|
|
391fb8 |
From 6b9b5f3220b48bab7340fa7cae6ee021280fa9f1 Mon Sep 17 00:00:00 2001
|
|
|
391fb8 |
From: Laszlo Ersek <lersek@redhat.com>
|
|
|
391fb8 |
Date: Mon, 22 Dec 2014 13:11:36 +0100
|
|
|
391fb8 |
Subject: [PATCH 05/15] fw_cfg: move boards to fw_cfg_init_io() /
|
|
|
391fb8 |
fw_cfg_init_mem()
|
|
|
391fb8 |
|
|
|
391fb8 |
This allows us to drop the fw_cfg_init() shim and to enforce the possible
|
|
|
391fb8 |
mappings at compile time.
|
|
|
391fb8 |
|
|
|
391fb8 |
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
391fb8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
391fb8 |
Message-id: 1419250305-31062-3-git-send-email-pbonzini@redhat.com
|
|
|
391fb8 |
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
|
|
|
391fb8 |
(cherry picked from commit 66708822cd3007ae1ec5104d274a861148725e7a)
|
|
|
391fb8 |
---
|
|
|
391fb8 |
hw/i386/pc.c | 4 ++--
|
|
|
391fb8 |
hw/nvram/fw_cfg.c | 14 --------------
|
|
|
391fb8 |
hw/ppc/mac_newworld.c | 2 +-
|
|
|
391fb8 |
hw/ppc/mac_oldworld.c | 2 +-
|
|
|
391fb8 |
hw/sparc/sun4m.c | 2 +-
|
|
|
391fb8 |
hw/sparc64/sun4u.c | 2 +-
|
|
|
391fb8 |
include/hw/nvram/fw_cfg.h | 2 --
|
|
|
391fb8 |
7 files changed, 6 insertions(+), 22 deletions(-)
|
|
|
391fb8 |
|
|
|
391fb8 |
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
|
|
|
391fb8 |
index f31d55e..f60965f 100644
|
|
|
391fb8 |
--- a/hw/i386/pc.c
|
|
|
391fb8 |
+++ b/hw/i386/pc.c
|
|
|
391fb8 |
@@ -648,7 +648,7 @@ static FWCfgState *bochs_bios_init(void)
|
|
|
391fb8 |
int i, j;
|
|
|
391fb8 |
unsigned int apic_id_limit = pc_apic_id_limit(max_cpus);
|
|
|
391fb8 |
|
|
|
391fb8 |
- fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);
|
|
|
391fb8 |
+ fw_cfg = fw_cfg_init_io(BIOS_CFG_IOPORT);
|
|
|
391fb8 |
/* FW_CFG_MAX_CPUS is a bit confusing/problematic on x86:
|
|
|
391fb8 |
*
|
|
|
391fb8 |
* SeaBIOS needs FW_CFG_MAX_CPUS for CPU hotplug, but the CPU hotplug
|
|
|
391fb8 |
@@ -1169,7 +1169,7 @@ FWCfgState *xen_load_linux(const char *kernel_filename,
|
|
|
391fb8 |
|
|
|
391fb8 |
assert(kernel_filename != NULL);
|
|
|
391fb8 |
|
|
|
391fb8 |
- fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);
|
|
|
391fb8 |
+ fw_cfg = fw_cfg_init_io(BIOS_CFG_IOPORT);
|
|
|
391fb8 |
rom_set_fw(fw_cfg);
|
|
|
391fb8 |
|
|
|
391fb8 |
load_linux(fw_cfg, kernel_filename, initrd_filename,
|
|
|
391fb8 |
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
|
|
|
391fb8 |
index ab7bfff..c48bc6e 100644
|
|
|
391fb8 |
--- a/hw/nvram/fw_cfg.c
|
|
|
391fb8 |
+++ b/hw/nvram/fw_cfg.c
|
|
|
391fb8 |
@@ -632,20 +632,6 @@ FWCfgState *fw_cfg_init_mem(hwaddr ctl_addr, hwaddr data_addr)
|
|
|
391fb8 |
}
|
|
|
391fb8 |
|
|
|
391fb8 |
|
|
|
391fb8 |
-FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
|
|
|
391fb8 |
- hwaddr crl_addr, hwaddr data_addr)
|
|
|
391fb8 |
-{
|
|
|
391fb8 |
- if (ctl_port + 1 == data_port && crl_addr == 0 && data_addr == 0) {
|
|
|
391fb8 |
- return fw_cfg_init_io(ctl_port);
|
|
|
391fb8 |
- }
|
|
|
391fb8 |
- if (ctl_port == 0 && data_port == 0 && crl_addr != 0 && data_addr != 0) {
|
|
|
391fb8 |
- return fw_cfg_init_mem(crl_addr, data_addr);
|
|
|
391fb8 |
- }
|
|
|
391fb8 |
- assert(false);
|
|
|
391fb8 |
- return NULL;
|
|
|
391fb8 |
-}
|
|
|
391fb8 |
-
|
|
|
391fb8 |
-
|
|
|
391fb8 |
FWCfgState *fw_cfg_find(void)
|
|
|
391fb8 |
{
|
|
|
391fb8 |
return FW_CFG(object_resolve_path(FW_CFG_PATH, NULL));
|
|
|
391fb8 |
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
|
|
|
391fb8 |
index 89aee71..5dac389 100644
|
|
|
391fb8 |
--- a/hw/ppc/mac_newworld.c
|
|
|
391fb8 |
+++ b/hw/ppc/mac_newworld.c
|
|
|
391fb8 |
@@ -454,7 +454,7 @@ static void ppc_core99_init(MachineState *machine)
|
|
|
391fb8 |
pmac_format_nvram_partition(nvr, 0x2000);
|
|
|
391fb8 |
/* No PCI init: the BIOS will do it */
|
|
|
391fb8 |
|
|
|
391fb8 |
- fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
|
|
|
391fb8 |
+ fw_cfg = fw_cfg_init_mem(CFG_ADDR, CFG_ADDR + 2);
|
|
|
391fb8 |
fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
|
|
|
391fb8 |
fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
|
|
|
391fb8 |
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
|
|
|
391fb8 |
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
|
|
|
391fb8 |
index 32c21a4..41fefb7 100644
|
|
|
391fb8 |
--- a/hw/ppc/mac_oldworld.c
|
|
|
391fb8 |
+++ b/hw/ppc/mac_oldworld.c
|
|
|
391fb8 |
@@ -314,7 +314,7 @@ static void ppc_heathrow_init(MachineState *machine)
|
|
|
391fb8 |
|
|
|
391fb8 |
/* No PCI init: the BIOS will do it */
|
|
|
391fb8 |
|
|
|
391fb8 |
- fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
|
|
|
391fb8 |
+ fw_cfg = fw_cfg_init_mem(CFG_ADDR, CFG_ADDR + 2);
|
|
|
391fb8 |
fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
|
|
|
391fb8 |
fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
|
|
|
391fb8 |
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
|
|
|
391fb8 |
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
|
|
|
391fb8 |
index 8273199..a12d3c4 100644
|
|
|
391fb8 |
--- a/hw/sparc/sun4m.c
|
|
|
391fb8 |
+++ b/hw/sparc/sun4m.c
|
|
|
391fb8 |
@@ -1084,7 +1084,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef,
|
|
|
391fb8 |
ecc_init(hwdef->ecc_base, slavio_irq[28],
|
|
|
391fb8 |
hwdef->ecc_version);
|
|
|
391fb8 |
|
|
|
391fb8 |
- fw_cfg = fw_cfg_init(0, 0, CFG_ADDR, CFG_ADDR + 2);
|
|
|
391fb8 |
+ fw_cfg = fw_cfg_init_mem(CFG_ADDR, CFG_ADDR + 2);
|
|
|
391fb8 |
fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
|
|
|
391fb8 |
fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
|
|
|
391fb8 |
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
|
|
|
391fb8 |
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
|
|
|
391fb8 |
index f42112c..49fb678 100644
|
|
|
391fb8 |
--- a/hw/sparc64/sun4u.c
|
|
|
391fb8 |
+++ b/hw/sparc64/sun4u.c
|
|
|
391fb8 |
@@ -892,7 +892,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
|
|
|
391fb8 |
graphic_width, graphic_height, graphic_depth,
|
|
|
391fb8 |
(uint8_t *)&nd_table[0].macaddr);
|
|
|
391fb8 |
|
|
|
391fb8 |
- fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);
|
|
|
391fb8 |
+ fw_cfg = fw_cfg_init_io(BIOS_CFG_IOPORT);
|
|
|
391fb8 |
fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
|
|
|
391fb8 |
fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
|
|
|
391fb8 |
fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
|
|
|
391fb8 |
diff --git a/include/hw/nvram/fw_cfg.h b/include/hw/nvram/fw_cfg.h
|
|
|
391fb8 |
index fcc88ea..a99586e 100644
|
|
|
391fb8 |
--- a/include/hw/nvram/fw_cfg.h
|
|
|
391fb8 |
+++ b/include/hw/nvram/fw_cfg.h
|
|
|
391fb8 |
@@ -78,8 +78,6 @@ void fw_cfg_add_file_callback(FWCfgState *s, const char *filename,
|
|
|
391fb8 |
void *data, size_t len);
|
|
|
391fb8 |
void *fw_cfg_modify_file(FWCfgState *s, const char *filename, void *data,
|
|
|
391fb8 |
size_t len);
|
|
|
391fb8 |
-FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
|
|
|
391fb8 |
- hwaddr crl_addr, hwaddr data_addr);
|
|
|
391fb8 |
FWCfgState *fw_cfg_init_io(uint32_t iobase);
|
|
|
391fb8 |
FWCfgState *fw_cfg_init_mem(hwaddr ctl_addr, hwaddr data_addr);
|
|
|
391fb8 |
|
|
|
391fb8 |
--
|
|
|
391fb8 |
2.1.0
|
|
|
391fb8 |
|