diff mbox

[v4,1/7] refer to FWCfgState explicitly

Message ID 1366316544-1428-2-git-send-email-lersek@redhat.com
State New
Headers show

Commit Message

Laszlo Ersek April 18, 2013, 8:22 p.m. UTC
Currently some places use pointer-to-void even though they mean
pointer-to-FWCfgState. Clean them up.

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/i386/multiboot.h  |    4 +++-
 include/hw/i386/pc.h |   19 ++++++++++---------
 include/hw/loader.h  |    3 ++-
 hw/acpi/piix4.c      |    2 +-
 hw/core/loader.c     |    2 +-
 hw/i386/multiboot.c  |    2 +-
 hw/i386/pc.c         |   24 ++++++++++++------------
 hw/i386/pc_piix.c    |    2 +-
 hw/sparc/sun4m.c     |    6 +++---
 hw/sparc64/sun4u.c   |    2 +-
 10 files changed, 35 insertions(+), 31 deletions(-)

Comments

Anthony Liguori April 25, 2013, 6:44 p.m. UTC | #1
Laszlo Ersek <lersek@redhat.com> writes:

> Currently some places use pointer-to-void even though they mean
> pointer-to-FWCfgState. Clean them up.
>
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> Acked-by: Michael S. Tsirkin <mst@redhat.com>

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>

Regards,

Anthony Liguori

