[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 44/49] hw/arm/mps2-tz: Get armv7m_load_kernel() size argument from
From: |
Peter Maydell |
Subject: |
[PULL 44/49] hw/arm/mps2-tz: Get armv7m_load_kernel() size argument from RAMInfo |
Date: |
Fri, 5 Mar 2021 17:15:10 +0000 |
The armv7m_load_kernel() function takes a mem_size argument which it
expects to be the size of the memory region at guest address 0. (It
uses this argument only as a limit on how large a raw image file it
can load at address zero).
Instead of hardcoding this value, find the RAMInfo corresponding to
the 0 address and extract its size.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20210215115138.20465-20-peter.maydell@linaro.org
---
hw/arm/mps2-tz.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/hw/arm/mps2-tz.c b/hw/arm/mps2-tz.c
index 333795b029c..4dfd9a3aa52 100644
--- a/hw/arm/mps2-tz.c
+++ b/hw/arm/mps2-tz.c
@@ -525,6 +525,20 @@ static void create_non_mpc_ram(MPS2TZMachineState *mms)
}
}
+static uint32_t boot_ram_size(MPS2TZMachineState *mms)
+{
+ /* Return the size of the RAM block at guest address zero */
+ const RAMInfo *p;
+ MPS2TZMachineClass *mmc = MPS2TZ_MACHINE_GET_CLASS(mms);
+
+ for (p = mmc->raminfo; p->name; p++) {
+ if (p->base == 0) {
+ return p->size;
+ }
+ }
+ g_assert_not_reached();
+}
+
static void mps2tz_common_init(MachineState *machine)
{
MPS2TZMachineState *mms = MPS2TZ_MACHINE(machine);
@@ -789,7 +803,8 @@ static void mps2tz_common_init(MachineState *machine)
create_non_mpc_ram(mms);
- armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename, 0x400000);
+ armv7m_load_kernel(ARM_CPU(first_cpu), machine->kernel_filename,
+ boot_ram_size(mms));
}
static void mps2_tz_idau_check(IDAUInterface *ii, uint32_t address,
--
2.20.1
- [PULL 31/49] hw/misc/mps2-fpgaio: Support SWITCH register, (continued)
- [PULL 31/49] hw/misc/mps2-fpgaio: Support SWITCH register, Peter Maydell, 2021/03/05
- [PULL 26/49] hw/arm/mps2-tz: Make SYSCLK frequency board-specific, Peter Maydell, 2021/03/05
- [PULL 37/49] hw/arm/mps2-tz: Allow PPCPortInfo structures to specify device interrupts, Peter Maydell, 2021/03/05
- [PULL 30/49] hw/misc/mps2-fpgaio: Make number of LEDs configurable by board, Peter Maydell, 2021/03/05
- [PULL 27/49] hw/misc/mps2-scc: Support configurable number of OSCCLK values, Peter Maydell, 2021/03/05
- [PULL 34/49] hw/arm/mps2-tz: Make number of IRQs board-specific, Peter Maydell, 2021/03/05
- [PULL 35/49] hw/misc/mps2-scc: Implement CFG_REG5 and CFG_REG6 for MPS3 AN524, Peter Maydell, 2021/03/05
- [PULL 46/49] hw/arm/mps2-tz: Stub out USB controller for mps3-an524, Peter Maydell, 2021/03/05
- [PULL 38/49] hw/arm/mps2-tz: Move device IRQ info to data structures, Peter Maydell, 2021/03/05
- [PULL 43/49] hw/arm/mps2-tz: Support ROMs as well as RAMs, Peter Maydell, 2021/03/05
- [PULL 44/49] hw/arm/mps2-tz: Get armv7m_load_kernel() size argument from RAMInfo,
Peter Maydell <=
- [PULL 49/49] hw/arm/mps2: Update old infocenter.arm.com URLs, Peter Maydell, 2021/03/05
- [PULL 47/49] hw/arm/mps2-tz: Provide PL031 RTC on mps3-an524, Peter Maydell, 2021/03/05
- [PULL 40/49] hw/arm/mps2-tz: Allow boards to have different PPCInfo data, Peter Maydell, 2021/03/05
- [PULL 45/49] hw/arm/mps2-tz: Add new mps3-an524 board, Peter Maydell, 2021/03/05
- [PULL 33/49] hw/arm/mps2-tz: Condition IRQ splitting on number of CPUs, not board type, Peter Maydell, 2021/03/05
- [PULL 36/49] hw/arm/mps2-tz: Correct wrong interrupt numbers for DMA and SPI, Peter Maydell, 2021/03/05
- [PULL 48/49] docs/system/arm/mps2.rst: Document the new mps3-an524 board, Peter Maydell, 2021/03/05
- [PULL 25/49] hw/display/tcx: Drop unnecessary code for handling BGR format outputs, Peter Maydell, 2021/03/05
- [PULL 42/49] hw/arm/mps2-tz: Set MachineClass default_ram info from RAMInfo data, Peter Maydell, 2021/03/05
- [PULL 39/49] hw/arm/mps2-tz: Size the uart-irq-orgate based on the number of UARTs, Peter Maydell, 2021/03/05