Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 1 Oct 2010 12:54:19 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 184337 for review
Message-ID:  <201010011254.o91CsJUG078084@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@184337?ac=10

Change 184337 by hselasky@hselasky_laptop001 on 2010/10/01 12:53:46

	USB controller:
		- XHCI style changes (no functional changes)
		- the definition of the WLENGTH mask was corrected
		- requested by Andrew Thompson

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/controller/xhci.c#32 edit
.. //depot/projects/usb/src/sys/dev/usb/controller/xhci.h#23 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/controller/xhci.c#32 (text+ko) ====

@@ -98,36 +98,41 @@
 #define	XHCI_INTR_ENDPT 1
 
 struct xhci_std_temp {
-	struct xhci_softc *sc;
-	struct usb_page_cache *pc;
-	struct xhci_td *td;
-	struct xhci_td *td_next;
-	uint32_t len;
-	uint32_t offset;
-	uint32_t max_packet_size;
-	uint32_t average;
-	uint16_t isoc_delta;
-	uint16_t isoc_frame;
-	uint8_t	shortpkt;
-	uint8_t multishort;
-	uint8_t last_frame;
-	uint8_t trb_type;
-	uint8_t direction;
-	uint8_t tbc;
-	uint8_t tlbpc;
-	uint8_t step_td;
+	struct xhci_softc	*sc;
+	struct usb_page_cache	*pc;
+	struct xhci_td		*td;
+	struct xhci_td		*td_next;
+	uint32_t		len;
+	uint32_t		offset;
+	uint32_t		max_packet_size;
+	uint32_t		average;
+	uint16_t		isoc_delta;
+	uint16_t		isoc_frame;
+	uint8_t			shortpkt;
+	uint8_t			multishort;
+	uint8_t			last_frame;
+	uint8_t			trb_type;
+	uint8_t			direction;
+	uint8_t			tbc;
+	uint8_t			tlbpc;
+	uint8_t			step_td;
 };
 
-static void xhci_do_poll(struct usb_bus *);
-static void xhci_device_done(struct usb_xfer *, usb_error_t);
-static void xhci_root_intr(struct xhci_softc *);
-static void xhci_free_device_ext(struct usb_device *udev);
-static struct xhci_endpoint_ext *xhci_get_endpoint_ext(struct usb_device *, struct usb_endpoint_descriptor *);
+static void	xhci_do_poll(struct usb_bus *);
+static void	xhci_device_done(struct usb_xfer *, usb_error_t);
+static void	xhci_root_intr(struct xhci_softc *);
+static void	xhci_free_device_ext(struct usb_device *);
+static struct xhci_endpoint_ext *xhci_get_endpoint_ext(struct usb_device *,
+		    struct usb_endpoint_descriptor *);
 static usb_proc_callback_t xhci_configure_msg;
 static usb_error_t xhci_configure_device(struct usb_device *);
-static usb_error_t xhci_configure_endpoint(struct usb_device *, struct usb_endpoint_descriptor *, uint64_t, uint16_t, uint8_t, uint8_t, uint8_t, uint16_t, uint16_t);
-static usb_error_t xhci_configure_mask(struct usb_device *, uint32_t, uint8_t);
-static usb_error_t xhci_cmd_evaluate_ctx(struct xhci_softc *, uint64_t, uint8_t);
+static usb_error_t xhci_configure_endpoint(struct usb_device *,
+		    struct usb_endpoint_descriptor *, uint64_t, uint16_t,
+		    uint8_t, uint8_t, uint8_t, uint16_t, uint16_t);
+static usb_error_t xhci_configure_mask(struct usb_device *,
+		    uint32_t, uint8_t);
+static usb_error_t xhci_cmd_evaluate_ctx(struct xhci_softc *,
+		    uint64_t, uint8_t);
 static void xhci_endpoint_doorbell(struct usb_xfer *);
 
 extern struct usb_bus_methods xhci_bus_methods;
