Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ofw/ofw_pcib.c
Show First 20 Lines • Show All 418 Lines • ▼ Show 20 Lines | return (nbase_ranges / sizeof(cell_t) / | ||||
(info->pci_address_cell + info->host_address_cells + | (info->pci_address_cell + info->host_address_cells + | ||||
info->size_cells)); | info->size_cells)); | ||||
} | } | ||||
static struct resource * | static struct resource * | ||||
ofw_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid, | ofw_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid, | ||||
rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | rman_res_t start, rman_res_t end, rman_res_t count, u_int flags) | ||||
{ | { | ||||
#if defined(PCI_RES_BUS) | |||||
struct ofw_pci_softc *sc; | struct ofw_pci_softc *sc; | ||||
sc = device_get_softc(bus); | sc = device_get_softc(bus); | ||||
#endif | |||||
switch (type) { | switch (type) { | ||||
#if defined(PCI_RES_BUS) | |||||
case PCI_RES_BUS: | case PCI_RES_BUS: | ||||
return (pci_domain_alloc_bus(sc->sc_pci_domain, child, rid, | return (pci_domain_alloc_bus(sc->sc_pci_domain, child, rid, | ||||
start, end, count, flags)); | start, end, count, flags)); | ||||
#endif | |||||
case SYS_RES_MEMORY: | case SYS_RES_MEMORY: | ||||
case SYS_RES_IOPORT: | case SYS_RES_IOPORT: | ||||
return (bus_generic_rman_alloc_resource(bus, child, type, rid, | return (bus_generic_rman_alloc_resource(bus, child, type, rid, | ||||
start, end, count, flags)); | start, end, count, flags)); | ||||
default: | default: | ||||
return (bus_generic_alloc_resource(bus, child, type, rid, | return (bus_generic_alloc_resource(bus, child, type, rid, | ||||
start, end, count, flags)); | start, end, count, flags)); | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
ofw_pcib_release_resource(device_t bus, device_t child, int type, int rid, | ofw_pcib_release_resource(device_t bus, device_t child, int type, int rid, | ||||
struct resource *res) | struct resource *res) | ||||
{ | { | ||||
#if defined(PCI_RES_BUS) | |||||
struct ofw_pci_softc *sc; | struct ofw_pci_softc *sc; | ||||
sc = device_get_softc(bus); | sc = device_get_softc(bus); | ||||
#endif | |||||
switch (type) { | switch (type) { | ||||
#if defined(PCI_RES_BUS) | |||||
case PCI_RES_BUS: | case PCI_RES_BUS: | ||||
return (pci_domain_release_bus(sc->sc_pci_domain, child, rid, | return (pci_domain_release_bus(sc->sc_pci_domain, child, rid, | ||||
res)); | res)); | ||||
#endif | |||||
case SYS_RES_MEMORY: | case SYS_RES_MEMORY: | ||||
case SYS_RES_IOPORT: | case SYS_RES_IOPORT: | ||||
return (bus_generic_rman_release_resource(bus, child, type, rid, | return (bus_generic_rman_release_resource(bus, child, type, rid, | ||||
res)); | res)); | ||||
default: | default: | ||||
return (bus_generic_release_resource(bus, child, type, rid, | return (bus_generic_release_resource(bus, child, type, rid, | ||||
res)); | res)); | ||||
} | } | ||||
Show All 37 Lines | ofw_pcib_translate_resource(device_t bus, int type, rman_res_t start, | ||||
} | } | ||||
return (ENOENT); | return (ENOENT); | ||||
} | } | ||||
static int | static int | ||||
ofw_pcib_activate_resource(device_t bus, device_t child, int type, int rid, | ofw_pcib_activate_resource(device_t bus, device_t child, int type, int rid, | ||||
struct resource *res) | struct resource *res) | ||||
{ | { | ||||
#if defined(PCI_RES_BUS) | |||||
struct ofw_pci_softc *sc; | struct ofw_pci_softc *sc; | ||||
sc = device_get_softc(bus); | sc = device_get_softc(bus); | ||||
#endif | |||||
switch (type) { | switch (type) { | ||||
#if defined(PCI_RES_BUS) | |||||
case PCI_RES_BUS: | case PCI_RES_BUS: | ||||
return (pci_domain_activate_bus(sc->sc_pci_domain, child, rid, | return (pci_domain_activate_bus(sc->sc_pci_domain, child, rid, | ||||
res)); | res)); | ||||
#endif | |||||
case SYS_RES_MEMORY: | case SYS_RES_MEMORY: | ||||
case SYS_RES_IOPORT: | case SYS_RES_IOPORT: | ||||
return (bus_generic_rman_activate_resource(bus, child, type, rid, | return (bus_generic_rman_activate_resource(bus, child, type, rid, | ||||
res)); | res)); | ||||
default: | default: | ||||
return (bus_generic_activate_resource(bus, child, type, rid, | return (bus_generic_activate_resource(bus, child, type, rid, | ||||
res)); | res)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Lines | ofw_pcib_bus_get_bus_tag(device_t bus, device_t child) | ||||
return (&bs_le_tag); | return (&bs_le_tag); | ||||
} | } | ||||
#endif | #endif | ||||
static int | static int | ||||
ofw_pcib_deactivate_resource(device_t bus, device_t child, int type, int rid, | ofw_pcib_deactivate_resource(device_t bus, device_t child, int type, int rid, | ||||
struct resource *res) | struct resource *res) | ||||
{ | { | ||||
#if defined(PCI_RES_BUS) | |||||
struct ofw_pci_softc *sc; | struct ofw_pci_softc *sc; | ||||
sc = device_get_softc(bus); | sc = device_get_softc(bus); | ||||
#endif | |||||
switch (type) { | switch (type) { | ||||
#if defined(PCI_RES_BUS) | |||||
case PCI_RES_BUS: | case PCI_RES_BUS: | ||||
return (pci_domain_deactivate_bus(sc->sc_pci_domain, child, rid, | return (pci_domain_deactivate_bus(sc->sc_pci_domain, child, rid, | ||||
res)); | res)); | ||||
#endif | |||||
case SYS_RES_MEMORY: | case SYS_RES_MEMORY: | ||||
case SYS_RES_IOPORT: | case SYS_RES_IOPORT: | ||||
return (bus_generic_rman_deactivate_resource(bus, child, type, | return (bus_generic_rman_deactivate_resource(bus, child, type, | ||||
rid, res)); | rid, res)); | ||||
default: | default: | ||||
return (bus_generic_deactivate_resource(bus, child, type, rid, | return (bus_generic_deactivate_resource(bus, child, type, rid, | ||||
res)); | res)); | ||||
} | } | ||||
} | } | ||||
static int | static int | ||||
ofw_pcib_adjust_resource(device_t bus, device_t child, int type, | ofw_pcib_adjust_resource(device_t bus, device_t child, int type, | ||||
struct resource *res, rman_res_t start, rman_res_t end) | struct resource *res, rman_res_t start, rman_res_t end) | ||||
{ | { | ||||
#if defined(PCI_RES_BUS) | |||||
struct ofw_pci_softc *sc; | struct ofw_pci_softc *sc; | ||||
sc = device_get_softc(bus); | sc = device_get_softc(bus); | ||||
#endif | |||||
switch (type) { | switch (type) { | ||||
#if defined(PCI_RES_BUS) | |||||
case PCI_RES_BUS: | case PCI_RES_BUS: | ||||
return (pci_domain_adjust_bus(sc->sc_pci_domain, child, res, | return (pci_domain_adjust_bus(sc->sc_pci_domain, child, res, | ||||
start, end)); | start, end)); | ||||
#endif | |||||
case SYS_RES_MEMORY: | case SYS_RES_MEMORY: | ||||
case SYS_RES_IOPORT: | case SYS_RES_IOPORT: | ||||
return (bus_generic_rman_adjust_resource(bus, child, type, res, | return (bus_generic_rman_adjust_resource(bus, child, type, res, | ||||
start, end)); | start, end)); | ||||
default: | default: | ||||
return (bus_generic_adjust_resource(bus, child, type, res, | return (bus_generic_adjust_resource(bus, child, type, res, | ||||
start, end)); | start, end)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines |