diff mbox series

[08/10] hw/arm/realview: Move 'loader_start' to RealviewMachineClass

Message ID 20230524145906.33156-9-philmd@linaro.org
State New
Headers show
Series hw/arm/realview: Introduce abstract RealviewMachineClass | expand

Commit Message

Philippe Mathieu-Daudé May 24, 2023, 2:59 p.m. UTC
Instead of having each machine instance resolve its loader
start address, set it once in their class_init() handler.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/arm/realview.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Richard Henderson May 24, 2023, 7:10 p.m. UTC | #1
On 5/24/23 07:59, Philippe Mathieu-Daudé wrote:
> Instead of having each machine instance resolve its loader
> start address, set it once in their class_init() handler.
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   hw/arm/realview.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
diff mbox series

Patch

diff --git a/hw/arm/realview.c b/hw/arm/realview.c
index 8a3b5a48b1..917a1b22df 100644
--- a/hw/arm/realview.c
+++ b/hw/arm/realview.c
@@ -36,6 +36,7 @@  struct RealviewMachineClass {
     int board_id;
     bool is_pb;
     hwaddr mpcore_periphbase;
+    hwaddr loader_start;
 };
 typedef struct RealviewMachineClass RealviewMachineClass;
 
@@ -376,7 +377,7 @@  static void realview_init(MachineState *machine,
 
     realview_binfo.ram_size = ram_size;
     realview_binfo.board_id = rmc->board_id;
-    realview_binfo.loader_start = (board_type == BOARD_PB_A8 ? 0x70000000 : 0);
+    realview_binfo.loader_start = rmc->loader_start;
     arm_load_kernel(ARM_CPU(first_cpu), machine, &realview_binfo);
 }
 
@@ -443,6 +444,7 @@  static void realview_pb_a8_class_init(ObjectClass *oc, void *data)
     mc->default_cpu_type = ARM_CPU_TYPE_NAME("cortex-a8");
     rmc->board_id = 0x769;
     rmc->is_pb = true;
+    rmc->loader_start = 0x70000000;
 }
 
 static void realview_pbx_a9_class_init(ObjectClass *oc, void *data)