pci: ecam: Do not warn on mismatch of bus_end

We cannot know the bus end number before parsing the MCFG table
so don't set the bus_end before that. If the MCFG table doesn't
exist we will set the configuration base address based on the _CBA
value and set the bus_end to the maximal number allowed by PCI.

Sponsored by: Ampere Computing, LLC

Differential Revision:	https://reviews.freebsd.org/D20213
This commit is contained in:
manu 2019-05-17 17:04:01 +00:00
parent 3cfe83e1e0
commit 77cb8c789c

View File

@ -207,11 +207,7 @@ pci_host_acpi_get_ecam_resource(device_t dev)
mcfg_entry++; mcfg_entry++;
} }
if (found) { if (found) {
if (mcfg_entry->EndBusNumber < sc->base.bus_end) { sc->base.bus_end = mcfg_entry->EndBusNumber;
device_printf(dev, "bus end mismatch! expected %d found %d.\n",
sc->base.bus_end, (int)mcfg_entry->EndBusNumber);
sc->base.bus_end = mcfg_entry->EndBusNumber;
}
base = mcfg_entry->Address; base = mcfg_entry->Address;
} else { } else {
device_printf(dev, "MCFG exists, but does not have bus %d-%d\n", device_printf(dev, "MCFG exists, but does not have bus %d-%d\n",
@ -220,9 +216,10 @@ pci_host_acpi_get_ecam_resource(device_t dev)
} }
} else { } else {
status = acpi_GetInteger(handle, "_CBA", &val); status = acpi_GetInteger(handle, "_CBA", &val);
if (ACPI_SUCCESS(status)) if (ACPI_SUCCESS(status)) {
base = val; base = val;
else sc->base.bus_end = 255;
} else
return (ENXIO); return (ENXIO);
} }
@ -259,7 +256,6 @@ pci_host_generic_acpi_attach(device_t dev)
device_printf(dev, "No _BBN, using start bus 0\n"); device_printf(dev, "No _BBN, using start bus 0\n");
sc->base.bus_start = 0; sc->base.bus_start = 0;
} }
sc->base.bus_end = 255;
/* Get PCI Segment (domain) needed for MCFG lookup */ /* Get PCI Segment (domain) needed for MCFG lookup */
status = acpi_GetInteger(handle, "_SEG", &sc->base.ecam); status = acpi_GetInteger(handle, "_SEG", &sc->base.ecam);