Changeset View
Changeset View
Standalone View
Standalone View
sys/dev/pci/pci_host_generic_acpi.c
Show First 20 Lines • Show All 195 Lines • ▼ Show 20 Lines | while (mcfg_entry < mcfg_end && !found) { | ||||
if (mcfg_entry->PciSegment == sc->base.ecam && | if (mcfg_entry->PciSegment == sc->base.ecam && | ||||
mcfg_entry->StartBusNumber <= sc->base.bus_start && | mcfg_entry->StartBusNumber <= sc->base.bus_start && | ||||
mcfg_entry->EndBusNumber >= sc->base.bus_start) | mcfg_entry->EndBusNumber >= sc->base.bus_start) | ||||
found = TRUE; | found = TRUE; | ||||
else | else | ||||
mcfg_entry++; | mcfg_entry++; | ||||
} | } | ||||
if (found) { | if (found) { | ||||
if (mcfg_entry->EndBusNumber < sc->base.bus_end) | |||||
sc->base.bus_end = 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", | ||||
sc->base.bus_start, sc->base.bus_end); | sc->base.bus_start, sc->base.bus_end); | ||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
} 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; | ||||
sc->base.bus_end = 255; | else | ||||
} else | |||||
return (ENXIO); | return (ENXIO); | ||||
} | } | ||||
/* add as MEM rid 0 */ | /* add as MEM rid 0 */ | ||||
ad = device_get_ivars(dev); | ad = device_get_ivars(dev); | ||||
rl = &ad->ad_rl; | rl = &ad->ad_rl; | ||||
start = base + (sc->base.bus_start << PCIE_BUS_SHIFT); | start = base + (sc->base.bus_start << PCIE_BUS_SHIFT); | ||||
end = base + ((sc->base.bus_end + 1) << PCIE_BUS_SHIFT) - 1; | end = base + ((sc->base.bus_end + 1) << PCIE_BUS_SHIFT) - 1; | ||||
Show All 16 Lines | pci_host_generic_acpi_init(device_t dev) | ||||
handle = acpi_get_handle(dev); | handle = acpi_get_handle(dev); | ||||
/* Get Start bus number for the PCI host bus is from _BBN method */ | /* Get Start bus number for the PCI host bus is from _BBN method */ | ||||
status = acpi_GetInteger(handle, "_BBN", &sc->base.bus_start); | status = acpi_GetInteger(handle, "_BBN", &sc->base.bus_start); | ||||
if (ACPI_FAILURE(status)) { | if (ACPI_FAILURE(status)) { | ||||
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); | ||||
if (ACPI_FAILURE(status)) { | if (ACPI_FAILURE(status)) { | ||||
device_printf(dev, "No _SEG for PCI Bus, using segment 0\n"); | device_printf(dev, "No _SEG for PCI Bus, using segment 0\n"); | ||||
sc->base.ecam = 0; | sc->base.ecam = 0; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 205 Lines • Show Last 20 Lines |