Skip to content

Commit 3501c94

Browse files
ozbenhpaniakin-aws
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> (cherry picked from commit a78cf96)
1 parent d61c2d4 commit 3501c94

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

drivers/acpi/pci_root.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -874,6 +874,8 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
874874
struct acpi_device *device = root->device;
875875
int node = acpi_get_node(device->handle);
876876
struct pci_bus *bus;
877+
struct pci_host_bridge *host_bridge;
878+
union acpi_object *obj;
877879

878880
info->root = root;
879881
info->bridge = device;
@@ -898,6 +900,19 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
898900
if (!bus)
899901
goto out_release_info;
900902

903+
host_bridge = to_pci_host_bridge(bus->bridge);
904+
905+
/*
906+
* Evaluate the "PCI Boot Configuration" _DSM Function. If it
907+
* exists and returns 0, we must preserve any PCI resource
908+
* assignments made by firmware for this host bridge.
909+
*/
910+
obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 1,
911+
IGNORE_PCI_BOOT_CONFIG_DSM, NULL);
912+
if (obj && obj->type == ACPI_TYPE_INTEGER && obj->integer.value == 0)
913+
host_bridge->preserve_config = 1;
914+
ACPI_FREE(obj);
915+
901916
pci_scan_child_bus(bus);
902917
pci_set_host_bridge_release(to_pci_host_bridge(bus->bridge),
903918
acpi_pci_root_release_info, 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
@@ -488,6 +488,8 @@ struct pci_host_bridge {
488488
struct msi_controller *msi;
489489
unsigned int ignore_reset_delay:1; /* for entire hierarchy */
490490
unsigned int no_ext_tags:1; /* no Extended Tags */
491+
unsigned int preserve_config:1; /* Preserve FW resource setup */
492+
491493
/* Resource alignment requirements */
492494
resource_size_t (*align_resource)(struct pci_dev *dev,
493495
const struct resource *res,

0 commit comments

Comments
 (0)