1. 26 1月, 2013 1 次提交
    • R
      ACPI: Rework acpi_get_child() to be more efficient · 33f767d7
      Rafael J. Wysocki 提交于
      Observe that acpi_get_child() doesn't need to use the helper
      struct acpi_find_child structure and change it to work without it.
      Also, using acpi_get_object_info() to get the output of _ADR for the
      given device is overkill, because that function does much more than
      just evaluating _ADR (let alone the additional memory allocation
      done by it).
      
      Moreover, acpi_get_child() doesn't need to loop any more once it has
      found a matching handle, so make it stop in that case.  To prevent
      the results from changing, make it use do_acpi_find_child() as
      a post-order callback.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      33f767d7
  2. 12 1月, 2013 1 次提交
  3. 03 1月, 2013 1 次提交
  4. 21 11月, 2012 2 次提交
    • R
      ACPI / driver core: Introduce struct acpi_dev_node and related macros · 95f8a082
      Rafael J. Wysocki 提交于
      To avoid adding an ACPI handle pointer to struct device on
      architectures that don't use ACPI, or generally when CONFIG_ACPI is
      not set, in which cases that pointer is useless, define struct
      acpi_dev_node that will contain the handle pointer if CONFIG_ACPI is
      set and will be empty otherwise and use it to represent the ACPI
      device node field in struct device.
      
      In addition to that define macros for reading and setting the ACPI
      handle of a device that don't generate code when CONFIG_ACPI is
      unset.  Modify the ACPI subsystem to use those macros instead of
      referring to the given device's ACPI handle directly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      95f8a082
    • R
      ACPI: Allow ACPI handles of devices to be initialized in advance · f3fd0c8a
      Rafael J. Wysocki 提交于
      Currently, the ACPI handles of devices are initialized from within
      device_add(), by acpi_bind_one() called from acpi_platform_notify()
      which first uses the .find_device() routine provided by the device's
      bus type to find the matching device node in the ACPI namespace.
      This is a source of some computational overhead and, moreover, the
      correctness of the result depends on the implementation of
      .find_device() which is known to fail occasionally for some bus types
      (e.g. PCI).  In some cases, however, the corresponding ACPI device
      node is known already before calling device_add() for the given
      struct device object and the whole .find_device() dance in
      acpi_platform_notify() is then simply unnecessary.
      
      For this reason, make it possible to initialize the ACPI handles of
      devices before calling device_add() for them.  Modify
      acpi_platform_notify() to call acpi_bind_one() in advance to check
      the device's existing ACPI handle and skip the .find_device()
      search if that is successful.  Change acpi_bind_one() accordingly.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      f3fd0c8a
  5. 15 11月, 2012 1 次提交
    • M
      driver core / ACPI: Move ACPI support to core device and driver types · 06f64c8f
      Mika Westerberg 提交于
      With ACPI 5 we are starting to see devices that don't natively support
      discovery but can be enumerated with the help of the ACPI namespace.
      Typically, these devices can be represented in the Linux device driver
      model as platform devices or some serial bus devices, like SPI or I2C
      devices.
      
      Since we want to re-use existing drivers for those devices, we need a
      way for drivers to specify the ACPI IDs of supported devices, so that
      they can be matched against device nodes in the ACPI namespace.  To
      this end, it is sufficient to add a pointer to an array of supported
      ACPI device IDs, that can be provided by the driver, to struct device.
      
      Moreover, things like ACPI power management need to have access to
      the ACPI handle of each supported device, because that handle is used
      to invoke AML methods associated with the corresponding ACPI device
      node.  The ACPI handles of devices are now stored in the archdata
      member structure of struct device whose definition depends on the
      architecture and includes the ACPI handle only on x86 and ia64. Since
      the pointer to an array of supported ACPI IDs is added to struct
      device_driver in an architecture-independent way, it is logical to
      move the ACPI handle from archdata to struct device itself at the same
      time.  This also makes code more straightforward in some places and
      follows the example of Device Trees that have a poiter to struct
      device_node in there too.
      
      This changeset is based on Mika Westerberg's work.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NH. Peter Anvin <hpa@zytor.com>
      Acked-by: NTony Luck <tony.luck@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      06f64c8f
  6. 23 10月, 2012 1 次提交
  7. 22 9月, 2012 1 次提交
    • L
      ACPI: Allow ACPI binding with USB-3.0 hub · 1033f904
      Lan Tianyu 提交于
      A USB port's position and connectability can't be identified on some boards
      via USB hub registers. ACPI _UPC and _PLD can help to resolve this issue
      and so it is necessary to bind USB with ACPI. This patch is to allow ACPI
      binding with USB-3.0 hub.
      
      Current ACPI only can bind one struct-device to one ACPI device node.
      This can not work with USB-3.0 hub, because the USB-3.0 hub has two logical
      devices. Each works for USB-2.0 and USB-3.0 devices. In the Linux USB subsystem,
      those two logical hubs are treated as two seperate devices that have two struct
      devices. But in the ACPI DSDT, these two logical hubs share one ACPI device
      node. So there is a requirement to bind multi struct-devices to one ACPI
      device node. This patch is to resolve such problem.
      
      Following is the ACPI device nodes' description under xhci hcd.
      
      Device (XHC)
                  Device (RHUB)
                      Device (HSP1)
                      Device (HSP2)
                      Device (HSP3)
                      Device (HSP4)
                      Device (SSP1)
                      Device (SSP2)
                      Device (SSP3)
                      Device (SSP4)
      
      Topology in the Linux
      
      	device XHC
      	   USB-2.0 logical hub    USB-3.0 logical hub
      		HSP1			SSP1
      		HSP2			SSP2
      		HSP3			SSP3
      		HSP4			SSP4
      
      This patch also modifies the output of /proc/acpi/wakeup. One ACPI node
      can be associated with multiple devices:
      
      XHC		S4	*enabled	pci:0000:00:14.0
      RHUB	S0	disabled	usb:usb1
      			disabled	usb:usb2
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Acked-by: NSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      1033f904
  8. 26 7月, 2012 1 次提交
  9. 29 6月, 2012 1 次提交
  10. 12 5月, 2012 1 次提交
  11. 01 11月, 2011 1 次提交
  12. 07 1月, 2011 1 次提交
  13. 27 7月, 2010 1 次提交
  14. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit 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: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  15. 28 1月, 2010 1 次提交
  16. 25 11月, 2009 1 次提交
  17. 29 8月, 2009 1 次提交
  18. 27 8月, 2009 2 次提交
  19. 18 6月, 2009 1 次提交
  20. 28 3月, 2009 1 次提交
    • B
      ACPI: call init_acpi_device_notify() explicitly rather than as initcall · 0e46517d
      Bjorn Helgaas 提交于
      This patch makes acpi_init() call init_acpi_device_notify() directly.
      Previously, init_acpi_device_notify() was an arch_initcall (sequence 3),
      so it was called before acpi_init() (a subsys_initcall at sequence 4).
      
      init_acpi_device_notify() sets the platform_notify and
      platform_notify_remove function pointers.  These pointers
      are not used until acpi_init() enumerates ACPI devices in
      this path:
      
          acpi_init()
      	    acpi_scan_init()
      		acpi_bus_scan()
      		    acpi_add_single_object()
      			acpi_device_register()
      			    device_add()
      				<use platform_notify>
      
      So it is sufficient to have acpi_init() call init_acpi_device_notify()
      directly before it enumerates devices.
      Signed-off-by: NBjorn Helgaas <bjorn.helgaas@hp.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      0e46517d
  21. 07 2月, 2009 1 次提交
  22. 08 11月, 2008 1 次提交
    • T
      ACPI: video: Ignore devices that aren't present in hardware · 22c13f9d
      Thomas Renninger 提交于
      This is a reimplemention of commit
      0119509c
      from Matthew Garrett <mjg59@srcf.ucam.org>
      
      This patch got removed because of a regression: ThinkPads with a
      Intel graphics card and an Integrated Graphics Device BIOS implementation
      stopped working.
      In fact, they only worked because the ACPI device of the discrete, the
      wrong one, got used (via int10). So ACPI functions were poking on the wrong
      hardware used which is a sever bug.
      The next patch provides support for above ThinkPads to be able to
      switch brightness via the legacy thinkpad_acpi driver and automatically
      detect when to use it.
      
      Original commit message from Matthew Garrett:
          Vendors often ship machines with a choice of integrated or discrete
          graphics, and use the same DSDT for both. As a result, the ACPI video
          module will locate devices that may not exist on this specific platform.
          Attempt to determine whether the device exists or not, and abort the
          device creation if it doesn't.
      
      http://bugzilla.kernel.org/show_bug.cgi?id=9614Signed-off-by: NThomas Renninger <trenn@suse.de>
      Acked-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      22c13f9d
  23. 15 10月, 2008 1 次提交
  24. 13 10月, 2008 1 次提交
    • L
      Fix RTC wakealarm sysfs interface breakage. · 1efd325f
      Linus Torvalds 提交于
      Commit ed458df4 ("PnP: move
      pnpacpi/pnpbios_init to after PCI init") moved the PnP RTC discovery
      later, and now the ACPI RTC glue code doesn't find it any more, breaking
      the RTC wakealarm sysfs interfaces, as reported by Rafael.
      
      This really is fairly messy, and we have several annoying ordering
      constraints here - the PnP code that sets up the RTC resources wants to
      run after the PCI resources have to be registered, which in turn needs
      to run after ACPI has at least enumerated the root PCI buses etc.  Our
      initcall ordering is not fine-grained enough to make this all painless.
      
      So this moves the ACPI RTC glue ("acpi_rtc_init()") down to a regular
      module call, which fixes the problem Rafael has.  The reason this isn't
      wonderful is that we really should do acpi_rtc_init before we do the
      rtc_cmos init, and now those two are in the same module_init() section.
      
      Which happens to work, but only because drivers/rtc is linked after
      drivers/acpi.  In other words, we still have a very subtle ordering
      issue here. Grr.
      Reported-and-tested-by: NRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: NDavid Brownell <david-b@pacbell.net>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      1efd325f
  25. 04 10月, 2008 1 次提交
  26. 22 7月, 2008 1 次提交
  27. 21 7月, 2008 1 次提交
  28. 18 7月, 2008 1 次提交
  29. 17 7月, 2008 1 次提交
  30. 08 7月, 2008 1 次提交
    • R
      PCI ACPI: Rework PCI handling of wake-up · eb9d0fe4
      Rafael J. Wysocki 提交于
      * Introduce function acpi_pm_device_sleep_wake() for enabling and
        disabling the system wake-up capability of devices that are power
        manageable by ACPI.
      
      * Introduce function acpi_bus_can_wakeup() allowing other (dependent)
        subsystems to check if ACPI is able to enable the system wake-up
        capability of given device.
      
      * Introduce callback .sleep_wake() in struct pci_platform_pm_ops and
        for the ACPI PCI 'driver' make it use acpi_pm_device_sleep_wake().
      
      * Introduce callback .can_wakeup() in struct pci_platform_pm_ops and
        for the ACPI 'driver' make it use acpi_bus_can_wakeup().
      
      * Move the PME# handlig code out of pci_enable_wake() and split it
        into two functions, pci_pme_capable() and pci_pme_active(),
        allowing the caller to check if given device is capable of
        generating PME# from given power state and to enable/disable the
        device's PME# functionality, respectively.
      
      * Modify pci_enable_wake() to use the new ACPI callbacks and the new
        PME#-related functions.
      
      * Drop the generic .platform_enable_wakeup() callback that is not
        used any more.
      
      * Introduce device_set_wakeup_capable() that will set the
        power.can_wakeup flag of given device.
      
      * Rework PCI device PM initialization so that, if given device is
        capable of generating wake-up events, either natively through the
        PME# mechanism, or with the help of the platform, its
        power.can_wakeup flag is set and its power.should_wakeup flag is
        unset as appropriate.
      
      * Make ACPI set the power.can_wakeup flag for devices found to be
        wake-up capable by it.
      
      * Make the ACPI wake-up code enable/disable GPEs for devices that
        have the wakeup.flags.prepared flag set (which means that their
        wake-up power has been enabled).
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      eb9d0fe4
  31. 26 6月, 2008 1 次提交
    • V
      ACPI: don't walk tables if ACPI was disabled · 4389ed2f
      Vegard Nossum 提交于
      Ingo Molnar wrote:
      > -tip auto-testing started triggering this spinlock corruption message
      > yesterday:
      >
      > [    3.976213] calling  acpi_rtc_init+0x0/0xd3
      > [    3.980213] ACPI Exception (utmutex-0263): AE_BAD_PARAMETER, Thread F7C50000 could not acquire Mutex [3] [20080321]
      > [    3.992213] BUG: spinlock bad magic on CPU#0, swapper/1
      > [    3.992213]  lock: c2508dc4, .magic: 00000000, .owner: swapper/1, .owner_cpu: 0
      
      This is apparently because some parts of ACPI, including mutexes, are not
      initialized when acpi=off is passed to the kernel.
      Reported-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NVegard Nossum <vegard.nossum@gmail.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      4389ed2f
  32. 12 6月, 2008 1 次提交
  33. 23 2月, 2008 1 次提交
    • D
      ACPI: crosslink ACPI and "real" device nodes · 1071695f
      David Brownell 提交于
      Add cross-links between ACPI device and "real" devices in sysfs,
      exposing otherwise-hidden interrelationships between the various
      device nodes for ACPI stuff.  As a representative example, one
      hardware device is exposed as two logical devices (PNP and ACPI):
      
        .../pnp0/00:06/
        .../LNXSYSTM:00/device:00/PNP0A03:00/device:15/PNP0B00:00/
      
      The PNP device gets a "firmware_node" link pointing to the ACPI device,
      and is what a Linux device driver binds to.  The ACPI device has instead
      a "physical_node" link pointing back to the PNP device.  Other firmware
      frameworks, like OpenFirmware, could do the same thing to couple their
      firmware tables to the rest of the system.
      
      (Based on a patch from Zhang Rui.  This version is modified to not
      depend on the patch makig ACPI initialize driver model wakeup flags.)
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Cc: Zhang Rui <rui.zhang@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      1071695f
  34. 07 2月, 2008 1 次提交
    • A
      ACPI: misc cleanups · e5685b9d
      Adrian Bunk 提交于
          This patch contains the following possible cleanups:
          - make the following needlessly global code static:
            - drivers/acpi/bay.c:dev_attr_eject
            - drivers/acpi/bay.c:dev_attr_present
            - drivers/acpi/dock.c:dev_attr_docked
            - drivers/acpi/dock.c:dev_attr_flags
            - drivers/acpi/dock.c:dev_attr_uid
            - drivers/acpi/dock.c:dev_attr_undock
            - drivers/acpi/pci_bind.c:acpi_pci_unbind()
            - drivers/acpi/pci_link.c:acpi_link_lock
            - drivers/acpi/sbs.c:acpi_sbs_callback()
            - drivers/acpi/sbshc.c:acpi_smbus_transaction()
            - drivers/acpi/sleep/main.c:acpi_sleep_prepare()
          - #if 0 the following unused global functions:
            - drivers/acpi/numa.c:acpi_unmap_pxm_to_node()
          - remove the following unused EXPORT_SYMBOL's:
            - acpi_register_gsi
            - acpi_unregister_gsi
            - acpi_strict
            - acpi_bus_receive_event
            - register_acpi_bus_type
            - unregister_acpi_bus_type
            - acpi_os_printf
            - acpi_os_sleep
            - acpi_os_stall
            - acpi_os_read_pci_configuration
            - acpi_os_create_semaphore
            - acpi_os_delete_semaphore
            - acpi_os_wait_semaphore
            - acpi_os_signal_semaphore
            - acpi_os_signal
            - acpi_pci_irq_enable
            - acpi_get_pxm
      Signed-off-by: NAdrian Bunk <bunk@kernel.org>
      Acked-by: NAlexey Starikovskiy <astarikovskiy@suse.de>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      e5685b9d
  35. 22 7月, 2007 1 次提交
  36. 09 5月, 2007 2 次提交
  37. 16 2月, 2007 1 次提交