-/* $OpenBSD: ehci.c,v 1.146 2014/03/25 20:27:37 mpi Exp $ */
+/* $OpenBSD: ehci.c,v 1.147 2014/04/27 14:48:10 mpi Exp $ */
/* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */
/*
usbd_status ehci_alloc_sqtd_chain(struct ehci_pipe *,
struct ehci_softc *, u_int, int, struct usbd_xfer *,
struct ehci_soft_qtd **, struct ehci_soft_qtd **);
-void ehci_free_sqtd_chain(struct ehci_softc *,
- struct ehci_xfer *exfer);
+void ehci_free_sqtd_chain(struct ehci_softc *, struct ehci_xfer *);
struct ehci_soft_itd *ehci_alloc_itd(struct ehci_softc *sc);
void ehci_free_itd(struct ehci_softc *sc, struct ehci_soft_itd *itd);
void ehci_rem_free_itd_chain(struct ehci_softc *sc,
- struct ehci_xfer *exfer);
+ struct ehci_xfer *);
void ehci_abort_isoc_xfer(struct usbd_xfer *xfer,
usbd_status status);
if (xfer != NULL) {
memset(xfer, 0, sizeof(struct ehci_xfer));
- EXFER(xfer)->ehci_xfer_flags = 0;
+ ((struct ehci_xfer *)xfer)->ehci_xfer_flags = 0;
#ifdef DIAGNOSTIC
- EXFER(xfer)->isdone = 1;
+ ((struct ehci_xfer *)xfer)->isdone = 1;
xfer->busy_free = XFER_BUSY;
#endif
}
return;
}
xfer->busy_free = XFER_FREE;
- if (!EXFER(xfer)->isdone) {
+ if (!((struct ehci_xfer *)xfer)->isdone) {
printf("ehci_freex: !isdone\n");
return;
}
/*Call at splusb*/
void
-ehci_rem_free_itd_chain(struct ehci_softc *sc, struct ehci_xfer *exfer)
+ehci_rem_free_itd_chain(struct ehci_softc *sc, struct ehci_xfer *ex)
{
struct ehci_soft_itd *itd, *prev;
prev = NULL;
- if (exfer->itdstart == NULL || exfer->itdend == NULL)
+ if (ex->itdstart == NULL || ex->itdend == NULL)
panic("ehci isoc xfer being freed, but with no itd chain");
- for (itd = exfer->itdstart; itd != NULL; itd = itd->xfer_next) {
+ for (itd = ex->itdstart; itd != NULL; itd = itd->xfer_next) {
prev = itd->u.frame_list.prev;
/* Unlink itd from hardware chain, or frame array */
if (prev == NULL) { /* We're at the table head */
}
prev = NULL;
- for (itd = exfer->itdstart; itd != NULL; itd = itd->xfer_next) {
+ for (itd = ex->itdstart; itd != NULL; itd = itd->xfer_next) {
if (prev != NULL)
ehci_free_itd(sc, prev);
prev = itd;
}
if (prev)
ehci_free_itd(sc, prev);
- exfer->itdstart = NULL;
- exfer->itdend = NULL;
+ ex->itdstart = NULL;
+ ex->itdend = NULL;
}
/***********/
DPRINTFN(alen<4*4096,("ehci_alloc_sqtd_chain: start len=%d\n", alen));
len = alen;
- iscontrol = (epipe->pipe.endpoint->edesc->bmAttributes & UE_XFERTYPE) ==
+ iscontrol = (xfer->pipe->endpoint->edesc->bmAttributes & UE_XFERTYPE) ==
UE_CONTROL;
dataphys = DMAADDR(dma, 0);
qtdstatus = EHCI_QTD_ACTIVE |
EHCI_QTD_SET_PID(rd ? EHCI_QTD_PID_IN : EHCI_QTD_PID_OUT) |
EHCI_QTD_SET_CERR(3); /* IOC and BYTES set below */
- mps = UGETW(epipe->pipe.endpoint->edesc->wMaxPacketSize);
+ mps = UGETW(xfer->pipe->endpoint->edesc->wMaxPacketSize);
forceshort = ((xfer->flags & USBD_FORCE_SHORT_XFER) || len == 0) &&
len % mps == 0;
/*
void
ehci_abort_xfer(struct usbd_xfer *xfer, usbd_status status)
{
-#define exfer EXFER(xfer)
+ struct ehci_softc *sc = (struct ehci_softc *)xfer->device->bus;
struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;
- struct ehci_softc *sc = (struct ehci_softc *)epipe->pipe.device->bus;
+ struct ehci_xfer *ex = (struct ehci_xfer*)xfer;
struct ehci_soft_qh *sqh = epipe->sqh;
struct ehci_soft_qtd *sqtd;
int s;
s = splusb();
xfer->status = status; /* make software ignore it */
timeout_del(&xfer->timeout_handle);
- usb_rem_task(epipe->pipe.device, &xfer->abort_task);
+ usb_rem_task(xfer->device, &xfer->abort_task);
usb_transfer_complete(xfer);
splx(s);
return;
* If an abort is already in progress then just wait for it to
* complete and return.
*/
- if (exfer->ehci_xfer_flags & EHCI_XFER_ABORTING) {
+ if (ex->ehci_xfer_flags & EHCI_XFER_ABORTING) {
DPRINTFN(2, ("ehci_abort_xfer: already aborting\n"));
/* No need to wait if we're aborting from a timeout. */
if (status == USBD_TIMEOUT)
/* Override the status which might be USBD_TIMEOUT. */
xfer->status = status;
DPRINTFN(2, ("ehci_abort_xfer: waiting for abort to finish\n"));
- exfer->ehci_xfer_flags |= EHCI_XFER_ABORTWAIT;
- while (exfer->ehci_xfer_flags & EHCI_XFER_ABORTING)
- tsleep(&exfer->ehci_xfer_flags, PZERO, "ehciaw", 0);
+ ex->ehci_xfer_flags |= EHCI_XFER_ABORTWAIT;
+ while (ex->ehci_xfer_flags & EHCI_XFER_ABORTING)
+ tsleep(&ex->ehci_xfer_flags, PZERO, "ehciaw", 0);
return;
}
* Step 1: Make interrupt routine and timeouts ignore xfer.
*/
s = splusb();
- exfer->ehci_xfer_flags |= EHCI_XFER_ABORTING;
+ ex->ehci_xfer_flags |= EHCI_XFER_ABORTING;
xfer->status = status; /* make software ignore it */
timeout_del(&xfer->timeout_handle);
- usb_rem_task(epipe->pipe.device, &xfer->abort_task);
+ usb_rem_task(xfer->device, &xfer->abort_task);
splx(s);
/*
sizeof(sqh->qh.qh_qtd.qtd_status),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
- for (sqtd = exfer->sqtdstart; sqtd != NULL; sqtd = sqtd->nextqtd) {
+ for (sqtd = ex->sqtdstart; sqtd != NULL; sqtd = sqtd->nextqtd) {
usb_syncmem(&sqtd->dma,
sqtd->offs + offsetof(struct ehci_qtd, qtd_status),
sizeof(sqtd->qtd.qtd_status),
tsleep(&sc->sc_softwake, PZERO, "ehciab", 0);
#ifdef DIAGNOSTIC
- exfer->isdone = 1;
+ ex->isdone = 1;
#endif
/* Do the wakeup first to avoid touching the xfer after the callback. */
- exfer->ehci_xfer_flags &= ~EHCI_XFER_ABORTING;
- if (exfer->ehci_xfer_flags & EHCI_XFER_ABORTWAIT) {
- exfer->ehci_xfer_flags &= ~EHCI_XFER_ABORTWAIT;
- wakeup(&exfer->ehci_xfer_flags);
+ ex->ehci_xfer_flags &= ~EHCI_XFER_ABORTING;
+ if (ex->ehci_xfer_flags & EHCI_XFER_ABORTWAIT) {
+ ex->ehci_xfer_flags &= ~EHCI_XFER_ABORTWAIT;
+ wakeup(&ex->ehci_xfer_flags);
}
usb_transfer_complete(xfer);
splx(s);
-#undef exfer
}
void
ehci_abort_isoc_xfer(struct usbd_xfer *xfer, usbd_status status)
{
+ struct ehci_softc *sc = (struct ehci_softc *)xfer->device->bus;
+ struct ehci_xfer *ex = (struct ehci_xfer *)xfer;
ehci_isoc_trans_t trans_status;
- struct ehci_pipe *epipe;
- struct ehci_xfer *exfer;
- struct ehci_softc *sc;
struct ehci_soft_itd *itd;
int s, i, wake;
- epipe = (struct ehci_pipe *) xfer->pipe;
- exfer = EXFER(xfer);
- sc = (struct ehci_softc *)epipe->pipe.device->bus;
- DPRINTF(("ehci_abort_isoc_xfer: xfer %p pipe %p\n", xfer, epipe));
+ DPRINTF(("ehci_abort_isoc_xfer: xfer %p pipe %p\n", xfer, xfer->pipe));
if (sc->sc_bus.dying) {
s = splusb();
xfer->status = status;
timeout_del(&xfer->timeout_handle);
- usb_rem_task(epipe->pipe.device, &xfer->abort_task);
+ usb_rem_task(xfer->device, &xfer->abort_task);
usb_transfer_complete(xfer);
splx(s);
return;
}
- if (exfer->ehci_xfer_flags & EHCI_XFER_ABORTING) {
+ if (ex->ehci_xfer_flags & EHCI_XFER_ABORTING) {
DPRINTFN(2, ("ehci_abort_isoc_xfer: already aborting\n"));
#ifdef DIAGNOSTIC
xfer->status = status;
DPRINTFN(2, ("ehci_abort_xfer: waiting for abort to finish\n"));
- exfer->ehci_xfer_flags |= EHCI_XFER_ABORTING;
- while (exfer->ehci_xfer_flags & EHCI_XFER_ABORTING)
- tsleep(&exfer->ehci_xfer_flags, PZERO, "ehciiaw", 0);
+ ex->ehci_xfer_flags |= EHCI_XFER_ABORTING;
+ while (ex->ehci_xfer_flags & EHCI_XFER_ABORTING)
+ tsleep(&ex->ehci_xfer_flags, PZERO, "ehciiaw", 0);
return;
}
- exfer->ehci_xfer_flags |= EHCI_XFER_ABORTING;
+ ex->ehci_xfer_flags |= EHCI_XFER_ABORTING;
xfer->status = status;
timeout_del(&xfer->timeout_handle);
- usb_rem_task(epipe->pipe.device, &xfer->abort_task);
+ usb_rem_task(xfer->device, &xfer->abort_task);
s = splusb();
- for (itd = exfer->itdstart; itd != NULL; itd = itd->xfer_next) {
+ for (itd = ex->itdstart; itd != NULL; itd = itd->xfer_next) {
for (i = 0; i < 8; i++) {
trans_status = letoh32(itd->itd.itd_ctl[i]);
trans_status &= ~EHCI_ITD_ACTIVE;
splx(s);
#ifdef DIAGNOSTIC
- exfer->isdone = 1;
+ ex->isdone = 1;
#endif
- wake = exfer->ehci_xfer_flags & EHCI_XFER_ABORTING;
- exfer->ehci_xfer_flags &= ~(EHCI_XFER_ABORTING | EHCI_XFER_ABORTWAIT);
+ wake = ex->ehci_xfer_flags & EHCI_XFER_ABORTING;
+ ex->ehci_xfer_flags &= ~(EHCI_XFER_ABORTING | EHCI_XFER_ABORTWAIT);
usb_transfer_complete(xfer);
if (wake)
- wakeup(&exfer->ehci_xfer_flags);
+ wakeup(&ex->ehci_xfer_flags);
return;
}
void
ehci_device_ctrl_done(struct usbd_xfer *xfer)
{
- struct ehci_xfer *ex = EXFER(xfer);
struct ehci_softc *sc = (struct ehci_softc *)xfer->device->bus;
- /*struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;*/
+ struct ehci_xfer *ex = (struct ehci_xfer *)xfer;
DPRINTFN(10,("ehci_ctrl_done: xfer=%p\n", xfer));
usbd_status
ehci_device_request(struct usbd_xfer *xfer)
{
-#define exfer EXFER(xfer)
+ struct ehci_softc *sc = (struct ehci_softc *)xfer->device->bus;
struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;
+ struct ehci_xfer *ex = (struct ehci_xfer *)xfer;
usb_device_request_t *req = &xfer->request;
- struct usbd_device *dev = epipe->pipe.device;
- struct ehci_softc *sc = (struct ehci_softc *)dev->bus;
struct ehci_soft_qtd *setup, *stat, *next;
struct ehci_soft_qh *sqh;
int isread;
DPRINTFN(3,("ehci_device_request: type=0x%02x, request=0x%02x, "
"wValue=0x%04x, wIndex=0x%04x len=%u, addr=%d, endpt=%d\n",
req->bmRequestType, req->bRequest, UGETW(req->wValue),
- UGETW(req->wIndex), len, dev->address,
- epipe->pipe.endpoint->edesc->bEndpointAddress));
+ UGETW(req->wIndex), len, xfer->device->address,
+ xfer->pipe->endpoint->edesc->bEndpointAddress));
setup = ehci_alloc_sqtd(sc);
if (setup == NULL) {
}
#endif
- exfer->sqtdstart = setup;
- exfer->sqtdend = stat;
+ ex->sqtdstart = setup;
+ ex->sqtdend = stat;
#ifdef DIAGNOSTIC
- if (!exfer->isdone) {
- printf("ehci_device_request: not done, exfer=%p\n", exfer);
+ if (!ex->isdone) {
+ printf("ehci_device_request: not done, ex=%p\n", ex);
}
- exfer->isdone = 0;
+ ex->isdone = 0;
#endif
/* Insert qTD in QH list. */
timeout_set(&xfer->timeout_handle, ehci_timeout, xfer);
timeout_add_msec(&xfer->timeout_handle, xfer->timeout);
}
- ehci_add_intr_list(sc, exfer);
+ ehci_add_intr_list(sc, ex);
xfer->status = USBD_IN_PROGRESS;
splx(s);
xfer->status = err;
usb_transfer_complete(xfer);
return (err);
-#undef exfer
}
/************************/
usbd_status
ehci_device_bulk_start(struct usbd_xfer *xfer)
{
-#define exfer EXFER(xfer)
+ struct ehci_softc *sc = (struct ehci_softc *)xfer->device->bus;
struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;
- struct usbd_device *dev = epipe->pipe.device;
- struct ehci_softc *sc = (struct ehci_softc *)dev->bus;
+ struct ehci_xfer *ex = (struct ehci_xfer *)xfer;
struct ehci_soft_qtd *data, *dataend;
struct ehci_soft_qh *sqh;
usbd_status err;
#endif
len = xfer->length;
- endpt = epipe->pipe.endpoint->edesc->bEndpointAddress;
+ endpt = xfer->pipe->endpoint->edesc->bEndpointAddress;
isread = UE_GET_DIR(endpt) == UE_DIR_IN;
sqh = epipe->sqh;
#endif
/* Set up interrupt info. */
- exfer->sqtdstart = data;
- exfer->sqtdend = dataend;
+ ex->sqtdstart = data;
+ ex->sqtdend = dataend;
#ifdef DIAGNOSTIC
- if (!exfer->isdone) {
- printf("ehci_device_bulk_start: not done, ex=%p\n", exfer);
+ if (!ex->isdone) {
+ printf("ehci_device_bulk_start: not done, ex=%p\n", ex);
}
- exfer->isdone = 0;
+ ex->isdone = 0;
#endif
s = splusb();
timeout_set(&xfer->timeout_handle, ehci_timeout, xfer);
timeout_add_msec(&xfer->timeout_handle, xfer->timeout);
}
- ehci_add_intr_list(sc, exfer);
+ ehci_add_intr_list(sc, ex);
xfer->status = USBD_IN_PROGRESS;
splx(s);
ehci_waitintr(sc, xfer);
return (USBD_IN_PROGRESS);
-#undef exfer
}
void
void
ehci_device_bulk_done(struct usbd_xfer *xfer)
{
- struct ehci_xfer *ex = EXFER(xfer);
struct ehci_softc *sc = (struct ehci_softc *)xfer->device->bus;
- struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;
- int endpt = epipe->pipe.endpoint->edesc->bEndpointAddress;
+ struct ehci_xfer *ex = (struct ehci_xfer *)xfer;
+ int endpt = xfer->pipe->endpoint->edesc->bEndpointAddress;
int rd = UE_GET_DIR(endpt) == UE_DIR_IN;
DPRINTFN(10,("ehci_bulk_done: xfer=%p, actlen=%d\n",
usbd_status
ehci_device_intr_start(struct usbd_xfer *xfer)
{
-#define exfer EXFER(xfer)
+ struct ehci_softc *sc = (struct ehci_softc *)xfer->device->bus;
+ struct ehci_xfer *ex = (struct ehci_xfer *)xfer;
struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;
- struct usbd_device *dev = xfer->device;
- struct ehci_softc *sc = (struct ehci_softc *)dev->bus;
struct ehci_soft_qtd *data, *dataend;
struct ehci_soft_qh *sqh;
usbd_status err;
#endif
len = xfer->length;
- endpt = epipe->pipe.endpoint->edesc->bEndpointAddress;
+ endpt = xfer->pipe->endpoint->edesc->bEndpointAddress;
isread = UE_GET_DIR(endpt) == UE_DIR_IN;
sqh = epipe->sqh;
#endif
/* Set up interrupt info. */
- exfer->sqtdstart = data;
- exfer->sqtdend = dataend;
+ ex->sqtdstart = data;
+ ex->sqtdend = dataend;
#ifdef DIAGNOSTIC
- if (!exfer->isdone)
- printf("ehci_device_intr_start: not done, ex=%p\n", exfer);
- exfer->isdone = 0;
+ if (!ex->isdone)
+ printf("ehci_device_intr_start: not done, ex=%p\n", ex);
+ ex->isdone = 0;
#endif
s = splusb();
timeout_set(&xfer->timeout_handle, ehci_timeout, xfer);
timeout_add_msec(&xfer->timeout_handle, xfer->timeout);
}
- ehci_add_intr_list(sc, exfer);
+ ehci_add_intr_list(sc, ex);
xfer->status = USBD_IN_PROGRESS;
splx(s);
ehci_waitintr(sc, xfer);
return (USBD_IN_PROGRESS);
-#undef exfer
}
void
void
ehci_device_intr_done(struct usbd_xfer *xfer)
{
-#define exfer EXFER(xfer)
- struct ehci_xfer *ex = EXFER(xfer);
struct ehci_softc *sc = (struct ehci_softc *)xfer->device->bus;
struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;
+ struct ehci_xfer *ex = (struct ehci_xfer *)xfer;
struct ehci_soft_qtd *data, *dataend;
struct ehci_soft_qh *sqh;
usbd_status err;
len = epipe->u.intr.length;
xfer->length = len;
- endpt = epipe->pipe.endpoint->edesc->bEndpointAddress;
+ endpt = xfer->pipe->endpoint->edesc->bEndpointAddress;
isread = UE_GET_DIR(endpt) == UE_DIR_IN;
usb_syncmem(&xfer->dmabuf, 0, len,
isread ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
}
/* Set up interrupt info. */
- exfer->sqtdstart = data;
- exfer->sqtdend = dataend;
+ ex->sqtdstart = data;
+ ex->sqtdend = dataend;
#ifdef DIAGNOSTIC
- if (!exfer->isdone) {
+ if (!ex->isdone) {
printf("ehci_device_intr_done: not done, ex=%p\n",
- exfer);
+ ex);
}
- exfer->isdone = 0;
+ ex->isdone = 0;
#endif
s = splusb();
} else if (xfer->status != USBD_NOMEM && ehci_active_intr_list(ex)) {
ehci_del_intr_list(sc, ex); /* remove from active list */
ehci_free_sqtd_chain(sc, ex);
- endpt = epipe->pipe.endpoint->edesc->bEndpointAddress;
+ endpt = xfer->pipe->endpoint->edesc->bEndpointAddress;
isread = UE_GET_DIR(endpt) == UE_DIR_IN;
usb_syncmem(&xfer->dmabuf, 0, xfer->length,
isread ? BUS_DMASYNC_POSTREAD : BUS_DMASYNC_POSTWRITE);
}
-#undef exfer
}
/************************/
usbd_status
ehci_device_isoc_start(struct usbd_xfer *xfer)
{
- struct ehci_pipe *epipe;
- struct ehci_softc *sc;
- struct ehci_xfer *exfer;
+ struct ehci_softc *sc = (struct ehci_softc *)xfer->device->bus;
+ struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;
+ struct ehci_xfer *ex = (struct ehci_xfer *)xfer;
struct ehci_soft_itd *itd, *prev, *start, *stop;
struct usb_dma *dma_buf;
int i, j, k, frames, uframes, ufrperframe;
prev = NULL;
itd = NULL;
trans_count = 0;
- exfer = (struct ehci_xfer *) xfer;
- sc = (struct ehci_softc *)xfer->device->bus;
- epipe = (struct ehci_pipe *)xfer->pipe;
/*
* To allow continuous transfers, above we start all transfers
* in progress or not
*/
- if (exfer->itdstart != NULL)
+ if (ex->itdstart != NULL)
return (USBD_IN_PROGRESS);
DPRINTFN(2, ("ehci_device_isoc_start: xfer %p len %u flags %d\n",
* the entire frame table. To within 4 frames, to allow some leeway
* on either side of where the hc currently is.
*/
- if ((1 << (epipe->pipe.endpoint->edesc->bInterval - 1)) *
+ if ((1 << (xfer->pipe->endpoint->edesc->bInterval - 1)) *
xfer->nframes >= (sc->sc_flsize - 4) * 8) {
printf("ehci: isoc descriptor requested that spans the entire "
"frametable, too many frames\n");
if (xfer->rqflags & URQ_REQUEST)
panic("ehci_device_isoc_start: request");
- if (!exfer->isdone)
- printf("ehci_device_isoc_start: not done, ex = %p\n", exfer);
- exfer->isdone = 0;
+ if (!ex->isdone)
+ printf("ehci_device_isoc_start: not done, ex = %p\n", ex);
+ ex->isdone = 0;
#endif
/*
* multiple microframes per frame.
*/
- i = epipe->pipe.endpoint->edesc->bInterval;
+ i = xfer->pipe->endpoint->edesc->bInterval;
if (i > 16 || i == 0) {
/* Spec page 271 says intervals > 16 are invalid */
DPRINTF(("ehci_device_isoc_start: bInvertal %d invalid\n", i));
* Other special values
*/
- k = epipe->pipe.endpoint->edesc->bEndpointAddress;
+ k = xfer->pipe->endpoint->edesc->bEndpointAddress;
itd->itd.itd_bufr[0] |=
htole32(EHCI_ITD_SET_EP(UE_GET_ADDR(k)) |
- EHCI_ITD_SET_DADDR(epipe->pipe.device->address));
+ EHCI_ITD_SET_DADDR(xfer->pipe->device->address));
- k = (UE_GET_DIR(epipe->pipe.endpoint->edesc->bEndpointAddress))
+ k = (UE_GET_DIR(xfer->pipe->endpoint->edesc->bEndpointAddress))
? 1 : 0;
- j = UGETW(epipe->pipe.endpoint->edesc->wMaxPacketSize);
+ j = UGETW(xfer->pipe->endpoint->edesc->wMaxPacketSize);
itd->itd.itd_bufr[1] |= htole32(EHCI_ITD_SET_DIR(k) |
EHCI_ITD_SET_MAXPKT(UE_GET_SIZE(j)));
frindex &= (sc->sc_flsize - 1);
/* Whats the frame interval? */
- i = (1 << (epipe->pipe.endpoint->edesc->bInterval - 1));
+ i = (1 << (xfer->pipe->endpoint->edesc->bInterval - 1));
if (i / 8 == 0)
i = 1;
else
epipe->u.isoc.cur_xfers++;
epipe->u.isoc.next_frame = frindex;
- exfer->itdstart = start;
- exfer->itdend = stop;
- exfer->sqtdstart = NULL;
- exfer->sqtdend = NULL;
+ ex->itdstart = start;
+ ex->itdend = stop;
+ ex->sqtdstart = NULL;
+ ex->sqtdend = NULL;
- ehci_add_intr_list(sc, exfer);
+ ehci_add_intr_list(sc, ex);
xfer->status = USBD_IN_PROGRESS;
xfer->done = 0;
splx(s);
void
ehci_device_isoc_done(struct usbd_xfer *xfer)
{
- struct ehci_xfer *exfer = EXFER(xfer);
struct ehci_softc *sc = (struct ehci_softc *)xfer->device->bus;
struct ehci_pipe *epipe = (struct ehci_pipe *)xfer->pipe;
+ struct ehci_xfer *ex = (struct ehci_xfer *)xfer;
int s;
-
s = splusb();
epipe->u.isoc.cur_xfers--;
- if (xfer->status != USBD_NOMEM && ehci_active_intr_list(exfer)) {
- ehci_del_intr_list(sc, exfer);
- ehci_rem_free_itd_chain(sc, exfer);
+ if (xfer->status != USBD_NOMEM && ehci_active_intr_list(ex)) {
+ ehci_del_intr_list(sc, ex);
+ ehci_rem_free_itd_chain(sc, ex);
}
splx(s);
}
-/* $OpenBSD: ehcivar.h,v 1.29 2014/03/25 20:27:37 mpi Exp $ */
+/* $OpenBSD: ehcivar.h,v 1.30 2014/04/27 14:48:10 mpi Exp $ */
/* $NetBSD: ehcivar.h,v 1.19 2005/04/29 15:04:29 augustss Exp $ */
/*
#define EHCI_XFER_ABORTING 0x0001 /* xfer is aborting. */
#define EHCI_XFER_ABORTWAIT 0x0002 /* abort completion is being awaited. */
-#define EXFER(xfer) ((struct ehci_xfer *)(xfer))
-
/* Information about an entry in the interrupt list. */
struct ehci_soft_islot {
struct ehci_soft_qh *sqh; /* Queue Head. */
-/* $OpenBSD: ohci.c,v 1.124 2014/03/25 20:27:37 mpi Exp $ */
+/* $OpenBSD: ohci.c,v 1.125 2014/04/27 14:48:10 mpi Exp $ */
/* $NetBSD: ohci.c,v 1.139 2003/02/22 05:24:16 tsutsui Exp $ */
/* $FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $ */
void
ohci_device_intr_done(struct usbd_xfer *xfer)
{
- struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe;
struct ohci_softc *sc = (struct ohci_softc *)xfer->device->bus;
+ struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe;
struct ohci_soft_ed *sed = opipe->sed;
struct ohci_soft_td *data, *tail;
usbd_status
ohci_device_request(struct usbd_xfer *xfer)
{
+ struct ohci_softc *sc = (struct ohci_softc *)xfer->device->bus;
struct ohci_pipe *opipe = (struct ohci_pipe *)xfer->pipe;
usb_device_request_t *req = &xfer->request;
- struct usbd_device *dev = xfer->device;
- struct ohci_softc *sc = (struct ohci_softc *)dev->bus;
struct ohci_soft_td *setup, *stat, *next, *tail;
struct ohci_soft_ed *sed;
int isread;
DPRINTFN(3,("ohci_device_control type=0x%02x, request=0x%02x, "
"wValue=0x%04x, wIndex=0x%04x len=%u, addr=%d, endpt=%d\n",
req->bmRequestType, req->bRequest, UGETW(req->wValue),
- UGETW(req->wIndex), len, dev->address,
- opipe->pipe.endpoint->edesc->bEndpointAddress));
+ UGETW(req->wIndex), len, xfer->device->address,
+ xfer->pipe->endpoint->edesc->bEndpointAddress));
setup = opipe->tail.td;
stat = ohci_alloc_std(sc);
usbd_status
ohci_open(struct usbd_pipe *pipe)
{
- struct usbd_device *dev = pipe->device;
- struct ohci_softc *sc = (struct ohci_softc *)dev->bus;
+ struct ohci_softc *sc = (struct ohci_softc *)pipe->device->bus;
usb_endpoint_descriptor_t *ed = pipe->endpoint->edesc;
struct ohci_pipe *opipe = (struct ohci_pipe *)pipe;
- u_int8_t addr = dev->address;
u_int8_t xfertype = ed->bmAttributes & UE_XFERTYPE;
- struct ohci_soft_ed *sed;
- struct ohci_soft_td *std;
+ struct ohci_soft_ed *sed = NULL;
+ struct ohci_soft_td *std = NULL;
struct ohci_soft_itd *sitd;
ohci_physaddr_t tdphys;
u_int32_t fmt;
int ival;
DPRINTFN(1, ("ohci_open: pipe=%p, addr=%d, endpt=%d\n",
- pipe, addr, ed->bEndpointAddress));
+ pipe, pipe->device->address, ed->bEndpointAddress));
if (sc->sc_bus.dying)
return (USBD_IOERROR);
- std = NULL;
- sed = NULL;
-
/* Root Hub */
if (pipe->device->depth == 0) {
switch (ed->bEndpointAddress) {
fmt = OHCI_ED_FORMAT_GEN | OHCI_ED_DIR_TD;
}
sed->ed.ed_flags = htole32(
- OHCI_ED_SET_FA(addr) |
+ OHCI_ED_SET_FA(pipe->device->address) |
OHCI_ED_SET_EN(UE_GET_ADDR(ed->bEndpointAddress)) |
- (dev->speed == USB_SPEED_LOW ? OHCI_ED_SPEED : 0) |
+ (pipe->device->speed == USB_SPEED_LOW ?
+ OHCI_ED_SPEED : 0) |
fmt | OHCI_ED_SET_MAXP(UGETW(ed->wMaxPacketSize)));
sed->ed.ed_headp = htole32(tdphys |
(pipe->endpoint->savedtoggle ? OHCI_TOGGLECARRY : 0));
(int)letoh32(sed->ed.ed_tailp),
pipe, std);
#ifdef USB_DEBUG
- usbd_dump_pipe(&opipe->pipe);
+ usbd_dump_pipe(pipe);
#endif
#ifdef OHCI_DEBUG
ohci_dump_ed(sed);
usbd_status
ohci_root_intr_start(struct usbd_xfer *xfer)
{
- struct usbd_pipe *pipe = xfer->pipe;
- struct ohci_softc *sc = (struct ohci_softc *)pipe->device->bus;
+ struct ohci_softc *sc = (struct ohci_softc *)xfer->device->bus;
if (sc->sc_bus.dying)
return (USBD_IOERROR);
-/* $OpenBSD: uhci.c,v 1.110 2014/03/25 20:27:37 mpi Exp $ */
+/* $OpenBSD: uhci.c,v 1.111 2014/04/27 14:48:10 mpi Exp $ */
/* $NetBSD: uhci.c,v 1.172 2003/02/23 04:19:26 simonb Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $ */
if (xfer != NULL) {
memset(xfer, 0, sizeof (struct uhci_xfer));
#ifdef DIAGNOSTIC
- UXFER(xfer)->isdone = 1;
+ ((struct uhci_xfer *)xfer)->isdone = 1;
xfer->busy_free = XFER_BUSY;
#endif
}
return;
}
xfer->busy_free = XFER_FREE;
- if (!UXFER(xfer)->isdone) {
+ if (!((struct uhci_xfer *)xfer)->isdone) {
printf("uhci_freex: !isdone\n");
return;
}
/* Called at splusb() */
void
-uhci_idone(struct uhci_xfer *ex)
+uhci_idone(struct uhci_xfer *ux)
{
- struct usbd_xfer *xfer = &ex->xfer;
+ struct usbd_xfer *xfer = &ux->xfer;
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
struct uhci_soft_td *std;
u_int32_t status = 0, nstatus;
int actlen;
- DPRINTFN(12, ("uhci_idone: ex=%p\n", ex));
+ DPRINTFN(12, ("uhci_idone: ux=%p\n", ux));
#ifdef DIAGNOSTIC
{
int s = splhigh();
- if (ex->isdone) {
+ if (ux->isdone) {
splx(s);
#ifdef UHCI_DEBUG
- printf("uhci_idone: ex is done!\n ");
- uhci_dump_xfer(ex);
+ printf("uhci_idone: ux is done!\n ");
+ uhci_dump_xfer(ux);
#else
- printf("uhci_idone: ex=%p is done!\n", ex);
+ printf("uhci_idone: ux=%p is done!\n", ux);
#endif
return;
}
- ex->isdone = 1;
+ ux->isdone = 1;
splx(s);
}
#endif
struct uhci_soft_td **stds = upipe->u.iso.stds;
int i, n, nframes, len;
- DPRINTFN(5,("uhci_idone: ex=%p isoc ready\n", ex));
+ DPRINTFN(5,("uhci_idone: ux=%p isoc ready\n", ux));
nframes = xfer->nframes;
actlen = 0;
- n = UXFER(xfer)->curframe;
+ n = ux->curframe;
for (i = 0; i < nframes; i++) {
std = stds[n];
#ifdef UHCI_DEBUG
}
#ifdef UHCI_DEBUG
- DPRINTFN(10, ("uhci_idone: ex=%p, xfer=%p, pipe=%p ready\n",
- ex, xfer, upipe));
+ DPRINTFN(10, ("uhci_idone: ux=%p, xfer=%p, pipe=%p ready\n",
+ ux, xfer, upipe));
if (uhcidebug > 10)
- uhci_dump_tds(ex->stdstart);
+ uhci_dump_tds(ux->stdstart);
#endif
/* The transfer is done, compute actual length and status. */
actlen = 0;
- for (std = ex->stdstart; std != NULL; std = std->link.std) {
+ for (std = ux->stdstart; std != NULL; std = std->link.std) {
nstatus = letoh32(std->td.td_status);
if (nstatus & UHCI_TD_ACTIVE)
break;
end:
usb_transfer_complete(xfer);
- DPRINTFN(12, ("uhci_idone: ex=%p done\n", ex));
+ DPRINTFN(12, ("uhci_idone: ux=%p done\n", ux));
}
void
usbd_status
uhci_device_bulk_start(struct usbd_xfer *xfer)
{
+ struct uhci_softc *sc = (struct uhci_softc *)xfer->device->bus;
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
- struct usbd_device *dev = upipe->pipe.device;
- struct uhci_softc *sc = (struct uhci_softc *)dev->bus;
- struct uhci_xfer *ex = UXFER(xfer);
+ struct uhci_xfer *ux = (struct uhci_xfer *)xfer;
struct uhci_soft_td *data, *dataend;
struct uhci_soft_qh *sqh;
usbd_status err;
int isread, endpt;
int s;
- DPRINTFN(3, ("uhci_device_bulk_start: xfer=%p len=%u flags=%d ex=%p\n",
- xfer, xfer->length, xfer->flags, ex));
+ DPRINTFN(3, ("uhci_device_bulk_start: xfer=%p len=%u flags=%d ux=%p\n",
+ xfer, xfer->length, xfer->flags, ux));
if (sc->sc_bus.dying)
return (USBD_IOERROR);
#endif
len = xfer->length;
- endpt = upipe->pipe.endpoint->edesc->bEndpointAddress;
+ endpt = xfer->pipe->endpoint->edesc->bEndpointAddress;
isread = UE_GET_DIR(endpt) == UE_DIR_IN;
sqh = upipe->u.bulk.sqh;
#endif
/* Set up interrupt info. */
- ex->stdstart = data;
- ex->stdend = dataend;
+ ux->stdstart = data;
+ ux->stdend = dataend;
#ifdef DIAGNOSTIC
- if (!ex->isdone) {
- printf("uhci_device_bulk_start: not done, ex=%p\n", ex);
+ if (!ux->isdone) {
+ printf("uhci_device_bulk_start: not done, ux=%p\n", ux);
}
- ex->isdone = 0;
+ ux->isdone = 0;
#endif
sqh->elink = data;
s = splusb();
uhci_add_bulk(sc, sqh);
- uhci_add_intr_list(sc, ex);
+ uhci_add_intr_list(sc, ux);
if (xfer->timeout && !sc->sc_bus.use_polling) {
timeout_del(&xfer->timeout_handle);
- timeout_set(&xfer->timeout_handle, uhci_timeout, ex);
+ timeout_set(&xfer->timeout_handle, uhci_timeout, xfer);
timeout_add_msec(&xfer->timeout_handle, xfer->timeout);
}
xfer->status = USBD_IN_PROGRESS;
void
uhci_abort_xfer(struct usbd_xfer *xfer, usbd_status status)
{
- struct uhci_xfer *ex = UXFER(xfer);
- struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
- struct uhci_softc *sc = (struct uhci_softc *)upipe->pipe.device->bus;
+ struct uhci_softc *sc = (struct uhci_softc *)xfer->device->bus;
+ struct uhci_xfer *ux = (struct uhci_xfer *)xfer;
struct uhci_soft_td *std;
int s;
xfer->status = status; /* make software ignore it */
timeout_del(&xfer->timeout_handle);
usb_rem_task(xfer->device, &xfer->abort_task);
- DPRINTFN(1,("uhci_abort_xfer: stop ex=%p\n", ex));
- for (std = ex->stdstart; std != NULL; std = std->link.std)
+ DPRINTFN(1,("uhci_abort_xfer: stop ux=%p\n", ux));
+ for (std = ux->stdstart; std != NULL; std = std->link.std)
std->td.td_status &= htole32(~(UHCI_TD_ACTIVE | UHCI_TD_IOC));
splx(s);
* use of the xfer. Also make sure the soft interrupt routine
* has run.
*/
- usb_delay_ms(upipe->pipe.device->bus, 2); /* Hardware finishes in 1ms */
+ usb_delay_ms(&sc->sc_bus, 2); /* Hardware finishes in 1ms */
s = splusb();
sc->sc_softwake = 1;
usb_schedsoftintr(&sc->sc_bus);
DPRINTFN(1,("uhci_abort_xfer: callback\n"));
s = splusb();
#ifdef DIAGNOSTIC
- ex->isdone = 1;
+ ux->isdone = 1;
#endif
usb_transfer_complete(xfer);
splx(s);
void
uhci_device_bulk_close(struct usbd_pipe *pipe)
{
+ struct uhci_softc *sc = (struct uhci_softc *)pipe->device->bus;
struct uhci_pipe *upipe = (struct uhci_pipe *)pipe;
- struct usbd_device *dev = upipe->pipe.device;
- struct uhci_softc *sc = (struct uhci_softc *)dev->bus;
uhci_free_sqh(sc, upipe->u.bulk.sqh);
pipe->endpoint->savedtoggle = upipe->nexttoggle;
usbd_status
uhci_device_intr_start(struct usbd_xfer *xfer)
{
+ struct uhci_softc *sc = (struct uhci_softc *)xfer->device->bus;
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
- struct usbd_device *dev = upipe->pipe.device;
- struct uhci_softc *sc = (struct uhci_softc *)dev->bus;
- struct uhci_xfer *ex = UXFER(xfer);
+ struct uhci_xfer *ux = (struct uhci_xfer *)xfer;
struct uhci_soft_td *data, *dataend;
struct uhci_soft_qh *sqh;
usbd_status err;
panic("uhci_device_intr_start: a request");
#endif
- endpt = upipe->pipe.endpoint->edesc->bEndpointAddress;
+ endpt = xfer->pipe->endpoint->edesc->bEndpointAddress;
isread = UE_GET_DIR(endpt) == UE_DIR_IN;
upipe->u.intr.isread = isread;
s = splusb();
/* Set up interrupt info. */
- ex->stdstart = data;
- ex->stdend = dataend;
+ ux->stdstart = data;
+ ux->stdend = dataend;
#ifdef DIAGNOSTIC
- if (!ex->isdone) {
- printf("uhci_device_intr_transfer: not done, ex=%p\n", ex);
+ if (!ux->isdone) {
+ printf("uhci_device_intr_transfer: not done, ux=%p\n", ux);
}
- ex->isdone = 0;
+ ux->isdone = 0;
#endif
DPRINTFN(10,("uhci_device_intr_start: qhs[0]=%p\n",
sqh->elink = data;
sqh->qh.qh_elink = htole32(data->physaddr | UHCI_PTR_TD);
}
- uhci_add_intr_list(sc, ex);
+ uhci_add_intr_list(sc, ux);
xfer->status = USBD_IN_PROGRESS;
splx(s);
usbd_status
uhci_device_request(struct usbd_xfer *xfer)
{
+ struct uhci_softc *sc = (struct uhci_softc *)xfer->device->bus;
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
+ struct uhci_xfer *ux = (struct uhci_xfer *)xfer;
usb_device_request_t *req = &xfer->request;
- struct usbd_device *dev = upipe->pipe.device;
- struct uhci_softc *sc = (struct uhci_softc *)dev->bus;
- int addr = dev->address;
- int endpt = upipe->pipe.endpoint->edesc->bEndpointAddress;
- struct uhci_xfer *ex = UXFER(xfer);
+ int addr = xfer->device->address;
+ int endpt = xfer->pipe->endpoint->edesc->bEndpointAddress;
struct uhci_soft_td *setup, *data, *stat, *next, *dataend;
struct uhci_soft_qh *sqh;
u_int len;
UGETW(req->wIndex), UGETW(req->wLength),
addr, endpt));
- ls = dev->speed == USB_SPEED_LOW ? UHCI_TD_LS : 0;
+ ls = xfer->device->speed == USB_SPEED_LOW ? UHCI_TD_LS : 0;
isread = req->bmRequestType & UT_READ;
len = UGETW(req->wLength);
#endif
/* Set up interrupt info. */
- ex->stdstart = setup;
- ex->stdend = stat;
+ ux->stdstart = setup;
+ ux->stdend = stat;
#ifdef DIAGNOSTIC
- if (!ex->isdone) {
- printf("uhci_device_request: not done, ex=%p\n", ex);
+ if (!ux->isdone) {
+ printf("%s: not done, ux=%p\n", __func__, ux);
}
- ex->isdone = 0;
+ ux->isdone = 0;
#endif
sqh->elink = setup;
sqh->qh.qh_elink = htole32(setup->physaddr | UHCI_PTR_TD);
s = splusb();
- if (dev->speed == USB_SPEED_LOW)
+ if (xfer->device->speed == USB_SPEED_LOW)
uhci_add_ls_ctrl(sc, sqh);
else
uhci_add_hs_ctrl(sc, sqh);
- uhci_add_intr_list(sc, ex);
+ uhci_add_intr_list(sc, ux);
#ifdef UHCI_DEBUG
if (uhcidebug > 12) {
struct uhci_soft_td *std;
#endif
if (xfer->timeout && !sc->sc_bus.use_polling) {
timeout_del(&xfer->timeout_handle);
- timeout_set(&xfer->timeout_handle, uhci_timeout, ex);
+ timeout_set(&xfer->timeout_handle, uhci_timeout, xfer);
timeout_add_msec(&xfer->timeout_handle, xfer->timeout);
}
xfer->status = USBD_IN_PROGRESS;
void
uhci_device_isoc_enter(struct usbd_xfer *xfer)
{
+ struct uhci_softc *sc = (struct uhci_softc *)xfer->device->bus;
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
- struct usbd_device *dev = upipe->pipe.device;
- struct uhci_softc *sc = (struct uhci_softc *)dev->bus;
struct iso *iso = &upipe->u.iso;
struct uhci_soft_td *std;
u_int32_t buf, len, status;
}
xfer->status = USBD_IN_PROGRESS;
- UXFER(xfer)->curframe = next;
+ ((struct uhci_xfer *)xfer)->curframe = next;
buf = DMAADDR(&xfer->dmabuf, 0);
status = UHCI_TD_ZERO_ACTLEN(UHCI_TD_SET_ERRCNT(0) |
usbd_status
uhci_device_isoc_start(struct usbd_xfer *xfer)
{
+ struct uhci_softc *sc = (struct uhci_softc *)xfer->device->bus;
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
- struct uhci_softc *sc = (struct uhci_softc *)upipe->pipe.device->bus;
- struct uhci_xfer *ex = UXFER(xfer);
+ struct uhci_xfer *ux = (struct uhci_xfer *)xfer;
struct uhci_soft_td *end;
int s, i;
#endif
/* Find the last TD */
- i = UXFER(xfer)->curframe + xfer->nframes;
+ i = ux->curframe + xfer->nframes;
if (i >= UHCI_VFRAMELIST_COUNT)
i -= UHCI_VFRAMELIST_COUNT;
end = upipe->u.iso.stds[i];
s = splusb();
/* Set up interrupt info. */
- ex->stdstart = end;
- ex->stdend = end;
+ ux->stdstart = end;
+ ux->stdend = end;
#ifdef DIAGNOSTIC
- if (!ex->isdone)
- printf("uhci_device_isoc_start: not done, ex=%p\n", ex);
- ex->isdone = 0;
+ if (!ux->isdone)
+ printf("%s: not done, ux=%p\n", __func__, ux);
+ ux->isdone = 0;
#endif
- uhci_add_intr_list(sc, ex);
+ uhci_add_intr_list(sc, ux);
splx(s);
void
uhci_device_isoc_abort(struct usbd_xfer *xfer)
{
+ struct uhci_xfer *ux = (struct uhci_xfer *)xfer;
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
struct uhci_soft_td **stds = upipe->u.iso.stds;
struct uhci_soft_td *std;
/* make hardware ignore it, */
nframes = xfer->nframes;
- n = UXFER(xfer)->curframe;
+ n = ux->curframe;
maxlen = 0;
for (i = 0; i < nframes; i++) {
std = stds[n];
delay(maxlen);
#ifdef DIAGNOSTIC
- UXFER(xfer)->isdone = 1;
+ ux->isdone = 1;
#endif
/* Run callback and remove from interrupt list. */
usb_transfer_complete(xfer);
void
uhci_device_isoc_close(struct usbd_pipe *pipe)
{
+ struct uhci_softc *sc = (struct uhci_softc *)pipe->device->bus;
struct uhci_pipe *upipe = (struct uhci_pipe *)pipe;
- struct usbd_device *dev = upipe->pipe.device;
- struct uhci_softc *sc = (struct uhci_softc *)dev->bus;
struct uhci_soft_td *std, *vstd;
struct iso *iso;
int i, s;
usbd_status
uhci_setup_isoc(struct usbd_pipe *pipe)
{
+ struct uhci_softc *sc = (struct uhci_softc *)pipe->device->bus;
struct uhci_pipe *upipe = (struct uhci_pipe *)pipe;
- struct usbd_device *dev = upipe->pipe.device;
- struct uhci_softc *sc = (struct uhci_softc *)dev->bus;
- int addr = upipe->pipe.device->address;
- int endpt = upipe->pipe.endpoint->edesc->bEndpointAddress;
+ int addr = pipe->device->address;
+ int endpt = pipe->endpoint->edesc->bEndpointAddress;
int rd = UE_GET_DIR(endpt) == UE_DIR_IN;
struct uhci_soft_td *std, *vstd;
u_int32_t token;
void
uhci_device_isoc_done(struct usbd_xfer *xfer)
{
- struct uhci_xfer *ex = UXFER(xfer);
+ struct uhci_xfer *ux = (struct uhci_xfer *)xfer;
DPRINTFN(4, ("uhci_device_isoc_done: length=%d\n", xfer->actlen));
- if (!uhci_active_intr_list(ex))
+ if (!uhci_active_intr_list(ux))
return;
#ifdef DIAGNOSTIC
return;
}
- if (ex->stdend == NULL) {
+ if (ux->stdend == NULL) {
printf("uhci_device_isoc_done: xfer=%p stdend==NULL\n", xfer);
#ifdef UHCI_DEBUG
- uhci_dump_xfer(ex);
+ uhci_dump_xfer(ux);
#endif
return;
}
#endif
/* Turn off the interrupt since it is active even if the TD is not. */
- ex->stdend->td.td_status &= htole32(~UHCI_TD_IOC);
+ ux->stdend->td.td_status &= htole32(~UHCI_TD_IOC);
- uhci_del_intr_list(ex); /* remove from active list */
+ uhci_del_intr_list(ux); /* remove from active list */
}
void
uhci_device_intr_done(struct usbd_xfer *xfer)
{
- struct uhci_xfer *ex = UXFER(xfer);
struct uhci_softc *sc = (struct uhci_softc *)xfer->device->bus;
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
+ struct uhci_xfer *ux = (struct uhci_xfer *)xfer;
struct uhci_soft_qh *sqh;
int i, npoll;
sqh->elink = NULL;
sqh->qh.qh_elink = htole32(UHCI_PTR_T);
}
- uhci_free_std_chain(sc, ex->stdstart, NULL);
+ uhci_free_std_chain(sc, ux->stdstart, NULL);
/* XXX Wasteful. */
if (xfer->pipe->repeat) {
}
#endif
- ex->stdstart = data;
- ex->stdend = dataend;
+ ux->stdstart = data;
+ ux->stdend = dataend;
#ifdef DIAGNOSTIC
- if (!ex->isdone) {
- printf("uhci_device_intr_done: not done, ex=%p\n", ex);
+ if (!ux->isdone) {
+ printf("%s: not done, ux=%p\n", __func__, ux);
}
- ex->isdone = 0;
+ ux->isdone = 0;
#endif
for (i = 0; i < npoll; i++) {
sqh = upipe->u.intr.qhs[i];
sqh->qh.qh_elink = htole32(data->physaddr | UHCI_PTR_TD);
}
xfer->status = USBD_IN_PROGRESS;
- /* The ex is already on the examined list, just leave it. */
+ /* The ux is already on the examined list, just leave it. */
} else {
DPRINTFN(5,("uhci_device_intr_done: removing\n"));
- if (uhci_active_intr_list(ex))
- uhci_del_intr_list(ex);
+ if (uhci_active_intr_list(ux))
+ uhci_del_intr_list(ux);
}
}
void
uhci_device_ctrl_done(struct usbd_xfer *xfer)
{
- struct uhci_xfer *ex = UXFER(xfer);
struct uhci_softc *sc = (struct uhci_softc *)xfer->device->bus;
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
+ struct uhci_xfer *ux = (struct uhci_xfer *)xfer;
#ifdef DIAGNOSTIC
if (!(xfer->rqflags & URQ_REQUEST))
panic("uhci_device_ctrl_done: not a request");
#endif
- if (!uhci_active_intr_list(ex))
+ if (!uhci_active_intr_list(ux))
return;
- uhci_del_intr_list(ex); /* remove from active list */
+ uhci_del_intr_list(ux); /* remove from active list */
- if (upipe->pipe.device->speed == USB_SPEED_LOW)
+ if (xfer->device->speed == USB_SPEED_LOW)
uhci_remove_ls_ctrl(sc, upipe->u.ctl.sqh);
else
uhci_remove_hs_ctrl(sc, upipe->u.ctl.sqh);
if (upipe->u.ctl.length != 0)
- uhci_free_std_chain(sc, ex->stdstart->link.std, ex->stdend);
+ uhci_free_std_chain(sc, ux->stdstart->link.std, ux->stdend);
DPRINTFN(5, ("uhci_device_ctrl_done: length=%d\n", xfer->actlen));
}
void
uhci_device_bulk_done(struct usbd_xfer *xfer)
{
- struct uhci_xfer *ex = UXFER(xfer);
struct uhci_softc *sc = (struct uhci_softc *)xfer->device->bus;
struct uhci_pipe *upipe = (struct uhci_pipe *)xfer->pipe;
+ struct uhci_xfer *ux = (struct uhci_xfer *)xfer;
- DPRINTFN(5,("uhci_device_bulk_done: xfer=%p ex=%p sc=%p upipe=%p\n",
- xfer, ex, sc, upipe));
+ DPRINTFN(5,("uhci_device_bulk_done: xfer=%p ux=%p sc=%p upipe=%p\n",
+ xfer, ux, sc, upipe));
- if (!uhci_active_intr_list(ex))
+ if (!uhci_active_intr_list(ux))
return;
- uhci_del_intr_list(ex); /* remove from active list */
+ uhci_del_intr_list(ux); /* remove from active list */
uhci_remove_bulk(sc, upipe->u.bulk.sqh);
- uhci_free_std_chain(sc, ex->stdstart, NULL);
+ uhci_free_std_chain(sc, ux->stdstart, NULL);
DPRINTFN(5, ("uhci_device_bulk_done: length=%d\n", xfer->actlen));
}
}
xfer->status = USBD_CANCELLED;
#ifdef DIAGNOSTIC
- UXFER(xfer)->isdone = 1;
+ ((struct uhci_xfer *)xfer)->isdone = 1;
#endif
usb_transfer_complete(xfer);
}
-/* $OpenBSD: uhcivar.h,v 1.29 2014/03/25 20:27:37 mpi Exp $ */
+/* $OpenBSD: uhcivar.h,v 1.30 2014/04/27 14:48:10 mpi Exp $ */
/* $NetBSD: uhcivar.h,v 1.36 2002/12/31 00:39:11 augustss Exp $ */
/* $FreeBSD: src/sys/dev/usb/uhcivar.h,v 1.14 1999/11/17 22:33:42 n_hibma Exp $ */
#endif
};
-#define UXFER(xfer) ((struct uhci_xfer *)(xfer))
-
/*
* Extra information that we need for a TD.
*/