summaryrefslogtreecommitdiffstats
path: root/sys/dev/usb/uhci.c
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2002-01-20 12:08:09 +0000
committerjoe <joe@FreeBSD.org>2002-01-20 12:08:09 +0000
commit6bf73776931f9818c3a00a1d0879a3bb4e4e2536 (patch)
treed5ae10a64bf500c369ec29b8ff2c29db4ad7a24b /sys/dev/usb/uhci.c
parent649c3f35e267be143011997b9028b09dffed32fe (diff)
downloadFreeBSD-src-6bf73776931f9818c3a00a1d0879a3bb4e4e2536.zip
FreeBSD-src-6bf73776931f9818c3a00a1d0879a3bb4e4e2536.tar.gz
Merge from NetBSD:
uchireg.h: -r1.12 uchi.c: -r1.121 date: 2000/07/23 19:43:38; author: augustss; state: Exp; Be a little more explicit and careful about setting links in TDs and QHs.
Diffstat (limited to 'sys/dev/usb/uhci.c')
-rw-r--r--sys/dev/usb/uhci.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/sys/dev/usb/uhci.c b/sys/dev/usb/uhci.c
index 51c2fa7..fcee105 100644
--- a/sys/dev/usb/uhci.c
+++ b/sys/dev/usb/uhci.c
@@ -385,7 +385,9 @@ uhci_init(uhci_softc_t *sc)
bsqh = uhci_alloc_sqh(sc);
if (bsqh == NULL)
return (USBD_NOMEM);
+ bsqh->hlink = NULL;
bsqh->qh.qh_hlink = htole32(UHCI_PTR_T); /* end of QH chain */
+ bsqh->elink = NULL;
bsqh->qh.qh_elink = htole32(UHCI_PTR_T);
sc->sc_bulk_start = sc->sc_bulk_end = bsqh;
@@ -394,7 +396,8 @@ uhci_init(uhci_softc_t *sc)
if (csqh == NULL)
return (USBD_NOMEM);
csqh->hlink = bsqh;
- csqh->qh.qh_hlink = htole32(bsqh->physaddr | UHCI_PTR_Q);
+ csqh->qh.qh_hlink = htole32(bsqh->physaddr | UHCI_PTR_QH);
+ csqh->elink = NULL;
csqh->qh.qh_elink = htole32(UHCI_PTR_T);
sc->sc_ctl_start = sc->sc_ctl_end = csqh;
@@ -409,12 +412,12 @@ uhci_init(uhci_softc_t *sc)
if (std == NULL || sqh == NULL)
return (USBD_NOMEM);
std->link.sqh = sqh;
- std->td.td_link = htole32(sqh->physaddr | UHCI_PTR_Q);
+ std->td.td_link = htole32(sqh->physaddr | UHCI_PTR_QH);
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 = htole32(csqh->physaddr | UHCI_PTR_Q);
+ sqh->qh.qh_hlink = htole32(csqh->physaddr | UHCI_PTR_QH);
sqh->elink = NULL;
sqh->qh.qh_elink = htole32(UHCI_PTR_T);
sc->sc_vframes[i].htd = std;
@@ -854,7 +857,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 = htole32(sqh->physaddr | UHCI_PTR_Q);
+ eqh->qh.qh_hlink = htole32(sqh->physaddr | UHCI_PTR_QH);
sc->sc_ctl_end = sqh;
}
@@ -895,7 +898,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 = htole32(sqh->physaddr | UHCI_PTR_Q);
+ eqh->qh.qh_hlink = htole32(sqh->physaddr | UHCI_PTR_QH);
sc->sc_bulk_end = sqh;
}
@@ -1473,10 +1476,7 @@ uhci_alloc_std_chain(struct uhci_pipe *upipe, uhci_softc_t *sc, int len,
return (USBD_NOMEM);
}
p->link.std = lastp;
- if (lastlink == UHCI_PTR_T)
- p->td.td_link = htole32(lastlink);
- else
- p->td.td_link = htole32(lastlink|UHCI_PTR_VF);
+ p->td.td_link = htole32(lastlink | UHCI_PTR_VF | UHCI_PTR_TD);
lastp = p;
lastlink = p->physaddr;
p->td.td_status = htole32(status);
@@ -1586,7 +1586,7 @@ uhci_device_bulk_start(usbd_xfer_handle xfer)
#endif
sqh->elink = data;
- sqh->qh.qh_elink = htole32(data->physaddr);
+ sqh->qh.qh_elink = htole32(data->physaddr | UHCI_PTR_TD);
sqh->intr_info = ii;
s = splusb();
@@ -1792,7 +1792,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 = htole32(data->physaddr);
+ sqh->qh.qh_elink = htole32(data->physaddr | UHCI_PTR_TD);
}
splx(s);
@@ -1914,7 +1914,7 @@ uhci_device_request(usbd_xfer_handle xfer)
return (err);
next = data;
dataend->link.std = stat;
- dataend->td.td_link = htole32(stat->physaddr | UHCI_PTR_VF);
+ dataend->td.td_link = htole32(stat->physaddr | UHCI_PTR_VF | UHCI_PTR_TD);
} else {
next = stat;
}
@@ -1923,7 +1923,7 @@ 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 = htole32(next->physaddr | UHCI_PTR_VF);
+ setup->td.td_link = htole32(next->physaddr | UHCI_PTR_VF | UHCI_PTR_TD);
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));
@@ -1960,7 +1960,7 @@ uhci_device_request(usbd_xfer_handle xfer)
#endif
sqh->elink = setup;
- sqh->qh.qh_elink = htole32(setup->physaddr);
+ sqh->qh.qh_elink = htole32(setup->physaddr | UHCI_PTR_TD);
sqh->intr_info = ii;
s = splusb();
@@ -1975,7 +1975,7 @@ uhci_device_request(usbd_xfer_handle xfer)
uhci_physaddr_t link;
DPRINTF(("uhci_enter_ctl_q: follow from [0]\n"));
for (std = sc->sc_vframes[0].htd, link = 0;
- (link & UHCI_PTR_Q) == 0;
+ (link & UHCI_PTR_QH) == 0;
std = std->link.std) {
link = le32toh(std->td.td_link);
uhci_dump_td(std);
@@ -2263,7 +2263,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 = htole32(std->physaddr);
+ vstd->td.td_link = htole32(std->physaddr | UHCI_PTR_TD);
}
uhci_unlock_frames(sc);
@@ -2355,7 +2355,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 = htole32(data->physaddr);
+ sqh->qh.qh_elink = htole32(data->physaddr | UHCI_PTR_TD);
}
} else {
ii->stdstart = 0; /* mark as inactive */
@@ -2415,7 +2415,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 = htole32(sqh->physaddr | UHCI_PTR_Q);
+ eqh->qh.qh_hlink = htole32(sqh->physaddr | UHCI_PTR_QH);
vf->eqh = sqh;
vf->bandwidth++;
}
OpenPOWER on IntegriCloud