qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] turn firmware image filename into a machine opt


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH] turn firmware image filename into a machine option
Date: Tue, 01 Oct 2013 15:32:10 +0200

> > --- a/hw/arm/highbank.c
> > +++ b/hw/arm/highbank.c
> > @@ -250,15 +250,15 @@ static void calxeda_init(QEMUMachineInitArgs *args, 
> > enum cxmachines machine)
> >       sysram = g_new(MemoryRegion, 1);
> >       memory_region_init_ram(sysram, NULL, "highbank.sysram", 0x8000);
> >       memory_region_add_subregion(sysmem, 0xfff88000, sysram);
> > -    if (bios_name != NULL) {
> > -        sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> > +    if (args->firmware != NULL) {
> > +        sysboot_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, 
> > args->firmware);
> >           if (sysboot_filename != NULL) {
> >               uint32_t filesize = get_image_size(sysboot_filename);
> >               if (load_image_targphys("sysram.bin", 0xfff88000, filesize)<  
> > 0) {
> > -                hw_error("Unable to load %s\n", bios_name);
> > +                hw_error("Unable to load %s\n", args->firmware);
> >               }
> >           } else {
> > -           hw_error("Unable to find %s\n", bios_name);
> > +           hw_error("Unable to find %s\n", args->firmware);
> >           }
> >       }
> >
> > diff --git a/hw/i386/pc.c b/hw/i386/pc.c
> > index 0c313fe..3e3c9c1 100644
> > --- a/hw/i386/pc.c
> > +++ b/hw/i386/pc.c
> > @@ -1112,7 +1112,8 @@ FWCfgState *pc_memory_init(MemoryRegion 
> > *system_memory,
> >                              ram_addr_t above_4g_mem_size,
> >                              MemoryRegion *rom_memory,
> >                              MemoryRegion **ram_memory,
> > -                           PcGuestInfo *guest_info)
> > +                           PcGuestInfo *guest_info,
> > +                           const char *firmware)
> 
> Looking at this I think it'd make more sense to convert all users of 
> bios_name to instead base on local variables and fetch the firmware name 
> directly from the firmware machine opt. If you like, add a helper to 
> make the conversion easier :).
> 
> But that way we don't have to touch function headers and bloat them even 
> more than they are today.

For most other machines (such as the calxeda quoted above) I don't have
to touch the prototypes but just replace the global bios_name with
QemuMachineInitArgs->firmware.

pc is special here as the bios init is deeply nested.  Maybe we should
pass down the whole QemuMachineInitArgs instead ...

cheers,
  Gerd





reply via email to

[Prev in Thread] Current Thread [Next in Thread]