@@ -217,7 +222,8 @@
 	DPRINTF("HCS0 = 0x%08x\n", temp);
 
 	if (XHCI_HCS0_CSZ(temp)) {
-		device_printf(sc->sc_bus.parent, "Driver does not support 64-byte contexts.");
+		device_printf(sc->sc_bus.parent, "Driver does not "
+		    "support 64-byte contexts.");
 		return (USB_ERR_IOERROR);
 	}
 
@@ -226,13 +232,15 @@
 
 	for (i = 0; i != 100; i++) {
 		usb_pause_mtx(NULL, hz / 1000);
-		temp = XREAD4(sc, oper, XHCI_USBCMD) & (XHCI_CMD_HCRST | XHCI_STS_CNR);
+		temp = XREAD4(sc, oper, XHCI_USBCMD) &
+		    (XHCI_CMD_HCRST | XHCI_STS_CNR);
 		if (!temp)
 			break;
 	}
 
 	if (temp) {
-		device_printf(sc->sc_bus.parent, "Controller reset timeout.\n");
+		device_printf(sc->sc_bus.parent, "Controller "
+		    "reset timeout.\n");
 		return (USB_ERR_IOERROR);
 	}
 
@@ -288,16 +296,12 @@
 
 	/* clear interrupts */
 	XWRITE4(sc, oper, XHCI_USBSTS, temp);
-
 	/* disable all device notifications */
 	XWRITE4(sc, oper, XHCI_DNCTRL, 0);
 
 	/* setup device context base address */
-
 	usbd_get_page(&sc->sc_hw.ctx_pc, 0, &buf_res);
-
 	pdctxa = buf_res.buffer;
-
 	memset(pdctxa, 0, sizeof(*pdctxa));
 
 	addr = buf_res.physaddr;
@@ -307,11 +311,8 @@
 	pdctxa->qwBaaDevCtxAddr[0] = htole64(addr);
 
 	for (i = 0; i != sc->sc_noscratch; i++) {
-
 		struct usb_page_search buf_scp;
-
 		usbd_get_page(&sc->sc_hw.scratch_pc[i], 0, &buf_scp);
-
 		pdctxa->qwSpBufPtr[i] = htole64((uint64_t)buf_scp.physaddr);
 	}
 
@@ -319,7 +320,6 @@
 
 	XWRITE4(sc, oper, XHCI_DCBAAP_LO, (uint32_t)addr);
 	XWRITE4(sc, oper, XHCI_DCBAAP_HI, (uint32_t)(addr >> 32));
-
 	XWRITE4(sc, oper, XHCI_DCBAAP_LO, (uint32_t)addr);
 	XWRITE4(sc, oper, XHCI_DCBAAP_HI, (uint32_t)(addr >> 32));
 
@@ -342,7 +342,6 @@
 	XWRITE4(sc, runt, XHCI_ERSTSZ(0), XHCI_ERSTS_SET(temp));
 
 	/* Setup interrupt rate */
-
 	XWRITE4(sc, runt, XHCI_IMOD(0), XHCI_IMOD_DEFAULT);
 
 	usbd_get_page(&sc->sc_hw.root_pc, 0, &buf_res);
@@ -352,7 +351,6 @@
 	addr += (uintptr_t)&((struct xhci_hw_root *)0)->hwr_events[0];
 
 	/* reset hardware root structure */
-
 	memset(phwr, 0, sizeof(*phwr));
 
 	phwr->hwr_ring_seg[0].qwEvrsTablePtr = htole64(addr);
@@ -377,7 +375,6 @@
 	XWRITE4(sc, runt, XHCI_IMAN(0), temp);
 
 	/* setup command ring control base address */
-
 	addr = buf_res.physaddr;
 	addr += (uintptr_t)&((struct xhci_hw_root *)0)->hwr_commands[0];
 
@@ -557,8 +554,8 @@
 			break;
 		}
 		/* Check for transfer error */
