summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/controller/xhci.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/usb/controller/xhci.h')
-rw-r--r--sys/dev/usb/controller/xhci.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/sys/dev/usb/controller/xhci.h b/sys/dev/usb/controller/xhci.h
index 7352e9c..c7610bb 100644
--- a/sys/dev/usb/controller/xhci.h
+++ b/sys/dev/usb/controller/xhci.h
@@ -320,11 +320,23 @@ struct xhci_dev_endpoint_trbs {
XHCI_MAX_TRANSFERS) + XHCI_MAX_STREAMS];
};
-#define XHCI_TD_PAGE_NBUF 17 /* units, room enough for 64Kbytes */
-#define XHCI_TD_PAGE_SIZE 4096 /* bytes */
-#define XHCI_TD_PAYLOAD_MAX (XHCI_TD_PAGE_SIZE * (XHCI_TD_PAGE_NBUF - 1))
+#if (USB_PAGE_SIZE < 4096)
+#error "The XHCI driver needs a pagesize above or equal to 4K"
+#endif
+
+/* Define the maximum payload which we will handle in a single TRB */
+#define XHCI_TD_PAYLOAD_MAX 65536 /* bytes */
+
+/* Define the maximum payload of a single scatter-gather list element */
+#define XHCI_TD_PAGE_SIZE \
+ ((USB_PAGE_SIZE < XHCI_TD_PAYLOAD_MAX) ? USB_PAGE_SIZE : XHCI_TD_PAYLOAD_MAX)
+
+/* Define the maximum length of the scatter-gather list */
+#define XHCI_TD_PAGE_NBUF \
+ (((XHCI_TD_PAYLOAD_MAX + XHCI_TD_PAGE_SIZE - 1) / XHCI_TD_PAGE_SIZE) + 1)
struct xhci_td {
+ /* one LINK TRB has been added to the TRB array */
struct xhci_trb td_trb[XHCI_TD_PAGE_NBUF + 1];
/*
@@ -452,7 +464,6 @@ struct xhci_softc {
struct usb_device *sc_devices[XHCI_MAX_DEVICES];
struct resource *sc_io_res;
- int sc_irq_rid;
struct resource *sc_irq_res;
void *sc_intr_hdl;
OpenPOWER on IntegriCloud