[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 06/11] hw/arm: Load -bios image as a boot ROM for npcm7xx
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v5 06/11] hw/arm: Load -bios image as a boot ROM for npcm7xx |
Date: |
Mon, 13 Jul 2020 19:50:08 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 |
On 7/9/20 2:36 AM, Havard Skinnemoen wrote:
> If a -bios option is specified on the command line, load the image into
> the internal ROM memory region, which contains the first instructions
> run by the CPU after reset.
>
> A minimal Apache-2.0-licensed boot ROM can be found at
>
> https://github.com/google/vbootrom
>
> It is by no means feature complete, but it is enough to launch the
> Nuvoton bootblock[1] from offset 0 in the flash, which in turn will
> launch u-boot and finally the Linux kernel.
Peter, should we include it as submodule with the compiled blob in
pc-bios/?
>
> [1] https://github.com/Nuvoton-Israel/bootblock
>
> Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
> Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com>
> ---
> hw/arm/npcm7xx_boards.c | 24 ++++++++++++++++++++++++
> 1 file changed, 24 insertions(+)
>
> diff --git a/hw/arm/npcm7xx_boards.c b/hw/arm/npcm7xx_boards.c
> index d78d9f991b..80cf1535f1 100644
> --- a/hw/arm/npcm7xx_boards.c
> +++ b/hw/arm/npcm7xx_boards.c
> @@ -19,8 +19,11 @@
> #include "hw/arm/boot.h"
> #include "hw/arm/npcm7xx.h"
> #include "hw/core/cpu.h"
> +#include "hw/loader.h"
> #include "qapi/error.h"
> +#include "qemu-common.h"
> #include "qemu/units.h"
> +#include "sysemu/sysemu.h"
>
> #define NPCM750_EVB_POWER_ON_STRAPS 0x00001ff7
> #define QUANTA_GSJ_POWER_ON_STRAPS 0x00001fff
> @@ -34,6 +37,25 @@ static struct arm_boot_info npcm7xx_binfo = {
> .board_id = -1,
> };
>
> +static void npcm7xx_load_bootrom(NPCM7xxState *soc)
> +{
> + if (bios_name) {
> + g_autofree char *filename = NULL;
> + int ret;
> +
> + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
> + if (!filename) {
> + error_report("Could not find ROM image '%s'", bios_name);
> + exit(1);
> + }
> + ret = load_image_mr(filename, &soc->irom);
> + if (ret < 0) {
> + error_report("Failed to load ROM image '%s'", filename);
> + exit(1);
> + }
> + }
> +}
> +
> static void npcm7xx_load_kernel(MachineState *machine, NPCM7xxState *soc)
> {
> NPCM7xxClass *sc = NPCM7XX_GET_CLASS(soc);
> @@ -73,6 +95,7 @@ static void npcm750_evb_init(MachineState *machine)
> npcm7xx_connect_dram(soc, machine->ram);
> qdev_realize(DEVICE(soc), NULL, &error_abort);
>
> + npcm7xx_load_bootrom(soc);
> npcm7xx_load_kernel(machine, soc);
> }
>
> @@ -84,6 +107,7 @@ static void quanta_gsj_init(MachineState *machine)
> npcm7xx_connect_dram(soc, machine->ram);
> qdev_realize(DEVICE(soc), NULL, &error_abort);
>
> + npcm7xx_load_bootrom(soc);
> npcm7xx_load_kernel(machine, soc);
> }
>
>
- [PATCH v5 04/11] hw/arm: Add NPCM730 and NPCM750 SoC models, (continued)
- [PATCH v5 04/11] hw/arm: Add NPCM730 and NPCM750 SoC models, Havard Skinnemoen, 2020/07/08
- Re: [PATCH v5 04/11] hw/arm: Add NPCM730 and NPCM750 SoC models, Philippe Mathieu-Daudé, 2020/07/09
- Re: [PATCH v5 04/11] hw/arm: Add NPCM730 and NPCM750 SoC models, Cédric Le Goater, 2020/07/13
- Re: [PATCH v5 04/11] hw/arm: Add NPCM730 and NPCM750 SoC models, Havard Skinnemoen, 2020/07/13
- Re: [PATCH v5 04/11] hw/arm: Add NPCM730 and NPCM750 SoC models, Philippe Mathieu-Daudé, 2020/07/14
- Re: [PATCH v5 04/11] hw/arm: Add NPCM730 and NPCM750 SoC models, Markus Armbruster, 2020/07/14
- Re: [PATCH v5 04/11] hw/arm: Add NPCM730 and NPCM750 SoC models, Philippe Mathieu-Daudé, 2020/07/14
- Re: [PATCH v5 04/11] hw/arm: Add NPCM730 and NPCM750 SoC models, Havard Skinnemoen, 2020/07/14
- Re: [PATCH v5 04/11] hw/arm: Add NPCM730 and NPCM750 SoC models, Markus Armbruster, 2020/07/15
[PATCH v5 06/11] hw/arm: Load -bios image as a boot ROM for npcm7xx, Havard Skinnemoen, 2020/07/08
- Re: [PATCH v5 06/11] hw/arm: Load -bios image as a boot ROM for npcm7xx,
Philippe Mathieu-Daudé <=
[PATCH v5 05/11] hw/arm: Add two NPCM7xx-based machines, Havard Skinnemoen, 2020/07/08
[PATCH v5 08/11] hw/mem: Stubbed out NPCM7xx Memory Controller model, Havard Skinnemoen, 2020/07/08
[PATCH v5 07/11] hw/nvram: NPCM7xx OTP device model, Havard Skinnemoen, 2020/07/08
[PATCH v5 10/11] hw/arm: Wire up BMC boot flash for npcm750-evb and quanta-gsj, Havard Skinnemoen, 2020/07/08