aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/sysfs.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-09-17ACPI / sysfs: Update sysfs signature handling codeLv Zheng1-29/+33
This patch cleans up sysfs table signature handling code: 1. Convert the signature handling code to use the ACPICA APIs to benefit from the future improvements of the APIs. 2. Add 'filename' attribute in order to handle both BE/LE name tags. 3. Add instance check in order to avoid the possible buffer overflow related to the table file name. Signed-off-by: Lv Zheng <lv.zheng@intel.com> [ rjw: Changelog ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-09-17ACPI / sysfs: Fix an issue for LoadTable opcodeLv Zheng1-1/+3
OEM tables can be installed via RSDT/XSDT, in this case, they have already been created under /sys/firmware/acpi/tables. For this kind of tables, normally LoadTable opcode will be executed to load them. If LoadTable opcode is executed after acpi_sysfs_init(), acpi_sysfs_table_handler() will be invoked, thus a redundant table file will be created under /sys/firmware/acpi/tables/dynamic. Then running "acpidump" on such platform results in an error, complaining blank empty table (see Link 1 below). The bug can be reproduced by customizing an OEM1 table, allowing it to be overridden via 'table_sigs' (drivers/acpi/tables.c), adding the following code to the customized DSDT to load it: Name (OEMH, Zero) Name (OEMF, One) If (LEqual (OEMF, One)) { Store (LoadTable ("OEM1", "Intel", "Test"), OEMH) Store (Zero, OEMF) } In order to make sure that the OEM1 table is installed after acpi_sysfs_init(), acpi_sysfs_init() can be moved before invoking acpi_load_tables(). Then the following command execution result can be seen: # acpidump > acpidump.txt Could not read table header: /sysfs/firmware/acpi/tables/dynamic/OEM12 Could not get ACPI table at index 17, AE_BAD_HEADER Link: https://bugzilla.kernel.org/show_bug.cgi?id=150841 # [1] Link: https://github.com/acpica/acpica/commit/ed6a5fbc Reported-by: Jason Voelz <jason.voelz@intel.com> Reported-by: Francisco Leoner <francisco.j.lenoer.soto@intel.com> Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-08-17ACPI / sysfs: Use new GPE masking mechanism in GPE interfaceLv Zheng1-8/+25
Now GPE can be masked via the new acpi_mask_gpe() API and this patch modifies /sys/firmware/acpi/interrupts/gpexx to use this new facility. Writes "mask/unmask" to this file now invokes acpi_mask_gpe(). Reads from this file now returns new "EN/STS" when the corresponding GPE hardware register's EN/STS bits are flagged, and new "masked/unmasked" attribute to indicate the status of the masking mechanism. Signed-off-by: Lv Zheng <lv.zheng@intel.com> [ rjw: Subject ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-07-08ACPI: add support for ACPI reconfiguration notifiersOctavian Purdila1-4/+2
Add support for ACPI reconfiguration notifiers to allow subsystems to react to changes in the ACPI tables that happen after the initial enumeration. This is similar with the way dynamic device tree notifications work. The reconfigure notifications supported for now are device add and device remove. Since ACPICA allows only one table notification handler, this patch makes the table notifier function generic and moves it out of the sysfs specific code. Signed-off-by: Octavian Purdila <octavian.purdila@intel.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2016-05-05ACPI / sysfs: fix error code in get_status()Dan Carpenter1-4/+3
The problem with ornamental, do-nothing gotos is that they lead to "forgot to set the error code" bugs. We should be returning -EINVAL here but we don't. It leads to an uninitalized variable in counter_show(): drivers/acpi/sysfs.c:603 counter_show() error: uninitialized symbol 'status'. Fixes: 1c8fce27e275 (ACPI: introduce drivers/acpi/sysfs.c) Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-10-26ACPI / sysfs: correctly check failing memory allocationInsu Yun1-0/+3
Since kobject_create_and_add() can fail under memory pressure, its return value needs to be checked against NULL before passing it to sysfs_create_file(). Signed-off-by: Insu Yun <wuninsu@gmail.com> [ rjw: Subject & changelog ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-08-07ACPI / sysfs: Add support to allow leading "\" missing in trace_method_name.Lv Zheng1-15/+13
Since _SB.PCI0 can be used as relative path from root and can be easily converted into internal trace_method_name format, we allow users to specify trace_method_name using relative paths from root. Note this is useful for grub2 for which users failed to pass "\" from the grub configuration file. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-08-07ACPI / sysfs: Update method tracing facility.Lv Zheng1-36/+100
This patch updates the method tracing facility as the acpi_debug_trace() API has been updated to allow it to trace AML interpreter execution, the meanings and the usages of the API parameters are changed due to the updates. The new API: 1. Uses ACPI_TRACE_ENABLED flag to indicate the enabling of the tracer; 2. Allows tracer still can be enabled when method name is not specified so that the AML interpreter execution can be traced without knowing the method name, which is useful for kernel boot tracing; 3. Supports arbitrary full path name, it doesn't need to be a name related to an entrance of acpi_evaluate_object(). Note that the sysfs parameters are also updated so that when reading the attribute files, ACPICA internal settings are returned. In order to make the sysfs parameters (acpi.trace_state) available during boot, this patch adds code to bypass ACPICA semaphore/mutex invocations when acpi mutex utilities haven't been initialized. This patch doesn't update documentation of method tracing facility, it will be updated by further patches. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-08-07ACPI / sysfs: Add ACPI_LV_REPAIR debug level.Lv Zheng1-0/+1
This patch updates debug_level file, adding ACPI_LV_REPAIR. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-03-10ACPI / sysfs: Treat the count field of counter_show() as unsignedNan Li1-1/+1
The count field is an unsigned 32bit value, and the counter_show() function should also treat it as a unsigned value. Otherwise the counter may show negative number as we found on a machine: ... gpe23: 0 invalid gpe24: -2071733 enabled gpe25: 0 invalid ... gpe_all: -2070980 sci: -2070949 Signed-off-by: Nan Li <nli@suse.com> Signed-off-by: Lee, Chun-Yi <jlee@suse.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-10-21ACPICA: Events: Reduce source code difference for the ACPI_EVENT_FLAG_HANDLE renaming.Lv Zheng1-2/+2
This patch is partial linuxized result of the following ACPICA commit: ACPICA commit: a73b66c6aa1846d055bb6390d9c9b9902f7d804d Subject: Add "has handler" flag to event/gpe status interfaces. This change adds a new flag, ACPI_EVENT_FLAGS_HAS_HANDLER to the acpi_get_event_status and acpi_get_gpe_status external interfaces. It is set if the event/gpe currently has a handler associated with it. This patch contains the code to rename ACPI_EVENT_FLAG_HANDLE to ACPI_EVENT_FLAG_HAS_HANDLER, and the corresponding updates of its usages. Link: https://github.com/acpica/acpica/commit/a73b66c6 Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-03-19ACPI: Remove duplicate definitions of PREFIXHanjun Guo1-2/+0
We already have a macro for PREFIX of "ACPI: " in drivers/acpi/internal.h, so remove the duplicate ones in ACPI drivers when internal.h is included. Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-01-29Merge branches 'acpi-processor', 'acpi-hotplug', 'acpi-init', 'acpi-pm' and 'acpica'Rafael J. Wysocki1-1/+1
* acpi-processor: ACPI / scan: reduce log level of "ACPI: \_PR_.CPU4: failed to get CPU APIC ID" ACPI / processor: Return specific error value when mapping lapic id * acpi-hotplug: ACPI / scan: Clear match_driver flag in acpi_bus_trim() * acpi-init: ACPI / init: Flag use of ACPI and ACPI idioms for power supplies to regulator API * acpi-pm: ACPI / PM: Use ACPI_COMPANION() to get ACPI companions of devices * acpica: ACPICA: Remove bool usage from ACPICA.
2014-01-27ACPICA: Remove bool usage from ACPICA.Lv Zheng1-1/+1
The use of "bool" is not safe for ACPICA code where it is originally using a "BOOLEAN" defined as "unsigned char". This patch removes the only "bool" usage from kernel source tree to reduce the source code differences between Linux and ACPICA upstream. This patch is required by future acpidump release automation. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2014-01-12Merge branch 'acpi-cleanup'Rafael J. Wysocki1-1/+1
* acpi-cleanup: (22 commits) ACPI / tables: Return proper error codes from acpi_table_parse() and fix comment. ACPI / tables: Check if id is NULL in acpi_table_parse() ACPI / proc: Include appropriate header file in proc.c ACPI / EC: Remove unused functions and add prototype declaration in internal.h ACPI / dock: Include appropriate header file in dock.c ACPI / PCI: Include appropriate header file in pci_link.c ACPI / PCI: Include appropriate header file in pci_slot.c ACPI / EC: Mark the function acpi_ec_add_debugfs() as static in ec_sys.c ACPI / NVS: Include appropriate header file in nvs.c ACPI / OSL: Mark the function acpi_table_checksum() as static ACPI / processor: initialize a variable to silence compiler warning ACPI / processor: use ACPI_COMPANION() to get ACPI device ACPI: correct minor typos ACPI / sleep: Drop redundant acpi_disabled check ACPI / dock: Drop redundant acpi_disabled check ACPI / table: Replace '1' with specific error return values ACPI: remove trailing whitespace ACPI / IBFT: Fix incorrect <acpi/acpi.h> inclusion in iSCSI boot firmware module ACPI / i915: Fix incorrect <acpi/acpi.h> inclusions via <linux/acpi_io.h> SFI / ACPI: Fix warnings reported during builds with W=1 ... Conflicts: drivers/acpi/nvs.c drivers/hwmon/asus_atk0110.c
2013-12-07ACPI: Clean up inclusions of ACPI header filesLv Zheng1-1/+1
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: Lv 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: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-11-21ACPI / sysfs: Fix incorrect ACPI tables walk in acpi_tables_sysfs_init()Jeremy Compostella1-25/+27
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: Jeremy Compostella <jeremy.compostella@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-11-21ACPI / sysfs: Set file size for each exposed ACPI tableDaisuke HATAYAMA1-1/+1
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: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com> Acked-by: Toshi Kani <toshi.kani@hp.com> Acked-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-10-28Merge branch 'acpi-assorted'Rafael J. Wysocki1-2/+7
* acpi-assorted: ACPI: Add Toshiba NB100 to Vista _OSI blacklist ACPI / osl: remove an unneeded NULL check ACPI / platform: add ACPI ID for a Broadcom GPS chip ACPI: improve acpi_extract_package() utility ACPI / LPSS: fix UART Auto Flow Control ACPI / platform: Add ACPI IDs for Intel SST audio device x86 / ACPI: fix incorrect placement of __initdata tag ACPI / thermal: convert printk(LEVEL...) to pr_<lvl> ACPI / sysfs: make GPE sysfs attributes only accept correct values ACPI / EC: Convert all printk() calls to dynamic debug function ACPI / button: Using input_set_capability() to mark device's event capability ACPI / osl: implement acpi_os_sleep() with msleep()
2013-09-30ACPI / hotplug: Use kobject_init_and_add() instead of _init() and _add()Bjorn Helgaas1-3/+2
Use kobject_init_and_add() since we have nothing special to do between kobject_init() and kobject_add(). Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-09-30ACPI / hotplug: Don't set kobject parent pointer explicitlyBjorn Helgaas1-1/+0
kobject_add() sets the parent pointer, so we don't need to do it explicitly. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-09-30ACPI / hotplug: Set kobject name via kobject_add(), not kobject_set_name()Bjorn Helgaas1-4/+1
Set the kobject name via kobject_add() instead of using kobject_set_name(), which is deprecated per Documentation/kobject.txt. Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-09-25ACPI / sysfs: make GPE sysfs attributes only accept correct valuesLan Tianyu1-2/+7
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: Lan Tianyu <tianyu.lan@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-07-03Merge branch 'akpm' (updates from Andrew Morton)Linus Torvalds1-2/+1
Merge first patch-bomb from Andrew Morton: - various misc bits - I'm been patchmonkeying ocfs2 for a while, as Joel and Mark have been distracted. There has been quite a bit of activity. - About half the MM queue - Some backlight bits - Various lib/ updates - checkpatch updates - zillions more little rtc patches - ptrace - signals - exec - procfs - rapidio - nbd - aoe - pps - memstick - tools/testing/selftests updates * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (445 commits) tools/testing/selftests: don't assume the x bit is set on scripts selftests: add .gitignore for kcmp selftests: fix clean target in kcmp Makefile selftests: add .gitignore for vm selftests: add hugetlbfstest self-test: fix make clean selftests: exit 1 on failure kernel/resource.c: remove the unneeded assignment in function __find_resource aio: fix wrong comment in aio_complete() drivers/w1/slaves/w1_ds2408.c: add magic sequence to disable P0 test mode drivers/memstick/host/r592.c: convert to module_pci_driver drivers/memstick/host/jmb38x_ms: convert to module_pci_driver pps-gpio: add device-tree binding and support drivers/pps/clients/pps-gpio.c: convert to module_platform_driver drivers/pps/clients/pps-gpio.c: convert to devm_* helpers drivers/parport/share.c: use kzalloc Documentation/accounting/getdelays.c: avoid strncpy in accounting tool aoe: update internal version number to v83 aoe: update copyright date aoe: perform I/O completions in parallel ...
2013-07-03clean up scary strncpy(dst, src, strlen(src)) usesKees Cook1-2/+1
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: Kees 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-05-12ACPI / hotplug: Use device offline/online for graceful hot-removalRafael J. Wysocki1-0/+31
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: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Toshi Kani <toshi.kani@hp.com>
2013-03-19ACPI / hotplug: Make acpi_hotplug_profile_ktype staticRafael J. Wysocki1-1/+1
The acpi_hotplug_profile_ktype object should be static, so make that be the case. Reported-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2013-03-04ACPI / hotplug: Introduce user space interface for hotplug profilesRafael J. Wysocki1-0/+66
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: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Toshi Kani <toshi.kani@hp.com> Tested-by: Toshi Kani <toshi.kani@hp.com>
2013-01-26ACPI sysfs: remove unnecessary newline from exceptionColin Ian King1-1/+1
ACPI_EXCEPTION() already appends a newline, so there is no need for the invalid GPE message to include one too. Signed-off-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-11-15ACPICA: Fix AcpiSrc caused divergences.Lv Zheng1-2/+2
There are definitions that can been converted into new styles by the recent AcpiSrc while they remain the old styles in the Linux. This patch fixes those definitions that will be converted by the AcpiSrc. This patch will not affect the generated vmlinux binary. This will decrease 97 lines of 20120913 divergence.diff. Signed-off-by: Lv Zheng <lv.zheng@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2012-07-26ACPI: replace strlen("string") with sizeof("string") -1Len Brown1-2/+2
...both give the number of chars in the string without the '\0', as strncmp() wants, but sizeof() is compile-time. Reported-by: Alan Stern <stern@rowland.harvard.edu> Cc: Pavel Vasilyev <pavel@pavlinux.ru> Signed-off-by: Len Brown <len.brown@intel.com>
2012-06-05ACPI sysfs.c strlen fixPavel Vasilyev1-2/+2
Current code is ignoring the last character of "enable" and "disable" in comparisons. https://bugzilla.kernel.org/show_bug.cgi?id=33732 Signed-off-by: Len Brown <len.brown@intel.com>
2011-11-06ACPI: Export FADT pm_profile integer value to userspaceThomas Renninger1-1/+13
There are a lot userspace approaches to detect the usage of the platform (laptop, workstation, server, ...) and adjust kernel tunables accordingly (io/process scheduler, power management, ...). These approaches need constant maintaining and are ugly to implement (detect PCMCIA controller -> laptop, does not work on recent systems anymore, ...) On ACPI systems there is an easy and reliable way (if implemented in BIOS and most recent platforms have this value set). -> export it to userspace. Signed-off-by: Thomas Renninger <trenn@suse.de> Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Signed-off-by: Len Brown <len.brown@intel.com>
2011-07-16ACPI: constify ops structsVasiliy Kulikov1-2/+2
Structs battery_file, acpi_dock_ops, file_operations, thermal_cooling_device_ops, thermal_zone_device_ops, kernel_param_ops are not changed in runtime. It is safe to make them const. register_hotplug_dock_device() was altered to take const "ops" argument to respect acpi_dock_ops' const notion. Signed-off-by: Vasiliy Kulikov <segoon@openwall.com> Acked-by: Jeff Garzik <jgarzik@redhat.com> Signed-off-by: Len Brown <len.brown@intel.com>
2011-05-29ACPI: Cleanup custom_method debug stuffThomas Renninger1-0/+8
- Move param aml_debug_output to other params into sysfs.c - Split acpi_debugfs_init to prepare custom_method to be an own .config option and driver. Signed-off-by: Thomas Renninger <trenn@suse.de> Acked-by: Rafael J. Wysocki <rjw@sisk.pl> Acked-by: rui.zhang@intel.com Signed-off-by: Len Brown <len.brown@intel.com>
2011-01-12ACPICA: Global event handlerLin Ming1-2/+17
The global event handler is called whenever a general purpose or fixed ACPI event occurs. Also update Linux OSL to collect events counter with global event handler. Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2010-09-28ACPI: fix build warnings resulting from merge window conflictZhang Rui1-6/+14
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 1c8fce27e275fd7c6b75bc6455745f02d3903ee6 ("ACPI: introduce drivers/acpi/sysfs.c") interacting with commit 9bbb9e5a33109b2832e2e63dcc7a132924ab374b ("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: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2010-08-15ACPI: introduce drivers/acpi/sysfs.cZhang Rui1-0/+685
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: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>