[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 07/12] hw/arm: Load -bios image as a boot ROM for npcm7xx
From: |
Havard Skinnemoen |
Subject: |
[PATCH v2 07/12] hw/arm: Load -bios image as a boot ROM for npcm7xx |
Date: |
Thu, 11 Jun 2020 15:30:11 -0700 |
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.
[1] https://github.com/Nuvoton-Israel/bootblock
Change-Id: I41eae4fc7786d33f532c14087e930bf1b5012562
Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
Signed-off-by: Havard Skinnemoen <hskinnemoen@google.com>
---
hw/arm/npcm7xx.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
diff --git a/hw/arm/npcm7xx.c b/hw/arm/npcm7xx.c
index a5dbf08c00..417bc16b5c 100644
--- a/hw/arm/npcm7xx.c
+++ b/hw/arm/npcm7xx.c
@@ -22,6 +22,7 @@
#include "hw/misc/unimp.h"
#include "hw/qdev-properties.h"
#include "qapi/error.h"
+#include "qemu-common.h"
#include "qemu/units.h"
#include "sysemu/sysemu.h"
@@ -270,6 +271,22 @@ static void npcm7xx_realize(DeviceState *dev, Error **errp)
}
memory_region_add_subregion(get_system_memory(), NPCM7XX_ROM_BA, &s->irom);
+ if (bios_name) {
+ g_autofree char *filename = NULL;
+ int ret;
+
+ filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+ if (!filename) {
+ error_setg(errp, "Could not find ROM image '%s'", bios_name);
+ return;
+ }
+ ret = load_image_mr(filename, &s->irom);
+ if (ret < 0) {
+ error_setg(errp, "Failed to load ROM image '%s'", filename);
+ return;
+ }
+ }
+
/* External DDR4 SDRAM */
memory_region_add_subregion(get_system_memory(), NPCM7XX_DRAM_BA, s->dram);
}
--
2.27.0.290.gba653c62da-goog
- [PATCH v2 03/12] hw/misc: Add NPCM7xx Clock Controller device model, (continued)
- [PATCH v2 03/12] hw/misc: Add NPCM7xx Clock Controller device model, Havard Skinnemoen, 2020/06/11
- [PATCH v2 01/12] npcm7xx: Add config symbol, Havard Skinnemoen, 2020/06/11
- [PATCH v2 04/12] hw/timer: Add NPCM7xx Timer device model, Havard Skinnemoen, 2020/06/11
- [PATCH v2 02/12] hw/misc: Add NPCM7xx System Global Control Registers device model, Havard Skinnemoen, 2020/06/11
- [PATCH v2 06/12] hw/arm: Add two NPCM7xx-based machines, Havard Skinnemoen, 2020/06/11
- [PATCH v2 05/12] hw/arm: Add NPCM730 and NPCM750 SoC models, Havard Skinnemoen, 2020/06/11
- [PATCH v2 08/12] hw/nvram: NPCM7xx OTP device model, Havard Skinnemoen, 2020/06/11
- [PATCH v2 07/12] hw/arm: Load -bios image as a boot ROM for npcm7xx,
Havard Skinnemoen <=
- [PATCH v2 09/12] hw/mem: Stubbed out NPCM7xx Memory Controller model, Havard Skinnemoen, 2020/06/11
- [PATCH v2 10/12] hw/ssi: NPCM7xx Flash Interface Unit device model, Havard Skinnemoen, 2020/06/11
- [PATCH v2 11/12] hw/arm: Wire up BMC boot flash for npcm750-evb and quanta-gsj, Havard Skinnemoen, 2020/06/11