summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/uhcivar.h
diff options
context:
space:
mode:
authorn_hibma <n_hibma@FreeBSD.org>1999-10-07 19:26:38 +0000
committern_hibma <n_hibma@FreeBSD.org>1999-10-07 19:26:38 +0000
commitb6c58860ab2b8db1457a6a3ff967066e30992908 (patch)
tree89a9b4bc579522b90571350c7580f2a0b06a069a /sys/dev/usb/uhcivar.h
parent2417a471092d1b5e990dad00d605bde4819e26f9 (diff)
downloadFreeBSD-src-b6c58860ab2b8db1457a6a3ff967066e30992908.zip
FreeBSD-src-b6c58860ab2b8db1457a6a3ff967066e30992908.tar.gz
Major synchronisation with the NetBSD USB stack:
- Some cleanup and improvements in the uhci and ohci drivers - Support for plugging and unplugging devices improved - Now available is bulk transport over OHCI controllers - Resume and suspend have been temporarily been disabled again. Proper support for it is available in the uhci.c and ohci.c files but I have not yet spent the brain cycles to use it. - OpenBSD now uses the USB stack as well - Add FreeBSD tags
Diffstat (limited to 'sys/dev/usb/uhcivar.h')
-rw-r--r--sys/dev/usb/uhcivar.h89
1 files changed, 49 insertions, 40 deletions
diff --git a/sys/dev/usb/uhcivar.h b/sys/dev/usb/uhcivar.h
index 266bced..1c2ad1b 100644
--- a/sys/dev/usb/uhcivar.h
+++ b/sys/dev/usb/uhcivar.h
@@ -1,5 +1,5 @@
-/* $NetBSD: uhcivar.h,v 1.5 1998/12/26 12:53:02 augustss Exp $ */
-/* $FreeBSD$ */
+/* $NetBSD: uhcivar.h,v 1.12 1999/08/22 23:41:00 augustss Exp $ */
+/* $FreeBSD$ */
/*
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -39,27 +39,28 @@
*/
/*
- * The framelist:
- *
* To avoid having 1024 TDs for each isochronous transfer we introduce
- * a virtual frame list. Every UHCI_VFRAMELIST_COUNT'th entry in the real
- * frame list points to a non-active TD. This TD is
- * UHCI_FRAMELIST_COUNT/UHCI_VFRAMELIST_COUNT times the start of the
- * virtual frame list for a queue of isochroneous transfers.
- *
- * The last isochroneous transfer in the list points to a QH for the
- * interrupt transfer in that timeslot. The QHs for interrupt transfers
- * all point to the single QH for control transfers, which in turn
- * points at the QH for control transfers.
+ * a virtual frame list. Every UHCI_VFRAMELIST_COUNT entries in the real
+ * frame list points to a non-active TD. These, in turn, which form the
+ * starts of the virtual frame list. This also has the advantage that it
+ * simplifies linking in/out TD/QH in the schedule.
+ * Furthermore, initially each of the inactive TDs point to an inactive
+ * QH that forms the start of the interrupt traffic for that slot.
+ * Each of these QHs point to the same QH that is the start of control
+ * traffic.
*
- * UHCI_VFRAMELIST_COUNT should be a power of 2 and UHCI_FRAMELIST_COUNT
- * should be a multiple of UHCI_VFRAMELIST_COUNT.
+ * UHCI_VFRAMELIST_COUNT should be a power of 2 and <= UHCI_FRAMELIST_COUNT.
*/
#define UHCI_VFRAMELIST_COUNT 128
typedef struct uhci_soft_qh uhci_soft_qh_t;
typedef struct uhci_soft_td uhci_soft_td_t;
+typedef union {
+ struct uhci_soft_qh *sqh;
+ struct uhci_soft_td *std;
+} uhci_soft_td_qh_t;
+
/*
* An interrupt info struct contains the information needed to
* execute a requested routine when the controller generates an
@@ -85,28 +86,34 @@ typedef struct uhci_intr_info {
* Extra information that we need for a TD.
*/
struct uhci_soft_td {
- uhci_td_t *td; /* The real TD */
- uhci_physaddr_t physaddr; /* and its physical address. */
+ uhci_td_t td; /* The real TD, must be first */
+ uhci_soft_td_qh_t link; /* soft version of the td_link field */
+ uhci_physaddr_t physaddr; /* TD's physical address. */
};
-#define UHCI_TD_CHUNK 128 /*(PAGE_SIZE / UHCI_TD_SIZE)*/
+/*
+ * Make the size such that it is a multiple of UHCI_TD_ALIGN. This way
+ * we can pack a number of soft TD together and have the real TS well
+ * aligned.
+ * NOTE: Minimum size is 32 bytes.
+ */
+#define UHCI_STD_SIZE ((sizeof (struct uhci_soft_td) + UHCI_TD_ALIGN - 1) / UHCI_TD_ALIGN * UHCI_TD_ALIGN)
+#define UHCI_STD_CHUNK 128 /*(PAGE_SIZE / UHCI_TD_SIZE)*/
/*
* Extra information that we need for a QH.
*/
struct uhci_soft_qh {
- uhci_qh_t *qh; /* The real QH */
- uhci_physaddr_t physaddr; /* and its physical address. */
+ uhci_qh_t qh; /* The real QH, must be first */
+ uhci_soft_qh_t *hlink; /* soft version of qh_hlink */
+ uhci_soft_td_t *elink; /* soft version of qh_elink */
+ uhci_physaddr_t physaddr; /* QH's physical address. */
int pos; /* Timeslot position */
uhci_intr_info_t *intr_info; /* Who to call on completion. */
+/* XXX should try to shrink with 4 bytes to fit into 32 bytes */
};
-#define UHCI_QH_CHUNK 128 /*(PAGE_SIZE / UHCI_QH_SIZE)*/
-
-/* Only used for buffer free list. */
-struct uhci_buffer {
- struct uhci_buffer *next;
-};
-#define UHCI_BUFFER_SIZE 64
-#define UHCI_BUFFER_CHUNK 64 /*(PAGE_SIZE / UHCI_BUFFER_SIZE)*/
+/* See comment about UHCI_STD_SIZE. */
+#define UHCI_SQH_SIZE ((sizeof (struct uhci_soft_qh) + UHCI_QH_ALIGN - 1) / UHCI_QH_ALIGN * UHCI_QH_ALIGN)
+#define UHCI_SQH_CHUNK 128 /*(PAGE_SIZE / UHCI_QH_SIZE)*/
/*
* Information about an entry in the virtial frame list.
@@ -121,19 +128,17 @@ struct uhci_vframe {
typedef struct uhci_softc {
struct usbd_bus sc_bus; /* base device */
-#if defined(__NetBSD__)
- void *sc_ih; /* interrupt vectoring */
-#endif
bus_space_tag_t iot;
bus_space_handle_t ioh;
+#if defined(__NetBSD__) || defined(__OpenBSD__)
+ void *sc_ih; /* interrupt vectoring */
-#if defined(__NetBSD__)
bus_dma_tag_t sc_dmatag; /* DMA tag */
/* XXX should keep track of all DMA memory */
-#endif
+#endif /* defined(__FreeBSD__) */
uhci_physaddr_t *sc_pframes;
- vm_offset_t sc_flbase;
+ usb_dma_t sc_dma;
struct uhci_vframe sc_vframes[UHCI_VFRAMELIST_COUNT];
uhci_soft_qh_t *sc_ctl_start; /* dummy QH for control */
@@ -143,13 +148,17 @@ typedef struct uhci_softc {
uhci_soft_td_t *sc_freetds;
uhci_soft_qh_t *sc_freeqhs;
- struct uhci_buffer *sc_freebuffers;
u_int8_t sc_addr; /* device address */
u_int8_t sc_conf; /* device configuration */
char sc_isreset;
+#if defined(__NetBSD__)
+ char sc_suspend;
+#endif
+ usbd_request_handle sc_has_timo;
+
int sc_intrs;
LIST_HEAD(, uhci_intr_info) sc_intrhead;
@@ -160,13 +169,13 @@ typedef struct uhci_softc {
#define UHCI_HAS_LOCK 1
#define UHCI_WANT_LOCK 2
-#if defined(__NetBSD__)
- usb_dma_t *sc_mallocs;
-#endif
-
char sc_vendor[16];
+ int sc_id_vendor;
} uhci_softc_t;
usbd_status uhci_init __P((uhci_softc_t *));
int uhci_intr __P((void *));
-usbd_status uhci_reset __P((uhci_softc_t *));
+#if 0
+void uhci_reset __P((void *));
+#endif
+
OpenPOWER on IntegriCloud