Skip to content

Commit a78cf96

Browse files
ozbenhbjorn-helgaas
authored andcommitted
PCI/ACPI: Evaluate PCI Boot Configuration _DSM
Evaluate _DSM Function #5, the "PCI Boot Configuration" function. If the result is 0, the OS should preserve any resource assignments made by the firmware. Link: https://lore.kernel.org/r/20190615002359.29577-2-benh@kernel.crashing.org Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> [bhelgaas: commit log] Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
1 parent a188339 commit a78cf96

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

drivers/acpi/pci_root.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -894,6 +894,7 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
894894
int node = acpi_get_node(device->handle);
895895
struct pci_bus *bus;
896896
struct pci_host_bridge *host_bridge;
897+
union acpi_object *obj;
897898

898899
info->root = root;
899900
info->bridge = device;
@@ -930,6 +931,17 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
930931
if (!(root->osc_control_set & OSC_PCI_EXPRESS_LTR_CONTROL))
931932
host_bridge->native_ltr = 0;
932933

934+
/*
935+
* Evaluate the "PCI Boot Configuration" _DSM Function. If it
936+
* exists and returns 0, we must preserve any PCI resource
937+
* assignments made by firmware for this host bridge.
938+
*/
939+
obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 1,
940+
IGNORE_PCI_BOOT_CONFIG_DSM, NULL);
941+
if (obj && obj->type == ACPI_TYPE_INTEGER && obj->integer.value == 0)
942+
host_bridge->preserve_config = 1;
943+
ACPI_FREE(obj);
944+
933945
pci_scan_child_bus(bus);
934946
pci_set_host_bridge_release(host_bridge, acpi_pci_root_release_info,
935947
info);

include/linux/pci-acpi.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,10 @@ static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
107107
#endif
108108

109109
extern const guid_t pci_acpi_dsm_guid;
110-
#define DEVICE_LABEL_DSM 0x07
111-
#define RESET_DELAY_DSM 0x08
112-
#define FUNCTION_DELAY_DSM 0x09
110+
#define IGNORE_PCI_BOOT_CONFIG_DSM 0x05
111+
#define DEVICE_LABEL_DSM 0x07
112+
#define RESET_DELAY_DSM 0x08
113+
#define FUNCTION_DELAY_DSM 0x09
113114

114115
#else /* CONFIG_ACPI */
115116
static inline void acpi_pci_add_bus(struct pci_bus *bus) { }

include/linux/pci.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,8 @@ struct pci_host_bridge {
505505
unsigned int native_shpc_hotplug:1; /* OS may use SHPC hotplug */
506506
unsigned int native_pme:1; /* OS may use PCIe PME */
507507
unsigned int native_ltr:1; /* OS may use PCIe LTR */
508+
unsigned int preserve_config:1; /* Preserve FW resource setup */
509+
508510
/* Resource alignment requirements */
509511
resource_size_t (*align_resource)(struct pci_dev *dev,
510512
const struct resource *res,

0 commit comments

Comments
 (0)