> ---
>  hw/i386/multiboot.h  |    4 +++-
>  include/hw/i386/pc.h |   19 ++++++++++---------
>  include/hw/loader.h  |    3 ++-
>  hw/acpi/piix4.c      |    2 +-
>  hw/core/loader.c     |    2 +-
>  hw/i386/multiboot.c  |    2 +-
>  hw/i386/pc.c         |   24 ++++++++++++------------
>  hw/i386/pc_piix.c    |    2 +-
>  hw/sparc/sun4m.c     |    6 +++---
>  hw/sparc64/sun4u.c   |    2 +-
>  10 files changed, 35 insertions(+), 31 deletions(-)
>
> diff --git a/hw/i386/multiboot.h b/hw/i386/multiboot.h
> index 98fb1b7..60de309 100644
> --- a/hw/i386/multiboot.h
> +++ b/hw/i386/multiboot.h
> @@ -1,7 +1,9 @@
>  #ifndef QEMU_MULTIBOOT_H
>  #define QEMU_MULTIBOOT_H
>  
> -int load_multiboot(void *fw_cfg,
> +#include "hw/nvram/fw_cfg.h"
> +
> +int load_multiboot(FWCfgState *fw_cfg,
>                     FILE *f,
>                     const char *kernel_filename,
>                     const char *initrd_filename,
> diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> index 9bcc819..fa4b5ce 100644
> --- a/include/hw/i386/pc.h
> +++ b/include/hw/i386/pc.h
> @@ -9,6 +9,7 @@
>  #include "net/net.h"
>  #include "exec/memory.h"
>  #include "hw/i386/ioapic.h"
> +#include "hw/nvram/fw_cfg.h"
>  
>  /* PC-style peripherals (also used by other machines).  */
>  
> @@ -80,14 +81,14 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
>  
>  void pc_cpus_init(const char *cpu_model);
>  void pc_acpi_init(const char *default_dsdt);
> -void *pc_memory_init(MemoryRegion *system_memory,
> -                    const char *kernel_filename,
> -                    const char *kernel_cmdline,
> -                    const char *initrd_filename,
> -                    ram_addr_t below_4g_mem_size,
> -                    ram_addr_t above_4g_mem_size,
> -                    MemoryRegion *rom_memory,
> -                    MemoryRegion **ram_memory);
> +FWCfgState *pc_memory_init(MemoryRegion *system_memory,
> +                           const char *kernel_filename,
> +                           const char *kernel_cmdline,
> +                           const char *initrd_filename,
> +                           ram_addr_t below_4g_mem_size,
> +                           ram_addr_t above_4g_mem_size,
> +                           MemoryRegion *rom_memory,
> +                           MemoryRegion **ram_memory);
>  qemu_irq *pc_allocate_cpu_irq(void);
>  DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
>  void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
> @@ -111,7 +112,7 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);
>  
>  i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
>                         qemu_irq sci_irq, qemu_irq smi_irq,
> -                       int kvm_enabled, void *fw_cfg);
> +                       int kvm_enabled, FWCfgState *fw_cfg);
>  void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
>  
>  /* hpet.c */
> diff --git a/include/hw/loader.h b/include/hw/loader.h
> index 0958f06..15d4cc9 100644
> --- a/include/hw/loader.h
> +++ b/include/hw/loader.h
> @@ -1,6 +1,7 @@
>  #ifndef LOADER_H
>  #define LOADER_H
>  #include "qapi/qmp/qdict.h"
> +#include "hw/nvram/fw_cfg.h"
>  
>  /* loader.c */
>  int get_image_size(const char *filename);
> @@ -30,7 +31,7 @@ int rom_add_blob(const char *name, const void *blob, size_t len,
>  int rom_add_elf_program(const char *name, void *data, size_t datasize,
>                          size_t romsize, hwaddr addr);
>  int rom_load_all(void);
> -void rom_set_fw(void *f);
> +void rom_set_fw(FWCfgState *f);
>  int rom_copy(uint8_t *dest, hwaddr addr, size_t size);
>  void *rom_ptr(hwaddr addr);
>  void do_info_roms(Monitor *mon, const QDict *qdict);
> diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
> index 88386d7..200c297 100644
> --- a/hw/acpi/piix4.c
> +++ b/hw/acpi/piix4.c
> @@ -435,7 +435,7 @@ static int piix4_pm_initfn(PCIDevice *dev)
>  
>  i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
>                         qemu_irq sci_irq, qemu_irq smi_irq,
> -                       int kvm_enabled, void *fw_cfg)
> +                       int kvm_enabled, FWCfgState *fw_cfg)
>  {
>      PCIDevice *dev;
>      PIIX4PMState *s;
> diff --git a/hw/core/loader.c b/hw/core/loader.c
> index 7507914..a711145 100644
> --- a/hw/core/loader.c
> +++ b/hw/core/loader.c
> @@ -733,7 +733,7 @@ int rom_load_all(void)
>      return 0;
>  }
>  
> -void rom_set_fw(void *f)
> +void rom_set_fw(FWCfgState *f)
>  {
>      fw_cfg = f;
>  }
> diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
> index d696507..09211e0 100644
> --- a/hw/i386/multiboot.c
> +++ b/hw/i386/multiboot.c
> @@ -124,7 +124,7 @@ static void mb_add_mod(MultibootState *s,
>      s->mb_mods_count++;
>  }
>  
> -int load_multiboot(void *fw_cfg,
> +int load_multiboot(FWCfgState *fw_cfg,
>                     FILE *f,
>                     const char *kernel_filename,
>                     const char *initrd_filename,
> diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> index 0d6e72b..3c12b55 100644
> --- a/hw/i386/pc.c
> +++ b/hw/i386/pc.c
> @@ -569,9 +569,9 @@ 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 FWCfgState *bochs_bios_init(void)
>  {
> -    void *fw_cfg;
> +    FWCfgState *fw_cfg;
>      uint8_t *smbios_table;
>      size_t smbios_len;
>      uint64_t *numa_fw_cfg;
> @@ -648,7 +648,7 @@ static long get_file_size(FILE *f)
>      return size;
>  }
>  
> -static void load_linux(void *fw_cfg,
> +static void load_linux(FWCfgState *fw_cfg,
>                         const char *kernel_filename,
>                         const char *initrd_filename,
>                         const char *kernel_cmdline,
> @@ -924,19 +924,19 @@ void pc_acpi_init(const char *default_dsdt)
>      }
>  }
>  
> -void *pc_memory_init(MemoryRegion *system_memory,
> -                    const char *kernel_filename,
> -                    const char *kernel_cmdline,
> -                    const char *initrd_filename,
> -                    ram_addr_t below_4g_mem_size,
> -                    ram_addr_t above_4g_mem_size,
> -                    MemoryRegion *rom_memory,
> -                    MemoryRegion **ram_memory)
> +FWCfgState *pc_memory_init(MemoryRegion *system_memory,
> +                           const char *kernel_filename,
> +                           const char *kernel_cmdline,
> +                           const char *initrd_filename,
> +                           ram_addr_t below_4g_mem_size,
> +                           ram_addr_t above_4g_mem_size,
> +                           MemoryRegion *rom_memory,
> +                           MemoryRegion **ram_memory)
>  {
>      int linux_boot, i;
>      MemoryRegion *ram, *option_rom_mr;
>      MemoryRegion *ram_below_4g, *ram_above_4g;
> -    void *fw_cfg;
> +    FWCfgState *fw_cfg;
>  
>      linux_boot = (kernel_filename != NULL);
>  
> diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> index 943758a..da10e6d 100644
> --- a/hw/i386/pc_piix.c
> +++ b/hw/i386/pc_piix.c
> @@ -85,7 +85,7 @@ static void pc_init1(MemoryRegion *system_memory,
>      MemoryRegion *ram_memory;
>      MemoryRegion *pci_memory;
>      MemoryRegion *rom_memory;
> -    void *fw_cfg = NULL;
> +    FWCfgState *fw_cfg = NULL;
>  
>      pc_cpus_init(cpu_model);
>      pc_acpi_init("acpi-dsdt.aml");
> diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> index 31beb32..0b1b620 100644
> --- a/hw/sparc/sun4m.c
> +++ b/hw/sparc/sun4m.c
> @@ -874,7 +874,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
>      qemu_irq *cpu_halt;
>      unsigned long kernel_size;
>      DriveInfo *fd[MAX_FD];
> -    void *fw_cfg;
> +    FWCfgState *fw_cfg;
>      unsigned int num_vsimms;
>  
>      /* init CPUs */
> @@ -1592,7 +1592,7 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size,
>          espdma_irq, ledma_irq;
>      qemu_irq esp_reset, dma_enable;
>      unsigned long kernel_size;
> -    void *fw_cfg;
> +    FWCfgState *fw_cfg;
>      DeviceState *dev;
>  
>      /* init CPUs */
> @@ -1793,7 +1793,7 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,
>      qemu_irq fdc_tc;
>      unsigned long kernel_size;
>      DriveInfo *fd[MAX_FD];
> -    void *fw_cfg;
> +    FWCfgState *fw_cfg;
>      DeviceState *dev;
>      unsigned int i;
>  
> diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> index 0d29620..0138252 100644
> --- a/hw/sparc64/sun4u.c
> +++ b/hw/sparc64/sun4u.c
> @@ -818,7 +818,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
>      qemu_irq *ivec_irqs, *pbm_irqs;
>      DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
>      DriveInfo *fd[MAX_FD];
> -    void *fw_cfg;
> +    FWCfgState *fw_cfg;
>  
>      /* init CPUs */
>      cpu = cpu_devinit(cpu_model, hwdef);
> -- 
> 1.7.1
Michael S. Tsirkin April 25, 2013, 9:04 p.m. UTC | #2
On Thu, Apr 25, 2013 at 01:44:20PM -0500, Anthony Liguori wrote:
> Laszlo Ersek <lersek@redhat.com> writes:
> 
> > Currently some places use pointer-to-void even though they mean
> > pointer-to-FWCfgState. Clean them up.
> >
> > Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> > Acked-by: Michael S. Tsirkin <mst@redhat.com>
> 
> Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
> 
> Regards,
> 
> Anthony Liguori

So which tree should this be merged through?
Should I pick it up?

> > ---
> >  hw/i386/multiboot.h  |    4 +++-
> >  include/hw/i386/pc.h |   19 ++++++++++---------
> >  include/hw/loader.h  |    3 ++-
> >  hw/acpi/piix4.c      |    2 +-
> >  hw/core/loader.c     |    2 +-
> >  hw/i386/multiboot.c  |    2 +-
> >  hw/i386/pc.c         |   24 ++++++++++++------------
> >  hw/i386/pc_piix.c    |    2 +-
> >  hw/sparc/sun4m.c     |    6 +++---
> >  hw/sparc64/sun4u.c   |    2 +-
> >  10 files changed, 35 insertions(+), 31 deletions(-)
> >
> > diff --git a/hw/i386/multiboot.h b/hw/i386/multiboot.h
> > index 98fb1b7..60de309 100644
> > --- a/hw/i386/multiboot.h
> > +++ b/hw/i386/multiboot.h
> > @@ -1,7 +1,9 @@
> >  #ifndef QEMU_MULTIBOOT_H
> >  #define QEMU_MULTIBOOT_H
> >  
> > -int load_multiboot(void *fw_cfg,
> > +#include "hw/nvram/fw_cfg.h"
> > +
> > +int load_multiboot(FWCfgState *fw_cfg,
> >                     FILE *f,
> >                     const char *kernel_filename,
> >                     const char *initrd_filename,
> > diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
> > index 9bcc819..fa4b5ce 100644
> > --- a/include/hw/i386/pc.h
> > +++ b/include/hw/i386/pc.h
> > @@ -9,6 +9,7 @@
> >  #include "net/net.h"
> >  #include "exec/memory.h"
> >  #include "hw/i386/ioapic.h"
> > +#include "hw/nvram/fw_cfg.h"
> >  
> >  /* PC-style peripherals (also used by other machines).  */
> >  
> > @@ -80,14 +81,14 @@ void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
> >  
> >  void pc_cpus_init(const char *cpu_model);
> >  void pc_acpi_init(const char *default_dsdt);
> > -void *pc_memory_init(MemoryRegion *system_memory,
> > -                    const char *kernel_filename,
> > -                    const char *kernel_cmdline,
> > -                    const char *initrd_filename,
> > -                    ram_addr_t below_4g_mem_size,
> > -                    ram_addr_t above_4g_mem_size,
> > -                    MemoryRegion *rom_memory,
> > -                    MemoryRegion **ram_memory);
> > +FWCfgState *pc_memory_init(MemoryRegion *system_memory,
> > +                           const char *kernel_filename,
> > +                           const char *kernel_cmdline,
> > +                           const char *initrd_filename,
> > +                           ram_addr_t below_4g_mem_size,
> > +                           ram_addr_t above_4g_mem_size,
> > +                           MemoryRegion *rom_memory,
> > +                           MemoryRegion **ram_memory);
> >  qemu_irq *pc_allocate_cpu_irq(void);
> >  DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
> >  void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
> > @@ -111,7 +112,7 @@ void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);
> >  
> >  i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
> >                         qemu_irq sci_irq, qemu_irq smi_irq,
> > -                       int kvm_enabled, void *fw_cfg);
> > +                       int kvm_enabled, FWCfgState *fw_cfg);
> >  void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
> >  
> >  /* hpet.c */
> > diff --git a/include/hw/loader.h b/include/hw/loader.h
> > index 0958f06..15d4cc9 100644
> > --- a/include/hw/loader.h
> > +++ b/include/hw/loader.h
> > @@ -1,6 +1,7 @@
> >  #ifndef LOADER_H
> >  #define LOADER_H
> >  #include "qapi/qmp/qdict.h"
> > +#include "hw/nvram/fw_cfg.h"
> >  
> >  /* loader.c */
> >  int get_image_size(const char *filename);
> > @@ -30,7 +31,7 @@ int rom_add_blob(const char *name, const void *blob, size_t len,
> >  int rom_add_elf_program(const char *name, void *data, size_t datasize,
> >                          size_t romsize, hwaddr addr);
> >  int rom_load_all(void);
> > -void rom_set_fw(void *f);
> > +void rom_set_fw(FWCfgState *f);
> >  int rom_copy(uint8_t *dest, hwaddr addr, size_t size);
> >  void *rom_ptr(hwaddr addr);
> >  void do_info_roms(Monitor *mon, const QDict *qdict);
> > diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
> > index 88386d7..200c297 100644
> > --- a/hw/acpi/piix4.c
> > +++ b/hw/acpi/piix4.c
> > @@ -435,7 +435,7 @@ static int piix4_pm_initfn(PCIDevice *dev)
> >  
> >  i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
> >                         qemu_irq sci_irq, qemu_irq smi_irq,
> > -                       int kvm_enabled, void *fw_cfg)
> > +                       int kvm_enabled, FWCfgState *fw_cfg)
> >  {
> >      PCIDevice *dev;
> >      PIIX4PMState *s;
> > diff --git a/hw/core/loader.c b/hw/core/loader.c
> > index 7507914..a711145 100644
> > --- a/hw/core/loader.c
> > +++ b/hw/core/loader.c
> > @@ -733,7 +733,7 @@ int rom_load_all(void)
> >      return 0;
> >  }
> >  
> > -void rom_set_fw(void *f)
> > +void rom_set_fw(FWCfgState *f)
> >  {
> >      fw_cfg = f;
> >  }
> > diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
> > index d696507..09211e0 100644
> > --- a/hw/i386/multiboot.c
> > +++ b/hw/i386/multiboot.c
> > @@ -124,7 +124,7 @@ static void mb_add_mod(MultibootState *s,
> >      s->mb_mods_count++;
> >  }
> >  
> > -int load_multiboot(void *fw_cfg,
> > +int load_multiboot(FWCfgState *fw_cfg,
> >                     FILE *f,
> >                     const char *kernel_filename,
> >                     const char *initrd_filename,
> > diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> > index 0d6e72b..3c12b55 100644
> > --- a/hw/i386/pc.c
> > +++ b/hw/i386/pc.c
> > @@ -569,9 +569,9 @@ 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 FWCfgState *bochs_bios_init(void)
> >  {
> > -    void *fw_cfg;
> > +    FWCfgState *fw_cfg;
> >      uint8_t *smbios_table;
> >      size_t smbios_len;
> >      uint64_t *numa_fw_cfg;
> > @@ -648,7 +648,7 @@ static long get_file_size(FILE *f)
> >      return size;
> >  }
> >  
> > -static void load_linux(void *fw_cfg,
> > +static void load_linux(FWCfgState *fw_cfg,
> >                         const char *kernel_filename,
> >                         const char *initrd_filename,
> >                         const char *kernel_cmdline,
> > @@ -924,19 +924,19 @@ void pc_acpi_init(const char *default_dsdt)
> >      }
> >  }
> >  
> > -void *pc_memory_init(MemoryRegion *system_memory,
> > -                    const char *kernel_filename,
> > -                    const char *kernel_cmdline,
> > -                    const char *initrd_filename,
> > -                    ram_addr_t below_4g_mem_size,
> > -                    ram_addr_t above_4g_mem_size,
> > -                    MemoryRegion *rom_memory,
> > -                    MemoryRegion **ram_memory)
> > +FWCfgState *pc_memory_init(MemoryRegion *system_memory,
> > +                           const char *kernel_filename,
> > +                           const char *kernel_cmdline,
> > +                           const char *initrd_filename,
> > +                           ram_addr_t below_4g_mem_size,
> > +                           ram_addr_t above_4g_mem_size,
> > +                           MemoryRegion *rom_memory,
> > +                           MemoryRegion **ram_memory)
> >  {
> >      int linux_boot, i;
> >      MemoryRegion *ram, *option_rom_mr;
> >      MemoryRegion *ram_below_4g, *ram_above_4g;
> > -    void *fw_cfg;
> > +    FWCfgState *fw_cfg;
> >  
> >      linux_boot = (kernel_filename != NULL);
> >  
> > diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
> > index 943758a..da10e6d 100644
> > --- a/hw/i386/pc_piix.c
> > +++ b/hw/i386/pc_piix.c
> > @@ -85,7 +85,7 @@ static void pc_init1(MemoryRegion *system_memory,
> >      MemoryRegion *ram_memory;
> >      MemoryRegion *pci_memory;
> >      MemoryRegion *rom_memory;
> > -    void *fw_cfg = NULL;
> > +    FWCfgState *fw_cfg = NULL;
> >  
> >      pc_cpus_init(cpu_model);
> >      pc_acpi_init("acpi-dsdt.aml");
> > diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
> > index 31beb32..0b1b620 100644
> > --- a/hw/sparc/sun4m.c
> > +++ b/hw/sparc/sun4m.c
> > @@ -874,7 +874,7 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
> >      qemu_irq *cpu_halt;
> >      unsigned long kernel_size;
> >      DriveInfo *fd[MAX_FD];
> > -    void *fw_cfg;
> > +    FWCfgState *fw_cfg;
> >      unsigned int num_vsimms;
> >  
> >      /* init CPUs */
> > @@ -1592,7 +1592,7 @@ static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size,
> >          espdma_irq, ledma_irq;
> >      qemu_irq esp_reset, dma_enable;
> >      unsigned long kernel_size;
> > -    void *fw_cfg;
> > +    FWCfgState *fw_cfg;
> >      DeviceState *dev;
> >  
> >      /* init CPUs */
> > @@ -1793,7 +1793,7 @@ static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,
> >      qemu_irq fdc_tc;
> >      unsigned long kernel_size;
> >      DriveInfo *fd[MAX_FD];
> > -    void *fw_cfg;
> > +    FWCfgState *fw_cfg;
> >      DeviceState *dev;
> >      unsigned int i;
> >  
> > diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
> > index 0d29620..0138252 100644
> > --- a/hw/sparc64/sun4u.c
> > +++ b/hw/sparc64/sun4u.c
> > @@ -818,7 +818,7 @@ static void sun4uv_init(MemoryRegion *address_space_mem,
> >      qemu_irq *ivec_irqs, *pbm_irqs;
> >      DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
> >      DriveInfo *fd[MAX_FD];
> > -    void *fw_cfg;
> > +    FWCfgState *fw_cfg;
> >  
> >      /* init CPUs */
> >      cpu = cpu_devinit(cpu_model, hwdef);
> > -- 
> > 1.7.1
diff mbox

Patch

diff --git a/hw/i386/multiboot.h b/hw/i386/multiboot.h
index 98fb1b7..60de309 100644
--- a/hw/i386/multiboot.h
+++ b/hw/i386/multiboot.h
@@ -1,7 +1,9 @@ 
 #ifndef QEMU_MULTIBOOT_H
 #define QEMU_MULTIBOOT_H
 
-int load_multiboot(void *fw_cfg,
+#include "hw/nvram/fw_cfg.h"
+
+int load_multiboot(FWCfgState *fw_cfg,
                    FILE *f,
                    const char *kernel_filename,
                    const char *initrd_filename,
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 9bcc819..fa4b5ce 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -9,6 +9,7 @@ 
 #include "net/net.h"
 #include "exec/memory.h"
 #include "hw/i386/ioapic.h"
+#include "hw/nvram/fw_cfg.h"
 
 /* PC-style peripherals (also used by other machines).  */
 
@@ -80,14 +81,14 @@  void pc_acpi_smi_interrupt(void *opaque, int irq, int level);
 
 void pc_cpus_init(const char *cpu_model);
 void pc_acpi_init(const char *default_dsdt);
-void *pc_memory_init(MemoryRegion *system_memory,
-                    const char *kernel_filename,
-                    const char *kernel_cmdline,
-                    const char *initrd_filename,
-                    ram_addr_t below_4g_mem_size,
-                    ram_addr_t above_4g_mem_size,
-                    MemoryRegion *rom_memory,
-                    MemoryRegion **ram_memory);
+FWCfgState *pc_memory_init(MemoryRegion *system_memory,
+                           const char *kernel_filename,
+                           const char *kernel_cmdline,
+                           const char *initrd_filename,
+                           ram_addr_t below_4g_mem_size,
+                           ram_addr_t above_4g_mem_size,
+                           MemoryRegion *rom_memory,
+                           MemoryRegion **ram_memory);
 qemu_irq *pc_allocate_cpu_irq(void);
 DeviceState *pc_vga_init(ISABus *isa_bus, PCIBus *pci_bus);
 void pc_basic_device_init(ISABus *isa_bus, qemu_irq *gsi,
@@ -111,7 +112,7 @@  void ioapic_init_gsi(GSIState *gsi_state, const char *parent_name);
 
 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
                        qemu_irq sci_irq, qemu_irq smi_irq,
-                       int kvm_enabled, void *fw_cfg);
+                       int kvm_enabled, FWCfgState *fw_cfg);
 void piix4_smbus_register_device(SMBusDevice *dev, uint8_t addr);
 
 /* hpet.c */
diff --git a/include/hw/loader.h b/include/hw/loader.h
index 0958f06..15d4cc9 100644
--- a/include/hw/loader.h
+++ b/include/hw/loader.h
@@ -1,6 +1,7 @@ 
 #ifndef LOADER_H
 #define LOADER_H
 #include "qapi/qmp/qdict.h"
+#include "hw/nvram/fw_cfg.h"
 
 /* loader.c */
 int get_image_size(const char *filename);
@@ -30,7 +31,7 @@  int rom_add_blob(const char *name, const void *blob, size_t len,
 int rom_add_elf_program(const char *name, void *data, size_t datasize,
                         size_t romsize, hwaddr addr);
 int rom_load_all(void);
-void rom_set_fw(void *f);
+void rom_set_fw(FWCfgState *f);
 int rom_copy(uint8_t *dest, hwaddr addr, size_t size);
 void *rom_ptr(hwaddr addr);
 void do_info_roms(Monitor *mon, const QDict *qdict);
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 88386d7..200c297 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -435,7 +435,7 @@  static int piix4_pm_initfn(PCIDevice *dev)
 
 i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
                        qemu_irq sci_irq, qemu_irq smi_irq,
-                       int kvm_enabled, void *fw_cfg)
+                       int kvm_enabled, FWCfgState *fw_cfg)
 {
     PCIDevice *dev;
     PIIX4PMState *s;
diff --git a/hw/core/loader.c b/hw/core/loader.c
index 7507914..a711145 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -733,7 +733,7 @@  int rom_load_all(void)
     return 0;
 }
 
-void rom_set_fw(void *f)
+void rom_set_fw(FWCfgState *f)
 {
     fw_cfg = f;
 }
diff --git a/hw/i386/multiboot.c b/hw/i386/multiboot.c
index d696507..09211e0 100644
--- a/hw/i386/multiboot.c
+++ b/hw/i386/multiboot.c
@@ -124,7 +124,7 @@  static void mb_add_mod(MultibootState *s,
     s->mb_mods_count++;
 }
 
-int load_multiboot(void *fw_cfg,
+int load_multiboot(FWCfgState *fw_cfg,
                    FILE *f,
                    const char *kernel_filename,
                    const char *initrd_filename,
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 0d6e72b..3c12b55 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -569,9 +569,9 @@  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 FWCfgState *bochs_bios_init(void)
 {
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
     uint8_t *smbios_table;
     size_t smbios_len;
     uint64_t *numa_fw_cfg;
@@ -648,7 +648,7 @@  static long get_file_size(FILE *f)
     return size;
 }
 
-static void load_linux(void *fw_cfg,
+static void load_linux(FWCfgState *fw_cfg,
                        const char *kernel_filename,
                        const char *initrd_filename,
                        const char *kernel_cmdline,
@@ -924,19 +924,19 @@  void pc_acpi_init(const char *default_dsdt)
     }
 }
 
-void *pc_memory_init(MemoryRegion *system_memory,
-                    const char *kernel_filename,
-                    const char *kernel_cmdline,
-                    const char *initrd_filename,
-                    ram_addr_t below_4g_mem_size,
-                    ram_addr_t above_4g_mem_size,
-                    MemoryRegion *rom_memory,
-                    MemoryRegion **ram_memory)
+FWCfgState *pc_memory_init(MemoryRegion *system_memory,
+                           const char *kernel_filename,
+                           const char *kernel_cmdline,
+                           const char *initrd_filename,
+                           ram_addr_t below_4g_mem_size,
+                           ram_addr_t above_4g_mem_size,
+                           MemoryRegion *rom_memory,
+                           MemoryRegion **ram_memory)
 {
     int linux_boot, i;
     MemoryRegion *ram, *option_rom_mr;
     MemoryRegion *ram_below_4g, *ram_above_4g;
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
 
     linux_boot = (kernel_filename != NULL);
 
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 943758a..da10e6d 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -85,7 +85,7 @@  static void pc_init1(MemoryRegion *system_memory,
     MemoryRegion *ram_memory;
     MemoryRegion *pci_memory;
     MemoryRegion *rom_memory;
-    void *fw_cfg = NULL;
+    FWCfgState *fw_cfg = NULL;
 
     pc_cpus_init(cpu_model);
     pc_acpi_init("acpi-dsdt.aml");
diff --git a/hw/sparc/sun4m.c b/hw/sparc/sun4m.c
index 31beb32..0b1b620 100644
--- a/hw/sparc/sun4m.c
+++ b/hw/sparc/sun4m.c
@@ -874,7 +874,7 @@  static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,
     qemu_irq *cpu_halt;
     unsigned long kernel_size;
     DriveInfo *fd[MAX_FD];
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
     unsigned int num_vsimms;
 
     /* init CPUs */
@@ -1592,7 +1592,7 @@  static void sun4d_hw_init(const struct sun4d_hwdef *hwdef, ram_addr_t RAM_size,
         espdma_irq, ledma_irq;
     qemu_irq esp_reset, dma_enable;
     unsigned long kernel_size;
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
     DeviceState *dev;
 
     /* init CPUs */
@@ -1793,7 +1793,7 @@  static void sun4c_hw_init(const struct sun4c_hwdef *hwdef, ram_addr_t RAM_size,
     qemu_irq fdc_tc;
     unsigned long kernel_size;
     DriveInfo *fd[MAX_FD];
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
     DeviceState *dev;
     unsigned int i;
 
diff --git a/hw/sparc64/sun4u.c b/hw/sparc64/sun4u.c
index 0d29620..0138252 100644
--- a/hw/sparc64/sun4u.c
+++ b/hw/sparc64/sun4u.c
@@ -818,7 +818,7 @@  static void sun4uv_init(MemoryRegion *address_space_mem,
     qemu_irq *ivec_irqs, *pbm_irqs;
     DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
     DriveInfo *fd[MAX_FD];
-    void *fw_cfg;
+    FWCfgState *fw_cfg;
 
     /* init CPUs */
     cpu = cpu_devinit(cpu_model, hwdef);