Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/ofw/ofw_pcib.c
Show First 20 Lines • Show All 407 Lines • ▼ Show 20 Lines | ofw_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid, | ||||
struct rman *rm; | struct rman *rm; | ||||
int needactivate; | int needactivate; | ||||
needactivate = flags & RF_ACTIVE; | needactivate = flags & RF_ACTIVE; | ||||
flags &= ~RF_ACTIVE; | flags &= ~RF_ACTIVE; | ||||
sc = device_get_softc(bus); | sc = device_get_softc(bus); | ||||
#if defined(PCI_RES_BUS) | |||||
if (type == PCI_RES_BUS) { | if (type == 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 | needactivate)); | start, end, count, flags | needactivate)); | ||||
} | } | ||||
#endif | |||||
rm = ofw_pcib_get_rman(sc, type, flags); | rm = ofw_pcib_get_rman(sc, type, flags); | ||||
if (rm == NULL) { | if (rm == NULL) { | ||||
return (bus_generic_alloc_resource(bus, child, type, rid, | return (bus_generic_alloc_resource(bus, child, type, rid, | ||||
start, end, count, flags | needactivate)); | start, end, count, flags | needactivate)); | ||||
} | } | ||||
rv = rman_reserve_resource(rm, start, end, count, flags, child); | rv = rman_reserve_resource(rm, start, end, count, flags, child); | ||||
Show All 23 Lines | ofw_pcib_release_resource(device_t bus, device_t child, int type, int rid, | ||||
struct resource *res) | struct resource *res) | ||||
{ | { | ||||
struct ofw_pci_softc *sc; | struct ofw_pci_softc *sc; | ||||
struct rman *rm; | struct rman *rm; | ||||
int error; | int error; | ||||
sc = device_get_softc(bus); | sc = device_get_softc(bus); | ||||
#if defined(PCI_RES_BUS) | |||||
if (type == PCI_RES_BUS) | if (type == 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 | |||||
rm = ofw_pcib_get_rman(sc, type, rman_get_flags(res)); | rm = ofw_pcib_get_rman(sc, type, rman_get_flags(res)); | ||||
if (rm == NULL) { | if (rm == NULL) { | ||||
return (bus_generic_release_resource(bus, child, type, rid, | return (bus_generic_release_resource(bus, child, type, rid, | ||||
res)); | res)); | ||||
} | } | ||||
KASSERT(rman_is_region_manager(res, rm), ("rman mismatch")); | KASSERT(rman_is_region_manager(res, rm), ("rman mismatch")); | ||||
▲ Show 20 Lines • Show All 140 Lines • ▼ Show 20 Lines | |||||
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) | ||||
{ | { | ||||
struct rman *rm; | struct rman *rm; | ||||
struct ofw_pci_softc *sc; | struct ofw_pci_softc *sc; | ||||
sc = device_get_softc(bus); | sc = device_get_softc(bus); | ||||
#if defined(PCI_RES_BUS) | |||||
if (type == PCI_RES_BUS) | if (type == 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 | |||||
rm = ofw_pcib_get_rman(sc, type, rman_get_flags(res)); | rm = ofw_pcib_get_rman(sc, type, rman_get_flags(res)); | ||||
if (rm == NULL) { | if (rm == NULL) { | ||||
return (bus_generic_adjust_resource(bus, child, type, res, | return (bus_generic_adjust_resource(bus, child, type, res, | ||||
start, end)); | start, end)); | ||||
} | } | ||||
KASSERT(rman_is_region_manager(res, rm), ("rman mismatch")); | KASSERT(rman_is_region_manager(res, rm), ("rman mismatch")); | ||||
KASSERT(!(rman_get_flags(res) & RF_ACTIVE), | KASSERT(!(rman_get_flags(res) & RF_ACTIVE), | ||||
▲ Show 20 Lines • Show All 81 Lines • Show Last 20 Lines |