X-Git-Url: http://git.joshuawise.com/netwatch.git/blobdiff_plain/73fb9b4cd8d1b1722077985594e50dd38893ca5f..b83b409494b6aedcbcb0548665b8edebba19b43e:/ich2/smi.c diff --git a/ich2/smi.c b/ich2/smi.c index 7f96421..8865eab 100644 --- a/ich2/smi.c +++ b/ich2/smi.c @@ -1,3 +1,14 @@ +/* smi.c + * System management interrupt dispatch routines for ICH2 southbridge + * NetWatch system management mode administration console + * + * Copyright (c) 2008 Jacob Potter and Joshua Wise. All rights reserved. + * This program is free software; you can redistribute and/or modify it under + * the terms found in the file LICENSE in the root of this source tree. + * + */ + + #include #include #include @@ -90,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); } @@ -213,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; } @@ -237,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; }