13 Jul, 2010

2 commits

  • Currently, during initialization ACPICA walks the entire ACPI
    namespace in search of any device objects with assciated _PRW
    methods. All of the _PRW methods found are executed in the process
    to extract the GPE information returned by them, so that the GPEs in
    question can be marked as "able to wakeup" (more precisely, the
    ACPI_GPE_CAN_WAKE flag is set for them). The only purpose of this
    exercise is to avoid enabling the CAN_WAKE GPEs automatically, even
    if there are _Lxx/_Exx methods associated with them. However, it is
    both costly and unnecessary, because the host OS has to execute the
    _PRW methods anyway to check which devices can wake up the system
    from sleep states. Moreover, it then uses full information
    returned by _PRW, including the GPE information, so it can take care
    of disabling the GPEs if necessary.

    Remove the code that walks the namespace and executes _PRW from
    ACPICA and modify comments to reflect that change. Make
    acpi_bus_set_run_wake_flags() disable GPEs for wakeup devices
    so that they don't cause spurious wakeup events to be signaled.
    This not only reduces the complexity of the ACPICA initialization
    code, but in some cases it should reduce the kernel boot time as
    well.

    Unfortunately, for this purpose we need a new ACPICA function,
    acpi_gpe_can_wake(), to be called by the host OS in order to disable
    the GPEs that can wake up the system and were previously enabled by
    acpi_ev_initialize_gpe_block() or acpi_ev_update_gpes() (such a GPE
    should be disabled only once, because the initialization code enables
    it only once, but it may be pointed to by _PRW for multiple devices
    and that's why the additional function is necessary).

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     
  • When we check if a GPE can be used for runtime signaling, we only
    search the FADT GPE blocks, which is incorrect, becuase the GPE
    may be located elsewhere. We really should be using the GPE device
    information previously returned by _PRW here, so make that happen.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     

20 Apr, 2010

1 commit

  • We have ported Rafael's major GPE changes
    (ACPI: Use GPE reference counting to support shared GPEs) into ACPICA code base.
    But the port and Rafael's original patch have some differences, so we made
    below patch to make linux GPE code consistent with ACPICA code base.

    Most changes are about comments and coding styles.
    Other noticeable changes are based on:

    Rafael: Reduce code duplication related to GPE lookup
    https://patchwork.kernel.org/patch/86237/

    Rafael: Always use the same lock for GPE locking
    https://patchwork.kernel.org/patch/90471/

    A new field gpe_count in struct acpi_gpe_block_info to record the number
    of individual GPEs in block.

    Rename acpi_ev_save_method_info to acpi_ev_match_gpe_method.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Robert Moore
    Signed-off-by: Lin Ming
    Signed-off-by: Len Brown

    Lin Ming
     

07 Apr, 2010

1 commit


04 Apr, 2010

1 commit

  • Previously, we assumed the only Device object immediately below the root
    was the \_SB Scope (which the ACPI CA treats as a Device), so we forced
    the HID of all such objects to ACPI_BUS_HID ("LNXSYBUS").

    However, there are DSDTs that supply root-level Device objects with _HIDs.
    This patch makes us pay attention to those _HIDs and only add the synthetic
    ACPI_BUS_HID for root-level objects that do not supply their own _HID.

    For example, this DSDT: https://bugzilla.kernel.org/show_bug.cgi?id=15605
    contains:

    Scope (_SB) {
    ...
    }
    Device (AMW0) {
    Name (_HID, EisaId ("PNP0C14"))
    ...
    }

    and we should use "PNP0C14" for the AMW0 device, not "LNXSYBUS".

    Signed-off-by: Bjorn Helgaas
    Acked-by: Zhang Rui
    Tested-by: Yong Wang
    Signed-off-by: Len Brown

    Bjorn Helgaas
     

30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

24 Mar, 2010

1 commit

  • On some old IBM workstations and desktop computers, the BIOS presents in the
    DSDT an SMBus object that is missing the HID identifier that the i2c-scmi
    driver looks for. Modify the ACPI device scan code to insert the missing HID
    if it finds an IBM system with such an object.

    Affected machines: IntelliStation Z20/Z30. Note that the i2c-i801 driver no
    longer works on these machines because of ACPI resource conflicts.

    Signed-off-by: Darrick J. Wong
    Signed-off-by: Jean Delvare

    Darrick J. Wong
     

23 Feb, 2010

2 commits

  • Although the majority of PCI devices can generate PMEs that in
    principle may be used to wake up devices suspended at run time,
    platform support is generally necessary to convert PMEs into wake-up
    events that can be delivered to the kernel. If ACPI is used for this
    purpose, PME signals generated by a PCI device will trigger the ACPI
    GPE associated with the device to generate an ACPI wake-up event that
    we can set up a handler for, provided that everything is configured
    correctly.

    Unfortunately, the subset of PCI devices that have GPEs associated
    with them is quite limited. The devices without dedicated GPEs have
    to rely on the GPEs associated with other devices (in the majority of
    cases their upstream bridges and, possibly, the root bridge) to
    generate ACPI wake-up events in response to PME signals from them.

    Add ACPI platform support for PCI PME wake-up:
    o Add a framework making is possible to use ACPI system notify
    handlers for run-time PM.
    o Add new PCI platform callback ->run_wake() to struct
    pci_platform_pm_ops allowing us to enable/disable the platform to
    generate wake-up events for given device. Implemet this callback
    for the ACPI platform.
    o Define ACPI wake-up handlers for PCI devices and PCI root buses and
    make the PCI-ACPI binding code register wake-up notifiers for all
    PCI devices present in the ACPI tables.
    o Add function pci_dev_run_wake() which can be used by PCI drivers to
    check if given device is capable of generating wake-up events at
    run time.

    Developed in cooperation with Matthew Garrett .

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     
  • Use the run_wake flag to mark all devices for which run-time wake-up
    events may be generated by the platform. Introduce a new wake-up
    flag, always_enabled, for marking devices that should be permanently
    enabled to generate run-time events. Also, introduce a reference
    counter for run-wake devices and a function that will initialize all
    of the run-time wake-up fields for given device.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Len Brown
    Signed-off-by: Jesse Barnes

    Rafael J. Wysocki
     

01 Feb, 2010

2 commits

  • Callers (acpi_memhotplug.c, dock.c and others) check for the return
    value of acpi_bus_add() and assume a valid device was returned in
    case zero was returned.

    Thus return -ENODEV if no device was found in acpi_bus_scan and
    propagate this through acpi_bus_add and acpi_bus_start.

    Also remove a confusing comment in acpiphp_glue.c, acpi_bus_scan
    will and cannot invoke if acpi_bus_add returns no valid device.

    Signed-off-by: Thomas Renninger
    Acked-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Thomas Renninger
     
  • If acpi_bus_add does not return a device and it's passed
    to acpi_bus_start, bad things will happen:

    BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
    IP: [] acpi_bus_start+0x14/0x24
    ...
    [] acpiphp_bus_add+0xba/0x130 [acpiphp]
    [] enable_device+0x132/0x2ff [acpiphp]
    [] acpiphp_enable_slot+0xb8/0x130 [acpiphp]
    [] handle_hotplug_event_func+0x87/0x190 [acpiphp]

    Next patch would make this NULL pointer check obsolete, but
    better having one more than one missing...

    Signed-off-by: Thomas Renninger
    Acked-by: Bjorn Helgaas
    CC: stable@kernel.org
    Signed-off-by: Len Brown

    Thomas Renninger
     

25 Nov, 2009

1 commit

  • The existing interface only has a pre-order callback. This change
    adds an additional parameter for a post-order callback which will
    be more useful for bus scans. ACPICA BZ 779.

    Also update the external calls to acpi_walk_namespace.

    http://www.acpica.org/bugzilla/show_bug.cgi?id=779

    Signed-off-by: Lin Ming
    Signed-off-by: Bob Moore
    Signed-off-by: Len Brown

    Lin Ming
     

02 Oct, 2009

1 commit

  • Free an acpi_get_object_info() buffer when we're finished. Skip the
    acpi_get_name() altogether -- it was only used for a printk that was
    really just for debug anyway.

    http://bugzilla.kernel.org/show_bug.cgi?id=14271

    Signed-off-by: Bjorn Helgaas
    Reported-and-tested-by: Zdenek Kabelac
    Signed-off-by: Len Brown

    Bjorn Helgaas
     

26 Sep, 2009

23 commits

  • Minor code cleanup, no functional change. Instead of remembering
    what HIDs & CIDs to add later, just add them immediately.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • Nobody uses acpi_device_uid(), so this patch removes it.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • Every acpi_device has at least one ID (if there's no _HID or _CID, we
    give it a synthetic or default ID). So there's no longer a need to
    check whether an ID exists; we can just use it.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • We now keep a single list of IDs that includes both the _HID and any
    _CIDs. We no longer need to keep track of whether the device has a _CID.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • There's no need to treat _HID and _CID differently. Keeping them in
    a single list makes code that uses the IDs a little simpler because it
    can just traverse the list rather than checking "do we have a HID?",
    "do we have any CIDs?"

    Signed-off-by: Bjorn Helgaas
    Reviewed-by: Alex Chiang
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • This makes sure every acpi_device has at least one ID. If we build an
    acpi_device for a namespace node with no _HID or _CID, we sometimes
    synthesize an ID like "LNXCPU" or "LNXVIDEO". If we don't even have
    that, give it a default "device" ID.

    Note that this means things like:
    /sys/devices/LNXSYSTM:00/LNXSYBUS:00/HWP0001:00/HWP0002:04/device:00
    (a PCI slot SxFy device) will have "hid" and "modprobe" entries, where
    they didn't before. These aren't very useful (a HID of "device" doesn't
    tell you what *kind* of device it is, so it doesn't help find a driver),
    but I don't think they're harmful.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • Use acpi_device_hid() rather than accessing acpi_device.pnp.hardware_id
    directly.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • This makes \_SB_ show up as /sys/devices/LNXSYSTM:00/LNXSYBUS:00
    rather than "device:00". This has been broken for a loooong time
    (at least since 2.6.13) because device->parent is an acpi_device
    pointer, not a handle.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • acpi_bus_scan() traverses the namespace to enumerate devices and uses
    acpi_add_single_object() to create acpi_devices. When the platform
    notifies us of a hot-plug event, we need to traverse part of the namespace
    again to figure out what appeared or disappeared. (We don't yet call
    acpi_bus_scan() during hot-plug, but I plan to do that in the future.)

    This patch makes acpi_add_single_object() notice when we already have
    an acpi_device, so we don't need to make a new one.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • This patch adds acpi_bus_type_and_status(), which determines the type
    of the object and whether we want to build an acpi_device for it. If
    it is acpi_device-worthy, it returns the type and the device's current
    status.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • acpi_bus_scan() currently walks the namespace manually. This patch changes
    it to use acpi_walk_namespace() instead.

    Besides removing some complicated code, this means we take advantage of the
    namespace locking done by acpi_walk_namespace(). The locking isn't so
    important at boot-time, but I hope to eventually use this same path to
    handle hot-addition of devices, when it will be important.

    Note that acpi_walk_namespace() does not actually visit the starting node
    first, so we need to do that by hand first.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • We can identify the root of the ACPI device tree by the fact that it
    has no parent. This is simpler than passing around ACPI_BUS_TYPE_SYSTEM
    and will help remove special treatment of the device tree root.

    Currently, we add the root by hand with ACPI_BUS_TYPE_SYSTEM. If we
    traverse the tree treating the root as just another device and use
    acpi_get_type(), the root shows up as ACPI_TYPE_DEVICE.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • This patch changes the order so we enumerate in the "root, namespace,
    functional fixed" order instead of the "root, functional fixed, namespace"
    order. When I change acpi_bus_scan() to use acpi_walk_namespace(), it
    will use the former order, so this patch isolates the order change for
    bisectability.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • This patch changes acpi_bus_scan() to take an acpi_handle rather than an
    acpi_device pointer. I plan to use acpi_bus_scan() in the hotplug path,
    and I'd rather not assume that notifications only go to nodes that already
    have acpi_devices.

    This will also help remove the special case for adding the root node. We
    currently add the root by hand before acpi_bus_scan(), but using a handle
    here means we can start the acpi_bus_scan() directly with the root even
    though it doesn't have an acpi_device yet.

    Note that acpi_bus_scan() currently adds and/or starts the *children* of
    its device argument. It doesn't do anything with the device itself.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • This patch adds acpi_bus_get_parent(), which ascends the namespace until
    it finds a parent with an acpi_device.

    Then we use acpi_bus_get_parent() in acpi_add_single_object(), so callers
    don't have to figure out or keep track of the parent acpi_device.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • acpi_add_single_object() is static, and all callers supply a valid "child"
    argument, so we don't need to check it. This patch also remove some
    unnecessary initializations.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • We now save the ACPI bus "device_type" in the acpi_device structure, so
    we don't need to pass it around explicitly anymore.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • We only pass the "type" to acpi_device_set_context() so we know whether
    the device has a handle to which we can attach the acpi_device pointer.
    But it's safer to just check for the handle directly, since it's in the
    acpi_device already.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • Check the acpi_device device_type rather than the HID.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • Most uses of the ACPI bus device_type (ACPI_BUS_TYPE_DEVICE,
    ACPI_BUS_TYPE_POWER, etc) are during device initialization, but
    we do need it later for notify handler installation, since that
    is different for fixed hardware devices vs. namespace devices.

    This patch saves the device_type in the acpi_device structure,
    so we can check that rather than comparing against the _HID string.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • In several cases, functions take handle and parent device pointers in
    addition to acpi_device pointers. But the acpi_device structure contains
    both the handle and the parent pointer, so it's pointless and error-prone
    to pass them all. This patch removes the unnecessary "handle" and "parent"
    arguments.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • We never use the "root" argument, so just remove it.

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     
  • Add debug output for adding an ACPI device. Enable this with
    "acpi.debug_layer=0x00010000" (ACPI_BUS_COMPONENT).

    Signed-off-by: Bjorn Helgaas
    Signed-off-by: Len Brown

    Bjorn Helgaas
     

19 Sep, 2009

4 commits