Skip to content

Commit 9ffed75

Browse files
AaronDotopsiff
authored andcommitted
LoongArch: Preserve firmware configuration if ACPI requires.
According to PCI Firmware Specification, if ACPI DSM#5 function returns 0, the OS must retain the resource allocation for PCI in the firmware; if ACPI DSM#5 function returns 1, the OS can ignore the resource allocation for PCI and reallocate it. Signed-off-by: Gao Qihang <gaoqihang@loongson.cn> Signed-off-by: Juxin Gao <gaojuxin@loongson.cn> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
1 parent 1246e9f commit 9ffed75

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

arch/loongarch/pci/acpi.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
199199
struct acpi_pci_root_ops *root_ops;
200200
int domain = root->segment;
201201
int busnum = root->secondary.start;
202+
struct pci_host_bridge *host;
202203

203204
info = kzalloc(sizeof(*info), GFP_KERNEL);
204205
if (!info) {
@@ -239,8 +240,17 @@ struct pci_bus *pci_acpi_scan_root(struct acpi_pci_root *root)
239240
return NULL;
240241
}
241242

242-
pci_bus_size_bridges(bus);
243-
pci_bus_assign_resources(bus);
243+
/* If we must preserve the resource configuration, claim now */
244+
host = pci_find_host_bridge(bus);
245+
if (host->preserve_config)
246+
pci_bus_claim_resources(bus);
247+
248+
/*
249+
* Assign whatever was left unassigned. If we didn't claim above,
250+
* this will reassign everything.
251+
*/
252+
pci_assign_unassigned_root_bus_resources(bus);
253+
244254
list_for_each_entry(child, &bus->children, node)
245255
pcie_bus_configure_settings(child);
246256
}

0 commit comments

Comments
 (0)