Changeset View
Changeset View
Standalone View
Standalone View
sys/powerpc/mpc85xx/pci_mpc85xx.c
Context not available. | |||||
bus_space_tag_t sc_bst; | bus_space_tag_t sc_bst; | ||||
int sc_rid; | int sc_rid; | ||||
int sc_irq_id; | |||||
struct resource *sc_irq_res; | struct resource *sc_irq_res; | ||||
void *sc_ih; | void *sc_ih; | ||||
Context not available. | |||||
/* Forward declerations. */ | /* Forward declerations. */ | ||||
static int fsl_pcib_attach(device_t); | static int fsl_pcib_attach(device_t); | ||||
static void fsl_new_pass(device_t); | |||||
static int fsl_pcib_detach(device_t); | static int fsl_pcib_detach(device_t); | ||||
static int fsl_pcib_probe(device_t); | static int fsl_pcib_probe(device_t); | ||||
Context not available. | |||||
DEVMETHOD(device_probe, fsl_pcib_probe), | DEVMETHOD(device_probe, fsl_pcib_probe), | ||||
DEVMETHOD(device_attach, fsl_pcib_attach), | DEVMETHOD(device_attach, fsl_pcib_attach), | ||||
DEVMETHOD(device_detach, fsl_pcib_detach), | DEVMETHOD(device_detach, fsl_pcib_detach), | ||||
DEVMETHOD(bus_new_pass, fsl_new_pass), | |||||
/* pcib interface */ | /* pcib interface */ | ||||
DEVMETHOD(pcib_maxslots, fsl_pcib_maxslots), | DEVMETHOD(pcib_maxslots, fsl_pcib_maxslots), | ||||
Context not available. | |||||
DEFINE_CLASS_1(pcib, fsl_pcib_driver, fsl_pcib_methods, | DEFINE_CLASS_1(pcib, fsl_pcib_driver, fsl_pcib_methods, | ||||
sizeof(struct fsl_pcib_softc), ofw_pci_driver); | sizeof(struct fsl_pcib_softc), ofw_pci_driver); | ||||
DRIVER_MODULE(pcib, ofwbus, fsl_pcib_driver, fsl_pcib_devclass, 0, 0); | EARLY_DRIVER_MODULE(pcib, ofwbus, fsl_pcib_driver, fsl_pcib_devclass, 0, 0, | ||||
BUS_PASS_BUS); | |||||
static int | static int | ||||
fsl_pcib_err_intr(void *v) | fsl_pcib_err_intr(void *v) | ||||
Context not available. | |||||
struct fsl_pcib_softc *sc; | struct fsl_pcib_softc *sc; | ||||
phandle_t node; | phandle_t node; | ||||
uint32_t cfgreg; | uint32_t cfgreg; | ||||
int error, maxslot, rid; | int error, maxslot; | ||||
uint8_t ltssm, capptr; | uint8_t ltssm, capptr; | ||||
sc = device_get_softc(dev); | sc = device_get_softc(dev); | ||||
Context not available. | |||||
} | } | ||||
/* Allocate irq */ | /* Allocate irq */ | ||||
rid = 0; | sc->sc_irq_id = 0; | ||||
sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, | sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, | ||||
RF_ACTIVE | RF_SHAREABLE); | &sc->sc_irq_id, RF_SHAREABLE /* Set up as inactive */); | ||||
if (sc->sc_irq_res == NULL) { | if (sc->sc_irq_res == NULL) { | ||||
error = fsl_pcib_detach(dev); | error = fsl_pcib_detach(dev); | ||||
if (error != 0) { | if (error != 0) { | ||||
Context not available. | |||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
/* Setup interrupt handler */ | /* Setup interrupt handler in fsl_new_pass() */ | ||||
error = bus_setup_intr(dev, sc->sc_irq_res, INTR_TYPE_MISC | INTR_MPSAFE, | |||||
NULL, (driver_intr_t *)fsl_pcib_err_intr, dev, &sc->sc_ih); | |||||
if (error != 0) { | |||||
device_printf(dev, "Could not setup irq, %d\n", error); | |||||
sc->sc_ih = NULL; | |||||
error = fsl_pcib_detach(dev); | |||||
if (error != 0) { | |||||
device_printf(dev, | |||||
"Detach of the driver failed with error %d\n", | |||||
error); | |||||
} | |||||
return (ENXIO); | |||||
} | |||||
fsl_pcib_err_init(dev); | fsl_pcib_err_init(dev); | ||||
Context not available. | |||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
static void | |||||
fsl_new_pass(device_t dev) | |||||
{ | |||||
struct fsl_pcib_softc *sc; | |||||
int error; | |||||
if (bus_current_pass <= BUS_PASS_INTERRUPT) | |||||
goto out; | |||||
sc = device_get_softc(dev); | |||||
if (rman_get_flags(sc->sc_irq_res) & RF_ACTIVE) | |||||
goto out; | |||||
/* Setup interrupt handler */ | |||||
bus_activate_resource(dev, SYS_RES_IRQ, sc->sc_irq_id, sc->sc_irq_res); | |||||
error = bus_setup_intr(dev, sc->sc_irq_res, | |||||
INTR_TYPE_MISC | INTR_MPSAFE, NULL, | |||||
(driver_intr_t *)fsl_pcib_err_intr, dev, &sc->sc_ih); | |||||
if (error != 0) | |||||
panic("fsl_new_pass: could not setup irq, %d\n", error); | |||||
out: | |||||
bus_generic_new_pass(dev); | |||||
} | |||||
static uint32_t | static uint32_t | ||||
fsl_pcib_cfgread(struct fsl_pcib_softc *sc, u_int bus, u_int slot, u_int func, | fsl_pcib_cfgread(struct fsl_pcib_softc *sc, u_int bus, u_int slot, u_int func, | ||||
u_int reg, int bytes) | u_int reg, int bytes) | ||||
Context not available. |