Move the defines to the right location.

Add a DIAGNOSTIC when closing interrupt pipes.

Insert splx(s) which were left out with iso pipes (non-functional yet) and
in a DIAGNOSTIC.
This commit is contained in:
Nick Hibma 2000-01-27 23:25:58 +00:00
parent cc16f1b9d9
commit 8648a2cdb9
3 changed files with 18 additions and 10 deletions

View file

@ -788,6 +788,7 @@ ohci_init(sc)
#if defined(__NetBSD__) || defined(__OpenBSD__)
sc->sc_shutdownhook = shutdownhook_establish(ohci_shutdown, sc);
#endif
return (USBD_NORMAL_COMPLETION);
bad5:
@ -1115,7 +1116,7 @@ ohci_process_done(sc, done)
for (std = sdone; std; std = stdnext) {
xfer = std->xfer;
stdnext = std->dnext;
DPRINTFN(10, ("ohci_process_done: std=%p xfer=%p hcpriv=%p\n",
DPRINTFN(5, ("ohci_process_done: std=%p xfer=%p hcpriv=%p\n",
std, xfer, xfer->hcpriv));
cc = OHCI_TD_GET_CC(LE(std->td.td_flags));
usb_untimeout(ohci_timeout, xfer, xfer->timo_handle);
@ -1556,6 +1557,7 @@ ohci_hash_find_td(sc, a)
std = LIST_NEXT(std, hnext))
if (std->physaddr == a)
return (std);
panic("ohci_hash_find_td: addr 0x%08lx not found\n", (u_long)a);
}
@ -1740,8 +1742,7 @@ 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_TAILMASK))) {
if (sed->ed.ed_tailp != (sed->ed.ed_headp & LE(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)]);
@ -1754,8 +1755,7 @@ ohci_close_pipe(pipe, head)
(int)LE(sed->ed.ed_headp), (int)LE(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_TAILMASK)))
if (sed->ed.ed_tailp != (sed->ed.ed_headp & LE(OHCI_HEADMASK)))
printf("ohci_close_pipe: pipe still not empty\n");
}
#endif
@ -1827,6 +1827,7 @@ ohci_abort_xfer_end(v)
#ifdef DIAGNOSTIC
if (p == NULL) {
printf("ohci_abort_xfer: hcpriv==0\n");
splx(s);
return;
}
#endif
@ -2649,9 +2650,13 @@ ohci_device_intr_close(pipe)
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_TAILMASK)))
if (sed->ed.ed_tailp != (sed->ed.ed_headp & LE(OHCI_HEADMASK)))
usb_delay_ms(&sc->sc_bus, 2);
#ifdef DIAGNOSTIC
if (sed->ed.ed_tailp != (sed->ed.ed_headp & LE(OHCI_HEADMASK)))
panic("%s: Intr pipe %p still has TDs queued\n",
USBDEVNAME(sc->sc_bus.bdev), pipe);
#endif
for (p = sc->sc_eds[pos]; p && p->next != sed; p = p->next)
;
@ -2792,6 +2797,7 @@ ohci_device_isoc_enter(xfer)
nsitd = ohci_alloc_sitd(sc);
if (nsitd == NULL) {
/* XXX what now? */
splx(s);
return;
}
sitd->nextitd = nsitd;
@ -2817,6 +2823,7 @@ ohci_device_isoc_enter(xfer)
nsitd = ohci_alloc_sitd(sc);
if (nsitd == NULL) {
/* XXX what now? */
splx(s);
return;
}
sitd->nextitd = nsitd;

View file

@ -163,10 +163,10 @@ typedef struct {
#define OHCI_ED_SET_MAXP(s) ((s) << 16)
#define OHCI_ED_MAXPMASK (0x7ff << 16)
ohci_physaddr_t ed_tailp;
ohci_physaddr_t ed_headp;
#define OHCI_HALTED 0x00000002
#define OHCI_TOGGLECARRY 0x00000001
#define OHCI_TAILMASK 0xfffffffc
ohci_physaddr_t ed_headp;
#define OHCI_HEADMASK 0xfffffffc
ohci_physaddr_t ed_nexted;
} ohci_ed_t;
/* #define OHCI_ED_SIZE 16 */

View file

@ -83,7 +83,8 @@ typedef struct ohci_softc {
ohci_soft_ed_t *sc_eds[OHCI_NO_EDS];
u_int sc_bws[OHCI_NO_INTRS];
u_int32_t sc_eintrs;
u_int32_t sc_eintrs; /* enabled interrupts */
ohci_soft_ed_t *sc_isoc_head;
ohci_soft_ed_t *sc_ctrl_head;
ohci_soft_ed_t *sc_bulk_head;