[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 20/26] pc, i440fx: simply i440fx initialization
From: |
Isaku Yamahata |
Subject: |
[Qemu-devel] [PATCH 20/26] pc, i440fx: simply i440fx initialization |
Date: |
Wed, 16 Mar 2011 18:29:31 +0900 |
simply i440fx initialization by eliminating
i440fx_init_memory_mappings().
Signed-off-by: Isaku Yamahata <address@hidden>
---
hw/pc.h | 2 +-
hw/pc_piix.c | 8 +-------
hw/piix_pci.c | 15 ++++++---------
3 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/hw/pc.h b/hw/pc.h
index 598747d..d382bb6 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -178,7 +178,7 @@ int pcspk_audio_init(qemu_irq *pic);
struct PCII440FXState;
typedef struct PCII440FXState PCII440FXState;
-PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix_devfn, qemu_irq
*pic, ram_addr_t ram_size);
+PCIBus *i440fx_init(int *piix_devfn, qemu_irq *pic, ram_addr_t ram_size);
void i440fx_init_memory_mappings(PCII440FXState *d);
/* piix4.c */
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index f04d58b..a3697e7 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -58,7 +58,6 @@ static void pc_init1(ram_addr_t ram_size,
int i;
ram_addr_t below_4g_mem_size, above_4g_mem_size;
PCIBus *pci_bus;
- PCII440FXState *i440fx_state;
int piix3_devfn = -1;
qemu_irq *isa_irq;
qemu_irq *cmos_s3;
@@ -84,10 +83,9 @@ static void pc_init1(ram_addr_t ram_size,
}
if (pci_enabled) {
- pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, isa_irq, ram_size);
+ pci_bus = i440fx_init(&piix3_devfn, isa_irq, ram_size);
} else {
pci_bus = NULL;
- i440fx_state = NULL;
isa_bus_new(NULL);
}
isa_bus_irqs(isa_irq);
@@ -136,10 +134,6 @@ static void pc_init1(ram_addr_t ram_size,
smbus_eeprom_init(smbus, 8, NULL, 0);
}
- if (i440fx_state) {
- i440fx_init_memory_mappings(i440fx_state);
- }
-
if (pci_enabled) {
pc_pci_device_init(pci_bus);
}
diff --git a/hw/piix_pci.c b/hw/piix_pci.c
index f619162..151353c 100644
--- a/hw/piix_pci.c
+++ b/hw/piix_pci.c
@@ -84,11 +84,6 @@ static void i440fx_set_smm(int val, void *arg)
smram_set_smm(&d->pam, val, d->dev.config[I440FX_SMRAM]);
}
-void i440fx_init_memory_mappings(PCII440FXState *d)
-{
- pam_init_memory_mappings(&d->pam);
-}
-
static void i440fx_write_config(PCIDevice *dev,
uint32_t address, uint32_t val, int len)
{
@@ -166,15 +161,17 @@ static int i440fx_initfn(PCIDevice *dev)
d->dev.config[I440FX_SMRAM] = 0x02;
cpu_smm_register(&i440fx_set_smm, d);
+ pam_init_memory_mappings(&d->pam);
return 0;
}
-PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int *piix3_devfn, qemu_irq
*pic, ram_addr_t ram_size)
+PCIBus *i440fx_init(int *piix3_devfn, qemu_irq *pic, ram_addr_t ram_size)
{
DeviceState *dev;
PCIBus *b;
PCIDevice *d;
I440FXState *s;
+ PCII440FXState *i440fx_state;
PIIX3State *piix3;
dev = qdev_create(NULL, "i440FX-pcihost");
@@ -184,20 +181,20 @@ PCIBus *i440fx_init(PCII440FXState **pi440fx_state, int
*piix3_devfn, qemu_irq *
qdev_init_nofail(dev);
d = pci_create_simple(b, 0, "i440FX");
- *pi440fx_state = DO_UPCAST(PCII440FXState, dev, d);
+ i440fx_state = DO_UPCAST(PCII440FXState, dev, d);
piix3 = DO_UPCAST(PIIX3State, dev,
pci_create_simple_multifunction(b, -1, true, "PIIX3"));
piix3->pic = pic;
pci_bus_irqs(b, piix3_set_irq, pci_slot_get_pirq, piix3, 4);
- (*pi440fx_state)->piix3 = piix3;
+ i440fx_state->piix3 = piix3;
*piix3_devfn = piix3->dev.devfn;
ram_size = ram_size / 8 / 1024 / 1024;
if (ram_size > 255)
ram_size = 255;
- (*pi440fx_state)->dev.config[0x57]=ram_size;
+ i440fx_state->dev.config[0x57]=ram_size;
return b;
}
--
1.7.1.1
- [Qemu-devel] [PATCH 17/26] pc, pc_piix: split out pc nic initialization, (continued)
- [Qemu-devel] [PATCH 17/26] pc, pc_piix: split out pc nic initialization, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 16/26] pc, pc_piix: split out allocating isa irqs, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 14/26] ide: consolidate drive_get(IF_IDE), Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 11/26] ahci: add ide device initialization helper, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 18/26] ioapic: move ioapic_init() from pc_piix.c to pc.c, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 02/26] pci: add opaque argument to pci_map_irq_fn, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 03/26] pci: introduce pci_swizzle_map_irq_fn() for standardized interrupt pin swizzle, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 20/26] pc, i440fx: simply i440fx initialization,
Isaku Yamahata <=
- [Qemu-devel] [PATCH 21/26] acpi, acpi_piix: factor out PM_TMR logic, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 24/26] acpi, acpi_piix: factor out GPE logic, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 09/26] dec_pci: simplify dec_pci.c by using pci_p2pbr, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 22/26] acpi, acpi_piix: factor out PM1a EVT logic, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 08/26] apb_pci: simplify apb_pci.c by using pci_p2pbr, Isaku Yamahata, 2011/03/16
- [Qemu-devel] [PATCH 04/26] pci: add accessor function to get irq levels, Isaku Yamahata, 2011/03/16