Lines 313-319
Link Here
|
313 |
|
313 |
|
314 |
sc->sc_dev = dev; |
314 |
sc->sc_dev = dev; |
315 |
|
315 |
|
316 |
#ifdef WPI_DEBUG |
316 |
#ifdef WPI_DEBUG |
317 |
error = resource_int_value(device_get_name(sc->sc_dev), |
317 |
error = resource_int_value(device_get_name(sc->sc_dev), |
318 |
device_get_unit(sc->sc_dev), "debug", &(sc->sc_debug)); |
318 |
device_get_unit(sc->sc_dev), "debug", &(sc->sc_debug)); |
319 |
if (error != 0) |
319 |
if (error != 0) |
Lines 455-474
Link Here
|
455 |
device_printf(dev, "could not read EEPROM, error %d\n", |
455 |
device_printf(dev, "could not read EEPROM, error %d\n", |
456 |
error); |
456 |
error); |
457 |
goto fail; |
457 |
goto fail; |
458 |
} |
458 |
} |
459 |
|
459 |
|
460 |
#ifdef WPI_DEBUG |
460 |
#ifdef WPI_DEBUG |
461 |
if (bootverbose) { |
461 |
if (bootverbose) { |
462 |
device_printf(sc->sc_dev, "Regulatory Domain: %.4s\n", sc->domain); |
462 |
device_printf(sc->sc_dev, "Regulatory Domain: %.4s\n", |
463 |
device_printf(sc->sc_dev, "Hardware Type: %c\n", |
463 |
sc->domain); |
464 |
sc->type > 1 ? 'B': '?'); |
464 |
device_printf(sc->sc_dev, "Hardware Type: %c\n", |
465 |
device_printf(sc->sc_dev, "Hardware Revision: %c\n", |
465 |
sc->type > 1 ? 'B': '?'); |
466 |
((le16toh(sc->rev) & 0xf0) == 0xd0) ? 'D': '?'); |
466 |
device_printf(sc->sc_dev, "Hardware Revision: %c\n", |
467 |
device_printf(sc->sc_dev, "SKU %s support 802.11a\n", |
467 |
((le16toh(sc->rev) & 0xf0) == 0xd0) ? 'D': '?'); |
468 |
supportsa ? "does" : "does not"); |
468 |
device_printf(sc->sc_dev, "SKU %s support 802.11a\n", |
|
|
469 |
supportsa ? "does" : "does not"); |
469 |
|
470 |
|
470 |
/* XXX hw_config uses the PCIDEV for the Hardware rev. Must check |
471 |
/* XXX hw_config uses the PCIDEV for the Hardware rev. Must |
471 |
what sc->rev really represents - benjsc 20070615 */ |
472 |
check what sc->rev really represents - benjsc 20070615 */ |
472 |
} |
473 |
} |
473 |
#endif |
474 |
#endif |
474 |
|
475 |
|
Lines 558-564
Link Here
|
558 |
static void |
559 |
static void |
559 |
wpi_sysctlattach(struct wpi_softc *sc) |
560 |
wpi_sysctlattach(struct wpi_softc *sc) |
560 |
{ |
561 |
{ |
561 |
#ifdef WPI_DEBUG |
562 |
#ifdef WPI_DEBUG |
562 |
struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev); |
563 |
struct sysctl_ctx_list *ctx = device_get_sysctl_ctx(sc->sc_dev); |
563 |
struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev); |
564 |
struct sysctl_oid *tree = device_get_sysctl_tree(sc->sc_dev); |
564 |
|
565 |
|
Lines 725-731
Link Here
|
725 |
/* Spin until we actually get the lock. */ |
726 |
/* Spin until we actually get the lock. */ |
726 |
for (ntries = 0; ntries < 1000; ntries++) { |
727 |
for (ntries = 0; ntries < 1000; ntries++) { |
727 |
if ((WPI_READ(sc, WPI_GP_CNTRL) & |
728 |
if ((WPI_READ(sc, WPI_GP_CNTRL) & |
728 |
(WPI_GP_CNTRL_MAC_ACCESS_ENA | WPI_GP_CNTRL_SLEEP)) == |
729 |
(WPI_GP_CNTRL_MAC_ACCESS_ENA | WPI_GP_CNTRL_SLEEP)) == |
729 |
WPI_GP_CNTRL_MAC_ACCESS_ENA) |
730 |
WPI_GP_CNTRL_MAC_ACCESS_ENA) |
730 |
return 0; |
731 |
return 0; |
731 |
DELAY(10); |
732 |
DELAY(10); |
Lines 957-972
Link Here
|
957 |
} |
958 |
} |
958 |
|
959 |
|
959 |
/* Create RX buffer DMA tag. */ |
960 |
/* Create RX buffer DMA tag. */ |
960 |
error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, |
961 |
error = bus_dma_tag_create(bus_get_dma_tag(sc->sc_dev), 1, 0, |
961 |
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, |
962 |
BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL, |
962 |
MJUMPAGESIZE, 1, MJUMPAGESIZE, BUS_DMA_NOWAIT, NULL, NULL, |
963 |
MJUMPAGESIZE, 1, MJUMPAGESIZE, BUS_DMA_NOWAIT, NULL, NULL, |
963 |
&ring->data_dmat); |
964 |
&ring->data_dmat); |
964 |
if (error != 0) { |
965 |
if (error != 0) { |
965 |
device_printf(sc->sc_dev, |
966 |
device_printf(sc->sc_dev, |
966 |
"%s: could not create RX buf DMA tag, error %d\n", |
967 |
"%s: could not create RX buf DMA tag, error %d\n", |
967 |
__func__, error); |
968 |
__func__, error); |
968 |
goto fail; |
969 |
goto fail; |
969 |
} |
970 |
} |
970 |
|
971 |
|
971 |
/* |
972 |
/* |
972 |
* Allocate and map RX buffers. |
973 |
* Allocate and map RX buffers. |
Lines 2028-2035
Link Here
|
2028 |
} |
2029 |
} |
2029 |
case WPI_STATE_CHANGED: |
2030 |
case WPI_STATE_CHANGED: |
2030 |
{ |
2031 |
{ |
2031 |
bus_dmamap_sync(sc->rxq.data_dmat, data->map, |
2032 |
bus_dmamap_sync(sc->rxq.data_dmat, data->map, |
2032 |
BUS_DMASYNC_POSTREAD); |
2033 |
BUS_DMASYNC_POSTREAD); |
2033 |
|
2034 |
|
2034 |
uint32_t *status = (uint32_t *)(desc + 1); |
2035 |
uint32_t *status = (uint32_t *)(desc + 1); |
2035 |
|
2036 |
|
Lines 2083-2089
Link Here
|
2083 |
* Process an INT_WAKEUP interrupt raised when the microcontroller wakes up |
2084 |
* Process an INT_WAKEUP interrupt raised when the microcontroller wakes up |
2084 |
* from power-down sleep mode. |
2085 |
* from power-down sleep mode. |
2085 |
*/ |
2086 |
*/ |
2086 |
static void |
2087 |
static void |
2087 |
wpi_wakeup_intr(struct wpi_softc *sc) |
2088 |
wpi_wakeup_intr(struct wpi_softc *sc) |
2088 |
{ |
2089 |
{ |
2089 |
int qid; |
2090 |
int qid; |
Lines 2127-2138
Link Here
|
2127 |
WPI_FW_DATA_BASE + WPI_FW_DATA_MAXSZ) { |
2128 |
WPI_FW_DATA_BASE + WPI_FW_DATA_MAXSZ) { |
2128 |
printf("%s: bad firmware error log address 0x%08x\n", __func__, |
2129 |
printf("%s: bad firmware error log address 0x%08x\n", __func__, |
2129 |
sc->errptr); |
2130 |
sc->errptr); |
2130 |
return; |
2131 |
return; |
2131 |
} |
2132 |
} |
2132 |
if (wpi_nic_lock(sc) != 0) { |
2133 |
if (wpi_nic_lock(sc) != 0) { |
2133 |
printf("%s: could not read firmware error log\n", __func__); |
2134 |
printf("%s: could not read firmware error log\n", __func__); |
2134 |
return; |
2135 |
return; |
2135 |
} |
2136 |
} |
2136 |
/* Read number of entries in the log. */ |
2137 |
/* Read number of entries in the log. */ |
2137 |
count = wpi_mem_read(sc, sc->errptr); |
2138 |
count = wpi_mem_read(sc, sc->errptr); |
2138 |
if (count == 0 || count * sizeof (dump) > WPI_FW_DATA_MAXSZ) { |
2139 |
if (count == 0 || count * sizeof (dump) > WPI_FW_DATA_MAXSZ) { |
Lines 2381-2387
Link Here
|
2381 |
} else { |
2382 |
} else { |
2382 |
qos = 0; |
2383 |
qos = 0; |
2383 |
tid = 0; |
2384 |
tid = 0; |
2384 |
} |
2385 |
} |
2385 |
ac = M_WME_GETAC(m); |
2386 |
ac = M_WME_GETAC(m); |
2386 |
|
2387 |
|
2387 |
chan = (ni->ni_chan != IEEE80211_CHAN_ANYC) ? |
2388 |
chan = (ni->ni_chan != IEEE80211_CHAN_ANYC) ? |
Lines 3233-3243
Link Here
|
3233 |
struct ieee80211_channel *c, int ridx) |
3234 |
struct ieee80211_channel *c, int ridx) |
3234 |
{ |
3235 |
{ |
3235 |
/* Fixed-point arithmetic division using a n-bit fractional part. */ |
3236 |
/* Fixed-point arithmetic division using a n-bit fractional part. */ |
3236 |
#define fdivround(a, b, n) \ |
3237 |
#define fdivround(a, b, n) \ |
3237 |
((((1 << n) * (a)) / (b) + (1 << n) / 2) / (1 << n)) |
3238 |
((((1 << n) * (a)) / (b) + (1 << n) / 2) / (1 << n)) |
3238 |
|
3239 |
|
3239 |
/* Linear interpolation. */ |
3240 |
/* Linear interpolation. */ |
3240 |
#define interpolate(x, x1, y1, x2, y2, n) \ |
3241 |
#define interpolate(x, x1, y1, x2, y2, n) \ |
3241 |
((y1) + fdivround(((x) - (x1)) * ((y2) - (y1)), (x2) - (x1), n)) |
3242 |
((y1) + fdivround(((x) - (x1)) * ((y2) - (y1)), (x2) - (x1), n)) |
3242 |
|
3243 |
|
3243 |
struct ifnet *ifp = sc->sc_ifp; |
3244 |
struct ifnet *ifp = sc->sc_ifp; |
Lines 3354-3371
Link Here
|
3354 |
return wpi_cmd(sc, WPI_CMD_SET_POWER_MODE, &cmd, sizeof cmd, async); |
3355 |
return wpi_cmd(sc, WPI_CMD_SET_POWER_MODE, &cmd, sizeof cmd, async); |
3355 |
} |
3356 |
} |
3356 |
|
3357 |
|
3357 |
static int |
3358 |
static int |
3358 |
wpi_send_btcoex(struct wpi_softc *sc) |
3359 |
wpi_send_btcoex(struct wpi_softc *sc) |
3359 |
{ |
3360 |
{ |
3360 |
struct wpi_bluetooth cmd; |
3361 |
struct wpi_bluetooth cmd; |
3361 |
|
3362 |
|
3362 |
memset(&cmd, 0, sizeof cmd); |
3363 |
memset(&cmd, 0, sizeof cmd); |
3363 |
cmd.flags = WPI_BT_COEX_MODE_4WIRE; |
3364 |
cmd.flags = WPI_BT_COEX_MODE_4WIRE; |
3364 |
cmd.lead_time = WPI_BT_LEAD_TIME_DEF; |
3365 |
cmd.lead_time = WPI_BT_LEAD_TIME_DEF; |
3365 |
cmd.max_kill = WPI_BT_MAX_KILL_DEF; |
3366 |
cmd.max_kill = WPI_BT_MAX_KILL_DEF; |
3366 |
DPRINTF(sc, WPI_DEBUG_RESET, "%s: configuring bluetooth coexistence\n", |
3367 |
DPRINTF(sc, WPI_DEBUG_RESET, "%s: configuring bluetooth coexistence\n", |
3367 |
__func__); |
3368 |
__func__); |
3368 |
return wpi_cmd(sc, WPI_CMD_BT_COEX, &cmd, sizeof(cmd), 0); |
3369 |
return wpi_cmd(sc, WPI_CMD_BT_COEX, &cmd, sizeof(cmd), 0); |
3369 |
} |
3370 |
} |
3370 |
|
3371 |
|
3371 |
static int |
3372 |
static int |
Lines 3719-3725
Link Here
|
3719 |
chan->rf_gain = 0x28; |
3720 |
chan->rf_gain = 0x28; |
3720 |
|
3721 |
|
3721 |
DPRINTF(sc, WPI_DEBUG_SCAN, "Scanning %u Passive: %d\n", |
3722 |
DPRINTF(sc, WPI_DEBUG_SCAN, "Scanning %u Passive: %d\n", |
3722 |
chan->chan, IEEE80211_IS_CHAN_PASSIVE(c)); |
3723 |
chan->chan, IEEE80211_IS_CHAN_PASSIVE(c)); |
3723 |
|
3724 |
|
3724 |
hdr->nchan++; |
3725 |
hdr->nchan++; |
3725 |
chan++; |
3726 |
chan++; |
Lines 4112-4122
Link Here
|
4112 |
if (ntries == 1000) { |
4113 |
if (ntries == 1000) { |
4113 |
device_printf(sc->sc_dev, |
4114 |
device_printf(sc->sc_dev, |
4114 |
"timeout waiting for thermal sensor calibration\n"); |
4115 |
"timeout waiting for thermal sensor calibration\n"); |
4115 |
return ETIMEDOUT; |
4116 |
return ETIMEDOUT; |
4116 |
} |
4117 |
} |
4117 |
|
4118 |
|
4118 |
DPRINTF(sc, WPI_DEBUG_TEMP, "temperature %d\n", sc->temp); |
4119 |
DPRINTF(sc, WPI_DEBUG_TEMP, "temperature %d\n", sc->temp); |
4119 |
return 0; |
4120 |
return 0; |
4120 |
} |
4121 |
} |
4121 |
|
4122 |
|
4122 |
/* |
4123 |
/* |