From df85339a5d0f61f8da868668f60c6c049875f9fa Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 10 Jul 2004 13:08:42 +0000 Subject: from loki@animata.net: this is netbsds fix for the endian problems they had with the data toggle change. do the swap when the var is assigned to the qtd, rather than swap everything that is assigned to the var and just assign the var. instead of 4 or so htole32s we now do 1. from netbsd, ehci.c 1.67 (i made a mistake, the last patch i gave you was from 1.68) log message: Fix a byte order error. --- sys/dev/usb/ehci.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'sys/dev/usb') diff --git a/sys/dev/usb/ehci.c b/sys/dev/usb/ehci.c index e0a47910ce4..c3640ee0293 100644 --- a/sys/dev/usb/ehci.c +++ b/sys/dev/usb/ehci.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ehci.c,v 1.17 2004/07/10 12:25:49 deraadt Exp $ */ +/* $OpenBSD: ehci.c,v 1.18 2004/07/10 13:08:41 deraadt Exp $ */ /* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */ /* @@ -2126,16 +2126,12 @@ ehci_alloc_sqtd_chain(struct ehci_pipe *epipe, ehci_softc_t *sc, len = alen; dataphys = DMAADDR(dma, 0); dataphyslastpage = EHCI_PAGE(dataphys + len - 1); - qtdstatus = htole32( - EHCI_QTD_ACTIVE | + qtdstatus = EHCI_QTD_ACTIVE | EHCI_QTD_SET_PID(rd ? EHCI_QTD_PID_IN : EHCI_QTD_PID_OUT) | - EHCI_QTD_SET_CERR(3) - /* IOC set below */ - /* BYTES set below */ - ); + EHCI_QTD_SET_CERR(3); /* IOC set below and BYTES set below */ mps = UGETW(epipe->pipe.endpoint->edesc->wMaxPacketSize); tog = epipe->nexttoggle; - qtdstatus |= htole32(EHCI_QTD_SET_TOGGLE(tog)); + qtdstatus |= EHCI_QTD_SET_TOGGLE(tog); cur = ehci_alloc_sqtd(sc); *sp = cur; @@ -2203,8 +2199,8 @@ ehci_alloc_sqtd_chain(struct ehci_pipe *epipe, ehci_softc_t *sc, } cur->nextqtd = next; cur->qtd.qtd_next = cur->qtd.qtd_altnext = nextphys; - cur->qtd.qtd_status = - qtdstatus | htole32(EHCI_QTD_SET_BYTES(curlen)); + cur->qtd.qtd_status = htole32(qtdstatus | + EHCI_QTD_SET_BYTES(curlen)); cur->xfer = xfer; cur->len = curlen; DPRINTFN(10,("ehci_alloc_sqtd_chain: cbp=0x%08x end=0x%08x\n", @@ -2213,7 +2209,7 @@ ehci_alloc_sqtd_chain(struct ehci_pipe *epipe, ehci_softc_t *sc, qtd */ if (((curlen + mps - 1) / mps) & 1) { tog ^= 1; - qtdstatus ^= htole32(EHCI_QTD_TOGGLE_MASK); + qtdstatus ^= EHCI_QTD_TOGGLE_MASK; } if (len == 0) break; -- cgit v1.2.3