summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/uhci.c
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2001-12-30 23:02:31 +0000
committerjoe <joe@FreeBSD.org>2001-12-30 23:02:31 +0000
commitfedd0e40cedf1b9b7c7b7c553cadab44aa8cf2ee (patch)
tree0f63cf1c1f0a171f7acb8eec3b9b2cb77b8b7aac /sys/dev/usb/uhci.c
parent18ea14531f8f3ebbed2bebd7105b117847189e9f (diff)
downloadFreeBSD-src-fedd0e40cedf1b9b7c7b7c553cadab44aa8cf2ee.zip
FreeBSD-src-fedd0e40cedf1b9b7c7b7c553cadab44aa8cf2ee.tar.gz
Partial sync with NetBSD:
Replace LE() macro with htole32()/le32toh().
Diffstat (limited to 'sys/dev/usb/uhci.c')
-rw-r--r--sys/dev/usb/uhci.c181
1 files changed, 94 insertions, 87 deletions
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index 7358fe1..8f36f5e 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -104,10 +104,14 @@ int uhcidebug = 1;
* The UHCI controller is little endian, so on big endian machines
* the data strored in memory needs to be swapped.
*/
+#if defined(__FreeBSD__)
#if BYTE_ORDER == BIG_ENDIAN
-#define LE(x) (bswap32(x))
+#define htole32(x) (bswap32(x))
+#define le32toh(x) (bswap32(x))
#else
-#define LE(x) (x)
+#define htole32(x) (x)
+#define le32toh(x) (x)
+#endif
#endif
struct uhci_pipe {
@@ -370,8 +374,8 @@ uhci_init(uhci_softc_t *sc)
bsqh = uhci_alloc_sqh(sc);
if (bsqh == NULL)
return (USBD_NOMEM);
- bsqh->qh.qh_hlink = LE(UHCI_PTR_T); /* end of QH chain */
- bsqh->qh.qh_elink = LE(UHCI_PTR_T);
+ bsqh->qh.qh_hlink = htole32(UHCI_PTR_T); /* end of QH chain */
+ bsqh->qh.qh_elink = htole32(UHCI_PTR_T);
sc->sc_bulk_start = sc->sc_bulk_end = bsqh;
/* Allocate the dummy QH where control traffic will be queued. */
@@ -379,8 +383,8 @@ uhci_init(uhci_softc_t *sc)
if (csqh == NULL)
return (USBD_NOMEM);
csqh->hlink = bsqh;
- csqh->qh.qh_hlink = LE(bsqh->physaddr | UHCI_PTR_Q);
- csqh->qh.qh_elink = LE(UHCI_PTR_T);
+ csqh->qh.qh_hlink = htole32(bsqh->physaddr | UHCI_PTR_Q);
+ csqh->qh.qh_elink = htole32(UHCI_PTR_T);
sc->sc_ctl_start = sc->sc_ctl_end = csqh;
/*
@@ -394,14 +398,14 @@ uhci_init(uhci_softc_t *sc)
if (std == NULL || sqh == NULL)
return (USBD_NOMEM);
std->link.sqh = sqh;
- std->td.td_link = LE(sqh->physaddr | UHCI_PTR_Q);
- std->td.td_status = LE(UHCI_TD_IOS); /* iso, inactive */
- std->td.td_token = LE(0);
- std->td.td_buffer = LE(0);
+ std->td.td_link = htole32(sqh->physaddr | UHCI_PTR_Q);
+ std->td.td_status = htole32(UHCI_TD_IOS); /* iso, inactive */
+ std->td.td_token = htole32(0);
+ std->td.td_buffer = htole32(0);
sqh->hlink = csqh;
- sqh->qh.qh_hlink = LE(csqh->physaddr | UHCI_PTR_Q);
+ sqh->qh.qh_hlink = htole32(csqh->physaddr | UHCI_PTR_Q);
sqh->elink = 0;
- sqh->qh.qh_elink = LE(UHCI_PTR_T);
+ sqh->qh.qh_elink = htole32(UHCI_PTR_T);
sc->sc_vframes[i].htd = std;
sc->sc_vframes[i].etd = std;
sc->sc_vframes[i].hqh = sqh;
@@ -409,7 +413,7 @@ uhci_init(uhci_softc_t *sc)
for (j = i;
j < UHCI_FRAMELIST_COUNT;
j += UHCI_VFRAMELIST_COUNT)
- sc->sc_pframes[j] = LE(std->physaddr);
+ sc->sc_pframes[j] = htole32(std->physaddr);
}
LIST_INIT(&sc->sc_intrhead);
@@ -632,31 +636,32 @@ uhci_dump_td(uhci_soft_td_t *p)
DPRINTFN(-1,("TD(%p) at %08lx = link=0x%08lx status=0x%08lx "
"token=0x%08lx buffer=0x%08lx\n",
p, (long)p->physaddr,
- (long)LE(p->td.td_link),
- (long)LE(p->td.td_status),
- (long)LE(p->td.td_token),
- (long)LE(p->td.td_buffer)));
+ (long)le32toh(p->td.td_link),
+ (long)le32toh(p->td.td_status),
+ (long)le32toh(p->td.td_token),
+ (long)le32toh(p->td.td_buffer)));
DPRINTFN(-1,(" %b %b,errcnt=%d,actlen=%d pid=%02x,addr=%d,endpt=%d,"
"D=%d,maxlen=%d\n",
- (int)LE(p->td.td_link),
+ (int)le32toh(p->td.td_link),
"\20\1T\2Q\3VF",
- (int)LE(p->td.td_status),
+ (int)le32toh(p->td.td_status),
"\20\22BITSTUFF\23CRCTO\24NAK\25BABBLE\26DBUFFER\27"
"STALLED\30ACTIVE\31IOC\32ISO\33LS\36SPD",
- UHCI_TD_GET_ERRCNT(LE(p->td.td_status)),
- UHCI_TD_GET_ACTLEN(LE(p->td.td_status)),
- UHCI_TD_GET_PID(LE(p->td.td_token)),
- UHCI_TD_GET_DEVADDR(LE(p->td.td_token)),
- UHCI_TD_GET_ENDPT(LE(p->td.td_token)),
- UHCI_TD_GET_DT(LE(p->td.td_token)),
- UHCI_TD_GET_MAXLEN(LE(p->td.td_token))));
+ UHCI_TD_GET_ERRCNT(le32toh(p->td.td_status)),
+ UHCI_TD_GET_ACTLEN(le32toh(p->td.td_status)),
+ UHCI_TD_GET_PID(le32toh(p->td.td_token)),
+ UHCI_TD_GET_DEVADDR(le32toh(p->td.td_token)),
+ UHCI_TD_GET_ENDPT(le32toh(p->td.td_token)),
+ UHCI_TD_GET_DT(le32toh(p->td.td_token)),
+ UHCI_TD_GET_MAXLEN(le32toh(p->td.td_token))));
}
void
uhci_dump_qh(uhci_soft_qh_t *sqh)
{
DPRINTFN(-1,("QH(%p) at %08x: hlink=%08x elink=%08x\n", sqh,
- (int)sqh->physaddr, LE(sqh->qh.qh_hlink), LE(sqh->qh.qh_elink)));
+ (int)sqh->physaddr, le32toh(sqh->qh.qh_hlink),
+ le32toh(sqh->qh.qh_elink)));
}
@@ -694,12 +699,12 @@ uhci_dump_qhs(uhci_soft_qh_t *sqh)
*/
- if (sqh->hlink != NULL && !(sqh->qh.qh_hlink & UHCI_PTR_T))
+ if (sqh->hlink != NULL && !(le32toh(sqh->qh.qh_hlink) & UHCI_PTR_T))
uhci_dump_qhs(sqh->hlink);
else
DPRINTF(("No QH\n"));
- if (sqh->elink != NULL && !(sqh->qh.qh_elink & UHCI_PTR_T))
+ if (sqh->elink != NULL && !(le32toh(sqh->qh.qh_elink) & UHCI_PTR_T))
uhci_dump_tds(sqh->elink);
else
DPRINTF(("No TD\n"));
@@ -718,8 +723,8 @@ uhci_dump_tds(uhci_soft_td_t *std)
* printing the free list in case the queue/TD has
* already been moved there (seatbelt).
*/
- if (td->td.td_link & UHCI_PTR_T ||
- td->td.td_link == 0)
+ if (le32toh(td->td.td_link) & UHCI_PTR_T ||
+ le32toh(td->td.td_link) == 0)
break;
}
}
@@ -833,7 +838,7 @@ uhci_add_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
sqh->hlink = eqh->hlink;
sqh->qh.qh_hlink = eqh->qh.qh_hlink;
eqh->hlink = sqh;
- eqh->qh.qh_hlink = LE(sqh->physaddr | UHCI_PTR_Q);
+ eqh->qh.qh_hlink = htole32(sqh->physaddr | UHCI_PTR_Q);
sc->sc_ctl_end = sqh;
}
@@ -848,7 +853,7 @@ uhci_remove_ctrl(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
DPRINTFN(10, ("uhci_remove_ctrl: sqh=%p\n", sqh));
for (pqh = sc->sc_ctl_start; pqh->hlink != sqh; pqh=pqh->hlink)
#if defined(DIAGNOSTIC) || defined(UHCI_DEBUG)
- if (LE(pqh->qh.qh_hlink) & UHCI_PTR_T) {
+ if (le32toh(pqh->qh.qh_hlink) & UHCI_PTR_T) {
printf("uhci_remove_ctrl: QH not found\n");
return;
}
@@ -874,7 +879,7 @@ uhci_add_bulk(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
sqh->hlink = eqh->hlink;
sqh->qh.qh_hlink = eqh->qh.qh_hlink;
eqh->hlink = sqh;
- eqh->qh.qh_hlink = LE(sqh->physaddr | UHCI_PTR_Q);
+ eqh->qh.qh_hlink = htole32(sqh->physaddr | UHCI_PTR_Q);
sc->sc_bulk_end = sqh;
}
@@ -889,7 +894,7 @@ uhci_remove_bulk(uhci_softc_t *sc, uhci_soft_qh_t *sqh)
DPRINTFN(10, ("uhci_remove_bulk: sqh=%p\n", sqh));
for (pqh = sc->sc_bulk_start; pqh->hlink != sqh; pqh = pqh->hlink)
#if defined(DIAGNOSTIC) || defined(UHCI_DEBUG)
- if (LE(pqh->qh.qh_hlink) & UHCI_PTR_T) {
+ if (le32toh(pqh->qh.qh_hlink) & UHCI_PTR_T) {
printf("uhci_remove_bulk: QH not found\n");
return;
}
@@ -1026,10 +1031,10 @@ uhci_check_intr(uhci_softc_t *sc, uhci_intr_info_t *ii)
* is a an error somewhere in the middle, or whether there was a
* short packet (SPD and not ACTIVE).
*/
- if (LE(lstd->td.td_status) & UHCI_TD_ACTIVE) {
+ if (le32toh(lstd->td.td_status) & UHCI_TD_ACTIVE) {
DPRINTFN(15, ("uhci_check_intr: active ii=%p\n", ii));
for (std = ii->stdstart; std != lstd; std = std->link.std) {
- status = LE(std->td.td_status);
+ status = le32toh(std->td.td_status);
/* If there's an active TD the xfer isn't done. */
if (status & UHCI_TD_ACTIVE)
break;
@@ -1042,7 +1047,7 @@ uhci_check_intr(uhci_softc_t *sc, uhci_intr_info_t *ii)
*/
if ((status & UHCI_TD_SPD) &&
UHCI_TD_GET_ACTLEN(status) <
- UHCI_TD_GET_MAXLEN(LE(std->td.td_token)))
+ UHCI_TD_GET_MAXLEN(le32toh(std->td.td_token)))
goto done;
}
DPRINTFN(15, ("uhci_check_intr: ii=%p std=%p still active\n",
@@ -1104,7 +1109,7 @@ uhci_idone(uhci_intr_info_t *ii)
#endif
if (++n >= UHCI_VFRAMELIST_COUNT)
n = 0;
- status = LE(std->td.td_status);
+ status = le32toh(std->td.td_status);
actlen += UHCI_TD_GET_ACTLEN(status);
}
upipe->u.iso.inuse -= nframes;
@@ -1125,17 +1130,18 @@ uhci_idone(uhci_intr_info_t *ii)
/* The transfer is done, compute actual length and status. */
actlen = 0;
for (std = ii->stdstart; std != NULL; std = std->link.std) {
- nstatus = LE(std->td.td_status);
+ nstatus = le32toh(std->td.td_status);
if (nstatus & UHCI_TD_ACTIVE)
break;
status = nstatus;
- if (UHCI_TD_GET_PID(LE(std->td.td_token)) != UHCI_TD_PID_SETUP)
+ if (UHCI_TD_GET_PID(le32toh(std->td.td_token)) !=
+ UHCI_TD_PID_SETUP)
actlen += UHCI_TD_GET_ACTLEN(status);
}
/* If there are left over TDs we need to update the toggle. */
if (std != NULL)
- upipe->nexttoggle = UHCI_TD_GET_DT(LE(std->td.td_token));
+ upipe->nexttoggle = UHCI_TD_GET_DT(le32toh(std->td.td_token));
status &= UHCI_TD_ERROR;
DPRINTFN(10, ("uhci_check_intr: actlen=%d, status=0x%x\n",
@@ -1321,11 +1327,11 @@ uhci_free_std(uhci_softc_t *sc, uhci_soft_td_t *std)
{
#ifdef DIAGNOSTIC
#define TD_IS_FREE 0x12345678
- if (std->td.td_token == LE(TD_IS_FREE)) {
+ if (le32toh(std->td.td_token) == TD_IS_FREE) {
printf("uhci_free_std: freeing free TD %p\n", std);
return;
}
- std->td.td_token = LE(TD_IS_FREE);
+ std->td.td_token = htole32(TD_IS_FREE);
#endif
std->link.std = sc->sc_freetds;
sc->sc_freetds = std;
@@ -1440,12 +1446,12 @@ uhci_alloc_std_chain(struct uhci_pipe *upipe, uhci_softc_t *sc,
}
p->link.std = lastp;
if (lastlink == UHCI_PTR_T)
- p->td.td_link = LE(lastlink);
+ p->td.td_link = htole32(lastlink);
else
- p->td.td_link = LE(lastlink|UHCI_PTR_VF);
+ p->td.td_link = htole32(lastlink|UHCI_PTR_VF);
lastp = p;
lastlink = p->physaddr;
- p->td.td_status = LE(status);
+ p->td.td_status = htole32(status);
if (i == ntd) {
/* last TD */
l = len % maxp;
@@ -1455,9 +1461,9 @@ uhci_alloc_std_chain(struct uhci_pipe *upipe, uhci_softc_t *sc,
} else
l = maxp;
p->td.td_token =
- LE(rd ? UHCI_TD_IN (l, endpt, addr, tog) :
+ htole32(rd ? UHCI_TD_IN (l, endpt, addr, tog) :
UHCI_TD_OUT(l, endpt, addr, tog));
- p->td.td_buffer = LE(DMAADDR(dma, i * maxp));
+ p->td.td_buffer = htole32(DMAADDR(dma, i * maxp));
tog ^= 1;
}
*sp = lastp;
@@ -1527,7 +1533,7 @@ uhci_device_bulk_start(usbd_xfer_handle xfer)
&xfer->dmabuf, &data, &dataend);
if (err)
return (err);
- dataend->td.td_status |= LE(UHCI_TD_IOC);
+ dataend->td.td_status |= htole32(UHCI_TD_IOC);
#ifdef UHCI_DEBUG
if (uhcidebug > 8) {
@@ -1551,7 +1557,7 @@ uhci_device_bulk_start(usbd_xfer_handle xfer)
#endif
sqh->elink = data;
- sqh->qh.qh_elink = LE(data->physaddr);
+ sqh->qh.qh_elink = htole32(data->physaddr);
sqh->intr_info = ii;
s = splusb();
@@ -1602,7 +1608,7 @@ uhci_abort_xfer(usbd_xfer_handle xfer, usbd_status status)
/* make hardware ignore it, */
for (std = ii->stdstart; std != 0; std = std->link.std)
- std->td.td_status &= LE(~(UHCI_TD_ACTIVE | UHCI_TD_IOC));
+ std->td.td_status &= htole32(~(UHCI_TD_ACTIVE | UHCI_TD_IOC));
xfer->hcpriv = ii;
@@ -1726,7 +1732,7 @@ uhci_device_intr_start(usbd_xfer_handle xfer)
&xfer->dmabuf, &data, &dataend);
if (err)
return (err);
- dataend->td.td_status |= LE(UHCI_TD_IOC);
+ dataend->td.td_status |= htole32(UHCI_TD_IOC);
#ifdef UHCI_DEBUG
if (uhcidebug > 10) {
@@ -1756,7 +1762,7 @@ uhci_device_intr_start(usbd_xfer_handle xfer)
for (i = 0; i < upipe->u.intr.npoll; i++) {
sqh = upipe->u.intr.qhs[i];
sqh->elink = data;
- sqh->qh.qh_elink = LE(data->physaddr);
+ sqh->qh.qh_elink = htole32(data->physaddr);
}
splx(s);
@@ -1878,7 +1884,7 @@ uhci_device_request(usbd_xfer_handle xfer)
return (err);
next = data;
dataend->link.std = stat;
- dataend->td.td_link = LE(stat->physaddr | UHCI_PTR_VF);
+ dataend->td.td_link = htole32(stat->physaddr | UHCI_PTR_VF);
} else {
next = stat;
}
@@ -1887,19 +1893,20 @@ uhci_device_request(usbd_xfer_handle xfer)
memcpy(KERNADDR(&upipe->u.ctl.reqdma, 0), req, sizeof *req);
setup->link.std = next;
- setup->td.td_link = LE(next->physaddr | UHCI_PTR_VF);
- setup->td.td_status = LE(UHCI_TD_SET_ERRCNT(3) | ls | UHCI_TD_ACTIVE);
- setup->td.td_token = LE(UHCI_TD_SETUP(sizeof *req, endpt, addr));
- setup->td.td_buffer = LE(DMAADDR(&upipe->u.ctl.reqdma, 0));
+ setup->td.td_link = htole32(next->physaddr | UHCI_PTR_VF);
+ setup->td.td_status = htole32(UHCI_TD_SET_ERRCNT(3) | ls |
+ UHCI_TD_ACTIVE);
+ setup->td.td_token = htole32(UHCI_TD_SETUP(sizeof *req, endpt, addr));
+ setup->td.td_buffer = htole32(DMAADDR(&upipe->u.ctl.reqdma, 0));
stat->link.std = 0;
- stat->td.td_link = LE(UHCI_PTR_T);
- stat->td.td_status = LE(UHCI_TD_SET_ERRCNT(3) | ls |
+ stat->td.td_link = htole32(UHCI_PTR_T);
+ stat->td.td_status = htole32(UHCI_TD_SET_ERRCNT(3) | ls |
UHCI_TD_ACTIVE | UHCI_TD_IOC);
stat->td.td_token =
- LE(isread ? UHCI_TD_OUT(0, endpt, addr, 1) :
+ htole32(isread ? UHCI_TD_OUT(0, endpt, addr, 1) :
UHCI_TD_IN (0, endpt, addr, 1));
- stat->td.td_buffer = LE(0);
+ stat->td.td_buffer = htole32(0);
#ifdef UHCI_DEBUG
if (uhcidebug > 10) {
@@ -1923,7 +1930,7 @@ uhci_device_request(usbd_xfer_handle xfer)
#endif
sqh->elink = setup;
- sqh->qh.qh_elink = LE(setup->physaddr);
+ sqh->qh.qh_elink = htole32(setup->physaddr);
sqh->intr_info = ii;
s = splusb();
@@ -1940,7 +1947,7 @@ uhci_device_request(usbd_xfer_handle xfer)
for (std = sc->sc_vframes[0].htd, link = 0;
(link & UHCI_PTR_Q) == 0;
std = std->link.std) {
- link = LE(std->td.td_link);
+ link = le32toh(std->td.td_link);
uhci_dump_td(std);
}
sxqh = (uhci_soft_qh_t *)std;
@@ -2027,9 +2034,9 @@ uhci_device_isoc_enter(usbd_xfer_handle xfer)
xfer->hcprivint = next;
buf = DMAADDR(&xfer->dmabuf, 0);
- status = LE(UHCI_TD_ZERO_ACTLEN(UHCI_TD_SET_ERRCNT(0) |
- UHCI_TD_ACTIVE |
- UHCI_TD_IOS));
+ status = UHCI_TD_ZERO_ACTLEN(UHCI_TD_SET_ERRCNT(0) |
+ UHCI_TD_ACTIVE |
+ UHCI_TD_IOS);
nframes = xfer->nframes;
s = splusb();
for (i = 0; i < nframes; i++) {
@@ -2037,12 +2044,12 @@ uhci_device_isoc_enter(usbd_xfer_handle xfer)
if (++next >= UHCI_VFRAMELIST_COUNT)
next = 0;
len = xfer->frlengths[i];
- std->td.td_buffer = LE(buf);
+ std->td.td_buffer = htole32(buf);
if (i == nframes - 1)
- status |= LE(UHCI_TD_IOC);
- std->td.td_status = status;
- std->td.td_token &= LE(~UHCI_TD_MAXLEN_MASK);
- std->td.td_token |= LE(UHCI_TD_SET_MAXLEN(len));
+ status |= UHCI_TD_IOC;
+ std->td.td_status = htole32(status);
+ std->td.td_token &= htole32(~UHCI_TD_MAXLEN_MASK);
+ std->td.td_token |= htole32(UHCI_TD_SET_MAXLEN(len));
#ifdef UHCI_DEBUG
if (uhcidebug > 5) {
DPRINTFN(5,("uhci_device_isoc_enter: TD %d\n", i));
@@ -2116,7 +2123,7 @@ uhci_device_isoc_abort(usbd_xfer_handle xfer)
n = xfer->hcprivint;
for (i = 0; i < nframes; i++) {
std = stds[n];
- std->td.td_status &= LE(~(UHCI_TD_ACTIVE | UHCI_TD_IOC));
+ std->td.td_status &= htole32(~(UHCI_TD_ACTIVE | UHCI_TD_IOC));
if (++n >= UHCI_VFRAMELIST_COUNT)
n = 0;
}
@@ -2153,7 +2160,7 @@ uhci_device_isoc_close(usbd_pipe_handle pipe)
iso = &upipe->u.iso;
for (i = 0; i < UHCI_VFRAMELIST_COUNT; i++)
- iso->stds[i]->td.td_status &= LE(~UHCI_TD_ACTIVE);
+ iso->stds[i]->td.td_status &= htole32(~UHCI_TD_ACTIVE);
usb_delay_ms(&sc->sc_bus, 2); /* wait for completion */
uhci_lock_frames(sc);
@@ -2196,16 +2203,16 @@ uhci_setup_isoc(usbd_pipe_handle pipe)
iso->stds = malloc(UHCI_VFRAMELIST_COUNT * sizeof (uhci_soft_td_t *),
M_USBHC, M_WAITOK);
- token = LE(rd ? UHCI_TD_IN (0, endpt, addr, 0) :
- UHCI_TD_OUT(0, endpt, addr, 0));
+ token = rd ? UHCI_TD_IN (0, endpt, addr, 0) :
+ UHCI_TD_OUT(0, endpt, addr, 0);
/* Allocate the TDs and mark as inactive; */
for (i = 0; i < UHCI_VFRAMELIST_COUNT; i++) {
std = uhci_alloc_std(sc);
if (std == 0)
goto bad;
- std->td.td_status = LE(UHCI_TD_IOS); /* iso, inactive */
- std->td.td_token = token;
+ std->td.td_status = htole32(UHCI_TD_IOS); /* iso, inactive */
+ std->td.td_token = htole32(token);
iso->stds[i] = std;
}
@@ -2217,7 +2224,7 @@ uhci_setup_isoc(usbd_pipe_handle pipe)
std->link = vstd->link;
std->td.td_link = vstd->td.td_link;
vstd->link.std = std;
- vstd->td.td_link = LE(std->physaddr);
+ vstd->td.td_link = htole32(std->physaddr);
}
uhci_unlock_frames(sc);
@@ -2241,7 +2248,7 @@ uhci_device_isoc_done(usbd_xfer_handle xfer)
DPRINTFN(4, ("uhci_isoc_done: length=%d\n", xfer->actlen));
/* Turn off the interrupt since it is active even if the TD is not. */
- ii->stdend->td.td_status &= LE(~UHCI_TD_IOC);
+ ii->stdend->td.td_status &= htole32(~UHCI_TD_IOC);
LIST_REMOVE(ii, list); /* remove from active list */
}
@@ -2261,7 +2268,7 @@ uhci_device_intr_done(usbd_xfer_handle xfer)
for(i = 0; i < npoll; i++) {
sqh = upipe->u.intr.qhs[i];
sqh->elink = 0;
- sqh->qh.qh_elink = LE(UHCI_PTR_T);
+ sqh->qh.qh_elink = htole32(UHCI_PTR_T);
}
uhci_free_std_chain(sc, ii->stdstart, 0);
@@ -2272,7 +2279,7 @@ uhci_device_intr_done(usbd_xfer_handle xfer)
/* This alloc cannot fail since we freed the chain above. */
uhci_alloc_std_chain(upipe, sc, xfer->length, 1, xfer->flags,
&xfer->dmabuf, &data, &dataend);
- dataend->td.td_status |= LE(UHCI_TD_IOC);
+ dataend->td.td_status |= htole32(UHCI_TD_IOC);
#ifdef UHCI_DEBUG
if (uhcidebug > 10) {
@@ -2296,7 +2303,7 @@ uhci_device_intr_done(usbd_xfer_handle xfer)
for (i = 0; i < npoll; i++) {
sqh = upipe->u.intr.qhs[i];
sqh->elink = data;
- sqh->qh.qh_elink = LE(data->physaddr);
+ sqh->qh.qh_elink = htole32(data->physaddr);
}
} else {
ii->stdstart = 0; /* mark as inactive */
@@ -2355,7 +2362,7 @@ uhci_add_intr(uhci_softc_t *sc, int n, uhci_soft_qh_t *sqh)
sqh->hlink = eqh->hlink;
sqh->qh.qh_hlink = eqh->qh.qh_hlink;
eqh->hlink = sqh;
- eqh->qh.qh_hlink = LE(sqh->physaddr | UHCI_PTR_Q);
+ eqh->qh.qh_hlink = htole32(sqh->physaddr | UHCI_PTR_Q);
vf->eqh = sqh;
vf->bandwidth++;
}
@@ -2371,7 +2378,7 @@ uhci_remove_intr(uhci_softc_t *sc, int n, uhci_soft_qh_t *sqh)
for (pqh = vf->hqh; pqh->hlink != sqh; pqh = pqh->hlink)
#if defined(DIAGNOSTIC) || defined(UHCI_DEBUG)
- if (LE(pqh->qh.qh_hlink) & UHCI_PTR_T) {
+ if (le32toh(pqh->qh.qh_hlink) & UHCI_PTR_T) {
DPRINTF(("uhci_remove_intr: QH not found\n"));
return;
}
@@ -2426,7 +2433,7 @@ uhci_device_setintr(uhci_softc_t *sc, struct uhci_pipe *upipe, int ival)
for(i = 0; i < npoll; i++) {
upipe->u.intr.qhs[i] = sqh = uhci_alloc_sqh(sc);
sqh->elink = 0;
- sqh->qh.qh_elink = LE(UHCI_PTR_T);
+ sqh->qh.qh_elink = htole32(UHCI_PTR_T);
sqh->pos = MOD(i * ival + bestoffs);
sqh->intr_info = upipe->iinfo;
}
OpenPOWER on IntegriCloud