aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Petter Selasky <hselasky@FreeBSD.org>2016-06-29 10:25:32 +0000
committerHans Petter Selasky <hselasky@FreeBSD.org>2016-06-29 10:25:32 +0000
commit357c8ca7388f2fd0df3580131dd37460a10e2517 (patch)
treed3cb31eb5537cddbdb049208dbf76da41f34333a
parent22523b3a7a371a8d11499d99b83decd8123eda76 (diff)
downloadsrc-357c8ca7388f2fd0df3580131dd37460a10e2517.tar.gz
src-357c8ca7388f2fd0df3580131dd37460a10e2517.zip
MFC r302076:
Update the definition for number of scratch pages to match the latest version of the XHCI specification. Make sure the code can handle the maximum number of allowed scratch pages. Submitted by: Shichun_Ma@Dell.com
Notes
Notes: svn path=/stable/8/; revision=302268
-rw-r--r--sys/dev/usb/controller/xhci.c4
-rw-r--r--sys/dev/usb/controller/xhci.h7
-rw-r--r--sys/dev/usb/controller/xhcireg.h4
3 files changed, 8 insertions, 7 deletions
diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c
index c31f9f1136ed..267fdfdf571b 100644
--- a/sys/dev/usb/controller/xhci.c
+++ b/sys/dev/usb/controller/xhci.c
@@ -199,7 +199,7 @@ static void
xhci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_cb_t *cb)
{
struct xhci_softc *sc = XHCI_BUS2SC(bus);
- uint8_t i;
+ uint16_t i;
cb(bus, &sc->sc_hw.root_pc, &sc->sc_hw.root_pg,
sizeof(struct xhci_hw_root), XHCI_PAGE_SIZE);
@@ -207,7 +207,7 @@ xhci_iterate_hw_softc(struct usb_bus *bus, usb_bus_mem_sub_cb_t *cb)
cb(bus, &sc->sc_hw.ctx_pc, &sc->sc_hw.ctx_pg,
sizeof(struct xhci_dev_ctx_addr), XHCI_PAGE_SIZE);
- for (i = 0; i != XHCI_MAX_SCRATCHPADS; i++) {
+ for (i = 0; i != sc->sc_noscratch; i++) {
cb(bus, &sc->sc_hw.scratch_pc[i], &sc->sc_hw.scratch_pg[i],
XHCI_PAGE_SIZE, XHCI_PAGE_SIZE);
}
diff --git a/sys/dev/usb/controller/xhci.h b/sys/dev/usb/controller/xhci.h
index 01fcef82a221..7a7a457ddda6 100644
--- a/sys/dev/usb/controller/xhci.h
+++ b/sys/dev/usb/controller/xhci.h
@@ -30,7 +30,7 @@
#define XHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128)
#define XHCI_MAX_ENDPOINTS 32 /* hardcoded - do not change */
-#define XHCI_MAX_SCRATCHPADS 32
+#define XHCI_MAX_SCRATCHPADS 1024
#define XHCI_MAX_EVENTS (16 * 13)
#define XHCI_MAX_COMMANDS (16 * 1)
#define XHCI_MAX_RSEG 1
@@ -486,14 +486,15 @@ struct xhci_softc {
uint16_t sc_command_idx;
uint16_t sc_imod_default;
+ /* number of scratch pages */
+ uint16_t sc_noscratch;
+
uint8_t sc_event_ccs;
uint8_t sc_command_ccs;
/* number of XHCI device slots */
uint8_t sc_noslot;
/* number of ports on root HUB */
uint8_t sc_noport;
- /* number of scratch pages */
- uint8_t sc_noscratch;
/* root HUB device configuration */
uint8_t sc_conf;
/* root HUB port event bitmap, max 256 ports */
diff --git a/sys/dev/usb/controller/xhcireg.h b/sys/dev/usb/controller/xhcireg.h
index a0b739711081..32288c0befb2 100644
--- a/sys/dev/usb/controller/xhcireg.h
+++ b/sys/dev/usb/controller/xhcireg.h
@@ -52,8 +52,8 @@
#define XHCI_HCSPARAMS2 0x08 /* RO structual parameters 2 */
#define XHCI_HCS2_IST(x) ((x) & 0xF)
#define XHCI_HCS2_ERST_MAX(x) (((x) >> 4) & 0xF)
-#define XHCI_HCS2_SPR(x) (((x) >> 24) & 0x1)
-#define XHCI_HCS2_SPB_MAX(x) (((x) >> 27) & 0x7F)
+#define XHCI_HCS2_SPR(x) (((x) >> 26) & 0x1)
+#define XHCI_HCS2_SPB_MAX(x) ((((x) >> 16) & 0x3E0) | (((x) >> 27) & 0x1F))
#define XHCI_HCSPARAMS3 0x0C /* RO structual parameters 3 */
#define XHCI_HCS3_U1_DEL(x) ((x) & 0xFF)
#define XHCI_HCS3_U2_DEL(x) (((x) >> 16) & 0xFFFF)