]> Joshua Wise's Git repositories - netwatch.git/commitdiff
Split reg-82801b out.
authorJoshua Wise <joshua@rebirth.joshuawise.com>
Sun, 21 Sep 2008 05:52:22 +0000 (01:52 -0400)
committerJoshua Wise <joshua@rebirth.joshuawise.com>
Sun, 21 Sep 2008 05:52:22 +0000 (01:52 -0400)
ich2/Makefile
ich2/smi.c
include/raw/stdarg.h [moved from include/stdarg.h with 100% similarity]
include/reg-82801b.h [new file with mode: 0644]
include/reg-82815.h [moved from ich2/reg-82815.h with 100% similarity]

index 2d908d9e7993931cb1b377bc7f6cb26cdc56fed6..d383a50acc95e3c25387e3c822e3d732f5ad7ef8 100644 (file)
@@ -1,5 +1,5 @@
 smram-ich2: smm-open-ich2.c
-       gcc -o smram-ich2 smm-open-ich2.c ../pci/pci-linux.c
+       gcc -o smram-ich2 smm-open-ich2.c ../pci/pci-linux.c -I../include
 
 clean:
        rm -f smram-ich2
index 3666a6c22cc1195f7b18abe4c3fa5e2b203fc6ba..6ca00c94618c30490006a6197455a78ff2951d35 100644 (file)
@@ -2,26 +2,27 @@
 #include <pci.h>
 #include <io.h>
 #include <stdint.h>
+#include <reg-82801b.h>
 
 uint16_t _get_PMBASE()
 {
-       return pci_read32(0, 31, 0, 0x40) & 0xFF80;
+       return pci_read32(ICH2_LPC_BUS, ICH2_LPC_DEV, ICH2_LPC_FN, ICH2_LPC_PCI_PMBASE) & ICH2_PMBASE_MASK;
 }
 
 void smi_disable()
 {
-       unsigned short smi_en = _get_PMBASE() + 0x30;
-       outl(smi_en, inl(smi_en) & ~0x0001);
+       unsigned short smi_en = _get_PMBASE() + ICH2_PMBASE_SMI_EN;
+       outl(smi_en, inl(smi_en) & ~ICH2_SMI_EN_GBL_SMI_EN);
 }
 
 void smi_enable()
 {
-       unsigned short smi_en = _get_PMBASE() + 0x30;
-       outl(smi_en, inl(smi_en) | 0x0001);
+       unsigned short smi_en = _get_PMBASE() + ICH2_PMBASE_SMI_EN;
+       outl(smi_en, inl(smi_en) | ICH2_SMI_EN_GBL_SMI_EN);
 }
 
 unsigned long smi_status()
 {
-       unsigned short smi_sts = _get_PMBASE() + 0x34;
+       unsigned short smi_sts = _get_PMBASE() + ICH2_PMBASE_SMI_STS;
        return inl(smi_sts);
 }
