]> Joshua Wise's Git repositories - netwatch.git/blobdiff - ich2/smi.c
add a first cut at a SMI API -- not many features...
[netwatch.git] / ich2 / smi.c
diff --git a/ich2/smi.c b/ich2/smi.c
new file mode 100644 (file)
index 0000000..59f14b6
--- /dev/null
@@ -0,0 +1,27 @@
+#include <smi.h>
+#include <pci.h>
+#include <io.h>
+#include <stdint.h>
+
+uint16_t _get_PMBASE()
+{
+       return pci_read32(0, 0, 0, 0x40) & 0xFF80;
+}
+
+void smi_disable()
+{
+       unsigned short smi_en = _get_PMBASE() + 0x30;
+       outl(smi_en, inl(smi_en) & ~0x0001);
+}
+
+void smi_enable()
+{
+       unsigned short smi_en = _get_PMBASE() + 0x30;
+       outl(smi_en, inl(smi_en) | 0x0001);
+}
+
+unsigned long smi_status()
+{
+       unsigned short smi_sts = _get_PMBASE() + 0x34;
+       return inl(smi_sts);
+}
This page took 0.023093 seconds and 4 git commands to generate.