Don't abuse usbd_status in xhci_init
This commit is contained in:
parent
89ca04c0c2
commit
30f3fc91b8
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: xhci_pci.c,v 1.1 2013/09/14 00:40:31 jakllsch Exp $ */
|
||||
/* $NetBSD: xhci_pci.c,v 1.2 2014/03/10 13:10:41 skrll Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1998 The NetBSD Foundation, Inc.
|
||||
@ -31,7 +31,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.1 2013/09/14 00:40:31 jakllsch Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xhci_pci.c,v 1.2 2014/03/10 13:10:41 skrll Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -82,7 +82,7 @@ xhci_pci_attach(device_t parent, device_t self, void *aux)
|
||||
char const *intrstr;
|
||||
pci_intr_handle_t ih;
|
||||
pcireg_t csr, memtype;
|
||||
usbd_status r;
|
||||
int err;
|
||||
//const char *vendor;
|
||||
uint32_t hccparams;
|
||||
|
||||
@ -164,9 +164,9 @@ xhci_pci_attach(device_t parent, device_t self, void *aux)
|
||||
"vendor 0x%04x", PCI_VENDOR(pa->pa_id));
|
||||
#endif
|
||||
|
||||
r = xhci_init(sc);
|
||||
if (r != USBD_NORMAL_COMPLETION) {
|
||||
aprint_error_dev(self, "init failed, error=%d\n", r);
|
||||
err = xhci_init(sc);
|
||||
if (err) {
|
||||
aprint_error_dev(self, "init failed, error=%d\n", err);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: xhci.c,v 1.14 2014/03/10 13:01:28 skrll Exp $ */
|
||||
/* $NetBSD: xhci.c,v 1.15 2014/03/10 13:10:41 skrll Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013 Jonathan A. Kollasch
|
||||
@ -27,7 +27,7 @@
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.14 2014/03/10 13:01:28 skrll Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: xhci.c,v 1.15 2014/03/10 13:10:41 skrll Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
@ -566,7 +566,7 @@ hexdump(const char *msg, const void *base, size_t len)
|
||||
}
|
||||
|
||||
|
||||
usbd_status
|
||||
int
|
||||
xhci_init(struct xhci_softc *sc)
|
||||
{
|
||||
bus_size_t bsz;
|
||||
@ -598,7 +598,7 @@ xhci_init(struct xhci_softc *sc)
|
||||
if (bus_space_subregion(sc->sc_iot, sc->sc_ioh, 0, caplength,
|
||||
&sc->sc_cbh) != 0) {
|
||||
aprint_error_dev(sc->sc_dev, "capability subregion failure\n");
|
||||
return USBD_NOMEM;
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
hcs1 = xhci_cap_read_4(sc, XHCI_HCSPARAMS1);
|
||||
@ -654,21 +654,21 @@ xhci_init(struct xhci_softc *sc)
|
||||
if (bus_space_subregion(sc->sc_iot, sc->sc_ioh, caplength, bsz,
|
||||
&sc->sc_obh) != 0) {
|
||||
aprint_error_dev(sc->sc_dev, "operational subregion failure\n");
|
||||
return USBD_NOMEM;
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
dboff = xhci_cap_read_4(sc, XHCI_DBOFF);
|
||||
if (bus_space_subregion(sc->sc_iot, sc->sc_ioh, dboff,
|
||||
sc->sc_maxslots * 4, &sc->sc_dbh) != 0) {
|
||||
aprint_error_dev(sc->sc_dev, "doorbell subregion failure\n");
|
||||
return USBD_NOMEM;
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
rtsoff = xhci_cap_read_4(sc, XHCI_RTSOFF);
|
||||
if (bus_space_subregion(sc->sc_iot, sc->sc_ioh, rtsoff,
|
||||
sc->sc_maxintrs * 0x20, &sc->sc_rbh) != 0) {
|
||||
aprint_error_dev(sc->sc_dev, "runtime subregion failure\n");
|
||||
return USBD_NOMEM;
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
@ -678,7 +678,7 @@ xhci_init(struct xhci_softc *sc)
|
||||
usb_delay_ms(&sc->sc_bus, 1);
|
||||
}
|
||||
if (i >= 100)
|
||||
return USBD_IOERROR;
|
||||
return EIO;
|
||||
|
||||
usbcmd = 0;
|
||||
xhci_op_write_4(sc, XHCI_USBCMD, usbcmd);
|
||||
@ -693,7 +693,7 @@ xhci_init(struct xhci_softc *sc)
|
||||
usb_delay_ms(&sc->sc_bus, 1);
|
||||
}
|
||||
if (i >= 100)
|
||||
return USBD_IOERROR;
|
||||
return EIO;
|
||||
|
||||
for (i = 0; i < 100; i++) {
|
||||
usbsts = xhci_op_read_4(sc, XHCI_USBSTS);
|
||||
@ -702,13 +702,13 @@ xhci_init(struct xhci_softc *sc)
|
||||
usb_delay_ms(&sc->sc_bus, 1);
|
||||
}
|
||||
if (i >= 100)
|
||||
return USBD_IOERROR;
|
||||
return EIO;
|
||||
|
||||
pagesize = xhci_op_read_4(sc, XHCI_PAGESIZE);
|
||||
aprint_debug_dev(sc->sc_dev, "PAGESIZE 0x%08x\n", pagesize);
|
||||
pagesize = ffs(pagesize);
|
||||
if (pagesize == 0)
|
||||
return USBD_IOERROR;
|
||||
return EIO;
|
||||
sc->sc_pgsz = 1 << (12 + (pagesize - 1));
|
||||
aprint_debug_dev(sc->sc_dev, "sc_pgsz 0x%08x\n", (uint32_t)sc->sc_pgsz);
|
||||
aprint_debug_dev(sc->sc_dev, "sc_maxslots 0x%08x\n",
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: xhcivar.h,v 1.2 2013/10/28 17:49:33 matt Exp $ */
|
||||
/* $NetBSD: xhcivar.h,v 1.3 2014/03/10 13:10:41 skrll Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2013 Jonathan A. Kollasch
|
||||
@ -116,7 +116,7 @@ struct xhci_softc {
|
||||
uint8_t sc_conf;
|
||||
};
|
||||
|
||||
usbd_status xhci_init(struct xhci_softc *);
|
||||
int xhci_init(struct xhci_softc *);
|
||||
int xhci_intr(void *);
|
||||
int xhci_detach(struct xhci_softc *, int);
|
||||
int xhci_activate(device_t, enum devact);
|
||||
|
Loading…
Reference in New Issue
Block a user