Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133420496
D17657.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D17657.diff
View Options
Index: head/sys/dev/pci/pci_host_generic.h
===================================================================
--- head/sys/dev/pci/pci_host_generic.h
+++ head/sys/dev/pci/pci_host_generic.h
@@ -56,6 +56,8 @@
struct rman io_rman;
struct resource *res;
struct resource *res1;
+ int bus_start;
+ int bus_end;
int ecam;
bus_space_tag_t bst;
bus_space_handle_t bsh;
Index: head/sys/dev/pci/pci_host_generic.c
===================================================================
--- head/sys/dev/pci/pci_host_generic.c
+++ head/sys/dev/pci/pci_host_generic.c
@@ -147,13 +147,14 @@
uint64_t offset;
uint32_t data;
- if ((bus > PCI_BUSMAX) || (slot > PCI_SLOTMAX) ||
- (func > PCI_FUNCMAX) || (reg > PCIE_REGMAX))
+ sc = device_get_softc(dev);
+ if ((bus < sc->bus_start) || (bus > sc->bus_end))
return (~0U);
+ if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) ||
+ (reg > PCIE_REGMAX))
+ return (~0U);
- sc = device_get_softc(dev);
-
- offset = PCIE_ADDR_OFFSET(bus, slot, func, reg);
+ offset = PCIE_ADDR_OFFSET(bus - sc->bus_start, slot, func, reg);
t = sc->bst;
h = sc->bsh;
@@ -183,14 +184,15 @@
bus_space_tag_t t;
uint64_t offset;
- if ((bus > PCI_BUSMAX) || (slot > PCI_SLOTMAX) ||
- (func > PCI_FUNCMAX) || (reg > PCIE_REGMAX))
+ sc = device_get_softc(dev);
+ if ((bus < sc->bus_start) || (bus > sc->bus_end))
return;
+ if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) ||
+ (reg > PCIE_REGMAX))
+ return;
- sc = device_get_softc(dev);
+ offset = PCIE_ADDR_OFFSET(bus - sc->bus_start, slot, func, reg);
- offset = PCIE_ADDR_OFFSET(bus, slot, func, reg);
-
t = sc->bst;
h = sc->bsh;
@@ -221,14 +223,11 @@
uintptr_t *result)
{
struct generic_pcie_core_softc *sc;
- int secondary_bus;
sc = device_get_softc(dev);
if (index == PCIB_IVAR_BUS) {
- /* this pcib adds only pci bus 0 as child */
- secondary_bus = 0;
- *result = secondary_bus;
+ *result = sc->bus_start;
return (0);
}
Index: head/sys/dev/pci/pci_host_generic_acpi.c
===================================================================
--- head/sys/dev/pci/pci_host_generic_acpi.c
+++ head/sys/dev/pci/pci_host_generic_acpi.c
@@ -125,7 +125,7 @@
struct generic_pcie_acpi_softc *sc;
ACPI_HANDLE handle;
ACPI_STATUS status;
- int error;
+ int error, bus_start;
sc = device_get_softc(dev);
@@ -136,10 +136,14 @@
device_printf(dev, "Bus is%s cache-coherent\n",
sc->base.coherent ? "" : " not");
- if (!ACPI_FAILURE(acpi_GetInteger(handle, "_BBN", &sc->base.ecam)))
- sc->base.ecam >>= 7;
- else
+ if (!ACPI_FAILURE(acpi_GetInteger(handle, "_BBN", &bus_start))) {
+ sc->base.ecam = bus_start >> 7;
+ sc->base.bus_start = bus_start & 0x7F;
+ } else {
sc->base.ecam = 0;
+ sc->base.bus_start = 0;
+ }
+ sc->base.bus_end = 0xFF;
acpi_pcib_fetch_prt(dev, &sc->ap_prt);
@@ -194,17 +198,12 @@
generic_pcie_acpi_read_ivar(device_t dev, device_t child, int index,
uintptr_t *result)
{
- ACPI_HANDLE handle;
struct generic_pcie_acpi_softc *sc;
- int secondary_bus;
sc = device_get_softc(dev);
if (index == PCIB_IVAR_BUS) {
- handle = acpi_get_handle(dev);
- if (ACPI_FAILURE(acpi_GetInteger(handle, "_BBN", &secondary_bus)))
- secondary_bus = sc->base.ecam * 0x80;
- *result = secondary_bus;
+ *result = sc->base.ecam * 0x80 + sc->base.bus_start;
return (0);
}
Index: head/sys/dev/pci/pci_host_generic_fdt.c
===================================================================
--- head/sys/dev/pci/pci_host_generic_fdt.c
+++ head/sys/dev/pci/pci_host_generic_fdt.c
@@ -152,6 +152,9 @@
device_printf(dev, "Bus is%s cache-coherent\n",
sc->base.coherent ? "" : " not");
+ /* TODO parse FDT bus ranges */
+ sc->base.bus_start = 0;
+ sc->base.bus_end = 0xFF;
error = pci_host_generic_core_attach(dev);
if (error != 0)
return (error);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 26, 4:28 PM (12 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24235074
Default Alt Text
D17657.diff (3 KB)
Attached To
Mode
D17657: pci_host_generic*: basic implementation of bus range
Attached
Detach File
Event Timeline
Log In to Comment