Message ID | 1467634738-28642-7-git-send-email-clg@kaod.org |
---|---|
State | New |
Headers | show |
On 07/04/2016 02:18 PM, Cédric Le Goater wrote: > This provides support for U-Boot images which are loaded at 0x0. > > A Palmetto BMC guest can now be simply booted with : > > $ qemu-system-arm -m 256 -M palmetto-bmc -nographic -nodefaults \ > -mtdblock ./flash-palmetto-20160512040959 \ > -mtdblock ./palmetto.pnor > > The first block device uses the file './flash-palmetto-20160512040959' > which will act as a SPI flash module for the BMC, handled by the > SMC/FMC controller. The second block device uses the file > './palmetto.pnor' which is an OpenPower firmware image for a palmetto > OpenPower system. This one will be handled by the SMC/SPI controller. > > The flash images can be grabbed here : > > https://openpower.xyz/job/openbmc-build/distro=ubuntu,target=palmetto/lastSuccessfulBuild/artifact/images/palmetto/flash-palmetto > https://openpower.xyz/job/openpower-op-build/distro=ubuntu,target=palmetto/lastSuccessfulBuild/artifact/images/palmetto.pnor > > We could add a second BMC SPI flash by changing the 'num-cs' property > of the controller and emulate a golden image flash module. > > Signed-off-by: Cédric Le Goater <clg@kaod.org> > --- > hw/arm/palmetto-bmc.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/hw/arm/palmetto-bmc.c b/hw/arm/palmetto-bmc.c > index b00757dcbc69..fcbb4f197162 100644 > --- a/hw/arm/palmetto-bmc.c > +++ b/hw/arm/palmetto-bmc.c > @@ -33,6 +33,8 @@ typedef struct PalmettoBMCState { > MemoryRegion ram; > } PalmettoBMCState; > > +static bool palmetto_bmc_has_flash0; > + > static void palmetto_bmc_init_flashes(AspeedSMCState *s, const char *flashtype, > Error **errp) > { > @@ -51,6 +53,7 @@ static void palmetto_bmc_init_flashes(AspeedSMCState *s, const char *flashtype, > if (dinfo) { > qdev_prop_set_drive(fl->flash, "drive", blk_by_legacy_dinfo(dinfo), > errp); > + palmetto_bmc_has_flash0 = true; > } > m25p80_set_rom_storage(fl->flash, &fl->mmio); > qdev_init_nofail(fl->flash); > @@ -82,6 +85,21 @@ static void palmetto_bmc_init(MachineState *machine) > palmetto_bmc_init_flashes(&bmc->soc.smc, "n25q256a", &error_abort); > palmetto_bmc_init_flashes(&bmc->soc.spi, "mx25l25635f", &error_abort); > > + /* > + * Install first SMC/FMC flash content as a rom. > + */ > + if (palmetto_bmc_has_flash0) { > + AspeedSMCFlash *flash0 = &bmc->soc.smc.flashes[0]; > + MemoryRegion *flash0alias = g_new(MemoryRegion, 1); > + > + memory_region_init_alias(flash0alias, OBJECT(&bmc->soc.smc), > + "flash0alias", &flash0->mmio, 0, > + flash0->size); > + > + memory_region_add_subregion(get_system_memory(), 0, flash0alias); > + palmetto_bmc_binfo.firmware_loaded = true; This should not be there. It will break qemu when a kernel is specified on the command line. I will drop it in the next round. Thanks, C. > + } > + > palmetto_bmc_binfo.kernel_filename = machine->kernel_filename; > palmetto_bmc_binfo.initrd_filename = machine->initrd_filename; > palmetto_bmc_binfo.kernel_cmdline = machine->kernel_cmdline; >
diff --git a/hw/arm/palmetto-bmc.c b/hw/arm/palmetto-bmc.c index b00757dcbc69..fcbb4f197162 100644 --- a/hw/arm/palmetto-bmc.c +++ b/hw/arm/palmetto-bmc.c @@ -33,6 +33,8 @@ typedef struct PalmettoBMCState { MemoryRegion ram; } PalmettoBMCState; +static bool palmetto_bmc_has_flash0; + static void palmetto_bmc_init_flashes(AspeedSMCState *s, const char *flashtype, Error **errp) { @@ -51,6 +53,7 @@ static void palmetto_bmc_init_flashes(AspeedSMCState *s, const char *flashtype, if (dinfo) { qdev_prop_set_drive(fl->flash, "drive", blk_by_legacy_dinfo(dinfo), errp); + palmetto_bmc_has_flash0 = true; } m25p80_set_rom_storage(fl->flash, &fl->mmio); qdev_init_nofail(fl->flash); @@ -82,6 +85,21 @@ static void palmetto_bmc_init(MachineState *machine) palmetto_bmc_init_flashes(&bmc->soc.smc, "n25q256a", &error_abort); palmetto_bmc_init_flashes(&bmc->soc.spi, "mx25l25635f", &error_abort); + /* + * Install first SMC/FMC flash content as a rom. + */ + if (palmetto_bmc_has_flash0) { + AspeedSMCFlash *flash0 = &bmc->soc.smc.flashes[0]; + MemoryRegion *flash0alias = g_new(MemoryRegion, 1); + + memory_region_init_alias(flash0alias, OBJECT(&bmc->soc.smc), + "flash0alias", &flash0->mmio, 0, + flash0->size); + + memory_region_add_subregion(get_system_memory(), 0, flash0alias); + palmetto_bmc_binfo.firmware_loaded = true; + } + palmetto_bmc_binfo.kernel_filename = machine->kernel_filename; palmetto_bmc_binfo.initrd_filename = machine->initrd_filename; palmetto_bmc_binfo.kernel_cmdline = machine->kernel_cmdline;
This provides support for U-Boot images which are loaded at 0x0. A Palmetto BMC guest can now be simply booted with : $ qemu-system-arm -m 256 -M palmetto-bmc -nographic -nodefaults \ -mtdblock ./flash-palmetto-20160512040959 \ -mtdblock ./palmetto.pnor The first block device uses the file './flash-palmetto-20160512040959' which will act as a SPI flash module for the BMC, handled by the SMC/FMC controller. The second block device uses the file './palmetto.pnor' which is an OpenPower firmware image for a palmetto OpenPower system. This one will be handled by the SMC/SPI controller. The flash images can be grabbed here : https://openpower.xyz/job/openbmc-build/distro=ubuntu,target=palmetto/lastSuccessfulBuild/artifact/images/palmetto/flash-palmetto https://openpower.xyz/job/openpower-op-build/distro=ubuntu,target=palmetto/lastSuccessfulBuild/artifact/images/palmetto.pnor We could add a second BMC SPI flash by changing the 'num-cs' property of the controller and emulate a golden image flash module. Signed-off-by: Cédric Le Goater <clg@kaod.org> --- hw/arm/palmetto-bmc.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)