]> Joshua Wise's Git repositories - netwatch.git/commitdiff
Integrate the KBC trap into smi.h.
authorJoshua Wise <joshua@rebirth.joshuawise.com>
Fri, 26 Sep 2008 01:19:25 +0000 (21:19 -0400)
committerJoshua Wise <joshua@rebirth.joshuawise.com>
Fri, 26 Sep 2008 01:19:25 +0000 (21:19 -0400)
aseg/counter.c
aseg/firstrun.c
ich2/smi.c
include/smi.h

index 85b73eba3c98a10ced98c329cb7ae8bf54cd64d1..3c22c0545d4e2d96aa798742daebcd456332a453 100644 (file)
@@ -60,6 +60,11 @@ void timer_handler(smi_event_t ev)
        outlog();
 }
 
        outlog();
 }
 
+void kbc_handler(smi_event_t ev)
+{
+       pci_dump();
+}
+
 void smi_entry(void)
 {
        char statstr[512];
 void smi_entry(void)
 {
        char statstr[512];
@@ -71,14 +76,6 @@ void smi_entry(void)
        sprintf(statstr, "15-412! %08x %08x", smi_status(), counter);
        strblit(statstr, 0, 0);
        
        sprintf(statstr, "15-412! %08x %08x", smi_status(), counter);
        strblit(statstr, 0, 0);
        
-       if (inl(0x834) & 0x1000)
-       {
-               if (inl(0x844) & 0x1000)        /* devact_sts */
-               {
-                       pci_dump();
-                       outl(0x844, 0x1000);    /* ack it */
-               }
-       }
        if (inl(0x840) & 0x1000)
        {
                pci_dump();
        if (inl(0x840) & 0x1000)
        {
                pci_dump();
index 323f1ab751f0f3c825379dbf92104e2af85f4d34..ec09a8218ecb07a2748f16b085b1b41ced594f08 100644 (file)
@@ -8,6 +8,7 @@
 extern int _bss, _bssend;
 
 extern void timer_handler(smi_event_t ev);
 extern int _bss, _bssend;
 
 extern void timer_handler(smi_event_t ev);
+extern void kbc_handler(smi_event_t ev);
 
 void __firstrun_start() {
        unsigned char *bp;
 
 void __firstrun_start() {
        unsigned char *bp;
@@ -29,9 +30,13 @@ void __firstrun_start() {
 
        /* Turn on the SMIs we want */
        smi_disable();
 
        /* Turn on the SMIs we want */
        smi_disable();
+       
        smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
        smi_enable_event(SMI_EVENT_FAST_TIMER);
        smi_register_handler(SMI_EVENT_FAST_TIMER, timer_handler);
        smi_enable_event(SMI_EVENT_FAST_TIMER);
-       outb(0x848, ICH2_DEVTRAP_EN_KBC_TRP_EN);
+       
+       smi_register_handler(SMI_EVENT_DEVTRAP_KBC, kbc_handler);
+       smi_enable_event(SMI_EVENT_DEVTRAP_KBC);
+
        smi_enable();
        
        smram_restore_state(smram);
        smi_enable();
        
        smram_restore_state(smram);
index d255615fbc9439db215e659f613a437e84759c70..0a0ddf47cf45e23d23fe9a2b80e43b64d3639aa0 100644 (file)
@@ -129,6 +129,21 @@ void smi_poll()
                unsigned short mon_smi = inw(_get_PMBASE() + ICH2_PMBASE_MON_SMI);
                unsigned long devact_sts = inl(_get_PMBASE() + ICH2_PMBASE_DEVACT_STS);
                unsigned long devtrap_en = inl(_get_PMBASE() + ICH2_PMBASE_DEVTRAP_EN);
                unsigned short mon_smi = inw(_get_PMBASE() + ICH2_PMBASE_MON_SMI);
                unsigned long devact_sts = inl(_get_PMBASE() + ICH2_PMBASE_DEVACT_STS);
                unsigned long devtrap_en = inl(_get_PMBASE() + ICH2_PMBASE_DEVTRAP_EN);
+               
+               if (devact_sts & ICH2_DEVACT_STS_KBC_ACT_STS)
+               {
+                       if (_handlers[SMI_EVENT_DEVTRAP_KBC] == SMI_HANDLER_NONE)
+                               output("Unhandled: DEVACT_KBC_ACT_STS");
+                       else if (_handlers[SMI_EVENT_DEVTRAP_KBC] != SMI_HANDLER_IGNORE)
+                               _handlers[SMI_EVENT_DEVTRAP_KBC](SMI_EVENT_DEVTRAP_KBC);
+                       outl(_get_PMBASE() + ICH2_PMBASE_DEVACT_STS, ICH2_DEVACT_STS_KBC_ACT_STS);
+               }
+               
+               /* Refresh register cache so that we can print unhandleds as needed. */
+               mon_smi = inw(_get_PMBASE() + ICH2_PMBASE_MON_SMI);
+               devact_sts = inl(_get_PMBASE() + ICH2_PMBASE_DEVACT_STS);
+               devtrap_en = inl(_get_PMBASE() + ICH2_PMBASE_DEVTRAP_EN);
+               
                if (((mon_smi & 0x0F00) >> 8) & ((mon_smi & 0xF000) >> 12))
                        outputf("Unhandled: MON_SMI (%04x)", mon_smi);
                if (devact_sts & devtrap_en)
                if (((mon_smi & 0x0F00) >> 8) & ((mon_smi & 0xF000) >> 12))
                        outputf("Unhandled: MON_SMI (%04x)", mon_smi);
                if (devact_sts & devtrap_en)
@@ -185,6 +200,11 @@ int smi_enable_event(smi_event_t ev)
                        inl(_get_PMBASE() + ICH2_PMBASE_SMI_EN) |
                                ICH2_SMI_EN_SWSMI_TMR_EN);
                return 0;
                        inl(_get_PMBASE() + ICH2_PMBASE_SMI_EN) |
                                ICH2_SMI_EN_SWSMI_TMR_EN);
                return 0;
+       case SMI_EVENT_DEVTRAP_KBC:
+               outl(_get_PMBASE() + ICH2_PMBASE_DEVTRAP_EN,
+                       inl(_get_PMBASE() + ICH2_PMBASE_DEVTRAP_EN) |
+                               ICH2_DEVTRAP_EN_KBC_TRP_EN);
+               return 0;
        default:
                return -1;
        }
        default:
                return -1;
        }
@@ -199,6 +219,11 @@ int smi_disable_event(smi_event_t ev)
                        inl(_get_PMBASE() + ICH2_PMBASE_SMI_EN) &
                                ~ICH2_SMI_EN_SWSMI_TMR_EN);
                return 0;
                        inl(_get_PMBASE() + ICH2_PMBASE_SMI_EN) &
                                ~ICH2_SMI_EN_SWSMI_TMR_EN);
                return 0;
+       case SMI_EVENT_DEVTRAP_KBC:
+               outl(_get_PMBASE() + ICH2_PMBASE_DEVTRAP_EN,
+                       inl(_get_PMBASE() + ICH2_PMBASE_DEVTRAP_EN) &
+                               ~ICH2_DEVTRAP_EN_KBC_TRP_EN);
+               return 0;
        default:
                return -1;
        }
        default:
                return -1;
        }
index 670dc63eaf7968e501bb8a9bee2384ae2020e1f7..e0fd0a06b04b382cc5f94eec05d967c8ba2b8748 100644 (file)
@@ -9,6 +9,7 @@ extern unsigned long smi_status();      /* Architecturally defined; for debugging onl
 
 typedef enum {
        SMI_EVENT_FAST_TIMER = 0,
 
 typedef enum {
        SMI_EVENT_FAST_TIMER = 0,
+       SMI_EVENT_DEVTRAP_KBC,
        SMI_EVENT_MAX
 } smi_event_t;
 
        SMI_EVENT_MAX
 } smi_event_t;
 
This page took 0.033806 seconds and 4 git commands to generate.