[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 03/11] hw/mips/loongson3_virt: Have fw_conf_init() access local l
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH 03/11] hw/mips/loongson3_virt: Have fw_conf_init() access local loaderparams |
Date: |
Sun, 12 Jan 2025 22:58:27 +0100 |
'loaderparams' is declared statically. Let fw_conf_init()
access its 'cpu_freq' and 'ram_size' fields.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/mips/loongson3_virt.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/hw/mips/loongson3_virt.c b/hw/mips/loongson3_virt.c
index 4b19941c1dc..032ff92383e 100644
--- a/hw/mips/loongson3_virt.c
+++ b/hw/mips/loongson3_virt.c
@@ -280,7 +280,7 @@ static void fw_cfg_boot_set(void *opaque, const char
*boot_device,
fw_cfg_modify_i16(opaque, FW_CFG_BOOT_DEVICE, boot_device[0]);
}
-static void fw_conf_init(unsigned long ram_size)
+static void fw_conf_init(void)
{
static const uint8_t suspend[6] = {128, 0, 0, 129, 128, 128};
FWCfgState *fw_cfg;
@@ -289,9 +289,9 @@ static void fw_conf_init(unsigned long ram_size)
fw_cfg = fw_cfg_init_mem_wide(cfg_addr, cfg_addr + 8, 8, 0, NULL);
fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS,
(uint16_t)current_machine->smp.cpus);
fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS,
(uint16_t)current_machine->smp.max_cpus);
- fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size);
+ fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, loaderparams.ram_size);
fw_cfg_add_i32(fw_cfg, FW_CFG_MACHINE_VERSION, 1);
- fw_cfg_add_i64(fw_cfg, FW_CFG_CPU_FREQ, get_cpu_freq_hz());
+ fw_cfg_add_i64(fw_cfg, FW_CFG_CPU_FREQ, loaderparams.cpu_freq);
fw_cfg_add_file(fw_cfg, "etc/system-states",
g_memdup2(suspend, sizeof(suspend)), sizeof(suspend));
@@ -635,9 +635,9 @@ static void mips_loongson3_virt_init(MachineState *machine)
* Please use -L to set the BIOS path and -bios to set bios name.
*/
+ loaderparams.cpu_freq = get_cpu_freq_hz();
+ loaderparams.ram_size = ram_size;
if (kernel_filename) {
- loaderparams.cpu_freq = get_cpu_freq_hz();
- loaderparams.ram_size = ram_size;
loaderparams.kernel_filename = kernel_filename;
loaderparams.kernel_cmdline = kernel_cmdline;
loaderparams.initrd_filename = initrd_filename;
@@ -663,7 +663,7 @@ static void mips_loongson3_virt_init(MachineState *machine)
exit(1);
}
- fw_conf_init(ram_size);
+ fw_conf_init();
}
loongson3_virt_devices_init(machine, liointc);
--
2.47.1
- [PATCH 00/11] hw/mips/loongson3: Remove uses of &first_cpu global, Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 01/11] hw/mips/loongson3_virt: Factor generic_cpu_reset() out, Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 02/11] hw/mips/loongson3_virt: Keep reference of vCPUs in machine_init(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 03/11] hw/mips/loongson3_virt: Have fw_conf_init() access local loaderparams,
Philippe Mathieu-Daudé <=
- [PATCH 04/11] hw/mips/loongson3_virt: Pass CPU argument to get_cpu_freq_hz(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 05/11] hw/mips/loongson3_bootp: Include missing headers, Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 06/11] hw/mips/loongson3: Propagate cpu_count to init_loongson_params(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 07/11] hw/mips/loongson3_virt: Propagate cpu_count to init_boot_param(), Philippe Mathieu-Daudé, 2025/01/12
- [PATCH 08/11] hw/mips/loongson3_bootp: Propagate processor_id to init_cpu_info(), Philippe Mathieu-Daudé, 2025/01/12