From: Joshua Wise Date: Thu, 8 Oct 2009 13:56:00 +0000 (-0400) Subject: Merge branch 'master' of git@github.com:jwise/netwatch X-Git-Url: http://git.joshuawise.com/netwatch.git/commitdiff_plain/a6327524107e76c689841eda10fbc19030b4cd15?hp=4753ffd55e1ec5906f80fa4728354d6873ea8f1f Merge branch 'master' of git@github.com:jwise/netwatch --- diff --git a/ich2/smi.c b/ich2/smi.c index c9a1f0e..8865eab 100644 --- a/ich2/smi.c +++ b/ich2/smi.c @@ -101,7 +101,10 @@ void smi_poll() if (pm1_sts & ICH2_PM1_STS_PWRBTN_STS) { - output("Unhandled: PM1_STS: PWRBTN_STS"); + if (_handlers[SMI_EVENT_PWRBTN] == SMI_HANDLER_NONE) + output("Unhandled: PM1_STS: PWRBTN_STS"); + else if (_handlers[SMI_EVENT_FAST_TIMER] != SMI_HANDLER_IGNORE) + _handlers[SMI_EVENT_PWRBTN](SMI_EVENT_PWRBTN); outw(_get_PMBASE() + ICH2_PMBASE_PM1_STS, ICH2_PM1_STS_PWRBTN_STS); } @@ -224,6 +227,11 @@ int smi_enable_event(smi_event_t ev) inl(_get_PMBASE() + ICH2_PMBASE_SMI_EN) | ICH2_SMI_EN_BIOS_EN); return 0; + case SMI_EVENT_PWRBTN: + outl(_get_PMBASE() + ICH2_PMBASE_PM1_EN, + inl(_get_PMBASE() + ICH2_PMBASE_PM1_EN) | + ICH2_PM1_EN_PWRBTN_EN); + return 0; default: return -1; } @@ -248,6 +256,11 @@ int smi_disable_event(smi_event_t ev) inl(_get_PMBASE() + ICH2_PMBASE_SMI_EN) & ~ICH2_SMI_EN_BIOS_EN); return 0; + case SMI_EVENT_PWRBTN: + outl(_get_PMBASE() + ICH2_PMBASE_PM1_EN, + inl(_get_PMBASE() + ICH2_PMBASE_PM1_EN) & + ~ICH2_PM1_EN_PWRBTN_EN); + return 0; default: return -1; } diff --git a/include/smi.h b/include/smi.h index a5dad92..5cc7a44 100644 --- a/include/smi.h +++ b/include/smi.h @@ -21,6 +21,7 @@ typedef enum { SMI_EVENT_FAST_TIMER = 0, SMI_EVENT_DEVTRAP_KBC, SMI_EVENT_GBL_RLS, + SMI_EVENT_PWRBTN, SMI_EVENT_MAX } smi_event_t;