[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/14] mac_{old|new}world: Set tbfreq at declaration
From: |
Mark Cave-Ayland |
Subject: |
[PULL 03/14] mac_{old|new}world: Set tbfreq at declaration |
Date: |
Mon, 31 Oct 2022 20:14:24 +0000 |
From: BALATON Zoltan <balaton@eik.bme.hu>
The tbfreq variable is only set once in an if-else which can be done
at the variable declaration saving some lines of code and making it
simpler.
Signed-off-by: BALATON Zoltan <balaton@eik.bme.hu>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id:
<15668da8eb8bad4561428a5f25b02f91e16d9c1b.1666957578.git.balaton@eik.bme.hu>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/ppc/mac_newworld.c | 9 +--------
hw/ppc/mac_oldworld.c | 9 +--------
2 files changed, 2 insertions(+), 16 deletions(-)
diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c
index 27e4e8d136..6327694f85 100644
--- a/hw/ppc/mac_newworld.c
+++ b/hw/ppc/mac_newworld.c
@@ -130,7 +130,7 @@ static void ppc_core99_init(MachineState *machine)
DeviceState *dev, *pic_dev;
DeviceState *uninorth_internal_dev = NULL, *uninorth_agp_dev = NULL;
hwaddr nvram_addr = 0xFFF04000;
- uint64_t tbfreq;
+ uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
/* init CPUs */
for (i = 0; i < machine->smp.cpus; i++) {
@@ -343,13 +343,6 @@ static void ppc_core99_init(MachineState *machine)
has_adb = (core99_machine->via_config == CORE99_VIA_CONFIG_CUDA ||
core99_machine->via_config == CORE99_VIA_CONFIG_PMU_ADB);
- /* Timebase Frequency */
- if (kvm_enabled()) {
- tbfreq = kvmppc_get_tbfreq();
- } else {
- tbfreq = TBFREQ;
- }
-
/* init basic PC hardware */
pci_bus = PCI_HOST_BRIDGE(uninorth_pci)->bus;
diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c
index 86512d31ad..5cabc410e7 100644
--- a/hw/ppc/mac_oldworld.c
+++ b/hw/ppc/mac_oldworld.c
@@ -99,7 +99,7 @@ static void ppc_heathrow_init(MachineState *machine)
uint16_t ppc_boot_device;
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
void *fw_cfg;
- uint64_t tbfreq;
+ uint64_t tbfreq = kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ;
/* init CPUs */
for (i = 0; i < machine->smp.cpus; i++) {
@@ -223,13 +223,6 @@ static void ppc_heathrow_init(MachineState *machine)
}
}
- /* Timebase Frequency */
- if (kvm_enabled()) {
- tbfreq = kvmppc_get_tbfreq();
- } else {
- tbfreq = TBFREQ;
- }
-
/* Grackle PCI host bridge */
grackle_dev = qdev_new(TYPE_GRACKLE_PCI_HOST_BRIDGE);
qdev_prop_set_uint32(grackle_dev, "ofw-addr", 0x80000000);
--
2.30.2
- [PULL 00/14] qemu-macppc queue 20221031, Mark Cave-Ayland, 2022/10/31
- [PULL 01/14] mac_newworld: Drop some variables, Mark Cave-Ayland, 2022/10/31
- [PULL 02/14] mac_oldworld: Drop some more variables, Mark Cave-Ayland, 2022/10/31
- [PULL 04/14] mac_{old|new}world: Avoid else branch by setting default value, Mark Cave-Ayland, 2022/10/31
- [PULL 05/14] mac_newworld: Clean up creation of Uninorth devices, Mark Cave-Ayland, 2022/10/31
- [PULL 03/14] mac_{old|new}world: Set tbfreq at declaration,
Mark Cave-Ayland <=
- [PULL 06/14] mac_{old|new}world: Reduce number of QOM casts, Mark Cave-Ayland, 2022/10/31
- [PULL 07/14] hw/ppc/mac.h: Move newworld specific parts out from shared header, Mark Cave-Ayland, 2022/10/31
- [PULL 08/14] hw/ppc/mac.h: Move macio specific parts out from shared header, Mark Cave-Ayland, 2022/10/31
- [PULL 09/14] hw/ppc/mac.h: Move grackle-pcihost type declaration out to a header, Mark Cave-Ayland, 2022/10/31
- [PULL 10/14] hw/ppc/mac.h: Move PROM and KERNEL defines to board code, Mark Cave-Ayland, 2022/10/31
- [PULL 12/14] mac_nvram: Use NVRAM_SIZE constant, Mark Cave-Ayland, 2022/10/31
- [PULL 11/14] hw/ppc/mac.h: Rename to include/hw/nvram/mac_nvram.h, Mark Cave-Ayland, 2022/10/31
- [PULL 13/14] mac_{old|new}world: Code style fix adding missing braces to if-s, Mark Cave-Ayland, 2022/10/31
- [PULL 14/14] mac_newworld: Turn CORE99_VIA_CONFIG defines into an enum, Mark Cave-Ayland, 2022/10/31