Only set the PCI bus end when we are reducing it

We read the bus end value from the _CRS method. On some systems we need
to further limit it based on the MCFG table.

Support this by setting a default value, then update it if needed in the
_CRS table, and finally reduce it if it is past the end of the MCFG tabel.
This will allow for both systems that use either method to encode this
value.

This partially reverts r347929, removing the error printf.

Reviewed by:	philip
Tested by:	philip, Andrey Fesenko <f0andrey_gmail.com>
MFC after:	2 weeks
Sponsored by:	Innovate UK
Differential Revision:	https://reviews.freebsd.org/D27274
This commit is contained in:
Andrew Turner 2020-11-29 16:22:33 +00:00
parent b842cbbc01
commit e0870cd468
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=368156

View File

@ -201,7 +201,8 @@ pci_host_acpi_get_ecam_resource(device_t dev)
mcfg_entry++;
}
if (found) {
sc->base.bus_end = mcfg_entry->EndBusNumber;
if (mcfg_entry->EndBusNumber < sc->base.bus_end)
sc->base.bus_end = mcfg_entry->EndBusNumber;
base = mcfg_entry->Address;
} else {
device_printf(dev, "MCFG exists, but does not have bus %d-%d\n",
@ -210,10 +211,9 @@ pci_host_acpi_get_ecam_resource(device_t dev)
}
} else {
status = acpi_GetInteger(handle, "_CBA", &val);
if (ACPI_SUCCESS(status)) {
if (ACPI_SUCCESS(status))
base = val;
sc->base.bus_end = 255;
} else
else
return (ENXIO);
}
@ -246,6 +246,7 @@ pci_host_generic_acpi_init(device_t dev)
device_printf(dev, "No _BBN, using start bus 0\n");
sc->base.bus_start = 0;
}
sc->base.bus_end = 255;
/* Get PCI Segment (domain) needed for MCFG lookup */
status = acpi_GetInteger(handle, "_SEG", &sc->base.ecam);