[SeaBIOS] [Qemu-devel] [PATCH 1/6] pc/bios: move common BIOS_CFG_IOPORT into fw_cfg.h

liguang lig.fnst at cn.fujitsu.com
Mon Feb 4 03:27:53 CET 2013


BIOS_CFG_IOPORT are commonly used, so move it to fw_cfg.h
bochs_bios_init seems misleading, bios may be seabios,
seabios is not only for bochs, and also we are in qemu.

Signed-off-by: liguang <lig.fnst at cn.fujitsu.com>
---
 hw/fw_cfg.h |    4 ++++
 hw/pc.c     |    9 ++++-----
 hw/sun4u.c  |    3 +--
 3 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h
index 05c8df1..6b3147d 100644
--- a/hw/fw_cfg.h
+++ b/hw/fw_cfg.h
@@ -38,6 +38,10 @@
 
 #define FW_CFG_INVALID          0xffff
 
+#define FW_CFG_CTL_IOPORT 0x510
+#define FW_CFG_DATA_IOPORT 0x511
+
+
 #ifndef NO_QEMU_PROTOS
 typedef struct FWCfgFile {
     uint32_t  size;        /* file size */
diff --git a/hw/pc.c b/hw/pc.c
index 34b6dff..d010c75 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -64,7 +64,6 @@
 
 /* Leave a chunk of memory at the top of RAM for the BIOS ACPI tables.  */
 #define ACPI_DATA_SIZE       0x10000
-#define BIOS_CFG_IOPORT 0x510
 #define FW_CFG_ACPI_TABLES (FW_CFG_ARCH_LOCAL + 0)
 #define FW_CFG_SMBIOS_ENTRIES (FW_CFG_ARCH_LOCAL + 1)
 #define FW_CFG_IRQ0_OVERRIDE (FW_CFG_ARCH_LOCAL + 2)
@@ -556,14 +555,14 @@ int e820_add_entry(uint64_t address, uint64_t length, uint32_t type)
  * This function returns the limit for the APIC ID value, so that all
  * CPU APIC IDs are < pc_apic_id_limit().
  *
- * This is used for FW_CFG_MAX_CPUS. See comments on bochs_bios_init().
+ * This is used for FW_CFG_MAX_CPUS. See comments on bios_init().
  */
 static unsigned int pc_apic_id_limit(unsigned int max_cpus)
 {
     return x86_cpu_apic_id_from_index(max_cpus - 1) + 1;
 }
 
-static void *bochs_bios_init(void)
+static void *bios_init(void)
 {
     void *fw_cfg;
     uint8_t *smbios_table;
@@ -572,7 +571,7 @@ static void *bochs_bios_init(void)
     int i, j;
     unsigned int apic_id_limit = pc_apic_id_limit(max_cpus);
 
-    fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);
+    fw_cfg = fw_cfg_init(FW_CFG_CTL_IOPORT, FW_CFG_DATA_IOPORT, 0, 0);
     /* FW_CFG_MAX_CPUS is a bit confusing/problematic on x86:
      *
      * SeaBIOS needs FW_CFG_MAX_CPUS for CPU hotplug, but the CPU hotplug
@@ -954,7 +953,7 @@ void *pc_memory_init(MemoryRegion *system_memory,
                                         option_rom_mr,
                                         1);
 
-    fw_cfg = bochs_bios_init();
+    fw_cfg = bios_init();
     rom_set_fw(fw_cfg);
 
     if (linux_boot) {
diff --git a/hw/sun4u.c b/hw/sun4u.c
index 9fbda29..1bdc443 100644
--- a/hw/sun4u.c
+++ b/hw/sun4u.c
@@ -76,7 +76,6 @@
 #define PROM_FILENAME        "openbios-sparc64"
 #define NVRAM_SIZE           0x2000
 #define MAX_IDE_BUS          2
-#define BIOS_CFG_IOPORT      0x510
 #define FW_CFG_SPARC64_WIDTH (FW_CFG_ARCH_LOCAL + 0x00)
 #define FW_CFG_SPARC64_HEIGHT (FW_CFG_ARCH_LOCAL + 0x01)
 #define FW_CFG_SPARC64_DEPTH (FW_CFG_ARCH_LOCAL + 0x02)
@@ -877,7 +876,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
                            graphic_width, graphic_height, graphic_depth,
                            (uint8_t *)&nd_table[0].macaddr);
 
-    fw_cfg = fw_cfg_init(BIOS_CFG_IOPORT, BIOS_CFG_IOPORT + 1, 0, 0);
+    fw_cfg = fw_cfg_init(FW_CFG_CTL_IOPORT, FW_CFG_DATA_IOPORT, 0, 0);
     fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)max_cpus);
     fw_cfg_add_i32(fw_cfg, FW_CFG_ID, 1);
     fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
-- 
1.7.2.5




More information about the SeaBIOS mailing list