-/* $OpenBSD: ehci.c,v 1.149 2014/04/29 14:11:23 mpi Exp $ */
+/* $OpenBSD: ehci.c,v 1.150 2014/05/04 14:31:50 mpi Exp $ */
/* $NetBSD: ehci.c,v 1.66 2004/06/30 03:11:56 mycroft Exp $ */
/*
#endif
#endif
-#define EHCI_NULL htole32(EHCI_LINK_TERMINATE)
-
#define EHCI_INTR_ENDPT 1
#define ehci_add_intr_list(sc, ex) \
sc->sc_flist = KERNADDR(&sc->sc_fldma, 0);
for (i = 0; i < sc->sc_flsize; i++)
- sc->sc_flist[i] = EHCI_NULL;
+ sc->sc_flist[i] = htole32(EHCI_LINK_TERMINATE);
EOWRITE4(sc, EHCI_PERIODICLISTBASE, DMAADDR(&sc->sc_fldma, 0));
sqh = sc->sc_islots[i].sqh;
if (i == 0) {
/* The last (1ms) QH terminates. */
- sqh->qh.qh_link = EHCI_NULL;
+ sqh->qh.qh_link = htole32(EHCI_LINK_TERMINATE);
sqh->next = NULL;
} else {
/* Otherwise the next QH has half the poll interval */
}
sqh->qh.qh_endp = htole32(EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH));
sqh->qh.qh_endphub = htole32(EHCI_QH_SET_MULT(1));
- sqh->qh.qh_curqtd = EHCI_NULL;
- sqh->qh.qh_qtd.qtd_next = EHCI_NULL;
- sqh->qh.qh_qtd.qtd_altnext = EHCI_NULL;
+ sqh->qh.qh_curqtd = htole32(EHCI_LINK_TERMINATE);
+ sqh->qh.qh_qtd.qtd_next = htole32(EHCI_LINK_TERMINATE);
+ sqh->qh.qh_qtd.qtd_altnext = htole32(EHCI_LINK_TERMINATE);
sqh->qh.qh_qtd.qtd_status = htole32(EHCI_QTD_HALTED);
sqh->sqtd = NULL;
usb_syncmem(&sqh->dma, sqh->offs, sizeof(sqh->qh),
htole32(EHCI_QH_SET_EPS(EHCI_QH_SPEED_HIGH) | EHCI_QH_HRECL);
sqh->qh.qh_link =
htole32(sqh->physaddr | EHCI_LINK_QH);
- sqh->qh.qh_curqtd = EHCI_NULL;
+ sqh->qh.qh_curqtd = htole32(EHCI_LINK_TERMINATE);
sqh->prev = sqh; /*It's a circular list.. */
sqh->next = sqh;
/* Fill the overlay qTD */
- sqh->qh.qh_qtd.qtd_next = EHCI_NULL;
- sqh->qh.qh_qtd.qtd_altnext = EHCI_NULL;
+ sqh->qh.qh_qtd.qtd_next = htole32(EHCI_LINK_TERMINATE);
+ sqh->qh.qh_qtd.qtd_altnext = htole32(EHCI_LINK_TERMINATE);
sqh->qh.qh_qtd.qtd_status = htole32(EHCI_QTD_HALTED);
sqh->sqtd = NULL;
usb_syncmem(&sqh->dma, sqh->offs, sizeof(sqh->qh),
status = nstatus;
/* halt is ok if descriptor is last, and complete */
- if (sqtd->qtd.qtd_next == EHCI_NULL &&
+ if (sqtd->qtd.qtd_next == htole32(EHCI_LINK_TERMINATE) &&
EHCI_QTD_GET_BYTES(status) == 0)
status &= ~EHCI_QTD_HALTED;
if (EHCI_QTD_GET_PID(status) != EHCI_QTD_PID_SETUP)
EHCI_QH_SET_CMASK(0x1c) | /* XXX */
EHCI_QH_SET_SMASK(xfertype == UE_INTERRUPT ? 0x01 : 0)
);
- sqh->qh.qh_curqtd = EHCI_NULL;
+ sqh->qh.qh_curqtd = htole32(EHCI_LINK_TERMINATE);
/* Fill the overlay qTD */
- sqh->qh.qh_qtd.qtd_next = EHCI_NULL;
- sqh->qh.qh_qtd.qtd_altnext = EHCI_NULL;
+ sqh->qh.qh_qtd.qtd_next = htole32(EHCI_LINK_TERMINATE);
+ sqh->qh.qh_qtd.qtd_altnext = htole32(EHCI_LINK_TERMINATE);
sqh->qh.qh_qtd.qtd_status =
htole32(EHCI_QTD_SET_TOGGLE(pipe->endpoint->savedtoggle));
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
sqh->qh.qh_curqtd = 0;
sqh->qh.qh_qtd.qtd_next = htole32(sqtd->physaddr);
- sqh->qh.qh_qtd.qtd_altnext = EHCI_NULL;
+ sqh->qh.qh_qtd.qtd_altnext = htole32(EHCI_LINK_TERMINATE);
for (i = 0; i < EHCI_QTD_NBUFFERS; i++)
sqh->qh.qh_qtd.qtd_buffer[i] = 0;
sqh->sqtd = sqtd;
nextphys = htole32(next->physaddr);
} else {
next = NULL;
- nextphys = EHCI_NULL;
+ nextphys = htole32(EHCI_LINK_TERMINATE);
}
for (i = 0; i * EHCI_PAGE_SIZE <
stat->qtd.qtd_buffer[0] = 0; /* XXX not needed? */
stat->qtd.qtd_buffer_hi[0] = 0; /* XXX not needed? */
stat->nextqtd = NULL;
- stat->qtd.qtd_next = stat->qtd.qtd_altnext = EHCI_NULL;
+ stat->qtd.qtd_next = stat->qtd.qtd_altnext = htole32(EHCI_LINK_TERMINATE);
stat->len = 0;
usb_syncmem(&stat->dma, stat->offs, sizeof(stat->qtd),
BUS_DMASYNC_PREWRITE | BUS_DMASYNC_PREREAD);
itd->itd.itd_next = sc->sc_flist[frindex];
if (itd->itd.itd_next == 0)
/* FIXME: frindex table gets initialized to NULL
- * or EHCI_NULL? */
- itd->itd.itd_next = htole32(EHCI_NULL);
+ * or htole32(EHCI_LINK_TERMINATE)? */
+ itd->itd.itd_next = htole32(htole32(EHCI_LINK_TERMINATE));
sc->sc_flist[frindex] = htole32(EHCI_LINK_ITD | itd->physaddr);
itd->u.frame_list.next = sc->sc_softitds[frindex];