diff options
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/asmc/asmc.c | 8 | ||||
-rw-r--r-- | sys/dev/cxgbe/iw_cxgbe/cm.c | 2 | ||||
-rw-r--r-- | sys/dev/ioat/ioat.c | 9 | ||||
-rw-r--r-- | sys/dev/ioat/ioat.h | 1 | ||||
-rw-r--r-- | sys/dev/iwm/if_iwm.c | 27 | ||||
-rw-r--r-- | sys/dev/iwm/if_iwmvar.h | 3 | ||||
-rw-r--r-- | sys/dev/iwn/if_iwn.c | 28 | ||||
-rw-r--r-- | sys/dev/usb/controller/dwc_otg.c | 27 | ||||
-rw-r--r-- | sys/dev/usb/wlan/if_urtwn.c | 6 | ||||
-rw-r--r-- | sys/dev/usb/wlan/if_urtwnreg.h | 18 |
10 files changed, 87 insertions, 42 deletions
diff --git a/sys/dev/asmc/asmc.c b/sys/dev/asmc/asmc.c index 2c8f6af..9c8c89a 100644 --- a/sys/dev/asmc/asmc.c +++ b/sys/dev/asmc/asmc.c @@ -963,14 +963,13 @@ asmc_fan_getvalue(device_t dev, const char *key, int fan) } static char* -asmc_fan_getstring(device_t dev, const char *key, int fan) +asmc_fan_getstring(device_t dev, const char *key, int fan, uint8_t *buf, uint8_t buflen) { - uint8_t buf[16]; char fankey[5]; char* desc; snprintf(fankey, sizeof(fankey), key, fan); - if (asmc_key_read(dev, fankey, buf, sizeof buf) < 0) + if (asmc_key_read(dev, fankey, buf, buflen) < 0) return (NULL); desc = buf+4; @@ -1012,12 +1011,13 @@ asmc_mb_sysctl_fanspeed(SYSCTL_HANDLER_ARGS) static int asmc_mb_sysctl_fanid(SYSCTL_HANDLER_ARGS) { + uint8_t buf[16]; device_t dev = (device_t) arg1; int fan = arg2; int error = true; char* desc; - desc = asmc_fan_getstring(dev, ASMC_KEY_FANID, fan); + desc = asmc_fan_getstring(dev, ASMC_KEY_FANID, fan, buf, sizeof(buf)); if (desc != NULL) error = sysctl_handle_string(oidp, desc, 0, req); diff --git a/sys/dev/cxgbe/iw_cxgbe/cm.c b/sys/dev/cxgbe/iw_cxgbe/cm.c index b5dede7..cb4be71 100644 --- a/sys/dev/cxgbe/iw_cxgbe/cm.c +++ b/sys/dev/cxgbe/iw_cxgbe/cm.c @@ -474,7 +474,7 @@ process_conn_error(struct c4iw_ep *ep) if (state != ABORTING) { CTR2(KTR_IW_CXGBE, "%s:pce1 %p", __func__, ep); - close_socket(&ep->com, 1); + close_socket(&ep->com, 0); state_set(&ep->com, DEAD); c4iw_put_ep(&ep->com); } diff --git a/sys/dev/ioat/ioat.c b/sys/dev/ioat/ioat.c index 4b6d7df..c93d1b5 100644 --- a/sys/dev/ioat/ioat.c +++ b/sys/dev/ioat/ioat.c @@ -744,6 +744,15 @@ ioat_get_hwversion(bus_dmaengine_t dmaengine) return (ioat->version); } +size_t +ioat_get_max_io_size(bus_dmaengine_t dmaengine) +{ + struct ioat_softc *ioat; + + ioat = to_ioat_softc(dmaengine); + return (ioat->max_xfer_size); +} + int ioat_set_interrupt_coalesce(bus_dmaengine_t dmaengine, uint16_t delay) { diff --git a/sys/dev/ioat/ioat.h b/sys/dev/ioat/ioat.h index e8f47ae..f5d5fad 100644 --- a/sys/dev/ioat/ioat.h +++ b/sys/dev/ioat/ioat.h @@ -70,6 +70,7 @@ void ioat_put_dmaengine(bus_dmaengine_t dmaengine); /* Check the DMA engine's HW version */ int ioat_get_hwversion(bus_dmaengine_t dmaengine); +size_t ioat_get_max_io_size(bus_dmaengine_t dmaengine); /* * Set interrupt coalescing on a DMA channel. diff --git a/sys/dev/iwm/if_iwm.c b/sys/dev/iwm/if_iwm.c index 73cccd9..510491e 100644 --- a/sys/dev/iwm/if_iwm.c +++ b/sys/dev/iwm/if_iwm.c @@ -423,9 +423,8 @@ iwm_set_default_calib(struct iwm_softc *sc, const void *data) static void iwm_fw_info_free(struct iwm_fw_info *fw) { - firmware_put(fw->fw_rawdata, FIRMWARE_UNLOAD); - fw->fw_rawdata = NULL; - fw->fw_rawsize = 0; + firmware_put(fw->fw_fp, FIRMWARE_UNLOAD); + fw->fw_fp = NULL; /* don't touch fw->fw_status */ memset(fw->fw_sects, 0, sizeof(fw->fw_sects)); } @@ -450,32 +449,30 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) msleep(&sc->sc_fw, &sc->sc_mtx, 0, "iwmfwp", 0); fw->fw_status = IWM_FW_STATUS_INPROGRESS; - if (fw->fw_rawdata != NULL) + if (fw->fw_fp != NULL) iwm_fw_info_free(fw); /* * Load firmware into driver memory. - * fw_rawdata and fw_rawsize will be set. + * fw_fp will be set. */ IWM_UNLOCK(sc); fwp = firmware_get(sc->sc_fwname); + IWM_LOCK(sc); if (fwp == NULL) { device_printf(sc->sc_dev, "could not read firmware %s (error %d)\n", sc->sc_fwname, error); - IWM_LOCK(sc); goto out; } - IWM_LOCK(sc); - fw->fw_rawdata = fwp->data; - fw->fw_rawsize = fwp->datasize; + fw->fw_fp = fwp; /* * Parse firmware contents */ - uhdr = (const void *)fw->fw_rawdata; - if (*(const uint32_t *)fw->fw_rawdata != 0 + uhdr = (const void *)fw->fw_fp->data; + if (*(const uint32_t *)fw->fw_fp->data != 0 || le32toh(uhdr->magic) != IWM_TLV_UCODE_MAGIC) { device_printf(sc->sc_dev, "invalid firmware %s\n", sc->sc_fwname); @@ -485,7 +482,7 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) sc->sc_fwver = le32toh(uhdr->ver); data = uhdr->data; - len = fw->fw_rawsize - sizeof(*uhdr); + len = fw->fw_fp->datasize - sizeof(*uhdr); while (len >= sizeof(tlv)) { size_t tlv_len; @@ -684,7 +681,7 @@ iwm_read_firmware(struct iwm_softc *sc, enum iwm_ucode_type ucode_type) out: if (error) { fw->fw_status = IWM_FW_STATUS_NONE; - if (fw->fw_rawdata != NULL) + if (fw->fw_fp != NULL) iwm_fw_info_free(fw); } else fw->fw_status = IWM_FW_STATUS_DONE; @@ -4957,10 +4954,10 @@ iwm_detach_local(struct iwm_softc *sc, int do_net80211) iwm_free_tx_ring(sc, &sc->txq[i]); /* Free firmware */ - if (fw->fw_rawdata != NULL) + if (fw->fw_fp != NULL) iwm_fw_info_free(fw); - /* free scheduler */ + /* Free scheduler */ iwm_free_sched(sc); if (sc->ict_dma.vaddr != NULL) iwm_free_ict(sc); diff --git a/sys/dev/iwm/if_iwmvar.h b/sys/dev/iwm/if_iwmvar.h index 52363c5..7ab0ea7 100644 --- a/sys/dev/iwm/if_iwmvar.h +++ b/sys/dev/iwm/if_iwmvar.h @@ -159,8 +159,7 @@ enum iwm_ucode_type { }; struct iwm_fw_info { - const void *fw_rawdata; - size_t fw_rawsize; + const struct firmware *fw_fp; int fw_status; struct iwm_fw_sects { diff --git a/sys/dev/iwn/if_iwn.c b/sys/dev/iwn/if_iwn.c index 2947db5..ab630e7 100644 --- a/sys/dev/iwn/if_iwn.c +++ b/sys/dev/iwn/if_iwn.c @@ -318,6 +318,7 @@ static int iwn_read_firmware_leg(struct iwn_softc *, static int iwn_read_firmware_tlv(struct iwn_softc *, struct iwn_fw_info *, uint16_t); static int iwn_read_firmware(struct iwn_softc *); +static void iwn_unload_firmware(struct iwn_softc *); static int iwn_clock_wait(struct iwn_softc *); static int iwn_apm_init(struct iwn_softc *); static void iwn_apm_stop_master(struct iwn_softc *); @@ -8200,9 +8201,8 @@ iwn_read_firmware(struct iwn_softc *sc) if (fw->size < sizeof (uint32_t)) { device_printf(sc->sc_dev, "%s: firmware too short: %zu bytes\n", __func__, fw->size); - firmware_put(sc->fw_fp, FIRMWARE_UNLOAD); - sc->fw_fp = NULL; - return EINVAL; + error = EINVAL; + goto fail; } /* Retrieve text and data sections. */ @@ -8214,9 +8214,7 @@ iwn_read_firmware(struct iwn_softc *sc) device_printf(sc->sc_dev, "%s: could not read firmware sections, error %d\n", __func__, error); - firmware_put(sc->fw_fp, FIRMWARE_UNLOAD); - sc->fw_fp = NULL; - return error; + goto fail; } device_printf(sc->sc_dev, "%s: ucode rev=0x%08x\n", __func__, sc->ucode_rev); @@ -8230,13 +8228,22 @@ iwn_read_firmware(struct iwn_softc *sc) (fw->boot.textsz & 3) != 0) { device_printf(sc->sc_dev, "%s: firmware sections too large\n", __func__); - firmware_put(sc->fw_fp, FIRMWARE_UNLOAD); - sc->fw_fp = NULL; - return EINVAL; + error = EINVAL; + goto fail; } /* We can proceed with loading the firmware. */ return 0; + +fail: iwn_unload_firmware(sc); + return error; +} + +static void +iwn_unload_firmware(struct iwn_softc *sc) +{ + firmware_put(sc->fw_fp, FIRMWARE_UNLOAD); + sc->fw_fp = NULL; } static int @@ -8724,8 +8731,7 @@ iwn_init_locked(struct iwn_softc *sc) /* Initialize hardware and upload firmware. */ error = iwn_hw_init(sc); - firmware_put(sc->fw_fp, FIRMWARE_UNLOAD); - sc->fw_fp = NULL; + iwn_unload_firmware(sc); if (error != 0) { device_printf(sc->sc_dev, "%s: could not initialize hardware, error %d\n", __func__, diff --git a/sys/dev/usb/controller/dwc_otg.c b/sys/dev/usb/controller/dwc_otg.c index 5e51527d..16c4c3a 100644 --- a/sys/dev/usb/controller/dwc_otg.c +++ b/sys/dev/usb/controller/dwc_otg.c @@ -456,6 +456,18 @@ dwc_otg_init_fifo(struct dwc_otg_softc *sc, uint8_t mode) return (0); } +static uint8_t +dwc_otg_uses_split(struct usb_device *udev) +{ + /* + * When a LOW or FULL speed device is connected directly to + * the USB port we don't use split transactions: + */ + return (udev->speed != USB_SPEED_HIGH && + udev->parent_hs_hub != NULL && + udev->parent_hs_hub->parent_hub != NULL); +} + static void dwc_otg_update_host_frame_interval(struct dwc_otg_softc *sc) { @@ -3329,16 +3341,16 @@ dwc_otg_setup_standard_chain(struct usb_xfer *xfer) else hcchar |= (td->ep_type << HCCHAR_EPTYPE_SHIFT); - if (usbd_get_speed(xfer->xroot->udev) == USB_SPEED_LOW) - hcchar |= HCCHAR_LSPDDEV; if (UE_GET_DIR(xfer->endpointno) == UE_DIR_IN) hcchar |= HCCHAR_EPDIR_IN; switch (xfer->xroot->udev->speed) { - case USB_SPEED_FULL: case USB_SPEED_LOW: + hcchar |= HCCHAR_LSPDDEV; + /* FALLTHROUGH */ + case USB_SPEED_FULL: /* check if root HUB port is running High Speed */ - if (xfer->xroot->udev->parent_hs_hub != NULL) { + if (dwc_otg_uses_split(xfer->xroot->udev)) { hcsplt = HCSPLT_SPLTENA | (xfer->xroot->udev->hs_port_no << HCSPLT_PRTADDR_SHIFT) | @@ -4160,7 +4172,10 @@ dwc_otg_device_isoc_start(struct usb_xfer *xfer) framenum = DSTS_SOFFN_GET(temp); } - if (xfer->xroot->udev->parent_hs_hub != NULL) + /* + * Check if port is doing 8000 or 1000 frames per second: + */ + if (sc->sc_flags.status_high_speed) framenum /= 8; framenum &= DWC_OTG_FRAME_MASK; @@ -4837,7 +4852,7 @@ dwc_otg_xfer_setup(struct usb_setup_params *parm) td = USB_ADD_BYTES(parm->buf, parm->size[0]); /* compute shared bandwidth resource index for TT */ - if (parm->udev->parent_hs_hub != NULL && parm->udev->speed != USB_SPEED_HIGH) { + if (dwc_otg_uses_split(parm->udev)) { if (parm->udev->parent_hs_hub->ddesc.bDeviceProtocol == UDPROTO_HSHUBMTT) td->tt_index = parm->udev->device_index; else diff --git a/sys/dev/usb/wlan/if_urtwn.c b/sys/dev/usb/wlan/if_urtwn.c index 6ca43c3..73eda59 100644 --- a/sys/dev/usb/wlan/if_urtwn.c +++ b/sys/dev/usb/wlan/if_urtwn.c @@ -2277,7 +2277,7 @@ urtwn_newstate(struct ieee80211vap *vap, enum ieee80211_state nstate, int arg) case IEEE80211_S_SCAN: /* Pause AC Tx queues. */ urtwn_write_1(sc, R92C_TXPAUSE, - urtwn_read_1(sc, R92C_TXPAUSE) | 0x0f); + urtwn_read_1(sc, R92C_TXPAUSE) | R92C_TX_QUEUE_AC); break; case IEEE80211_S_AUTH: urtwn_set_chan(sc, ic->ic_curchan, NULL); @@ -4425,7 +4425,7 @@ urtwn_lc_calib(struct urtwn_softc *sc) } } else { /* Block all Tx queues. */ - urtwn_write_1(sc, R92C_TXPAUSE, 0xff); + urtwn_write_1(sc, R92C_TXPAUSE, R92C_TX_QUEUE_ALL); } /* Start calibration. */ urtwn_rf_write(sc, 0, R92C_RF_CHNLBW, @@ -4640,7 +4640,7 @@ urtwn_init(struct urtwn_softc *sc) ieee80211_runtask(ic, &sc->cmdq_task); /* Enable hardware sequence numbering. */ - urtwn_write_1(sc, R92C_HWSEQ_CTRL, 0xff); + urtwn_write_1(sc, R92C_HWSEQ_CTRL, R92C_TX_QUEUE_ALL); /* Enable per-packet TX report. */ if (sc->chip & URTWN_CHIP_88E) { diff --git a/sys/dev/usb/wlan/if_urtwnreg.h b/sys/dev/usb/wlan/if_urtwnreg.h index 1a43297..2c5f2ef 100644 --- a/sys/dev/usb/wlan/if_urtwnreg.h +++ b/sys/dev/usb/wlan/if_urtwnreg.h @@ -496,6 +496,24 @@ #define R92C_EDCA_PARAM_TXOP_M 0xffff0000 #define R92C_EDCA_PARAM_TXOP_S 16 +/* Bits for R92C_HWSEQ_CTRL / R92C_TXPAUSE. */ +#define R92C_TX_QUEUE_VO 0x01 +#define R92C_TX_QUEUE_VI 0x02 +#define R92C_TX_QUEUE_BE 0x04 +#define R92C_TX_QUEUE_BK 0x08 +#define R92C_TX_QUEUE_MGT 0x10 +#define R92C_TX_QUEUE_HIGH 0x20 +#define R92C_TX_QUEUE_BCN 0x40 + +/* Shortcuts. */ +#define R92C_TX_QUEUE_AC \ + (R92C_TX_QUEUE_VO | R92C_TX_QUEUE_VI | \ + R92C_TX_QUEUE_BE | R92C_TX_QUEUE_BK) + +#define R92C_TX_QUEUE_ALL \ + (R92C_TX_QUEUE_AC | R92C_TX_QUEUE_MGT | \ + R92C_TX_QUEUE_HIGH | R92C_TX_QUEUE_BCN | 0x80) /* XXX */ + /* Bits for R92C_BCN_CTRL. */ #define R92C_BCN_CTRL_EN_MBSSID 0x02 #define R92C_BCN_CTRL_TXBCN_RPT 0x04 |