mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: gcc-4.6: ACPI: fix unused but set variables in ACPI ACPI thermal: make procfs I/F depend on CONFIG_ACPI_PROCFS ACPI video: make procfs I/F depend on CONFIG_ACPI_PROCFS ACPI processor: remove deprecated ACPI procfs I/F ACPI power_resource: remove unused procfs I/F ACPI: remove deprecated ACPI procfs I/F ACPI: introduce drivers/acpi/sysfs.c ACPI: introduce module parameter acpi.aml_debug_output ACPI: introduce drivers/acpi/debugfs.c ACPI, APEI, ERST debug support ACPI, APEI, Manage GHES as platform devices ACPI, APEI, Rename CPER and GHES severity constants ACPI, APEI, Fix a typo of error path of apei_resources_request ACPI / ACPICA: Fix reference counting problems with GPE handlers ACPI: Add the check of ADR flag in course of finding ACPI handle for PCI device ACPI / Sleep: Drop acpi_suspend_finish() ACPI / Sleep: Consolidate suspend and hibernation routines ACPI / Wakeup: Simplify enabling of wakeup devices ACPI / Sleep: Rework enabling wakeup devices ACPI / Sleep: Free NVS copy if suspending of devices fails Fixed up totally buggered "ACPI: fix unused but set variables in ACPI" patch that doesn't even compile in the merge. Thanks to Sedat Dilek <sedat.dilek@googlemail.com> for noticing the breakage before I even pulled. And a big "Grrr.." at Len for not even bothering to compile the tree before asking me to pull.
This commit is contained in:
@@ -19,6 +19,8 @@ Note: Only ACPI METHOD can be overridden, any other object types like
|
||||
"Device", "OperationRegion", are not recognized.
|
||||
Note: The same ACPI control method can be overridden for many times,
|
||||
and it's always the latest one that used by Linux/kernel.
|
||||
Note: To get the ACPI debug object output (Store (AAAA, Debug)),
|
||||
please run "echo 1 > /sys/module/acpi/parameters/aml_debug_output".
|
||||
|
||||
1. override an existing method
|
||||
a) get the ACPI table via ACPI sysfs I/F. e.g. to get the DSDT,
|
||||
|
||||
@@ -80,7 +80,7 @@ int apei_write_mce(struct mce *m)
|
||||
rcd.hdr.revision = CPER_RECORD_REV;
|
||||
rcd.hdr.signature_end = CPER_SIG_END;
|
||||
rcd.hdr.section_count = 1;
|
||||
rcd.hdr.error_severity = CPER_SER_FATAL;
|
||||
rcd.hdr.error_severity = CPER_SEV_FATAL;
|
||||
/* timestamp, platform_id, partition_id are all invalid */
|
||||
rcd.hdr.validation_bits = 0;
|
||||
rcd.hdr.record_length = sizeof(rcd);
|
||||
@@ -96,7 +96,7 @@ int apei_write_mce(struct mce *m)
|
||||
rcd.sec_hdr.validation_bits = 0;
|
||||
rcd.sec_hdr.flags = CPER_SEC_PRIMARY;
|
||||
rcd.sec_hdr.section_type = CPER_SECTION_TYPE_MCE;
|
||||
rcd.sec_hdr.section_severity = CPER_SER_FATAL;
|
||||
rcd.sec_hdr.section_severity = CPER_SEV_FATAL;
|
||||
|
||||
memcpy(&rcd.mce, m, sizeof(*m));
|
||||
|
||||
|
||||
@@ -54,17 +54,10 @@ config ACPI_PROCFS
|
||||
they have been replaced by functions in /sys.
|
||||
The deprecated files (and their replacements) include:
|
||||
|
||||
/proc/acpi/sleep (/sys/power/state)
|
||||
/proc/acpi/info (/sys/module/acpi/parameters/acpica_version)
|
||||
/proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT)
|
||||
/proc/acpi/fadt (/sys/firmware/acpi/tables/FACP)
|
||||
/proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer)
|
||||
/proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level)
|
||||
/proc/acpi/processor/*/power (/sys/devices/system/cpu/*/cpuidle/*)
|
||||
/proc/acpi/processor/*/performance (/sys/devices/system/cpu/*/
|
||||
cpufreq/*)
|
||||
/proc/acpi/processor/*/throttling (/sys/class/thermal/
|
||||
cooling_device*/*)
|
||||
/proc/acpi/video/*/brightness (/sys/class/backlight/)
|
||||
/proc/acpi/thermal_zone/*/* (/sys/class/thermal/)
|
||||
This option has no effect on /proc/acpi/ files
|
||||
and functions which do not yet exist in /sys.
|
||||
|
||||
|
||||
@@ -37,8 +37,9 @@ acpi-y += ec.o
|
||||
acpi-$(CONFIG_ACPI_DOCK) += dock.o
|
||||
acpi-y += pci_root.o pci_link.o pci_irq.o pci_bind.o
|
||||
acpi-y += power.o
|
||||
acpi-y += system.o event.o
|
||||
acpi-$(CONFIG_ACPI_DEBUG) += debug.o
|
||||
acpi-y += event.o
|
||||
acpi-y += sysfs.o
|
||||
acpi-$(CONFIG_DEBUG_FS) += debugfs.o
|
||||
acpi-$(CONFIG_ACPI_NUMA) += numa.o
|
||||
acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
|
||||
ifdef CONFIG_ACPI_VIDEO
|
||||
|
||||
@@ -82,6 +82,10 @@ acpi_ev_update_gpe_enable_mask(struct acpi_gpe_event_info *gpe_event_info);
|
||||
|
||||
acpi_status acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
|
||||
|
||||
acpi_status acpi_raw_enable_gpe(struct acpi_gpe_event_info *gpe_event_info);
|
||||
|
||||
acpi_status acpi_raw_disable_gpe(struct acpi_gpe_event_info *gpe_event_info);
|
||||
|
||||
struct acpi_gpe_event_info *acpi_ev_get_gpe_event_info(acpi_handle gpe_device,
|
||||
u32 gpe_number);
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ u8 ACPI_INIT_GLOBAL(acpi_gbl_use_default_register_widths, TRUE);
|
||||
/*
|
||||
* Optionally enable output from the AML Debug Object.
|
||||
*/
|
||||
u8 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
|
||||
u32 ACPI_INIT_GLOBAL(acpi_gbl_enable_aml_debug_object, FALSE);
|
||||
|
||||
/*
|
||||
* Optionally copy the entire DSDT to local memory (instead of simply
|
||||
|
||||
@@ -412,6 +412,7 @@ struct acpi_handler_info {
|
||||
acpi_event_handler address; /* Address of handler, if any */
|
||||
void *context; /* Context to be passed to handler */
|
||||
struct acpi_namespace_node *method_node; /* Method node for this GPE level (saved) */
|
||||
u8 orig_flags; /* Original misc info about this GPE */
|
||||
};
|
||||
|
||||
union acpi_gpe_dispatch_info {
|
||||
|
||||
@@ -135,6 +135,79 @@ acpi_ev_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
|
||||
}
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_raw_enable_gpe
|
||||
*
|
||||
* PARAMETERS: gpe_event_info - GPE to enable
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Add a reference to a GPE. On the first reference, the GPE is
|
||||
* hardware-enabled.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status acpi_raw_enable_gpe(struct acpi_gpe_event_info *gpe_event_info)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) {
|
||||
return_ACPI_STATUS(AE_LIMIT);
|
||||
}
|
||||
|
||||
gpe_event_info->runtime_count++;
|
||||
if (gpe_event_info->runtime_count == 1) {
|
||||
status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
status = acpi_ev_enable_gpe(gpe_event_info);
|
||||
}
|
||||
|
||||
if (ACPI_FAILURE(status)) {
|
||||
gpe_event_info->runtime_count--;
|
||||
}
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_raw_disable_gpe
|
||||
*
|
||||
* PARAMETERS: gpe_event_info - GPE to disable
|
||||
*
|
||||
* RETURN: Status
|
||||
*
|
||||
* DESCRIPTION: Remove a reference to a GPE. When the last reference is
|
||||
* removed, the GPE is hardware-disabled.
|
||||
*
|
||||
******************************************************************************/
|
||||
|
||||
acpi_status acpi_raw_disable_gpe(struct acpi_gpe_event_info *gpe_event_info)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
|
||||
if (!gpe_event_info->runtime_count) {
|
||||
return_ACPI_STATUS(AE_LIMIT);
|
||||
}
|
||||
|
||||
gpe_event_info->runtime_count--;
|
||||
if (!gpe_event_info->runtime_count) {
|
||||
status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
status = acpi_hw_low_set_gpe(gpe_event_info,
|
||||
ACPI_GPE_DISABLE);
|
||||
}
|
||||
|
||||
if (ACPI_FAILURE(status)) {
|
||||
gpe_event_info->runtime_count++;
|
||||
}
|
||||
}
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
*
|
||||
* FUNCTION: acpi_ev_low_get_gpe_info
|
||||
|
||||
@@ -691,23 +691,7 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||
if (!gpe_event_info) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Make sure that there isn't a handler there already */
|
||||
|
||||
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
|
||||
ACPI_GPE_DISPATCH_HANDLER) {
|
||||
status = AE_ALREADY_EXISTS;
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Allocate and init handler object */
|
||||
/* Allocate memory for the handler object */
|
||||
|
||||
handler = ACPI_ALLOCATE_ZEROED(sizeof(struct acpi_handler_info));
|
||||
if (!handler) {
|
||||
@@ -715,13 +699,45 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||
if (!gpe_event_info) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto free_and_exit;
|
||||
}
|
||||
|
||||
/* Make sure that there isn't a handler there already */
|
||||
|
||||
if ((gpe_event_info->flags & ACPI_GPE_DISPATCH_MASK) ==
|
||||
ACPI_GPE_DISPATCH_HANDLER) {
|
||||
status = AE_ALREADY_EXISTS;
|
||||
goto free_and_exit;
|
||||
}
|
||||
|
||||
/* Allocate and init handler object */
|
||||
|
||||
handler->address = address;
|
||||
handler->context = context;
|
||||
handler->method_node = gpe_event_info->dispatch.method_node;
|
||||
handler->orig_flags = gpe_event_info->flags &
|
||||
(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
|
||||
|
||||
/*
|
||||
* If the GPE is associated with a method and it cannot wake up the
|
||||
* system from sleep states, it was enabled automatically during
|
||||
* initialization, so it has to be disabled now to avoid spurious
|
||||
* execution of the handler.
|
||||
*/
|
||||
|
||||
if ((handler->orig_flags & ACPI_GPE_DISPATCH_METHOD)
|
||||
&& !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE))
|
||||
(void)acpi_raw_disable_gpe(gpe_event_info);
|
||||
|
||||
/* Install the handler */
|
||||
|
||||
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
||||
gpe_event_info->dispatch.handler = handler;
|
||||
|
||||
/* Setup up dispatch flags to indicate handler (vs. method) */
|
||||
@@ -735,6 +751,11 @@ acpi_install_gpe_handler(acpi_handle gpe_device,
|
||||
unlock_and_exit:
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
return_ACPI_STATUS(status);
|
||||
|
||||
free_and_exit:
|
||||
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
||||
ACPI_FREE(handler);
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
ACPI_EXPORT_SYMBOL(acpi_install_gpe_handler)
|
||||
@@ -770,11 +791,17 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
|
||||
return_ACPI_STATUS(AE_BAD_PARAMETER);
|
||||
}
|
||||
|
||||
/* Make sure all deferred tasks are completed */
|
||||
|
||||
acpi_os_wait_events_complete(NULL);
|
||||
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
||||
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||
@@ -798,34 +825,34 @@ acpi_remove_gpe_handler(acpi_handle gpe_device,
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
/* Make sure all deferred tasks are completed */
|
||||
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
acpi_os_wait_events_complete(NULL);
|
||||
status = acpi_ut_acquire_mutex(ACPI_MTX_EVENTS);
|
||||
if (ACPI_FAILURE(status)) {
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
/* Remove the handler */
|
||||
|
||||
flags = acpi_os_acquire_lock(acpi_gbl_gpe_lock);
|
||||
handler = gpe_event_info->dispatch.handler;
|
||||
|
||||
/* Restore Method node (if any), set dispatch flags */
|
||||
|
||||
gpe_event_info->dispatch.method_node = handler->method_node;
|
||||
gpe_event_info->flags &= ~ACPI_GPE_DISPATCH_MASK; /* Clear bits */
|
||||
if (handler->method_node) {
|
||||
gpe_event_info->flags |= ACPI_GPE_DISPATCH_METHOD;
|
||||
}
|
||||
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
||||
gpe_event_info->flags &=
|
||||
~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK);
|
||||
gpe_event_info->flags |= handler->orig_flags;
|
||||
|
||||
/*
|
||||
* If the GPE was previously associated with a method and it cannot wake
|
||||
* up the system from sleep states, it should be enabled at this point
|
||||
* to restore the post-initialization configuration.
|
||||
*/
|
||||
|
||||
if ((handler->orig_flags & ACPI_GPE_DISPATCH_METHOD)
|
||||
&& !(gpe_event_info->flags & ACPI_GPE_CAN_WAKE))
|
||||
(void)acpi_raw_enable_gpe(gpe_event_info);
|
||||
|
||||
/* Now we can free the handler object */
|
||||
|
||||
ACPI_FREE(handler);
|
||||
|
||||
unlock_and_exit:
|
||||
unlock_and_exit:
|
||||
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
||||
|
||||
(void)acpi_ut_release_mutex(ACPI_MTX_EVENTS);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
|
||||
@@ -294,7 +294,7 @@ ACPI_EXPORT_SYMBOL(acpi_gpe_wakeup)
|
||||
******************************************************************************/
|
||||
acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
acpi_status status = AE_BAD_PARAMETER;
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
acpi_cpu_flags flags;
|
||||
|
||||
@@ -305,28 +305,10 @@ acpi_status acpi_enable_gpe(acpi_handle gpe_device, u32 gpe_number)
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||
if (!gpe_event_info) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
if (gpe_event_info) {
|
||||
status = acpi_raw_enable_gpe(gpe_event_info);
|
||||
}
|
||||
|
||||
if (gpe_event_info->runtime_count == ACPI_UINT8_MAX) {
|
||||
status = AE_LIMIT; /* Too many references */
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
gpe_event_info->runtime_count++;
|
||||
if (gpe_event_info->runtime_count == 1) {
|
||||
status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
status = acpi_ev_enable_gpe(gpe_event_info);
|
||||
}
|
||||
if (ACPI_FAILURE(status)) {
|
||||
gpe_event_info->runtime_count--;
|
||||
}
|
||||
}
|
||||
|
||||
unlock_and_exit:
|
||||
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
@@ -348,7 +330,7 @@ ACPI_EXPORT_SYMBOL(acpi_enable_gpe)
|
||||
******************************************************************************/
|
||||
acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
|
||||
{
|
||||
acpi_status status = AE_OK;
|
||||
acpi_status status = AE_BAD_PARAMETER;
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
acpi_cpu_flags flags;
|
||||
|
||||
@@ -359,32 +341,10 @@ acpi_status acpi_disable_gpe(acpi_handle gpe_device, u32 gpe_number)
|
||||
/* Ensure that we have a valid GPE number */
|
||||
|
||||
gpe_event_info = acpi_ev_get_gpe_event_info(gpe_device, gpe_number);
|
||||
if (!gpe_event_info) {
|
||||
status = AE_BAD_PARAMETER;
|
||||
goto unlock_and_exit;
|
||||
if (gpe_event_info) {
|
||||
status = acpi_raw_disable_gpe(gpe_event_info) ;
|
||||
}
|
||||
|
||||
/* Hardware-disable a runtime GPE on removal of the last reference */
|
||||
|
||||
if (!gpe_event_info->runtime_count) {
|
||||
status = AE_LIMIT; /* There are no references to remove */
|
||||
goto unlock_and_exit;
|
||||
}
|
||||
|
||||
gpe_event_info->runtime_count--;
|
||||
if (!gpe_event_info->runtime_count) {
|
||||
status = acpi_ev_update_gpe_enable_mask(gpe_event_info);
|
||||
if (ACPI_SUCCESS(status)) {
|
||||
status =
|
||||
acpi_hw_low_set_gpe(gpe_event_info,
|
||||
ACPI_GPE_DISABLE);
|
||||
}
|
||||
if (ACPI_FAILURE(status)) {
|
||||
gpe_event_info->runtime_count++;
|
||||
}
|
||||
}
|
||||
|
||||
unlock_and_exit:
|
||||
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
@@ -411,7 +371,6 @@ acpi_status acpi_gpe_can_wake(acpi_handle gpe_device, u32 gpe_number)
|
||||
acpi_status status = AE_OK;
|
||||
struct acpi_gpe_event_info *gpe_event_info;
|
||||
acpi_cpu_flags flags;
|
||||
u8 disable = 0;
|
||||
|
||||
ACPI_FUNCTION_TRACE(acpi_gpe_can_wake);
|
||||
|
||||
@@ -430,15 +389,12 @@ acpi_status acpi_gpe_can_wake(acpi_handle gpe_device, u32 gpe_number)
|
||||
}
|
||||
|
||||
gpe_event_info->flags |= ACPI_GPE_CAN_WAKE;
|
||||
disable = (gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD)
|
||||
&& gpe_event_info->runtime_count;
|
||||
if (gpe_event_info->flags & ACPI_GPE_DISPATCH_METHOD) {
|
||||
(void)acpi_raw_disable_gpe(gpe_event_info);
|
||||
}
|
||||
|
||||
unlock_and_exit:
|
||||
acpi_os_release_lock(acpi_gbl_gpe_lock, flags);
|
||||
|
||||
if (disable)
|
||||
status = acpi_disable_gpe(gpe_device, gpe_number);
|
||||
|
||||
return_ACPI_STATUS(status);
|
||||
}
|
||||
ACPI_EXPORT_SYMBOL(acpi_gpe_can_wake)
|
||||
|
||||
@@ -279,13 +279,10 @@ acpi_status acpi_ut_acquire_mutex(acpi_mutex_handle mutex_id)
|
||||
|
||||
acpi_status acpi_ut_release_mutex(acpi_mutex_handle mutex_id)
|
||||
{
|
||||
acpi_thread_id this_thread_id;
|
||||
|
||||
ACPI_FUNCTION_NAME(ut_release_mutex);
|
||||
|
||||
this_thread_id = acpi_os_get_thread_id();
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_MUTEX, "Thread %p releasing Mutex [%s]\n",
|
||||
ACPI_CAST_PTR(void, this_thread_id),
|
||||
ACPI_CAST_PTR(void, acpi_os_get_thread_id()),
|
||||
acpi_ut_get_mutex_name(mutex_id)));
|
||||
|
||||
if (mutex_id > ACPI_MAX_MUTEX) {
|
||||
|
||||
@@ -28,3 +28,12 @@ config ACPI_APEI_EINJ
|
||||
EINJ provides a hardware error injection mechanism, it is
|
||||
mainly used for debugging and testing the other parts of
|
||||
APEI and some other RAS features.
|
||||
|
||||
config ACPI_APEI_ERST_DEBUG
|
||||
tristate "APEI Error Record Serialization Table (ERST) Debug Support"
|
||||
depends on ACPI_APEI
|
||||
help
|
||||
ERST is a way provided by APEI to save and retrieve hardware
|
||||
error infomation to and from a persistent store. Enable this
|
||||
if you want to debugging and testing the ERST kernel support
|
||||
and firmware implementation.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
obj-$(CONFIG_ACPI_APEI) += apei.o
|
||||
obj-$(CONFIG_ACPI_APEI_GHES) += ghes.o
|
||||
obj-$(CONFIG_ACPI_APEI_EINJ) += einj.o
|
||||
obj-$(CONFIG_ACPI_APEI_ERST_DEBUG) += erst-dbg.o
|
||||
|
||||
apei-y := apei-base.o hest.o cper.o erst.o
|
||||
|
||||
@@ -482,14 +482,14 @@ err_unmap_ioport:
|
||||
list_for_each_entry(res, &resources->ioport, list) {
|
||||
if (res == res_bak)
|
||||
break;
|
||||
release_mem_region(res->start, res->end - res->start);
|
||||
release_region(res->start, res->end - res->start);
|
||||
}
|
||||
res_bak = NULL;
|
||||
err_unmap_iomem:
|
||||
list_for_each_entry(res, &resources->iomem, list) {
|
||||
if (res == res_bak)
|
||||
break;
|
||||
release_region(res->start, res->end - res->start);
|
||||
release_mem_region(res->start, res->end - res->start);
|
||||
}
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
207
drivers/acpi/apei/erst-dbg.c
Normal file
207
drivers/acpi/apei/erst-dbg.c
Normal file
@@ -0,0 +1,207 @@
|
||||
/*
|
||||
* APEI Error Record Serialization Table debug support
|
||||
*
|
||||
* ERST is a way provided by APEI to save and retrieve hardware error
|
||||
* infomation to and from a persistent store. This file provide the
|
||||
* debugging/testing support for ERST kernel support and firmware
|
||||
* implementation.
|
||||
*
|
||||
* Copyright 2010 Intel Corp.
|
||||
* Author: Huang Ying <ying.huang@intel.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License version
|
||||
* 2 as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <acpi/apei.h>
|
||||
#include <linux/miscdevice.h>
|
||||
|
||||
#include "apei-internal.h"
|
||||
|
||||
#define ERST_DBG_PFX "ERST DBG: "
|
||||
|
||||
#define ERST_DBG_RECORD_LEN_MAX 4096
|
||||
|
||||
static void *erst_dbg_buf;
|
||||
static unsigned int erst_dbg_buf_len;
|
||||
|
||||
/* Prevent erst_dbg_read/write from being invoked concurrently */
|
||||
static DEFINE_MUTEX(erst_dbg_mutex);
|
||||
|
||||
static int erst_dbg_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
if (erst_disable)
|
||||
return -ENODEV;
|
||||
|
||||
return nonseekable_open(inode, file);
|
||||
}
|
||||
|
||||
static long erst_dbg_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
|
||||
{
|
||||
int rc;
|
||||
u64 record_id;
|
||||
u32 record_count;
|
||||
|
||||
switch (cmd) {
|
||||
case APEI_ERST_CLEAR_RECORD:
|
||||
rc = copy_from_user(&record_id, (void __user *)arg,
|
||||
sizeof(record_id));
|
||||
if (rc)
|
||||
return -EFAULT;
|
||||
return erst_clear(record_id);
|
||||
case APEI_ERST_GET_RECORD_COUNT:
|
||||
rc = erst_get_record_count();
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
record_count = rc;
|
||||
rc = put_user(record_count, (u32 __user *)arg);
|
||||
if (rc)
|
||||
return rc;
|
||||
return 0;
|
||||
default:
|
||||
return -ENOTTY;
|
||||
}
|
||||
}
|
||||
|
||||
static ssize_t erst_dbg_read(struct file *filp, char __user *ubuf,
|
||||
size_t usize, loff_t *off)
|
||||
{
|
||||
int rc;
|
||||
ssize_t len = 0;
|
||||
u64 id;
|
||||
|
||||
if (*off != 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (mutex_lock_interruptible(&erst_dbg_mutex) != 0)
|
||||
return -EINTR;
|
||||
|
||||
retry_next:
|
||||
rc = erst_get_next_record_id(&id);
|
||||
if (rc)
|
||||
goto out;
|
||||
/* no more record */
|
||||
if (id == APEI_ERST_INVALID_RECORD_ID)
|
||||
goto out;
|
||||
retry:
|
||||
rc = len = erst_read(id, erst_dbg_buf, erst_dbg_buf_len);
|
||||
/* The record may be cleared by others, try read next record */
|
||||
if (rc == -ENOENT)
|
||||
goto retry_next;
|
||||
if (rc < 0)
|
||||
goto out;
|
||||
if (len > ERST_DBG_RECORD_LEN_MAX) {
|
||||
pr_warning(ERST_DBG_PFX
|
||||
"Record (ID: 0x%llx) length is too long: %zd\n",
|
||||
id, len);
|
||||
rc = -EIO;
|
||||
goto out;
|
||||
}
|
||||
if (len > erst_dbg_buf_len) {
|
||||
kfree(erst_dbg_buf);
|
||||
rc = -ENOMEM;
|
||||
erst_dbg_buf = kmalloc(len, GFP_KERNEL);
|
||||
if (!erst_dbg_buf)
|
||||
goto out;
|
||||
erst_dbg_buf_len = len;
|
||||
goto retry;
|
||||
}
|
||||
|
||||
rc = -EINVAL;
|
||||
if (len > usize)
|
||||
goto out;
|
||||
|
||||
rc = -EFAULT;
|
||||
if (copy_to_user(ubuf, erst_dbg_buf, len))
|
||||
goto out;
|
||||
rc = 0;
|
||||
out:
|
||||
mutex_unlock(&erst_dbg_mutex);
|
||||
return rc ? rc : len;
|
||||
}
|
||||
|
||||
static ssize_t erst_dbg_write(struct file *filp, const char __user *ubuf,
|
||||
size_t usize, loff_t *off)
|
||||
{
|
||||
int rc;
|
||||
struct cper_record_header *rcd;
|
||||
|
||||
if (!capable(CAP_SYS_ADMIN))
|
||||
return -EPERM;
|
||||
|
||||
if (usize > ERST_DBG_RECORD_LEN_MAX) {
|
||||
pr_err(ERST_DBG_PFX "Too long record to be written\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (mutex_lock_interruptible(&erst_dbg_mutex))
|
||||
return -EINTR;
|
||||
if (usize > erst_dbg_buf_len) {
|
||||
kfree(erst_dbg_buf);
|
||||
rc = -ENOMEM;
|
||||
erst_dbg_buf = kmalloc(usize, GFP_KERNEL);
|
||||
if (!erst_dbg_buf)
|
||||
goto out;
|
||||
erst_dbg_buf_len = usize;
|
||||
}
|
||||
rc = copy_from_user(erst_dbg_buf, ubuf, usize);
|
||||
if (rc) {
|
||||
rc = -EFAULT;
|
||||
goto out;
|
||||
}
|
||||
rcd = erst_dbg_buf;
|
||||
rc = -EINVAL;
|
||||
if (rcd->record_length != usize)
|
||||
goto out;
|
||||
|
||||
rc = erst_write(erst_dbg_buf);
|
||||
|
||||
out:
|
||||
mutex_unlock(&erst_dbg_mutex);
|
||||
return rc < 0 ? rc : usize;
|
||||
}
|
||||
|
||||
static const struct file_operations erst_dbg_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = erst_dbg_open,
|
||||
.read = erst_dbg_read,
|
||||
.write = erst_dbg_write,
|
||||
.unlocked_ioctl = erst_dbg_ioctl,
|
||||
};
|
||||
|
||||
static struct miscdevice erst_dbg_dev = {
|
||||
.minor = MISC_DYNAMIC_MINOR,
|
||||
.name = "erst_dbg",
|
||||
.fops = &erst_dbg_ops,
|
||||
};
|
||||
|
||||
static __init int erst_dbg_init(void)
|
||||
{
|
||||
return misc_register(&erst_dbg_dev);
|
||||
}
|
||||
|
||||
static __exit void erst_dbg_exit(void)
|
||||
{
|
||||
misc_deregister(&erst_dbg_dev);
|
||||
kfree(erst_dbg_buf);
|
||||
}
|
||||
|
||||
module_init(erst_dbg_init);
|
||||
module_exit(erst_dbg_exit);
|
||||
|
||||
MODULE_AUTHOR("Huang Ying");
|
||||
MODULE_DESCRIPTION("APEI Error Record Serialization Table debug support");
|
||||
MODULE_LICENSE("GPL");
|
||||
@@ -41,6 +41,8 @@
|
||||
#include <linux/interrupt.h>
|
||||
#include <linux/cper.h>
|
||||
#include <linux/kdebug.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <acpi/apei.h>
|
||||
#include <acpi/atomicio.h>
|
||||
#include <acpi/hed.h>
|
||||
@@ -87,6 +89,7 @@ struct ghes {
|
||||
* used for that.
|
||||
*/
|
||||
static LIST_HEAD(ghes_sci);
|
||||
static DEFINE_MUTEX(ghes_list_mutex);
|
||||
|
||||
static struct ghes *ghes_new(struct acpi_hest_generic *generic)
|
||||
{
|
||||
@@ -132,26 +135,26 @@ static void ghes_fini(struct ghes *ghes)
|
||||
}
|
||||
|
||||
enum {
|
||||
GHES_SER_NO = 0x0,
|
||||
GHES_SER_CORRECTED = 0x1,
|
||||
GHES_SER_RECOVERABLE = 0x2,
|
||||
GHES_SER_PANIC = 0x3,
|
||||
GHES_SEV_NO = 0x0,
|
||||
GHES_SEV_CORRECTED = 0x1,
|
||||
GHES_SEV_RECOVERABLE = 0x2,
|
||||
GHES_SEV_PANIC = 0x3,
|
||||
};
|
||||
|
||||
static inline int ghes_severity(int severity)
|
||||
{
|
||||
switch (severity) {
|
||||
case CPER_SER_INFORMATIONAL:
|
||||
return GHES_SER_NO;
|
||||
case CPER_SER_CORRECTED:
|
||||
return GHES_SER_CORRECTED;
|
||||
case CPER_SER_RECOVERABLE:
|
||||
return GHES_SER_RECOVERABLE;
|
||||
case CPER_SER_FATAL:
|
||||
return GHES_SER_PANIC;
|
||||
case CPER_SEV_INFORMATIONAL:
|
||||
return GHES_SEV_NO;
|
||||
case CPER_SEV_CORRECTED:
|
||||
return GHES_SEV_CORRECTED;
|
||||
case CPER_SEV_RECOVERABLE:
|
||||
return GHES_SEV_RECOVERABLE;
|
||||
case CPER_SEV_FATAL:
|
||||
return GHES_SEV_PANIC;
|
||||
default:
|
||||
/* Unkown, go panic */
|
||||
return GHES_SER_PANIC;
|
||||
return GHES_SEV_PANIC;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,16 +240,16 @@ static void ghes_clear_estatus(struct ghes *ghes)
|
||||
|
||||
static void ghes_do_proc(struct ghes *ghes)
|
||||
{
|
||||
int ser, processed = 0;
|
||||
int sev, processed = 0;
|
||||
struct acpi_hest_generic_data *gdata;
|
||||
|
||||
ser = ghes_severity(ghes->estatus->error_severity);
|
||||
sev = ghes_severity(ghes->estatus->error_severity);
|
||||
apei_estatus_for_each_section(ghes->estatus, gdata) {
|
||||
#ifdef CONFIG_X86_MCE
|
||||
if (!uuid_le_cmp(*(uuid_le *)gdata->section_type,
|
||||
CPER_SEC_PLATFORM_MEM)) {
|
||||
apei_mce_report_mem_error(
|
||||
ser == GHES_SER_CORRECTED,
|
||||
sev == GHES_SEV_CORRECTED,
|
||||
(struct cper_sec_mem_err *)(gdata+1));
|
||||
processed = 1;
|
||||
}
|
||||
@@ -293,18 +296,15 @@ static struct notifier_block ghes_notifier_sci = {
|
||||
.notifier_call = ghes_notify_sci,
|
||||
};
|
||||
|
||||
static int hest_ghes_parse(struct acpi_hest_header *hest_hdr, void *data)
|
||||
static int __devinit ghes_probe(struct platform_device *ghes_dev)
|
||||
{
|
||||
struct acpi_hest_generic *generic;
|
||||
struct ghes *ghes = NULL;
|
||||
int rc = 0;
|
||||
int rc = -EINVAL;
|
||||
|
||||
if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR)
|
||||
return 0;
|
||||
|
||||
generic = (struct acpi_hest_generic *)hest_hdr;
|
||||
generic = ghes_dev->dev.platform_data;
|
||||
if (!generic->enabled)
|
||||
return 0;
|
||||
return -ENODEV;
|
||||
|
||||
if (generic->error_block_length <
|
||||
sizeof(struct acpi_hest_generic_status)) {
|
||||
@@ -327,62 +327,91 @@ static int hest_ghes_parse(struct acpi_hest_header *hest_hdr, void *data)
|
||||
ghes = NULL;
|
||||
goto err;
|
||||
}
|
||||
switch (generic->notify.type) {
|
||||
case ACPI_HEST_NOTIFY_POLLED:
|
||||
pr_warning(GHES_PFX
|
||||
"Generic hardware error source: %d notified via POLL is not supported!\n",
|
||||
generic->header.source_id);
|
||||
break;
|
||||
case ACPI_HEST_NOTIFY_EXTERNAL:
|
||||
case ACPI_HEST_NOTIFY_LOCAL:
|
||||
pr_warning(GHES_PFX
|
||||
"Generic hardware error source: %d notified via IRQ is not supported!\n",
|
||||
generic->header.source_id);
|
||||
break;
|
||||
case ACPI_HEST_NOTIFY_SCI:
|
||||
if (generic->notify.type == ACPI_HEST_NOTIFY_SCI) {
|
||||
mutex_lock(&ghes_list_mutex);
|
||||
if (list_empty(&ghes_sci))
|
||||
register_acpi_hed_notifier(&ghes_notifier_sci);
|
||||
list_add_rcu(&ghes->list, &ghes_sci);
|
||||
break;
|
||||
case ACPI_HEST_NOTIFY_NMI:
|
||||
pr_warning(GHES_PFX
|
||||
"Generic hardware error source: %d notified via NMI is not supported!\n",
|
||||
generic->header.source_id);
|
||||
break;
|
||||
default:
|
||||
pr_warning(FW_WARN GHES_PFX
|
||||
"Unknown notification type: %u for generic hardware error source: %d\n",
|
||||
generic->notify.type, generic->header.source_id);
|
||||
break;
|
||||
mutex_unlock(&ghes_list_mutex);
|
||||
} else {
|
||||
unsigned char *notify = NULL;
|
||||
|
||||
switch (generic->notify.type) {
|
||||
case ACPI_HEST_NOTIFY_POLLED:
|
||||
notify = "POLL";
|
||||
break;
|
||||
case ACPI_HEST_NOTIFY_EXTERNAL:
|
||||
case ACPI_HEST_NOTIFY_LOCAL:
|
||||
notify = "IRQ";
|
||||
break;
|
||||
case ACPI_HEST_NOTIFY_NMI:
|
||||
notify = "NMI";
|
||||
break;
|
||||
}
|
||||
if (notify) {
|
||||
pr_warning(GHES_PFX
|
||||
"Generic hardware error source: %d notified via %s is not supported!\n",
|
||||
generic->header.source_id, notify);
|
||||
} else {
|
||||
pr_warning(FW_WARN GHES_PFX
|
||||
"Unknown notification type: %u for generic hardware error source: %d\n",
|
||||
generic->notify.type, generic->header.source_id);
|
||||
}
|
||||
rc = -ENODEV;
|
||||
goto err;
|
||||
}
|
||||
platform_set_drvdata(ghes_dev, ghes);
|
||||
|
||||
return 0;
|
||||
err:
|
||||
if (ghes)
|
||||
ghes_fini(ghes);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static void ghes_cleanup(void)
|
||||
{
|
||||
struct ghes *ghes, *nghes;
|
||||
|
||||
if (!list_empty(&ghes_sci))
|
||||
unregister_acpi_hed_notifier(&ghes_notifier_sci);
|
||||
|
||||
synchronize_rcu();
|
||||
|
||||
list_for_each_entry_safe(ghes, nghes, &ghes_sci, list) {
|
||||
list_del(&ghes->list);
|
||||
if (ghes) {
|
||||
ghes_fini(ghes);
|
||||
kfree(ghes);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __devexit ghes_remove(struct platform_device *ghes_dev)
|
||||
{
|
||||
struct ghes *ghes;
|
||||
struct acpi_hest_generic *generic;
|
||||
|
||||
ghes = platform_get_drvdata(ghes_dev);
|
||||
generic = ghes->generic;
|
||||
|
||||
switch (generic->notify.type) {
|
||||
case ACPI_HEST_NOTIFY_SCI:
|
||||
mutex_lock(&ghes_list_mutex);
|
||||
list_del_rcu(&ghes->list);
|
||||
if (list_empty(&ghes_sci))
|
||||
unregister_acpi_hed_notifier(&ghes_notifier_sci);
|
||||
mutex_unlock(&ghes_list_mutex);
|
||||
break;
|
||||
default:
|
||||
BUG();
|
||||
break;
|
||||
}
|
||||
|
||||
synchronize_rcu();
|
||||
ghes_fini(ghes);
|
||||
kfree(ghes);
|
||||
|
||||
platform_set_drvdata(ghes_dev, NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct platform_driver ghes_platform_driver = {
|
||||
.driver = {
|
||||
.name = "GHES",
|
||||
.owner = THIS_MODULE,
|
||||
},
|
||||
.probe = ghes_probe,
|
||||
.remove = ghes_remove,
|
||||
};
|
||||
|
||||
static int __init ghes_init(void)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (acpi_disabled)
|
||||
return -ENODEV;
|
||||
|
||||
@@ -391,32 +420,12 @@ static int __init ghes_init(void)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
rc = apei_hest_parse(hest_ghes_parse, NULL);
|
||||
if (rc) {
|
||||
pr_err(GHES_PFX
|
||||
"Error during parsing HEST generic hardware error sources.\n");
|
||||
goto err_cleanup;
|
||||
}
|
||||
|
||||
if (list_empty(&ghes_sci)) {
|
||||
pr_info(GHES_PFX
|
||||
"No functional generic hardware error sources.\n");
|
||||
rc = -ENODEV;
|
||||
goto err_cleanup;
|
||||
}
|
||||
|
||||
pr_info(GHES_PFX
|
||||
"Generic Hardware Error Source support is initialized.\n");
|
||||
|
||||
return 0;
|
||||
err_cleanup:
|
||||
ghes_cleanup();
|
||||
return rc;
|
||||
return platform_driver_register(&ghes_platform_driver);
|
||||
}
|
||||
|
||||
static void __exit ghes_exit(void)
|
||||
{
|
||||
ghes_cleanup();
|
||||
platform_driver_unregister(&ghes_platform_driver);
|
||||
}
|
||||
|
||||
module_init(ghes_init);
|
||||
@@ -425,3 +434,4 @@ module_exit(ghes_exit);
|
||||
MODULE_AUTHOR("Huang Ying");
|
||||
MODULE_DESCRIPTION("APEI Generic Hardware Error Source support");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS("platform:GHES");
|
||||
|
||||
@@ -34,6 +34,7 @@
|
||||
#include <linux/kdebug.h>
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <acpi/apei.h>
|
||||
|
||||
#include "apei-internal.h"
|
||||
@@ -47,11 +48,6 @@ EXPORT_SYMBOL_GPL(hest_disable);
|
||||
|
||||
static struct acpi_table_hest *hest_tab;
|
||||
|
||||
static int hest_void_parse(struct acpi_hest_header *hest_hdr, void *data)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hest_esrc_len_tab[ACPI_HEST_TYPE_RESERVED] = {
|
||||
[ACPI_HEST_TYPE_IA32_CHECK] = -1, /* need further calculation */
|
||||
[ACPI_HEST_TYPE_IA32_CORRECTED_CHECK] = -1,
|
||||
@@ -125,6 +121,69 @@ int apei_hest_parse(apei_hest_func_t func, void *data)
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(apei_hest_parse);
|
||||
|
||||
struct ghes_arr {
|
||||
struct platform_device **ghes_devs;
|
||||
unsigned int count;
|
||||
};
|
||||
|
||||
static int hest_parse_ghes_count(struct acpi_hest_header *hest_hdr, void *data)
|
||||
{
|
||||
int *count = data;
|
||||
|
||||
if (hest_hdr->type == ACPI_HEST_TYPE_GENERIC_ERROR)
|
||||
(*count)++;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hest_parse_ghes(struct acpi_hest_header *hest_hdr, void *data)
|
||||
{
|
||||
struct acpi_hest_generic *generic;
|
||||
struct platform_device *ghes_dev;
|
||||
struct ghes_arr *ghes_arr = data;
|
||||
int rc;
|
||||
|
||||
if (hest_hdr->type != ACPI_HEST_TYPE_GENERIC_ERROR)
|
||||
return 0;
|
||||
generic = (struct acpi_hest_generic *)hest_hdr;
|
||||
if (!generic->enabled)
|
||||
return 0;
|
||||
ghes_dev = platform_device_alloc("GHES", hest_hdr->source_id);
|
||||
if (!ghes_dev)
|
||||
return -ENOMEM;
|
||||
ghes_dev->dev.platform_data = generic;
|
||||
rc = platform_device_add(ghes_dev);
|
||||
if (rc)
|
||||
goto err;
|
||||
ghes_arr->ghes_devs[ghes_arr->count++] = ghes_dev;
|
||||
|
||||
return 0;
|
||||
err:
|
||||
platform_device_put(ghes_dev);
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int hest_ghes_dev_register(unsigned int ghes_count)
|
||||
{
|
||||
int rc, i;
|
||||
struct ghes_arr ghes_arr;
|
||||
|
||||
ghes_arr.count = 0;
|
||||
ghes_arr.ghes_devs = kmalloc(sizeof(void *) * ghes_count, GFP_KERNEL);
|
||||
if (!ghes_arr.ghes_devs)
|
||||
return -ENOMEM;
|
||||
|
||||
rc = apei_hest_parse(hest_parse_ghes, &ghes_arr);
|
||||
if (rc)
|
||||
goto err;
|
||||
out:
|
||||
kfree(ghes_arr.ghes_devs);
|
||||
return rc;
|
||||
err:
|
||||
for (i = 0; i < ghes_arr.count; i++)
|
||||
platform_device_unregister(ghes_arr.ghes_devs[i]);
|
||||
goto out;
|
||||
}
|
||||
|
||||
static int __init setup_hest_disable(char *str)
|
||||
{
|
||||
hest_disable = 1;
|
||||
@@ -137,6 +196,7 @@ static int __init hest_init(void)
|
||||
{
|
||||
acpi_status status;
|
||||
int rc = -ENODEV;
|
||||
unsigned int ghes_count = 0;
|
||||
|
||||
if (acpi_disabled)
|
||||
goto err;
|
||||
@@ -158,7 +218,11 @@ static int __init hest_init(void)
|
||||
goto err;
|
||||
}
|
||||
|
||||
rc = apei_hest_parse(hest_void_parse, NULL);
|
||||
rc = apei_hest_parse(hest_parse_ghes_count, &ghes_count);
|
||||
if (rc)
|
||||
goto err;
|
||||
|
||||
rc = hest_ghes_dev_register(ghes_count);
|
||||
if (rc)
|
||||
goto err;
|
||||
|
||||
|
||||
@@ -1034,8 +1034,8 @@ static int __init acpi_init(void)
|
||||
acpi_scan_init();
|
||||
acpi_ec_init();
|
||||
acpi_power_init();
|
||||
acpi_system_init();
|
||||
acpi_debug_init();
|
||||
acpi_sysfs_init();
|
||||
acpi_debugfs_init();
|
||||
acpi_sleep_proc_init();
|
||||
acpi_wakeup_device_init();
|
||||
return result;
|
||||
|
||||
@@ -1,422 +0,0 @@
|
||||
/*
|
||||
* debug.c - ACPI debug interface to userspace.
|
||||
*/
|
||||
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/slab.h>
|
||||
#include <asm/uaccess.h>
|
||||
#include <acpi/acpi_drivers.h>
|
||||
|
||||
#define _COMPONENT ACPI_SYSTEM_COMPONENT
|
||||
ACPI_MODULE_NAME("debug");
|
||||
|
||||
struct acpi_dlayer {
|
||||
const char *name;
|
||||
unsigned long value;
|
||||
};
|
||||
struct acpi_dlevel {
|
||||
const char *name;
|
||||
unsigned long value;
|
||||
};
|
||||
#define ACPI_DEBUG_INIT(v) { .name = #v, .value = v }
|
||||
|
||||
static const struct acpi_dlayer acpi_debug_layers[] = {
|
||||
ACPI_DEBUG_INIT(ACPI_UTILITIES),
|
||||
ACPI_DEBUG_INIT(ACPI_HARDWARE),
|
||||
ACPI_DEBUG_INIT(ACPI_EVENTS),
|
||||
ACPI_DEBUG_INIT(ACPI_TABLES),
|
||||
ACPI_DEBUG_INIT(ACPI_NAMESPACE),
|
||||
ACPI_DEBUG_INIT(ACPI_PARSER),
|
||||
ACPI_DEBUG_INIT(ACPI_DISPATCHER),
|
||||
ACPI_DEBUG_INIT(ACPI_EXECUTER),
|
||||
ACPI_DEBUG_INIT(ACPI_RESOURCES),
|
||||
ACPI_DEBUG_INIT(ACPI_CA_DEBUGGER),
|
||||
ACPI_DEBUG_INIT(ACPI_OS_SERVICES),
|
||||
ACPI_DEBUG_INIT(ACPI_CA_DISASSEMBLER),
|
||||
ACPI_DEBUG_INIT(ACPI_COMPILER),
|
||||
ACPI_DEBUG_INIT(ACPI_TOOLS),
|
||||
|
||||
ACPI_DEBUG_INIT(ACPI_BUS_COMPONENT),
|
||||
ACPI_DEBUG_INIT(ACPI_AC_COMPONENT),
|
||||
ACPI_DEBUG_INIT(ACPI_BATTERY_COMPONENT),
|
||||
ACPI_DEBUG_INIT(ACPI_BUTTON_COMPONENT),
|
||||
ACPI_DEBUG_INIT(ACPI_SBS_COMPONENT),
|
||||
ACPI_DEBUG_INIT(ACPI_FAN_COMPONENT),
|
||||
ACPI_DEBUG_INIT(ACPI_PCI_COMPONENT),
|
||||
ACPI_DEBUG_INIT(ACPI_POWER_COMPONENT),
|
||||
ACPI_DEBUG_INIT(ACPI_CONTAINER_COMPONENT),
|
||||
ACPI_DEBUG_INIT(ACPI_SYSTEM_COMPONENT),
|
||||
ACPI_DEBUG_INIT(ACPI_THERMAL_COMPONENT),
|
||||
ACPI_DEBUG_INIT(ACPI_MEMORY_DEVICE_COMPONENT),
|
||||
ACPI_DEBUG_INIT(ACPI_VIDEO_COMPONENT),
|
||||
ACPI_DEBUG_INIT(ACPI_PROCESSOR_COMPONENT),
|
||||
};
|
||||
|
||||
static const struct acpi_dlevel acpi_debug_levels[] = {
|
||||
ACPI_DEBUG_INIT(ACPI_LV_INIT),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_DEBUG_OBJECT),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_INFO),
|
||||
|
||||
ACPI_DEBUG_INIT(ACPI_LV_INIT_NAMES),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_PARSE),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_LOAD),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_DISPATCH),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_EXEC),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_NAMES),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_OPREGION),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_BFIELD),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_TABLES),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_VALUES),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_OBJECTS),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_RESOURCES),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_USER_REQUESTS),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_PACKAGE),
|
||||
|
||||
ACPI_DEBUG_INIT(ACPI_LV_ALLOCATIONS),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_FUNCTIONS),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_OPTIMIZATIONS),
|
||||
|
||||
ACPI_DEBUG_INIT(ACPI_LV_MUTEX),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_THREADS),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_IO),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_INTERRUPTS),
|
||||
|
||||
ACPI_DEBUG_INIT(ACPI_LV_AML_DISASSEMBLE),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_VERBOSE_INFO),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_FULL_TABLES),
|
||||
ACPI_DEBUG_INIT(ACPI_LV_EVENTS),
|
||||
};
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
FS Interface (/sys)
|
||||
-------------------------------------------------------------------------- */
|
||||
static int param_get_debug_layer(char *buffer, const struct kernel_param *kp)
|
||||
{
|
||||
int result = 0;
|
||||
int i;
|
||||
|
||||
result = sprintf(buffer, "%-25s\tHex SET\n", "Description");
|
||||
|
||||
for(i = 0; i <ARRAY_SIZE(acpi_debug_layers); i++) {
|
||||
result += sprintf(buffer+result, "%-25s\t0x%08lX [%c]\n",
|
||||
acpi_debug_layers[i].name,
|
||||
acpi_debug_layers[i].value,
|
||||
(acpi_dbg_layer & acpi_debug_layers[i].value) ? '*' : ' ');
|
||||
}
|
||||
result += sprintf(buffer+result, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
|
||||
ACPI_ALL_DRIVERS,
|
||||
(acpi_dbg_layer & ACPI_ALL_DRIVERS) ==
|
||||
ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer &
|
||||
ACPI_ALL_DRIVERS) == 0 ? ' ' : '-');
|
||||
result += sprintf(buffer+result, "--\ndebug_layer = 0x%08X ( * = enabled)\n", acpi_dbg_layer);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int param_get_debug_level(char *buffer, const struct kernel_param *kp)
|
||||
{
|
||||
int result = 0;
|
||||
int i;
|
||||
|
||||
result = sprintf(buffer, "%-25s\tHex SET\n", "Description");
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) {
|
||||
result += sprintf(buffer+result, "%-25s\t0x%08lX [%c]\n",
|
||||
acpi_debug_levels[i].name,
|
||||
acpi_debug_levels[i].value,
|
||||
(acpi_dbg_level & acpi_debug_levels[i].
|
||||
value) ? '*' : ' ');
|
||||
}
|
||||
result += sprintf(buffer+result, "--\ndebug_level = 0x%08X (* = enabled)\n",
|
||||
acpi_dbg_level);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static struct kernel_param_ops acpi_debug_layer_ops = {
|
||||
.set = param_set_uint,
|
||||
.get = param_get_debug_layer,
|
||||
};
|
||||
|
||||
static struct kernel_param_ops acpi_debug_level_ops = {
|
||||
.set = param_set_uint,
|
||||
.get = param_get_debug_level,
|
||||
};
|
||||
|
||||
module_param_cb(debug_layer, &acpi_debug_layer_ops, &acpi_dbg_layer, 0644);
|
||||
module_param_cb(debug_level, &acpi_debug_level_ops, &acpi_dbg_level, 0644);
|
||||
|
||||
static char trace_method_name[6];
|
||||
module_param_string(trace_method_name, trace_method_name, 6, 0644);
|
||||
static unsigned int trace_debug_layer;
|
||||
module_param(trace_debug_layer, uint, 0644);
|
||||
static unsigned int trace_debug_level;
|
||||
module_param(trace_debug_level, uint, 0644);
|
||||
|
||||
static int param_set_trace_state(const char *val, const struct kernel_param *kp)
|
||||
{
|
||||
int result = 0;
|
||||
|
||||
if (!strncmp(val, "enable", strlen("enable") - 1)) {
|
||||
result = acpi_debug_trace(trace_method_name, trace_debug_level,
|
||||
trace_debug_layer, 0);
|
||||
if (result)
|
||||
result = -EBUSY;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!strncmp(val, "disable", strlen("disable") - 1)) {
|
||||
int name = 0;
|
||||
result = acpi_debug_trace((char *)&name, trace_debug_level,
|
||||
trace_debug_layer, 0);
|
||||
if (result)
|
||||
result = -EBUSY;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!strncmp(val, "1", 1)) {
|
||||
result = acpi_debug_trace(trace_method_name, trace_debug_level,
|
||||
trace_debug_layer, 1);
|
||||
if (result)
|
||||
result = -EBUSY;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
result = -EINVAL;
|
||||
exit:
|
||||
return result;
|
||||
}
|
||||
|
||||
static int param_get_trace_state(char *buffer, const struct kernel_param *kp)
|
||||
{
|
||||
if (!acpi_gbl_trace_method_name)
|
||||
return sprintf(buffer, "disable");
|
||||
else {
|
||||
if (acpi_gbl_trace_flags & 1)
|
||||
return sprintf(buffer, "1");
|
||||
else
|
||||
return sprintf(buffer, "enable");
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct kernel_param_ops param_ops_trace_state = {
|
||||
.set = param_set_trace_state,
|
||||
.get = param_get_trace_state,
|
||||
};
|
||||
|
||||
module_param_cb(trace_state, ¶m_ops_trace_state, NULL, 0644);
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
DebugFS Interface
|
||||
-------------------------------------------------------------------------- */
|
||||
|
||||
static ssize_t cm_write(struct file *file, const char __user *user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
static char *buf;
|
||||
static int uncopied_bytes;
|
||||
struct acpi_table_header table;
|
||||
acpi_status status;
|
||||
|
||||
if (!(*ppos)) {
|
||||
/* parse the table header to get the table length */
|
||||
if (count <= sizeof(struct acpi_table_header))
|
||||
return -EINVAL;
|
||||
if (copy_from_user(&table, user_buf,
|
||||
sizeof(struct acpi_table_header)))
|
||||
return -EFAULT;
|
||||
uncopied_bytes = table.length;
|
||||
buf = kzalloc(uncopied_bytes, GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (uncopied_bytes < count) {
|
||||
kfree(buf);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (copy_from_user(buf + (*ppos), user_buf, count)) {
|
||||
kfree(buf);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
uncopied_bytes -= count;
|
||||
*ppos += count;
|
||||
|
||||
if (!uncopied_bytes) {
|
||||
status = acpi_install_method(buf);
|
||||
kfree(buf);
|
||||
if (ACPI_FAILURE(status))
|
||||
return -EINVAL;
|
||||
add_taint(TAINT_OVERRIDDEN_ACPI_TABLE);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations cm_fops = {
|
||||
.write = cm_write,
|
||||
};
|
||||
|
||||
static int acpi_debugfs_init(void)
|
||||
{
|
||||
struct dentry *acpi_dir, *cm_dentry;
|
||||
|
||||
acpi_dir = debugfs_create_dir("acpi", NULL);
|
||||
if (!acpi_dir)
|
||||
goto err;
|
||||
|
||||
cm_dentry = debugfs_create_file("custom_method", S_IWUGO,
|
||||
acpi_dir, NULL, &cm_fops);
|
||||
if (!cm_dentry)
|
||||
goto err;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
if (acpi_dir)
|
||||
debugfs_remove(acpi_dir);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* --------------------------------------------------------------------------
|
||||
FS Interface (/proc)
|
||||
-------------------------------------------------------------------------- */
|
||||
#ifdef CONFIG_ACPI_PROCFS
|
||||
#define ACPI_SYSTEM_FILE_DEBUG_LAYER "debug_layer"
|
||||
#define ACPI_SYSTEM_FILE_DEBUG_LEVEL "debug_level"
|
||||
|
||||
static int acpi_system_debug_proc_show(struct seq_file *m, void *v)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
seq_printf(m, "%-25s\tHex SET\n", "Description");
|
||||
|
||||
switch ((unsigned long)m->private) {
|
||||
case 0:
|
||||
for (i = 0; i < ARRAY_SIZE(acpi_debug_layers); i++) {
|
||||
seq_printf(m, "%-25s\t0x%08lX [%c]\n",
|
||||
acpi_debug_layers[i].name,
|
||||
acpi_debug_layers[i].value,
|
||||
(acpi_dbg_layer & acpi_debug_layers[i].
|
||||
value) ? '*' : ' ');
|
||||
}
|
||||
seq_printf(m, "%-25s\t0x%08X [%c]\n", "ACPI_ALL_DRIVERS",
|
||||
ACPI_ALL_DRIVERS,
|
||||
(acpi_dbg_layer & ACPI_ALL_DRIVERS) ==
|
||||
ACPI_ALL_DRIVERS ? '*' : (acpi_dbg_layer &
|
||||
ACPI_ALL_DRIVERS) ==
|
||||
0 ? ' ' : '-');
|
||||
seq_printf(m,
|
||||
"--\ndebug_layer = 0x%08X (* = enabled, - = partial)\n",
|
||||
acpi_dbg_layer);
|
||||
break;
|
||||
case 1:
|
||||
for (i = 0; i < ARRAY_SIZE(acpi_debug_levels); i++) {
|
||||
seq_printf(m, "%-25s\t0x%08lX [%c]\n",
|
||||
acpi_debug_levels[i].name,
|
||||
acpi_debug_levels[i].value,
|
||||
(acpi_dbg_level & acpi_debug_levels[i].
|
||||
value) ? '*' : ' ');
|
||||
}
|
||||
seq_printf(m, "--\ndebug_level = 0x%08X (* = enabled)\n",
|
||||
acpi_dbg_level);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int acpi_system_debug_proc_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, acpi_system_debug_proc_show, PDE(inode)->data);
|
||||
}
|
||||
|
||||
static ssize_t acpi_system_debug_proc_write(struct file *file,
|
||||
const char __user * buffer,
|
||||
size_t count, loff_t *pos)
|
||||
{
|
||||
char debug_string[12] = { '\0' };
|
||||
|
||||
|
||||
if (count > sizeof(debug_string) - 1)
|
||||
return -EINVAL;
|
||||
|
||||
if (copy_from_user(debug_string, buffer, count))
|
||||
return -EFAULT;
|
||||
|
||||
debug_string[count] = '\0';
|
||||
|
||||
switch ((unsigned long)PDE(file->f_path.dentry->d_inode)->data) {
|
||||
case 0:
|
||||
acpi_dbg_layer = simple_strtoul(debug_string, NULL, 0);
|
||||
break;
|
||||
case 1:
|
||||
acpi_dbg_level = simple_strtoul(debug_string, NULL, 0);
|
||||
break;
|
||||
default:
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations acpi_system_debug_proc_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.open = acpi_system_debug_proc_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
.write = acpi_system_debug_proc_write,
|
||||
};
|
||||
#endif
|
||||
|
||||
int __init acpi_procfs_init(void)
|
||||
{
|
||||
#ifdef CONFIG_ACPI_PROCFS
|
||||
struct proc_dir_entry *entry;
|
||||
int error = 0;
|
||||
char *name;
|
||||
|
||||
/* 'debug_layer' [R/W] */
|
||||
name = ACPI_SYSTEM_FILE_DEBUG_LAYER;
|
||||
entry = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUSR,
|
||||
acpi_root_dir, &acpi_system_debug_proc_fops,
|
||||
(void *)0);
|
||||
if (!entry)
|
||||
goto Error;
|
||||
|
||||
/* 'debug_level' [R/W] */
|
||||
name = ACPI_SYSTEM_FILE_DEBUG_LEVEL;
|
||||
entry = proc_create_data(name, S_IFREG | S_IRUGO | S_IWUSR,
|
||||
acpi_root_dir, &acpi_system_debug_proc_fops,
|
||||
(void *)1);
|
||||
if (!entry)
|
||||
goto Error;
|
||||
|
||||
Done:
|
||||
return error;
|
||||
|
||||
Error:
|
||||
remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LEVEL, acpi_root_dir);
|
||||
remove_proc_entry(ACPI_SYSTEM_FILE_DEBUG_LAYER, acpi_root_dir);
|
||||
error = -ENODEV;
|
||||
goto Done;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int __init acpi_debug_init(void)
|
||||
{
|
||||
acpi_debugfs_init();
|
||||
acpi_procfs_init();
|
||||
return 0;
|
||||
}
|
||||
93
drivers/acpi/debugfs.c
Normal file
93
drivers/acpi/debugfs.c
Normal file
@@ -0,0 +1,93 @@
|
||||
/*
|
||||
* debugfs.c - ACPI debugfs interface to userspace.
|
||||
*/
|
||||
|
||||
#include <linux/init.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <acpi/acpi_drivers.h>
|
||||
|
||||
#define _COMPONENT ACPI_SYSTEM_COMPONENT
|
||||
ACPI_MODULE_NAME("debugfs");
|
||||
|
||||
|
||||
/* /sys/modules/acpi/parameters/aml_debug_output */
|
||||
|
||||
module_param_named(aml_debug_output, acpi_gbl_enable_aml_debug_object,
|
||||
bool, 0644);
|
||||
MODULE_PARM_DESC(aml_debug_output,
|
||||
"To enable/disable the ACPI Debug Object output.");
|
||||
|
||||
/* /sys/kernel/debug/acpi/custom_method */
|
||||
|
||||
static ssize_t cm_write(struct file *file, const char __user * user_buf,
|
||||
size_t count, loff_t *ppos)
|
||||
{
|
||||
static char *buf;
|
||||
static int uncopied_bytes;
|
||||
struct acpi_table_header table;
|
||||
acpi_status status;
|
||||
|
||||
if (!(*ppos)) {
|
||||
/* parse the table header to get the table length */
|
||||
if (count <= sizeof(struct acpi_table_header))
|
||||
return -EINVAL;
|
||||
if (copy_from_user(&table, user_buf,
|
||||
sizeof(struct acpi_table_header)))
|
||||
return -EFAULT;
|
||||
uncopied_bytes = table.length;
|
||||
buf = kzalloc(uncopied_bytes, GFP_KERNEL);
|
||||
if (!buf)
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
if (uncopied_bytes < count) {
|
||||
kfree(buf);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (copy_from_user(buf + (*ppos), user_buf, count)) {
|
||||
kfree(buf);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
uncopied_bytes -= count;
|
||||
*ppos += count;
|
||||
|
||||
if (!uncopied_bytes) {
|
||||
status = acpi_install_method(buf);
|
||||
kfree(buf);
|
||||
if (ACPI_FAILURE(status))
|
||||
return -EINVAL;
|
||||
add_taint(TAINT_OVERRIDDEN_ACPI_TABLE);
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
static const struct file_operations cm_fops = {
|
||||
.write = cm_write,
|
||||
};
|
||||
|
||||
int __init acpi_debugfs_init(void)
|
||||
{
|
||||
struct dentry *acpi_dir, *cm_dentry;
|
||||
|
||||
acpi_dir = debugfs_create_dir("acpi", NULL);
|
||||
if (!acpi_dir)
|
||||
goto err;
|
||||
|
||||
cm_dentry = debugfs_create_file("custom_method", S_IWUGO,
|
||||
acpi_dir, NULL, &cm_fops);
|
||||
if (!cm_dentry)
|
||||
goto err;
|
||||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
if (acpi_dir)
|
||||
debugfs_remove(acpi_dir);
|
||||
return -EINVAL;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user