Skip to content

Commit 2cbf475

Browse files
rbbrnsTzung-Bi Shih
authored andcommitted
platform/chrome: cros_ec: Report EC panic as uevent
Create a uevent when an EC panic is detected. This will allow udev rules to trigger when a panic occurs. For example, a udev rule could be added to capture an EC coredump. This approach avoids the need to stuff all the processing into the driver. Signed-off-by: Rob Barnes <[email protected]> Reviewed-by: Prashant Malani <[email protected]> Signed-off-by: Tzung-Bi Shih <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c9f9c6c commit 2cbf475

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

drivers/platform/chrome/cros_ec_lpc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/delay.h>
1717
#include <linux/io.h>
1818
#include <linux/interrupt.h>
19+
#include <linux/kobject.h>
1920
#include <linux/module.h>
2021
#include <linux/platform_data/cros_ec_commands.h>
2122
#include <linux/platform_data/cros_ec_proto.h>
@@ -315,6 +316,7 @@ static int cros_ec_lpc_readmem(struct cros_ec_device *ec, unsigned int offset,
315316

316317
static void cros_ec_lpc_acpi_notify(acpi_handle device, u32 value, void *data)
317318
{
319+
static const char *env[] = { "ERROR=PANIC", NULL };
318320
struct cros_ec_device *ec_dev = data;
319321
bool ec_has_more_events;
320322
int ret;
@@ -324,6 +326,7 @@ static void cros_ec_lpc_acpi_notify(acpi_handle device, u32 value, void *data)
324326
if (value == ACPI_NOTIFY_CROS_EC_PANIC) {
325327
dev_emerg(ec_dev->dev, "CrOS EC Panic Reported. Shutdown is imminent!");
326328
blocking_notifier_call_chain(&ec_dev->panic_notifier, 0, ec_dev);
329+
kobject_uevent_env(&ec_dev->dev->kobj, KOBJ_CHANGE, (char **)env);
327330
/* Begin orderly shutdown. Force shutdown after 1 second. */
328331
hw_protection_shutdown("CrOS EC Panic", 1000);
329332
/* Do not query for other events after a panic is reported */

0 commit comments

Comments
 (0)