[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH V12 07/27] pc, i440fx: Make smm enable/disable funct
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH V12 07/27] pc, i440fx: Make smm enable/disable function i440fx independent. |
Date: |
Wed, 6 Jan 2010 11:39:31 +0900 |
make cpu_smm_update() generic to be independent on i440fx by
registering a callback.
Signed-off-by: Isaku Yamahata <address@hidden>
Acked-by: Gerd Hoffmann <address@hidden>
---
hw/pc.c | 18 +++++++++++++++---
hw/pc.h | 8 +++++++-
hw/piix_pci.c | 5 ++++-
3 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index fbacc1e..cdd9de6 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -67,7 +67,6 @@
static fdctrl_t *floppy_controller;
static RTCState *rtc_state;
static PITState *pit;
-static PCII440FXState *i440fx_state;
typedef struct isa_irq_state {
qemu_irq *i8259;
@@ -109,10 +108,22 @@ uint64_t cpu_get_tsc(CPUX86State *env)
}
/* SMM support */
+
+static cpu_set_smm_t smm_set;
+static void *smm_arg;
+
+void cpu_smm_register(cpu_set_smm_t callback, void *arg)
+{
+ assert(smm_set == NULL);
+ assert(smm_arg == NULL);
+ smm_set = callback;
+ smm_arg = arg;
+}
+
void cpu_smm_update(CPUState *env)
{
- if (i440fx_state && env == first_cpu)
- i440fx_set_smm(i440fx_state, (env->hflags >> HF_SMM_SHIFT) & 1);
+ if (smm_set && smm_arg && env == first_cpu)
+ smm_set(!!(env->hflags & HF_SMM_MASK), smm_arg);
}
@@ -996,6 +1007,7 @@ static void pc_init1(ram_addr_t ram_size,
int bios_size, isa_bios_size;
PCIBus *pci_bus;
ISADevice *isa_dev;
+ PCII440FXState *i440fx_state;
int piix3_devfn = -1;
CPUState *env;
qemu_irq *cpu_irq;
diff --git a/hw/pc.h b/hw/pc.h
index 03ffc91..cbecc07 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -94,6 +94,13 @@ extern int fd_bootchk;
void ioport_set_a20(int enable);
int ioport_get_a20(void);
+typedef void (*cpu_set_smm_t)(int smm, void *arg);
+#if defined(TARGET_I386)
+void cpu_smm_register(cpu_set_smm_t callback, void *arg);
+#else
+static inline void cpu_smm_register(cpu_set_smm_t callback, void *arg) { };
+#endif
+
/* acpi.c */
extern int acpi_enabled;
extern char *acpi_tables;
@@ -120,7 +127,6 @@ struct PCII440FXState;
typedef struct PCII440FXState PCII440FXState;
PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq
*pic);
-void i440fx_set_smm(PCII440FXState *d, int val);
void i440fx_init_memory_mappings(PCII440FXState *d);
/* piix4.c */
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index 1b67475..ff689a3 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -104,8 +104,10 @@ static void i440fx_update_memory_mappings(PCII440FXState
*d)
}
}
-void i440fx_set_smm(PCII440FXState *d, int val)
+static void i440fx_set_smm(int val, void *arg)
{
+ PCII440FXState *d = arg;
+
val = (val != 0);
if (d->smm_enabled != val) {
d->smm_enabled = val;
@@ -198,6 +200,7 @@ static int i440fx_initfn(PCIDevice *dev)
d->dev.config[0x72] = 0x02; /* SMRAM */
+ cpu_smm_register(&i440fx_set_smm, d);
return 0;
}
--
1.6.5.4
- [Qemu-devel] [PATCH V12 21/27] acpi_piix4: qdevfy., (continued)
- [Qemu-devel] [PATCH V12 21/27] acpi_piix4: qdevfy., Isaku Yamahata, 2010/01/05
- [Qemu-devel] [PATCH V12 20/27] rtc: make rtc_xxx accept/return ISADevice instead of RTCState., Isaku Yamahata, 2010/01/05
- [Qemu-devel] [PATCH V12 19/27] pc: move rtc declarations from pc.h into a dedicated header file., Isaku Yamahata, 2010/01/05
- [Qemu-devel] [PATCH V12 06/27] pc: initialize ioapic before use., Isaku Yamahata, 2010/01/05
- [Qemu-devel] [PATCH V12 13/27] pc: split out cpu initialization from pc_init1() into pc_cpus_init()., Isaku Yamahata, 2010/01/05
- [Qemu-devel] [PATCH V12 17/27] pc: split out pci device init from pc_init1() into pc_pci_device_init(), Isaku Yamahata, 2010/01/05
- [Qemu-devel] [PATCH V12 15/27] pc: split out vga initialization from pc_init1() into pc_vga_init()., Isaku Yamahata, 2010/01/05
- [Qemu-devel] [PATCH V12 02/27] acpi: split out apm register emulation from acpi.c, Isaku Yamahata, 2010/01/05
- [Qemu-devel] [PATCH V12 04/27] acpi: split acpi.c into the common part and the piix4 part., Isaku Yamahata, 2010/01/05
- [Qemu-devel] [PATCH V12 03/27] acpi: add acpi constants from linux header files and use them., Isaku Yamahata, 2010/01/05
- [Qemu-devel] [PATCH V12 07/27] pc, i440fx: Make smm enable/disable function i440fx independent.,
Isaku Yamahata <=
- Re: [Qemu-devel] [PATCH V12 00/27] split out piix specific part from pc emulator and some clean ups, Isaku Yamahata, 2010/01/12