• Rafael J. Wysocki's avatar
    ACPI: Separate adding ACPI device objects from probing ACPI drivers · 805d410f
    Rafael J. Wysocki authored
    Split the ACPI namespace scanning for devices into two passes, such
    that struct acpi_device objects are registerd in the first pass
    without probing ACPI drivers and the drivers are probed against them
    directly in the second pass.
    
    There are two main reasons for doing that.
    
    First, the ACPI PCI root bridge driver's .add() routine,
    acpi_pci_root_add(), causes struct pci_dev objects to be created for
    all PCI devices under the given root bridge.  Usually, there are
    corresponding ACPI device nodes in the ACPI namespace for some of
    those devices and therefore there should be "companion" struct
    acpi_device objects to attach those struct pci_dev objects to.  These
    struct acpi_device objects should exist when the corresponding
    struct pci_dev objects are created, but that is only guaranteed
    during boot and not during hotplug.  This leads to a number of
    functional differences between the boot and the hotplug cases which
    are not strictly necessary and make the code more complicated.
    
    For example, this forces the ACPI PCI root bridge driver to defer the
    registration of the just created struct pci_dev objects and to use a
    special .start() callback routine, acpi_pci_root_start(), to make
    sure that all of the "companion" struct acpi_device objects will be
    present at PCI devices registration time during hotplug.
    
    If those differences can be eliminated, we will be able to
    consolidate the boot and hotplug code paths for the enumeration and
    registration of PCI devices and to reduce the complexity of that
    code quite a bit.
    
    The second reason is that, in general, it should be possible to
    resolve conflicts of resources assigned by the BIOS to different
    devices represented by ACPI namespace nodes before any drivers bind
    to them and before they are attached to "companion" objects
    representing physical devices (such as struct pci_dev).  However, for
    this purpose we first need to enumerate all ACPI device nodes in the
    given namespace scope.
    Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
    Acked-by: default avatarYinghai Lu <yinghai@kernel.org>
    Acked-by: default avatarToshi Kani <toshi.kani@hp.com>
    805d410f
acpi_bus.h 14.5 KB