1. 28 1月, 2014 1 次提交
  2. 07 12月, 2013 1 次提交
    • L
      ACPI: Clean up inclusions of ACPI header files · 8b48463f
      Lv Zheng 提交于
      Replace direct inclusions of <acpi/acpi.h>, <acpi/acpi_bus.h> and
      <acpi/acpi_drivers.h>, which are incorrect, with <linux/acpi.h>
      inclusions and remove some inclusions of those files that aren't
      necessary.
      
      First of all, <acpi/acpi.h>, <acpi/acpi_bus.h> and <acpi/acpi_drivers.h>
      should not be included directly from any files that are built for
      CONFIG_ACPI unset, because that generally leads to build warnings about
      undefined symbols in !CONFIG_ACPI builds.  For CONFIG_ACPI set,
      <linux/acpi.h> includes those files and for CONFIG_ACPI unset it
      provides stub ACPI symbols to be used in that case.
      
      Second, there are ordering dependencies between those files that always
      have to be met.  Namely, it is required that <acpi/acpi_bus.h> be included
      prior to <acpi/acpi_drivers.h> so that the acpi_pci_root declarations the
      latter depends on are always there.  And <acpi/acpi.h> which provides
      basic ACPICA type declarations should always be included prior to any other
      ACPI headers in CONFIG_ACPI builds.  That also is taken care of including
      <linux/acpi.h> as appropriate.
      Signed-off-by: NLv Zheng <lv.zheng@intel.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Matthew Garrett <mjg59@srcf.ucam.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Acked-by: Bjorn Helgaas <bhelgaas@google.com> (drivers/pci stuff)
      Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> (Xen stuff)
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      8b48463f
  3. 21 11月, 2013 2 次提交
    • J
      ACPI / sysfs: Fix incorrect ACPI tables walk in acpi_tables_sysfs_init() · de03beed
      Jeremy Compostella 提交于
      When executing on an ACPI Hardware Reduced hardware, all the ACPI
      tables are not exposed in sysfs due to the fact that FACS is
      silently ignored by the kernel in the ACPI hardware reduced mode
      and, moreover, the acpi_tables_sysfs_init() ACPI table walk
      is buggy and stops too soon.
      
      The acpi_tables_sysfs_init() function should rely on the acpi_status
      return value from acpi_get_table_by_index() to decide whether or not
      to stop the iteration (the walk should only be terminated when that
      value is AE_BAD_PARAMETER).  This way, when running in an ACPI Harware
      Reduced environment (where the FACS table is silently ignored by the
      kernel) or if some ACPI tables are not correctly memory mapped or
      have bad checksums, it will still walk through the remaining tables
      that may be correct.
      
      [rjw: Changelog]
      Signed-off-by: NJeremy Compostella <jeremy.compostella@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      de03beed
    • D
      ACPI / sysfs: Set file size for each exposed ACPI table · 083ca8c4
      Daisuke HATAYAMA 提交于
      Currently, each of the ACPI tables exported from
      /sys/firmware/acpi/tables is of zero size:
      
      $ LANG=C ls -ld /sys/firmware/acpi/tables/*
      -r-------- 1 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/APIC
      -r-------- 1 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/BOOT
      -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/DSDT
      -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/FACP
      -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/FACS
      -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/MCFG
      -r-------- 1 root root 0 Nov 19 14:25 /sys/firmware/acpi/tables/SRAT
      drwxr-xr-x 2 root root 0 Nov 19 09:48 /sys/firmware/acpi/tables/dynamic/
      
      due to which, user-land tools fail reading each table. For example:
      
      $ acpidump -f /sys/firmware/acpi/tables/SRAT
      Could not get input file size: /sys/firmware/acpi/tables/SRAT
      
      To deal with the issue, this patch assigns size of each ACPI table to
      the corresponding sysfs file.
      
      $ LANG=C ls -hld /sys/firmware/acpi/tables/*
      -r-------- 1 root root  94 Nov 19 16:45 /sys/firmware/acpi/tables/APIC
      -r-------- 1 root root  40 Nov 19 16:45 /sys/firmware/acpi/tables/BOOT
      -r-------- 1 root root 58K Nov 19 16:55 /sys/firmware/acpi/tables/DSDT
      -r-------- 1 root root 244 Nov 19 16:55 /sys/firmware/acpi/tables/FACP
      -r-------- 1 root root  64 Nov 19 16:55 /sys/firmware/acpi/tables/FACS
      -r-------- 1 root root  60 Nov 19 16:55 /sys/firmware/acpi/tables/MCFG
      -r-------- 1 root root 168 Nov 19 16:45 /sys/firmware/acpi/tables/SRAT
      drwxr-xr-x 2 root root   0 Nov 19 16:55 /sys/firmware/acpi/tables/dynamic/
      
      Then, user-land tools work well like:
      
      $ acpidump -f /sys/firmware/acpi/tables/SRAT
      SRAT @ 0x0000000000000000
        0000: 53 52 41 54 A8 00 00 00 02 65 56 4D 57 41 52 45  SRAT.....eVMWARE
        0010: 4D 45 4D 50 4C 55 47 20 00 00 04 06 56 4D 57 20  MEMPLUG ....VMW
        0020: 01 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................
        0030: 01 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .(..............
        0040: 00 00 0A 00 00 00 00 00 00 00 00 00 01 00 00 00  ................
        0050: 00 00 00 00 00 00 00 00 01 28 00 00 00 00 00 00  .........(......
        0060: 00 00 10 00 00 00 00 00 00 00 F0 BF 00 00 00 00  ................
        0070: 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................
        0080: 01 28 00 00 00 00 00 00 00 00 00 00 01 00 00 00  .(..............
        0090: 00 00 00 40 00 00 00 00 00 00 00 00 01 00 00 00  ...@............
        00A0: 00 00 00 00 00 00 00 00                          ........
      Signed-off-by: NHATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      Acked-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      083ca8c4
  4. 01 10月, 2013 3 次提交
  5. 25 9月, 2013 1 次提交
    • L
      ACPI / sysfs: make GPE sysfs attributes only accept correct values · c48b1565
      Lan Tianyu 提交于
      According to the design, GPE sysfs attributes should accept "disable",
      "enable", "clear" and integer numbers as params. Current code checks
      "disable", "enable" and "clear" first. If the param doesn't match,
      pass it to strtoul() as a string representing an integer number and
      assign the return value to the given GPE count. It is missing the check
      of whether or not the param really represents an integer number and
      strtoul() will return 0 if the string is not a number.  This causes any
      params except for "enable", "disable", "clear" and a number to make the
      GPE count become 0. This patch is to use kstrtoul() to replace strtoul()
      and check the return value. If the convertion is successful, use as the
      new GPE count. If not, return an error.
      Signed-off-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c48b1565
  6. 04 7月, 2013 1 次提交
    • K
      clean up scary strncpy(dst, src, strlen(src)) uses · 096a8aac
      Kees Cook 提交于
      Fix various weird constructions of strncpy(dst, src, strlen(src)).
      
      Length limits should be about the space available in the destination,
      not repurposed as a method to either always include or always exclude a
      trailing NULL byte.  Either the NULL should always be copied (using
      strlcpy), or it should not be copied (using something like memcpy).
      Readable code should not depend on the weird behavior of strncpy when it
      hits the length limit.  Better to avoid the anti-pattern entirely.
      
      [akpm@linux-foundation.org: revert getdelays.c part due to missing bsd/string.h]
      Signed-off-by: NKees Cook <keescook@chromium.org>
      Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>	[staging]
      Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>	[acpi]
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
      Cc: Ursula Braun <ursula.braun@de.ibm.com>
      Cc: Frank Blaschka <blaschka@linux.vnet.ibm.com>
      Cc: Richard Weinberger <richard@nod.at>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      096a8aac
  7. 12 5月, 2013 1 次提交
    • R
      ACPI / hotplug: Use device offline/online for graceful hot-removal · 683058e3
      Rafael J. Wysocki 提交于
      Modify the generic ACPI hotplug code to be able to check if devices
      scheduled for hot-removal may be gracefully removed from the system
      using the device offline/online mechanism introduced previously.
      
      Namely, make acpi_scan_hot_remove() handling device hot-removal call
      device_offline() for all physical companions of the ACPI device nodes
      involved in the operation and check the results.  If any of the
      device_offline() calls fails, the function will not progress to the
      removal phase (which cannot be aborted), unless its (new) force
      argument is set (in case of a failing offline it will put the devices
      offlined by it back online).
      
      In support of 'forced' device hot-removal, add a new sysfs attribute
      'force_remove' that will reside under /sys/firmware/acpi/hotplug/.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NToshi Kani <toshi.kani@hp.com>
      683058e3
  8. 19 3月, 2013 1 次提交
  9. 04 3月, 2013 1 次提交
    • R
      ACPI / hotplug: Introduce user space interface for hotplug profiles · 3f8055c3
      Rafael J. Wysocki 提交于
      Introduce user space interface for manipulating hotplug profiles
      associated with ACPI scan handlers.
      
      The interface consists of sysfs directories under
      /sys/firmware/acpi/hotplug/, one for each hotplug profile, containing
      an attribute allowing user space to manipulate the enabled field of
      the corresponding profile.  Namely, switching the enabled attribute
      from '0' to '1' will cause the common hotplug notify handler to be
      installed for all ACPI namespace objects representing devices matching
      the scan handler associated with the given hotplug profile (and
      analogously for the converse switch).
      
      Drivers willing to use the new user space interface should add their
      ACPI scan handlers with the help of new funtion
      acpi_scan_add_handler_with_hotplug().
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NToshi Kani <toshi.kani@hp.com>
      Tested-by: NToshi Kani <toshi.kani@hp.com>
      3f8055c3
  10. 26 1月, 2013 1 次提交
  11. 15 11月, 2012 1 次提交
  12. 27 7月, 2012 1 次提交
  13. 05 6月, 2012 1 次提交
  14. 07 11月, 2011 1 次提交
  15. 17 7月, 2011 1 次提交
  16. 29 5月, 2011 1 次提交
  17. 12 1月, 2011 1 次提交
  18. 29 9月, 2010 1 次提交
    • Z
      ACPI: fix build warnings resulting from merge window conflict · ec652b35
      Zhang Rui 提交于
      drivers/acpi/sysfs.c:154: warning: passing argument 1 of '__check_old_set_param' from incompatible pointer type
      include/linux/moduleparam.h:165: note: expected 'int (*)(const char *, struct kernel_param *)' but argument is of type 'int (*)(const char *, const struct kernel_param *)'
      
      Introduced by commit 1c8fce27 ("ACPI:
      introduce drivers/acpi/sysfs.c") interacting with commit
      9bbb9e5a ("param: use ops in struct
      kernel_param, rather than get and set fns directly").
      
      Use module_param_cb instead of the obsoleted module_param_call to fix a build warning.
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      ec652b35
  19. 15 8月, 2010 1 次提交
    • Z
      ACPI: introduce drivers/acpi/sysfs.c · 1c8fce27
      Zhang Rui 提交于
      Introduce drivers/acpi/sysfs.c.
      
      code for ACPI sysfs I/F, including
      #ifdef ACPI_DEBUG
      /sys/module/acpi/parameters/debug_layer
      /sys/module/acpi/parameters/debug_level
      /sys/module/acpi/parameters/trace_method_name
      /sys/module/acpi/parameters/trace_debug_layer
      /sys/module/acpi/parameters/trace_debug_level
      /sys/module/acpi/parameters/trace_state
      #endif
      /sys/module/acpi/parameters/acpica_version
      /sys/firmware/acpi/tables/
      /sys/firmware/acpi/interrupts/
      is moved to this file.
      
      No function change in this patch.
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      1c8fce27
  20. 07 7月, 2010 1 次提交
  21. 12 6月, 2010 1 次提交
    • R
      ACPI / ACPICA: Fix sysfs GPE interface · 9d3c752d
      Rafael J. Wysocki 提交于
      The sysfs interface allowing user space to disable/enable GPEs
      doesn't work correctly, because a GPE disabled this way will be
      re-enabled shortly by acpi_ev_asynch_enable_gpe() if it was
      previosuly enabled by acpi_enable_gpe() (in which case the
      corresponding bit in its enable register's enable_for_run mask is
      set).
      
      To address this issue make the sysfs GPE interface use
      acpi_enable_gpe() and acpi_disable_gpe() instead of acpi_set_gpe()
      so that GPE reference counters are modified by it along with the
      values of GPE enable registers.
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      9d3c752d
  22. 22 5月, 2010 1 次提交
  23. 20 4月, 2010 1 次提交
  24. 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
  25. 08 3月, 2010 1 次提交
  26. 23 2月, 2010 1 次提交
    • R
      ACPI: Use GPE reference counting to support shared GPEs · 9630bdd9
      Rafael J. Wysocki 提交于
      ACPI GPEs may map to multiple devices.  The current GPE interface
      only provides a mechanism for enabling and disabling GPEs, making
      it difficult to change the state of GPEs at runtime without extensive
      cooperation between devices.
      
      Add an API to allow devices to indicate whether or not they want
      their device's GPE to be enabled for both runtime and wakeup events.
      
      Remove the old GPE type handling entirely, which gets rid of various
      quirks, like the implicit disabling with GPE type setting. This
      requires a small amount of rework in order to ensure that non-wake
      GPEs are enabled by default to preserve existing behaviour.
      
      Based on patches from Matthew Garrett <mjg@redhat.com>.
      Signed-off-by: NMatthew Garrett <mjg@redhat.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NJesse Barnes <jbarnes@virtuousgeek.org>
      9630bdd9
  27. 29 8月, 2009 1 次提交
  28. 02 8月, 2009 1 次提交
  29. 21 4月, 2009 1 次提交
  30. 03 4月, 2009 1 次提交
  31. 28 3月, 2009 1 次提交
  32. 26 2月, 2009 1 次提交
  33. 31 12月, 2008 1 次提交
  34. 12 11月, 2008 1 次提交
  35. 07 11月, 2008 1 次提交
  36. 28 10月, 2008 1 次提交
    • Z
      ACPI: bugfix reporting of event handler status · ed206fac
      Zhang Rui 提交于
      Introduce a new flag showing whether the event has an event handler/method.
      
      For all the GPEs and Fixed Events,
       1. ACPI_EVENT_FLAG_HANDLE is cleared, it's an "invalid" ACPI event.
       2. Both ACPI_EVENT_FLAG_HANDLE and ACPI_EVENT_FLAG_DISABLE are set,
          it's "disabled".
       3. Both ACPI_EVENT_FLAG_HANDLE and ACPI_EVENT_FLAG_ENABLE are set,
          it's "enabled".
       4. Both ACPI_EVENT_FLAG_HANDLE and ACPI_EVENT_FLAG_WAKE_ENABLE are set,
          it's "wake_enabled".
      
      Among other things, this prevents incorrect reporting of ACPI events
      as being "invalid" when it's really just (temporarily) "disabled".
      Signed-off-by: NZhang Rui <rui.zhang@intel.com>
      Signed-off-by: NDavid Brownell <dbrownell@users.sourceforge.net>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      ed206fac
  37. 23 10月, 2008 1 次提交