summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/controller/xhci.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/usb/controller/xhci.c')
-rw-r--r--sys/dev/usb/controller/xhci.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/sys/dev/usb/controller/xhci.c b/sys/dev/usb/controller/xhci.c
index 1c1d7ff..2b0ad00 100644
--- a/sys/dev/usb/controller/xhci.c
+++ b/sys/dev/usb/controller/xhci.c
@@ -2682,24 +2682,23 @@ xhci_alloc_device_ext(struct usb_device *udev)
goto error;
}
- pc = &sc->sc_hw.devs[index].endpoint_pc;
- pg = &sc->sc_hw.devs[index].endpoint_pg;
+ /* initialise all endpoint LINK TRBs */
- /* need to initialize the page cache */
- pc->tag_parent = sc->sc_bus.dma_parent_tag;
+ for (i = 0; i != XHCI_MAX_ENDPOINTS; i++) {
- if (usb_pc_alloc_mem(pc, pg,
- sizeof(struct xhci_dev_endpoint_trbs), XHCI_PAGE_SIZE)) {
- goto error;
- }
+ pc = &sc->sc_hw.devs[index].endpoint_pc[i];
+ pg = &sc->sc_hw.devs[index].endpoint_pg[i];
- /* initialise all endpoint LINK TRBs */
+ /* need to initialize the page cache */
+ pc->tag_parent = sc->sc_bus.dma_parent_tag;
- for (i = 0; i != XHCI_MAX_ENDPOINTS; i++) {
+ if (usb_pc_alloc_mem(pc, pg,
+ sizeof(struct xhci_dev_endpoint_trbs), XHCI_TRB_ALIGN)) {
+ goto error;
+ }
/* lookup endpoint TRB ring */
- usbd_get_page(pc, (uintptr_t)&
- ((struct xhci_dev_endpoint_trbs *)0)->trb[i][0], &buf_ep);
+ usbd_get_page(pc, 0, &buf_ep);
/* get TRB pointer */
trb = buf_ep.buffer;
@@ -2713,9 +2712,9 @@ xhci_alloc_device_ext(struct usb_device *udev)
trb->dwTrb2 = htole32(XHCI_TRB_2_IRQ_SET(0));
trb->dwTrb3 = htole32(XHCI_TRB_3_CYCLE_BIT |
XHCI_TRB_3_TYPE_SET(XHCI_TRB_TYPE_LINK));
- }
- usb_pc_cpu_flush(pc);
+ usb_pc_cpu_flush(pc);
+ }
xhci_set_slot_pointer(sc, index, buf_dev.physaddr);
@@ -2732,13 +2731,15 @@ xhci_free_device_ext(struct usb_device *udev)
{
struct xhci_softc *sc = XHCI_BUS2SC(udev->bus);
uint8_t index;
+ uint8_t i;
index = udev->controller_slot_id;
xhci_set_slot_pointer(sc, index, 0);
usb_pc_free_mem(&sc->sc_hw.devs[index].device_pc);
usb_pc_free_mem(&sc->sc_hw.devs[index].input_pc);
- usb_pc_free_mem(&sc->sc_hw.devs[index].endpoint_pc);
+ for (i = 0; i != XHCI_MAX_ENDPOINTS; i++)
+ usb_pc_free_mem(&sc->sc_hw.devs[index].endpoint_pc[i]);
}
static struct xhci_endpoint_ext *
@@ -2759,10 +2760,9 @@ xhci_get_endpoint_ext(struct usb_device *udev, struct usb_endpoint_descriptor *e
index = udev->controller_slot_id;
- pc = &sc->sc_hw.devs[index].endpoint_pc;
+ pc = &sc->sc_hw.devs[index].endpoint_pc[epno];
- usbd_get_page(pc, (uintptr_t)&((struct xhci_dev_endpoint_trbs *)0)->
- trb[epno][0], &buf_ep);
+ usbd_get_page(pc, 0, &buf_ep);
pepext = &sc->sc_hw.devs[index].endp[epno];
pepext->page_cache = pc;
OpenPOWER on IntegriCloud