summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/dev/usb/ehci.c46
-rw-r--r--sys/dev/usb/ohci.c23
-rw-r--r--sys/dev/usb/uhci.c21
3 files changed, 48 insertions, 42 deletions
diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c
index 43ad4e08b9b..f750348694f 100644
--- a/sys/dev/usb/ehci.c
+++ b/sys/dev/usb/ehci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ehci.c,v 1.99 2009/04/20 14:11:57 reyk Exp $ */
+/* $OpenBSD: ehci.c,v 1.100 2009/06/02 23:49:33 deraadt Exp $ */
/* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */
/*
@@ -193,7 +193,7 @@ void ehci_free_sqh(ehci_softc_t *, ehci_soft_qh_t *);
ehci_soft_qtd_t *ehci_alloc_sqtd(ehci_softc_t *);
void ehci_free_sqtd(ehci_softc_t *, ehci_soft_qtd_t *);
usbd_status ehci_alloc_sqtd_chain(struct ehci_pipe *,
- ehci_softc_t *, int, int, usbd_xfer_handle,
+ ehci_softc_t *, u_int, int, usbd_xfer_handle,
ehci_soft_qtd_t **, ehci_soft_qtd_t **);
void ehci_free_sqtd_chain(ehci_softc_t *, ehci_soft_qtd_t *,
ehci_soft_qtd_t *);
@@ -2445,14 +2445,14 @@ ehci_free_sqtd(ehci_softc_t *sc, ehci_soft_qtd_t *sqtd)
}
usbd_status
-ehci_alloc_sqtd_chain(struct ehci_pipe *epipe, ehci_softc_t *sc, int alen,
+ehci_alloc_sqtd_chain(struct ehci_pipe *epipe, ehci_softc_t *sc, u_int alen,
int rd, usbd_xfer_handle xfer, ehci_soft_qtd_t **sp, ehci_soft_qtd_t **ep)
{
ehci_soft_qtd_t *next, *cur;
ehci_physaddr_t dataphys, dataphyspage, dataphyslastpage, nextphys;
u_int32_t qtdstatus;
- int len, curlen, mps;
- int i, iscontrol, forceshort;
+ u_int len, curlen;
+ int mps, i, iscontrol, forceshort;
usb_dma_t *dma = &xfer->dmabuf;
DPRINTFN(alen<4*4096,("ehci_alloc_sqtd_chain: start len=%d\n", alen));
@@ -2493,8 +2493,8 @@ ehci_alloc_sqtd_chain(struct ehci_pipe *epipe, ehci_softc_t *sc, int alen,
EHCI_PAGE_OFFSET(dataphys);
#ifdef DIAGNOSTIC
if (curlen > len) {
- printf("ehci_alloc_sqtd_chain: curlen=0x%x "
- "len=0x%x offs=0x%x\n", curlen, len,
+ printf("ehci_alloc_sqtd_chain: curlen=%u "
+ "len=%u offs=0x%x\n", curlen, len,
EHCI_PAGE_OFFSET(dataphys));
printf("lastpage=0x%x page=0x%x phys=0x%x\n",
dataphyslastpage, dataphyspage, dataphys);
@@ -2504,14 +2504,15 @@ ehci_alloc_sqtd_chain(struct ehci_pipe *epipe, ehci_softc_t *sc, int alen,
/* the length must be a multiple of the max size */
curlen -= curlen % mps;
DPRINTFN(1,("ehci_alloc_sqtd_chain: multiple QTDs, "
- "curlen=%d\n", curlen));
+ "curlen=%u\n", curlen));
#ifdef DIAGNOSTIC
if (curlen == 0)
panic("ehci_alloc_std: curlen == 0");
#endif
}
+
DPRINTFN(4,("ehci_alloc_sqtd_chain: dataphys=0x%08x "
- "dataphyslastpage=0x%08x len=%d curlen=%d\n",
+ "dataphyslastpage=0x%08x len=%u curlen=%u\n",
dataphys, dataphyslastpage, len, curlen));
len -= curlen;
@@ -2535,14 +2536,14 @@ ehci_alloc_sqtd_chain(struct ehci_pipe *epipe, ehci_softc_t *sc, int alen,
ehci_physaddr_t a = dataphys + i * EHCI_PAGE_SIZE;
if (i != 0) /* use offset only in first buffer */
a = EHCI_PAGE(a);
- cur->qtd.qtd_buffer[i] = htole32(a);
- cur->qtd.qtd_buffer_hi[i] = 0;
#ifdef DIAGNOSTIC
if (i >= EHCI_QTD_NBUFFERS) {
printf("ehci_alloc_sqtd_chain: i=%d\n", i);
goto nomem;
}
#endif
+ cur->qtd.qtd_buffer[i] = htole32(a);
+ cur->qtd.qtd_buffer_hi[i] = 0;
}
cur->nextqtd = next;
cur->qtd.qtd_next = cur->qtd.qtd_altnext = nextphys;
@@ -2552,7 +2553,7 @@ ehci_alloc_sqtd_chain(struct ehci_pipe *epipe, ehci_softc_t *sc, int alen,
cur->len = curlen;
DPRINTFN(10,("ehci_alloc_sqtd_chain: cbp=0x%08x end=0x%08x\n",
dataphys, dataphys + curlen));
- DPRINTFN(10,("ehci_alloc_sqtd_chain: curlen=%d\n", curlen));
+ DPRINTFN(10,("ehci_alloc_sqtd_chain: curlen=%u\n", curlen));
if (iscontrol) {
/*
* adjust the toggle based on the number of packets
@@ -3094,7 +3095,7 @@ ehci_device_ctrl_done(usbd_xfer_handle xfer)
ehci_free_sqtd_chain(sc, ex->sqtdstart, NULL);
}
- DPRINTFN(5, ("ehci_ctrl_done: length=%d\n", xfer->actlen));
+ DPRINTFN(5, ("ehci_ctrl_done: length=%u\n", xfer->actlen));
}
/* Abort a device control request. */
@@ -3128,7 +3129,7 @@ ehci_device_request(usbd_xfer_handle xfer)
ehci_soft_qtd_t *setup, *stat, *next;
ehci_soft_qh_t *sqh;
int isread;
- int len;
+ u_int len;
usbd_status err;
int s;
@@ -3136,7 +3137,7 @@ ehci_device_request(usbd_xfer_handle xfer)
len = UGETW(req->wLength);
DPRINTFN(3,("ehci_device_request: type=0x%02x, request=0x%02x, "
- "wValue=0x%04x, wIndex=0x%04x len=%d, addr=%d, endpt=%d\n",
+ "wValue=0x%04x, wIndex=0x%04x len=%u, addr=%d, endpt=%d\n",
req->bmRequestType, req->bRequest, UGETW(req->wValue),
UGETW(req->wIndex), len, addr,
epipe->pipe.endpoint->edesc->bEndpointAddress));
@@ -3292,10 +3293,11 @@ ehci_device_bulk_start(usbd_xfer_handle xfer)
ehci_soft_qtd_t *data, *dataend;
ehci_soft_qh_t *sqh;
usbd_status err;
- int len, isread, endpt;
+ u_int len;
+ int isread, endpt;
int s;
- DPRINTFN(2, ("ehci_device_bulk_start: xfer=%p len=%d flags=%d\n",
+ DPRINTFN(2, ("ehci_device_bulk_start: xfer=%p len=%u flags=%d\n",
xfer, xfer->length, xfer->flags));
if (sc->sc_dying)
@@ -3467,10 +3469,11 @@ ehci_device_intr_start(usbd_xfer_handle xfer)
ehci_soft_qtd_t *data, *dataend;
ehci_soft_qh_t *sqh;
usbd_status err;
- int len, isread, endpt;
+ u_int len;
+ int isread, endpt;
int s;
- DPRINTFN(2, ("ehci_device_intr_start: xfer=%p len=%d flags=%d\n",
+ DPRINTFN(2, ("ehci_device_intr_start: xfer=%p len=%u flags=%d\n",
xfer, xfer->length, xfer->flags));
if (sc->sc_dying)
@@ -3581,7 +3584,8 @@ ehci_device_intr_done(usbd_xfer_handle xfer)
ehci_soft_qtd_t *data, *dataend;
ehci_soft_qh_t *sqh;
usbd_status err;
- int len, isread, endpt, s;
+ u_int len;
+ int isread, endpt, s;
DPRINTFN(10, ("ehci_device_intr_done: xfer=%p, actlen=%d\n",
xfer, xfer->actlen));
@@ -3677,7 +3681,7 @@ ehci_device_isoc_start(usbd_xfer_handle xfer)
if (exfer->itdstart != NULL)
return (USBD_IN_PROGRESS);
- DPRINTFN(2, ("ehci_device_isoc_start: xfer %p len %d flags %d\n",
+ DPRINTFN(2, ("ehci_device_isoc_start: xfer %p len %u flags %d\n",
xfer, xfer->length, xfer->flags));
if (sc->sc_dying)
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c
index 2e739091909..2c3114ad9fc 100644
--- a/sys/dev/usb/ohci.c
+++ b/sys/dev/usb/ohci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ohci.c,v 1.90 2009/02/14 20:05:09 chl Exp $ */
+/* $OpenBSD: ohci.c,v 1.91 2009/06/02 23:49:33 deraadt 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 $ */
@@ -97,7 +97,7 @@ void ohci_free_std_chain(ohci_softc_t *, ohci_soft_td_t *,
ohci_soft_td_t *);
#endif
usbd_status ohci_alloc_std_chain(struct ohci_pipe *,
- ohci_softc_t *, int, int, usbd_xfer_handle,
+ ohci_softc_t *, u_int, int, usbd_xfer_handle,
ohci_soft_td_t *, ohci_soft_td_t **);
void ohci_shutdown(void *v);
@@ -435,17 +435,17 @@ ohci_free_std(ohci_softc_t *sc, ohci_soft_td_t *std)
usbd_status
ohci_alloc_std_chain(struct ohci_pipe *opipe, ohci_softc_t *sc,
- int alen, int rd, usbd_xfer_handle xfer,
+ u_int alen, int rd, usbd_xfer_handle xfer,
ohci_soft_td_t *sp, ohci_soft_td_t **ep)
{
ohci_soft_td_t *next, *cur;
ohci_physaddr_t dataphys, dataphysend;
u_int32_t tdflags;
- int len, curlen;
+ u_int len, curlen;
usb_dma_t *dma = &xfer->dmabuf;
u_int16_t flags = xfer->flags;
- DPRINTFN(alen < 4096,("ohci_alloc_std_chain: start len=%d\n", alen));
+ DPRINTFN(alen < 4096,("ohci_alloc_std_chain: start len=%u\n", alen));
len = alen;
cur = sp;
@@ -478,7 +478,7 @@ ohci_alloc_std_chain(struct ohci_pipe *opipe, ohci_softc_t *sc,
#endif
}
DPRINTFN(4,("ohci_alloc_std_chain: dataphys=0x%08x "
- "dataphysend=0x%08x len=%d curlen=%d\n",
+ "dataphysend=0x%08x len=%u curlen=%u\n",
dataphys, dataphysend,
len, curlen));
len -= curlen;
@@ -1648,7 +1648,7 @@ ohci_device_request(usbd_xfer_handle xfer)
ohci_soft_td_t *setup, *stat, *next, *tail;
ohci_soft_ed_t *sed;
int isread;
- int len;
+ u_int len;
usbd_status err;
int s;
@@ -1656,7 +1656,7 @@ ohci_device_request(usbd_xfer_handle xfer)
len = UGETW(req->wLength);
DPRINTFN(3,("ohci_device_control type=0x%02x, request=0x%02x, "
- "wValue=0x%04x, wIndex=0x%04x len=%d, addr=%d, endpt=%d\n",
+ "wValue=0x%04x, wIndex=0x%04x len=%u, addr=%d, endpt=%d\n",
req->bmRequestType, req->bRequest, UGETW(req->wValue),
UGETW(req->wIndex), len, addr,
opipe->pipe.endpoint->edesc->bEndpointAddress));
@@ -2854,7 +2854,8 @@ ohci_device_bulk_start(usbd_xfer_handle xfer)
int addr = dev->address;
ohci_soft_td_t *data, *tail, *tdp;
ohci_soft_ed_t *sed;
- int s, len, isread, endpt;
+ u_int len;
+ int s, isread, endpt;
usbd_status err;
if (sc->sc_dying)
@@ -2873,7 +2874,7 @@ ohci_device_bulk_start(usbd_xfer_handle xfer)
isread = UE_GET_DIR(endpt) == UE_DIR_IN;
sed = opipe->sed;
- DPRINTFN(4,("ohci_device_bulk_start: xfer=%p len=%d isread=%d "
+ DPRINTFN(4,("ohci_device_bulk_start: xfer=%p len=%u isread=%d "
"flags=%d endpt=%d\n", xfer, len, isread, xfer->flags,
endpt));
@@ -2998,7 +2999,7 @@ ohci_device_intr_start(usbd_xfer_handle xfer)
if (sc->sc_dying)
return (USBD_IOERROR);
- DPRINTFN(3, ("ohci_device_intr_transfer: xfer=%p len=%d "
+ DPRINTFN(3, ("ohci_device_intr_transfer: xfer=%p len=%u "
"flags=%d priv=%p\n",
xfer, xfer->length, xfer->flags, xfer->priv));
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index 8af21d8e618..7a2f60a822f 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uhci.c,v 1.69 2008/11/21 17:08:42 deraadt Exp $ */
+/* $OpenBSD: uhci.c,v 1.70 2009/06/02 23:49:33 deraadt 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 $ */
@@ -144,7 +144,7 @@ void uhci_exit_ctl_q(uhci_softc_t *, uhci_soft_qh_t *);
void uhci_free_std_chain(uhci_softc_t *,
uhci_soft_td_t *, uhci_soft_td_t *);
usbd_status uhci_alloc_std_chain(struct uhci_pipe *,
- uhci_softc_t *, int, int, u_int16_t, usb_dma_t *,
+ uhci_softc_t *, u_int, int, u_int16_t, usb_dma_t *,
uhci_soft_td_t **, uhci_soft_td_t **);
void uhci_poll_hub(void *);
void uhci_waitintr(uhci_softc_t *, usbd_xfer_handle);
@@ -1678,7 +1678,7 @@ uhci_free_std_chain(uhci_softc_t *sc, uhci_soft_td_t *std,
}
usbd_status
-uhci_alloc_std_chain(struct uhci_pipe *upipe, uhci_softc_t *sc, int len,
+uhci_alloc_std_chain(struct uhci_pipe *upipe, uhci_softc_t *sc, u_int len,
int rd, u_int16_t flags, usb_dma_t *dma,
uhci_soft_td_t **sp, uhci_soft_td_t **ep)
{
@@ -1689,7 +1689,7 @@ uhci_alloc_std_chain(struct uhci_pipe *upipe, uhci_softc_t *sc, int len,
int addr = upipe->pipe.device->address;
int endpt = upipe->pipe.endpoint->edesc->bEndpointAddress;
- DPRINTFN(8, ("uhci_alloc_std_chain: addr=%d endpt=%d len=%d speed=%d "
+ DPRINTFN(8, ("uhci_alloc_std_chain: addr=%d endpt=%d len=%u speed=%d "
"flags=0x%x\n", addr, UE_GET_ADDR(endpt), len,
upipe->pipe.device->speed, flags));
maxp = UGETW(upipe->pipe.endpoint->edesc->wMaxPacketSize);
@@ -1788,10 +1788,11 @@ uhci_device_bulk_start(usbd_xfer_handle xfer)
uhci_soft_td_t *data, *dataend;
uhci_soft_qh_t *sqh;
usbd_status err;
- int len, isread, endpt;
+ u_int len;
+ int isread, endpt;
int s;
- DPRINTFN(3, ("uhci_device_bulk_start: xfer=%p len=%d flags=%d ii=%p\n",
+ DPRINTFN(3, ("uhci_device_bulk_start: xfer=%p len=%u flags=%d ii=%p\n",
xfer, xfer->length, xfer->flags, ii));
if (sc->sc_dying)
@@ -2029,7 +2030,7 @@ uhci_device_intr_start(usbd_xfer_handle xfer)
if (sc->sc_dying)
return (USBD_IOERROR);
- DPRINTFN(3,("uhci_device_intr_start: xfer=%p len=%d flags=%d\n",
+ DPRINTFN(3,("uhci_device_intr_start: xfer=%p len=%u flags=%d\n",
xfer, xfer->length, xfer->flags));
#ifdef DIAGNOSTIC
@@ -2159,14 +2160,14 @@ uhci_device_request(usbd_xfer_handle xfer)
uhci_intr_info_t *ii = &UXFER(xfer)->iinfo;
uhci_soft_td_t *setup, *data, *stat, *next, *dataend;
uhci_soft_qh_t *sqh;
- int len;
+ u_int len;
u_int32_t ls;
usbd_status err;
int isread;
int s;
DPRINTFN(3,("uhci_device_request type=0x%02x, request=0x%02x, "
- "wValue=0x%04x, wIndex=0x%04x len=%d, addr=%d, endpt=%d\n",
+ "wValue=0x%04x, wIndex=0x%04x len=%u, addr=%d, endpt=%d\n",
req->bmRequestType, req->bRequest, UGETW(req->wValue),
UGETW(req->wIndex), UGETW(req->wLength),
addr, endpt));
@@ -3471,7 +3472,7 @@ uhci_root_intr_start(usbd_xfer_handle xfer)
usbd_pipe_handle pipe = xfer->pipe;
uhci_softc_t *sc = (uhci_softc_t *)pipe->device->bus;
- DPRINTFN(3, ("uhci_root_intr_start: xfer=%p len=%d flags=%d\n",
+ DPRINTFN(3, ("uhci_root_intr_start: xfer=%p len=%u flags=%d\n",
xfer, xfer->length, xfer->flags));
if (sc->sc_dying)