Retire non-NEW_PCIB code and remove config option

All architectures enable NEW_PCIB in DEFAULTS (arm being the most recent
to do so in 121be55599 (arm: Set NEW_PCIB in DEFAULTS rather than a
subset of kernel configs")), so it's time we removed the legacy code
that no longer sees much testing and has a significant maintenance
burden.

Reviewed by:	jhb, andrew, emaste
Differential Revision:	https://reviews.freebsd.org/D32954
This commit is contained in:
Jessica Clarke
2024-07-18 18:55:12 +01:00
parent 03248b3f50
commit 8415a654d0
32 changed files with 64 additions and 540 deletions
-2
View File
@@ -25,6 +25,4 @@ options GEOM_PART_GPT
# Default congestion control algorithm # Default congestion control algorithm
options CC_CUBIC # include CUBIC congestion control options CC_CUBIC # include CUBIC congestion control
options NEW_PCIB
options NETLINK # netlink(4) support options NETLINK # netlink(4) support
-2
View File
@@ -39,8 +39,6 @@
#define SYS_RES_DRQ 2 /* isa dma lines */ #define SYS_RES_DRQ 2 /* isa dma lines */
#define SYS_RES_MEMORY 3 /* i/o memory */ #define SYS_RES_MEMORY 3 /* i/o memory */
#define SYS_RES_IOPORT 4 /* i/o ports */ #define SYS_RES_IOPORT 4 /* i/o ports */
#ifdef NEW_PCIB
#define PCI_RES_BUS 5 /* PCI bus numbers */ #define PCI_RES_BUS 5 /* PCI bus numbers */
#endif
#endif /* !_MACHINE_RESOURCE_H_ */ #endif /* !_MACHINE_RESOURCE_H_ */
-1
View File
@@ -7,5 +7,4 @@ device mem
# Default congestion control algorithm # Default congestion control algorithm
options CC_CUBIC # include CUBIC congestion control options CC_CUBIC # include CUBIC congestion control
options NEW_PCIB
options INTRNG # All arm systems use INTRNG these days options INTRNG # All arm systems use INTRNG these days
-2
View File
@@ -40,8 +40,6 @@
#define SYS_RES_MEMORY 3 /* i/o memory */ #define SYS_RES_MEMORY 3 /* i/o memory */
#define SYS_RES_IOPORT 4 /* i/o ports */ #define SYS_RES_IOPORT 4 /* i/o ports */
#define SYS_RES_GPIO 5 /* general purpose i/o */ #define SYS_RES_GPIO 5 /* general purpose i/o */
#ifdef NEW_PCIB
#define PCI_RES_BUS 6 /* PCI bus numbers */ #define PCI_RES_BUS 6 /* PCI bus numbers */
#endif
#endif /* !_MACHINE_RESOURCE_H_ */ #endif /* !_MACHINE_RESOURCE_H_ */
+9 -9
View File
@@ -254,13 +254,13 @@ thunder_pem_write_ivar(device_t dev, device_t child, int index,
static int static int
thunder_pem_activate_resource(device_t dev, device_t child, struct resource *r) thunder_pem_activate_resource(device_t dev, device_t child, struct resource *r)
{ {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
struct thunder_pem_softc *sc; struct thunder_pem_softc *sc;
sc = device_get_softc(dev); sc = device_get_softc(dev);
#endif #endif
switch (rman_get_type(r)) { switch (rman_get_type(r)) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (pci_domain_activate_bus(sc->id, child, r)); return (pci_domain_activate_bus(sc->id, child, r));
#endif #endif
@@ -276,13 +276,13 @@ static int
thunder_pem_deactivate_resource(device_t dev, device_t child, thunder_pem_deactivate_resource(device_t dev, device_t child,
struct resource *r) struct resource *r)
{ {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
struct thunder_pem_softc *sc; struct thunder_pem_softc *sc;
sc = device_get_softc(dev); sc = device_get_softc(dev);
#endif #endif
switch (rman_get_type(r)) { switch (rman_get_type(r)) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (pci_domain_deactivate_bus(sc->id, child, r)); return (pci_domain_deactivate_bus(sc->id, child, r));
#endif #endif
@@ -350,13 +350,13 @@ static int
thunder_pem_adjust_resource(device_t dev, device_t child, struct resource *res, thunder_pem_adjust_resource(device_t dev, device_t child, struct resource *res,
rman_res_t start, rman_res_t end) rman_res_t start, rman_res_t end)
{ {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
struct thunder_pem_softc *sc; struct thunder_pem_softc *sc;
sc = device_get_softc(dev); sc = device_get_softc(dev);
#endif #endif
switch (rman_get_type(res)) { switch (rman_get_type(res)) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (pci_domain_adjust_bus(sc->id, child, res, start, end)); return (pci_domain_adjust_bus(sc->id, child, res, start, end));
#endif #endif
@@ -671,7 +671,7 @@ thunder_pem_alloc_resource(device_t dev, device_t child, int type, int *rid,
device_t parent_dev; device_t parent_dev;
switch (type) { switch (type) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (pci_domain_alloc_bus(sc->id, child, rid, start, end, return (pci_domain_alloc_bus(sc->id, child, rid, start, end,
count, flags)); count, flags));
@@ -718,12 +718,12 @@ static int
thunder_pem_release_resource(device_t dev, device_t child, struct resource *res) thunder_pem_release_resource(device_t dev, device_t child, struct resource *res)
{ {
device_t parent_dev; device_t parent_dev;
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
struct thunder_pem_softc *sc = device_get_softc(dev); struct thunder_pem_softc *sc = device_get_softc(dev);
#endif #endif
switch (rman_get_type(res)) { switch (rman_get_type(res)) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (pci_domain_release_bus(sc->id, child, res)); return (pci_domain_release_bus(sc->id, child, res));
#endif #endif
-1
View File
@@ -15,7 +15,6 @@ options GEOM_PART_GPT
# Default congestion control algorithm # Default congestion control algorithm
options CC_CUBIC # include CUBIC congestion control options CC_CUBIC # include CUBIC congestion control
options NEW_PCIB
options INTRNG options INTRNG
options NETLINK # netlink(4) support options NETLINK # netlink(4) support
-2
View File
@@ -44,9 +44,7 @@
#define SYS_RES_MEMORY 3 /* i/o memory */ #define SYS_RES_MEMORY 3 /* i/o memory */
#define SYS_RES_IOPORT 4 /* i/o ports */ #define SYS_RES_IOPORT 4 /* i/o ports */
#define SYS_RES_GPIO 5 /* general purpose i/o */ #define SYS_RES_GPIO 5 /* general purpose i/o */
#ifdef NEW_PCIB
#define PCI_RES_BUS 6 /* PCI bus numbers */ #define PCI_RES_BUS 6 /* PCI bus numbers */
#endif
#endif /* !_MACHINE_RESOURCE_H_ */ #endif /* !_MACHINE_RESOURCE_H_ */
+3 -3
View File
@@ -59,9 +59,9 @@ opt_sctp.h:
opt_wlan.h: opt_wlan.h:
echo "#define IEEE80211_DEBUG 1" > ${.TARGET} echo "#define IEEE80211_DEBUG 1" > ${.TARGET}
echo "#define IEEE80211_SUPPORT_MESH 1" >> ${.TARGET} echo "#define IEEE80211_SUPPORT_MESH 1" >> ${.TARGET}
KERN_OPTS.i386=NEW_PCIB DEV_PCI KERN_OPTS.i386=DEV_PCI
KERN_OPTS.amd64=NEW_PCIB DEV_PCI KERN_OPTS.amd64=DEV_PCI
KERN_OPTS.powerpc=NEW_PCIB DEV_PCI KERN_OPTS.powerpc=DEV_PCI
KERN_OPTS=MROUTING IEEE80211_DEBUG \ KERN_OPTS=MROUTING IEEE80211_DEBUG \
IEEE80211_SUPPORT_MESH DEV_BPF \ IEEE80211_SUPPORT_MESH DEV_BPF \
${KERN_OPTS.${MACHINE}} ${KERN_OPTS_EXTRA} ${KERN_OPTS.${MACHINE}} ${KERN_OPTS_EXTRA}
-1
View File
@@ -186,7 +186,6 @@ MFI_DEBUG opt_mfi.h
MFI_DECODE_LOG opt_mfi.h MFI_DECODE_LOG opt_mfi.h
MPROF_BUFFERS opt_mprof.h MPROF_BUFFERS opt_mprof.h
MPROF_HASH_SIZE opt_mprof.h MPROF_HASH_SIZE opt_mprof.h
NEW_PCIB opt_global.h
NO_ADAPTIVE_MUTEXES opt_adaptive_mutexes.h NO_ADAPTIVE_MUTEXES opt_adaptive_mutexes.h
NO_ADAPTIVE_RWLOCKS NO_ADAPTIVE_RWLOCKS
NO_ADAPTIVE_SX NO_ADAPTIVE_SX
+5 -26
View File
@@ -67,9 +67,7 @@ struct acpi_hpcib_softc {
int ap_addr; /* device/func of PCI-Host bridge */ int ap_addr; /* device/func of PCI-Host bridge */
ACPI_BUFFER ap_prt; /* interrupt routing table */ ACPI_BUFFER ap_prt; /* interrupt routing table */
#ifdef NEW_PCIB
struct pcib_host_resources ap_host_res; struct pcib_host_resources ap_host_res;
#endif
}; };
static int acpi_pcib_acpi_probe(device_t bus); static int acpi_pcib_acpi_probe(device_t bus);
@@ -95,7 +93,6 @@ static struct resource *acpi_pcib_acpi_alloc_resource(device_t dev,
device_t child, int type, int *rid, device_t child, int type, int *rid,
rman_res_t start, rman_res_t end, rman_res_t count, rman_res_t start, rman_res_t end, rman_res_t count,
u_int flags); u_int flags);
#ifdef NEW_PCIB
static int acpi_pcib_acpi_adjust_resource(device_t dev, static int acpi_pcib_acpi_adjust_resource(device_t dev,
device_t child, struct resource *r, device_t child, struct resource *r,
rman_res_t start, rman_res_t end); rman_res_t start, rman_res_t end);
@@ -107,7 +104,6 @@ static int acpi_pcib_acpi_activate_resource(device_t dev,
static int acpi_pcib_acpi_deactivate_resource(device_t dev, static int acpi_pcib_acpi_deactivate_resource(device_t dev,
device_t child, struct resource *r); device_t child, struct resource *r);
#endif #endif
#endif
static int acpi_pcib_request_feature(device_t pcib, device_t dev, static int acpi_pcib_request_feature(device_t pcib, device_t dev,
enum pci_feature feature); enum pci_feature feature);
static bus_dma_tag_t acpi_pcib_get_dma_tag(device_t bus, device_t child); static bus_dma_tag_t acpi_pcib_get_dma_tag(device_t bus, device_t child);
@@ -124,12 +120,8 @@ static device_method_t acpi_pcib_acpi_methods[] = {
DEVMETHOD(bus_read_ivar, acpi_pcib_read_ivar), DEVMETHOD(bus_read_ivar, acpi_pcib_read_ivar),
DEVMETHOD(bus_write_ivar, acpi_pcib_write_ivar), DEVMETHOD(bus_write_ivar, acpi_pcib_write_ivar),
DEVMETHOD(bus_alloc_resource, acpi_pcib_acpi_alloc_resource), DEVMETHOD(bus_alloc_resource, acpi_pcib_acpi_alloc_resource),
#ifdef NEW_PCIB
DEVMETHOD(bus_adjust_resource, acpi_pcib_acpi_adjust_resource), DEVMETHOD(bus_adjust_resource, acpi_pcib_acpi_adjust_resource),
#else #if defined(PCI_RES_BUS)
DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
#endif
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
DEVMETHOD(bus_release_resource, acpi_pcib_acpi_release_resource), DEVMETHOD(bus_release_resource, acpi_pcib_acpi_release_resource),
DEVMETHOD(bus_activate_resource, acpi_pcib_acpi_activate_resource), DEVMETHOD(bus_activate_resource, acpi_pcib_acpi_activate_resource),
DEVMETHOD(bus_deactivate_resource, acpi_pcib_acpi_deactivate_resource), DEVMETHOD(bus_deactivate_resource, acpi_pcib_acpi_deactivate_resource),
@@ -183,7 +175,6 @@ acpi_pcib_acpi_probe(device_t dev)
return (0); return (0);
} }
#ifdef NEW_PCIB
static ACPI_STATUS static ACPI_STATUS
acpi_pcib_producer_handler(ACPI_RESOURCE *res, void *context) acpi_pcib_producer_handler(ACPI_RESOURCE *res, void *context)
{ {
@@ -290,9 +281,8 @@ acpi_pcib_producer_handler(ACPI_RESOURCE *res, void *context)
} }
return (AE_OK); return (AE_OK);
} }
#endif
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
static bool static bool
get_decoded_bus_range(struct acpi_hpcib_softc *sc, rman_res_t *startp, get_decoded_bus_range(struct acpi_hpcib_softc *sc, rman_res_t *startp,
rman_res_t *endp) rman_res_t *endp)
@@ -371,7 +361,7 @@ acpi_pcib_acpi_attach(device_t dev)
ACPI_STATUS status; ACPI_STATUS status;
static int bus0_seen = 0; static int bus0_seen = 0;
u_int slot, func, busok; u_int slot, func, busok;
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
struct resource *bus_res; struct resource *bus_res;
rman_res_t end, start; rman_res_t end, start;
int rid; int rid;
@@ -421,7 +411,6 @@ acpi_pcib_acpi_attach(device_t dev)
sc->ap_addr = -1; sc->ap_addr = -1;
} }
#ifdef NEW_PCIB
/* /*
* Determine which address ranges this bridge decodes and setup * Determine which address ranges this bridge decodes and setup
* resource managers for those ranges. * resource managers for those ranges.
@@ -435,7 +424,6 @@ acpi_pcib_acpi_attach(device_t dev)
device_printf(sc->ap_dev, "failed to parse resources: %s\n", device_printf(sc->ap_dev, "failed to parse resources: %s\n",
AcpiFormatException(status)); AcpiFormatException(status));
} }
#endif
/* /*
* Get our base bus number by evaluating _BBN. * Get our base bus number by evaluating _BBN.
@@ -491,7 +479,7 @@ acpi_pcib_acpi_attach(device_t dev)
} }
} }
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
/* /*
* If nothing else worked, hope that ACPI at least lays out the * 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 * Host-PCI bridges in order and that as a result the next free
@@ -578,7 +566,7 @@ acpi_pcib_acpi_attach(device_t dev)
errout: errout:
device_printf(device_get_parent(dev), "couldn't attach pci bus\n"); device_printf(device_get_parent(dev), "couldn't attach pci bus\n");
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
pcib_host_res_free(dev, &sc->ap_host_res); pcib_host_res_free(dev, &sc->ap_host_res);
#endif #endif
return (error); return (error);
@@ -704,16 +692,13 @@ struct resource *
acpi_pcib_acpi_alloc_resource(device_t dev, device_t child, int type, int *rid, acpi_pcib_acpi_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) rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
{ {
#ifdef NEW_PCIB
struct acpi_hpcib_softc *sc; struct acpi_hpcib_softc *sc;
struct resource *res; struct resource *res;
#endif
#if defined(__i386__) || defined(__amd64__) #if defined(__i386__) || defined(__amd64__)
start = hostb_alloc_start(type, start, end, count); start = hostb_alloc_start(type, start, end, count);
#endif #endif
#ifdef NEW_PCIB
sc = device_get_softc(dev); sc = device_get_softc(dev);
#ifdef PCI_RES_BUS #ifdef PCI_RES_BUS
if (type == PCI_RES_BUS) if (type == PCI_RES_BUS)
@@ -734,13 +719,8 @@ acpi_pcib_acpi_alloc_resource(device_t dev, device_t child, int type, int *rid,
res = bus_generic_alloc_resource(dev, child, type, rid, start, end, res = bus_generic_alloc_resource(dev, child, type, rid, start, end,
count, flags); count, flags);
return (res); return (res);
#else
return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
count, flags));
#endif
} }
#ifdef NEW_PCIB
int int
acpi_pcib_acpi_adjust_resource(device_t dev, device_t child, acpi_pcib_acpi_adjust_resource(device_t dev, device_t child,
struct resource *r, rman_res_t start, rman_res_t end) struct resource *r, rman_res_t start, rman_res_t end)
@@ -793,7 +773,6 @@ acpi_pcib_acpi_deactivate_resource(device_t dev, device_t child,
return (bus_generic_deactivate_resource(dev, child, r)); return (bus_generic_deactivate_resource(dev, child, r));
} }
#endif #endif
#endif
static int static int
acpi_pcib_request_feature(device_t pcib, device_t dev, enum pci_feature feature) acpi_pcib_request_feature(device_t pcib, device_t dev, enum pci_feature feature)
-3
View File
@@ -25,7 +25,6 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
#ifdef NEW_PCIB
#include "opt_acpi.h" #include "opt_acpi.h"
#include <sys/param.h> #include <sys/param.h>
@@ -2042,5 +2041,3 @@ DEFINE_CLASS_0(pcib, vmbus_pcib_driver, vmbus_pcib_methods,
DRIVER_MODULE(vmbus_pcib, vmbus, vmbus_pcib_driver, 0, 0); DRIVER_MODULE(vmbus_pcib, vmbus, vmbus_pcib_driver, 0, 0);
MODULE_DEPEND(vmbus_pcib, vmbus, 1, 1, 1); MODULE_DEPEND(vmbus_pcib, vmbus, 1, 1, 1);
MODULE_DEPEND(vmbus_pcib, pci, 1, 1, 1); MODULE_DEPEND(vmbus_pcib, pci, 1, 1, 1);
#endif /* NEW_PCIB */
+1 -10
View File
@@ -1069,15 +1069,12 @@ vmbus_alloc_resource(device_t dev, device_t child, int type, int *rid,
device_t parent = device_get_parent(dev); device_t parent = device_get_parent(dev);
struct resource *res; struct resource *res;
#ifdef NEW_PCIB
if (type == SYS_RES_MEMORY) { if (type == SYS_RES_MEMORY) {
struct vmbus_softc *sc = device_get_softc(dev); struct vmbus_softc *sc = device_get_softc(dev);
res = pcib_host_res_alloc(&sc->vmbus_mmio_res, child, type, res = pcib_host_res_alloc(&sc->vmbus_mmio_res, child, type,
rid, start, end, count, flags); rid, start, end, count, flags);
} else } else {
#endif
{
res = BUS_ALLOC_RESOURCE(parent, child, type, rid, start, res = BUS_ALLOC_RESOURCE(parent, child, type, rid, start,
end, count, flags); end, count, flags);
} }
@@ -1158,7 +1155,6 @@ vmbus_get_eventtq_method(device_t bus, device_t dev __unused, int cpu)
return (VMBUS_PCPU_GET(sc, event_tq, cpu)); return (VMBUS_PCPU_GET(sc, event_tq, cpu));
} }
#ifdef NEW_PCIB
#define VTPM_BASE_ADDR 0xfed40000 #define VTPM_BASE_ADDR 0xfed40000
#define FOUR_GB (1ULL << 32) #define FOUR_GB (1ULL << 32)
@@ -1375,7 +1371,6 @@ vmbus_free_mmio_res(device_t dev)
if (hv_fb_res) if (hv_fb_res)
hv_fb_res = NULL; hv_fb_res = NULL;
} }
#endif /* NEW_PCIB */
static void static void
vmbus_identify(driver_t *driver, device_t parent) vmbus_identify(driver_t *driver, device_t parent)
@@ -1460,10 +1455,8 @@ vmbus_doattach(struct vmbus_softc *sc)
if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED) if (sc->vmbus_flags & VMBUS_FLAG_ATTACHED)
return (0); return (0);
#ifdef NEW_PCIB
vmbus_get_mmio_res(sc->vmbus_dev); vmbus_get_mmio_res(sc->vmbus_dev);
vmbus_fb_mmio_res(sc->vmbus_dev); vmbus_fb_mmio_res(sc->vmbus_dev);
#endif
sc->vmbus_flags |= VMBUS_FLAG_ATTACHED; sc->vmbus_flags |= VMBUS_FLAG_ATTACHED;
@@ -1681,9 +1674,7 @@ vmbus_detach(device_t dev)
mtx_destroy(&sc->vmbus_prichan_lock); mtx_destroy(&sc->vmbus_prichan_lock);
mtx_destroy(&sc->vmbus_chan_lock); mtx_destroy(&sc->vmbus_chan_lock);
#ifdef NEW_PCIB
vmbus_free_mmio_res(dev); vmbus_free_mmio_res(dev);
#endif
#if defined(__aarch64__) #if defined(__aarch64__)
bus_release_resource(device_get_parent(dev), SYS_RES_IRQ, sc->vector, bus_release_resource(device_get_parent(dev), SYS_RES_IRQ, sc->vector,
-2
View File
@@ -127,10 +127,8 @@ struct vmbus_softc {
struct intr_config_hook vmbus_intrhook; struct intr_config_hook vmbus_intrhook;
#ifdef NEW_PCIB
/* The list of usable MMIO ranges for PCIe pass-through */ /* The list of usable MMIO ranges for PCIe pass-through */
struct pcib_host_resources vmbus_mmio_res; struct pcib_host_resources vmbus_mmio_res;
#endif
#if defined(__aarch64__) #if defined(__aarch64__)
struct resource *ires; struct resource *ires;
+10 -10
View File
@@ -421,13 +421,13 @@ 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(NEW_PCIB) && defined(PCI_RES_BUS) #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 #endif
switch (type) { switch (type) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #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));
@@ -445,13 +445,13 @@ ofw_pcib_alloc_resource(device_t bus, device_t child, int type, int *rid,
static int static int
ofw_pcib_release_resource(device_t bus, device_t child, struct resource *res) ofw_pcib_release_resource(device_t bus, device_t child, struct resource *res)
{ {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #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 #endif
switch (rman_get_type(res)) { switch (rman_get_type(res)) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (pci_domain_release_bus(sc->sc_pci_domain, child, res)); return (pci_domain_release_bus(sc->sc_pci_domain, child, res));
#endif #endif
@@ -505,13 +505,13 @@ ofw_pcib_translate_resource(device_t bus, int type, rman_res_t start,
static int static int
ofw_pcib_activate_resource(device_t bus, device_t child, struct resource *res) ofw_pcib_activate_resource(device_t bus, device_t child, struct resource *res)
{ {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #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 #endif
switch (rman_get_type(res)) { switch (rman_get_type(res)) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (pci_domain_activate_bus(sc->sc_pci_domain, child, res)); return (pci_domain_activate_bus(sc->sc_pci_domain, child, res));
#endif #endif
@@ -621,13 +621,13 @@ ofw_pcib_bus_get_bus_tag(device_t bus, device_t child)
static int static int
ofw_pcib_deactivate_resource(device_t bus, device_t child, struct resource *res) ofw_pcib_deactivate_resource(device_t bus, device_t child, struct resource *res)
{ {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #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 #endif
switch (rman_get_type(res)) { switch (rman_get_type(res)) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (pci_domain_deactivate_bus(sc->sc_pci_domain, child, return (pci_domain_deactivate_bus(sc->sc_pci_domain, child,
res)); res));
@@ -644,13 +644,13 @@ static int
ofw_pcib_adjust_resource(device_t bus, device_t child, ofw_pcib_adjust_resource(device_t bus, device_t child,
struct resource *res, rman_res_t start, rman_res_t end) struct resource *res, rman_res_t start, rman_res_t end)
{ {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #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 #endif
switch (rman_get_type(res)) { switch (rman_get_type(res)) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #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));
+7 -7
View File
@@ -276,7 +276,7 @@ cbb_print_config(device_t dev)
static int static int
cbb_pci_attach(device_t brdev) cbb_pci_attach(device_t brdev)
{ {
#if !(defined(NEW_PCIB) && defined(PCI_RES_BUS)) #if !defined(PCI_RES_BUS)
static int curr_bus_number = 2; /* XXX EVILE BAD (see below) */ static int curr_bus_number = 2; /* XXX EVILE BAD (see below) */
uint32_t pribus; uint32_t pribus;
#endif #endif
@@ -293,7 +293,7 @@ cbb_pci_attach(device_t brdev)
sc->cbdev = NULL; sc->cbdev = NULL;
sc->domain = pci_get_domain(brdev); sc->domain = pci_get_domain(brdev);
sc->pribus = pcib_get_bus(parent); sc->pribus = pcib_get_bus(parent);
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
pci_write_config(brdev, PCIR_PRIBUS_2, sc->pribus, 1); pci_write_config(brdev, PCIR_PRIBUS_2, sc->pribus, 1);
pcib_setup_secbus(brdev, &sc->bus, 1); pcib_setup_secbus(brdev, &sc->bus, 1);
#else #else
@@ -351,7 +351,7 @@ cbb_pci_attach(device_t brdev)
CTLFLAG_RD, &sc->subbus, 0, "io range 2 open"); CTLFLAG_RD, &sc->subbus, 0, "io range 2 open");
#endif #endif
#if !(defined(NEW_PCIB) && defined(PCI_RES_BUS)) #if !defined(PCI_RES_BUS)
/* /*
* This is a gross hack. We should be scanning the entire pci * This is a gross hack. We should be scanning the entire pci
* tree, assigning bus numbers in a way such that we (1) can * tree, assigning bus numbers in a way such that we (1) can
@@ -429,13 +429,13 @@ cbb_pci_attach(device_t brdev)
static int static int
cbb_pci_detach(device_t brdev) cbb_pci_detach(device_t brdev)
{ {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
struct cbb_softc *sc = device_get_softc(brdev); struct cbb_softc *sc = device_get_softc(brdev);
#endif #endif
int error; int error;
error = cbb_detach(brdev); error = cbb_detach(brdev);
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
if (error == 0) if (error == 0)
pcib_free_secbus(brdev, &sc->bus); pcib_free_secbus(brdev, &sc->bus);
#endif #endif
@@ -787,7 +787,7 @@ cbb_pci_filt(void *arg)
return retval; return retval;
} }
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
static struct resource * static struct resource *
cbb_pci_alloc_resource(device_t bus, device_t child, int type, int *rid, 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) rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
@@ -931,7 +931,7 @@ static device_method_t cbb_methods[] = {
/* bus methods */ /* bus methods */
DEVMETHOD(bus_read_ivar, cbb_read_ivar), DEVMETHOD(bus_read_ivar, cbb_read_ivar),
DEVMETHOD(bus_write_ivar, cbb_write_ivar), DEVMETHOD(bus_write_ivar, cbb_write_ivar),
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
DEVMETHOD(bus_alloc_resource, cbb_pci_alloc_resource), DEVMETHOD(bus_alloc_resource, cbb_pci_alloc_resource),
DEVMETHOD(bus_adjust_resource, cbb_pci_adjust_resource), DEVMETHOD(bus_adjust_resource, cbb_pci_adjust_resource),
DEVMETHOD(bus_release_resource, cbb_pci_release_resource), DEVMETHOD(bus_release_resource, cbb_pci_release_resource),
+4 -8
View File
@@ -405,7 +405,7 @@ static int pci_clear_bars;
SYSCTL_INT(_hw_pci, OID_AUTO, clear_bars, CTLFLAG_RDTUN, &pci_clear_bars, 0, SYSCTL_INT(_hw_pci, OID_AUTO, clear_bars, CTLFLAG_RDTUN, &pci_clear_bars, 0,
"Ignore firmware-assigned resources for BARs."); "Ignore firmware-assigned resources for BARs.");
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
static int pci_clear_buses; static int pci_clear_buses;
SYSCTL_INT(_hw_pci, OID_AUTO, clear_buses, CTLFLAG_RDTUN, &pci_clear_buses, 0, SYSCTL_INT(_hw_pci, OID_AUTO, clear_buses, CTLFLAG_RDTUN, &pci_clear_buses, 0,
"Ignore firmware-assigned bus numbers."); "Ignore firmware-assigned bus numbers.");
@@ -3706,7 +3706,7 @@ xhci_early_takeover(device_t self)
bus_release_resource(self, SYS_RES_MEMORY, rid, res); bus_release_resource(self, SYS_RES_MEMORY, rid, res);
} }
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
static void static void
pci_reserve_secbus(device_t bus, device_t dev, pcicfgregs *cfg, pci_reserve_secbus(device_t bus, device_t dev, pcicfgregs *cfg,
struct resource_list *rl) struct resource_list *rl)
@@ -4118,7 +4118,7 @@ pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask)
uhci_early_takeover(dev); uhci_early_takeover(dev);
} }
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
/* /*
* Reserve resources for secondary bus ranges behind bridge * Reserve resources for secondary bus ranges behind bridge
* devices. * devices.
@@ -5551,7 +5551,7 @@ pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid,
rl = &dinfo->resources; rl = &dinfo->resources;
cfg = &dinfo->cfg; cfg = &dinfo->cfg;
switch (type) { switch (type) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (pci_alloc_secbus(dev, child, rid, start, end, count, return (pci_alloc_secbus(dev, child, rid, start, end, count,
flags)); flags));
@@ -5576,7 +5576,6 @@ pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid,
break; break;
case SYS_RES_IOPORT: case SYS_RES_IOPORT:
case SYS_RES_MEMORY: case SYS_RES_MEMORY:
#ifdef NEW_PCIB
/* /*
* PCI-PCI bridge I/O window resources are not BARs. * PCI-PCI bridge I/O window resources are not BARs.
* For those allocations just pass the request up the * For those allocations just pass the request up the
@@ -5595,7 +5594,6 @@ pci_alloc_multi_resource(device_t dev, device_t child, int type, int *rid,
type, rid, start, end, count, flags)); type, rid, start, end, count, flags));
} }
} }
#endif
/* Reserve resources for this BAR if needed. */ /* Reserve resources for this BAR if needed. */
rle = resource_list_find(rl, type, *rid); rle = resource_list_find(rl, type, *rid);
if (rle == NULL) { if (rle == NULL) {
@@ -5668,7 +5666,6 @@ pci_release_resource(device_t dev, device_t child, struct resource *r)
} }
#endif #endif
#ifdef NEW_PCIB
/* /*
* PCI-PCI bridge I/O window resources are not BARs. For * PCI-PCI bridge I/O window resources are not BARs. For
* those allocations just pass the request up the tree. * those allocations just pass the request up the tree.
@@ -5683,7 +5680,6 @@ pci_release_resource(device_t dev, device_t child, struct resource *r)
return (bus_generic_release_resource(dev, child, r)); return (bus_generic_release_resource(dev, child, r));
} }
} }
#endif
rl = &dinfo->resources; rl = &dinfo->resources;
return (resource_list_release(rl, dev, child, r)); return (resource_list_release(rl, dev, child, r));
+13 -13
View File
@@ -416,13 +416,13 @@ int
pci_host_generic_core_release_resource(device_t dev, device_t child, pci_host_generic_core_release_resource(device_t dev, device_t child,
struct resource *res) struct resource *res)
{ {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
struct generic_pcie_core_softc *sc; struct generic_pcie_core_softc *sc;
sc = device_get_softc(dev); sc = device_get_softc(dev);
#endif #endif
switch (rman_get_type(res)) { switch (rman_get_type(res)) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (pci_domain_release_bus(sc->ecam, child, res)); return (pci_domain_release_bus(sc->ecam, child, res));
#endif #endif
@@ -506,17 +506,17 @@ struct resource *
pci_host_generic_core_alloc_resource(device_t dev, device_t child, int type, 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) int *rid, rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
{ {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
struct generic_pcie_core_softc *sc; struct generic_pcie_core_softc *sc;
#endif #endif
struct resource *res; struct resource *res;
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
sc = device_get_softc(dev); sc = device_get_softc(dev);
#endif #endif
switch (type) { switch (type) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
res = pci_domain_alloc_bus(sc->ecam, child, rid, start, end, res = pci_domain_alloc_bus(sc->ecam, child, rid, start, end,
count, flags); count, flags);
@@ -543,13 +543,13 @@ pci_host_generic_core_alloc_resource(device_t dev, device_t child, int type,
static int static int
generic_pcie_activate_resource(device_t dev, device_t child, struct resource *r) generic_pcie_activate_resource(device_t dev, device_t child, struct resource *r)
{ {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
struct generic_pcie_core_softc *sc; struct generic_pcie_core_softc *sc;
sc = device_get_softc(dev); sc = device_get_softc(dev);
#endif #endif
switch (rman_get_type(r)) { switch (rman_get_type(r)) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (pci_domain_activate_bus(sc->ecam, child, r)); return (pci_domain_activate_bus(sc->ecam, child, r));
#endif #endif
@@ -565,13 +565,13 @@ static int
generic_pcie_deactivate_resource(device_t dev, device_t child, generic_pcie_deactivate_resource(device_t dev, device_t child,
struct resource *r) struct resource *r)
{ {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
struct generic_pcie_core_softc *sc; struct generic_pcie_core_softc *sc;
sc = device_get_softc(dev); sc = device_get_softc(dev);
#endif #endif
switch (rman_get_type(r)) { switch (rman_get_type(r)) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (pci_domain_deactivate_bus(sc->ecam, child, r)); return (pci_domain_deactivate_bus(sc->ecam, child, r));
#endif #endif
@@ -587,13 +587,13 @@ static int
generic_pcie_adjust_resource(device_t dev, device_t child, generic_pcie_adjust_resource(device_t dev, device_t child,
struct resource *res, rman_res_t start, rman_res_t end) struct resource *res, rman_res_t start, rman_res_t end)
{ {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
struct generic_pcie_core_softc *sc; struct generic_pcie_core_softc *sc;
sc = device_get_softc(dev); sc = device_get_softc(dev);
#endif #endif
switch (rman_get_type(res)) { switch (rman_get_type(res)) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (pci_domain_adjust_bus(sc->ecam, child, res, start, return (pci_domain_adjust_bus(sc->ecam, child, res, start,
end)); end));
@@ -619,7 +619,7 @@ generic_pcie_map_resource(device_t dev, device_t child, struct resource *r,
type = rman_get_type(r); type = rman_get_type(r);
switch (type) { switch (type) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (EINVAL); return (EINVAL);
#endif #endif
@@ -658,7 +658,7 @@ generic_pcie_unmap_resource(device_t dev, device_t child, struct resource *r,
type = rman_get_type(r); type = rman_get_type(r);
switch (type) { switch (type) {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
case PCI_RES_BUS: case PCI_RES_BUS:
return (EINVAL); return (EINVAL);
#endif #endif
+4 -370
View File
@@ -58,19 +58,16 @@
#include "pcib_if.h" #include "pcib_if.h"
static int pcib_probe(device_t dev); static int pcib_probe(device_t dev);
static int pcib_suspend(device_t dev);
static int pcib_resume(device_t dev); static int pcib_resume(device_t dev);
static bus_child_present_t pcib_child_present; static bus_child_present_t pcib_child_present;
static bus_alloc_resource_t pcib_alloc_resource; static bus_alloc_resource_t pcib_alloc_resource;
#ifdef NEW_PCIB
static bus_adjust_resource_t pcib_adjust_resource; static bus_adjust_resource_t pcib_adjust_resource;
static bus_release_resource_t pcib_release_resource; static bus_release_resource_t pcib_release_resource;
static bus_activate_resource_t pcib_activate_resource; static bus_activate_resource_t pcib_activate_resource;
static bus_deactivate_resource_t pcib_deactivate_resource; static bus_deactivate_resource_t pcib_deactivate_resource;
static bus_map_resource_t pcib_map_resource; static bus_map_resource_t pcib_map_resource;
static bus_unmap_resource_t pcib_unmap_resource; static bus_unmap_resource_t pcib_unmap_resource;
#endif
static int pcib_reset_child(device_t dev, device_t child, int flags); static int pcib_reset_child(device_t dev, device_t child, int flags);
static int pcib_power_for_sleep(device_t pcib, device_t dev, static int pcib_power_for_sleep(device_t pcib, device_t dev,
@@ -101,7 +98,7 @@ static device_method_t pcib_methods[] = {
DEVMETHOD(device_attach, pcib_attach), DEVMETHOD(device_attach, pcib_attach),
DEVMETHOD(device_detach, pcib_detach), DEVMETHOD(device_detach, pcib_detach),
DEVMETHOD(device_shutdown, bus_generic_shutdown), DEVMETHOD(device_shutdown, bus_generic_shutdown),
DEVMETHOD(device_suspend, pcib_suspend), DEVMETHOD(device_suspend, bus_generic_suspend),
DEVMETHOD(device_resume, pcib_resume), DEVMETHOD(device_resume, pcib_resume),
/* Bus interface */ /* Bus interface */
@@ -109,19 +106,12 @@ static device_method_t pcib_methods[] = {
DEVMETHOD(bus_read_ivar, pcib_read_ivar), DEVMETHOD(bus_read_ivar, pcib_read_ivar),
DEVMETHOD(bus_write_ivar, pcib_write_ivar), DEVMETHOD(bus_write_ivar, pcib_write_ivar),
DEVMETHOD(bus_alloc_resource, pcib_alloc_resource), DEVMETHOD(bus_alloc_resource, pcib_alloc_resource),
#ifdef NEW_PCIB
DEVMETHOD(bus_adjust_resource, pcib_adjust_resource), DEVMETHOD(bus_adjust_resource, pcib_adjust_resource),
DEVMETHOD(bus_release_resource, pcib_release_resource), DEVMETHOD(bus_release_resource, pcib_release_resource),
DEVMETHOD(bus_activate_resource, pcib_activate_resource), DEVMETHOD(bus_activate_resource, pcib_activate_resource),
DEVMETHOD(bus_deactivate_resource, pcib_deactivate_resource), DEVMETHOD(bus_deactivate_resource, pcib_deactivate_resource),
DEVMETHOD(bus_map_resource, pcib_map_resource), DEVMETHOD(bus_map_resource, pcib_map_resource),
DEVMETHOD(bus_unmap_resource, pcib_unmap_resource), DEVMETHOD(bus_unmap_resource, pcib_unmap_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_setup_intr, bus_generic_setup_intr),
DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr), DEVMETHOD(bus_teardown_intr, bus_generic_teardown_intr),
DEVMETHOD(bus_reset_child, pcib_reset_child), DEVMETHOD(bus_reset_child, pcib_reset_child),
@@ -150,11 +140,8 @@ static device_method_t pcib_methods[] = {
DEFINE_CLASS_0(pcib, pcib_driver, pcib_methods, sizeof(struct pcib_softc)); DEFINE_CLASS_0(pcib, pcib_driver, pcib_methods, sizeof(struct pcib_softc));
EARLY_DRIVER_MODULE(pcib, pci, pcib_driver, NULL, NULL, BUS_PASS_BUS); EARLY_DRIVER_MODULE(pcib, pci, pcib_driver, NULL, NULL, BUS_PASS_BUS);
#if defined(NEW_PCIB) || defined(PCI_HP)
SYSCTL_DECL(_hw_pci); SYSCTL_DECL(_hw_pci);
#endif
#ifdef NEW_PCIB
static int pci_clear_pcib; static int pci_clear_pcib;
SYSCTL_INT(_hw_pci, OID_AUTO, clear_pcib, CTLFLAG_RDTUN, &pci_clear_pcib, 0, SYSCTL_INT(_hw_pci, OID_AUTO, clear_pcib, CTLFLAG_RDTUN, &pci_clear_pcib, 0,
"Clear firmware-assigned resources for PCI-PCI bridge I/O windows."); "Clear firmware-assigned resources for PCI-PCI bridge I/O windows.");
@@ -808,140 +795,6 @@ pcib_alloc_subbus(struct pcib_secbus *bus, device_t child, int *rid,
} }
#endif #endif
#else
/*
* Is the prefetch window open (eg, can we allocate memory in it?)
*/
static int
pcib_is_prefetch_open(struct pcib_softc *sc)
{
return (sc->pmembase > 0 && sc->pmembase < sc->pmemlimit);
}
/*
* Is the nonprefetch window open (eg, can we allocate memory in it?)
*/
static int
pcib_is_nonprefetch_open(struct pcib_softc *sc)
{
return (sc->membase > 0 && sc->membase < sc->memlimit);
}
/*
* Is the io window open (eg, can we allocate ports in it?)
*/
static int
pcib_is_io_open(struct pcib_softc *sc)
{
return (sc->iobase > 0 && sc->iobase < sc->iolimit);
}
/*
* Get current I/O decode.
*/
static void
pcib_get_io_decode(struct pcib_softc *sc)
{
device_t dev;
uint32_t iolow;
dev = sc->dev;
iolow = pci_read_config(dev, PCIR_IOBASEL_1, 1);
if ((iolow & PCIM_BRIO_MASK) == PCIM_BRIO_32)
sc->iobase = PCI_PPBIOBASE(
pci_read_config(dev, PCIR_IOBASEH_1, 2), iolow);
else
sc->iobase = PCI_PPBIOBASE(0, iolow);
iolow = pci_read_config(dev, PCIR_IOLIMITL_1, 1);
if ((iolow & PCIM_BRIO_MASK) == PCIM_BRIO_32)
sc->iolimit = PCI_PPBIOLIMIT(
pci_read_config(dev, PCIR_IOLIMITH_1, 2), iolow);
else
sc->iolimit = PCI_PPBIOLIMIT(0, iolow);
}
/*
* Get current memory decode.
*/
static void
pcib_get_mem_decode(struct pcib_softc *sc)
{
device_t dev;
pci_addr_t pmemlow;
dev = sc->dev;
sc->membase = PCI_PPBMEMBASE(0,
pci_read_config(dev, PCIR_MEMBASE_1, 2));
sc->memlimit = PCI_PPBMEMLIMIT(0,
pci_read_config(dev, PCIR_MEMLIMIT_1, 2));
pmemlow = pci_read_config(dev, PCIR_PMBASEL_1, 2);
if ((pmemlow & PCIM_BRPM_MASK) == PCIM_BRPM_64)
sc->pmembase = PCI_PPBMEMBASE(
pci_read_config(dev, PCIR_PMBASEH_1, 4), pmemlow);
else
sc->pmembase = PCI_PPBMEMBASE(0, pmemlow);
pmemlow = pci_read_config(dev, PCIR_PMLIMITL_1, 2);
if ((pmemlow & PCIM_BRPM_MASK) == PCIM_BRPM_64)
sc->pmemlimit = PCI_PPBMEMLIMIT(
pci_read_config(dev, PCIR_PMLIMITH_1, 4), pmemlow);
else
sc->pmemlimit = PCI_PPBMEMLIMIT(0, pmemlow);
}
/*
* Restore previous I/O decode.
*/
static void
pcib_set_io_decode(struct pcib_softc *sc)
{
device_t dev;
uint32_t iohi;
dev = sc->dev;
iohi = sc->iobase >> 16;
if (iohi > 0)
pci_write_config(dev, PCIR_IOBASEH_1, iohi, 2);
pci_write_config(dev, PCIR_IOBASEL_1, sc->iobase >> 8, 1);
iohi = sc->iolimit >> 16;
if (iohi > 0)
pci_write_config(dev, PCIR_IOLIMITH_1, iohi, 2);
pci_write_config(dev, PCIR_IOLIMITL_1, sc->iolimit >> 8, 1);
}
/*
* Restore previous memory decode.
*/
static void
pcib_set_mem_decode(struct pcib_softc *sc)
{
device_t dev;
pci_addr_t pmemhi;
dev = sc->dev;
pci_write_config(dev, PCIR_MEMBASE_1, sc->membase >> 16, 2);
pci_write_config(dev, PCIR_MEMLIMIT_1, sc->memlimit >> 16, 2);
pmemhi = sc->pmembase >> 32;
if (pmemhi > 0)
pci_write_config(dev, PCIR_PMBASEH_1, pmemhi, 4);
pci_write_config(dev, PCIR_PMBASEL_1, sc->pmembase >> 16, 2);
pmemhi = sc->pmemlimit >> 32;
if (pmemhi > 0)
pci_write_config(dev, PCIR_PMLIMITH_1, pmemhi, 4);
pci_write_config(dev, PCIR_PMLIMITL_1, sc->pmemlimit >> 16, 2);
}
#endif
#ifdef PCI_HP #ifdef PCI_HP
/* /*
* PCI-express HotPlug support. * PCI-express HotPlug support.
@@ -1509,45 +1362,13 @@ pcib_detach_hotplug(struct pcib_softc *sc)
} }
#endif #endif
/*
* Get current bridge configuration.
*/
static void
pcib_cfg_save(struct pcib_softc *sc)
{
#ifndef NEW_PCIB
device_t dev;
uint16_t command;
dev = sc->dev;
command = pci_read_config(dev, PCIR_COMMAND, 2);
if (command & PCIM_CMD_PORTEN)
pcib_get_io_decode(sc);
if (command & PCIM_CMD_MEMEN)
pcib_get_mem_decode(sc);
#endif
}
/* /*
* Restore previous bridge configuration. * Restore previous bridge configuration.
*/ */
static void static void
pcib_cfg_restore(struct pcib_softc *sc) pcib_cfg_restore(struct pcib_softc *sc)
{ {
#ifndef NEW_PCIB
uint16_t command;
#endif
#ifdef NEW_PCIB
pcib_write_windows(sc, WIN_IO | WIN_MEM | WIN_PMEM); pcib_write_windows(sc, WIN_IO | WIN_MEM | WIN_PMEM);
#else
command = pci_read_config(sc->dev, PCIR_COMMAND, 2);
if (command & PCIM_CMD_PORTEN)
pcib_set_io_decode(sc);
if (command & PCIM_CMD_MEMEN)
pcib_set_mem_decode(sc);
#endif
} }
/* /*
@@ -1579,12 +1400,11 @@ pcib_attach_common(device_t dev)
* Get current bridge configuration. * Get current bridge configuration.
*/ */
sc->domain = pci_get_domain(dev); sc->domain = pci_get_domain(dev);
#if !(defined(NEW_PCIB) && defined(PCI_RES_BUS)) #if !defined(PCI_RES_BUS)
sc->bus.sec = pci_read_config(dev, PCIR_SECBUS_1, 1); sc->bus.sec = pci_read_config(dev, PCIR_SECBUS_1, 1);
sc->bus.sub = pci_read_config(dev, PCIR_SUBBUS_1, 1); sc->bus.sub = pci_read_config(dev, PCIR_SUBBUS_1, 1);
#endif #endif
sc->bridgectl = pci_read_config(dev, PCIR_BRIDGECTL_1, 2); sc->bridgectl = pci_read_config(dev, PCIR_BRIDGECTL_1, 2);
pcib_cfg_save(sc);
/* /*
* The primary bus register should always be the bus of the * The primary bus register should always be the bus of the
@@ -1611,7 +1431,7 @@ pcib_attach_common(device_t dev)
* Quirk handling. * Quirk handling.
*/ */
switch (pci_get_devid(dev)) { switch (pci_get_devid(dev)) {
#if !(defined(NEW_PCIB) && defined(PCI_RES_BUS)) #if !defined(PCI_RES_BUS)
case 0x12258086: /* Intel 82454KX/GX (Orion) */ case 0x12258086: /* Intel 82454KX/GX (Orion) */
{ {
uint8_t supbus; uint8_t supbus;
@@ -1638,7 +1458,7 @@ pcib_attach_common(device_t dev)
sc->flags |= PCIB_SUBTRACTIVE; sc->flags |= PCIB_SUBTRACTIVE;
break; break;
#if !(defined(NEW_PCIB) && defined(PCI_RES_BUS)) #if !defined(PCI_RES_BUS)
/* Compaq R3000 BIOS sets wrong subordinate bus number. */ /* Compaq R3000 BIOS sets wrong subordinate bus number. */
case 0x00dd10de: case 0x00dd10de:
{ {
@@ -1688,12 +1508,10 @@ pcib_attach_common(device_t dev)
#ifdef PCI_HP #ifdef PCI_HP
pcib_probe_hotplug(sc); pcib_probe_hotplug(sc);
#endif #endif
#ifdef NEW_PCIB
#ifdef PCI_RES_BUS #ifdef PCI_RES_BUS
pcib_setup_secbus(dev, &sc->bus, 1); pcib_setup_secbus(dev, &sc->bus, 1);
#endif #endif
pcib_probe_windows(sc); pcib_probe_windows(sc);
#endif
#ifdef PCI_HP #ifdef PCI_HP
if (sc->flags & PCIB_HOTPLUG) if (sc->flags & PCIB_HOTPLUG)
pcib_setup_hotplug(sc); pcib_setup_hotplug(sc);
@@ -1702,7 +1520,6 @@ pcib_attach_common(device_t dev)
device_printf(dev, " domain %d\n", sc->domain); device_printf(dev, " domain %d\n", sc->domain);
device_printf(dev, " secondary bus %d\n", sc->bus.sec); device_printf(dev, " secondary bus %d\n", sc->bus.sec);
device_printf(dev, " subordinate bus %d\n", sc->bus.sub); device_printf(dev, " subordinate bus %d\n", sc->bus.sub);
#ifdef NEW_PCIB
if (pcib_is_window_open(&sc->io)) if (pcib_is_window_open(&sc->io))
device_printf(dev, " I/O decode 0x%jx-0x%jx\n", device_printf(dev, " I/O decode 0x%jx-0x%jx\n",
(uintmax_t)sc->io.base, (uintmax_t)sc->io.limit); (uintmax_t)sc->io.base, (uintmax_t)sc->io.limit);
@@ -1712,17 +1529,6 @@ pcib_attach_common(device_t dev)
if (pcib_is_window_open(&sc->pmem)) if (pcib_is_window_open(&sc->pmem))
device_printf(dev, " prefetched decode 0x%jx-0x%jx\n", device_printf(dev, " prefetched decode 0x%jx-0x%jx\n",
(uintmax_t)sc->pmem.base, (uintmax_t)sc->pmem.limit); (uintmax_t)sc->pmem.base, (uintmax_t)sc->pmem.limit);
#else
if (pcib_is_io_open(sc))
device_printf(dev, " I/O decode 0x%x-0x%x\n",
sc->iobase, sc->iolimit);
if (pcib_is_nonprefetch_open(sc))
device_printf(dev, " memory decode 0x%jx-0x%jx\n",
(uintmax_t)sc->membase, (uintmax_t)sc->memlimit);
if (pcib_is_prefetch_open(sc))
device_printf(dev, " prefetched decode 0x%jx-0x%jx\n",
(uintmax_t)sc->pmembase, (uintmax_t)sc->pmemlimit);
#endif
if (sc->bridgectl & (PCIB_BCR_ISA_ENABLE | PCIB_BCR_VGA_ENABLE) || if (sc->bridgectl & (PCIB_BCR_ISA_ENABLE | PCIB_BCR_VGA_ENABLE) ||
sc->flags & PCIB_SUBTRACTIVE) { sc->flags & PCIB_SUBTRACTIVE) {
device_printf(dev, " special decode "); device_printf(dev, " special decode ");
@@ -1793,14 +1599,10 @@ pcib_attach(device_t dev)
int int
pcib_detach(device_t dev) pcib_detach(device_t dev)
{ {
#if defined(PCI_HP) || defined(NEW_PCIB)
struct pcib_softc *sc; struct pcib_softc *sc;
#endif
int error; int error;
#if defined(PCI_HP) || defined(NEW_PCIB)
sc = device_get_softc(dev); sc = device_get_softc(dev);
#endif
error = bus_generic_detach(dev); error = bus_generic_detach(dev);
if (error) if (error)
return (error); return (error);
@@ -1814,23 +1616,13 @@ pcib_detach(device_t dev)
error = device_delete_children(dev); error = device_delete_children(dev);
if (error) if (error)
return (error); return (error);
#ifdef NEW_PCIB
pcib_free_windows(sc); pcib_free_windows(sc);
#ifdef PCI_RES_BUS #ifdef PCI_RES_BUS
pcib_free_secbus(dev, &sc->bus); pcib_free_secbus(dev, &sc->bus);
#endif
#endif #endif
return (0); return (0);
} }
int
pcib_suspend(device_t dev)
{
pcib_cfg_save(device_get_softc(dev));
return (bus_generic_suspend(dev));
}
int int
pcib_resume(device_t dev) pcib_resume(device_t dev)
{ {
@@ -1905,7 +1697,6 @@ pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value)
return(ENOENT); return(ENOENT);
} }
#ifdef NEW_PCIB
/* /*
* Attempt to allocate a resource from the existing resources assigned * Attempt to allocate a resource from the existing resources assigned
* to a window. * to a window.
@@ -2569,163 +2360,6 @@ pcib_unmap_resource(device_t dev, device_t child, struct resource *r,
return (ENOENT); return (ENOENT);
return (bus_unmap_resource(dev, pres, map)); return (bus_unmap_resource(dev, pres, map));
} }
#else
/*
* We have to trap resource allocation requests and ensure that the bridge
* is set up to, or capable of handling them.
*/
static struct resource *
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)
{
struct pcib_softc *sc = device_get_softc(dev);
const char *name, *suffix;
int ok;
/*
* Fail the allocation for this range if it's not supported.
*/
name = device_get_nameunit(child);
if (name == NULL) {
name = "";
suffix = "";
} else
suffix = " ";
switch (type) {
case SYS_RES_IOPORT:
ok = 0;
if (!pcib_is_io_open(sc))
break;
ok = (start >= sc->iobase && end <= sc->iolimit);
/*
* Make sure we allow access to VGA I/O addresses when the
* bridge has the "VGA Enable" bit set.
*/
if (!ok && pci_is_vga_ioport_range(start, end))
ok = (sc->bridgectl & PCIB_BCR_VGA_ENABLE) ? 1 : 0;
if ((sc->flags & PCIB_SUBTRACTIVE) == 0) {
if (!ok) {
if (start < sc->iobase)
start = sc->iobase;
if (end > sc->iolimit)
end = sc->iolimit;
if (start < end)
ok = 1;
}
} else {
ok = 1;
#if 0
/*
* If we overlap with the subtractive range, then
* pick the upper range to use.
*/
if (start < sc->iolimit && end > sc->iobase)
start = sc->iolimit + 1;
#endif
}
if (end < start) {
device_printf(dev, "ioport: end (%jx) < start (%jx)\n",
end, start);
start = 0;
end = 0;
ok = 0;
}
if (!ok) {
device_printf(dev, "%s%srequested unsupported I/O "
"range 0x%jx-0x%jx (decoding 0x%x-0x%x)\n",
name, suffix, start, end, sc->iobase, sc->iolimit);
return (NULL);
}
if (bootverbose)
device_printf(dev,
"%s%srequested I/O range 0x%jx-0x%jx: in range\n",
name, suffix, start, end);
break;
case SYS_RES_MEMORY:
ok = 0;
if (pcib_is_nonprefetch_open(sc))
ok = ok || (start >= sc->membase && end <= sc->memlimit);
if (pcib_is_prefetch_open(sc))
ok = ok || (start >= sc->pmembase && end <= sc->pmemlimit);
/*
* Make sure we allow access to VGA memory addresses when the
* bridge has the "VGA Enable" bit set.
*/
if (!ok && pci_is_vga_memory_range(start, end))
ok = (sc->bridgectl & PCIB_BCR_VGA_ENABLE) ? 1 : 0;
if ((sc->flags & PCIB_SUBTRACTIVE) == 0) {
if (!ok) {
ok = 1;
if (flags & RF_PREFETCHABLE) {
if (pcib_is_prefetch_open(sc)) {
if (start < sc->pmembase)
start = sc->pmembase;
if (end > sc->pmemlimit)
end = sc->pmemlimit;
} else {
ok = 0;
}
} else { /* non-prefetchable */
if (pcib_is_nonprefetch_open(sc)) {
if (start < sc->membase)
start = sc->membase;
if (end > sc->memlimit)
end = sc->memlimit;
} else {
ok = 0;
}
}
}
} else if (!ok) {
ok = 1; /* subtractive bridge: always ok */
#if 0
if (pcib_is_nonprefetch_open(sc)) {
if (start < sc->memlimit && end > sc->membase)
start = sc->memlimit + 1;
}
if (pcib_is_prefetch_open(sc)) {
if (start < sc->pmemlimit && end > sc->pmembase)
start = sc->pmemlimit + 1;
}
#endif
}
if (end < start) {
device_printf(dev, "memory: end (%jx) < start (%jx)\n",
end, start);
start = 0;
end = 0;
ok = 0;
}
if (!ok && bootverbose)
device_printf(dev,
"%s%srequested unsupported memory range %#jx-%#jx "
"(decoding %#jx-%#jx, %#jx-%#jx)\n",
name, suffix, start, end,
(uintmax_t)sc->membase, (uintmax_t)sc->memlimit,
(uintmax_t)sc->pmembase, (uintmax_t)sc->pmemlimit);
if (!ok)
return (NULL);
if (bootverbose)
device_printf(dev,"%s%srequested memory range "
"0x%jx-0x%jx: good\n",
name, suffix, start, end);
break;
default:
break;
}
/*
* Bridge is OK decoding this resource, so pass it up.
*/
return (bus_generic_alloc_resource(dev, child, type, rid, start, end,
count, flags));
}
#endif
/* /*
* If ARI is enabled on this downstream port, translate the function number * If ARI is enabled on this downstream port, translate the function number
-3
View File
@@ -131,7 +131,6 @@ host_pcib_get_busno(pci_read_config_fn read_config, int bus, int slot, int func,
return 1; return 1;
} }
#ifdef NEW_PCIB
/* /*
* Return a pointer to a pretty name for a PCI device. If the device * Return a pointer to a pretty name for a PCI device. If the device
* has a driver attached, the device's name is used, otherwise a name * has a driver attached, the device's name is used, otherwise a name
@@ -413,5 +412,3 @@ pci_domain_deactivate_bus(int domain, device_t dev, struct resource *r)
return (rman_deactivate_resource(r)); return (rman_deactivate_resource(r));
} }
#endif /* PCI_RES_BUS */ #endif /* PCI_RES_BUS */
#endif /* NEW_PCIB */
+2 -17
View File
@@ -35,7 +35,6 @@
#include <sys/taskqueue.h> #include <sys/taskqueue.h>
#ifdef NEW_PCIB
/* /*
* Data structure and routines that Host to PCI bridge drivers can use * Data structure and routines that Host to PCI bridge drivers can use
* to restrict allocations for child devices to ranges decoded by the * to restrict allocations for child devices to ranges decoded by the
@@ -58,7 +57,6 @@ struct resource *pcib_host_res_alloc(struct pcib_host_resources *hr,
int pcib_host_res_adjust(struct pcib_host_resources *hr, int pcib_host_res_adjust(struct pcib_host_resources *hr,
device_t dev, struct resource *r, rman_res_t start, device_t dev, struct resource *r, rman_res_t start,
rman_res_t end); rman_res_t end);
#endif
/* /*
* Export portions of generic PCI:PCI bridge support so that it can be * Export portions of generic PCI:PCI bridge support so that it can be
@@ -66,7 +64,6 @@ int pcib_host_res_adjust(struct pcib_host_resources *hr,
*/ */
DECLARE_CLASS(pcib_driver); DECLARE_CLASS(pcib_driver);
#ifdef NEW_PCIB
#define WIN_IO 0x1 #define WIN_IO 0x1
#define WIN_MEM 0x2 #define WIN_MEM 0x2
#define WIN_PMEM 0x4 #define WIN_PMEM 0x4
@@ -83,12 +80,11 @@ struct pcib_window {
int step; /* log_2 of window granularity */ int step; /* log_2 of window granularity */
const char *name; const char *name;
}; };
#endif
struct pcib_secbus { struct pcib_secbus {
u_int sec; u_int sec;
u_int sub; u_int sub;
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
device_t dev; device_t dev;
struct rman rman; struct rman rman;
struct resource *res; struct resource *res;
@@ -116,18 +112,9 @@ struct pcib_softc
u_int domain; /* domain number */ u_int domain; /* domain number */
u_int pribus; /* primary bus number */ u_int pribus; /* primary bus number */
struct pcib_secbus bus; /* secondary bus numbers */ struct pcib_secbus bus; /* secondary bus numbers */
#ifdef NEW_PCIB
struct pcib_window io; /* I/O port window */ struct pcib_window io; /* I/O port window */
struct pcib_window mem; /* memory window */ struct pcib_window mem; /* memory window */
struct pcib_window pmem; /* prefetchable memory window */ struct pcib_window pmem; /* prefetchable memory window */
#else
pci_addr_t pmembase; /* base address of prefetchable memory */
pci_addr_t pmemlimit; /* topmost address of prefetchable memory */
pci_addr_t membase; /* base address of memory window */
pci_addr_t memlimit; /* topmost address of memory window */
uint32_t iobase; /* base address of port window */
uint32_t iolimit; /* topmost address of port window */
#endif
uint16_t bridgectl; /* bridge control register */ uint16_t bridgectl; /* bridge control register */
uint16_t pcie_link_sta; uint16_t pcie_link_sta;
uint16_t pcie_slot_sta; uint16_t pcie_slot_sta;
@@ -153,7 +140,7 @@ typedef uint32_t pci_read_config_fn(int d, int b, int s, int f, int reg,
int host_pcib_get_busno(pci_read_config_fn read_config, int bus, int host_pcib_get_busno(pci_read_config_fn read_config, int bus,
int slot, int func, uint8_t *busnum); int slot, int func, uint8_t *busnum);
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
struct resource *pci_domain_alloc_bus(int domain, device_t dev, int *rid, 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); 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, int pci_domain_adjust_bus(int domain, device_t dev,
@@ -175,9 +162,7 @@ int pcib_attach(device_t dev);
int pcib_attach_child(device_t dev); int pcib_attach_child(device_t dev);
void pcib_attach_common(device_t dev); void pcib_attach_common(device_t dev);
void pcib_bridge_init(device_t dev); void pcib_bridge_init(device_t dev);
#ifdef NEW_PCIB
const char *pcib_child_name(device_t child); const char *pcib_child_name(device_t child);
#endif
int pcib_detach(device_t dev); int pcib_detach(device_t dev);
int pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result); int pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result);
int pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value); int pcib_write_ivar(device_t dev, device_t child, int which, uintptr_t value);
-2
View File
@@ -29,6 +29,4 @@ options CC_CUBIC # include CUBIC congestion control
# enable support for native hardware # enable support for native hardware
device atpic device atpic
options NEW_PCIB
options NETLINK # netlink(4) support options NETLINK # netlink(4) support
-2
View File
@@ -39,8 +39,6 @@
#define SYS_RES_DRQ 2 /* isa dma lines */ #define SYS_RES_DRQ 2 /* isa dma lines */
#define SYS_RES_MEMORY 3 /* i/o memory */ #define SYS_RES_MEMORY 3 /* i/o memory */
#define SYS_RES_IOPORT 4 /* i/o ports */ #define SYS_RES_IOPORT 4 /* i/o ports */
#ifdef NEW_PCIB
#define PCI_RES_BUS 5 /* PCI bus numbers */ #define PCI_RES_BUS 5 /* PCI bus numbers */
#endif
#endif /* !_MACHINE_RESOURCE_H_ */ #endif /* !_MACHINE_RESOURCE_H_ */
-4
View File
@@ -4,8 +4,4 @@ KMOD= cardbus
SRCS= cardbus.c cardbus_cis.c cardbus_device.c \ SRCS= cardbus.c cardbus_cis.c cardbus_device.c \
device_if.h bus_if.h card_if.h power_if.h pci_if.h pcib_if.h device_if.h bus_if.h card_if.h power_if.h pci_if.h pcib_if.h
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
CFLAGS += -DNEW_PCIB
.endif
.include <bsd.kmod.mk> .include <bsd.kmod.mk>
-4
View File
@@ -4,8 +4,4 @@ KMOD= cbb
SRCS= pccbb.c pccbb_pci.c \ SRCS= pccbb.c pccbb_pci.c \
device_if.h bus_if.h power_if.h card_if.h pci_if.h pcib_if.h device_if.h bus_if.h power_if.h card_if.h pci_if.h pcib_if.h
.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64"
CFLAGS += -DNEW_PCIB
.endif
.include <bsd.kmod.mk> .include <bsd.kmod.mk>
-2
View File
@@ -14,6 +14,4 @@ options GEOM_PART_MBR
# Default congestion control algorithm # Default congestion control algorithm
options CC_CUBIC # include CUBIC congestion control options CC_CUBIC # include CUBIC congestion control
options NEW_PCIB
options NETLINK # netlink(4) support options NETLINK # netlink(4) support
-1
View File
@@ -15,7 +15,6 @@ options GEOM_PART_GPT
# Default congestion control algorithm # Default congestion control algorithm
options CC_CUBIC # include CUBIC congestion control options CC_CUBIC # include CUBIC congestion control
options NEW_PCIB
options INTRNG options INTRNG
options NETLINK # netlink(4) support options NETLINK # netlink(4) support
-2
View File
@@ -40,8 +40,6 @@
#define SYS_RES_MEMORY 3 /* i/o memory */ #define SYS_RES_MEMORY 3 /* i/o memory */
#define SYS_RES_IOPORT 4 /* i/o ports */ #define SYS_RES_IOPORT 4 /* i/o ports */
#define SYS_RES_GPIO 5 /* general purpose i/o */ #define SYS_RES_GPIO 5 /* general purpose i/o */
#ifdef NEW_PCIB
#define PCI_RES_BUS 6 /* PCI bus numbers */ #define PCI_RES_BUS 6 /* PCI bus numbers */
#endif
#endif /* !_MACHINE_RESOURCE_H_ */ #endif /* !_MACHINE_RESOURCE_H_ */
-4
View File
@@ -188,16 +188,12 @@ typedef struct CBASMENTRY {
#ifdef _KERNEL #ifdef _KERNEL
struct mptable_hostb_softc { struct mptable_hostb_softc {
#ifdef NEW_PCIB
struct pcib_host_resources sc_host_res; struct pcib_host_resources sc_host_res;
int sc_decodes_vga_io; int sc_decodes_vga_io;
int sc_decodes_isa_io; int sc_decodes_isa_io;
#endif
}; };
#ifdef NEW_PCIB
void mptable_pci_host_res_init(device_t pcib); void mptable_pci_host_res_init(device_t pcib);
#endif
int mptable_pci_probe_table(int bus); int mptable_pci_probe_table(int bus);
int mptable_pci_route_interrupt(device_t pcib, device_t dev, int pin); int mptable_pci_route_interrupt(device_t pcib, device_t dev, int pin);
#endif #endif
+3 -3
View File
@@ -595,7 +595,7 @@ legacy_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) rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
{ {
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
if (type == PCI_RES_BUS) if (type == PCI_RES_BUS)
return (pci_domain_alloc_bus(0, child, rid, start, end, count, return (pci_domain_alloc_bus(0, child, rid, start, end, count,
flags)); flags));
@@ -605,7 +605,7 @@ legacy_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid,
count, flags)); count, flags));
} }
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
int int
legacy_pcib_adjust_resource(device_t dev, device_t child, legacy_pcib_adjust_resource(device_t dev, device_t child,
struct resource *r, rman_res_t start, rman_res_t end) struct resource *r, rman_res_t start, rman_res_t end)
@@ -656,7 +656,7 @@ static device_method_t legacy_pcib_methods[] = {
DEVMETHOD(bus_read_ivar, legacy_pcib_read_ivar), DEVMETHOD(bus_read_ivar, legacy_pcib_read_ivar),
DEVMETHOD(bus_write_ivar, legacy_pcib_write_ivar), DEVMETHOD(bus_write_ivar, legacy_pcib_write_ivar),
DEVMETHOD(bus_alloc_resource, legacy_pcib_alloc_resource), DEVMETHOD(bus_alloc_resource, legacy_pcib_alloc_resource),
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
DEVMETHOD(bus_adjust_resource, legacy_pcib_adjust_resource), DEVMETHOD(bus_adjust_resource, legacy_pcib_adjust_resource),
DEVMETHOD(bus_release_resource, legacy_pcib_release_resource), DEVMETHOD(bus_release_resource, legacy_pcib_release_resource),
DEVMETHOD(bus_activate_resource, legacy_pcib_activate_resource), DEVMETHOD(bus_activate_resource, legacy_pcib_activate_resource),
+2 -2
View File
@@ -246,7 +246,7 @@ qpi_pcib_read_ivar(device_t dev, device_t child, int which, uintptr_t *result)
} }
} }
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
static struct resource * static struct resource *
qpi_pcib_alloc_resource(device_t dev, device_t child, int type, int *rid, 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) rman_res_t start, rman_res_t end, rman_res_t count, u_int flags)
@@ -280,7 +280,7 @@ static device_method_t qpi_pcib_methods[] = {
/* Bus interface */ /* Bus interface */
DEVMETHOD(bus_read_ivar, qpi_pcib_read_ivar), DEVMETHOD(bus_read_ivar, qpi_pcib_read_ivar),
#if defined(NEW_PCIB) && defined(PCI_RES_BUS) #if defined(PCI_RES_BUS)
DEVMETHOD(bus_alloc_resource, qpi_pcib_alloc_resource), DEVMETHOD(bus_alloc_resource, qpi_pcib_alloc_resource),
DEVMETHOD(bus_adjust_resource, legacy_pcib_adjust_resource), DEVMETHOD(bus_adjust_resource, legacy_pcib_adjust_resource),
DEVMETHOD(bus_release_resource, legacy_pcib_release_resource), DEVMETHOD(bus_release_resource, legacy_pcib_release_resource),
-12
View File
@@ -36,18 +36,14 @@
#include <sys/limits.h> #include <sys/limits.h>
#include <sys/malloc.h> #include <sys/malloc.h>
#include <sys/smp.h> #include <sys/smp.h>
#ifdef NEW_PCIB
#include <sys/rman.h> #include <sys/rman.h>
#endif
#include <vm/vm.h> #include <vm/vm.h>
#include <vm/vm_param.h> #include <vm/vm_param.h>
#include <vm/pmap.h> #include <vm/pmap.h>
#include <dev/pci/pcivar.h> #include <dev/pci/pcivar.h>
#ifdef NEW_PCIB
#include <dev/pci/pcib_private.h> #include <dev/pci/pcib_private.h>
#endif
#include <x86/apicreg.h> #include <x86/apicreg.h>
#include <x86/legacyvar.h> #include <x86/legacyvar.h>
#include <x86/mptable.h> #include <x86/mptable.h>
@@ -56,9 +52,7 @@
#include <x86/apicvar.h> #include <x86/apicvar.h>
#include <machine/md_var.h> #include <machine/md_var.h>
#include <machine/pc/bios.h> #include <machine/pc/bios.h>
#ifdef NEW_PCIB
#include <machine/resource.h> #include <machine/resource.h>
#endif
#include <machine/specialreg.h> #include <machine/specialreg.h>
/* string defined by the Intel MP Spec as identifying the MP table */ /* string defined by the Intel MP Spec as identifying the MP table */
@@ -199,10 +193,8 @@ static void mptable_setup_cpus_handler(u_char *entry, void *arg __unused);
static void mptable_register(void *dummy); static void mptable_register(void *dummy);
static int mptable_setup_local(void); static int mptable_setup_local(void);
static int mptable_setup_io(void); static int mptable_setup_io(void);
#ifdef NEW_PCIB
static void mptable_walk_extended_table( static void mptable_walk_extended_table(
mptable_extended_entry_handler *handler, void *arg); mptable_extended_entry_handler *handler, void *arg);
#endif
static void mptable_walk_table(mptable_entry_handler *handler, void *arg); static void mptable_walk_table(mptable_entry_handler *handler, void *arg);
static int search_for_sig(u_int32_t target, int count); static int search_for_sig(u_int32_t target, int count);
@@ -504,7 +496,6 @@ mptable_walk_table(mptable_entry_handler *handler, void *arg)
} }
} }
#ifdef NEW_PCIB
/* /*
* Call the handler routine for each entry in the MP config extended * Call the handler routine for each entry in the MP config extended
* table. * table.
@@ -523,7 +514,6 @@ mptable_walk_extended_table(mptable_extended_entry_handler *handler, void *arg)
entry = (ext_entry_ptr)((char *)entry + entry->length); entry = (ext_entry_ptr)((char *)entry + entry->length);
} }
} }
#endif
static void static void
mptable_probe_cpus_handler(u_char *entry, void *arg) mptable_probe_cpus_handler(u_char *entry, void *arg)
@@ -1178,7 +1168,6 @@ mptable_pci_route_interrupt(device_t pcib, device_t dev, int pin)
return (args.vector); return (args.vector);
} }
#ifdef NEW_PCIB
struct host_res_args { struct host_res_args {
struct mptable_hostb_softc *sc; struct mptable_hostb_softc *sc;
device_t dev; device_t dev;
@@ -1306,4 +1295,3 @@ mptable_pci_host_res_init(device_t pcib)
panic("failed to init hostb resources"); panic("failed to init hostb resources");
mptable_walk_extended_table(mptable_host_res_handler, &args); mptable_walk_extended_table(mptable_host_res_handler, &args);
} }
#endif
+1 -10
View File
@@ -64,14 +64,11 @@ static int
mptable_hostb_attach(device_t dev) mptable_hostb_attach(device_t dev)
{ {
#ifdef NEW_PCIB
mptable_pci_host_res_init(dev); mptable_pci_host_res_init(dev);
#endif
device_add_child(dev, "pci", -1); device_add_child(dev, "pci", -1);
return (bus_generic_attach(dev)); return (bus_generic_attach(dev));
} }
#ifdef NEW_PCIB
static int static int
mptable_is_isa_range(rman_res_t start, rman_res_t end) mptable_is_isa_range(rman_res_t start, rman_res_t end)
{ {
@@ -151,7 +148,6 @@ mptable_hostb_adjust_resource(device_t dev, device_t child,
sc = device_get_softc(dev); sc = device_get_softc(dev);
return (pcib_host_res_adjust(&sc->sc_host_res, child, r, start, end)); return (pcib_host_res_adjust(&sc->sc_host_res, child, r, start, end));
} }
#endif
static device_method_t mptable_hostb_methods[] = { static device_method_t mptable_hostb_methods[] = {
/* Device interface */ /* Device interface */
@@ -164,14 +160,9 @@ static device_method_t mptable_hostb_methods[] = {
/* Bus interface */ /* Bus interface */
DEVMETHOD(bus_read_ivar, legacy_pcib_read_ivar), DEVMETHOD(bus_read_ivar, legacy_pcib_read_ivar),
DEVMETHOD(bus_write_ivar, legacy_pcib_write_ivar), DEVMETHOD(bus_write_ivar, legacy_pcib_write_ivar),
#ifdef NEW_PCIB
DEVMETHOD(bus_alloc_resource, mptable_hostb_alloc_resource), DEVMETHOD(bus_alloc_resource, mptable_hostb_alloc_resource),
DEVMETHOD(bus_adjust_resource, mptable_hostb_adjust_resource), DEVMETHOD(bus_adjust_resource, mptable_hostb_adjust_resource),
#else #if defined(PCI_RES_BUS)
DEVMETHOD(bus_alloc_resource, legacy_pcib_alloc_resource),
DEVMETHOD(bus_adjust_resource, bus_generic_adjust_resource),
#endif
#if defined(NEW_PCIB) && defined(PCI_RES_BUS)
DEVMETHOD(bus_release_resource, legacy_pcib_release_resource), DEVMETHOD(bus_release_resource, legacy_pcib_release_resource),
DEVMETHOD(bus_activate_resource, legacy_pcib_activate_resource), DEVMETHOD(bus_activate_resource, legacy_pcib_activate_resource),
DEVMETHOD(bus_deactivate_resource, legacy_pcib_deactivate_resource), DEVMETHOD(bus_deactivate_resource, legacy_pcib_deactivate_resource),