-		if ((status != XHCI_TRB_ERROR_SHORT_PKT) &&
-		    (status != XHCI_TRB_ERROR_SUCCESS)) {
+		if (status != XHCI_TRB_ERROR_SHORT_PKT &&
+		    status != XHCI_TRB_ERROR_SUCCESS) {
 			/* the transfer is finished */
 			td = NULL;
 			break;
@@ -589,8 +586,8 @@
 	xfer->td_transfer_cache = td;
 
 	return ((status == XHCI_TRB_ERROR_STALL) ? USB_ERR_STALLED : 
-	    ((status != XHCI_TRB_ERROR_SHORT_PKT) && 
-	    (status != XHCI_TRB_ERROR_SUCCESS)) ? USB_ERR_IOERROR :
+	    (status != XHCI_TRB_ERROR_SHORT_PKT && 
+	    status != XHCI_TRB_ERROR_SUCCESS) ? USB_ERR_IOERROR :
 	    USB_ERR_NORMAL_COMPLETION);
 }
 
@@ -712,8 +709,8 @@
 	index = XHCI_TRB_3_SLOT_GET(temp);
 
 	/* check if error means halted */
-	halted = (status != XHCI_TRB_ERROR_SHORT_PKT) &&
-	    (status != XHCI_TRB_ERROR_SUCCESS);
+	halted = (status != XHCI_TRB_ERROR_SHORT_PKT &&
+	    status != XHCI_TRB_ERROR_SUCCESS);
 
 	DPRINTF("slot=%u epno=%u remainder=%u status=%u\n",
 	    index, epno, remainder, status);
@@ -759,8 +756,8 @@
 
 		offset = td_event - td->td_self;
 
-		if ((offset >= 0) &&
-		    (offset < sizeof(td->td_trb))) {
+		if (offset >= 0 &&
+		    offset < sizeof(td->td_trb)) {
 
 			usb_pc_cpu_invalidate(td->page_cache);
 
@@ -1165,7 +1162,6 @@
 		}
 
 		/* configure input endpoint context structure */
-
 		switch (udev->speed) {
 		case USB_SPEED_LOW:
 		case USB_SPEED_FULL:
@@ -1526,7 +1522,8 @@
 			td->td_trb[0].qwTrb0 = 0;
 
 			usbd_copy_out(temp->pc, temp->offset + buf_offset, 
-			   (uint8_t *)(uintptr_t)&td->td_trb[0].qwTrb0, average);
+			   (uint8_t *)(uintptr_t)&td->td_trb[0].qwTrb0,
+			   average);
 
 			dword = XHCI_TRB_2_BYTES_SET(8) |
 			    XHCI_TRB_2_TDSZ_SET(0) |
@@ -1538,7 +1535,8 @@
 			  XHCI_TRB_3_IDT_BIT | XHCI_TRB_3_CYCLE_BIT;
 
 			/* check wLength */
-			if (td->td_trb[0].qwTrb0 & htole64(0xFFFF00000000ULL)) {
+			if (td->td_trb[0].qwTrb0 &
+			   htole64(XHCI_TRB_0_WLENGTH_MASK)) {
 				if (td->td_trb[0].qwTrb0 & htole64(1))
 					dword |= XHCI_TRB_3_TRT_IN;
 				else
@@ -1606,8 +1604,10 @@
 				 * can be sent using the wrong data
 				 * toggle value.
 				 */
-				if ((temp->trb_type != XHCI_TRB_TYPE_SETUP_STAGE) &&
-				    (temp->trb_type != XHCI_TRB_TYPE_STATUS_STAGE))
+				if (temp->trb_type !=
+				    XHCI_TRB_TYPE_SETUP_STAGE &&
+				    temp->trb_type !=
+				    XHCI_TRB_TYPE_STATUS_STAGE)
 					dword |= XHCI_TRB_3_ISP_BIT;
 			}
 
@@ -1838,7 +1838,7 @@
 
 		temp.len = xfer->frlengths[x];
 		temp.step_td = ((xfer->endpointno & UE_DIR_IN) &&
-		    (x != 0) && (temp.multishort == 0));
+		    x != 0 && temp.multishort == 0);
 
 		x++;
 
@@ -1963,7 +1963,7 @@
 	pinp = buf_inp.buffer;
 
 	if (drop) {
-		mask &= 0xFFFFFFFC;
+		mask &= XHCI_INCTX_NON_CTRL_MASK;
 		pinp->ctx_input.dwInCtx0 = htole32(mask);
 		pinp->ctx_input.dwInCtx1 = 0;
 	} else {
@@ -2091,7 +2091,8 @@
 	case UE_INTERRUPT:
 	case UE_ISOCHRONOUS:
 		temp = XHCI_EPCTX_4_MAX_ESIT_PAYLOAD_SET(max_frame_size) |
-		    XHCI_EPCTX_4_AVG_TRB_LEN_SET(MIN(XHCI_PAGE_SIZE, max_frame_size));
+		    XHCI_EPCTX_4_AVG_TRB_LEN_SET(MIN(XHCI_PAGE_SIZE,
+		    max_frame_size));
 		break;
 	case UE_CONTROL:
 		temp = XHCI_EPCTX_4_AVG_TRB_LEN_SET(8);
@@ -2217,9 +2218,9 @@
 		break;
 	}
 
-	is_hub = (sc->sc_hw.devs[index].nports != 0) &&
-	    ((udev->speed == USB_SPEED_SUPER) ||
-	    (udev->speed == USB_SPEED_HIGH));
+	is_hub = sc->sc_hw.devs[index].nports != 0 &&
+	    (udev->speed == USB_SPEED_SUPER ||
+	    udev->speed == USB_SPEED_HIGH);
 
 	if (is_hub) {
 		temp |= XHCI_SCTX_0_HUB_SET(1);
@@ -2235,8 +2236,10 @@
 
 	temp = XHCI_SCTX_1_RH_PORT_SET(rh_port);
 
-	if (is_hub)
-		temp |= XHCI_SCTX_1_NUM_PORTS_SET(sc->sc_hw.devs[index].nports);
+	if (is_hub) {
+		temp |= XHCI_SCTX_1_NUM_PORTS_SET(
+		    sc->sc_hw.devs[index].nports);
+	}
 
 	switch (udev->speed) {
 	case USB_SPEED_SUPER:
@@ -2375,24 +2378,14 @@
 xhci_free_device_ext(struct usb_device *udev)
 {
 	struct xhci_softc *sc = XHCI_BUS2SC(udev->bus);
-	struct usb_page_cache *pc;
 	uint8_t index;
 
 	index = udev->controller_slot_id;
-
 	xhci_set_slot_pointer(sc, index, 0);
 
-	pc = &sc->sc_hw.devs[index].device_pc;
-
-	usb_pc_free_mem(pc);
-
-	pc = &sc->sc_hw.devs[index].input_pc;
-
-	usb_pc_free_mem(pc);
-
-	pc = &sc->sc_hw.devs[index].endpoint_pc;
-
-	usb_pc_free_mem(pc);
+	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);
 }
 
 static struct xhci_endpoint_ext *
@@ -2458,7 +2451,7 @@
 
 		pepext->xfer[xfer->qh_pos] = NULL;
 
-		if (error && (pepext->trb_running != 0)) {
+		if (error && pepext->trb_running != 0) {
 			pepext->trb_halted = 1;
 			pepext->trb_running = 0;
 		}
@@ -2963,7 +2956,7 @@
 		}
 		break;
 	case C(UR_SET_CONFIG, UT_WRITE_DEVICE):
-		if ((value != 0) && (value != 1)) {
+		if (value != 0 && value != 1) {
 			err = USB_ERR_IOERROR;
 			goto done;
 		}

==== //depot/projects/usb/src/sys/dev/usb/controller/xhci.h#23 (text+ko) ====

@@ -57,7 +57,8 @@
 	volatile uint64_t	qwSpBufPtr[XHCI_MAX_SCRATCHPADS];
 };
 
-#define	XHCI_EPNO2EPID(x) ((((x) & UE_DIR_IN) ? 1 : 0) | (2 * ((x) & UE_ADDR)))
+#define	XHCI_EPNO2EPID(x) \
+    ((((x) & UE_DIR_IN) ? 1 : 0) | (2 * ((x) & UE_ADDR)))
 
 struct xhci_slot_ctx {
 	volatile uint32_t	dwSctx0;
@@ -136,6 +137,7 @@
 };
 
 struct xhci_input_ctx {
+#define	XHCI_INCTX_NON_CTRL_MASK	0xFFFFFFFCU
 	volatile uint32_t	dwInCtx0;
 #define	XHCI_INCTX_0_DROP_MASK(n)	(1U << (n))
 	volatile uint32_t	dwInCtx1;
@@ -180,6 +182,7 @@
 
 struct xhci_trb {
 	volatile uint64_t	qwTrb0;
+#define	XHCI_TRB_0_WLENGTH_MASK		(0xFFFFULL << 48)
 	volatile uint32_t	dwTrb2;
 #define	XHCI_TRB_2_ERROR_GET(x)		(((x) >> 24) & 0xFF)
 #define	XHCI_TRB_2_ERROR_SET(x)		(((x) & 0xFF) << 24)
@@ -299,10 +302,10 @@
 #define	XHCI_TRB_ERROR_INVALID_SID	0x22
 #define	XHCI_TRB_ERROR_SEC_BW		0x23
 #define	XHCI_TRB_ERROR_SPLIT_XACT	0x24
-};
+} __aligned(4);
 
 struct xhci_dev_endpoint_trbs {
-	struct xhci_trb trb[XHCI_MAX_ENDPOINTS][XHCI_MAX_TRANSFERS];
+	struct xhci_trb		trb[XHCI_MAX_ENDPOINTS][XHCI_MAX_TRANSFERS];
 };
 
 #define	XHCI_TD_PAGE_NBUF	17	/* units, room enough for 64Kbytes */
@@ -310,25 +313,24 @@
 #define	XHCI_TD_PAYLOAD_MAX	(XHCI_TD_PAGE_SIZE * (XHCI_TD_PAGE_NBUF - 1))
 
 struct xhci_td {
-	struct xhci_trb	td_trb[XHCI_TD_PAGE_NBUF + 1];
+	struct xhci_trb		td_trb[XHCI_TD_PAGE_NBUF + 1];
 
 /*
  * Extra information needed:
  */
-	uint64_t td_self;
-	struct xhci_td *next;
-	struct xhci_td *alt_next;
-	struct xhci_td *obj_next;
-	struct usb_page_cache *page_cache;
-	uint32_t len;
-	uint32_t remainder;
-	uint8_t ntrb;
-	uint8_t status;
-
+	uint64_t		td_self;
+	struct xhci_td		*next;
+	struct xhci_td		*alt_next;
+	struct xhci_td		*obj_next;
+	struct usb_page_cache	*page_cache;
+	uint32_t		len;
+	uint32_t		remainder;
+	uint8_t			ntrb;
+	uint8_t			status;
 } __aligned(XHCI_TRB_ALIGN);
 
 struct xhci_command {
-	struct xhci_trb trb;
+	struct xhci_trb		trb;
 	TAILQ_ENTRY(xhci_command) entry;
 };
 
@@ -342,20 +344,20 @@
 	struct xhci_event_ring_seg	hwr_ring_seg[XHCI_MAX_RSEG];
 	struct {
 		volatile uint64_t dummy;
-	} __aligned(64) padding;
+	} __aligned(64)			padding;
 	struct xhci_trb			hwr_events[XHCI_MAX_EVENTS];
 	struct xhci_trb			hwr_commands[XHCI_MAX_COMMANDS];
 };
 
 struct xhci_endpoint_ext {
-	struct xhci_trb *trb;
-	struct usb_xfer *xfer[XHCI_MAX_TRANSFERS - 1];
-	struct usb_page_cache *page_cache;
-	uint64_t physaddr;
-	uint8_t trb_used;
-	uint8_t trb_index;
-	uint8_t trb_halted;
-	uint8_t trb_running;
+	struct xhci_trb		*trb;
+	struct usb_xfer		*xfer[XHCI_MAX_TRANSFERS - 1];
+	struct usb_page_cache	*page_cache;
+	uint64_t		physaddr;
+	uint8_t			trb_used;
+	uint8_t			trb_index;
+	uint8_t			trb_halted;
+	uint8_t			trb_running;
 };
 
 enum {
@@ -368,101 +370,113 @@
 };
 
 struct xhci_hw_dev {
-	struct usb_page_cache device_pc;
-	struct usb_page_cache input_pc;
-	struct usb_page_cache endpoint_pc;
+	struct usb_page_cache	device_pc;
+	struct usb_page_cache	input_pc;
+	struct usb_page_cache	endpoint_pc;
 
-	struct usb_page device_pg;
-	struct usb_page input_pg;
-	struct usb_page endpoint_pg;
+	struct usb_page		device_pg;
+	struct usb_page		input_pg;
+	struct usb_page		endpoint_pg;
 
 	struct xhci_endpoint_ext endp[XHCI_MAX_ENDPOINTS];
 
-	uint8_t state;
-	uint8_t nports;
-	uint8_t tt;
-	uint8_t reserved;
+	uint8_t			state;
+	uint8_t			nports;
+	uint8_t			tt;
+	uint8_t			reserved;
 };
 
 struct xhci_hw_softc {
-	struct usb_page_cache root_pc;
-	struct usb_page_cache ctx_pc;
-	struct usb_page_cache scratch_pc[XHCI_MAX_SCRATCHPADS];
+	struct usb_page_cache	root_pc;
+	struct usb_page_cache	ctx_pc;
+	struct usb_page_cache	scratch_pc[XHCI_MAX_SCRATCHPADS];
 
-	struct usb_page root_pg;
-	struct usb_page ctx_pg;
-	struct usb_page scratch_pg[XHCI_MAX_SCRATCHPADS];
+	struct usb_page		root_pg;
+	struct usb_page		ctx_pg;
+	struct usb_page		scratch_pg[XHCI_MAX_SCRATCHPADS];
 
-	struct xhci_hw_dev devs[XHCI_MAX_DEVICES + 1];
+	struct xhci_hw_dev	devs[XHCI_MAX_DEVICES + 1];
 };
 
 struct xhci_config_desc {
-	struct usb_config_descriptor confd;
-	struct usb_interface_descriptor ifcd;
-	struct usb_endpoint_descriptor endpd;
-	struct usb_endpoint_ss_comp_descriptor endpcd;
+	struct usb_config_descriptor		confd;
+	struct usb_interface_descriptor		ifcd;
+	struct usb_endpoint_descriptor		endpd;
+	struct usb_endpoint_ss_comp_descriptor	endpcd;
 } __packed;
 
 struct xhci_bos_desc {
-	struct usb_bos_descriptor bosd;
-	struct usb_devcap_usb2ext_descriptor usb2extd;
-	struct usb_devcap_ss_descriptor usbdcd;
+	struct usb_bos_descriptor		bosd;
+	struct usb_devcap_usb2ext_descriptor	usb2extd;
+	struct usb_devcap_ss_descriptor		usbdcd;
 	struct usb_devcap_container_id_descriptor cidd;
 } __packed;
 
 union xhci_hub_desc {
-	struct usb_status stat;
-	struct usb_port_status ps;
-	struct usb_hub_ss_descriptor hubd;
-	uint8_t	temp[128];
+	struct usb_status		stat;
+	struct usb_port_status		ps;
+	struct usb_hub_ss_descriptor	hubd;
+	uint8_t				temp[128];
 };
 
 struct xhci_softc {
-	struct xhci_hw_softc sc_hw;
-	struct usb_bus sc_bus;		/* base device */
-	struct usb_process sc_config_proc;	/* configure process */
-	struct usb_bus_msg sc_config_msg[2];
+	struct xhci_hw_softc	sc_hw;
+	/* base device */
+	struct usb_bus		sc_bus;
+	/* configure process */
+	struct usb_process	sc_config_proc;
+	struct usb_bus_msg	sc_config_msg[2];
 
-	union xhci_hub_desc sc_hub_desc;
+	union xhci_hub_desc	sc_hub_desc;
 
-	struct cv sc_cmd_cv;
-	struct sx sc_cmd_sx;
+	struct cv		sc_cmd_cv;
+	struct sx		sc_cmd_sx;
 
-	struct usb_device *sc_devices[XHCI_MAX_DEVICES];
-	struct resource *sc_io_res;
-	struct resource *sc_irq_res;
+	struct usb_device	*sc_devices[XHCI_MAX_DEVICES];
+	struct resource		*sc_io_res;
+	struct resource		*sc_irq_res;
 
-	void   *sc_intr_hdl;
-	bus_size_t sc_io_size;
-	bus_space_tag_t sc_io_tag;
-	bus_space_handle_t sc_io_hdl;
+	void			*sc_intr_hdl;
+	bus_size_t		sc_io_size;
+	bus_space_tag_t		sc_io_tag;
+	bus_space_handle_t	sc_io_hdl;
+	/* last pending command address */
+	uint64_t		sc_cmd_addr;
+	/* result of command */
+	uint32_t		sc_cmd_result[2];
+ 	/* copy of cmd register */
+	uint32_t		sc_cmd;
+	/* worst case exit latency */
+	uint32_t		sc_exit_lat_max;
 
-	uint64_t sc_cmd_addr;		/* current pending command */
-	uint32_t sc_cmd_result[2];	/* result of command */
+	/* offset to operational registers */
+	uint32_t		sc_oper_off;
+	/* offset to capability registers */
+	uint32_t		sc_capa_off;
+	/* offset to runtime registers */
+	uint32_t		sc_runt_off;
+	/* offset to doorbell registers */
+	uint32_t		sc_door_off;
 
-	uint32_t sc_cmd;		/* copy of cmd register */
-	uint32_t sc_exit_lat_max;	/* worst case exit latency */
+	/* chip specific */
+	uint16_t		sc_erst_max;
+	uint16_t		sc_event_idx;
+	uint16_t		sc_command_idx;
 
-	uint32_t sc_oper_off;		/* offset to operational registers */
-	uint32_t sc_capa_off;		/* offset to capability registers */
-	uint32_t sc_runt_off;		/* offset to runtime registers */
-	uint32_t sc_door_off;		/* offset to doorbell registers */
+	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;
+	uint8_t			sc_hub_idata[2];
 
-	uint16_t sc_flags;		/* chip specific flags */
-	uint16_t sc_erst_max;
-	uint16_t sc_event_idx;
-	uint16_t sc_command_idx;
-
-	uint8_t sc_event_ccs;
-	uint8_t sc_command_ccs;
-	uint8_t	sc_noslot;		/* number of XHCI device slots */
-	uint8_t	sc_noport;		/* number of ports on root HUB */
-	uint8_t sc_noscratch;		/* number of scratch pages */
-	uint8_t	sc_conf;		/* root HUB device configuration */
-	uint8_t	sc_hub_idata[2];
-
-	char	sc_vendor[16];		/* vendor string for root hub */
-
+	/* vendor string for root HUB */
+	char			sc_vendor[16];
 };
 
 #define	XHCI_CMD_LOCK(sc)	sx_xlock(&(sc)->sc_cmd_sx)
@@ -471,13 +485,13 @@
 
 /* prototypes */
 
-void xhci_suspend(struct xhci_softc *);
-void xhci_resume(struct xhci_softc *);
-void xhci_shutdown(struct xhci_softc *);
+usb_error_t xhci_halt_controller(struct xhci_softc *);
 usb_error_t xhci_init(struct xhci_softc *, device_t);
-void xhci_uninit(struct xhci_softc *);
 usb_error_t xhci_start_controller(struct xhci_softc *);
-usb_error_t xhci_halt_controller(struct xhci_softc *);
-void xhci_interrupt(struct xhci_softc *);
+void	xhci_interrupt(struct xhci_softc *);
+void	xhci_resume(struct xhci_softc *);
+void	xhci_shutdown(struct xhci_softc *);
+void	xhci_suspend(struct xhci_softc *);
+void	xhci_uninit(struct xhci_softc *);
 
 #endif					/* _XHCI_H_ */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010011254.o91CsJUG078084>