xref: /freebsd/sys/dev/usb/controller/uhci.h (revision ab42e8b2df8c3fab030422628f7d8d4c41c29a2f)
102ac6454SAndrew Thompson /* $FreeBSD$ */
202ac6454SAndrew Thompson /*-
302ac6454SAndrew Thompson  * Copyright (c) 1998 The NetBSD Foundation, Inc.
402ac6454SAndrew Thompson  * All rights reserved.
502ac6454SAndrew Thompson  *
602ac6454SAndrew Thompson  * This code is derived from software contributed to The NetBSD Foundation
702ac6454SAndrew Thompson  * by Lennart Augustsson (lennart@augustsson.net) at
802ac6454SAndrew Thompson  * Carlstedt Research & Technology.
902ac6454SAndrew Thompson  *
1002ac6454SAndrew Thompson  * Redistribution and use in source and binary forms, with or without
1102ac6454SAndrew Thompson  * modification, are permitted provided that the following conditions
1202ac6454SAndrew Thompson  * are met:
1302ac6454SAndrew Thompson  * 1. Redistributions of source code must retain the above copyright
1402ac6454SAndrew Thompson  *    notice, this list of conditions and the following disclaimer.
1502ac6454SAndrew Thompson  * 2. Redistributions in binary form must reproduce the above copyright
1602ac6454SAndrew Thompson  *    notice, this list of conditions and the following disclaimer in the
1702ac6454SAndrew Thompson  *    documentation and/or other materials provided with the distribution.
1802ac6454SAndrew Thompson  * 3. All advertising materials mentioning features or use of this software
1902ac6454SAndrew Thompson  *    must display the following acknowledgement:
2002ac6454SAndrew Thompson  *        This product includes software developed by the NetBSD
2102ac6454SAndrew Thompson  *        Foundation, Inc. and its contributors.
2202ac6454SAndrew Thompson  * 4. Neither the name of The NetBSD Foundation nor the names of its
2302ac6454SAndrew Thompson  *    contributors may be used to endorse or promote products derived
2402ac6454SAndrew Thompson  *    from this software without specific prior written permission.
2502ac6454SAndrew Thompson  *
2602ac6454SAndrew Thompson  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
2702ac6454SAndrew Thompson  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
2802ac6454SAndrew Thompson  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
2902ac6454SAndrew Thompson  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
3002ac6454SAndrew Thompson  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
3102ac6454SAndrew Thompson  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
3202ac6454SAndrew Thompson  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
3302ac6454SAndrew Thompson  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
3402ac6454SAndrew Thompson  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
3502ac6454SAndrew Thompson  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
3602ac6454SAndrew Thompson  * POSSIBILITY OF SUCH DAMAGE.
3702ac6454SAndrew Thompson  */
3802ac6454SAndrew Thompson 
3902ac6454SAndrew Thompson #ifndef _UHCI_H_
4002ac6454SAndrew Thompson #define	_UHCI_H_
4102ac6454SAndrew Thompson 
42ab42e8b2SAndrew Thompson #define	UHCI_MAX_DEVICES MIN(USB_MAX_DEVICES, 128)
4302ac6454SAndrew Thompson 
4402ac6454SAndrew Thompson /* PCI config registers */
4502ac6454SAndrew Thompson #define	PCI_USBREV		0x60	/* USB protocol revision */
4602ac6454SAndrew Thompson #define	PCI_USB_REV_MASK		0xff
4702ac6454SAndrew Thompson #define	PCI_USB_REV_PRE_1_0	0x00
4802ac6454SAndrew Thompson #define	PCI_USB_REV_1_0		0x10
4902ac6454SAndrew Thompson #define	PCI_USB_REV_1_1		0x11
5002ac6454SAndrew Thompson #define	PCI_LEGSUP		0xc0	/* Legacy Support register */
5102ac6454SAndrew Thompson #define	PCI_LEGSUP_USBPIRQDEN	0x2000	/* USB PIRQ D Enable */
5202ac6454SAndrew Thompson #define	PCI_CBIO		0x20	/* configuration base IO */
5302ac6454SAndrew Thompson #define	PCI_INTERFACE_UHCI	0x00
5402ac6454SAndrew Thompson 
5502ac6454SAndrew Thompson /* UHCI registers */
5602ac6454SAndrew Thompson #define	UHCI_CMD		0x00
5702ac6454SAndrew Thompson #define	UHCI_CMD_RS		0x0001
5802ac6454SAndrew Thompson #define	UHCI_CMD_HCRESET	0x0002
5902ac6454SAndrew Thompson #define	UHCI_CMD_GRESET		0x0004
6002ac6454SAndrew Thompson #define	UHCI_CMD_EGSM		0x0008
6102ac6454SAndrew Thompson #define	UHCI_CMD_FGR		0x0010
6202ac6454SAndrew Thompson #define	UHCI_CMD_SWDBG		0x0020
6302ac6454SAndrew Thompson #define	UHCI_CMD_CF		0x0040
6402ac6454SAndrew Thompson #define	UHCI_CMD_MAXP		0x0080
6502ac6454SAndrew Thompson #define	UHCI_STS		0x02
6602ac6454SAndrew Thompson #define	UHCI_STS_USBINT		0x0001
6702ac6454SAndrew Thompson #define	UHCI_STS_USBEI		0x0002
6802ac6454SAndrew Thompson #define	UHCI_STS_RD		0x0004
6902ac6454SAndrew Thompson #define	UHCI_STS_HSE		0x0008
7002ac6454SAndrew Thompson #define	UHCI_STS_HCPE		0x0010
7102ac6454SAndrew Thompson #define	UHCI_STS_HCH		0x0020
7202ac6454SAndrew Thompson #define	UHCI_STS_ALLINTRS	0x003f
7302ac6454SAndrew Thompson #define	UHCI_INTR		0x04
7402ac6454SAndrew Thompson #define	UHCI_INTR_TOCRCIE	0x0001
7502ac6454SAndrew Thompson #define	UHCI_INTR_RIE		0x0002
7602ac6454SAndrew Thompson #define	UHCI_INTR_IOCE		0x0004
7702ac6454SAndrew Thompson #define	UHCI_INTR_SPIE		0x0008
7802ac6454SAndrew Thompson #define	UHCI_FRNUM		0x06
7902ac6454SAndrew Thompson #define	UHCI_FRNUM_MASK		0x03ff
8002ac6454SAndrew Thompson #define	UHCI_FLBASEADDR		0x08
8102ac6454SAndrew Thompson #define	UHCI_SOF		0x0c
8202ac6454SAndrew Thompson #define	UHCI_SOF_MASK		0x7f
8302ac6454SAndrew Thompson #define	UHCI_PORTSC1      	0x010
8402ac6454SAndrew Thompson #define	UHCI_PORTSC2      	0x012
8502ac6454SAndrew Thompson #define	UHCI_PORTSC_CCS		0x0001
8602ac6454SAndrew Thompson #define	UHCI_PORTSC_CSC		0x0002
8702ac6454SAndrew Thompson #define	UHCI_PORTSC_PE		0x0004
8802ac6454SAndrew Thompson #define	UHCI_PORTSC_POEDC	0x0008
8902ac6454SAndrew Thompson #define	UHCI_PORTSC_LS		0x0030
9002ac6454SAndrew Thompson #define	UHCI_PORTSC_LS_SHIFT	4
9102ac6454SAndrew Thompson #define	UHCI_PORTSC_RD		0x0040
9202ac6454SAndrew Thompson #define	UHCI_PORTSC_LSDA	0x0100
9302ac6454SAndrew Thompson #define	UHCI_PORTSC_PR		0x0200
9402ac6454SAndrew Thompson #define	UHCI_PORTSC_OCI		0x0400
9502ac6454SAndrew Thompson #define	UHCI_PORTSC_OCIC	0x0800
9602ac6454SAndrew Thompson #define	UHCI_PORTSC_SUSP	0x1000
9702ac6454SAndrew Thompson 
9802ac6454SAndrew Thompson #define	URWMASK(x)		((x) & (UHCI_PORTSC_SUSP |		\
9902ac6454SAndrew Thompson 				UHCI_PORTSC_PR | UHCI_PORTSC_RD |	\
10002ac6454SAndrew Thompson 				UHCI_PORTSC_PE))
10102ac6454SAndrew Thompson 
10202ac6454SAndrew Thompson #define	UHCI_FRAMELIST_COUNT	1024	/* units */
10302ac6454SAndrew Thompson #define	UHCI_FRAMELIST_ALIGN	4096	/* bytes */
10402ac6454SAndrew Thompson 
10502ac6454SAndrew Thompson /* Structures alignment (bytes) */
10602ac6454SAndrew Thompson #define	UHCI_TD_ALIGN		16
10702ac6454SAndrew Thompson #define	UHCI_QH_ALIGN		16
10802ac6454SAndrew Thompson 
10902ac6454SAndrew Thompson #if	((USB_PAGE_SIZE < UHCI_TD_ALIGN) || (UHCI_TD_ALIGN == 0) ||	\
11002ac6454SAndrew Thompson 	(USB_PAGE_SIZE < UHCI_QH_ALIGN) || (UHCI_QH_ALIGN == 0))
11102ac6454SAndrew Thompson #error	"Invalid USB page size!"
11202ac6454SAndrew Thompson #endif
11302ac6454SAndrew Thompson 
11402ac6454SAndrew Thompson typedef uint32_t uhci_physaddr_t;
11502ac6454SAndrew Thompson 
11602ac6454SAndrew Thompson #define	UHCI_PTR_T		0x00000001
11702ac6454SAndrew Thompson #define	UHCI_PTR_TD		0x00000000
11802ac6454SAndrew Thompson #define	UHCI_PTR_QH		0x00000002
11902ac6454SAndrew Thompson #define	UHCI_PTR_VF		0x00000004
12002ac6454SAndrew Thompson 
12102ac6454SAndrew Thompson #define	UHCI_QH_REMOVE_DELAY	5	/* us - QH remove delay */
12202ac6454SAndrew Thompson 
12302ac6454SAndrew Thompson /*
12402ac6454SAndrew Thompson  * The Queue Heads (QH) and Transfer Descriptors (TD) are accessed by
12502ac6454SAndrew Thompson  * both the CPU and the USB-controller which run concurrently. Great
12602ac6454SAndrew Thompson  * care must be taken. When the data-structures are linked into the
12702ac6454SAndrew Thompson  * USB controller's frame list, the USB-controller "owns" the
12802ac6454SAndrew Thompson  * td_status and qh_elink fields, which will not be written by the
12902ac6454SAndrew Thompson  * CPU.
13002ac6454SAndrew Thompson  *
13102ac6454SAndrew Thompson  */
13202ac6454SAndrew Thompson 
13302ac6454SAndrew Thompson struct uhci_td {
13402ac6454SAndrew Thompson /*
13502ac6454SAndrew Thompson  * Data used by the UHCI controller.
13602ac6454SAndrew Thompson  * volatile is used in order to mantain struct members ordering.
13702ac6454SAndrew Thompson  */
13802ac6454SAndrew Thompson 	volatile uint32_t td_next;
13902ac6454SAndrew Thompson 	volatile uint32_t td_status;
14002ac6454SAndrew Thompson #define	UHCI_TD_GET_ACTLEN(s)	(((s) + 1) & 0x3ff)
14102ac6454SAndrew Thompson #define	UHCI_TD_ZERO_ACTLEN(t)	((t) | 0x3ff)
14202ac6454SAndrew Thompson #define	UHCI_TD_BITSTUFF	0x00020000
14302ac6454SAndrew Thompson #define	UHCI_TD_CRCTO		0x00040000
14402ac6454SAndrew Thompson #define	UHCI_TD_NAK		0x00080000
14502ac6454SAndrew Thompson #define	UHCI_TD_BABBLE		0x00100000
14602ac6454SAndrew Thompson #define	UHCI_TD_DBUFFER		0x00200000
14702ac6454SAndrew Thompson #define	UHCI_TD_STALLED		0x00400000
14802ac6454SAndrew Thompson #define	UHCI_TD_ACTIVE		0x00800000
14902ac6454SAndrew Thompson #define	UHCI_TD_IOC		0x01000000
15002ac6454SAndrew Thompson #define	UHCI_TD_IOS		0x02000000
15102ac6454SAndrew Thompson #define	UHCI_TD_LS		0x04000000
15202ac6454SAndrew Thompson #define	UHCI_TD_GET_ERRCNT(s)	(((s) >> 27) & 3)
15302ac6454SAndrew Thompson #define	UHCI_TD_SET_ERRCNT(n)	((n) << 27)
15402ac6454SAndrew Thompson #define	UHCI_TD_SPD		0x20000000
15502ac6454SAndrew Thompson 	volatile uint32_t td_token;
15602ac6454SAndrew Thompson #define	UHCI_TD_PID		0x000000ff
15702ac6454SAndrew Thompson #define	UHCI_TD_PID_IN		0x00000069
15802ac6454SAndrew Thompson #define	UHCI_TD_PID_OUT		0x000000e1
15902ac6454SAndrew Thompson #define	UHCI_TD_PID_SETUP	0x0000002d
16002ac6454SAndrew Thompson #define	UHCI_TD_GET_PID(s)	((s) & 0xff)
16102ac6454SAndrew Thompson #define	UHCI_TD_SET_DEVADDR(a)	((a) << 8)
16202ac6454SAndrew Thompson #define	UHCI_TD_GET_DEVADDR(s)	(((s) >> 8) & 0x7f)
16302ac6454SAndrew Thompson #define	UHCI_TD_SET_ENDPT(e)	(((e) & 0xf) << 15)
16402ac6454SAndrew Thompson #define	UHCI_TD_GET_ENDPT(s)	(((s) >> 15) & 0xf)
16502ac6454SAndrew Thompson #define	UHCI_TD_SET_DT(t)	((t) << 19)
16602ac6454SAndrew Thompson #define	UHCI_TD_GET_DT(s)	(((s) >> 19) & 1)
16702ac6454SAndrew Thompson #define	UHCI_TD_SET_MAXLEN(l)	(((l)-1) << 21)
16802ac6454SAndrew Thompson #define	UHCI_TD_GET_MAXLEN(s)	((((s) >> 21) + 1) & 0x7ff)
16902ac6454SAndrew Thompson #define	UHCI_TD_MAXLEN_MASK	0xffe00000
17002ac6454SAndrew Thompson 	volatile uint32_t td_buffer;
17102ac6454SAndrew Thompson /*
17202ac6454SAndrew Thompson  * Extra information needed:
17302ac6454SAndrew Thompson  */
17402ac6454SAndrew Thompson 	struct uhci_td *next;
17502ac6454SAndrew Thompson 	struct uhci_td *prev;
17602ac6454SAndrew Thompson 	struct uhci_td *obj_next;
17702ac6454SAndrew Thompson 	struct usb2_page_cache *page_cache;
17802ac6454SAndrew Thompson 	struct usb2_page_cache *fix_pc;
17902ac6454SAndrew Thompson 	uint32_t td_self;
18002ac6454SAndrew Thompson 	uint16_t len;
18102ac6454SAndrew Thompson } __aligned(UHCI_TD_ALIGN);
18202ac6454SAndrew Thompson 
18302ac6454SAndrew Thompson typedef struct uhci_td uhci_td_t;
18402ac6454SAndrew Thompson 
18502ac6454SAndrew Thompson #define	UHCI_TD_ERROR	(UHCI_TD_BITSTUFF | UHCI_TD_CRCTO | 		\
18602ac6454SAndrew Thompson 			UHCI_TD_BABBLE | UHCI_TD_DBUFFER | UHCI_TD_STALLED)
18702ac6454SAndrew Thompson 
18802ac6454SAndrew Thompson #define	UHCI_TD_SETUP(len, endp, dev)	(UHCI_TD_SET_MAXLEN(len) |	\
18902ac6454SAndrew Thompson 					UHCI_TD_SET_ENDPT(endp) |	\
19002ac6454SAndrew Thompson 					UHCI_TD_SET_DEVADDR(dev) |	\
19102ac6454SAndrew Thompson 					UHCI_TD_PID_SETUP)
19202ac6454SAndrew Thompson 
19302ac6454SAndrew Thompson #define	UHCI_TD_OUT(len, endp, dev, dt)	(UHCI_TD_SET_MAXLEN(len) |	\
19402ac6454SAndrew Thompson 					UHCI_TD_SET_ENDPT(endp) |	\
19502ac6454SAndrew Thompson 					UHCI_TD_SET_DEVADDR(dev) |	\
19602ac6454SAndrew Thompson 					UHCI_TD_PID_OUT | UHCI_TD_SET_DT(dt))
19702ac6454SAndrew Thompson 
19802ac6454SAndrew Thompson #define	UHCI_TD_IN(len, endp, dev, dt)	(UHCI_TD_SET_MAXLEN(len) |	\
19902ac6454SAndrew Thompson 					UHCI_TD_SET_ENDPT(endp) |	\
20002ac6454SAndrew Thompson 					UHCI_TD_SET_DEVADDR(dev) |	\
20102ac6454SAndrew Thompson 					UHCI_TD_PID_IN | UHCI_TD_SET_DT(dt))
20202ac6454SAndrew Thompson 
20302ac6454SAndrew Thompson struct uhci_qh {
20402ac6454SAndrew Thompson /*
20502ac6454SAndrew Thompson  * Data used by the UHCI controller.
20602ac6454SAndrew Thompson  */
20702ac6454SAndrew Thompson 	volatile uint32_t qh_h_next;
20802ac6454SAndrew Thompson 	volatile uint32_t qh_e_next;
20902ac6454SAndrew Thompson /*
21002ac6454SAndrew Thompson  * Extra information needed:
21102ac6454SAndrew Thompson  */
21202ac6454SAndrew Thompson 	struct uhci_qh *h_next;
21302ac6454SAndrew Thompson 	struct uhci_qh *h_prev;
21402ac6454SAndrew Thompson 	struct uhci_qh *obj_next;
21502ac6454SAndrew Thompson 	struct uhci_td *e_next;
21602ac6454SAndrew Thompson 	struct usb2_page_cache *page_cache;
21702ac6454SAndrew Thompson 	uint32_t qh_self;
21802ac6454SAndrew Thompson 	uint16_t intr_pos;
21902ac6454SAndrew Thompson } __aligned(UHCI_QH_ALIGN);
22002ac6454SAndrew Thompson 
22102ac6454SAndrew Thompson typedef struct uhci_qh uhci_qh_t;
22202ac6454SAndrew Thompson 
22302ac6454SAndrew Thompson /* Maximum number of isochronous TD's and QH's interrupt */
22402ac6454SAndrew Thompson #define	UHCI_VFRAMELIST_COUNT	128
22502ac6454SAndrew Thompson #define	UHCI_IFRAMELIST_COUNT	(2 * UHCI_VFRAMELIST_COUNT)
22602ac6454SAndrew Thompson 
22702ac6454SAndrew Thompson #if	(((UHCI_VFRAMELIST_COUNT & (UHCI_VFRAMELIST_COUNT-1)) != 0) ||	\
22802ac6454SAndrew Thompson 	(UHCI_VFRAMELIST_COUNT > UHCI_FRAMELIST_COUNT))
22902ac6454SAndrew Thompson #error	"UHCI_VFRAMELIST_COUNT is not power of two"
23002ac6454SAndrew Thompson #error	"or UHCI_VFRAMELIST_COUNT > UHCI_FRAMELIST_COUNT"
23102ac6454SAndrew Thompson #endif
23202ac6454SAndrew Thompson 
23302ac6454SAndrew Thompson #if (UHCI_VFRAMELIST_COUNT < USB_MAX_FS_ISOC_FRAMES_PER_XFER)
23402ac6454SAndrew Thompson #error "maximum number of full-speed isochronous frames is higher than supported!"
23502ac6454SAndrew Thompson #endif
23602ac6454SAndrew Thompson 
23702ac6454SAndrew Thompson struct uhci_config_desc {
23802ac6454SAndrew Thompson 	struct usb2_config_descriptor confd;
23902ac6454SAndrew Thompson 	struct usb2_interface_descriptor ifcd;
24002ac6454SAndrew Thompson 	struct usb2_endpoint_descriptor endpd;
24102ac6454SAndrew Thompson } __packed;
24202ac6454SAndrew Thompson 
24302ac6454SAndrew Thompson union uhci_hub_desc {
24402ac6454SAndrew Thompson 	struct usb2_status stat;
24502ac6454SAndrew Thompson 	struct usb2_port_status ps;
24602ac6454SAndrew Thompson 	struct usb2_device_descriptor devd;
24702ac6454SAndrew Thompson 	uint8_t	temp[128];
24802ac6454SAndrew Thompson };
24902ac6454SAndrew Thompson 
25002ac6454SAndrew Thompson struct uhci_hw_softc {
25102ac6454SAndrew Thompson 	struct usb2_page_cache pframes_pc;
25202ac6454SAndrew Thompson 	struct usb2_page_cache isoc_start_pc[UHCI_VFRAMELIST_COUNT];
25302ac6454SAndrew Thompson 	struct usb2_page_cache intr_start_pc[UHCI_IFRAMELIST_COUNT];
25402ac6454SAndrew Thompson 	struct usb2_page_cache ls_ctl_start_pc;
25502ac6454SAndrew Thompson 	struct usb2_page_cache fs_ctl_start_pc;
25602ac6454SAndrew Thompson 	struct usb2_page_cache bulk_start_pc;
25702ac6454SAndrew Thompson 	struct usb2_page_cache last_qh_pc;
25802ac6454SAndrew Thompson 	struct usb2_page_cache last_td_pc;
25902ac6454SAndrew Thompson 
26002ac6454SAndrew Thompson 	struct usb2_page pframes_pg;
26102ac6454SAndrew Thompson 	struct usb2_page isoc_start_pg[UHCI_VFRAMELIST_COUNT];
26202ac6454SAndrew Thompson 	struct usb2_page intr_start_pg[UHCI_IFRAMELIST_COUNT];
26302ac6454SAndrew Thompson 	struct usb2_page ls_ctl_start_pg;
26402ac6454SAndrew Thompson 	struct usb2_page fs_ctl_start_pg;
26502ac6454SAndrew Thompson 	struct usb2_page bulk_start_pg;
26602ac6454SAndrew Thompson 	struct usb2_page last_qh_pg;
26702ac6454SAndrew Thompson 	struct usb2_page last_td_pg;
26802ac6454SAndrew Thompson };
26902ac6454SAndrew Thompson 
27002ac6454SAndrew Thompson typedef struct uhci_softc {
27102ac6454SAndrew Thompson 	struct uhci_hw_softc sc_hw;
27202ac6454SAndrew Thompson 	struct usb2_bus sc_bus;		/* base device */
27302ac6454SAndrew Thompson 	union uhci_hub_desc sc_hub_desc;
27402ac6454SAndrew Thompson 	struct usb2_sw_transfer sc_root_ctrl;
27502ac6454SAndrew Thompson 	struct usb2_sw_transfer sc_root_intr;
27602ac6454SAndrew Thompson 
27702ac6454SAndrew Thompson 	struct usb2_device *sc_devices[UHCI_MAX_DEVICES];
27802ac6454SAndrew Thompson 	struct uhci_td *sc_isoc_p_last[UHCI_VFRAMELIST_COUNT];	/* pointer to last TD
27902ac6454SAndrew Thompson 								 * for isochronous */
28002ac6454SAndrew Thompson 	struct uhci_qh *sc_intr_p_last[UHCI_IFRAMELIST_COUNT];	/* pointer to last QH
28102ac6454SAndrew Thompson 								 * for interrupt */
28202ac6454SAndrew Thompson 	struct uhci_qh *sc_ls_ctl_p_last;	/* pointer to last QH for low
28302ac6454SAndrew Thompson 						 * speed control */
28402ac6454SAndrew Thompson 	struct uhci_qh *sc_fs_ctl_p_last;	/* pointer to last QH for full
28502ac6454SAndrew Thompson 						 * speed control */
28602ac6454SAndrew Thompson 	struct uhci_qh *sc_bulk_p_last;	/* pointer to last QH for bulk */
28702ac6454SAndrew Thompson 	struct uhci_qh *sc_reclaim_qh_p;
28802ac6454SAndrew Thompson 	struct uhci_qh *sc_last_qh_p;
28902ac6454SAndrew Thompson 	struct uhci_td *sc_last_td_p;
29002ac6454SAndrew Thompson 	struct resource *sc_io_res;
29102ac6454SAndrew Thompson 	struct resource *sc_irq_res;
29202ac6454SAndrew Thompson 	void   *sc_intr_hdl;
29302ac6454SAndrew Thompson 	device_t sc_dev;
29402ac6454SAndrew Thompson 	bus_size_t sc_io_size;
29502ac6454SAndrew Thompson 	bus_space_tag_t sc_io_tag;
29602ac6454SAndrew Thompson 	bus_space_handle_t sc_io_hdl;
29702ac6454SAndrew Thompson 
29802ac6454SAndrew Thompson 	uint32_t sc_loops;		/* number of QHs that wants looping */
29902ac6454SAndrew Thompson 
30002ac6454SAndrew Thompson 	uint16_t sc_intr_stat[UHCI_IFRAMELIST_COUNT];
30102ac6454SAndrew Thompson 	uint16_t sc_saved_frnum;
30202ac6454SAndrew Thompson 
30302ac6454SAndrew Thompson 	uint8_t	sc_addr;		/* device address */
30402ac6454SAndrew Thompson 	uint8_t	sc_conf;		/* device configuration */
30502ac6454SAndrew Thompson 	uint8_t	sc_isreset;		/* bits set if a root hub is reset */
30602ac6454SAndrew Thompson 	uint8_t	sc_isresumed;		/* bits set if a port was resumed */
30702ac6454SAndrew Thompson 	uint8_t	sc_saved_sof;
30802ac6454SAndrew Thompson 	uint8_t	sc_hub_idata[1];
30902ac6454SAndrew Thompson 
31002ac6454SAndrew Thompson 	char	sc_vendor[16];		/* vendor string for root hub */
31102ac6454SAndrew Thompson } uhci_softc_t;
31202ac6454SAndrew Thompson 
31302ac6454SAndrew Thompson usb2_bus_mem_cb_t uhci_iterate_hw_softc;
31402ac6454SAndrew Thompson 
31502ac6454SAndrew Thompson usb2_error_t uhci_init(uhci_softc_t *sc);
31602ac6454SAndrew Thompson void	uhci_suspend(uhci_softc_t *sc);
31702ac6454SAndrew Thompson void	uhci_resume(uhci_softc_t *sc);
31802ac6454SAndrew Thompson void	uhci_reset(uhci_softc_t *sc);
31902ac6454SAndrew Thompson void	uhci_interrupt(uhci_softc_t *sc);
32002ac6454SAndrew Thompson 
32102ac6454SAndrew Thompson #endif					/* _UHCI_H_ */
322