similarity index 100%
rename from include/stdarg.h
rename to include/raw/stdarg.h
diff --git a/include/reg-82801b.h b/include/reg-82801b.h
new file mode 100644 (file)
index 0000000..ca7e3b5
--- /dev/null
@@ -0,0 +1,85 @@
+#ifndef _REG_82801B_H
+#define _REG_82801B_H
+
+#define ICH2_PCI_BRIDGE_BUS            0
+#define ICH2_PCI_BRIDGE_DEV            30
+#define ICH2_PCI_BRIDGE_FN             0
+
+#define ICH2_NIC_BUS                   1
+#define ICH2_NIC_DEV                   8
+#define ICH2_NIC_FN                    0
+
+#define ICH2_LPC_BUS                   0
+#define ICH2_LPC_DEV                   31
+#define ICH2_LPC_FN                    0
+
+#define ICH2_LPC_PCI_PMBASE            0x40
+#define ICH2_PMBASE_MASK               0xFF80
+#define ICH2_LPC_PCI_ACPI_CTRL         0x44
+#define ICH2_LPC_PCI_GPIOBASE          0x58
+#define ICH2_LPC_PCI_GPIO_CNTL         0x5C
+#define ICH2_LPC_PCI_GEN_PMCON1                0xA0
+#define ICH2_LPC_PCI_GEN_PMCON2                0xA2
+#define ICH2_LPC_PCI_GEN_PMCON3                0xA4
+#define ICH2_LPC_PCI_GPI_ROUT          0xB8
+#define ICH2_LPC_PCI_TRP_FWD_EN                0xC0
+#define ICH2_LPC_PCI_MON4_TRP_RNG      0xC4
+#define ICH2_LPC_PCI_MON5_TRP_RNG      0xC6
+#define ICH2_LPC_PCI_MON6_TRP_RNG      0xC8
+#define ICH2_LPC_PCI_MON7_TRP_RNG      0xCA
+#define ICH2_LPC_PCI_MON_TRP_MSK       0xCC
+
+#define ICH2_PMBASE_SMI_EN             0x30
+#define ICH2_SMI_EN_PERIODIC_EN                (1 << 14)
+#define ICH2_SMI_EN_TCO_EN             (1 << 13)
+#define ICH2_SMI_EN_MCSMI_EN           (1 << 11)
+#define ICH2_SMI_EN_BIOS_RLS           (1 << 7)
+#define ICH2_SMI_EN_SWSMI_TMR_EN       (1 << 6)
+#define ICH2_SMI_EN_APMC_EN            (1 << 5)
+#define ICH2_SMI_EN_SLP_SMI_EN         (1 << 4)
+#define ICH2_SMI_EN_LEGACY_USB_EN      (1 << 3)
+#define ICH2_SMI_EN_BIOS_EN            (1 << 2)
+#define ICH2_SMI_EN_EOS                        (1 << 1)
+#define ICH2_SMI_EN_GBL_SMI_EN         (1 << 0)
+
+#define ICH2_PMBASE_SMI_STS            0x34
+#define ICH2_SMI_STS_SMBUS_SMI_STS     (1 << 16)
+#define ICH2_SMI_STS_SERIRQ_SMI_STS    (1 << 15)
+#define ICH2_SMI_STS_PERIODIC_STS      (1 << 14)
+#define ICH2_SMI_STS_TCO_STS           (1 << 13)
+#define ICH2_SMI_STS_DEVMON_STS                (1 << 12)
+#define ICH2_SMI_STS_MCSMI_STS         (1 << 11)
+#define ICH2_SMI_STS_GPE1_STS          (1 << 10)
+#define ICH2_SMI_STS_GPE0_STS          (1 << 9)
+#define ICH2_SMI_STS_PM1_STS_REG       (1 << 8)
+#define ICH2_SMI_STS_SWSMI_TMR_STS     (1 << 6)
+#define ICH2_SMI_STS_APM_STS           (1 << 5)
+#define ICH2_SMI_STS_SLP_SMI_STS       (1 << 4)
+#define ICH2_SMI_STS_LEGACY_USB_STS    (1 << 3)
+#define ICH2_SMI_STS_BIOS_STS          (1 << 2)
+
+#define ICH2_IDE_BUS                   0
+#define ICH2_IDE_DEV                   31
+#define ICH2_IDE_FN                    1
+
+#define ICH2_USB0_BUS                  0
+#define ICH2_USB0_DEV                  31
+#define ICH2_USB0_FN                   2
+
+#define ICH2_USB1_BUS                  0
+#define ICH2_USB1_DEV                  31
+#define ICH2_USB1_FN                   4
+
+#define ICH2_SMBUS_BUS                 0
+#define ICH2_SMBUS_DEV                 31
+#define ICH2_SMBUS_FN                  3
+
+#define ICH2_AC97AUD_BUS               0
+#define ICH2_AC97AUD_DEV               31
+#define ICH2_AC97AUD_FN                        5
+
+#define ICH2_AC97MOD_BUS               0
+#define ICH2_AC97MOD_DEV               31
+#define ICH2_AC97MOD_FN                        6
+
+#endif
similarity index 100%
rename from ich2/reg-82815.h
rename to include/reg-82815.h
This page took 0.031954 seconds and 4 git commands to generate.