[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 06/26] pc, i440fx: Make smm enable/disable function
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH 06/26] pc, i440fx: Make smm enable/disable function i440fx independent. |
Date: |
Fri, 14 May 2010 16:29:04 +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 | 4 +++-
hw/piix_pci.c | 5 ++++-
3 files changed, 22 insertions(+), 5 deletions(-)
diff --git a/hw/pc.c b/hw/pc.c
index 8842766..691803f 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -68,7 +68,6 @@
static FDCtrl *floppy_controller;
static RTCState *rtc_state;
static PITState *pit;
-static PCII440FXState *i440fx_state;
#define E820_NR_ENTRIES 16
@@ -125,10 +124,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);
}
@@ -813,6 +824,7 @@ static void pc_init1(ram_addr_t ram_size,
ram_addr_t below_4g_mem_size, above_4g_mem_size = 0;
int bios_size, isa_bios_size;
PCIBus *pci_bus;
+ PCII440FXState *i440fx_state;
int piix3_devfn = -1;
qemu_irq *cpu_irq;
qemu_irq *isa_irq;
diff --git a/hw/pc.h b/hw/pc.h
index d11a576..77239a0 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -80,6 +80,9 @@ 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);
+void cpu_smm_register(cpu_set_smm_t callback, void *arg);
+
/* acpi.c */
extern int acpi_enabled;
extern char *acpi_tables;
@@ -108,7 +111,6 @@ struct PCII440FXState;
typedef struct PCII440FXState PCII440FXState;
PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq
*pic, int ram_size);
-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 97519db..aff7f6d 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -114,8 +114,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;
@@ -210,6 +212,7 @@ static int i440fx_initfn(PCIDevice *dev)
d->dev.config[I440FX_SMRAM] = 0x02;
+ cpu_smm_register(&i440fx_set_smm, d);
return 0;
}
--
1.6.6.1
- [Qemu-devel] [PATCH 00/26] split out piix specific part from pc emulator and some clean ups, Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 11/26] pc: make pc_init1() not refer ferr_irq directly., Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 15/26] pc: split out basic device init from pc_init1() into pc_basic_device_init(), Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 09/26] pc: remove global variable rtc_state by using qemu_irq., Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 04/26] acpi: split acpi.c into the common part and the piix4 part., Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 01/26] acpi: split out piix4 smbus routines from acpi.c into pm_smbus.c, Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 10/26] pc: introduce a function to allocate cpu irq., Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 07/26] pc: make an unnecessary global variable, pit, local., Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 02/26] acpi: split out apm register emulation from acpi.c, Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 05/26] pc: initialize ioapic before use., Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 06/26] pc, i440fx: Make smm enable/disable function i440fx independent.,
Isaku Yamahata <=
- [Qemu-devel] [PATCH 13/26] pc: split out memory allocation from pc_init1() into pc_memory_init(), Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 08/26] pc: remove a global variable, floppy_controller., Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 14/26] pc: split out vga initialization from pc_init1() into pc_vga_init()., Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 24/26] acpi_piix4: remove #ifdef DEBUG., Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 21/26] pci hotplug: add argument to pci hot plug callback., Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 18/26] pc: move rtc declarations from pc.h into a dedicated header file., Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 25/26] apm: remove #ifdef DEBUG., Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 26/26] mc146818rtc: remove #ifdef DEBUG_CMOS., Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 03/26] acpi: add acpi constants from linux header files and use them., Isaku Yamahata, 2010/05/14
- [Qemu-devel] [PATCH 12/26] pc: split out cpu initialization from pc_init1() into pc_cpus_init()., Isaku Yamahata, 2010/05/14