Page MenuHomeFreeBSD

D32955.diff
No OneTemporary

D32955.diff

diff --git a/sys/arm/mv/mv_pci.c b/sys/arm/mv/mv_pci.c
--- a/sys/arm/mv/mv_pci.c
+++ b/sys/arm/mv/mv_pci.c
@@ -913,11 +913,9 @@
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
break;
-#ifdef PCI_RES_BUS
case PCI_RES_BUS:
return (pci_domain_alloc_bus(sc->ap_segment, child, rid, start,
end, count, flags));
-#endif
default:
return (BUS_ALLOC_RESOURCE(device_get_parent(dev), dev,
type, rid, start, end, count, flags));
@@ -941,20 +939,16 @@
mv_pcib_adjust_resource(device_t dev, device_t child,
struct resource *r, rman_res_t start, rman_res_t end)
{
-#ifdef PCI_RES_BUS
struct mv_pcib_softc *sc = device_get_softc(dev);
-#endif
switch (rman_get_type(r)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
return (bus_generic_rman_adjust_resource(dev, child, r, start,
end));
-#ifdef PCI_RES_BUS
case PCI_RES_BUS:
return (pci_domain_adjust_bus(sc->ap_segment, child, r, start,
end));
-#endif
default:
return (bus_generic_adjust_resource(dev, child, r, start, end));
}
@@ -963,18 +957,14 @@
static int
mv_pcib_release_resource(device_t dev, device_t child, struct resource *res)
{
-#ifdef PCI_RES_BUS
struct mv_pcib_softc *sc = device_get_softc(dev);
-#endif
switch (rman_get_type(res)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
return (bus_generic_rman_release_resource(dev, child, res));
-#ifdef PCI_RES_BUS
case PCI_RES_BUS:
return (pci_domain_release_bus(sc->ap_segment, child, res));
-#endif
default:
return (bus_generic_release_resource(dev, child, res));
}
@@ -983,18 +973,14 @@
static int
mv_pcib_activate_resource(device_t dev, device_t child, struct resource *r)
{
-#ifdef PCI_RES_BUS
struct mv_pcib_softc *sc = device_get_softc(dev);
-#endif
switch (rman_get_type(r)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
return (bus_generic_rman_activate_resource(dev, child, r));
-#ifdef PCI_RES_BUS
case PCI_RES_BUS:
return (pci_domain_activate_bus(sc->ap_segment, child, r));
-#endif
default:
return (bus_generic_activate_resource(dev, child, r));
}
@@ -1003,18 +989,14 @@
static int
mv_pcib_deactivate_resource(device_t dev, device_t child, struct resource *r)
{
-#ifdef PCI_RES_BUS
struct mv_pcib_softc *sc = device_get_softc(dev);
-#endif
switch (rman_get_type(r)) {
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
return (bus_generic_rman_deactivate_resource(dev, child, r));
-#ifdef PCI_RES_BUS
case PCI_RES_BUS:
return (pci_domain_deactivate_bus(sc->ap_segment, child, r));
-#endif
default:
return (bus_generic_deactivate_resource(dev, child, r));
}
diff --git a/sys/arm64/cavium/thunder_pcie_pem.c b/sys/arm64/cavium/thunder_pcie_pem.c
--- a/sys/arm64/cavium/thunder_pcie_pem.c
+++ b/sys/arm64/cavium/thunder_pcie_pem.c
@@ -254,16 +254,12 @@
static int
thunder_pem_activate_resource(device_t dev, device_t child, struct resource *r)
{
-#if defined(PCI_RES_BUS)
struct thunder_pem_softc *sc;
sc = device_get_softc(dev);
-#endif
switch (rman_get_type(r)) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_domain_activate_bus(sc->id, child, r));
-#endif
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
return (bus_generic_rman_activate_resource(dev, child, r));
@@ -276,16 +272,12 @@
thunder_pem_deactivate_resource(device_t dev, device_t child,
struct resource *r)
{
-#if defined(PCI_RES_BUS)
struct thunder_pem_softc *sc;
sc = device_get_softc(dev);
-#endif
switch (rman_get_type(r)) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_domain_deactivate_bus(sc->id, child, r));
-#endif
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
return (bus_generic_rman_deactivate_resource(dev, child, r));
@@ -350,16 +342,12 @@
thunder_pem_adjust_resource(device_t dev, device_t child, struct resource *res,
rman_res_t start, rman_res_t end)
{
-#if defined(PCI_RES_BUS)
struct thunder_pem_softc *sc;
sc = device_get_softc(dev);
-#endif
switch (rman_get_type(res)) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_domain_adjust_bus(sc->id, child, res, start, end));
-#endif
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
return (bus_generic_rman_adjust_resource(dev, child, res, start,
@@ -671,11 +659,9 @@
device_t parent_dev;
switch (type) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_domain_alloc_bus(sc->id, child, rid, start, end,
count, flags));
-#endif
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
break;
@@ -718,15 +704,11 @@
thunder_pem_release_resource(device_t dev, device_t child, struct resource *res)
{
device_t parent_dev;
-#if defined(PCI_RES_BUS)
struct thunder_pem_softc *sc = device_get_softc(dev);
-#endif
switch (rman_get_type(res)) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_domain_release_bus(sc->id, child, res));
-#endif
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
return (bus_generic_rman_release_resource(dev, child, res));
diff --git a/sys/dev/acpica/acpi_pcib_acpi.c b/sys/dev/acpica/acpi_pcib_acpi.c
--- a/sys/dev/acpica/acpi_pcib_acpi.c
+++ b/sys/dev/acpica/acpi_pcib_acpi.c
@@ -96,14 +96,12 @@
static int acpi_pcib_acpi_adjust_resource(device_t dev,
device_t child, struct resource *r,
rman_res_t start, rman_res_t end);
-#ifdef PCI_RES_BUS
static int acpi_pcib_acpi_release_resource(device_t dev,
device_t child, struct resource *r);
static int acpi_pcib_acpi_activate_resource(device_t dev,
device_t child, struct resource *r);
static int acpi_pcib_acpi_deactivate_resource(device_t dev,
device_t child, struct resource *r);
-#endif
static int acpi_pcib_request_feature(device_t pcib, device_t dev,
enum pci_feature feature);
static bus_dma_tag_t acpi_pcib_get_dma_tag(device_t bus, device_t child);
@@ -121,15 +119,9 @@
DEVMETHOD(bus_write_ivar, acpi_pcib_write_ivar),
DEVMETHOD(bus_alloc_resource, acpi_pcib_acpi_alloc_resource),
DEVMETHOD(bus_adjust_resource, acpi_pcib_acpi_adjust_resource),
-#if defined(PCI_RES_BUS)
DEVMETHOD(bus_release_resource, acpi_pcib_acpi_release_resource),
DEVMETHOD(bus_activate_resource, acpi_pcib_acpi_activate_resource),
DEVMETHOD(bus_deactivate_resource, acpi_pcib_acpi_deactivate_resource),
-#else
- DEVMETHOD(bus_release_resource, bus_generic_release_resource),
- DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
- DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
-#endif
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
DEVMETHOD(bus_get_cpus, acpi_pcib_get_cpus),
@@ -243,11 +235,9 @@
case ACPI_IO_RANGE:
type = SYS_RES_IOPORT;
break;
-#ifdef PCI_RES_BUS
case ACPI_BUS_NUMBER_RANGE:
type = PCI_RES_BUS;
break;
-#endif
default:
return (AE_OK);
}
@@ -282,7 +272,6 @@
return (AE_OK);
}
-#if defined(PCI_RES_BUS)
static bool
get_decoded_bus_range(struct acpi_hpcib_softc *sc, rman_res_t *startp,
rman_res_t *endp)
@@ -296,7 +285,6 @@
*endp = rle->end;
return (true);
}
-#endif
static int
acpi_pcib_osc(struct acpi_hpcib_softc *sc, uint32_t osc_ctl)
@@ -361,11 +349,9 @@
ACPI_STATUS status;
static int bus0_seen = 0;
u_int slot, func, busok;
-#if defined(PCI_RES_BUS)
struct resource *bus_res;
rman_res_t end, start;
int rid;
-#endif
int error, domain;
uint8_t busno;
@@ -479,7 +465,6 @@
}
}
-#if defined(PCI_RES_BUS)
/*
* If nothing else worked, hope that ACPI at least lays out the
* Host-PCI bridges in order and that as a result the next free
@@ -524,18 +509,6 @@
}
}
}
-#else
- /*
- * If nothing else worked, hope that ACPI at least lays out the
- * host-PCI bridges in order and that as a result our unit number
- * is actually our bus number. There are several reasons this
- * might not be true.
- */
- if (busok == 0) {
- sc->ap_bus = device_get_unit(dev);
- device_printf(dev, "trying bus number %d\n", sc->ap_bus);
- }
-#endif
/* If this is bus 0 on segment 0, note that it has been seen already. */
if (sc->ap_segment == 0 && sc->ap_bus == 0)
@@ -566,9 +539,7 @@
errout:
device_printf(device_get_parent(dev), "couldn't attach pci bus\n");
-#if defined(PCI_RES_BUS)
pcib_host_res_free(dev, &sc->ap_host_res);
-#endif
return (error);
}
@@ -700,11 +671,9 @@
#endif
sc = device_get_softc(dev);
-#ifdef PCI_RES_BUS
if (type == PCI_RES_BUS)
return (pci_domain_alloc_bus(sc->ap_segment, child, rid, start, end,
count, flags));
-#endif
res = pcib_host_res_alloc(&sc->ap_host_res, child, type, rid, start, end,
count, flags);
@@ -728,15 +697,12 @@
struct acpi_hpcib_softc *sc;
sc = device_get_softc(dev);
-#ifdef PCI_RES_BUS
if (rman_get_type(r) == PCI_RES_BUS)
return (pci_domain_adjust_bus(sc->ap_segment, child, r, start,
end));
-#endif
return (pcib_host_res_adjust(&sc->ap_host_res, child, r, start, end));
}
-#ifdef PCI_RES_BUS
int
acpi_pcib_acpi_release_resource(device_t dev, device_t child,
struct resource *r)
@@ -772,7 +738,6 @@
return (pci_domain_deactivate_bus(sc->ap_segment, child, r));
return (bus_generic_deactivate_resource(dev, child, r));
}
-#endif
static int
acpi_pcib_request_feature(device_t pcib, device_t dev, enum pci_feature feature)
diff --git a/sys/dev/cardbus/cardbus.c b/sys/dev/cardbus/cardbus.c
--- a/sys/dev/cardbus/cardbus.c
+++ b/sys/dev/cardbus/cardbus.c
@@ -93,13 +93,10 @@
cardbus_attach(device_t cbdev)
{
struct cardbus_softc *sc;
-#ifdef PCI_RES_BUS
int rid;
-#endif
sc = device_get_softc(cbdev);
sc->sc_dev = cbdev;
-#ifdef PCI_RES_BUS
rid = 0;
sc->sc_bus = bus_alloc_resource(cbdev, PCI_RES_BUS, &rid,
pcib_get_bus(cbdev), pcib_get_bus(cbdev), 1, 0);
@@ -107,25 +104,18 @@
device_printf(cbdev, "failed to allocate bus number\n");
return (ENXIO);
}
-#else
- device_printf(cbdev, "Your bus numbers may be AFU\n");
-#endif
return (0);
}
static int
cardbus_detach(device_t cbdev)
{
-#ifdef PCI_RES_BUS
struct cardbus_softc *sc;
-#endif
cardbus_detach_card(cbdev);
-#ifdef PCI_RES_BUS
sc = device_get_softc(cbdev);
device_printf(cbdev, "Freeing up the allocatd bus\n");
(void)bus_release_resource(cbdev, PCI_RES_BUS, 0, sc->sc_bus);
-#endif
return (0);
}
diff --git a/sys/dev/cardbus/cardbusvar.h b/sys/dev/cardbus/cardbusvar.h
--- a/sys/dev/cardbus/cardbusvar.h
+++ b/sys/dev/cardbus/cardbusvar.h
@@ -68,9 +68,7 @@
struct cardbus_softc
{
device_t sc_dev;
-#ifdef PCI_RES_BUS
struct resource *sc_bus;
-#endif
};
/*
diff --git a/sys/dev/ofw/ofw_pcib.c b/sys/dev/ofw/ofw_pcib.c
--- a/sys/dev/ofw/ofw_pcib.c
+++ b/sys/dev/ofw/ofw_pcib.c
@@ -421,17 +421,13 @@
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)
{
-#if defined(PCI_RES_BUS)
struct ofw_pci_softc *sc;
sc = device_get_softc(bus);
-#endif
switch (type) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_domain_alloc_bus(sc->sc_pci_domain, child, rid,
start, end, count, flags));
-#endif
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
return (bus_generic_rman_alloc_resource(bus, child, type, rid,
@@ -445,16 +441,12 @@
static int
ofw_pcib_release_resource(device_t bus, device_t child, struct resource *res)
{
-#if defined(PCI_RES_BUS)
struct ofw_pci_softc *sc;
sc = device_get_softc(bus);
-#endif
switch (rman_get_type(res)) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_domain_release_bus(sc->sc_pci_domain, child, res));
-#endif
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
return (bus_generic_rman_release_resource(bus, child, res));
@@ -505,16 +497,12 @@
static int
ofw_pcib_activate_resource(device_t bus, device_t child, struct resource *res)
{
-#if defined(PCI_RES_BUS)
struct ofw_pci_softc *sc;
sc = device_get_softc(bus);
-#endif
switch (rman_get_type(res)) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_domain_activate_bus(sc->sc_pci_domain, child, res));
-#endif
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
return (bus_generic_rman_activate_resource(bus, child, res));
@@ -621,17 +609,13 @@
static int
ofw_pcib_deactivate_resource(device_t bus, device_t child, struct resource *res)
{
-#if defined(PCI_RES_BUS)
struct ofw_pci_softc *sc;
sc = device_get_softc(bus);
-#endif
switch (rman_get_type(res)) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_domain_deactivate_bus(sc->sc_pci_domain, child,
res));
-#endif
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
return (bus_generic_rman_deactivate_resource(bus, child, res));
@@ -644,17 +628,13 @@
ofw_pcib_adjust_resource(device_t bus, device_t child,
struct resource *res, rman_res_t start, rman_res_t end)
{
-#if defined(PCI_RES_BUS)
struct ofw_pci_softc *sc;
sc = device_get_softc(bus);
-#endif
switch (rman_get_type(res)) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_domain_adjust_bus(sc->sc_pci_domain, child, res,
start, end));
-#endif
case SYS_RES_MEMORY:
case SYS_RES_IOPORT:
return (bus_generic_rman_adjust_resource(bus, child, res,
diff --git a/sys/dev/pccbb/pccbb_pci.c b/sys/dev/pccbb/pccbb_pci.c
--- a/sys/dev/pccbb/pccbb_pci.c
+++ b/sys/dev/pccbb/pccbb_pci.c
@@ -276,10 +276,6 @@
static int
cbb_pci_attach(device_t brdev)
{
-#if !defined(PCI_RES_BUS)
- static int curr_bus_number = 2; /* XXX EVILE BAD (see below) */
- uint32_t pribus;
-#endif
struct cbb_softc *sc = (struct cbb_softc *)device_get_softc(brdev);
struct sysctl_ctx_list *sctx;
struct sysctl_oid *soid;
@@ -293,13 +289,8 @@
sc->cbdev = NULL;
sc->domain = pci_get_domain(brdev);
sc->pribus = pcib_get_bus(parent);
-#if defined(PCI_RES_BUS)
pci_write_config(brdev, PCIR_PRIBUS_2, sc->pribus, 1);
pcib_setup_secbus(brdev, &sc->bus, 1);
-#else
- sc->bus.sec = pci_read_config(brdev, PCIR_SECBUS_2, 1);
- sc->bus.sub = pci_read_config(brdev, PCIR_SUBBUS_2, 1);
-#endif
SLIST_INIT(&sc->rl);
rid = CBBR_SOCKBASE;
@@ -351,32 +342,6 @@
CTLFLAG_RD, &sc->subbus, 0, "io range 2 open");
#endif
-#if !defined(PCI_RES_BUS)
- /*
- * This is a gross hack. We should be scanning the entire pci
- * tree, assigning bus numbers in a way such that we (1) can
- * reserve 1 extra bus just in case and (2) all sub buses
- * are in an appropriate range.
- */
- DEVPRINTF((brdev, "Secondary bus is %d\n", sc->bus.sec));
- pribus = pci_read_config(brdev, PCIR_PRIBUS_2, 1);
- if (sc->bus.sec == 0 || sc->pribus != pribus) {
- if (curr_bus_number <= sc->pribus)
- curr_bus_number = sc->pribus + 1;
- if (pribus != sc->pribus) {
- DEVPRINTF((brdev, "Setting primary bus to %d\n",
- sc->pribus));
- pci_write_config(brdev, PCIR_PRIBUS_2, sc->pribus, 1);
- }
- sc->bus.sec = curr_bus_number++;
- sc->bus.sub = curr_bus_number++;
- DEVPRINTF((brdev, "Secondary bus set to %d subbus %d\n",
- sc->bus.sec, sc->bus.sub));
- pci_write_config(brdev, PCIR_SECBUS_2, sc->bus.sec, 1);
- pci_write_config(brdev, PCIR_SUBBUS_2, sc->bus.sub, 1);
- }
-#endif
-
/* Map and establish the interrupt. */
rid = 0;
sc->irq_res = bus_alloc_resource_any(brdev, SYS_RES_IRQ, &rid,
@@ -429,16 +394,12 @@
static int
cbb_pci_detach(device_t brdev)
{
-#if defined(PCI_RES_BUS)
struct cbb_softc *sc = device_get_softc(brdev);
-#endif
int error;
error = cbb_detach(brdev);
-#if defined(PCI_RES_BUS)
if (error == 0)
pcib_free_secbus(brdev, &sc->bus);
-#endif
return (error);
}
@@ -787,7 +748,6 @@
return retval;
}
-#if defined(PCI_RES_BUS)
static struct resource *
cbb_pci_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)
@@ -836,7 +796,6 @@
}
return (cbb_release_resource(bus, child, r));
}
-#endif
/************************************************************************/
/* PCI compat methods */
@@ -931,14 +890,9 @@
/* bus methods */
DEVMETHOD(bus_read_ivar, cbb_read_ivar),
DEVMETHOD(bus_write_ivar, cbb_write_ivar),
-#if defined(PCI_RES_BUS)
DEVMETHOD(bus_alloc_resource, cbb_pci_alloc_resource),
DEVMETHOD(bus_adjust_resource, cbb_pci_adjust_resource),
DEVMETHOD(bus_release_resource, cbb_pci_release_resource),
-#else
- DEVMETHOD(bus_alloc_resource, cbb_alloc_resource),
- DEVMETHOD(bus_release_resource, cbb_release_resource),
-#endif
DEVMETHOD(bus_activate_resource, cbb_activate_resource),
DEVMETHOD(bus_deactivate_resource, cbb_deactivate_resource),
DEVMETHOD(bus_driver_added, cbb_driver_added),
diff --git a/sys/dev/pci/pci.c b/sys/dev/pci/pci.c
--- a/sys/dev/pci/pci.c
+++ b/sys/dev/pci/pci.c
@@ -405,11 +405,9 @@
SYSCTL_INT(_hw_pci, OID_AUTO, clear_bars, CTLFLAG_RDTUN, &pci_clear_bars, 0,
"Ignore firmware-assigned resources for BARs.");
-#if defined(PCI_RES_BUS)
static int pci_clear_buses;
SYSCTL_INT(_hw_pci, OID_AUTO, clear_buses, CTLFLAG_RDTUN, &pci_clear_buses, 0,
"Ignore firmware-assigned bus numbers.");
-#endif
static int pci_enable_ari = 1;
SYSCTL_INT(_hw_pci, OID_AUTO, enable_ari, CTLFLAG_RDTUN, &pci_enable_ari,
@@ -3706,7 +3704,6 @@
bus_release_resource(self, SYS_RES_MEMORY, rid, res);
}
-#if defined(PCI_RES_BUS)
static void
pci_reserve_secbus(device_t bus, device_t dev, pcicfgregs *cfg,
struct resource_list *rl)
@@ -3862,7 +3859,6 @@
return (resource_list_alloc(rl, dev, child, PCI_RES_BUS, rid, start,
end, count, flags));
}
-#endif
static int
pci_ea_bei_to_rid(device_t dev, int bei)
@@ -4118,13 +4114,11 @@
uhci_early_takeover(dev);
}
-#if defined(PCI_RES_BUS)
/*
* Reserve resources for secondary bus ranges behind bridge
* devices.
*/
pci_reserve_secbus(bus, dev, cfg, rl);
-#endif
}
static struct pci_devinfo *
@@ -4470,14 +4464,11 @@
{
struct pci_softc *sc;
int busno, domain;
-#ifdef PCI_RES_BUS
int rid;
-#endif
sc = device_get_softc(dev);
domain = pcib_get_domain(dev);
busno = pcib_get_bus(dev);
-#ifdef PCI_RES_BUS
rid = 0;
sc->sc_bus = bus_alloc_resource(dev, PCI_RES_BUS, &rid, busno, busno,
1, 0);
@@ -4485,7 +4476,6 @@
device_printf(dev, "failed to allocate bus number\n");
return (ENXIO);
}
-#endif
if (bootverbose)
device_printf(dev, "domain=%d, physical bus=%d\n",
domain, busno);
@@ -4517,20 +4507,16 @@
int
pci_detach(device_t dev)
{
-#ifdef PCI_RES_BUS
struct pci_softc *sc;
-#endif
int error;
error = bus_generic_detach(dev);
if (error)
return (error);
-#ifdef PCI_RES_BUS
sc = device_get_softc(dev);
error = bus_release_resource(dev, PCI_RES_BUS, 0, sc->sc_bus);
if (error)
return (error);
-#endif
return (device_delete_children(dev));
}
@@ -5111,10 +5097,8 @@
pci_printf(&dinfo->cfg, "Device leaked memory resources\n");
if (resource_list_release_active(rl, dev, child, SYS_RES_IOPORT) != 0)
pci_printf(&dinfo->cfg, "Device leaked I/O resources\n");
-#ifdef PCI_RES_BUS
if (resource_list_release_active(rl, dev, child, PCI_RES_BUS) != 0)
pci_printf(&dinfo->cfg, "Device leaked PCI bus numbers\n");
-#endif
pci_cfg_save(child, dinfo, 1);
}
@@ -5551,11 +5535,9 @@
rl = &dinfo->resources;
cfg = &dinfo->cfg;
switch (type) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_alloc_secbus(dev, child, rid, start, end, count,
flags));
-#endif
case SYS_RES_IRQ:
/*
* Can't alloc legacy interrupt once MSI messages have
diff --git a/sys/dev/pci/pci_host_generic.c b/sys/dev/pci/pci_host_generic.c
--- a/sys/dev/pci/pci_host_generic.c
+++ b/sys/dev/pci/pci_host_generic.c
@@ -416,16 +416,12 @@
pci_host_generic_core_release_resource(device_t dev, device_t child,
struct resource *res)
{
-#if defined(PCI_RES_BUS)
struct generic_pcie_core_softc *sc;
sc = device_get_softc(dev);
-#endif
switch (rman_get_type(res)) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_domain_release_bus(sc->ecam, child, res));
-#endif
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
return (bus_generic_rman_release_resource(dev, child, res));
@@ -506,22 +502,16 @@
pci_host_generic_core_alloc_resource(device_t dev, device_t child, int type,
int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
{
-#if defined(PCI_RES_BUS)
struct generic_pcie_core_softc *sc;
-#endif
struct resource *res;
-#if defined(PCI_RES_BUS)
sc = device_get_softc(dev);
-#endif
switch (type) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
res = pci_domain_alloc_bus(sc->ecam, child, rid, start, end,
count, flags);
break;
-#endif
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
res = bus_generic_rman_alloc_resource(dev, child, type, rid,
@@ -543,16 +533,12 @@
static int
generic_pcie_activate_resource(device_t dev, device_t child, struct resource *r)
{
-#if defined(PCI_RES_BUS)
struct generic_pcie_core_softc *sc;
sc = device_get_softc(dev);
-#endif
switch (rman_get_type(r)) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_domain_activate_bus(sc->ecam, child, r));
-#endif
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
return (bus_generic_rman_activate_resource(dev, child, r));
@@ -565,16 +551,12 @@
generic_pcie_deactivate_resource(device_t dev, device_t child,
struct resource *r)
{
-#if defined(PCI_RES_BUS)
struct generic_pcie_core_softc *sc;
sc = device_get_softc(dev);
-#endif
switch (rman_get_type(r)) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_domain_deactivate_bus(sc->ecam, child, r));
-#endif
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
return (bus_generic_rman_deactivate_resource(dev, child, r));
@@ -587,17 +569,13 @@
generic_pcie_adjust_resource(device_t dev, device_t child,
struct resource *res, rman_res_t start, rman_res_t end)
{
-#if defined(PCI_RES_BUS)
struct generic_pcie_core_softc *sc;
sc = device_get_softc(dev);
-#endif
switch (rman_get_type(res)) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (pci_domain_adjust_bus(sc->ecam, child, res, start,
end));
-#endif
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
return (bus_generic_rman_adjust_resource(dev, child, res,
@@ -619,10 +597,8 @@
type = rman_get_type(r);
switch (type) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (EINVAL);
-#endif
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
break;
@@ -658,10 +634,8 @@
type = rman_get_type(r);
switch (type) {
-#if defined(PCI_RES_BUS)
case PCI_RES_BUS:
return (EINVAL);
-#endif
case SYS_RES_IOPORT:
case SYS_RES_MEMORY:
break;
diff --git a/sys/dev/pci/pci_pci.c b/sys/dev/pci/pci_pci.c
--- a/sys/dev/pci/pci_pci.c
+++ b/sys/dev/pci/pci_pci.c
@@ -178,10 +178,8 @@
pcib_is_resource_managed(struct pcib_softc *sc, struct resource *r)
{
-#ifdef PCI_RES_BUS
if (rman_get_type(r) == PCI_RES_BUS)
return (rman_is_region_manager(r, &sc->bus.rman));
-#endif
return (pcib_get_resource_window(sc, r) != NULL);
}
@@ -605,7 +603,6 @@
pcib_release_window(sc, &sc->io, SYS_RES_IOPORT);
}
-#ifdef PCI_RES_BUS
/*
* Allocate a suitable secondary bus for this bridge if needed and
* initialize the resource manager for the secondary bus range. Note
@@ -793,7 +790,6 @@
flags));
return (NULL);
}
-#endif
#ifdef PCI_HP
/*
@@ -1400,10 +1396,6 @@
* Get current bridge configuration.
*/
sc->domain = pci_get_domain(dev);
-#if !defined(PCI_RES_BUS)
- sc->bus.sec = pci_read_config(dev, PCIR_SECBUS_1, 1);
- sc->bus.sub = pci_read_config(dev, PCIR_SUBBUS_1, 1);
-#endif
sc->bridgectl = pci_read_config(dev, PCIR_BRIDGECTL_1, 2);
/*
@@ -1431,20 +1423,6 @@
* Quirk handling.
*/
switch (pci_get_devid(dev)) {
-#if !defined(PCI_RES_BUS)
- case 0x12258086: /* Intel 82454KX/GX (Orion) */
- {
- uint8_t supbus;
-
- supbus = pci_read_config(dev, 0x41, 1);
- if (supbus != 0xff) {
- sc->bus.sec = supbus + 1;
- sc->bus.sub = supbus + 1;
- }
- break;
- }
-#endif
-
/*
* The i82380FB mobile docking controller is a PCI-PCI bridge,
* and it is a subtractive bridge. However, the ProgIf is wrong
@@ -1457,34 +1435,6 @@
case 0x060513d7: /* Toshiba ???? */
sc->flags |= PCIB_SUBTRACTIVE;
break;
-
-#if !defined(PCI_RES_BUS)
- /* Compaq R3000 BIOS sets wrong subordinate bus number. */
- case 0x00dd10de:
- {
- char *cp;
-
- if ((cp = kern_getenv("smbios.planar.maker")) == NULL)
- break;
- if (strncmp(cp, "Compal", 6) != 0) {
- freeenv(cp);
- break;
- }
- freeenv(cp);
- if ((cp = kern_getenv("smbios.planar.product")) == NULL)
- break;
- if (strncmp(cp, "08A0", 4) != 0) {
- freeenv(cp);
- break;
- }
- freeenv(cp);
- if (sc->bus.sub < 0xa) {
- pci_write_config(dev, PCIR_SUBBUS_1, 0xa, 1);
- sc->bus.sub = pci_read_config(dev, PCIR_SUBBUS_1, 1);
- }
- break;
- }
-#endif
}
if (pci_msi_device_blacklisted(dev))
@@ -1508,9 +1458,7 @@
#ifdef PCI_HP
pcib_probe_hotplug(sc);
#endif
-#ifdef PCI_RES_BUS
pcib_setup_secbus(dev, &sc->bus, 1);
-#endif
pcib_probe_windows(sc);
#ifdef PCI_HP
if (sc->flags & PCIB_HOTPLUG)
@@ -1617,9 +1565,7 @@
if (error)
return (error);
pcib_free_windows(sc);
-#ifdef PCI_RES_BUS
pcib_free_secbus(dev, &sc->bus);
-#endif
return (0);
}
@@ -2097,11 +2043,9 @@
}
switch (type) {
-#ifdef PCI_RES_BUS
case PCI_RES_BUS:
return (pcib_alloc_subbus(&sc->bus, child, rid, start, end,
count, flags));
-#endif
case SYS_RES_IOPORT:
if (pcib_is_isa_range(sc, start, end, count))
return (NULL);
@@ -2181,7 +2125,6 @@
if (!pcib_is_resource_managed(sc, r))
return (bus_generic_adjust_resource(bus, child, r, start, end));
-#ifdef PCI_RES_BUS
if (type == PCI_RES_BUS) {
/*
* If our bus range isn't big enough to grow the sub-allocation
@@ -2195,9 +2138,7 @@
if (error != 0)
return (error);
}
- } else
-#endif
- {
+ } else {
/*
* Resource is managed and not a secondary bus number, must
* be from one of our windows.
diff --git a/sys/dev/pci/pci_private.h b/sys/dev/pci/pci_private.h
--- a/sys/dev/pci/pci_private.h
+++ b/sys/dev/pci/pci_private.h
@@ -40,9 +40,7 @@
struct pci_softc {
bus_dma_tag_t sc_dma_tag;
-#ifdef PCI_RES_BUS
struct resource *sc_bus;
-#endif
};
extern int pci_do_power_resume;
diff --git a/sys/dev/pci/pci_subr.c b/sys/dev/pci/pci_subr.c
--- a/sys/dev/pci/pci_subr.c
+++ b/sys/dev/pci/pci_subr.c
@@ -283,7 +283,6 @@
return (ERANGE);
}
-#ifdef PCI_RES_BUS
struct pci_domain {
int pd_domain;
struct rman pd_bus_rman;
@@ -411,4 +410,3 @@
#endif
return (rman_deactivate_resource(r));
}
-#endif /* PCI_RES_BUS */
diff --git a/sys/dev/pci/pcib_private.h b/sys/dev/pci/pcib_private.h
--- a/sys/dev/pci/pcib_private.h
+++ b/sys/dev/pci/pcib_private.h
@@ -84,13 +84,11 @@
struct pcib_secbus {
u_int sec;
u_int sub;
-#if defined(PCI_RES_BUS)
device_t dev;
struct rman rman;
struct resource *res;
const char *name;
int sub_reg;
-#endif
};
/*
@@ -140,7 +138,6 @@
int host_pcib_get_busno(pci_read_config_fn read_config, int bus,
int slot, int func, uint8_t *busnum);
-#if defined(PCI_RES_BUS)
struct resource *pci_domain_alloc_bus(int domain, device_t dev, int *rid,
rman_res_t start, rman_res_t end, rman_res_t count, u_int flags);
int pci_domain_adjust_bus(int domain, device_t dev,
@@ -157,7 +154,6 @@
void pcib_free_secbus(device_t dev, struct pcib_secbus *bus);
void pcib_setup_secbus(device_t dev, struct pcib_secbus *bus,
int min_count);
-#endif
int pcib_attach(device_t dev);
int pcib_attach_child(device_t dev);
void pcib_attach_common(device_t dev);
diff --git a/sys/x86/pci/pci_bus.c b/sys/x86/pci/pci_bus.c
--- a/sys/x86/pci/pci_bus.c
+++ b/sys/x86/pci/pci_bus.c
@@ -595,17 +595,14 @@
rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
{
-#if defined(PCI_RES_BUS)
if (type == PCI_RES_BUS)
return (pci_domain_alloc_bus(0, child, rid, start, end, count,
flags));
-#endif
start = hostb_alloc_start(type, start, end, count);
return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
count, flags));
}
-#if defined(PCI_RES_BUS)
int
legacy_pcib_adjust_resource(device_t dev, device_t child,
struct resource *r, rman_res_t start, rman_res_t end)
@@ -641,7 +638,6 @@
return (pci_domain_deactivate_bus(0, child, r));
return (bus_generic_deactivate_resource(dev, child, r));
}
-#endif
static device_method_t legacy_pcib_methods[] = {
/* Device interface */
@@ -656,17 +652,10 @@
DEVMETHOD(bus_read_ivar, legacy_pcib_read_ivar),
DEVMETHOD(bus_write_ivar, legacy_pcib_write_ivar),
DEVMETHOD(bus_alloc_resource, legacy_pcib_alloc_resource),
-#if defined(PCI_RES_BUS)
DEVMETHOD(bus_adjust_resource, legacy_pcib_adjust_resource),
DEVMETHOD(bus_release_resource, legacy_pcib_release_resource),
DEVMETHOD(bus_activate_resource, legacy_pcib_activate_resource),
DEVMETHOD(bus_deactivate_resource, legacy_pcib_deactivate_resource),
-#else
- DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
- DEVMETHOD(bus_release_resource, bus_generic_release_resource),
- DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
- DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
-#endif
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
diff --git a/sys/x86/pci/qpi.c b/sys/x86/pci/qpi.c
--- a/sys/x86/pci/qpi.c
+++ b/sys/x86/pci/qpi.c
@@ -246,7 +246,6 @@
}
}
-#if defined(PCI_RES_BUS)
static struct resource *
qpi_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
@@ -258,7 +257,6 @@
return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
count, flags));
}
-#endif
static int
qpi_pcib_map_msi(device_t pcib, device_t dev, int irq, uint64_t *addr,
@@ -280,18 +278,11 @@
/* Bus interface */
DEVMETHOD(bus_read_ivar, qpi_pcib_read_ivar),
-#if defined(PCI_RES_BUS)
DEVMETHOD(bus_alloc_resource, qpi_pcib_alloc_resource),
DEVMETHOD(bus_adjust_resource, legacy_pcib_adjust_resource),
DEVMETHOD(bus_release_resource, legacy_pcib_release_resource),
DEVMETHOD(bus_activate_resource, legacy_pcib_activate_resource),
DEVMETHOD(bus_deactivate_resource, legacy_pcib_deactivate_resource),
-#else
- DEVMETHOD(bus_alloc_resource, bus_generic_alloc_resource),
- DEVMETHOD(bus_release_resource, bus_generic_release_resource),
- DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
- DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
-#endif
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
diff --git a/sys/x86/x86/mptable_pci.c b/sys/x86/x86/mptable_pci.c
--- a/sys/x86/x86/mptable_pci.c
+++ b/sys/x86/x86/mptable_pci.c
@@ -100,11 +100,9 @@
{
struct mptable_hostb_softc *sc;
-#ifdef PCI_RES_BUS
if (type == PCI_RES_BUS)
return (pci_domain_alloc_bus(0, child, rid, start, end, count,
flags));
-#endif
sc = device_get_softc(dev);
if (type == SYS_RES_IOPORT && start + count - 1 == end) {
if (mptable_is_isa_range(start, end)) {
@@ -141,10 +139,8 @@
{
struct mptable_hostb_softc *sc;
-#ifdef PCI_RES_BUS
if (rman_get_type(r) == PCI_RES_BUS)
return (pci_domain_adjust_bus(0, child, r, start, end));
-#endif
sc = device_get_softc(dev);
return (pcib_host_res_adjust(&sc->sc_host_res, child, r, start, end));
}
@@ -162,15 +158,9 @@
DEVMETHOD(bus_write_ivar, legacy_pcib_write_ivar),
DEVMETHOD(bus_alloc_resource, mptable_hostb_alloc_resource),
DEVMETHOD(bus_adjust_resource, mptable_hostb_adjust_resource),
-#if defined(PCI_RES_BUS)
DEVMETHOD(bus_release_resource, legacy_pcib_release_resource),
DEVMETHOD(bus_activate_resource, legacy_pcib_activate_resource),
DEVMETHOD(bus_deactivate_resource, legacy_pcib_deactivate_resource),
-#else
- DEVMETHOD(bus_release_resource, bus_generic_release_resource),
- DEVMETHOD(bus_activate_resource, bus_generic_activate_resource),
- DEVMETHOD(bus_deactivate_resource, bus_generic_deactivate_resource),
-#endif
DEVMETHOD(bus_setup_intr, bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 8, 8:47 AM (22 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
14531636
Default Alt Text
D32955.diff (31 KB)

Event Timeline