[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 05/13] mac_{old|new}world: Simplify cmdline_base calculation
From: |
BALATON Zoltan |
Subject: |
[PATCH v3 05/13] mac_{old|new}world: Simplify cmdline_base calculation |
Date: |
Mon, 3 Oct 2022 22:13:19 +0200 (CEST) |
By slight reorganisation we can avoid an else branch and some code
duplication which makes it easier to follow the code.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
---
hw/ppc/mac_newworld.c | 6 +++---
hw/ppc/mac_oldworld.c | 7 +++----
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 6bc3bd19be..73b01e8c6d 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -194,9 +194,11 @@ static void ppc_core99_init(MachineState *machine)
machine->kernel_filename);
exit(1);
}
+ cmdline_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size +
+ KERNEL_GAP);
/* load initrd */
if (machine->initrd_filename) {
- initrd_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size +
KERNEL_GAP);
+ initrd_base = cmdline_base;
initrd_size = load_image_targphys(machine->initrd_filename,
initrd_base,
machine->ram_size - initrd_base);
@@ -206,8 +208,6 @@ static void ppc_core99_init(MachineState *machine)
exit(1);
}
cmdline_base = TARGET_PAGE_ALIGN(initrd_base + initrd_size);
- } else {
- cmdline_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size +
KERNEL_GAP);
}
ppc_boot_device = 'm';
} else {
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index cb67e44081..b424729a39 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -168,10 +168,11 @@ static void ppc_heathrow_init(MachineState *machine)
machine->kernel_filename);
exit(1);
}
+ cmdline_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size +
+ KERNEL_GAP);
/* load initrd */
if (machine->initrd_filename) {
- initrd_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size +
- KERNEL_GAP);
+ initrd_base = cmdline_base;
initrd_size = load_image_targphys(machine->initrd_filename,
initrd_base,
machine->ram_size - initrd_base);
@@ -181,8 +182,6 @@ static void ppc_heathrow_init(MachineState *machine)
exit(1);
}
cmdline_base = TARGET_PAGE_ALIGN(initrd_base + initrd_size);
- } else {
- cmdline_base = TARGET_PAGE_ALIGN(kernel_base + kernel_size +
KERNEL_GAP);
}
ppc_boot_device = 'm';
} else {
--
2.30.4
- Re: [PATCH v3 10/13] hw/ppc/mac.h: Move grackle-pcihost type declaration out to a header, (continued)
- [PATCH v3 13/13] mac_nvram: Use NVRAM_SIZE constant, BALATON Zoltan, 2022/10/03
- [PATCH v3 12/13] hw/ppc/mac.h: Rename to include/hw/nvram/mac_nvram.h, BALATON Zoltan, 2022/10/03
- [PATCH v3 07/13] mac_{old|new}world: Reduce number of QOM casts, BALATON Zoltan, 2022/10/03
- [PATCH v3 08/13] hw/ppc/mac.h: Move newworld specific parts out from shared header, BALATON Zoltan, 2022/10/03
- [PATCH v3 02/13] mac_oldworld: Drop some more variables, BALATON Zoltan, 2022/10/03
- [PATCH v3 04/13] mac_{old|new}world: Avoid else branch by setting default value, BALATON Zoltan, 2022/10/03
- [PATCH v3 11/13] hw/ppc/mac.h: Move PROM and KERNEL defines to board code, BALATON Zoltan, 2022/10/03
- [PATCH v3 03/13] mac_{old|new}world: Set tbfreq at declaration, BALATON Zoltan, 2022/10/03
- [PATCH v3 01/13] mac_newworld: Drop some variables, BALATON Zoltan, 2022/10/03
- [PATCH v3 05/13] mac_{old|new}world: Simplify cmdline_base calculation,
BALATON Zoltan <=
- [PATCH v3 09/13] hw/ppc/mac.h: Move macio specific parts out from shared header, BALATON Zoltan, 2022/10/03
- Re: [PATCH v3 00/13] Misc ppc/mac machines clean up, BALATON Zoltan, 2022/10/11