svn commit: r196970 - in head/sys: cam/scsi
contrib/dev/acpica/executer dev/aac dev/ae dev/amr dev/ata
dev/ata/chipsets dev/ath dev/ath/ath_hal dev/bce dev/e1000
dev/ep dev/firewire dev/fxp dev/hpt...
Poul-Henning Kamp
phk at FreeBSD.org
Tue Sep 8 13:19:05 UTC 2009
Author: phk
Date: Tue Sep 8 13:19:05 2009
New Revision: 196970
URL: http://svn.freebsd.org/changeset/base/196970
Log:
Revert previous commit and add myself to the list of people who should
know better than to commit with a cat in the area.
Modified:
head/sys/cam/scsi/scsi_cd.c
head/sys/contrib/dev/acpica/executer/exfldio.c
head/sys/dev/aac/aac.c
head/sys/dev/ae/if_ae.c
head/sys/dev/amr/amr.c
head/sys/dev/ata/ata-raid.c
head/sys/dev/ata/chipsets/ata-acerlabs.c
head/sys/dev/ata/chipsets/ata-marvell.c
head/sys/dev/ath/ah_osdep.c
head/sys/dev/ath/ath_hal/ah.c
head/sys/dev/ath/ath_hal/ah_eeprom_v3.c
head/sys/dev/bce/if_bce.c
head/sys/dev/e1000/if_em.c
head/sys/dev/ep/if_ep.c
head/sys/dev/ep/if_epreg.h
head/sys/dev/firewire/fwcrom.c
head/sys/dev/firewire/fwdev.c
head/sys/dev/fxp/if_fxp.c
head/sys/dev/hptiop/hptiop.c
head/sys/dev/iir/iir.c
head/sys/dev/mpt/mpt_raid.c
head/sys/dev/msk/if_msk.c
head/sys/dev/usb/wlan/if_rum.c
head/sys/dev/usb/wlan/if_rumreg.h
head/sys/dev/usb/wlan/if_urtw.c
head/sys/dev/wi/if_wi.c
head/sys/fs/msdosfs/msdosfs_conv.c
head/sys/kern/kern_jail.c
head/sys/kern/kern_linker.c
head/sys/kern/kern_lock.c
head/sys/kern/kern_mutex.c
head/sys/net80211/ieee80211_action.c
head/sys/net80211/ieee80211_proto.h
head/sys/security/audit/audit_bsm_token.c
Modified: head/sys/cam/scsi/scsi_cd.c
==============================================================================
--- head/sys/cam/scsi/scsi_cd.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/cam/scsi/scsi_cd.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -2528,7 +2528,7 @@ cdioctl(struct disk *dp, u_long cmd, voi
error = cdgetmode(periph, ¶ms, AUDIO_PAGE);
if (error) {
- free(¶ms.mode_buf, M_SCSICD);
+ free(¶ms, M_SCSICD);
cam_periph_unlock(periph);
break;
}
Modified: head/sys/contrib/dev/acpica/executer/exfldio.c
==============================================================================
--- head/sys/contrib/dev/acpica/executer/exfldio.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/contrib/dev/acpica/executer/exfldio.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -992,7 +992,6 @@ AcpiExInsertIntoField (
/* Get initial Datum from the input buffer */
- /* XXX: Flexelint sees arg 9 for bufferlen 8 */
ACPI_MEMCPY (&RawDatum, Buffer,
ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
BufferLength - BufferOffset));
Modified: head/sys/dev/aac/aac.c
==============================================================================
--- head/sys/dev/aac/aac.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/aac/aac.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -3556,7 +3556,7 @@ aac_supported_features(struct aac_softc
* associated with the feature in the data field or perform whatever
* action needed indicates in the data field.
*/
- if (f.feat.fValue == 0) {
+ if (f.feat.fValue == 0) {
f.feat.fBits.largeLBA =
(sc->flags & AAC_FLAGS_LBA_64BIT) ? 1 : 0;
/* TODO: In the future, add other features state here as well */
Modified: head/sys/dev/ae/if_ae.c
==============================================================================
--- head/sys/dev/ae/if_ae.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/ae/if_ae.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -1662,7 +1662,6 @@ ae_stop_rxmac(ae_softc_t *sc)
/*
* Wait for IDLE state.
*/
- /* XXX: Flexelint "<" test with -- */
for (i = 0; i < AE_IDLE_TIMEOUT; i--) {
val = AE_READ_4(sc, AE_IDLE_REG);
if ((val & (AE_IDLE_RXMAC | AE_IDLE_DMAWRITE)) == 0)
@@ -1699,7 +1698,6 @@ ae_stop_txmac(ae_softc_t *sc)
/*
* Wait for IDLE state.
*/
- /* XXX: Flexelint "<" test with -- */
for (i = 0; i < AE_IDLE_TIMEOUT; i--) {
val = AE_READ_4(sc, AE_IDLE_REG);
if ((val & (AE_IDLE_TXMAC | AE_IDLE_DMAREAD)) == 0)
Modified: head/sys/dev/amr/amr.c
==============================================================================
--- head/sys/dev/amr/amr.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/amr/amr.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -527,7 +527,7 @@ amr_rescan_drives(struct cdev *dev)
sc->amr_drive[i].al_disk)) != 0)
goto shutdown_out;
- sc->amr_drive[i].al_disk = 0;
+ sc->amr_drive[i].al_disk = 0;
}
}
Modified: head/sys/dev/ata/ata-raid.c
==============================================================================
--- head/sys/dev/ata/ata-raid.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/ata/ata-raid.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -407,7 +407,7 @@ ata_raid_strategy(struct bio *bp)
if (rdp->status & AR_S_REBUILDING)
blk = ((lba / rdp->interleave) * rdp->width) * rdp->interleave +
(rdp->interleave * (drv % rdp->width)) +
- lba % rdp->interleave;
+ lba % rdp->interleave;;
if (bp->bio_cmd == BIO_READ) {
int src_online =
@@ -1138,7 +1138,6 @@ ata_raid_create(struct ata_ioc_raid_conf
rdp->type == AR_T_RAID5) {
int bit = 0;
- /* XXX: Flexelint not happy */
while (config->interleave >>= 1)
bit++;
rdp->interleave = 1 << bit;
Modified: head/sys/dev/ata/chipsets/ata-acerlabs.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-acerlabs.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/ata/chipsets/ata-acerlabs.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -127,7 +127,6 @@ ata_ali_chipinit(device_t dev)
RF_ACTIVE);
if (res->bars[i] == NULL) {
device_printf(dev, "Failed to allocate BAR %d\n", i);
- /* XXX: Flexelint: Reuse of for loop variable 'i' at 'line 124' could cause chaos */
for (i--; i >=0; i--)
bus_release_resource(dev, SYS_RES_IOPORT,
PCIR_BAR(i), res->bars[i]);
Modified: head/sys/dev/ata/chipsets/ata-marvell.c
==============================================================================
--- head/sys/dev/ata/chipsets/ata-marvell.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/ata/chipsets/ata-marvell.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -153,7 +153,7 @@ ata_marvell_pata_ch_attach(device_t dev)
return ENXIO;
/* dont use 32 bit PIO transfers */
- ch->flags |= ATA_USE_16BIT;
+ ch->flags |= ATA_USE_16BIT;
return 0;
}
Modified: head/sys/dev/ath/ah_osdep.c
==============================================================================
--- head/sys/dev/ath/ah_osdep.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/ath/ah_osdep.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -107,7 +107,6 @@ ath_hal_malloc(size_t size)
return malloc(size, M_ATH_HAL, M_NOWAIT | M_ZERO);
}
-/* XXX: FlexeLint return in void function ? */
void
ath_hal_free(void* p)
{
Modified: head/sys/dev/ath/ath_hal/ah.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/ath/ath_hal/ah.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -566,7 +566,6 @@ ath_hal_getregdump(struct ath_hal *ah, c
uint32_t *dp = dstbuf;
int i;
- /* XXX: FlexeLint: ">" test with ++ */
for (i = 0; space >= 2*sizeof(uint32_t); i++) {
u_int r = regs[i].start;
u_int e = regs[i].end;
Modified: head/sys/dev/ath/ath_hal/ah_eeprom_v3.c
==============================================================================
--- head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/ath/ath_hal/ah_eeprom_v3.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -1753,8 +1753,6 @@ legacyEepromGetSpurChan(struct ath_hal *
/*
* Reclaim any EEPROM-related storage.
*/
-
-/* XXX: FlexeLint: return in void function */
static void
legacyEepromDetach(struct ath_hal *ah)
{
Modified: head/sys/dev/bce/if_bce.c
==============================================================================
--- head/sys/dev/bce/if_bce.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/bce/if_bce.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -608,17 +608,17 @@ bce_print_adapter_info(struct bce_softc
#endif
if (sc->bce_flags & BCE_USING_MSI_FLAG) {
if (i > 0) printf("|");
- printf("MSI"); i++;
+ printf("MSI"); i++;
}
if (sc->bce_flags & BCE_USING_MSIX_FLAG) {
if (i > 0) printf("|");
- printf("MSI-X "); i++;
+ printf("MSI-X "); i++;
}
if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) {
if (i > 0) printf("|");
- printf("2.5G"); i++;
+ printf("2.5G"); i++;
}
if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) {
@@ -628,7 +628,7 @@ bce_print_adapter_info(struct bce_softc
printf(")\n");
}
- DBEXIT(BCE_VERBOSE_LOAD);
+ DBEXIT(BCE_VERBOSE_LOAD);
}
Modified: head/sys/dev/e1000/if_em.c
==============================================================================
--- head/sys/dev/e1000/if_em.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/e1000/if_em.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -2826,7 +2826,7 @@ em_allocate_pci_resources(struct adapter
* Setup the Legacy or MSI Interrupt handler
*
**********************************************************************/
-static int
+int
em_allocate_legacy(struct adapter *adapter)
{
device_t dev = adapter->dev;
Modified: head/sys/dev/ep/if_ep.c
==============================================================================
--- head/sys/dev/ep/if_ep.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/ep/if_ep.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -666,7 +666,6 @@ rescan:
sc->tx_underrun++;
#endif
} else {
- /* XXX: FlexeLint doesn't like ; */
if (status & TXS_JABBER);
else
++ifp->if_collisions;
Modified: head/sys/dev/ep/if_epreg.h
==============================================================================
--- head/sys/dev/ep/if_epreg.h Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/ep/if_epreg.h Tue Sep 8 13:19:05 2009 (r196970)
@@ -315,11 +315,7 @@
S_TX_AVAIL|S_RX_COMPLETE|S_RX_EARLY)
#define S_COMMAND_IN_PROGRESS (u_short) (0x1000)
-#define EP_BUSY_WAIT(sc) \
- do { \
- while (CSR_READ_2(sc, EP_STATUS) & S_COMMAND_IN_PROGRESS) \
- continue; \
- } while (0)
+#define EP_BUSY_WAIT(sc) while (CSR_READ_2(sc, EP_STATUS) & S_COMMAND_IN_PROGRESS)
/* Address Config. Register.
* Window 0/Port 06
Modified: head/sys/dev/firewire/fwcrom.c
==============================================================================
--- head/sys/dev/firewire/fwcrom.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/firewire/fwcrom.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -454,9 +454,9 @@ crom_add_simple_text(struct crom_src *sr
len = strlen(buf);
if (len > MAX_TEXT) {
#if defined(__DragonFly__) || __FreeBSD_version < 500000
- printf("text(%d) truncated to %d.\n", len, MAX_TEXT);
+ printf("text(%d) trancated to %d.\n", len, MAX_TEXT);
#else
- printf("text(%d) truncated to %td.\n", len, MAX_TEXT);
+ printf("text(%d) trancated to %td.\n", len, MAX_TEXT);
#endif
len = MAX_TEXT;
}
Modified: head/sys/dev/firewire/fwdev.c
==============================================================================
--- head/sys/dev/firewire/fwdev.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/firewire/fwdev.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -844,7 +844,6 @@ out:
err = copyout(ptr, crom_buf->ptr, len);
if (fwdev == NULL)
/* myself */
- /* XXX: Flexelint no sure about modified pointer */
free(ptr, M_FW);
break;
default:
Modified: head/sys/dev/fxp/if_fxp.c
==============================================================================
--- head/sys/dev/fxp/if_fxp.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/fxp/if_fxp.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -1597,7 +1597,6 @@ fxp_encap(struct fxp_softc *sc, struct m
cbp->tbd_number = nseg;
/* Configure TSO. */
if (m->m_pkthdr.csum_flags & CSUM_TSO) {
- /* XXX: FlexeLint: negative subscript */
cbp->tbd[-1].tb_size = htole32(m->m_pkthdr.tso_segsz << 16);
cbp->tbd[1].tb_size |= htole32(tcp_payload << 16);
cbp->ipcb_ip_schedule |= FXP_IPCB_LARGESEND_ENABLE |
Modified: head/sys/dev/hptiop/hptiop.c
==============================================================================
--- head/sys/dev/hptiop/hptiop.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/hptiop/hptiop.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -432,7 +432,6 @@ srb_complete:
sg_list), (u_int8_t *)&ccb->csio.sense_data,
MIN(dxfer, sizeof(ccb->csio.sense_data)));
} else {
- /* XXX: Flexelint arg2 is 16 bytes, arg3 is 32 */
memcpy(&ccb->csio.sense_data, &req->sg_list,
MIN(dxfer, sizeof(ccb->csio.sense_data)));
}
@@ -576,7 +575,6 @@ static void hptiop_request_callback_mv(s
ccb->ccb_h.status = CAM_BUSY;
break;
case IOP_RESULT_CHECK_CONDITION:
- /* XXX: FlexeLint: arg2=16b arg3=32 */
memcpy(&ccb->csio.sense_data, &req->sg_list,
MIN(req->dataxfer_length, sizeof(ccb->csio.sense_data)));
ccb->ccb_h.status = CAM_SCSI_STATUS_ERROR;
Modified: head/sys/dev/iir/iir.c
==============================================================================
--- head/sys/dev/iir/iir.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/iir/iir.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -1203,7 +1203,6 @@ gdt_internal_cache_cmd(struct gdt_softc
bzero( ccb->csio.data_ptr+copylen,
ccb->csio.dxfer_len - copylen );
page=((struct scsi_mode_sense_6 *)ccb->csio.cdb_io.cdb_bytes)->page;
- /* XXX: FlexeLint: why ?? */
switch (page) {
default:
GDT_DPRINTF(GDT_D_MISC, ("MODE_SENSE_6: page 0x%x\n", page));
Modified: head/sys/dev/mpt/mpt_raid.c
==============================================================================
--- head/sys/dev/mpt/mpt_raid.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/mpt/mpt_raid.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -562,7 +562,6 @@ mpt_raid_reply_frame_handler(struct mpt_
break;
}
action_result = REQ_TO_RAID_ACTION_RESULT(req);
- /* XXX: FlexeLint: ActionData is only 4 bytes */
memcpy(&action_result->action_data, &reply->ActionData,
sizeof(action_result->action_data));
action_result->action_status = le16toh(reply->ActionStatus);
Modified: head/sys/dev/msk/if_msk.c
==============================================================================
--- head/sys/dev/msk/if_msk.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/msk/if_msk.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -118,21 +118,26 @@ __FBSDID("$FreeBSD$");
#include <net/bpf.h>
#include <net/ethernet.h>
#include <net/if.h>
+#include <net/if_arp.h>
#include <net/if_dl.h>
#include <net/if_media.h>
#include <net/if_types.h>
#include <net/if_vlan_var.h>
#include <netinet/in.h>
+#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>
+#include <netinet/udp.h>
#include <machine/bus.h>
#include <machine/in_cksum.h>
#include <machine/resource.h>
#include <sys/rman.h>
+#include <dev/mii/mii.h>
#include <dev/mii/miivar.h>
+#include <dev/mii/brgphyreg.h>
#include <dev/pci/pcireg.h>
#include <dev/pci/pcivar.h>
Modified: head/sys/dev/usb/wlan/if_rum.c
==============================================================================
--- head/sys/dev/usb/wlan/if_rum.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/usb/wlan/if_rum.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -42,9 +42,12 @@ __FBSDID("$FreeBSD$");
#include <sys/kdb.h>
#include <machine/bus.h>
+#include <machine/resource.h>
+#include <sys/rman.h>
#include <net/bpf.h>
#include <net/if.h>
+#include <net/if_arp.h>
#include <net/ethernet.h>
#include <net/if_dl.h>
#include <net/if_media.h>
@@ -1486,7 +1489,7 @@ rum_rf_write(struct rum_softc *sc, uint8
return;
}
- tmp = RT2573_RF_BUSY | RT2573_RF_20BIT | ((val & 0xfffff) << 2) |
+ tmp = RT2573_RF_BUSY | RT2573_RF_20BIT | (val & 0xfffff) << 2 |
(reg & 3);
rum_write(sc, RT2573_PHY_CSR4, tmp);
Modified: head/sys/dev/usb/wlan/if_rumreg.h
==============================================================================
--- head/sys/dev/usb/wlan/if_rumreg.h Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/usb/wlan/if_rumreg.h Tue Sep 8 13:19:05 2009 (r196970)
@@ -139,7 +139,7 @@
#define RT2573_BBP_BUSY (1 << 16)
/* possible flags for register PHY_CSR4 */
#define RT2573_RF_20BIT (20 << 24)
-#define RT2573_RF_BUSY (1U << 31)
+#define RT2573_RF_BUSY (1 << 31)
/* LED values */
#define RT2573_LED_RADIO (1 << 8)
Modified: head/sys/dev/usb/wlan/if_urtw.c
==============================================================================
--- head/sys/dev/usb/wlan/if_urtw.c Tue Sep 8 13:16:55 2009 (r196969)
+++ head/sys/dev/usb/wlan/if_urtw.c Tue Sep 8 13:19:05 2009 (r196970)
@@ -61,8 +61,6 @@ __FBSDID("$FreeBSD$");
#include <dev/usb/wlan/if_urtwreg.h>
#include <dev/usb/wlan/if_urtwvar.h>
-#define nitems(a) (sizeof(a) / sizeof((a)[0]))
-
SYSCTL_NODE(_hw_usb, OID_AUTO, urtw, CTLFLAG_RW, 0, "USB Realtek 8187L");
#ifdef URTW_DEBUG
int urtw_debug = 0;
@@ -177,46 +175,6 @@ struct urtw_pair {
uint32_t val;
};
-static const uint8_t urtw_8187b_reg_table[][3] = {
- { 0xf0, 0x32, 0 }, { 0xf1, 0x32, 0 }, { 0xf2, 0x00, 0 },
- { 0xf3, 0x00, 0 }, { 0xf4, 0x32, 0 }, { 0xf5, 0x43, 0 },
- { 0xf6, 0x00, 0 }, { 0xf7, 0x00, 0 }, { 0xf8, 0x46, 0 },
- { 0xf9, 0xa4, 0 }, { 0xfa, 0x00, 0 }, { 0xfb, 0x00, 0 },
- { 0xfc, 0x96, 0 }, { 0xfd, 0xa4, 0 }, { 0xfe, 0x00, 0 },
- { 0xff, 0x00, 0 },
-
- { 0x58, 0x4b, 1 }, { 0x59, 0x00, 1 }, { 0x5a, 0x4b, 1 },
- { 0x5b, 0x00, 1 }, { 0x60, 0x4b, 1 }, { 0x61, 0x09, 1 },
- { 0x62, 0x4b, 1 }, { 0x63, 0x09, 1 }, { 0xce, 0x0f, 1 },
- { 0xcf, 0x00, 1 }, { 0xe0, 0xff, 1 }, { 0xe1, 0x0f, 1 },
- { 0xe2, 0x00, 1 }, { 0xf0, 0x4e, 1 }, { 0xf1, 0x01, 1 },
- { 0xf2, 0x02, 1 }, { 0xf3, 0x03, 1 }, { 0xf4, 0x04, 1 },
- { 0xf5, 0x05, 1 }, { 0xf6, 0x06, 1 }, { 0xf7, 0x07, 1 },
- { 0xf8, 0x08, 1 },
-
- { 0x4e, 0x00, 2 }, { 0x0c, 0x04, 2 }, { 0x21, 0x61, 2 },
- { 0x22, 0x68, 2 }, { 0x23, 0x6f, 2 }, { 0x24, 0x76, 2 },
- { 0x25, 0x7d, 2 }, { 0x26, 0x84, 2 }, { 0x27, 0x8d, 2 },
- { 0x4d, 0x08, 2 }, { 0x50, 0x05, 2 }, { 0x51, 0xf5, 2 },
- { 0x52, 0x04, 2 }, { 0x53, 0xa0, 2 }, { 0x54, 0x1f, 2 },
- { 0x55, 0x23, 2 }, { 0x56, 0x45, 2 }, { 0x57, 0x67, 2 },
- { 0x58, 0x08, 2 }, { 0x59, 0x08, 2 }, { 0x5a, 0x08, 2 },
- { 0x5b, 0x08, 2 }, { 0x60, 0x08, 2 }, { 0x61, 0x08, 2 },
- { 0x62, 0x08, 2 }, { 0x63, 0x08, 2 }, { 0x64, 0xcf, 2 },
- { 0x72, 0x56, 2 }, { 0x73, 0x9a, 2 },
-
- { 0x34, 0xf0, 0 }, { 0x35, 0x0f, 0 }, { 0x5b, 0x40, 0 },
- { 0x84, 0x88, 0 }, { 0x85, 0x24, 0 }, { 0x88, 0x54, 0 },
- { 0x8b, 0xb8, 0 }, { 0x8c, 0x07, 0 }, { 0x8d, 0x00, 0 },
- { 0x94, 0x1b, 0 }, { 0x95, 0x12, 0 }, { 0x96, 0x00, 0 },
- { 0x97, 0x06, 0 }, { 0x9d, 0x1a, 0 }, { 0x9f, 0x10, 0 },
- { 0xb4, 0x22, 0 }, { 0xbe, 0x80, 0 }, { 0xdb, 0x00, 0 },
- { 0xee, 0x00, 0 }, { 0x91, 0x03, 0 },
-
- { 0x4c, 0x00, 2 }, { 0x9f, 0x00, 3 }, { 0x8c, 0x01, 0 },
- { 0x8d, 0x10, 0 }, { 0x8e, 0x08, 0 }, { 0x8f, 0x00, 0 }
-};
-
static uint8_t urtw_8225_agc[] = {
0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9e, 0x9d, 0x9c, 0x9b,
0x9a, 0x99, 0x98, 0x97, 0x96, 0x95, 0x94, 0x93, 0x92, 0x91, 0x90,
@@ -232,6 +190,21 @@ static uint8_t urtw_8225_agc[] = {
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
};
+static uint8_t urtw_8225z2_agc[] = {
+ 0x5e, 0x5e, 0x5e, 0x5e, 0x5d, 0x5b, 0x59, 0x57, 0x55, 0x53, 0x51,
+ 0x4f, 0x4d, 0x4b, 0x49, 0x47, 0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b,
+ 0x39, 0x37, 0x35, 0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27, 0x25,
+ 0x23, 0x21, 0x1f, 0x1d, 0x1b, 0x19, 0x17, 0x15, 0x13, 0x11, 0x0f,
+ 0x0d, 0x0b, 0x09, 0x07, 0x05, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01,
+ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x19, 0x19,
+ 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x20, 0x21, 0x22, 0x23,
+ 0x24, 0x25, 0x26, 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2a,
+ 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d, 0x2d, 0x2d, 0x2d,
+ 0x2e, 0x2e, 0x2e, 0x2e, 0x2f, 0x2f, 0x2f, 0x30, 0x30, 0x31, 0x31,
+ 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31,
+ 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31
+};
+
static uint32_t urtw_8225_channel[] = {
0x0000, /* dummy channel 0 */
0x085c, /* 1 */
@@ -264,7 +237,7 @@ static struct urtw_pair urtw_8225_rf_par
{ 0x00, 0x0067 }, { 0x01, 0x0fe0 }, { 0x02, 0x044d }, { 0x03, 0x0441 },
{ 0x04, 0x0486 }, { 0x05, 0x0bc0 }, { 0x06, 0x0ae6 }, { 0x07, 0x082a },
{ 0x08, 0x001f }, { 0x09, 0x0334 }, { 0x0a, 0x0fd4 }, { 0x0b, 0x0391 },
- { 0x0c, 0x0050 }, { 0x0d, 0x06db }, { 0x0e, 0x0029 }, { 0x0f, 0x0914 }
+ { 0x0c, 0x0050 }, { 0x0d, 0x06db }, { 0x0e, 0x0029 }, { 0x0f, 0x0914 },
};
static struct urtw_pair urtw_8225_rf_part2[] = {
@@ -306,7 +279,7 @@ static uint16_t urtw_8225_rxgain[] = {
};
static uint8_t urtw_8225_threshold[] = {
- 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd
+ 0x8d, 0x8d, 0x8d, 0x8d, 0x9d, 0xad, 0xbd,
};
static uint8_t urtw_8225_tx_gain_cck_ofdm[] = {
@@ -331,29 +304,10 @@ static uint8_t urtw_8225_txpwr_cck_ch14[
0x2b, 0x2a, 0x25, 0x15, 0x00, 0x00, 0x00, 0x00
};
-static uint8_t urtw_8225_txpwr_ofdm[] = {
+static uint8_t urtw_8225_txpwr_ofdm[]={
0x80, 0x90, 0xa2, 0xb5, 0xcb, 0xe4
};
-static uint8_t urtw_8225z2_agc[] = {
- 0x5e, 0x5e, 0x5e, 0x5e, 0x5d, 0x5b, 0x59, 0x57,
- 0x55, 0x53, 0x51, 0x4f, 0x4d, 0x4b, 0x49, 0x47,
- 0x45, 0x43, 0x41, 0x3f, 0x3d, 0x3b, 0x39, 0x37,
- 0x35, 0x33, 0x31, 0x2f, 0x2d, 0x2b, 0x29, 0x27,
- 0x25, 0x23, 0x21, 0x1f, 0x1d, 0x1b, 0x19, 0x17,
- 0x15, 0x13, 0x11, 0x0f, 0x0d, 0x0b, 0x09, 0x07,
- 0x05, 0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
- 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19, 0x19,
- 0x19, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26,
- 0x26, 0x27, 0x27, 0x28, 0x28, 0x29, 0x2a, 0x2a,
- 0x2a, 0x2b, 0x2b, 0x2b, 0x2c, 0x2c, 0x2c, 0x2d,
- 0x2d, 0x2d, 0x2d, 0x2e, 0x2e, 0x2e, 0x2e, 0x2f,
- 0x2f, 0x2f, 0x30, 0x30, 0x31, 0x31, 0x31, 0x31,
- 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31,
- 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31, 0x31
-};
-
static uint8_t urtw_8225v2_gain_bg[]={
0x23, 0x15, 0xa5, /* -82-1dbm */
0x23, 0x15, 0xb5, /* -82-2dbm */
@@ -456,7 +410,11 @@ static uint8_t urtw_8225v2_tx_gain_cck_o
0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11,
0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
- 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23
+ 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23,
+};
+
+static uint8_t urtw_8225v2_txpwr_cck[] = {
+ 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04
};
static uint8_t urtw_8225v2_txpwr_cck_ch14[] = {
@@ -470,10 +428,6 @@ static uint8_t urtw_8225v2b_txpwr_cck[]
0x26, 0x25, 0x21, 0x1b, 0x14, 0x0d, 0x06, 0x03
};
-static uint8_t urtw_8225v2_txpwr_cck[] = {
- 0x36, 0x35, 0x2e, 0x25, 0x1c, 0x12, 0x09, 0x04
-};
-
static uint8_t urtw_8225v2b_txpwr_cck_ch14[] = {
0x36, 0x35, 0x2e, 0x1b, 0x00, 0x00, 0x00, 0x00,
0x30, 0x2f, 0x29, 0x15, 0x00, 0x00, 0x00, 0x00,
@@ -487,6 +441,40 @@ static struct urtw_pair urtw_ratetable[]
{ 96, 10 }, { 108, 11 }
};
+static const uint8_t urtw_8187b_reg_table[][3] = {
+ { 0xf0, 0x32, 0 }, { 0xf1, 0x32, 0 }, { 0xf2, 0x00, 0 },
+ { 0xf3, 0x00, 0 }, { 0xf4, 0x32, 0 }, { 0xf5, 0x43, 0 },
+ { 0xf6, 0x00, 0 }, { 0xf7, 0x00, 0 }, { 0xf8, 0x46, 0 },
+ { 0xf9, 0xa4, 0 }, { 0xfa, 0x00, 0 }, { 0xfb, 0x00, 0 },
+ { 0xfc, 0x96, 0 }, { 0xfd, 0xa4, 0 }, { 0xfe, 0x00, 0 },
+ { 0xff, 0x00, 0 }, { 0x58, 0x4b, 1 }, { 0x59, 0x00, 1 },
+ { 0x5a, 0x4b, 1 }, { 0x5b, 0x00, 1 }, { 0x60, 0x4b, 1 },
+ { 0x61, 0x09, 1 }, { 0x62, 0x4b, 1 }, { 0x63, 0x09, 1 },
+ { 0xce, 0x0f, 1 }, { 0xcf, 0x00, 1 }, { 0xe0, 0xff, 1 },
+ { 0xe1, 0x0f, 1 }, { 0xe2, 0x00, 1 }, { 0xf0, 0x4e, 1 },
+ { 0xf1, 0x01, 1 }, { 0xf2, 0x02, 1 }, { 0xf3, 0x03, 1 },
+ { 0xf4, 0x04, 1 }, { 0xf5, 0x05, 1 }, { 0xf6, 0x06, 1 },
+ { 0xf7, 0x07, 1 }, { 0xf8, 0x08, 1 }, { 0x4e, 0x00, 2 },
+ { 0x0c, 0x04, 2 }, { 0x21, 0x61, 2 }, { 0x22, 0x68, 2 },
+ { 0x23, 0x6f, 2 }, { 0x24, 0x76, 2 }, { 0x25, 0x7d, 2 },
+ { 0x26, 0x84, 2 }, { 0x27, 0x8d, 2 }, { 0x4d, 0x08, 2 },
+ { 0x50, 0x05, 2 }, { 0x51, 0xf5, 2 }, { 0x52, 0x04, 2 },
+ { 0x53, 0xa0, 2 }, { 0x54, 0x1f, 2 }, { 0x55, 0x23, 2 },
+ { 0x56, 0x45, 2 }, { 0x57, 0x67, 2 }, { 0x58, 0x08, 2 },
+ { 0x59, 0x08, 2 }, { 0x5a, 0x08, 2 }, { 0x5b, 0x08, 2 },
+ { 0x60, 0x08, 2 }, { 0x61, 0x08, 2 }, { 0x62, 0x08, 2 },
+ { 0x63, 0x08, 2 }, { 0x64, 0xcf, 2 }, { 0x72, 0x56, 2 },
+ { 0x73, 0x9a, 2 }, { 0x34, 0xf0, 0 }, { 0x35, 0x0f, 0 },
+ { 0x5b, 0x40, 0 }, { 0x84, 0x88, 0 }, { 0x85, 0x24, 0 },
+ { 0x88, 0x54, 0 }, { 0x8b, 0xb8, 0 }, { 0x8c, 0x07, 0 },
+ { 0x8d, 0x00, 0 }, { 0x94, 0x1b, 0 }, { 0x95, 0x12, 0 },
+ { 0x96, 0x00, 0 }, { 0x97, 0x06, 0 }, { 0x9d, 0x1a, 0 },
+ { 0x9f, 0x10, 0 }, { 0xb4, 0x22, 0 }, { 0xbe, 0x80, 0 },
+ { 0xdb, 0x00, 0 }, { 0xee, 0x00, 0 }, { 0x91, 0x03, 0 },
+ { 0x4c, 0x00, 2 }, { 0x9f, 0x00, 3 }, { 0x8c, 0x01, 0 },
+ { 0x8d, 0x10, 0 }, { 0x8e, 0x08, 0 }, { 0x8f, 0x00, 0 }
+};
+
static usb_callback_t urtw_bulk_rx_callback;
static usb_callback_t urtw_bulk_tx_callback;
@@ -1046,6 +1034,7 @@ urtw_init(void *arg)
static usb_error_t
urtw_adapter_start_b(struct urtw_softc *sc)
{
+#define N(a) (sizeof(a) / sizeof((a)[0]))
int i;
uint8_t data8;
usb_error_t error;
@@ -1109,7 +1098,7 @@ urtw_adapter_start_b(struct urtw_softc *
goto fail;
urtw_write8_m(sc, URTW_WPA_CONFIG, 0);
- for (i = 0; i < nitems(urtw_8187b_reg_table); i++) {
+ for (i = 0; i < N(urtw_8187b_reg_table); i++) {
error = urtw_write8_i(sc, urtw_8187b_reg_table[i][0],
urtw_8187b_reg_table[i][1], urtw_8187b_reg_table[i][2]);
if (error)
@@ -1219,6 +1208,7 @@ urtw_adapter_start_b(struct urtw_softc *
fail:
return (error);
+#undef N
}
static usb_error_t
@@ -1283,6 +1273,19 @@ fail:
return (error);
}
+static usb_error_t
+urtw_set_mode(struct urtw_softc *sc, uint32_t mode)
+{
+ uint8_t data;
+ usb_error_t error;
+
+ urtw_read8_m(sc, URTW_EPROM_CMD, &data);
+ data = (data & ~URTW_EPROM_CMD_MASK) | (mode << URTW_EPROM_CMD_SHIFT);
+ data = data & ~(URTW_EPROM_CS | URTW_EPROM_CK);
+ urtw_write8_m(sc, URTW_EPROM_CMD, data);
+fail:
+ return (error);
+}
static usb_error_t
urtw_8187b_cmd_reset(struct urtw_softc *sc)
@@ -1392,6 +1395,56 @@ urtw_write32_i(struct urtw_softc *sc, in
}
static void
+urtw_stop_locked(struct ifnet *ifp, int disable)
+{
+ struct urtw_softc *sc = ifp->if_softc;
+ uint8_t data8;
+ usb_error_t error;
+
+ (void)disable;
+ ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
+
+ error = urtw_intr_disable(sc);
+ if (error)
+ goto fail;
+ urtw_read8_m(sc, URTW_CMD, &data8);
+ data8 &= ~(URTW_CMD_RX_ENABLE | URTW_CMD_TX_ENABLE);
+ urtw_write8_m(sc, URTW_CMD, data8);
+
+ error = sc->sc_rf_stop(sc);
+ if (error != 0)
+ goto fail;
+
+ error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG);
+ if (error)
+ goto fail;
+ urtw_read8_m(sc, URTW_CONFIG4, &data8);
+ urtw_write8_m(sc, URTW_CONFIG4, data8 | URTW_CONFIG4_VCOOFF);
+ error = urtw_set_mode(sc, URTW_EPROM_CMD_NORMAL);
+ if (error)
+ goto fail;
+fail:
+ if (error)
+ device_printf(sc->sc_dev, "failed to stop (%s)\n",
+ usbd_errstr(error));
+
+ usb_callout_stop(&sc->sc_led_ch);
+ callout_stop(&sc->sc_watchdog_ch);
+
+ urtw_abort_xfers(sc);
+}
+
+static void
+urtw_stop(struct ifnet *ifp, int disable)
+{
+ struct urtw_softc *sc = ifp->if_softc;
+
+ URTW_LOCK(sc);
+ urtw_stop_locked(ifp, disable);
+ URTW_UNLOCK(sc);
+}
+
+static void
urtw_abort_xfers(struct urtw_softc *sc)
{
int i, max;
@@ -1896,198 +1949,105 @@ urtw_set_multi(void *arg)
ifp->if_flags |= IFF_ALLMULTI;
}
-
static usb_error_t
-urtw_get_macaddr(struct urtw_softc *sc)
+urtw_set_rate(struct urtw_softc *sc)
{
- uint32_t data;
+ int i, basic_rate, min_rr_rate, max_rr_rate;
+ uint16_t data;
usb_error_t error;
- error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR, &data);
- if (error != 0)
- goto fail;
- sc->sc_bssid[0] = data & 0xff;
- sc->sc_bssid[1] = (data & 0xff00) >> 8;
- error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 1, &data);
- if (error != 0)
- goto fail;
- sc->sc_bssid[2] = data & 0xff;
- sc->sc_bssid[3] = (data & 0xff00) >> 8;
- error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 2, &data);
- if (error != 0)
- goto fail;
- sc->sc_bssid[4] = data & 0xff;
- sc->sc_bssid[5] = (data & 0xff00) >> 8;
+ basic_rate = urtw_rate2rtl(48);
+ min_rr_rate = urtw_rate2rtl(12);
+ max_rr_rate = urtw_rate2rtl(48);
+
+ urtw_write8_m(sc, URTW_RESP_RATE,
+ max_rr_rate << URTW_RESP_MAX_RATE_SHIFT |
+ min_rr_rate << URTW_RESP_MIN_RATE_SHIFT);
+
+ urtw_read16_m(sc, URTW_BRSR, &data);
+ data &= ~URTW_BRSR_MBR_8185;
+
+ for (i = 0; i <= basic_rate; i++)
+ data |= (1 << i);
+
+ urtw_write16_m(sc, URTW_BRSR, data);
fail:
return (error);
}
-static usb_error_t
-urtw_eprom_read32(struct urtw_softc *sc, uint32_t addr, uint32_t *data)
+static uint16_t
+urtw_rate2rtl(int rate)
{
-#define URTW_READCMD_LEN 3
- int addrlen, i;
- int16_t addrstr[8], data16, readcmd[] = { 1, 1, 0 };
- usb_error_t error;
-
- /* NB: make sure the buffer is initialized */
- *data = 0;
-
- /* enable EPROM programming */
- urtw_write8_m(sc, URTW_EPROM_CMD, URTW_EPROM_CMD_PROGRAM_MODE);
- DELAY(URTW_EPROM_DELAY);
+#define N(a) (sizeof(a) / sizeof((a)[0]))
+ int i;
- error = urtw_eprom_cs(sc, URTW_EPROM_ENABLE);
- if (error != 0)
- goto fail;
- error = urtw_eprom_ck(sc);
- if (error != 0)
- goto fail;
- error = urtw_eprom_sendbits(sc, readcmd, URTW_READCMD_LEN);
- if (error != 0)
- goto fail;
- if (sc->sc_epromtype == URTW_EEPROM_93C56) {
- addrlen = 8;
- addrstr[0] = addr & (1 << 7);
- addrstr[1] = addr & (1 << 6);
- addrstr[2] = addr & (1 << 5);
- addrstr[3] = addr & (1 << 4);
- addrstr[4] = addr & (1 << 3);
- addrstr[5] = addr & (1 << 2);
- addrstr[6] = addr & (1 << 1);
- addrstr[7] = addr & (1 << 0);
- } else {
- addrlen=6;
- addrstr[0] = addr & (1 << 5);
- addrstr[1] = addr & (1 << 4);
- addrstr[2] = addr & (1 << 3);
- addrstr[3] = addr & (1 << 2);
- addrstr[4] = addr & (1 << 1);
- addrstr[5] = addr & (1 << 0);
+ for (i = 0; i < N(urtw_ratetable); i++) {
+ if (rate == urtw_ratetable[i].reg)
+ return urtw_ratetable[i].val;
}
- error = urtw_eprom_sendbits(sc, addrstr, addrlen);
- if (error != 0)
- goto fail;
- error = urtw_eprom_writebit(sc, 0);
- if (error != 0)
- goto fail;
+ return (3);
+#undef N
+}
- for (i = 0; i < 16; i++) {
- error = urtw_eprom_ck(sc);
- if (error != 0)
- goto fail;
- error = urtw_eprom_readbit(sc, &data16);
- if (error != 0)
- goto fail;
+static uint16_t
+urtw_rtl2rate(int rate)
+{
+#define N(a) (sizeof(a) / sizeof((a)[0]))
+ int i;
- (*data) |= (data16 << (15 - i));
+ for (i = 0; i < N(urtw_ratetable); i++) {
+ if (rate == urtw_ratetable[i].val)
+ return urtw_ratetable[i].reg;
}
- error = urtw_eprom_cs(sc, URTW_EPROM_DISABLE);
- if (error != 0)
- goto fail;
- error = urtw_eprom_ck(sc);
- if (error != 0)
- goto fail;
-
- /* now disable EPROM programming */
- urtw_write8_m(sc, URTW_EPROM_CMD, URTW_EPROM_CMD_NORMAL_MODE);
-fail:
- return (error);
-#undef URTW_READCMD_LEN
+ return (0);
+#undef N
}
static usb_error_t
-urtw_eprom_readbit(struct urtw_softc *sc, int16_t *data)
+urtw_update_msr(struct urtw_softc *sc)
{
- uint8_t data8;
+ struct ifnet *ifp = sc->sc_ifp;
+ struct ieee80211com *ic = ifp->if_l2com;
+ uint8_t data;
usb_error_t error;
- urtw_read8_m(sc, URTW_EPROM_CMD, &data8);
- *data = (data8 & URTW_EPROM_READBIT) ? 1 : 0;
- DELAY(URTW_EPROM_DELAY);
+ urtw_read8_m(sc, URTW_MSR, &data);
+ data &= ~URTW_MSR_LINK_MASK;
+
+ if (sc->sc_state == IEEE80211_S_RUN) {
+ switch (ic->ic_opmode) {
+ case IEEE80211_M_STA:
+ case IEEE80211_M_MONITOR:
+ data |= URTW_MSR_LINK_STA;
+ if (sc->sc_flags & URTW_RTL8187B)
+ data |= URTW_MSR_LINK_ENEDCA;
+ break;
+ case IEEE80211_M_IBSS:
+ data |= URTW_MSR_LINK_ADHOC;
+ break;
+ case IEEE80211_M_HOSTAP:
+ data |= URTW_MSR_LINK_HOSTAP;
+ break;
+ default:
+ panic("unsupported operation mode 0x%x\n",
+ ic->ic_opmode);
+ /* never reach */
+ }
+ } else
+ data |= URTW_MSR_LINK_NONE;
+ urtw_write8_m(sc, URTW_MSR, data);
fail:
return (error);
}
static usb_error_t
-urtw_eprom_sendbits(struct urtw_softc *sc, int16_t *buf, int buflen)
+urtw_read8_c(struct urtw_softc *sc, int val, uint8_t *data)
{
- int i = 0;
- usb_error_t error = 0;
-
- for (i = 0; i < buflen; i++) {
- error = urtw_eprom_writebit(sc, buf[i]);
- if (error != 0)
- goto fail;
- error = urtw_eprom_ck(sc);
- if (error != 0)
- goto fail;
- }
-fail:
- return (error);
-}
-
-static usb_error_t
-urtw_eprom_writebit(struct urtw_softc *sc, int16_t bit)
-{
- uint8_t data;
- usb_error_t error;
-
- urtw_read8_m(sc, URTW_EPROM_CMD, &data);
- if (bit != 0)
- urtw_write8_m(sc, URTW_EPROM_CMD, data | URTW_EPROM_WRITEBIT);
- else
- urtw_write8_m(sc, URTW_EPROM_CMD, data & ~URTW_EPROM_WRITEBIT);
- DELAY(URTW_EPROM_DELAY);
-fail:
- return (error);
-}
-
-static usb_error_t
-urtw_eprom_ck(struct urtw_softc *sc)
-{
- uint8_t data;
- usb_error_t error;
-
- /* masking */
- urtw_read8_m(sc, URTW_EPROM_CMD, &data);
- urtw_write8_m(sc, URTW_EPROM_CMD, data | URTW_EPROM_CK);
- DELAY(URTW_EPROM_DELAY);
- /* unmasking */
- urtw_read8_m(sc, URTW_EPROM_CMD, &data);
- urtw_write8_m(sc, URTW_EPROM_CMD, data & ~URTW_EPROM_CK);
- DELAY(URTW_EPROM_DELAY);
-fail:
- return (error);
-}
-
-
-static usb_error_t
-urtw_eprom_cs(struct urtw_softc *sc, int able)
-{
- uint8_t data;
- usb_error_t error;
-
- urtw_read8_m(sc, URTW_EPROM_CMD, &data);
- if (able == URTW_EPROM_ENABLE)
- urtw_write8_m(sc, URTW_EPROM_CMD, data | URTW_EPROM_CS);
- else
- urtw_write8_m(sc, URTW_EPROM_CMD, data & ~URTW_EPROM_CS);
- DELAY(URTW_EPROM_DELAY);
-fail:
- return (error);
-}
-
-
-
-static usb_error_t
-urtw_read8_c(struct urtw_softc *sc, int val, uint8_t *data)
-{
- struct usb_device_request req;
- usb_error_t error;
+ struct usb_device_request req;
+ usb_error_t error;
URTW_ASSERT_LOCKED(sc);
@@ -2102,22 +2062,6 @@ urtw_read8_c(struct urtw_softc *sc, int
}
static usb_error_t
-urtw_read8e(struct urtw_softc *sc, int val, uint8_t *data)
-{
- struct usb_device_request req;
- usb_error_t error;
-
- req.bmRequestType = UT_READ_VENDOR_DEVICE;
- req.bRequest = URTW_8187_GETREGS_REQ;
- USETW(req.wValue, val | 0xfe00);
- USETW(req.wIndex, 0);
- USETW(req.wLength, sizeof(uint8_t));
-
- error = urtw_do_request(sc, &req, data);
- return (error);
-}
-
-static usb_error_t
urtw_read16_c(struct urtw_softc *sc, int val, uint16_t *data)
{
struct usb_device_request req;
@@ -2170,20 +2114,6 @@ urtw_write8_c(struct urtw_softc *sc, int
}
static usb_error_t
-urtw_write8e(struct urtw_softc *sc, int val, uint8_t data)
-{
- struct usb_device_request req;
-
- req.bmRequestType = UT_WRITE_VENDOR_DEVICE;
- req.bRequest = URTW_8187_SETREGS_REQ;
- USETW(req.wValue, val | 0xfe00);
- USETW(req.wIndex, 0);
- USETW(req.wLength, sizeof(uint8_t));
-
- return (urtw_do_request(sc, &req, &data));
-}
-
-static usb_error_t
urtw_write16_c(struct urtw_softc *sc, int val, uint16_t data)
{
struct usb_device_request req;
@@ -2216,180 +2146,308 @@ urtw_write32_c(struct urtw_softc *sc, in
}
static usb_error_t
-urtw_set_mode(struct urtw_softc *sc, uint32_t mode)
+urtw_get_macaddr(struct urtw_softc *sc)
{
- uint8_t data;
+ uint32_t data;
usb_error_t error;
- urtw_read8_m(sc, URTW_EPROM_CMD, &data);
- data = (data & ~URTW_EPROM_CMD_MASK) | (mode << URTW_EPROM_CMD_SHIFT);
- data = data & ~(URTW_EPROM_CS | URTW_EPROM_CK);
- urtw_write8_m(sc, URTW_EPROM_CMD, data);
+ error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR, &data);
+ if (error != 0)
+ goto fail;
+ sc->sc_bssid[0] = data & 0xff;
+ sc->sc_bssid[1] = (data & 0xff00) >> 8;
+ error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 1, &data);
+ if (error != 0)
+ goto fail;
+ sc->sc_bssid[2] = data & 0xff;
+ sc->sc_bssid[3] = (data & 0xff00) >> 8;
+ error = urtw_eprom_read32(sc, URTW_EPROM_MACADDR + 2, &data);
+ if (error != 0)
+ goto fail;
+ sc->sc_bssid[4] = data & 0xff;
+ sc->sc_bssid[5] = (data & 0xff00) >> 8;
fail:
return (error);
}
static usb_error_t
-urtw_8180_set_anaparam(struct urtw_softc *sc, uint32_t val)
+urtw_eprom_read32(struct urtw_softc *sc, uint32_t addr, uint32_t *data)
{
- uint8_t data;
+#define URTW_READCMD_LEN 3
+ int addrlen, i;
+ int16_t addrstr[8], data16, readcmd[] = { 1, 1, 0 };
usb_error_t error;
- error = urtw_set_mode(sc, URTW_EPROM_CMD_CONFIG);
- if (error)
+ /* NB: make sure the buffer is initialized */
+ *data = 0;
+
+ /* enable EPROM programming */
+ urtw_write8_m(sc, URTW_EPROM_CMD, URTW_EPROM_CMD_PROGRAM_MODE);
+ DELAY(URTW_EPROM_DELAY);
+
+ error = urtw_eprom_cs(sc, URTW_EPROM_ENABLE);
+ if (error != 0)
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-head
mailing list