2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-19 18:53:52 +08:00
linux-next/arch/x86/pci
Rafael J. Wysocki 6c0cc950ae ACPI / PCI: Set root bridge ACPI handle in advance
The ACPI handles of PCI root bridges need to be known to
acpi_bind_one(), so that it can create the appropriate
"firmware_node" and "physical_node" files for them, but currently
the way it gets to know those handles is not exactly straightforward
(to put it lightly).

This is how it works, roughly:

  1. acpi_bus_scan() finds the handle of a PCI root bridge,
     creates a struct acpi_device object for it and passes that
     object to acpi_pci_root_add().

  2. acpi_pci_root_add() creates a struct acpi_pci_root object,
     populates its "device" field with its argument's address
     (device->handle is the ACPI handle found in step 1).

  3. The struct acpi_pci_root object created in step 2 is passed
     to pci_acpi_scan_root() and used to get resources that are
     passed to pci_create_root_bus().

  4. pci_create_root_bus() creates a struct pci_host_bridge object
     and passes its "dev" member to device_register().

  5. platform_notify(), which for systems with ACPI is set to
     acpi_platform_notify(), is called.

So far, so good.  Now it starts to be "interesting".

  6. acpi_find_bridge_device() is used to find the ACPI handle of
     the given device (which is the PCI root bridge) and executes
     acpi_pci_find_root_bridge(), among other things, for the
     given device object.

  7. acpi_pci_find_root_bridge() uses the name (sic!) of the given
     device object to extract the segment and bus numbers of the PCI
     root bridge and passes them to acpi_get_pci_rootbridge_handle().

  8. acpi_get_pci_rootbridge_handle() browses the list of ACPI PCI
     root bridges and finds the one that matches the given segment
     and bus numbers.  Its handle is then used to initialize the
     ACPI handle of the PCI root bridge's device object by
     acpi_bind_one().  However, this is *exactly* the ACPI handle we
     started with in step 1.

Needless to say, this is quite embarassing, but it may be avoided
thanks to commit f3fd0c8 (ACPI: Allow ACPI handles of devices to be
initialized in advance), which makes it possible to initialize the
ACPI handle of a device before passing it to device_register().

Accordingly, add a new __weak routine, pcibios_root_bridge_prepare(),
defaulting to an empty implementation that can be replaced by the
interested architecutres (x86 and ia64 at the moment) with functions
that will set the root bridge's ACPI handle before its dev member is
passed to device_register().  Make both x86 and ia64 provide such
implementations of pcibios_root_bridge_prepare() and remove
acpi_pci_find_root_bridge() and acpi_get_pci_rootbridge_handle() that
aren't necessary any more.

Included is a fix for breakage on systems with non-ACPI PCI host
bridges from Bjorn Helgaas.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
2013-01-13 17:14:28 -07:00
..
acpi.c ACPI / PCI: Set root bridge ACPI handle in advance 2013-01-13 17:14:28 -07:00
amd_bus.c x86/PCI: put busn resource in pci_root_info for native host bridge drivers 2012-06-13 15:42:24 -06:00
broadcom_bus.c x86/PCI: dynamically allocate pci_root_info for native host bridge drivers 2012-04-30 14:52:43 -06:00
bus_numa.c x86/PCI: put busn resource in pci_root_info for native host bridge drivers 2012-06-13 15:42:24 -06:00
bus_numa.h x86/PCI: put busn resource in pci_root_info for native host bridge drivers 2012-06-13 15:42:24 -06:00
ce4100.c x86/ce4100: Fix PCI configuration register access for devices without interrupts 2012-10-30 10:16:47 +01:00
common.c PCI: Work around Stratus ftServer broken PCIe hierarchy (fix DMI check) 2012-12-26 10:39:23 -07:00
direct.c x86: constify PCI raw ops structures 2011-10-14 09:05:28 -07:00
early.c x86/PCI: remove early PCI pr_debug statements 2009-11-24 15:25:19 -08:00
fixup.c Merge branch 'drm-core-next' of git://people.freedesktop.org/~airlied/linux 2012-05-24 12:42:54 -07:00
i386.c x86/PCI: Implement pcibios_resource_survey_bus() 2013-01-07 15:58:48 -07:00
init.c x86, olpc: Use pci subarch init for OLPC 2010-02-25 19:26:23 -08:00
irq.c x86/PCI: irq and pci_ids patch for Intel Panther Point DeviceIDs 2011-05-10 15:43:36 -07:00
legacy.c x86/PCI: use pci_scan_bus() instead of pci_scan_bus_parented() 2012-01-06 12:11:13 -08:00
Makefile x86/PCI: Add NumaChip remote PCI support 2012-12-07 14:24:32 -07:00
mmconfig_32.c x86/PCI: update MMCONFIG information when hot-plugging PCI host bridges 2012-06-22 15:17:00 -06:00
mmconfig_64.c x86/PCI: use pr_level() to replace printk(KERN_LEVEL) 2012-06-22 15:18:05 -06:00
mmconfig-shared.c arch/x86: Remove unecessary semicolons 2012-09-19 17:32:48 +02:00
mrst.c PCI: do not call pci_set_power_state with PCI_D3cold 2012-06-23 10:50:44 -06:00
numachip.c x86/PCI: Add NumaChip remote PCI support 2012-12-07 14:24:32 -07:00
numaq_32.c x86/PCI: use pci_scan_bus() instead of pci_scan_bus_parented() 2012-01-06 12:11:13 -08:00
olpc.c x86: constify PCI raw ops structures 2011-10-14 09:05:28 -07:00
pcbios.c typo fixes: aera -> area, exntension -> extension 2011-12-09 15:22:07 +01:00
sta2x11-fixup.c x86, platform: Initial support for sta2x11 I/O hub 2012-04-12 11:10:30 -07:00
visws.c PCI: Provide a default pcibios_update_irq() 2012-09-18 17:28:21 -06:00
xen.c xen: do not map the same GSI twice in PVHVM guests. 2012-05-21 14:11:36 -04:00