[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/7] seabios: smm_init: move out i440fx smram operat
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH 4/7] seabios: smm_init: move out i440fx smram operation into dev-i440fx.c |
Date: |
Mon, 12 Jul 2010 20:47:49 +0900 |
move out i440fx smram operation into dev-i440fx.c.
Signed-off-by: Isaku Yamahata <address@hidden>
---
src/dev-i440fx.c | 8 ++++++++
src/dev-i440fx.h | 1 +
src/post.h | 5 +++++
src/smm.c | 17 ++++++++++++-----
4 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/src/dev-i440fx.c b/src/dev-i440fx.c
index 17d42ce..c9e0c3e 100644
--- a/src/dev-i440fx.c
+++ b/src/dev-i440fx.c
@@ -26,6 +26,14 @@ void i440fx_shadow_detected(u16 bdf, void *arg)
pam_regs->pam0 = I440FX_PAM0;
}
+#define I440FX_SMRAM 0x72
+
+void i440fx_smram_detected(u16 bdf, void *arg)
+{
+ struct smram_regs *smram_regs = arg;
+ smram_regs->smram = I440FX_SMRAM;
+}
+
/* PIIX3/PIIX4 PCI to ISA bridge */
void piix_isa_bridge_init(u16 bdf, void *arg)
{
diff --git a/src/dev-i440fx.h b/src/dev-i440fx.h
index 934e7f2..6250c5e 100644
--- a/src/dev-i440fx.h
+++ b/src/dev-i440fx.h
@@ -4,6 +4,7 @@
#include "types.h" // u16
void i440fx_shadow_detected(u16 bdf, void *arg);
+void i440fx_smram_detected(u16 bdf, void *arg);
void piix_isa_bridge_init(u16 bdf, void *arg);
void piix_ide_init(u16 bdf, void *arg);
void piix4_pm_init(u16 bdf, void *arg);
diff --git a/src/post.h b/src/post.h
index 2996878..c82ee8f 100644
--- a/src/post.h
+++ b/src/post.h
@@ -16,4 +16,9 @@ struct apmc_ops
void (*enable)(u16 bdf);
};
+struct smram_regs
+{
+ u32 smram;
+};
+
#endif /* __POST_H */
diff --git a/src/smm.c b/src/smm.c
index baa272f..4518d95 100644
--- a/src/smm.c
+++ b/src/smm.c
@@ -81,6 +81,13 @@ static const struct pci_device_id apmc_ops_tbl[] = {
PCI_DEVICE_END,
};
+static const struct pci_device_id smram_tbl[] = {
+ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82441,
+ i440fx_smram_detected),
+
+ PCI_DEVICE_END,
+};
+
void
smm_init(void)
{
@@ -98,9 +105,9 @@ smm_init(void)
if (bdf < 0)
// Device not found
return;
- int i440_bdf = pci_find_device(PCI_VENDOR_ID_INTEL
- , PCI_DEVICE_ID_INTEL_82441);
- if (i440_bdf < 0)
+ struct smram_regs smram_regs;
+ int smram_bdf = pci_find_init_device(smram_tbl, &smram_regs);
+ if (smram_bdf < 0)
return;
/* check if SMM init is already done */
@@ -108,7 +115,7 @@ smm_init(void)
return;
/* enable the SMM memory window */
- pci_config_writeb(i440_bdf, 0x72, 0x02 | 0x48);
+ pci_config_writeb(smram_bdf, smram_regs.smram, 0x02 | 0x48);
/* save original memory content */
memcpy((void *)BUILD_SMM_ADDR, (void *)BUILD_SMM_INIT_ADDR,
BUILD_SMM_SIZE);
@@ -139,5 +146,5 @@ smm_init(void)
wbinvd();
/* close the SMM memory window and enable normal SMM */
- pci_config_writeb(i440_bdf, 0x72, 0x02 | 0x08);
+ pci_config_writeb(smram_bdf, smram_regs.smram, 0x02 | 0x08);
}
--
1.7.1.1
- [Qemu-devel] [PATCH 0/7] abstract chipset(i440fx) specific register operation., Isaku Yamahata, 2010/07/12
- [Qemu-devel] [PATCH 3/7] seabios: smm: move out piix4 specific logic to dev-i440fx.c, Isaku Yamahata, 2010/07/12
- [Qemu-devel] [PATCH 5/7] seabios: acpi: move acpi definitions to acpi.h from acpi.c, Isaku Yamahata, 2010/07/12
- [Qemu-devel] [PATCH 1/7] seabios: pci: introduce helper function to find device from table and initialize it., Isaku Yamahata, 2010/07/12
- [Qemu-devel] [PATCH 7/7] seabios: acpi: clean up of finding pm device., Isaku Yamahata, 2010/07/12
- [Qemu-devel] [PATCH 4/7] seabios: smm_init: move out i440fx smram operation into dev-i440fx.c,
Isaku Yamahata <=
- [Qemu-devel] [PATCH 6/7] seabios: acpi: split out piix4 pm logic., Isaku Yamahata, 2010/07/12
- [Qemu-devel] Re: [SeaBIOS] [PATCH 0/7] abstract chipset(i440fx) specific register operation., Kevin O'Connor, 2010/07/12