tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[patch] xhci patch 20151021
Hello,
Here are xhci patches for nick-nhusb branch.
nhusb-xhci-cos.diff
+ Cosmetic: remove space after unary operator ~.
nhusb-xhci-psfix.diff
+ Fix the bug that port feature UHF_PORT_{U1,U2}_TIMEOUT
were never set.
PS_SPEED bits were always cleared.
+ Fix the bug of logic inversion whether port speed is SS
when setting feature UHF_PORT_{U1,U2}_TIMEOUT.
+ Add comments.
nhusb-xhci-macro.diff
+ Replace long lines descending pointers with macros.
Regards,
--
t-hash
--- sys/dev/usb/xhci.c.orig 2015-10-11 20:57:37.000000000 +0900
+++ sys/dev/usb/xhci.c 2015-10-19 21:15:54.000000000 +0900
@@ -2872,7 +2872,7 @@ xhci_roothub_ctrl(struct usbd_bus *bus,
v &= ~XHCI_PS_CLEAR;
switch (value) {
case UHF_PORT_ENABLE:
- xhci_op_write_4(sc, port, v &~ XHCI_PS_PED);
+ xhci_op_write_4(sc, port, v & ~XHCI_PS_PED);
break;
case UHF_PORT_SUSPEND:
return -1;
@@ -2993,7 +2993,7 @@ xhci_roothub_ctrl(struct usbd_bus *bus,
/* XXX suspend */
break;
case UHF_PORT_RESET:
- v &= ~ (XHCI_PS_PED | XHCI_PS_PR);
+ v &= ~(XHCI_PS_PED | XHCI_PS_PR);
xhci_op_write_4(sc, port, v | XHCI_PS_PR);
/* Wait for reset to complete. */
usb_delay_ms(&sc->sc_bus, USB_PORT_ROOT_RESET_DELAY);
--- sys/dev/usb/xhci.c.orig 2015-10-19 21:17:29.000000000 +0900
+++ sys/dev/usb/xhci.c 2015-10-19 21:22:09.000000000 +0900
@@ -123,6 +123,7 @@ struct xhci_pipe {
#define XHCI_EVENT_RING_TRBS 256
#define XHCI_EVENT_RING_SEGMENTS 1
#define XHCI_TRB_3_ED_BIT XHCI_TRB_3_ISP_BIT
+#define XHCI_PS_SS(ps) USB_IS_SS(xhci_xspeed2speed(XHCI_PS_SPEED_GET(ps)))
static usbd_status xhci_open(struct usbd_pipe *);
static void xhci_close_pipe(struct usbd_pipe *);
@@ -2860,6 +2861,7 @@ xhci_roothub_ctrl(struct usbd_bus *bus,
/* Hub requests */
case C(UR_CLEAR_FEATURE, UT_WRITE_CLASS_DEVICE):
break;
+ /* Clear Port Feature request */
case C(UR_CLEAR_FEATURE, UT_WRITE_CLASS_OTHER):
DPRINTFN(4, "UR_CLEAR_PORT_FEATURE port=%d feature=%d",
index, value, 0, 0);
@@ -2930,6 +2932,7 @@ xhci_roothub_ctrl(struct usbd_bus *bus,
memset(buf, 0, len); /* ? XXX */
totlen = len;
break;
+ /* Get Port Status request */
case C(UR_GET_STATUS, UT_READ_CLASS_OTHER):
DPRINTFN(8, "get port status i=%d", index, 0, 0, 0);
if (index < 1 || index > sc->sc_maxports) {
@@ -2975,6 +2978,7 @@ xhci_roothub_ctrl(struct usbd_bus *bus,
break;
case C(UR_SET_FEATURE, UT_WRITE_CLASS_DEVICE):
break;
+ /* Set Port Feature request */
case C(UR_SET_FEATURE, UT_WRITE_CLASS_OTHER): {
int optval = (index >> 8) & 0xff;
index &= 0xff;
@@ -2984,6 +2988,7 @@ xhci_roothub_ctrl(struct usbd_bus *bus,
port = XHCI_PORTSC(index);
v = xhci_op_read_4(sc, port);
DPRINTFN(4, "portsc=0x%08x", v, 0, 0, 0);
+ uint32_t v0 = v;
v &= ~XHCI_PS_CLEAR;
switch (value) {
case UHF_PORT_ENABLE:
@@ -3015,9 +3020,8 @@ xhci_roothub_ctrl(struct usbd_bus *bus,
xhci_op_write_4(sc, port, v | XHCI_PS_PRC);
break;
case UHF_PORT_U1_TIMEOUT:
- if (USB_IS_SS(xhci_xspeed2speed(XHCI_PS_SPEED_GET(v)))){
+ if (!XHCI_PS_SS(v0))
return -1;
- }
port = XHCI_PORTPMSC(index);
v = xhci_op_read_4(sc, port);
v &= ~XHCI_PM3_U1TO_SET(0xff);
@@ -3025,9 +3029,8 @@ xhci_roothub_ctrl(struct usbd_bus *bus,
xhci_op_write_4(sc, port, v);
break;
case UHF_PORT_U2_TIMEOUT:
- if (USB_IS_SS(xhci_xspeed2speed(XHCI_PS_SPEED_GET(v)))){
+ if (!XHCI_PS_SS(v0))
return -1;
- }
port = XHCI_PORTPMSC(index);
v = xhci_op_read_4(sc, port);
v &= ~XHCI_PM3_U2TO_SET(0xff);
--- sys/dev/usb/xhci.c.orig 2015-10-21 21:35:35.000000000 +0900
+++ sys/dev/usb/xhci.c 2015-10-21 21:36:45.000000000 +0900
@@ -114,6 +114,12 @@ fail:
#define XHCI_ICI_INPUT_CONTROL 0
+#define XHCI_PIPE2EDESC(pipe) ((pipe)->up_endpoint->ue_edesc)
+#define XHCI_PIPE2DCI(pipe) xhci_ep_get_dci(XHCI_PIPE2EDESC(pipe))
+#define XHCI_XFER2DCI(xfer) XHCI_PIPE2DCI((xfer)->ux_pipe)
+#define XHCI_PIPE2XS(pipe) ((pipe)->up_dev->ud_hcpriv)
+#define XHCI_XFER2XS(xfer) XHCI_PIPE2XS((xfer)->ux_pipe)
+
struct xhci_pipe {
struct usbd_pipe xp_pipe;
struct usb_task xp_async_task;
@@ -1200,7 +1206,7 @@ xhci_setup_sctx(struct usbd_device *dev,
static uint32_t
xhci_get_maxburst(struct usbd_pipe *pipe)
{
- usb_endpoint_descriptor_t * const ed = pipe->up_endpoint->ue_edesc;
+ usb_endpoint_descriptor_t * const ed = XHCI_PIPE2EDESC(pipe);
usbd_desc_iter_t iter;
const usb_cdc_descriptor_t *cdcd;
const usb_endpoint_ss_comp_descriptor_t * esscd = NULL;
@@ -1274,9 +1280,9 @@ xhci_bival2ival(uint32_t ival, int speed
static void
xhci_setup_endp_ctx(struct usbd_pipe *pipe, uint32_t *cp)
{
- struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
- usb_endpoint_descriptor_t * const ed = pipe->up_endpoint->ue_edesc;
- const u_int dci = xhci_ep_get_dci(ed);
+ struct xhci_slot * const xs = XHCI_PIPE2XS(pipe);
+ const u_int dci = XHCI_PIPE2DCI(pipe);
+ usb_endpoint_descriptor_t * const ed = XHCI_PIPE2EDESC(pipe);
const uint8_t xfertype = UE_GET_XFERTYPE(ed->bmAttributes);
uint32_t mps = UGETW(ed->wMaxPacketSize);
uint32_t maxb = 0;
@@ -1369,17 +1375,17 @@ xhci_setup_endp_ctx(struct usbd_pipe *pi
static usbd_status
xhci_configure_endpoint(struct usbd_pipe *pipe)
{
- struct xhci_softc * const sc = pipe->up_dev->ud_bus->ub_hcpriv;
- struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
- const u_int dci = xhci_ep_get_dci(pipe->up_endpoint->ue_edesc);
+ struct xhci_softc * const sc = XHCI_PIPE2SC(pipe);
+ struct xhci_slot * const xs = XHCI_PIPE2XS(pipe);
+ const u_int dci = XHCI_PIPE2DCI(pipe);
struct xhci_trb trb;
usbd_status err;
uint32_t *cp;
XHCIHIST_FUNC(); XHCIHIST_CALLED();
DPRINTFN(4, "slot %u dci %u epaddr 0x%02x attr 0x%02x",
- xs->xs_idx, dci, pipe->up_endpoint->ue_edesc->bEndpointAddress,
- pipe->up_endpoint->ue_edesc->bmAttributes);
+ xs->xs_idx, dci, XHCI_PIPE2EDESC(pipe)->bEndpointAddress,
+ XHCI_PIPE2EDESC(pipe)->bmAttributes);
/* XXX ensure input context is available? */
@@ -1424,7 +1430,7 @@ static usbd_status
xhci_unconfigure_endpoint(struct usbd_pipe *pipe)
{
#ifdef USB_DEBUG
- struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
+ struct xhci_slot * const xs = XHCI_PIPE2XS(pipe);
#endif
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -1438,9 +1444,9 @@ xhci_unconfigure_endpoint(struct usbd_pi
static usbd_status
xhci_reset_endpoint(struct usbd_pipe *pipe)
{
- struct xhci_softc * const sc = pipe->up_dev->ud_bus->ub_hcpriv;
- struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
- const u_int dci = xhci_ep_get_dci(pipe->up_endpoint->ue_edesc);
+ struct xhci_softc * const sc = XHCI_PIPE2SC(pipe);
+ struct xhci_slot * const xs = XHCI_PIPE2XS(pipe);
+ const u_int dci = XHCI_PIPE2DCI(pipe);
struct xhci_trb trb;
usbd_status err;
@@ -1468,11 +1474,11 @@ xhci_reset_endpoint(struct usbd_pipe *pi
static usbd_status
xhci_stop_endpoint(struct usbd_pipe *pipe)
{
- struct xhci_softc * const sc = pipe->up_dev->ud_bus->ub_hcpriv;
- struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
+ struct xhci_softc * const sc = XHCI_PIPE2SC(pipe);
+ struct xhci_slot * const xs = XHCI_PIPE2XS(pipe);
+ const u_int dci = XHCI_PIPE2DCI(pipe);
struct xhci_trb trb;
usbd_status err;
- const u_int dci = xhci_ep_get_dci(pipe->up_endpoint->ue_edesc);
XHCIHIST_FUNC(); XHCIHIST_CALLED();
DPRINTFN(4, "slot %u dci %u", xs->xs_idx, dci, 0, 0);
@@ -1499,9 +1505,9 @@ xhci_stop_endpoint(struct usbd_pipe *pip
static usbd_status
xhci_set_dequeue(struct usbd_pipe *pipe)
{
- struct xhci_softc * const sc = pipe->up_dev->ud_bus->ub_hcpriv;
- struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
- const u_int dci = xhci_ep_get_dci(pipe->up_endpoint->ue_edesc);
+ struct xhci_softc * const sc = XHCI_PIPE2SC(pipe);
+ struct xhci_slot * const xs = XHCI_PIPE2XS(pipe);
+ const u_int dci = XHCI_PIPE2DCI(pipe);
struct xhci_ring * const xr = &xs->xs_ep[dci].xe_tr;
struct xhci_trb trb;
usbd_status err;
@@ -1538,8 +1544,8 @@ static usbd_status
xhci_open(struct usbd_pipe *pipe)
{
struct usbd_device * const dev = pipe->up_dev;
- struct xhci_softc * const sc = dev->ud_bus->ub_hcpriv;
- usb_endpoint_descriptor_t * const ed = pipe->up_endpoint->ue_edesc;
+ struct xhci_softc * const sc = XHCI_BUS2SC(dev->ud_bus);
+ usb_endpoint_descriptor_t * const ed = XHCI_PIPE2EDESC(pipe);
const uint8_t xfertype = UE_GET_XFERTYPE(ed->bmAttributes);
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -1601,10 +1607,9 @@ xhci_open(struct usbd_pipe *pipe)
static void
xhci_close_pipe(struct usbd_pipe *pipe)
{
- struct xhci_softc * const sc = pipe->up_dev->ud_bus->ub_hcpriv;
- struct xhci_slot * const xs = pipe->up_dev->ud_hcpriv;
- usb_endpoint_descriptor_t * const ed = pipe->up_endpoint->ue_edesc;
- const u_int dci = xhci_ep_get_dci(ed);
+ struct xhci_softc * const sc = XHCI_PIPE2SC(pipe);
+ struct xhci_slot * const xs = XHCI_PIPE2XS(pipe);
+ const u_int dci = XHCI_PIPE2DCI(pipe);
struct xhci_trb trb;
uint32_t *cp;
@@ -1670,7 +1675,7 @@ xhci_close_pipe(struct usbd_pipe *pipe)
static void
xhci_abort_xfer(struct usbd_xfer *xfer, usbd_status status)
{
- struct xhci_softc * const sc = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_XFER2SC(xfer);
XHCIHIST_FUNC(); XHCIHIST_CALLED();
DPRINTFN(4, "xfer %p pipe %p status %d",
@@ -1707,9 +1712,9 @@ static void
xhci_clear_endpoint_stall_async_task(void *cookie)
{
struct usbd_xfer * const xfer = cookie;
- struct xhci_softc * const sc = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
- struct xhci_slot * const xs = xfer->ux_pipe->up_dev->ud_hcpriv;
- const u_int dci = xhci_ep_get_dci(xfer->ux_pipe->up_endpoint->ue_edesc);
+ struct xhci_softc * const sc = XHCI_XFER2SC(xfer);
+ struct xhci_slot * const xs = XHCI_XFER2XS(xfer);
+ const u_int dci = XHCI_XFER2DCI(xfer);
struct xhci_ring * const tr = &xs->xs_ep[dci].xe_tr;
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -1728,7 +1733,7 @@ xhci_clear_endpoint_stall_async_task(voi
static usbd_status
xhci_clear_endpoint_stall_async(struct usbd_xfer *xfer)
{
- struct xhci_softc * const sc = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_XFER2SC(xfer);
struct xhci_pipe * const xp = (struct xhci_pipe *)xfer->ux_pipe;
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -1999,7 +2004,7 @@ static void
xhci_softintr(void *v)
{
struct usbd_bus * const bus = v;
- struct xhci_softc * const sc = bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_BUS2SC(bus);
struct xhci_ring * const er = &sc->sc_er;
struct xhci_trb *trb;
int i, j, k;
@@ -2043,7 +2048,7 @@ xhci_softintr(void *v)
static void
xhci_poll(struct usbd_bus *bus)
{
- struct xhci_softc * const sc = bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_BUS2SC(bus);
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -2057,7 +2062,7 @@ xhci_poll(struct usbd_bus *bus)
static struct usbd_xfer *
xhci_allocx(struct usbd_bus *bus, unsigned int nframes)
{
- struct xhci_softc * const sc = bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_BUS2SC(bus);
struct usbd_xfer *xfer;
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -2076,7 +2081,7 @@ xhci_allocx(struct usbd_bus *bus, unsign
static void
xhci_freex(struct usbd_bus *bus, struct usbd_xfer *xfer)
{
- struct xhci_softc * const sc = bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_BUS2SC(bus);
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -2093,7 +2098,7 @@ xhci_freex(struct usbd_bus *bus, struct
static void
xhci_get_lock(struct usbd_bus *bus, kmutex_t **lock)
{
- struct xhci_softc * const sc = bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_BUS2SC(bus);
*lock = &sc->sc_lock;
}
@@ -2114,7 +2119,7 @@ static usbd_status
xhci_new_device(device_t parent, struct usbd_bus *bus, int depth,
int speed, int port, struct usbd_port *up)
{
- struct xhci_softc * const sc = bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_BUS2SC(bus);
struct usbd_device *dev;
usbd_status err;
usb_device_descriptor_t *dd;
@@ -2694,7 +2699,7 @@ xhci_set_dcba(struct xhci_softc * const
static usbd_status
xhci_init_slot(struct usbd_device *dev, uint32_t slot, int route, int rhport)
{
- struct xhci_softc * const sc = dev->ud_bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_BUS2SC(dev->ud_bus);
struct xhci_slot *xs;
usbd_status err;
u_int dci;
@@ -2808,7 +2813,7 @@ static int
xhci_roothub_ctrl(struct usbd_bus *bus, usb_device_request_t *req,
void *buf, int buflen)
{
- struct xhci_softc * const sc = bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_BUS2SC(bus);
usb_port_status_t ps;
int l, totlen = 0;
uint16_t len, value, index;
@@ -3073,7 +3078,7 @@ xhci_roothub_ctrl(struct usbd_bus *bus,
static usbd_status
xhci_root_intr_transfer(struct usbd_xfer *xfer)
{
- struct xhci_softc * const sc = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_XFER2SC(xfer);
usbd_status err;
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -3093,7 +3098,7 @@ xhci_root_intr_transfer(struct usbd_xfer
static usbd_status
xhci_root_intr_start(struct usbd_xfer *xfer)
{
- struct xhci_softc * const sc = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_XFER2SC(xfer);
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -3110,7 +3115,7 @@ xhci_root_intr_start(struct usbd_xfer *x
static void
xhci_root_intr_abort(struct usbd_xfer *xfer)
{
- struct xhci_softc * const sc = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_XFER2SC(xfer);
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -3126,7 +3131,7 @@ xhci_root_intr_abort(struct usbd_xfer *x
static void
xhci_root_intr_close(struct usbd_pipe *pipe)
{
- struct xhci_softc * const sc = pipe->up_dev->ud_bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_PIPE2SC(pipe);
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -3149,7 +3154,7 @@ xhci_root_intr_done(struct usbd_xfer *xf
static usbd_status
xhci_device_ctrl_transfer(struct usbd_xfer *xfer)
{
- struct xhci_softc * const sc = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_XFER2SC(xfer);
usbd_status err;
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -3168,11 +3173,11 @@ xhci_device_ctrl_transfer(struct usbd_xf
static usbd_status
xhci_device_ctrl_start(struct usbd_xfer *xfer)
{
- struct xhci_softc * const sc = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
- struct xhci_slot * const xs = xfer->ux_pipe->up_dev->ud_hcpriv;
- const u_int dci = xhci_ep_get_dci(xfer->ux_pipe->up_endpoint->ue_edesc);
+ struct xhci_softc * const sc = XHCI_XFER2SC(xfer);
+ struct xhci_slot * const xs = XHCI_XFER2XS(xfer);
+ const u_int dci = XHCI_XFER2DCI(xfer);
struct xhci_ring * const tr = &xs->xs_ep[dci].xe_tr;
- struct xhci_xfer * const xx = (void *)xfer;
+ struct xhci_xfer * const xx = XHCI_XFER2XXFER(xfer);
usb_device_request_t * const req = &xfer->ux_request;
const int isread = usbd_xfer_isread(xfer);
const uint32_t len = UGETW(req->wLength);
@@ -3302,7 +3307,7 @@ xhci_device_ctrl_close(struct usbd_pipe
static usbd_status
xhci_device_bulk_transfer(struct usbd_xfer *xfer)
{
- struct xhci_softc * const sc = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_XFER2SC(xfer);
usbd_status err;
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -3324,11 +3329,11 @@ xhci_device_bulk_transfer(struct usbd_xf
static usbd_status
xhci_device_bulk_start(struct usbd_xfer *xfer)
{
- struct xhci_softc * const sc = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
- struct xhci_slot * const xs = xfer->ux_pipe->up_dev->ud_hcpriv;
- const u_int dci = xhci_ep_get_dci(xfer->ux_pipe->up_endpoint->ue_edesc);
+ struct xhci_softc * const sc = XHCI_XFER2SC(xfer);
+ struct xhci_slot * const xs = XHCI_XFER2XS(xfer);
+ const u_int dci = XHCI_XFER2DCI(xfer);
struct xhci_ring * const tr = &xs->xs_ep[dci].xe_tr;
- struct xhci_xfer * const xx = (void *)xfer;
+ struct xhci_xfer * const xx = XHCI_XFER2XXFER(xfer);
const uint32_t len = xfer->ux_length;
usb_dma_t * const dma = &xfer->ux_dmabuf;
uint64_t parameter;
@@ -3383,8 +3388,8 @@ static void
xhci_device_bulk_done(struct usbd_xfer *xfer)
{
#ifdef USB_DEBUG
- struct xhci_slot * const xs = xfer->ux_pipe->up_dev->ud_hcpriv;
- const u_int dci = xhci_ep_get_dci(xfer->ux_pipe->up_endpoint->ue_edesc);
+ struct xhci_slot * const xs = XHCI_XFER2XS(xfer);
+ const u_int dci = XHCI_XFER2DCI(xfer);
#endif
const int isread = usbd_xfer_isread(xfer);
@@ -3420,7 +3425,7 @@ xhci_device_bulk_close(struct usbd_pipe
static usbd_status
xhci_device_intr_transfer(struct usbd_xfer *xfer)
{
- struct xhci_softc * const sc = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_XFER2SC(xfer);
usbd_status err;
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -3442,11 +3447,11 @@ xhci_device_intr_transfer(struct usbd_xf
static usbd_status
xhci_device_intr_start(struct usbd_xfer *xfer)
{
- struct xhci_softc * const sc = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
- struct xhci_slot * const xs = xfer->ux_pipe->up_dev->ud_hcpriv;
- const u_int dci = xhci_ep_get_dci(xfer->ux_pipe->up_endpoint->ue_edesc);
+ struct xhci_softc * const sc = XHCI_XFER2SC(xfer);
+ struct xhci_slot * const xs = XHCI_XFER2XS(xfer);
+ const u_int dci = XHCI_XFER2DCI(xfer);
struct xhci_ring * const tr = &xs->xs_ep[dci].xe_tr;
- struct xhci_xfer * const xx = (void *)xfer;
+ struct xhci_xfer * const xx = XHCI_XFER2XXFER(xfer);
const uint32_t len = xfer->ux_length;
usb_dma_t * const dma = &xfer->ux_dmabuf;
uint64_t parameter;
@@ -3489,11 +3494,10 @@ xhci_device_intr_start(struct usbd_xfer
static void
xhci_device_intr_done(struct usbd_xfer *xfer)
{
- struct xhci_softc * const sc __diagused =
- xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
+ struct xhci_softc * const sc __diagused = XHCI_XFER2SC(xfer);
#ifdef USB_DEBUG
- struct xhci_slot * const xs = xfer->ux_pipe->up_dev->ud_hcpriv;
- const u_int dci = xhci_ep_get_dci(xfer->ux_pipe->up_endpoint->ue_edesc);
+ struct xhci_slot * const xs = XHCI_XFER2XS(xfer);
+ const u_int dci = XHCI_XFER2DCI(xfer);
#endif
const int isread = usbd_xfer_isread(xfer);
@@ -3525,8 +3529,7 @@ xhci_device_intr_done(struct usbd_xfer *
static void
xhci_device_intr_abort(struct usbd_xfer *xfer)
{
- struct xhci_softc * const sc __diagused =
- xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
+ struct xhci_softc * const sc __diagused = XHCI_XFER2SC(xfer);
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -3539,7 +3542,7 @@ xhci_device_intr_abort(struct usbd_xfer
static void
xhci_device_intr_close(struct usbd_pipe *pipe)
{
- //struct xhci_softc * const sc = pipe->up_dev->ud_bus->ub_hcpriv;
+ //struct xhci_softc * const sc = XHCI_PIPE2SC(pipe);
XHCIHIST_FUNC(); XHCIHIST_CALLED();
DPRINTFN(15, "%p", pipe, 0, 0, 0);
@@ -3554,7 +3557,7 @@ xhci_timeout(void *addr)
{
struct xhci_xfer * const xx = addr;
struct usbd_xfer * const xfer = &xx->xx_xfer;
- struct xhci_softc * const sc = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_XFER2SC(xfer);
XHCIHIST_FUNC(); XHCIHIST_CALLED();
@@ -3572,7 +3575,7 @@ static void
xhci_timeout_task(void *addr)
{
struct usbd_xfer * const xfer = addr;
- struct xhci_softc * const sc = xfer->ux_pipe->up_dev->ud_bus->ub_hcpriv;
+ struct xhci_softc * const sc = XHCI_XFER2SC(xfer);
XHCIHIST_FUNC(); XHCIHIST_CALLED();
Home |
Main Index |
Thread Index |
Old Index