0a122b
From 9698fead0e127336b0483ec2289affb308d7f505 Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <9698fead0e127336b0483ec2289affb308d7f505.1387298827.git.minovotn@redhat.com>
0a122b
In-Reply-To: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
References: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
From: "Michael S. Tsirkin" <mst@redhat.com>
0a122b
Date: Tue, 17 Dec 2013 15:17:11 +0100
0a122b
Subject: [PATCH 09/56] refer to FWCfgState explicitly
0a122b
0a122b
RH-Author: Michael S. Tsirkin <mst@redhat.com>
0a122b
Message-id: <1387293161-4085-10-git-send-email-mst@redhat.com>
0a122b
Patchwork-id: 56314
0a122b
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 09/57] refer to FWCfgState explicitly
0a122b
Bugzilla: 1034876
0a122b
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
0a122b
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
0a122b
From: Laszlo Ersek <lersek@redhat.com>
0a122b
0a122b
Currently some places use pointer-to-void even though they mean
0a122b
pointer-to-FWCfgState. Clean them up.
0a122b
0a122b
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
0a122b
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
0a122b
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
0a122b
(cherry picked from commit a88b362c6ffbb7a802bf0ed5ef0e2447164dc989)
0a122b
---
0a122b
 hw/i386/multiboot.h  |  4 +++-
0a122b
 include/hw/i386/pc.h | 19 ++++++++++---------
0a122b
 include/hw/loader.h  |  3 ++-
0a122b
 hw/acpi/piix4.c      |  2 +-
0a122b
 hw/core/loader.c     |  2 +-
0a122b
 hw/i386/multiboot.c  |  2 +-
0a122b
 hw/i386/pc.c         | 24 ++++++++++++------------
0a122b
 hw/i386/pc_piix.c    |  2 +-
0a122b
 hw/sparc/sun4m.c     |  2 +-
0a122b
 hw/sparc64/sun4u.c   |  2 +-
0a122b
 10 files changed, 33 insertions(+), 29 deletions(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 hw/acpi/piix4.c      |  2 +-
0a122b
 hw/core/loader.c     |  2 +-
0a122b
 hw/i386/multiboot.c  |  2 +-
0a122b
 hw/i386/multiboot.h  |  4 +++-
0a122b
 hw/i386/pc.c         | 24 ++++++++++++------------
0a122b
 hw/i386/pc_piix.c    |  2 +-
0a122b
 hw/sparc/sun4m.c     |  2 +-
0a122b
 hw/sparc64/sun4u.c   |  2 +-
0a122b
 include/hw/i386/pc.h | 19 ++++++++++---------
0a122b
 include/hw/loader.h  |  3 ++-
0a122b
 10 files changed, 33 insertions(+), 29 deletions(-)
0a122b
0a122b
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
0a122b
index 8af97cf..6882937 100644
0a122b
--- a/hw/acpi/piix4.c
0a122b
+++ b/hw/acpi/piix4.c
0a122b
@@ -447,7 +447,7 @@ static int piix4_pm_initfn(PCIDevice *dev)
0a122b
 
0a122b
 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
0a122b
                        qemu_irq sci_irq, qemu_irq smi_irq,
0a122b
-                       int kvm_enabled, void *fw_cfg)
0a122b
+                       int kvm_enabled, FWCfgState *fw_cfg)
0a122b
 {
0a122b
     PCIDevice *dev;
0a122b
     PIIX4PMState *s;
0a122b
diff --git a/hw/core/loader.c b/hw/core/loader.c
0a122b
index 8514eaf..7d61537 100644
0a122b
--- a/hw/core/loader.c
0a122b
+++ b/hw/core/loader.c
0a122b
@@ -733,7 +733,7 @@ int rom_load_all(void)
0a122b
     return 0;
0a122b
 }
0a122b
 
0a122b
-void rom_set_fw(void *f)
0a122b
+void rom_set_fw(FWCfgState *f)
0a122b
 {
0a122b
     fw_cfg = f;
0a122b
 }
0a122b
diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
0a122b
index d696507..09211e0 100644
0a122b
--- a/hw/i386/multiboot.c
0a122b
+++ b/hw/i386/multiboot.c
0a122b
@@ -124,7 +124,7 @@ static void mb_add_mod(MultibootState *s,
0a122b
     s->mb_mods_count++;
0a122b
 }
0a122b
 
0a122b
-int load_multiboot(void *fw_cfg,
0a122b
+int load_multiboot(FWCfgState *fw_cfg,
0a122b
                    FILE *f,
0a122b
                    const char *kernel_filename,
0a122b
                    const char *initrd_filename,
0a122b
diff --git a/hw/i386/multiboot.h b/hw/i386/multiboot.h
0a122b
index 98fb1b7..60de309 100644
0a122b
--- a/hw/i386/multiboot.h
0a122b
+++ b/hw/i386/multiboot.h
0a122b
@@ -1,7 +1,9 @@
0a122b
 #ifndef QEMU_MULTIBOOT_H
0a122b
 #define QEMU_MULTIBOOT_H
0a122b
 
0a122b
-int load_multiboot(void *fw_cfg,
0a122b
+#include "hw/nvram/fw_cfg.h"
0a122b
+
0a122b
+int load_multiboot(FWCfgState *fw_cfg,
0a122b
                    FILE *f,
0a122b
                    const char *kernel_filename,
0a122b
                    const char *initrd_filename,
0a122b
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
0a122b
index 333e83f..2948781 100644
0a122b
--- a/hw/i386/pc.c
0a122b
+++ b/hw/i386/pc.c
0a122b
@@ -598,9 +598,9 @@ static unsigned int pc_apic_id_limit(unsigned int max_cpus)
0a122b
     return x86_cpu_apic_id_from_index(max_cpus - 1) + 1;
0a122b
 }
0a122b
 
0a122b
-static void *bochs_bios_init(void)
0a122b
+static FWCfgState *bochs_bios_init(void)
0a122b
 {
0a122b
-    void *fw_cfg;
0a122b
+    FWCfgState *fw_cfg;
0a122b
     uint8_t *smbios_table;
0a122b
     size_t smbios_len;
0a122b
     uint64_t *numa_fw_cfg;
0a122b
@@ -677,7 +677,7 @@ static long get_file_size(FILE *f)
0a122b
     return size;
0a122b
 }
0a122b
 
0a122b
-static void load_linux(void *fw_cfg,
0a122b
+static void load_linux(FWCfgState *fw_cfg,
0a122b
                        const char *kernel_filename,
0a122b
                        const char *initrd_filename,
0a122b
                        const char *kernel_cmdline,
0a122b
@@ -1019,19 +1019,19 @@ void pc_acpi_init(const char *default_dsdt)
0a122b
     }
0a122b
 }
0a122b
 
0a122b
-void *pc_memory_init(MemoryRegion *system_memory,
0a122b
-                    const char *kernel_filename,
0a122b
-                    const char *kernel_cmdline,
0a122b
-                    const char *initrd_filename,
0a122b
-                    ram_addr_t below_4g_mem_size,
0a122b
-                    ram_addr_t above_4g_mem_size,
0a122b
-                    MemoryRegion *rom_memory,
0a122b
-                    MemoryRegion **ram_memory)
0a122b
+FWCfgState *pc_memory_init(MemoryRegion *system_memory,
0a122b
+                           const char *kernel_filename,
0a122b
+                           const char *kernel_cmdline,
0a122b
+                           const char *initrd_filename,
0a122b
+                           ram_addr_t below_4g_mem_size,
0a122b
+                           ram_addr_t above_4g_mem_size,
0a122b
+                           MemoryRegion *rom_memory,
0a122b
+                           MemoryRegion **ram_memory)
0a122b
 {
0a122b
     int linux_boot, i;
0a122b
     MemoryRegion *ram, *option_rom_mr;
0a122b
     MemoryRegion *ram_below_4g, *ram_above_4g;
0a122b
-    void *fw_cfg;
0a122b
+    FWCfgState *fw_cfg;
0a122b
 
0a122b
     linux_boot = (kernel_filename != NULL);
0a122b
 
0a122b
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
0a122b
index 8c3f2d6..b6f9288 100644
0a122b
--- a/hw/i386/pc_piix.c
0a122b
+++ b/hw/i386/pc_piix.c
0a122b
@@ -85,7 +85,7 @@ static void pc_init1(QEMUMachineInitArgs *args,
0a122b
     MemoryRegion *pci_memory;
0a122b
     MemoryRegion *rom_memory;
0a122b
     DeviceState *icc_bridge;
0a122b
-    void *fw_cfg = NULL;
0a122b
+    FWCfgState *fw_cfg = NULL;
0a122b
 
0a122b
     icc_bridge = qdev_create(NULL, TYPE_ICC_BRIDGE);
0a122b
     object_property_add_child(qdev_get_machine(), "icc-bridge",
0a122b
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
0a122b
index 635115f..7c5b8e7 100644
0a122b
--- a/hw/sparc/sun4m.c
0a122b
+++ b/hw/sparc/sun4m.c
0a122b
@@ -873,7 +873,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
0a122b
     qemu_irq *cpu_halt;
0a122b
     unsigned long kernel_size;
0a122b
     DriveInfo *fd[MAX_FD];
0a122b
-    void *fw_cfg;
0a122b
+    FWCfgState *fw_cfg;
0a122b
     unsigned int num_vsimms;
0a122b
 
0a122b
     /* init CPUs */
0a122b
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
0a122b
index 5c2bbd4..5ce5ed6 100644
0a122b
--- a/hw/sparc64/sun4u.c
0a122b
+++ b/hw/sparc64/sun4u.c
0a122b
@@ -818,7 +818,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
0a122b
     qemu_irq *ivec_irqs, *pbm_irqs;
0a122b
     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
0a122b
     DriveInfo *fd[MAX_FD];
0a122b
-    void *fw_cfg;
0a122b
+    FWCfgState *fw_cfg;
0a122b
 
0a122b
     /* init CPUs */
0a122b
     cpu = cpu_devinit(cpu_model, hwdef);
0a122b
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
0a122b
index 72f6882..4175c1b 100644
0a122b
--- a/include/hw/i386/pc.h
0a122b
+++ b/include/hw/i386/pc.h
0a122b
@@ -9,6 +9,7 @@
0a122b
 #include "net/net.h"
0a122b
 #include "exec/memory.h"
0a122b
 #include "hw/i386/ioapic.h"
0a122b
+#include "hw/nvram/fw_cfg.h"
0a122b
 
0a122b
 /* PC-style peripherals (also used by other machines).  */
0a122b
 
0a122b
@@ -84,14 +85,14 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
0a122b
 void pc_cpus_init(const char *cpu_model, DeviceState *icc_bridge);
0a122b
 void pc_hot_add_cpu(const int64_t id, Error **errp);
0a122b
 void pc_acpi_init(const char *default_dsdt);
0a122b
-void *pc_memory_init(MemoryRegion *system_memory,
0a122b
-                    const char *kernel_filename,
0a122b
-                    const char *kernel_cmdline,
0a122b
-                    const char *initrd_filename,
0a122b
-                    ram_addr_t below_4g_mem_size,
0a122b
-                    ram_addr_t above_4g_mem_size,
0a122b
-                    MemoryRegion *rom_memory,
0a122b
-                    MemoryRegion **ram_memory);
0a122b
+FWCfgState *pc_memory_init(MemoryRegion *system_memory,
0a122b
+                           const char *kernel_filename,
0a122b
+                           const char *kernel_cmdline,
0a122b
+                           const char *initrd_filename,
0a122b
+                           ram_addr_t below_4g_mem_size,
0a122b
+                           ram_addr_t above_4g_mem_size,
0a122b
+                           MemoryRegion *rom_memory,
0a122b
+                           MemoryRegion **ram_memory);
0a122b
 qemu_irq *pc_allocate_cpu_irq(void);
0a122b
 DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
0a122b
 void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
0a122b
@@ -115,7 +116,7 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);
0a122b
 
0a122b
 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
0a122b
                        qemu_irq sci_irq, qemu_irq smi_irq,
0a122b
-                       int kvm_enabled, void *fw_cfg);
0a122b
+                       int kvm_enabled, FWCfgState *fw_cfg);
0a122b
 void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
0a122b
 
0a122b
 /* hpet.c */
0a122b
diff --git a/include/hw/loader.h b/include/hw/loader.h
0a122b
index 0958f06..15d4cc9 100644
0a122b
--- a/include/hw/loader.h
0a122b
+++ b/include/hw/loader.h
0a122b
@@ -1,6 +1,7 @@
0a122b
 #ifndef LOADER_H
0a122b
 #define LOADER_H
0a122b
 #include "qapi/qmp/qdict.h"
0a122b
+#include "hw/nvram/fw_cfg.h"
0a122b
 
0a122b
 /* loader.c */
0a122b
 int get_image_size(const char *filename);
0a122b
@@ -30,7 +31,7 @@ int rom_add_blob(const char *name, const void *blob, size_t len,
0a122b
 int rom_add_elf_program(const char *name, void *data, size_t datasize,
0a122b
                         size_t romsize, hwaddr addr);
0a122b
 int rom_load_all(void);
0a122b
-void rom_set_fw(void *f);
0a122b
+void rom_set_fw(FWCfgState *f);
0a122b
 int rom_copy(uint8_t *dest, hwaddr addr, size_t size);
0a122b
 void *rom_ptr(hwaddr addr);
0a122b
 void do_info_roms(Monitor *mon, const QDict *qdict);
0a122b
-- 
0a122b
1.7.11.7
0a122b