]> Joshua Wise's Git repositories - netwatch.git/commitdiff
Add support for the power button SMI.
authorJoshua Wise <joshua@escape.wv.cc.cmu.edu>
Thu, 8 Oct 2009 13:38:31 +0000 (09:38 -0400)
committerJoshua Wise <joshua@escape.wv.cc.cmu.edu>
Thu, 8 Oct 2009 13:38:31 +0000 (09:38 -0400)
ich2/smi.c
include/smi.h

index c9a1f0e8292592691b8d3cac423b44062b04e8d9..8865eab944ad2e51ccc6b6dbc94a7ee7bf6ef615 100644 (file)
@@ -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;
        }
index a5dad922e1ba47a284619641c9e6aa0a21f59e43..5cc7a44da85163ad659b62d296ccf88908e9ae88 100644 (file)
@@ -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;
 
This page took 0.029236 seconds and 4 git commands to generate.