[coreboot-gerrit] Patch set updated for coreboot: 975689c hp/pavilion_m6_1035dx: Shutdown when lid is closed on non-ACPI OS

Alexandru Gagniuc (mr.nuke.me@gmail.com) gerrit at coreboot.org
Fri Apr 18 19:11:32 CEST 2014


Alexandru Gagniuc (mr.nuke.me at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/171

-gerrit

commit 975689c1fe1d3bdee1a598f09b45444f96d00c1d
Author: Alexandru Gagniuc <mr.nuke.me at gmail.com>
Date:   Thu Apr 17 23:41:19 2014 -0500

    hp/pavilion_m6_1035dx: Shutdown when lid is closed on non-ACPI OS
    
    This is handled by generating an SMI when GEVENT22 goes low. This pin
    is driven by the EC when the lid opens or closes. This SMI is
    disabled when switching to ACPI mode, so ACPI OSes are not affected.
    
    Change-Id: I38193572bf0416fd642002dba94c19257f0f6f5b
    Signed-off-by: Alexandru Gagniuc <mr.nuke.me at gmail.com>
---
 src/mainboard/hp/pavilion_m6_1035dx/ec.h            |  1 +
 src/mainboard/hp/pavilion_m6_1035dx/mainboard.c     |  1 +
 src/mainboard/hp/pavilion_m6_1035dx/mainboard_smi.c | 12 ++++++++++++
 3 files changed, 14 insertions(+)

diff --git a/src/mainboard/hp/pavilion_m6_1035dx/ec.h b/src/mainboard/hp/pavilion_m6_1035dx/ec.h
index 579bf7e..7eb4d06 100644
--- a/src/mainboard/hp/pavilion_m6_1035dx/ec.h
+++ b/src/mainboard/hp/pavilion_m6_1035dx/ec.h
@@ -7,6 +7,7 @@
 #define _MAINBOARD_HP_PAVILION_M6_1035DX_EC_H
 
 #define EC_SMI_GEVENT		23
+#define EC_LID_GEVENT		22
 
 #ifndef __SMM__
 void pavilion_m6_1035dx_ec_init(void);
diff --git a/src/mainboard/hp/pavilion_m6_1035dx/mainboard.c b/src/mainboard/hp/pavilion_m6_1035dx/mainboard.c
index ccabaf2..2e8436b 100644
--- a/src/mainboard/hp/pavilion_m6_1035dx/mainboard.c
+++ b/src/mainboard/hp/pavilion_m6_1035dx/mainboard.c
@@ -42,6 +42,7 @@ static void mainboard_enable(device_t dev)
 	pavilion_m6_1035dx_ec_init();
 
 	hudson_configure_gevent_smi(EC_SMI_GEVENT, SMI_MODE_SMI, SMI_LVL_HIGH);
+	hudson_configure_gevent_smi(EC_LID_GEVENT, SMI_MODE_SMI, SMI_LVL_LOW);
 	hudson_enable_smi_generation();
 
 	/*
diff --git a/src/mainboard/hp/pavilion_m6_1035dx/mainboard_smi.c b/src/mainboard/hp/pavilion_m6_1035dx/mainboard_smi.c
index f911443..386d390 100644
--- a/src/mainboard/hp/pavilion_m6_1035dx/mainboard_smi.c
+++ b/src/mainboard/hp/pavilion_m6_1035dx/mainboard_smi.c
@@ -12,6 +12,7 @@
 #include <delay.h>
 #include <ec/compal/ene932/ec.h>
 #include <southbridge/amd/agesa/hudson/hudson.h>
+#include <southbridge/amd/agesa/hudson/smi.h>
 
 #define ACPI_PM1_CNT_SLEEP(state) ((1 << 13) | (state & 0x7) << 10)
 
@@ -71,16 +72,25 @@ static void handle_ec_smi(void)
 		ec_process_smi(src);
 }
 
+static void handle_lid_smi(void)
+{
+	/* Only triggered in non-ACPI mode on lid close. */
+	outl(ACPI_PM1_CNT_SLEEP(S4), ACPI_PM1_CNT_BLK);
+}
+
 int mainboard_smi_apmc(uint8_t data)
 {
 	switch (data) {
 	case ACPI_SMI_CMD_ENABLE:
 		printk(BIOS_DEBUG, "Enable ACPI mode\n");
 		ec_enter_acpi_mode();
+		hudson_disable_gevent_smi(EC_LID_GEVENT);
 		break;
 	case ACPI_SMI_CMD_DISABLE:
 		printk(BIOS_DEBUG, "Disable ACPI mode\n");
 		ec_enter_apm_mode();
+		hudson_configure_gevent_smi(EC_LID_GEVENT, SMI_MODE_SMI,
+					    SMI_LVL_LOW);
 		break;
 	default:
 		printk(BIOS_DEBUG, "Unhandled ACPI command: 0x%x\n", data);
@@ -92,4 +102,6 @@ void mainboard_smi_gpi(uint32_t gpi_sts)
 {
 	if (gpi_sts & (1 << EC_SMI_GEVENT))
 		handle_ec_smi();
+	if (gpi_sts & (1 << EC_LID_GEVENT))
+		handle_lid_smi();
 }



More information about the coreboot-gerrit mailing list