diff options
author | joe <joe@FreeBSD.org> | 2001-12-30 23:02:31 +0000 |
---|---|---|
committer | joe <joe@FreeBSD.org> | 2001-12-30 23:02:31 +0000 |
commit | fedd0e40cedf1b9b7c7b7c553cadab44aa8cf2ee (patch) | |
tree | 0f63cf1c1f0a171f7acb8eec3b9b2cb77b8b7aac /sys/dev/usb/ohci.c | |
parent | 18ea14531f8f3ebbed2bebd7105b117847189e9f (diff) | |
download | FreeBSD-src-fedd0e40cedf1b9b7c7b7c553cadab44aa8cf2ee.zip FreeBSD-src-fedd0e40cedf1b9b7c7b7c553cadab44aa8cf2ee.tar.gz |
Partial sync with NetBSD:
Replace LE() macro with htole32()/le32toh().
Diffstat (limited to 'sys/dev/usb/ohci.c')
-rw-r--r-- | sys/dev/usb/ohci.c | 214 |
1 files changed, 112 insertions, 102 deletions
diff --git a/sys/dev/usb/ohci.c b/sys/dev/usb/ohci.c index 14d8f3a..42baeb9 100644 --- a/sys/dev/usb/ohci.c +++ b/sys/dev/usb/ohci.c @@ -100,10 +100,14 @@ int ohcidebug = 1; * The OHCI 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 ohci_pipe; @@ -532,11 +536,11 @@ ohci_alloc_std_chain(opipe, sc, len, rd, flags, dma, std, rstd) len -= curlen; intr = len == 0 ? OHCI_TD_SET_DI(1) : OHCI_TD_NOINTR; - cur->td.td_flags = LE(tdflags | intr); - cur->td.td_cbp = LE(dataphys); + cur->td.td_flags = htole32(tdflags | intr); + cur->td.td_cbp = htole32(dataphys); cur->nexttd = next; - cur->td.td_nexttd = LE(next->physaddr); - cur->td.td_be = LE(dataphys + curlen - 1); + cur->td.td_nexttd = htole32(next->physaddr); + cur->td.td_be = htole32(dataphys + curlen - 1); cur->len = curlen; cur->flags = OHCI_ADD_LEN; DPRINTFN(10,("ohci_alloc_std_chain: cbp=0x%08x be=0x%08x\n", @@ -554,11 +558,11 @@ ohci_alloc_std_chain(opipe, sc, len, rd, flags, dma, std, rstd) if (next == 0) goto nomem; - cur->td.td_flags = LE(tdflags | OHCI_TD_SET_DI(1)); + cur->td.td_flags = htole32(tdflags | OHCI_TD_SET_DI(1)); cur->td.td_cbp = 0; /* indicate 0 length packet */ cur->nexttd = next; - cur->td.td_nexttd = LE(next->physaddr); - cur->td.td_be = LE(dataphys - 1); + cur->td.td_nexttd = htole32(next->physaddr); + cur->td.td_be = htole32(dataphys - 1); cur->len = 0; cur->flags = 0; cur = next; @@ -677,7 +681,7 @@ ohci_init(sc) err = USBD_NOMEM; goto bad1; } - sc->sc_ctrl_head->ed.ed_flags |= LE(OHCI_ED_SKIP); + sc->sc_ctrl_head->ed.ed_flags |= htole32(OHCI_ED_SKIP); /* Allocate dummy ED that starts the bulk list. */ sc->sc_bulk_head = ohci_alloc_sed(sc); @@ -685,7 +689,7 @@ ohci_init(sc) err = USBD_NOMEM; goto bad2; } - sc->sc_bulk_head->ed.ed_flags |= LE(OHCI_ED_SKIP); + sc->sc_bulk_head->ed.ed_flags |= htole32(OHCI_ED_SKIP); /* Allocate dummy ED that starts the isochronous list. */ sc->sc_isoc_head = ohci_alloc_sed(sc); @@ -693,7 +697,7 @@ ohci_init(sc) err = USBD_NOMEM; goto bad3; } - sc->sc_isoc_head->ed.ed_flags |= LE(OHCI_ED_SKIP); + sc->sc_isoc_head->ed.ed_flags |= htole32(OHCI_ED_SKIP); /* Allocate all the dummy EDs that make up the interrupt tree. */ for (i = 0; i < OHCI_NO_EDS; i++) { @@ -706,13 +710,13 @@ ohci_init(sc) } /* All ED fields are set to 0. */ sc->sc_eds[i] = sed; - sed->ed.ed_flags |= LE(OHCI_ED_SKIP); + sed->ed.ed_flags |= htole32(OHCI_ED_SKIP); if (i != 0) psed = sc->sc_eds[(i-1) / 2]; else psed= sc->sc_isoc_head; sed->next = psed; - sed->ed.ed_nexted = LE(psed->physaddr); + sed->ed.ed_nexted = htole32(psed->physaddr); } /* * Fill HCCA interrupt table. The bit reversal is to get @@ -720,7 +724,7 @@ ohci_init(sc) */ for (i = 0; i < OHCI_NO_INTRS; i++) sc->sc_hcca->hcca_interrupt_table[revbits[i]] = - LE(sc->sc_eds[OHCI_NO_EDS-OHCI_NO_INTRS+i]->physaddr); + htole32(sc->sc_eds[OHCI_NO_EDS-OHCI_NO_INTRS+i]->physaddr); /* Determine in what context we are running. */ ctl = OREAD4(sc, OHCI_CONTROL); @@ -969,8 +973,8 @@ ohci_dumpregs(sc) OREAD4(sc, OHCI_RH_PORT_STATUS(1)), OREAD4(sc, OHCI_RH_PORT_STATUS(2)))); DPRINTF((" HCCA: frame_number=0x%04x done_head=0x%08x\n", - LE(sc->sc_hcca->hcca_frame_number), - LE(sc->sc_hcca->hcca_done_head))); + le32toh(sc->sc_hcca->hcca_frame_number), + le32toh(sc->sc_hcca->hcca_done_head))); } #endif @@ -1009,7 +1013,7 @@ ohci_intr1(sc) } intrs = 0; - done = LE(sc->sc_hcca->hcca_done_head); + done = le32toh(sc->sc_hcca->hcca_done_head); /* The LSb of done is used to inform the HC Driver that an interrupt * condition exists for both the Done list and for another event @@ -1141,8 +1145,8 @@ ohci_process_done(sc, done) /* Reverse the done list and store the reversed list in sdone */ sdone = NULL; - for (; done; done = LE(std->td.td_nexttd)) { - std = ohci_hash_find_td(sc, done & LE(OHCI_TAILMASK)); + for (; done; done = le32toh(std->td.td_nexttd)) { + std = ohci_hash_find_td(sc, done & htole32(OHCI_TAILMASK)); if (std == NULL) { #ifdef OHCI_DEBUG DPRINTF(("%s: Invalid done queue 0x%08x", @@ -1183,7 +1187,7 @@ ohci_process_done(sc, done) */ continue; } - cc = OHCI_TD_GET_CC(LE(std->td.td_flags)); + cc = OHCI_TD_GET_CC(le32toh(std->td.td_flags)); usb_untimeout(ohci_timeout, xfer, xfer->timo_handle); if (xfer->status == USBD_CANCELLED || xfer->status == USBD_TIMEOUT) { @@ -1195,8 +1199,8 @@ ohci_process_done(sc, done) xfer)); len = std->len; if (std->td.td_cbp != 0) - len -= LE(std->td.td_be) - - LE(std->td.td_cbp) + 1; + len -= le32toh(std->td.td_be) - + le32toh(std->td.td_cbp) + 1; if (std->flags & OHCI_ADD_LEN) xfer->actlen += len; if (std->flags & OHCI_CALL_DONE) { @@ -1215,8 +1219,8 @@ ohci_process_done(sc, done) (struct ohci_pipe *)xfer->pipe; DPRINTF(("ohci_process_done: err cc=%d (%s), xfer=%p\n", - OHCI_TD_GET_CC(LE(std->td.td_flags)), - ohci_cc_strs[OHCI_TD_GET_CC(LE(std->td.td_flags))], + OHCI_TD_GET_CC(le32toh(std->td.td_flags)), + ohci_cc_strs[OHCI_TD_GET_CC(le32toh(std->td.td_flags))], xfer)); /* Mark all the TDs in the done queue for the current @@ -1232,7 +1236,7 @@ ohci_process_done(sc, done) n = p->nexttd; ohci_free_std(sc, p); } - opipe->sed->ed.ed_headp = LE(p->physaddr); + opipe->sed->ed.ed_headp = htole32(p->physaddr); /* XXX why is this being done? Why not OHCI_BLF too */ OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_CLF); @@ -1285,15 +1289,15 @@ ohci_device_intr_done(xfer) } tail->xfer = NULL; - data->td.td_flags = LE( + data->td.td_flags = htole32( OHCI_TD_IN | OHCI_TD_NOCC | OHCI_TD_SET_DI(1) | OHCI_TD_TOGGLE_CARRY); if (xfer->flags & USBD_SHORT_XFER_OK) - data->td.td_flags |= LE(OHCI_TD_R); - data->td.td_cbp = LE(DMAADDR(&xfer->dmabuf, 0)); + data->td.td_flags |= htole32(OHCI_TD_R); + data->td.td_cbp = htole32(DMAADDR(&xfer->dmabuf, 0)); data->nexttd = tail; - data->td.td_nexttd = LE(tail->physaddr); - data->td.td_be = LE(LE(data->td.td_cbp) + xfer->length - 1); + data->td.td_nexttd = htole32(tail->physaddr); + data->td.td_be = htole32(htole32(data->td.td_cbp) + xfer->length - 1); data->len = xfer->length; data->xfer = xfer; data->flags = OHCI_CALL_DONE | OHCI_ADD_LEN; @@ -1301,7 +1305,7 @@ ohci_device_intr_done(xfer) xfer->actlen = 0; ohci_hash_add_td(sc, data); - sed->ed.ed_tailp = LE(tail->physaddr); + sed->ed.ed_tailp = htole32(tail->physaddr); opipe->tail.td = tail; } } @@ -1453,8 +1457,8 @@ ohci_device_request(xfer) /* Update device address and length since they may have changed. */ /* XXX This only needs to be done once, but it's too early in open. */ - sed->ed.ed_flags = LE( - (LE(sed->ed.ed_flags) & ~(OHCI_ED_ADDRMASK | OHCI_ED_MAXPMASK)) | + sed->ed.ed_flags = htole32( + (le32toh(sed->ed.ed_flags) & ~(OHCI_ED_ADDRMASK | OHCI_ED_MAXPMASK)) | OHCI_ED_SET_FA(addr) | OHCI_ED_SET_MAXP(UGETW(opipe->pipe.endpoint->edesc->wMaxPacketSize))); @@ -1465,14 +1469,14 @@ ohci_device_request(xfer) err = USBD_NOMEM; goto bad3; } - data->td.td_flags = LE( + data->td.td_flags = htole32( (isread ? OHCI_TD_IN : OHCI_TD_OUT) | OHCI_TD_NOCC | OHCI_TD_TOGGLE_1 | OHCI_TD_NOINTR | (xfer->flags & USBD_SHORT_XFER_OK ? OHCI_TD_R : 0)); - data->td.td_cbp = LE(DMAADDR(&xfer->dmabuf, 0)); + data->td.td_cbp = htole32(DMAADDR(&xfer->dmabuf, 0)); data->nexttd = stat; - data->td.td_nexttd = LE(stat->physaddr); - data->td.td_be = LE(LE(data->td.td_cbp) + len - 1); + data->td.td_nexttd = htole32(stat->physaddr); + data->td.td_be = htole32(le32toh(data->td.td_cbp) + len - 1); data->len = len; data->xfer = xfer; data->flags = OHCI_ADD_LEN; @@ -1487,23 +1491,23 @@ ohci_device_request(xfer) memcpy(KERNADDR(&opipe->u.ctl.reqdma, 0), req, sizeof *req); - setup->td.td_flags = LE(OHCI_TD_SETUP | OHCI_TD_NOCC | + setup->td.td_flags = htole32(OHCI_TD_SETUP | OHCI_TD_NOCC | OHCI_TD_TOGGLE_0 | OHCI_TD_NOINTR); - setup->td.td_cbp = LE(DMAADDR(&opipe->u.ctl.reqdma, 0)); + setup->td.td_cbp = htole32(DMAADDR(&opipe->u.ctl.reqdma, 0)); setup->nexttd = next; - setup->td.td_nexttd = LE(next->physaddr); - setup->td.td_be = LE(LE(setup->td.td_cbp) + sizeof *req - 1); + setup->td.td_nexttd = htole32(next->physaddr); + setup->td.td_be = htole32(le32toh(setup->td.td_cbp) + sizeof *req - 1); setup->len = 0; /* XXX The number of byte we count */ setup->xfer = xfer; setup->flags = 0; xfer->hcpriv = setup; - stat->td.td_flags = LE( + stat->td.td_flags = htole32( (isread ? OHCI_TD_OUT : OHCI_TD_IN) | OHCI_TD_NOCC | OHCI_TD_TOGGLE_1 | OHCI_TD_SET_DI(1)); stat->td.td_cbp = 0; stat->nexttd = tail; - stat->td.td_nexttd = LE(tail->physaddr); + stat->td.td_nexttd = htole32(tail->physaddr); stat->td.td_be = 0; stat->len = 0; stat->xfer = xfer; @@ -1518,7 +1522,7 @@ ohci_device_request(xfer) /* Insert ED in schedule */ s = splusb(); - sed->ed.ed_tailp = LE(tail->physaddr); + sed->ed.ed_tailp = htole32(tail->physaddr); opipe->tail.td = tail; OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_CLF); if (xfer->timeout && !sc->sc_bus.use_polling) { @@ -1559,7 +1563,7 @@ ohci_add_ed(sed, head) sed->next = head->next; sed->ed.ed_nexted = head->ed.ed_nexted; head->next = sed; - head->ed.ed_nexted = LE(sed->physaddr); + head->ed.ed_nexted = htole32(sed->physaddr); } /* @@ -1676,13 +1680,14 @@ ohci_dump_td(std) DPRINTF(("TD(%p) at %08lx: %b delay=%d ec=%d cc=%d\ncbp=0x%08lx " "nexttd=0x%08lx be=0x%08lx\n", std, (u_long)std->physaddr, - (int)LE(std->td.td_flags), + (int)le32toh(std->td.td_flags), "\20\23R\24OUT\25IN\31TOG1\32SETTOGGLE", - OHCI_TD_GET_DI(LE(std->td.td_flags)), - OHCI_TD_GET_EC(LE(std->td.td_flags)), - OHCI_TD_GET_CC(LE(std->td.td_flags)), - (u_long)LE(std->td.td_cbp), - (u_long)LE(std->td.td_nexttd), (u_long)LE(std->td.td_be))); + OHCI_TD_GET_DI(le32toh(std->td.td_flags)), + OHCI_TD_GET_EC(le32toh(std->td.td_flags)), + OHCI_TD_GET_CC(le32toh(std->td.td_flags)), + (u_long)le32toh(std->td.td_cbp), + (u_long)le32toh(std->td.td_nexttd), + (u_long)le32toh(std->td.td_be))); } void @@ -1692,16 +1697,16 @@ ohci_dump_ed(sed) DPRINTF(("ED(%p) at %08lx: addr=%d endpt=%d maxp=%d %b\n" "tailp=0x%8b headp=0x%8b nexted=0x%08lx\n", sed, (u_long)sed->physaddr, - OHCI_ED_GET_FA(LE(sed->ed.ed_flags)), - OHCI_ED_GET_EN(LE(sed->ed.ed_flags)), - OHCI_ED_GET_MAXP(LE(sed->ed.ed_flags)), - (int)LE(sed->ed.ed_flags), + OHCI_ED_GET_FA(le32toh(sed->ed.ed_flags)), + OHCI_ED_GET_EN(le32toh(sed->ed.ed_flags)), + OHCI_ED_GET_MAXP(le32toh(sed->ed.ed_flags)), + (int)le32toh(sed->ed.ed_flags), "\20\14OUT\15IN\16LOWSPEED\17SKIP\20ISO", - (int)(uintptr_t)LE(sed->ed.ed_tailp), + (int)(uintptr_t)le32toh(sed->ed.ed_tailp), "\20\1BIT1\2BIT2", - (int)(uintptr_t)LE(sed->ed.ed_headp), + (int)(uintptr_t)le32toh(sed->ed.ed_headp), "\20\1HALT\2CARRY", - (u_long)LE(sed->ed.ed_nexted))); + (u_long)le32toh(sed->ed.ed_nexted))); } #endif @@ -1749,7 +1754,7 @@ ohci_open(pipe) goto bad1; } opipe->tail.itd = sitd; - tdphys = LE(sitd->physaddr); + tdphys = sitd->physaddr; fmt = OHCI_ED_FORMAT_ISO; } else { std = ohci_alloc_std(sc); @@ -1758,16 +1763,16 @@ ohci_open(pipe) goto bad1; } opipe->tail.td = std; - tdphys = LE(std->physaddr); + tdphys = std->physaddr; fmt = OHCI_ED_FORMAT_GEN; } - sed->ed.ed_flags = LE( + sed->ed.ed_flags = htole32( OHCI_ED_SET_FA(addr) | OHCI_ED_SET_EN(ed->bEndpointAddress) | OHCI_ED_DIR_TD | (dev->lowspeed ? OHCI_ED_SPEED : 0) | fmt | OHCI_ED_SET_MAXP(UGETW(ed->wMaxPacketSize))); - sed->ed.ed_headp = sed->ed.ed_tailp = tdphys; + sed->ed.ed_headp = sed->ed.ed_tailp = htole32(tdphys); switch (xfertype) { case UE_CONTROL: @@ -1825,9 +1830,9 @@ ohci_close_pipe(pipe, head) s = splusb(); #ifdef DIAGNOSTIC - sed->ed.ed_flags |= LE(OHCI_ED_SKIP); - if ((sed->ed.ed_tailp & LE(OHCI_TAILMASK)) - != (sed->ed.ed_headp & LE(OHCI_HEADMASK))) { + sed->ed.ed_flags |= htole32(OHCI_ED_SKIP); + if ((le32toh(sed->ed.ed_tailp) & OHCI_TAILMASK) + != (le32toh(sed->ed.ed_headp) & OHCI_HEADMASK)) { ohci_physaddr_t td = sed->ed.ed_headp; ohci_soft_td_t *std; for (std = LIST_FIRST(&sc->sc_hash_tds[HASH(td)]); @@ -1837,11 +1842,12 @@ ohci_close_pipe(pipe, head) break; printf("ohci_close_pipe: pipe not empty sed=%p hd=0x%x " "tl=0x%x pipe=%p, std=%p\n", sed, - (int)LE(sed->ed.ed_headp), (int)LE(sed->ed.ed_tailp), + (int)le32toh(sed->ed.ed_headp), + (int)le32toh(sed->ed.ed_tailp), pipe, std); usb_delay_ms(&sc->sc_bus, 2); - if ((sed->ed.ed_tailp & LE(OHCI_TAILMASK)) - != (sed->ed.ed_headp & LE(OHCI_HEADMASK))) + if ((le32toh(sed->ed.ed_tailp) & OHCI_TAILMASK) != + (le32toh(sed->ed.ed_headp) & OHCI_HEADMASK)) printf("ohci_close_pipe: pipe still not empty\n"); } #endif @@ -1875,7 +1881,7 @@ ohci_abort_xfer(xfer, status) usb_untimeout(ohci_timeout, xfer, xfer->timo_handle); sed = opipe->sed; - sed->ed.ed_flags |= LE(OHCI_ED_SKIP); /* force hardware skip */ + sed->ed.ed_flags |= htole32(OHCI_ED_SKIP); /* force hardware skip */ #ifdef OHCI_DEBUG DPRINTFN(1,("ohci_abort_xfer: stop ed=%p\n", sed)); ohci_dump_ed(sed); @@ -1927,9 +1933,9 @@ ohci_abort_xfer_end(v) sed = opipe->sed; DPRINTFN(2,("ohci_abort_xfer: set hd=%x, tl=%x\n", - (int)LE(p->physaddr), (int)LE(sed->ed.ed_tailp))); - sed->ed.ed_headp = p->physaddr; /* unlink TDs */ - sed->ed.ed_flags &= LE(~OHCI_ED_SKIP); /* remove hardware skip */ + (int)p->physaddr, (int)le32toh(sed->ed.ed_tailp))); + sed->ed.ed_headp = htole32(p->physaddr); /* unlink TDs */ + sed->ed.ed_flags &= htole32(~OHCI_ED_SKIP); /* remove hardware skip */ usb_transfer_complete(xfer); @@ -2477,7 +2483,7 @@ ohci_device_clear_toggle(pipe) { struct ohci_pipe *opipe = (struct ohci_pipe *)pipe; - opipe->sed->ed.ed_headp &= LE(~OHCI_TOGGLECARRY); + opipe->sed->ed.ed_headp &= htole32(~OHCI_TOGGLECARRY); } Static void @@ -2535,8 +2541,8 @@ ohci_device_bulk_start(xfer) opipe->u.bulk.length = len; /* Update device address */ - sed->ed.ed_flags = LE( - (LE(sed->ed.ed_flags) & ~OHCI_ED_ADDRMASK) | + sed->ed.ed_flags = htole32( + (le32toh(sed->ed.ed_flags) & ~OHCI_ED_ADDRMASK) | OHCI_ED_SET_FA(addr)); /* Allocate a chain of new TDs (including a new tail). */ @@ -2551,8 +2557,10 @@ ohci_device_bulk_start(xfer) DPRINTFN(4,("ohci_device_bulk_start: ed_flags=0x%08x td_flags=0x%08x " "td_cbp=0x%08x td_be=0x%08x\n", - (int)LE(sed->ed.ed_flags), (int)LE(data->td.td_flags), - (int)LE(data->td.td_cbp), (int)LE(data->td.td_be))); + (int)le32toh(sed->ed.ed_flags), + (int)le32toh(data->td.td_flags), + (int)le32toh(data->td.td_cbp), + (int)le32toh(data->td.td_be))); #ifdef OHCI_DEBUG if (ohcidebug > 4) { @@ -2567,9 +2575,9 @@ ohci_device_bulk_start(xfer) tdp->xfer = xfer; ohci_hash_add_td(sc, tdp); } - sed->ed.ed_tailp = LE(tail->physaddr); + sed->ed.ed_tailp = htole32(tail->physaddr); opipe->tail.td = tail; - sed->ed.ed_flags &= LE(~OHCI_ED_SKIP); + sed->ed.ed_flags &= htole32(~OHCI_ED_SKIP); OWRITE4(sc, OHCI_COMMAND_STATUS, OHCI_BLF); if (xfer->timeout && !sc->sc_bus.use_polling) { usb_timeout(ohci_timeout, xfer, @@ -2661,15 +2669,15 @@ ohci_device_intr_start(xfer) return (USBD_NOMEM); tail->xfer = NULL; - data->td.td_flags = LE( + data->td.td_flags = htole32( OHCI_TD_IN | OHCI_TD_NOCC | OHCI_TD_SET_DI(1) | OHCI_TD_TOGGLE_CARRY); if (xfer->flags & USBD_SHORT_XFER_OK) - data->td.td_flags |= LE(OHCI_TD_R); - data->td.td_cbp = LE(DMAADDR(&xfer->dmabuf, 0)); + data->td.td_flags |= htole32(OHCI_TD_R); + data->td.td_cbp = htole32(DMAADDR(&xfer->dmabuf, 0)); data->nexttd = tail; - data->td.td_nexttd = LE(tail->physaddr); - data->td.td_be = LE(LE(data->td.td_cbp) + len - 1); + data->td.td_nexttd = htole32(tail->physaddr); + data->td.td_be = htole32(le32toh(data->td.td_cbp) + len - 1); data->len = len; data->xfer = xfer; data->flags = OHCI_CALL_DONE | OHCI_ADD_LEN; @@ -2686,9 +2694,9 @@ ohci_device_intr_start(xfer) /* Insert ED in schedule */ s = splusb(); ohci_hash_add_td(sc, data); - sed->ed.ed_tailp = LE(tail->physaddr); + sed->ed.ed_tailp = htole32(tail->physaddr); opipe->tail.td = tail; - sed->ed.ed_flags &= LE(~OHCI_ED_SKIP); + sed->ed.ed_flags &= htole32(~OHCI_ED_SKIP); #if 0 /* @@ -2737,13 +2745,13 @@ ohci_device_intr_close(pipe) DPRINTFN(1,("ohci_device_intr_close: pipe=%p nslots=%d pos=%d\n", pipe, nslots, pos)); s = splusb(); - sed->ed.ed_flags |= LE(OHCI_ED_SKIP); - if ((sed->ed.ed_tailp & LE(OHCI_TAILMASK)) - != (sed->ed.ed_headp & LE(OHCI_HEADMASK))) + sed->ed.ed_flags |= htole32(OHCI_ED_SKIP); + if ((le32toh(sed->ed.ed_tailp) & OHCI_TAILMASK) != + (le32toh(sed->ed.ed_headp) & OHCI_HEADMASK)) usb_delay_ms(&sc->sc_bus, 2); #ifdef DIAGNOSTIC - if ((sed->ed.ed_tailp & LE(OHCI_TAILMASK)) - != (sed->ed.ed_headp & LE(OHCI_HEADMASK))) + if ((le32toh(sed->ed.ed_tailp) & OHCI_TAILMASK) != + (le32toh(sed->ed.ed_headp) & OHCI_HEADMASK)) panic("%s: Intr pipe %p still has TDs queued\n", USBDEVNAME(sc->sc_bus.bdev), pipe); #endif @@ -2818,7 +2826,7 @@ ohci_device_setintr(sc, opipe, ival) sed->next = hsed->next; sed->ed.ed_nexted = hsed->ed.ed_nexted; hsed->next = sed; - hsed->ed.ed_nexted = LE(sed->physaddr); + hsed->ed.ed_nexted = htole32(sed->physaddr); splx(s); for (j = 0; j < nslots; j++) @@ -2877,7 +2885,7 @@ ohci_device_isoc_enter(xfer) s = splusb(); sitd = opipe->tail.itd; buf = DMAADDR(&xfer->dmabuf, 0); - sitd->itd.itd_bp0 = LE(buf & OHCI_ITD_PAGE_MASK); + sitd->itd.itd_bp0 = htole32(buf & OHCI_ITD_PAGE_MASK); nframes = xfer->nframes; offs = buf & OHCI_ITD_OFFSET_MASK; for (i = ncur = 0; i < nframes; i++, ncur++) { @@ -2891,14 +2899,16 @@ ohci_device_isoc_enter(xfer) return; } sitd->nextitd = nsitd; - sitd->itd.itd_nextitd = LE(nsitd->physaddr); - sitd->itd.itd_flags = LE( + sitd->itd.itd_nextitd = htole32(nsitd->physaddr); + sitd->itd.itd_flags = htole32( OHCI_ITD_NOCC | OHCI_ITD_SET_SF(iso->next) | OHCI_ITD_NOINTR | OHCI_ITD_SET_FC(OHCI_ITD_NOFFSET)); - sitd->itd.itd_be = LE(LE(sitd->itd.itd_bp0) + offs - 1); - nsitd->itd.itd_bp0 = LE((buf + offs) & OHCI_ITD_PAGE_MASK); + sitd->itd.itd_be = htole32( + le32toh(sitd->itd.itd_bp0) + offs - 1); + nsitd->itd.itd_bp0 = htole32( + (buf + offs) & OHCI_ITD_PAGE_MASK); sitd = nsitd; iso->next = iso->next + ncur; ncur = 0; @@ -2917,17 +2927,17 @@ ohci_device_isoc_enter(xfer) return; } sitd->nextitd = nsitd; - sitd->itd.itd_nextitd = LE(nsitd->physaddr); - sitd->itd.itd_flags = LE( + sitd->itd.itd_nextitd = htole32(nsitd->physaddr); + sitd->itd.itd_flags = le32toh( OHCI_ITD_NOCC | OHCI_ITD_SET_SF(iso->next) | OHCI_ITD_SET_DI(0) | OHCI_ITD_SET_FC(ncur)); - sitd->itd.itd_be = LE(LE(sitd->itd.itd_bp0) + offs - 1); + sitd->itd.itd_be = htole32(le32toh(sitd->itd.itd_bp0) + offs - 1); iso->next = iso->next + ncur; opipe->tail.itd = nsitd; - sed->ed.ed_tailp = LE(nsitd->physaddr); + sed->ed.ed_tailp = htole32(nsitd->physaddr); /* XXX update ED */ splx(s); } |