]> Joshua Wise's Git repositories - netwatch.git/blobdiff - ich2/smi.c
Move much more logic out into smi.c again.
[netwatch.git] / ich2 / smi.c
index 08fcc64d4263d38713a37db79675d9d4ad2b7e4d..92607c42e0da3de3466da1d7bee70f5aef71dd42 100644 (file)
@@ -2,6 +2,7 @@
 #include <pci.h>
 #include <io.h>
 #include <stdint.h>
+#include <vga-overlay.h>
 #include <reg-82801b.h>
 
 uint16_t _get_PMBASE()
@@ -27,3 +28,94 @@ unsigned long smi_status()
        return inl(smi_sts);
 }
 
+void smi_poll()
+{
+       unsigned long sts = smi_status();
+       
+       if (sts & ICH2_SMI_STS_BIOS_STS)
+       {
+               dolog("Unhandled: BIOS_STS");
+               outl(_get_PMBASE() + ICH2_PMBASE_SMI_STS, ICH2_SMI_STS_BIOS_STS);
+       }
+       
+       if (sts & ICH2_SMI_STS_LEGACY_USB_STS)
+       {
+               dolog("Unhandled: LEGACY_USB_STS");
+               outl(_get_PMBASE() + ICH2_PMBASE_SMI_STS, ICH2_SMI_STS_LEGACY_USB_STS);
+       }
+       
+       if (sts & ICH2_SMI_STS_SLP_SMI_STS)
+       {
+               dolog("Unhandled: SLP_SMI_STS");
+               outl(_get_PMBASE() + ICH2_PMBASE_SMI_STS, ICH2_SMI_STS_SLP_SMI_STS);
+       }
+       
+       if (sts & ICH2_SMI_STS_APM_STS)
+       {
+               dolog("Unhandled: APM_STS");
+               outl(_get_PMBASE() + ICH2_PMBASE_SMI_STS, ICH2_SMI_STS_SLP_SMI_STS);
+       }
+       
+       if (sts & ICH2_SMI_STS_SWSMI_TMR_STS)   // Ack it, then request another.
+       {
+               outl(_get_PMBASE() + ICH2_PMBASE_SMI_STS, ICH2_SMI_STS_SLP_SMI_STS);
+               outl(_get_PMBASE() + ICH2_PMBASE_SMI_EN,
+                       inl(_get_PMBASE() + ICH2_PMBASE_SMI_EN) & ~ICH2_SMI_EN_SWSMI_TMR_EN);
+               outl(_get_PMBASE() + ICH2_PMBASE_SMI_EN,
+                       inl(_get_PMBASE() + ICH2_PMBASE_SMI_EN) | ICH2_SMI_EN_SWSMI_TMR_EN);
+       }
+       
+       if (sts & ICH2_SMI_STS_PM1_STS_REG)
+       {
+               /* XXX -- trawl through PMBASE+00h to see what happened */
+       }
+       
+       if (sts & ICH2_SMI_STS_GPE0_STS)
+       {
+               /* XXX -- trawl through GPE0_STS to see what happened */
+       }
+       
+       if (sts & ICH2_SMI_STS_MCSMI_STS)
+       {
+               dolog("Unhandled: MCSMI_STS");
+               outl(_get_PMBASE() + ICH2_PMBASE_SMI_STS, ICH2_SMI_STS_MCSMI_STS);
+       }
+       
+       if (sts & ICH2_SMI_STS_DEVMON_STS)
+       {
+               /* XXX -- trawl through DEVx_TRAP_STS to see what happened */
+               /* XXX -- trawl through DEVTRAP_STS to see what happened */
+       }
+       
+       if (sts & ICH2_SMI_STS_TCO_STS)
+       {
+               dolog("Unhandled: TCO_STS");
+               outl(_get_PMBASE() + ICH2_PMBASE_SMI_STS, ICH2_SMI_STS_TCO_STS);
+       }
+       
+       if (sts & ICH2_SMI_STS_PERIODIC_STS)
+       {
+               dolog("Unhandled: PERIODIC_STS");
+               outl(_get_PMBASE() + ICH2_PMBASE_SMI_STS, ICH2_SMI_STS_PERIODIC_STS);
+       }
+       
+       if (sts & ICH2_SMI_STS_SERIRQ_SMI_STS)
+       {
+               dolog("Unhandled: SERIRQ_SMI_STS");
+               outl(_get_PMBASE() + ICH2_PMBASE_SMI_STS, ICH2_SMI_STS_SERIRQ_SMI_STS);
+       }
+       
+       if (sts & ICH2_SMI_STS_SMBUS_SMI_STS)
+       {
+               dolog("Unhandled: SMBUS_SMI_STS");
+               outl(_get_PMBASE() + ICH2_PMBASE_SMI_STS, ICH2_SMI_STS_SMBUS_SMI_STS);
+       }
+       
+       if (smi_status())
+               dolog("WARNING: failed to clear SMI_STS!");
+       
+       outl(_get_PMBASE() + ICH2_PMBASE_SMI_EN,
+               inl(_get_PMBASE() + ICH2_PMBASE_SMI_EN) |
+                       ICH2_SMI_EN_EOS |
+                       ICH2_SMI_EN_GBL_SMI_EN);
+}
This page took 0.02761 seconds and 4 git commands to generate.