aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/pci_root.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/pci_root.c')
-rw-r--r--drivers/acpi/pci_root.c67
1 files changed, 12 insertions, 55 deletions
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 7928d4dc7056..22a8458b4ec9 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -47,7 +47,6 @@ ACPI_MODULE_NAME("pci_root");
47#define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge" 47#define ACPI_PCI_ROOT_DEVICE_NAME "PCI Root Bridge"
48static int acpi_pci_root_add(struct acpi_device *device); 48static int acpi_pci_root_add(struct acpi_device *device);
49static int acpi_pci_root_remove(struct acpi_device *device, int type); 49static int acpi_pci_root_remove(struct acpi_device *device, int type);
50static int acpi_pci_root_start(struct acpi_device *device);
51 50
52#define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \ 51#define ACPI_PCIE_REQ_SUPPORT (OSC_EXT_PCI_CONFIG_SUPPORT \
53 | OSC_ACTIVE_STATE_PWR_SUPPORT \ 52 | OSC_ACTIVE_STATE_PWR_SUPPORT \
@@ -67,7 +66,6 @@ static struct acpi_driver acpi_pci_root_driver = {
67 .ops = { 66 .ops = {
68 .add = acpi_pci_root_add, 67 .add = acpi_pci_root_add,
69 .remove = acpi_pci_root_remove, 68 .remove = acpi_pci_root_remove,
70 .start = acpi_pci_root_start,
71 }, 69 },
72}; 70};
73 71
@@ -188,21 +186,6 @@ static acpi_status try_get_root_bridge_busnr(acpi_handle handle,
188 return AE_OK; 186 return AE_OK;
189} 187}
190 188
191static void acpi_pci_bridge_scan(struct acpi_device *device)
192{
193 int status;
194 struct acpi_device *child = NULL;
195
196 if (device->flags.bus_address)
197 if (device->parent && device->parent->ops.bind) {
198 status = device->parent->ops.bind(device);
199 if (!status) {
200 list_for_each_entry(child, &device->children, node)
201 acpi_pci_bridge_scan(child);
202 }
203 }
204}
205
206static u8 pci_osc_uuid_str[] = "33DB4D5B-1FF7-401C-9657-7441C03DD766"; 189static u8 pci_osc_uuid_str[] = "33DB4D5B-1FF7-401C-9657-7441C03DD766";
207 190
208static acpi_status acpi_pci_run_osc(acpi_handle handle, 191static acpi_status acpi_pci_run_osc(acpi_handle handle,
@@ -452,7 +435,7 @@ static int acpi_pci_root_add(struct acpi_device *device)
452 int result; 435 int result;
453 struct acpi_pci_root *root; 436 struct acpi_pci_root *root;
454 acpi_handle handle; 437 acpi_handle handle;
455 struct acpi_device *child; 438 struct acpi_pci_driver *driver;
456 u32 flags, base_flags; 439 u32 flags, base_flags;
457 bool is_osc_granted = false; 440 bool is_osc_granted = false;
458 441
@@ -603,21 +586,6 @@ static int acpi_pci_root_add(struct acpi_device *device)
603 goto out_del_root; 586 goto out_del_root;
604 } 587 }
605 588
606 /*
607 * Attach ACPI-PCI Context
608 * -----------------------
609 * Thus binding the ACPI and PCI devices.
610 */
611 result = acpi_pci_bind_root(device);
612 if (result)
613 goto out_del_root;
614
615 /*
616 * Scan and bind all _ADR-Based Devices
617 */
618 list_for_each_entry(child, &device->children, node)
619 acpi_pci_bridge_scan(child);
620
621 /* ASPM setting */ 589 /* ASPM setting */
622 if (is_osc_granted) { 590 if (is_osc_granted) {
623 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM) 591 if (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_ASPM)
@@ -632,24 +600,6 @@ static int acpi_pci_root_add(struct acpi_device *device)
632 if (device->wakeup.flags.run_wake) 600 if (device->wakeup.flags.run_wake)
633 device_set_run_wake(root->bus->bridge, true); 601 device_set_run_wake(root->bus->bridge, true);
634 602
635 return 0;
636
637out_del_root:
638 mutex_lock(&acpi_pci_root_lock);
639 list_del(&root->node);
640 mutex_unlock(&acpi_pci_root_lock);
641
642 acpi_pci_irq_del_prt(root->segment, root->secondary.start);
643end:
644 kfree(root);
645 return result;
646}
647
648static int acpi_pci_root_start(struct acpi_device *device)
649{
650 struct acpi_pci_root *root = acpi_driver_data(device);
651 struct acpi_pci_driver *driver;
652
653 if (system_state != SYSTEM_BOOTING) 603 if (system_state != SYSTEM_BOOTING)
654 pci_assign_unassigned_bus_resources(root->bus); 604 pci_assign_unassigned_bus_resources(root->bus);
655 605
@@ -664,8 +614,17 @@ static int acpi_pci_root_start(struct acpi_device *device)
664 pci_enable_bridges(root->bus); 614 pci_enable_bridges(root->bus);
665 615
666 pci_bus_add_devices(root->bus); 616 pci_bus_add_devices(root->bus);
667
668 return 0; 617 return 0;
618
619out_del_root:
620 mutex_lock(&acpi_pci_root_lock);
621 list_del(&root->node);
622 mutex_unlock(&acpi_pci_root_lock);
623
624 acpi_pci_irq_del_prt(root->segment, root->secondary.start);
625end:
626 kfree(root);
627 return result;
669} 628}
670 629
671static int acpi_pci_root_remove(struct acpi_device *device, int type) 630static int acpi_pci_root_remove(struct acpi_device *device, int type)
@@ -699,7 +658,7 @@ static int acpi_pci_root_remove(struct acpi_device *device, int type)
699 return 0; 658 return 0;
700} 659}
701 660
702static int __init acpi_pci_root_init(void) 661int __init acpi_pci_root_init(void)
703{ 662{
704 acpi_hest_init(); 663 acpi_hest_init();
705 664
@@ -712,5 +671,3 @@ static int __init acpi_pci_root_init(void)
712 671
713 return 0; 672 return 0;
714} 673}
715
716subsys_initcall(acpi_pci_root_init);