File tree Expand file tree Collapse file tree 4 files changed +38
-12
lines changed Expand file tree Collapse file tree 4 files changed +38
-12
lines changed Original file line number Diff line number Diff line change @@ -1008,7 +1008,6 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
1008
1008
int node = acpi_get_node (device -> handle );
1009
1009
struct pci_bus * bus ;
1010
1010
struct pci_host_bridge * host_bridge ;
1011
- union acpi_object * obj ;
1012
1011
1013
1012
info -> root = root ;
1014
1013
info -> bridge = device ;
@@ -1050,17 +1049,6 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
1050
1049
if (!(root -> osc_ext_control_set & OSC_CXL_ERROR_REPORTING_CONTROL ))
1051
1050
host_bridge -> native_cxl_error = 0 ;
1052
1051
1053
- /*
1054
- * Evaluate the "PCI Boot Configuration" _DSM Function. If it
1055
- * exists and returns 0, we must preserve any PCI resource
1056
- * assignments made by firmware for this host bridge.
1057
- */
1058
- obj = acpi_evaluate_dsm_typed (ACPI_HANDLE (bus -> bridge ), & pci_acpi_dsm_guid , 1 ,
1059
- DSM_PCI_PRESERVE_BOOT_CONFIG , NULL , ACPI_TYPE_INTEGER );
1060
- if (obj && obj -> integer .value == 0 )
1061
- host_bridge -> preserve_config = 1 ;
1062
- ACPI_FREE (obj );
1063
-
1064
1052
acpi_dev_power_up_children_with_adr (device );
1065
1053
1066
1054
pci_scan_child_bus (bus );
Original file line number Diff line number Diff line change @@ -119,6 +119,28 @@ phys_addr_t acpi_pci_root_get_mcfg_addr(acpi_handle handle)
119
119
return (phys_addr_t )mcfg_addr ;
120
120
}
121
121
122
+ bool pci_acpi_preserve_config (struct pci_host_bridge * host_bridge )
123
+ {
124
+ if (ACPI_HANDLE (& host_bridge -> dev )) {
125
+ union acpi_object * obj ;
126
+
127
+ /*
128
+ * Evaluate the "PCI Boot Configuration" _DSM Function. If it
129
+ * exists and returns 0, we must preserve any PCI resource
130
+ * assignments made by firmware for this host bridge.
131
+ */
132
+ obj = acpi_evaluate_dsm_typed (ACPI_HANDLE (& host_bridge -> dev ),
133
+ & pci_acpi_dsm_guid ,
134
+ 1 , DSM_PCI_PRESERVE_BOOT_CONFIG ,
135
+ NULL , ACPI_TYPE_INTEGER );
136
+ if (obj && obj -> integer .value == 0 )
137
+ return true;
138
+ ACPI_FREE (obj );
139
+ }
140
+
141
+ return false;
142
+ }
143
+
122
144
/* _HPX PCI Setting Record (Type 0); same as _HPP */
123
145
struct hpx_type0 {
124
146
u32 revision ; /* Not present in _HPP */
Original file line number Diff line number Diff line change @@ -732,6 +732,7 @@ static inline void pci_restore_aer_state(struct pci_dev *dev) { }
732
732
#endif
733
733
734
734
#ifdef CONFIG_ACPI
735
+ bool pci_acpi_preserve_config (struct pci_host_bridge * bridge );
735
736
int pci_acpi_program_hp_params (struct pci_dev * dev );
736
737
extern const struct attribute_group pci_dev_acpi_attr_group ;
737
738
void pci_set_acpi_fwnode (struct pci_dev * dev );
@@ -745,6 +746,10 @@ int acpi_pci_wakeup(struct pci_dev *dev, bool enable);
745
746
bool acpi_pci_need_resume (struct pci_dev * dev );
746
747
pci_power_t acpi_pci_choose_state (struct pci_dev * pdev );
747
748
#else
749
+ static inline bool pci_acpi_preserve_config (struct pci_host_bridge * bridge )
750
+ {
751
+ return false;
752
+ }
748
753
static inline int pci_dev_acpi_reset (struct pci_dev * dev , bool probe )
749
754
{
750
755
return - ENOTTY ;
Original file line number Diff line number Diff line change @@ -889,6 +889,14 @@ static void pci_set_bus_msi_domain(struct pci_bus *bus)
889
889
dev_set_msi_domain (& bus -> dev , d );
890
890
}
891
891
892
+ static bool pci_preserve_config (struct pci_host_bridge * host_bridge )
893
+ {
894
+ if (pci_acpi_preserve_config (host_bridge ))
895
+ return true;
896
+
897
+ return false;
898
+ }
899
+
892
900
static int pci_register_host_bridge (struct pci_host_bridge * bridge )
893
901
{
894
902
struct device * parent = bridge -> dev .parent ;
@@ -983,6 +991,9 @@ static int pci_register_host_bridge(struct pci_host_bridge *bridge)
983
991
if (nr_node_ids > 1 && pcibus_to_node (bus ) == NUMA_NO_NODE )
984
992
dev_warn (& bus -> dev , "Unknown NUMA node; performance will be reduced\n" );
985
993
994
+ /* Check if the boot configuration by FW needs to be preserved */
995
+ bridge -> preserve_config = pci_preserve_config (bridge );
996
+
986
997
/* Coalesce contiguous windows */
987
998
resource_list_for_each_entry_safe (window , n , & resources ) {
988
999
if (list_is_last (& window -> node , & resources ))
You can’t perform that action at this time.
0 commit comments