From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958305156394.9143735362187; Fri, 28 Oct 2022 04:58:25 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNyK-0001gn-Ne; Fri, 28 Oct 2022 07:56:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyI-0001f2-84; Fri, 28 Oct 2022 07:56:22 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyE-0006KG-So; Fri, 28 Oct 2022 07:56:22 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 5A09375A150; Fri, 28 Oct 2022 13:56:17 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 09F2775A135; Fri, 28 Oct 2022 13:56:17 +0200 (CEST) Message-Id: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 01/19] mac_newworld: Drop some variables To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:17 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, PP_MIME_FAKE_ASCII_TEXT=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958306463100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Values not used frequently enough may not worth putting in a local variable, especially with names almost as long as the original value because that does not improve readability, to the contrary it makes it harder to see what value is used. Drop a few such variables. This is the same clean up that was done for mac_oldworld in commit b8df32555ce5. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud\ufffd\ufffd Reviewed-by: Mark Cave-Ayland --- hw/ppc/mac_newworld.c | 65 +++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index cf7eb72391..27e4e8d136 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -106,18 +106,13 @@ static void ppc_core99_reset(void *opaque) /* PowerPC Mac99 hardware initialisation */ static void ppc_core99_init(MachineState *machine) { - ram_addr_t ram_size =3D machine->ram_size; - const char *bios_name =3D machine->firmware ?: PROM_FILENAME; - const char *kernel_filename =3D machine->kernel_filename; - const char *kernel_cmdline =3D machine->kernel_cmdline; - const char *initrd_filename =3D machine->initrd_filename; - const char *boot_device =3D machine->boot_config.order; Core99MachineState *core99_machine =3D CORE99_MACHINE(machine); PowerPCCPU *cpu =3D NULL; CPUPPCState *env =3D NULL; char *filename; IrqLines *openpic_irqs; - int linux_boot, i, j, k; + int i, j, k, ppc_boot_device, machine_arch, bios_size; + const char *bios_name =3D machine->firmware ?: PROM_FILENAME; MemoryRegion *bios =3D g_new(MemoryRegion, 1); hwaddr kernel_base, initrd_base, cmdline_base =3D 0; long kernel_size, initrd_size; @@ -129,22 +124,16 @@ static void ppc_core99_init(MachineState *machine) MACIOIDEState *macio_ide; BusState *adb_bus; MacIONVRAMState *nvr; - int bios_size; - int ppc_boot_device; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; void *fw_cfg; - int machine_arch; SysBusDevice *s; DeviceState *dev, *pic_dev; DeviceState *uninorth_internal_dev =3D NULL, *uninorth_agp_dev =3D NUL= L; hwaddr nvram_addr =3D 0xFFF04000; uint64_t tbfreq; - unsigned int smp_cpus =3D machine->smp.cpus; - - linux_boot =3D (kernel_filename !=3D NULL); =20 /* init CPUs */ - for (i =3D 0; i < smp_cpus; i++) { + for (i =3D 0; i < machine->smp.cpus; i++) { cpu =3D POWERPC_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 @@ -184,7 +173,7 @@ static void ppc_core99_init(MachineState *machine) exit(1); } =20 - if (linux_boot) { + if (machine->kernel_filename) { int bswap_needed; =20 #ifdef BSWAP_NEEDED @@ -194,29 +183,31 @@ static void ppc_core99_init(MachineState *machine) #endif kernel_base =3D KERNEL_LOAD_ADDR; =20 - kernel_size =3D load_elf(kernel_filename, NULL, + kernel_size =3D load_elf(machine->kernel_filename, NULL, translate_kernel_address, NULL, NULL, NULL, NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0); if (kernel_size < 0) - kernel_size =3D load_aout(kernel_filename, kernel_base, - ram_size - kernel_base, bswap_needed, - TARGET_PAGE_SIZE); + kernel_size =3D load_aout(machine->kernel_filename, kernel_bas= e, + machine->ram_size - kernel_base, + bswap_needed, TARGET_PAGE_SIZE); if (kernel_size < 0) - kernel_size =3D load_image_targphys(kernel_filename, + kernel_size =3D load_image_targphys(machine->kernel_filename, kernel_base, - ram_size - kernel_base); + machine->ram_size - kernel_b= ase); if (kernel_size < 0) { - error_report("could not load kernel '%s'", kernel_filename); + error_report("could not load kernel '%s'", + machine->kernel_filename); exit(1); } /* load initrd */ - if (initrd_filename) { + if (machine->initrd_filename) { initrd_base =3D TARGET_PAGE_ALIGN(kernel_base + kernel_size + = KERNEL_GAP); - initrd_size =3D load_image_targphys(initrd_filename, initrd_ba= se, - ram_size - initrd_base); + initrd_size =3D load_image_targphys(machine->initrd_filename, + initrd_base, + machine->ram_size - initrd_b= ase); if (initrd_size < 0) { error_report("could not load initial ram disk '%s'", - initrd_filename); + machine->initrd_filename); exit(1); } cmdline_base =3D TARGET_PAGE_ALIGN(initrd_base + initrd_size); @@ -235,9 +226,10 @@ static void ppc_core99_init(MachineState *machine) /* We consider that NewWorld PowerMac never have any floppy drive * For now, OHW cannot boot from the network. */ - for (i =3D 0; boot_device[i] !=3D '\0'; i++) { - if (boot_device[i] >=3D 'c' && boot_device[i] <=3D 'f') { - ppc_boot_device =3D boot_device[i]; + for (i =3D 0; machine->boot_config.order[i] !=3D '\0'; i++) { + if (machine->boot_config.order[i] >=3D 'c' && + machine->boot_config.order[i] <=3D 'f') { + ppc_boot_device =3D machine->boot_config.order[i]; break; } } @@ -254,8 +246,8 @@ static void ppc_core99_init(MachineState *machine) memory_region_add_subregion(get_system_memory(), 0xf8000000, sysbus_mmio_get_region(s, 0)); =20 - openpic_irqs =3D g_new0(IrqLines, smp_cpus); - for (i =3D 0; i < smp_cpus; i++) { + openpic_irqs =3D g_new0(IrqLines, machine->smp.cpus); + for (i =3D 0; i < machine->smp.cpus; i++) { /* Mac99 IRQ connection between OpenPIC outputs pins * and PowerPC input pins */ @@ -398,7 +390,7 @@ static void ppc_core99_init(MachineState *machine) /* OpenPIC */ s =3D SYS_BUS_DEVICE(pic_dev); k =3D 0; - for (i =3D 0; i < smp_cpus; i++) { + for (i =3D 0; i < machine->smp.cpus; i++) { for (j =3D 0; j < OPENPIC_OUTPUT_NB; j++) { sysbus_connect_irq(s, k++, openpic_irqs[i].irq[j]); } @@ -480,15 +472,16 @@ static void ppc_core99_init(MachineState *machine) sysbus_mmio_map(s, 0, CFG_ADDR); sysbus_mmio_map(s, 1, CFG_ADDR + 2); =20 - fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)smp_cpus); + fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)machine->smp.cpus); fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)machine->smp.max_cpu= s); - fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); + fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size); fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, machine_arch); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); - if (kernel_cmdline) { + if (machine->kernel_cmdline) { fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, cmdline_base); - pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, kernel= _cmdline); + pstrcpy_targphys("cmdline", cmdline_base, TARGET_PAGE_SIZE, + machine->kernel_cmdline); } else { fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_CMDLINE, 0); } --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958233128873.8728107709871; Fri, 28 Oct 2022 04:57:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNyJ-0001fg-9o; Fri, 28 Oct 2022 07:56:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyI-0001ez-53; Fri, 28 Oct 2022 07:56:22 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyF-0006KS-Nc; Fri, 28 Oct 2022 07:56:21 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 3EF4075A159; Fri, 28 Oct 2022 13:56:18 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 1503475A135; Fri, 28 Oct 2022 13:56:18 +0200 (CEST) Message-Id: <1b9a448431d9b1198432151af0511316cfc20d21.1666957578.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 02/19] mac_oldworld: Drop some more variables To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:18 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, PP_MIME_FAKE_ASCII_TEXT=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958234279100005 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Drop some more local variables additionally to commit b8df32555ce5 to match clean ups done to mac_newwold in previous patch. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud\ufffd\ufffd Reviewed-by: Mark Cave-Ayland --- hw/ppc/mac_oldworld.c | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 03732ca7ed..86512d31ad 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -80,14 +80,13 @@ static void ppc_heathrow_reset(void *opaque) =20 static void ppc_heathrow_init(MachineState *machine) { - ram_addr_t ram_size =3D machine->ram_size; const char *bios_name =3D machine->firmware ?: PROM_FILENAME; - const char *boot_device =3D machine->boot_config.order; PowerPCCPU *cpu =3D NULL; CPUPPCState *env =3D NULL; char *filename; - int i; + int i, bios_size; MemoryRegion *bios =3D g_new(MemoryRegion, 1); + uint64_t bios_addr; uint32_t kernel_base, initrd_base, cmdline_base =3D 0; int32_t kernel_size, initrd_size; PCIBus *pci_bus; @@ -97,16 +96,13 @@ static void ppc_heathrow_init(MachineState *machine) SysBusDevice *s; DeviceState *dev, *pic_dev, *grackle_dev; BusState *adb_bus; - uint64_t bios_addr; - int bios_size; - unsigned int smp_cpus =3D machine->smp.cpus; uint16_t ppc_boot_device; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; void *fw_cfg; uint64_t tbfreq; =20 /* init CPUs */ - for (i =3D 0; i < smp_cpus; i++) { + for (i =3D 0; i < machine->smp.cpus; i++) { cpu =3D POWERPC_CPU(cpu_create(machine->cpu_type)); env =3D &cpu->env; =20 @@ -116,9 +112,9 @@ static void ppc_heathrow_init(MachineState *machine) } =20 /* allocate RAM */ - if (ram_size > 2047 * MiB) { + if (machine->ram_size > 2047 * MiB) { error_report("Too much memory for this machine: %" PRId64 " MB, " - "maximum 2047 MB", ram_size / MiB); + "maximum 2047 MB", machine->ram_size / MiB); exit(1); } =20 @@ -165,12 +161,12 @@ static void ppc_heathrow_init(MachineState *machine) NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0); if (kernel_size < 0) kernel_size =3D load_aout(machine->kernel_filename, kernel_bas= e, - ram_size - kernel_base, bswap_needed, - TARGET_PAGE_SIZE); + machine->ram_size - kernel_base, + bswap_needed, TARGET_PAGE_SIZE); if (kernel_size < 0) kernel_size =3D load_image_targphys(machine->kernel_filename, kernel_base, - ram_size - kernel_base); + machine->ram_size - kernel_b= ase); if (kernel_size < 0) { error_report("could not load kernel '%s'", machine->kernel_filename); @@ -182,7 +178,7 @@ static void ppc_heathrow_init(MachineState *machine) KERNEL_GAP); initrd_size =3D load_image_targphys(machine->initrd_filename, initrd_base, - ram_size - initrd_base); + machine->ram_size - initrd_b= ase); if (initrd_size < 0) { error_report("could not load initial ram disk '%s'", machine->initrd_filename); @@ -201,19 +197,22 @@ static void ppc_heathrow_init(MachineState *machine) initrd_base =3D 0; initrd_size =3D 0; ppc_boot_device =3D '\0'; - for (i =3D 0; boot_device[i] !=3D '\0'; i++) { - /* TOFIX: for now, the second IDE channel is not properly + for (i =3D 0; machine->boot_config.order[i] !=3D '\0'; i++) { + /* + * TOFIX: for now, the second IDE channel is not properly * used by OHW. The Mac floppy disk are not emulated. * For now, OHW cannot boot from the network. */ #if 0 - if (boot_device[i] >=3D 'a' && boot_device[i] <=3D 'f') { - ppc_boot_device =3D boot_device[i]; + if (machine->boot_config.order[i] >=3D 'a' && + machine->boot_config.order[i] <=3D 'f') { + ppc_boot_device =3D machine->boot_config.order[i]; break; } #else - if (boot_device[i] >=3D 'c' && boot_device[i] <=3D 'd') { - ppc_boot_device =3D boot_device[i]; + if (machine->boot_config.order[i] >=3D 'c' && + machine->boot_config.order[i] <=3D 'd') { + ppc_boot_device =3D machine->boot_config.order[i]; break; } #endif @@ -266,7 +265,7 @@ static void ppc_heathrow_init(MachineState *machine) } =20 /* Connect the heathrow PIC outputs to the 6xx bus */ - for (i =3D 0; i < smp_cpus; i++) { + for (i =3D 0; i < machine->smp.cpus; i++) { switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_6xx: /* XXX: we register only 1 output pin for heathrow PIC */ @@ -323,9 +322,9 @@ static void ppc_heathrow_init(MachineState *machine) sysbus_mmio_map(s, 0, CFG_ADDR); sysbus_mmio_map(s, 1, CFG_ADDR + 2); =20 - fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)smp_cpus); + fw_cfg_add_i16(fw_cfg, FW_CFG_NB_CPUS, (uint16_t)machine->smp.cpus); fw_cfg_add_i16(fw_cfg, FW_CFG_MAX_CPUS, (uint16_t)machine->smp.max_cpu= s); - fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)ram_size); + fw_cfg_add_i64(fw_cfg, FW_CFG_RAM_SIZE, (uint64_t)machine->ram_size); fw_cfg_add_i16(fw_cfg, FW_CFG_MACHINE_ID, ARCH_HEATHROW); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_ADDR, kernel_base); fw_cfg_add_i32(fw_cfg, FW_CFG_KERNEL_SIZE, kernel_size); --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958275982511.2595800661527; Fri, 28 Oct 2022 04:57:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNyP-0001hc-Hj; Fri, 28 Oct 2022 07:56:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyI-0001fX-RG; Fri, 28 Oct 2022 07:56:22 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyH-0006Kc-9j; Fri, 28 Oct 2022 07:56:22 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 46EDA75A160; Fri, 28 Oct 2022 13:56:19 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 2719A75A15D; Fri, 28 Oct 2022 13:56:19 +0200 (CEST) Message-Id: <15668da8eb8bad4561428a5f25b02f91e16d9c1b.1666957578.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 03/19] mac_{old|new}world: Set tbfreq at declaration To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:19 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958276374100002 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 Reviewed-by: Mark Cave-Ayland --- 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 =3D NULL, *uninorth_agp_dev =3D NUL= L; hwaddr nvram_addr =3D 0xFFF04000; - uint64_t tbfreq; + uint64_t tbfreq =3D kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ; =20 /* init CPUs */ for (i =3D 0; i < machine->smp.cpus; i++) { @@ -343,13 +343,6 @@ static void ppc_core99_init(MachineState *machine) has_adb =3D (core99_machine->via_config =3D=3D CORE99_VIA_CONFIG_CUDA = || core99_machine->via_config =3D=3D CORE99_VIA_CONFIG_PMU_ADB= ); =20 - /* Timebase Frequency */ - if (kvm_enabled()) { - tbfreq =3D kvmppc_get_tbfreq(); - } else { - tbfreq =3D TBFREQ; - } - /* init basic PC hardware */ pci_bus =3D PCI_HOST_BRIDGE(uninorth_pci)->bus; =20 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 =3D kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ; =20 /* init CPUs */ for (i =3D 0; i < machine->smp.cpus; i++) { @@ -223,13 +223,6 @@ static void ppc_heathrow_init(MachineState *machine) } } =20 - /* Timebase Frequency */ - if (kvm_enabled()) { - tbfreq =3D kvmppc_get_tbfreq(); - } else { - tbfreq =3D TBFREQ; - } - /* Grackle PCI host bridge */ grackle_dev =3D qdev_new(TYPE_GRACKLE_PCI_HOST_BRIDGE); qdev_prop_set_uint32(grackle_dev, "ofw-addr", 0x80000000); --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958387006475.6437035265426; Fri, 28 Oct 2022 04:59:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNyQ-0001iS-P4; Fri, 28 Oct 2022 07:56:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyK-0001go-Nw; Fri, 28 Oct 2022 07:56:24 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyI-0006Ko-UB; Fri, 28 Oct 2022 07:56:24 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 5AC8D75A15D; Fri, 28 Oct 2022 13:56:20 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 3454D75A156; Fri, 28 Oct 2022 13:56:20 +0200 (CEST) Message-Id: <8dac3515b29976a61dacda07752175d7531dca3c.1666957578.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 04/19] mac_{old|new}world: Avoid else branch by setting default value To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:20 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958388829100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Several variables are set in if-else branches where the else branch can be removed by setting a default value at the variable declaration which leads to simlpler code that is easier to follow. Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland --- hw/ppc/mac_newworld.c | 19 ++++--------------- hw/ppc/mac_oldworld.c | 18 ++++-------------- 2 files changed, 8 insertions(+), 29 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 6327694f85..6bc3bd19be 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -111,11 +111,11 @@ static void ppc_core99_init(MachineState *machine) CPUPPCState *env =3D NULL; char *filename; IrqLines *openpic_irqs; - int i, j, k, ppc_boot_device, machine_arch, bios_size; + int i, j, k, ppc_boot_device, machine_arch, bios_size =3D -1; const char *bios_name =3D machine->firmware ?: PROM_FILENAME; MemoryRegion *bios =3D g_new(MemoryRegion, 1); - hwaddr kernel_base, initrd_base, cmdline_base =3D 0; - long kernel_size, initrd_size; + hwaddr kernel_base =3D 0, initrd_base =3D 0, cmdline_base =3D 0; + long kernel_size =3D 0, initrd_size =3D 0; UNINHostState *uninorth_pci; PCIBus *pci_bus; PCIDevice *macio; @@ -165,8 +165,6 @@ static void ppc_core99_init(MachineState *machine) bios_size =3D load_image_targphys(filename, PROM_BASE, PROM_SI= ZE); } g_free(filename); - } else { - bios_size =3D -1; } if (bios_size < 0 || bios_size > PROM_SIZE) { error_report("could not load PowerPC bios '%s'", bios_name); @@ -174,15 +172,12 @@ static void ppc_core99_init(MachineState *machine) } =20 if (machine->kernel_filename) { - int bswap_needed; + int bswap_needed =3D 0; =20 #ifdef BSWAP_NEEDED bswap_needed =3D 1; -#else - bswap_needed =3D 0; #endif kernel_base =3D KERNEL_LOAD_ADDR; - kernel_size =3D load_elf(machine->kernel_filename, NULL, translate_kernel_address, NULL, NULL, NULL, NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0); @@ -212,16 +207,10 @@ static void ppc_core99_init(MachineState *machine) } cmdline_base =3D TARGET_PAGE_ALIGN(initrd_base + initrd_size); } else { - initrd_base =3D 0; - initrd_size =3D 0; cmdline_base =3D TARGET_PAGE_ALIGN(kernel_base + kernel_size += KERNEL_GAP); } ppc_boot_device =3D 'm'; } else { - kernel_base =3D 0; - kernel_size =3D 0; - initrd_base =3D 0; - initrd_size =3D 0; ppc_boot_device =3D '\0'; /* We consider that NewWorld PowerMac never have any floppy drive * For now, OHW cannot boot from the network. diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 5cabc410e7..cb67e44081 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -84,11 +84,11 @@ static void ppc_heathrow_init(MachineState *machine) PowerPCCPU *cpu =3D NULL; CPUPPCState *env =3D NULL; char *filename; - int i, bios_size; + int i, bios_size =3D -1; MemoryRegion *bios =3D g_new(MemoryRegion, 1); uint64_t bios_addr; - uint32_t kernel_base, initrd_base, cmdline_base =3D 0; - int32_t kernel_size, initrd_size; + uint32_t kernel_base =3D 0, initrd_base =3D 0, cmdline_base =3D 0; + int32_t kernel_size =3D 0, initrd_size =3D 0; PCIBus *pci_bus; PCIDevice *macio; MACIOIDEState *macio_ide; @@ -139,8 +139,6 @@ static void ppc_heathrow_init(MachineState *machine) bios_addr =3D PROM_BASE; } g_free(filename); - } else { - bios_size =3D -1; } if (bios_size < 0 || bios_addr - PROM_BASE + bios_size > PROM_SIZE) { error_report("could not load PowerPC bios '%s'", bios_name); @@ -148,12 +146,10 @@ static void ppc_heathrow_init(MachineState *machine) } =20 if (machine->kernel_filename) { - int bswap_needed; + int bswap_needed =3D 0; =20 #ifdef BSWAP_NEEDED bswap_needed =3D 1; -#else - bswap_needed =3D 0; #endif kernel_base =3D KERNEL_LOAD_ADDR; kernel_size =3D load_elf(machine->kernel_filename, NULL, @@ -186,16 +182,10 @@ static void ppc_heathrow_init(MachineState *machine) } cmdline_base =3D TARGET_PAGE_ALIGN(initrd_base + initrd_size); } else { - initrd_base =3D 0; - initrd_size =3D 0; cmdline_base =3D TARGET_PAGE_ALIGN(kernel_base + kernel_size += KERNEL_GAP); } ppc_boot_device =3D 'm'; } else { - kernel_base =3D 0; - kernel_size =3D 0; - initrd_base =3D 0; - initrd_size =3D 0; ppc_boot_device =3D '\0'; for (i =3D 0; machine->boot_config.order[i] !=3D '\0'; i++) { /* --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958437272862.3386518920397; Fri, 28 Oct 2022 05:00:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNyf-0001lt-S6; Fri, 28 Oct 2022 07:56:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyY-0001ix-FU; Fri, 28 Oct 2022 07:56:38 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyK-0006Kz-TH; Fri, 28 Oct 2022 07:56:38 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 6626B75A161; Fri, 28 Oct 2022 13:56:21 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 412D675A156; Fri, 28 Oct 2022 13:56:21 +0200 (CEST) Message-Id: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 05/19] mac_newworld: Clean up creation of Uninorth devices To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:21 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958439396100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Map regions in ascending otder and eorganise code a bit to avoid some casts and move Uninorth parts together. Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland --- hw/ppc/mac_newworld.c | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 6bc3bd19be..e2f456b547 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -228,13 +228,6 @@ static void ppc_core99_init(MachineState *machine) } } =20 - /* UniN init */ - dev =3D qdev_new(TYPE_UNI_NORTH); - s =3D SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(s, &error_fatal); - memory_region_add_subregion(get_system_memory(), 0xf8000000, - sysbus_mmio_get_region(s, 0)); - openpic_irqs =3D g_new0(IrqLines, machine->smp.cpus); for (i =3D 0; i < machine->smp.cpus; i++) { /* Mac99 IRQ connection between OpenPIC outputs pins @@ -275,24 +268,30 @@ static void ppc_core99_init(MachineState *machine) } } =20 + /* UniN init */ + s =3D SYS_BUS_DEVICE(qdev_new(TYPE_UNI_NORTH)); + sysbus_realize_and_unref(s, &error_fatal); + memory_region_add_subregion(get_system_memory(), 0xf8000000, + sysbus_mmio_get_region(s, 0)); + if (PPC_INPUT(env) =3D=3D PPC_FLAGS_INPUT_970) { + machine_arch =3D ARCH_MAC99_U3; /* 970 gets a U3 bus */ /* Uninorth AGP bus */ dev =3D qdev_new(TYPE_U3_AGP_HOST_BRIDGE); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); uninorth_pci =3D U3_AGP_HOST_BRIDGE(dev); s =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(s, &error_fatal); + sysbus_mmio_map(s, 0, 0xf0800000); + sysbus_mmio_map(s, 1, 0xf0c00000); /* PCI hole */ - memory_region_add_subregion(get_system_memory(), 0x80000000ULL, + memory_region_add_subregion(get_system_memory(), 0x80000000, sysbus_mmio_get_region(s, 2)); /* Register 8 MB of ISA IO space */ memory_region_add_subregion(get_system_memory(), 0xf2000000, sysbus_mmio_get_region(s, 3)); - sysbus_mmio_map(s, 0, 0xf0800000); - sysbus_mmio_map(s, 1, 0xf0c00000); - - machine_arch =3D ARCH_MAC99_U3; } else { + machine_arch =3D ARCH_MAC99; /* Use values found on a real PowerMac */ /* Uninorth AGP bus */ uninorth_agp_dev =3D qdev_new(TYPE_UNI_NORTH_AGP_HOST_BRIDGE); @@ -309,22 +308,20 @@ static void ppc_core99_init(MachineState *machine) sysbus_mmio_map(s, 0, 0xf4800000); sysbus_mmio_map(s, 1, 0xf4c00000); =20 - /* Uninorth main bus */ + /* Uninorth main bus - this must be last to make it the default */ dev =3D qdev_new(TYPE_UNI_NORTH_PCI_HOST_BRIDGE); qdev_prop_set_uint32(dev, "ofw-addr", 0xf2000000); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); uninorth_pci =3D UNI_NORTH_PCI_HOST_BRIDGE(dev); s =3D SYS_BUS_DEVICE(dev); + sysbus_realize_and_unref(s, &error_fatal); + sysbus_mmio_map(s, 0, 0xf2800000); + sysbus_mmio_map(s, 1, 0xf2c00000); /* PCI hole */ - memory_region_add_subregion(get_system_memory(), 0x80000000ULL, + memory_region_add_subregion(get_system_memory(), 0x80000000, sysbus_mmio_get_region(s, 2)); /* Register 8 MB of ISA IO space */ memory_region_add_subregion(get_system_memory(), 0xf2000000, sysbus_mmio_get_region(s, 3)); - sysbus_mmio_map(s, 0, 0xf2800000); - sysbus_mmio_map(s, 1, 0xf2c00000); - - machine_arch =3D ARCH_MAC99; } =20 machine->usb |=3D defaults_enabled() && !machine->usb_disabled; --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958349025223.4041021294338; Fri, 28 Oct 2022 04:59:09 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNyu-0001wy-I8; Fri, 28 Oct 2022 07:57:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNya-0001jF-1F; Fri, 28 Oct 2022 07:56:43 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyK-0006LK-SF; Fri, 28 Oct 2022 07:56:39 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 8A88175A162; Fri, 28 Oct 2022 13:56:22 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 5680E75A156; Fri, 28 Oct 2022 13:56:22 +0200 (CEST) Message-Id: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 06/19] mac_{old|new}world: Reduce number of QOM casts To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:22 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, PP_MIME_FAKE_ASCII_TEXT=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958350658100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" By storing the device pointers in a variable with the right type the number of QOM casts can be reduced which also makes the code more readable. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud\ufffd\ufffd Reviewed-by: Mark Cave-Ayland --- hw/ppc/mac_newworld.c | 61 ++++++++++++++++++++----------------------- hw/ppc/mac_oldworld.c | 26 ++++++++---------- 2 files changed, 39 insertions(+), 48 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index e2f456b547..4bfffa586b 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -116,18 +116,16 @@ static void ppc_core99_init(MachineState *machine) MemoryRegion *bios =3D g_new(MemoryRegion, 1); hwaddr kernel_base =3D 0, initrd_base =3D 0, cmdline_base =3D 0; long kernel_size =3D 0, initrd_size =3D 0; - UNINHostState *uninorth_pci; PCIBus *pci_bus; - PCIDevice *macio; - ESCCState *escc; bool has_pmu, has_adb; + Object *macio; MACIOIDEState *macio_ide; BusState *adb_bus; MacIONVRAMState *nvr; DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; void *fw_cfg; SysBusDevice *s; - DeviceState *dev, *pic_dev; + DeviceState *dev, *pic_dev, *uninorth_pci_dev; DeviceState *uninorth_internal_dev =3D NULL, *uninorth_agp_dev =3D NUL= L; hwaddr nvram_addr =3D 0xFFF04000; uint64_t tbfreq =3D kvm_enabled() ? kvmppc_get_tbfreq() : TBFREQ; @@ -229,6 +227,7 @@ static void ppc_core99_init(MachineState *machine) } =20 openpic_irqs =3D g_new0(IrqLines, machine->smp.cpus); + dev =3D DEVICE(cpu); for (i =3D 0; i < machine->smp.cpus; i++) { /* Mac99 IRQ connection between OpenPIC outputs pins * and PowerPC input pins @@ -236,30 +235,30 @@ static void ppc_core99_init(MachineState *machine) switch (PPC_INPUT(env)) { case PPC_FLAGS_INPUT_6xx: openpic_irqs[i].irq[OPENPIC_OUTPUT_INT] =3D - qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_INT); + qdev_get_gpio_in(dev, PPC6xx_INPUT_INT); openpic_irqs[i].irq[OPENPIC_OUTPUT_CINT] =3D - qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_INT); + qdev_get_gpio_in(dev, PPC6xx_INPUT_INT); openpic_irqs[i].irq[OPENPIC_OUTPUT_MCK] =3D - qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_MCP); + qdev_get_gpio_in(dev, PPC6xx_INPUT_MCP); /* Not connected ? */ openpic_irqs[i].irq[OPENPIC_OUTPUT_DEBUG] =3D NULL; /* Check this */ openpic_irqs[i].irq[OPENPIC_OUTPUT_RESET] =3D - qdev_get_gpio_in(DEVICE(cpu), PPC6xx_INPUT_HRESET); + qdev_get_gpio_in(dev, PPC6xx_INPUT_HRESET); break; #if defined(TARGET_PPC64) case PPC_FLAGS_INPUT_970: openpic_irqs[i].irq[OPENPIC_OUTPUT_INT] =3D - qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_INT); + qdev_get_gpio_in(dev, PPC970_INPUT_INT); openpic_irqs[i].irq[OPENPIC_OUTPUT_CINT] =3D - qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_INT); + qdev_get_gpio_in(dev, PPC970_INPUT_INT); openpic_irqs[i].irq[OPENPIC_OUTPUT_MCK] =3D - qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_MCP); + qdev_get_gpio_in(dev, PPC970_INPUT_MCP); /* Not connected ? */ openpic_irqs[i].irq[OPENPIC_OUTPUT_DEBUG] =3D NULL; /* Check this */ openpic_irqs[i].irq[OPENPIC_OUTPUT_RESET] =3D - qdev_get_gpio_in(DEVICE(cpu), PPC970_INPUT_HRESET); + qdev_get_gpio_in(dev, PPC970_INPUT_HRESET); break; #endif /* defined(TARGET_PPC64) */ default: @@ -278,9 +277,8 @@ static void ppc_core99_init(MachineState *machine) machine_arch =3D ARCH_MAC99_U3; /* 970 gets a U3 bus */ /* Uninorth AGP bus */ - dev =3D qdev_new(TYPE_U3_AGP_HOST_BRIDGE); - uninorth_pci =3D U3_AGP_HOST_BRIDGE(dev); - s =3D SYS_BUS_DEVICE(dev); + uninorth_pci_dev =3D qdev_new(TYPE_U3_AGP_HOST_BRIDGE); + s =3D SYS_BUS_DEVICE(uninorth_pci_dev); sysbus_realize_and_unref(s, &error_fatal); sysbus_mmio_map(s, 0, 0xf0800000); sysbus_mmio_map(s, 1, 0xf0c00000); @@ -309,10 +307,9 @@ static void ppc_core99_init(MachineState *machine) sysbus_mmio_map(s, 1, 0xf4c00000); =20 /* Uninorth main bus - this must be last to make it the default */ - dev =3D qdev_new(TYPE_UNI_NORTH_PCI_HOST_BRIDGE); - qdev_prop_set_uint32(dev, "ofw-addr", 0xf2000000); - uninorth_pci =3D UNI_NORTH_PCI_HOST_BRIDGE(dev); - s =3D SYS_BUS_DEVICE(dev); + uninorth_pci_dev =3D qdev_new(TYPE_UNI_NORTH_PCI_HOST_BRIDGE); + qdev_prop_set_uint32(uninorth_pci_dev, "ofw-addr", 0xf2000000); + s =3D SYS_BUS_DEVICE(uninorth_pci_dev); sysbus_realize_and_unref(s, &error_fatal); sysbus_mmio_map(s, 0, 0xf2800000); sysbus_mmio_map(s, 1, 0xf2c00000); @@ -330,24 +327,24 @@ static void ppc_core99_init(MachineState *machine) core99_machine->via_config =3D=3D CORE99_VIA_CONFIG_PMU_ADB= ); =20 /* init basic PC hardware */ - pci_bus =3D PCI_HOST_BRIDGE(uninorth_pci)->bus; + pci_bus =3D PCI_HOST_BRIDGE(uninorth_pci_dev)->bus; =20 /* MacIO */ - macio =3D pci_new(-1, TYPE_NEWWORLD_MACIO); + macio =3D OBJECT(pci_new(-1, TYPE_NEWWORLD_MACIO)); dev =3D DEVICE(macio); qdev_prop_set_uint64(dev, "frequency", tbfreq); qdev_prop_set_bit(dev, "has-pmu", has_pmu); qdev_prop_set_bit(dev, "has-adb", has_adb); =20 - escc =3D ESCC(object_resolve_path_component(OBJECT(macio), "escc")); - qdev_prop_set_chr(DEVICE(escc), "chrA", serial_hd(0)); - qdev_prop_set_chr(DEVICE(escc), "chrB", serial_hd(1)); + dev =3D DEVICE(object_resolve_path_component(macio, "escc")); + qdev_prop_set_chr(dev, "chrA", serial_hd(0)); + qdev_prop_set_chr(dev, "chrB", serial_hd(1)); =20 - pci_realize_and_unref(macio, pci_bus, &error_fatal); + pci_realize_and_unref(PCI_DEVICE(macio), pci_bus, &error_fatal); =20 - pic_dev =3D DEVICE(object_resolve_path_component(OBJECT(macio), "pic")= ); + pic_dev =3D DEVICE(object_resolve_path_component(macio, "pic")); for (i =3D 0; i < 4; i++) { - qdev_connect_gpio_out(DEVICE(uninorth_pci), i, + qdev_connect_gpio_out(uninorth_pci_dev, i, qdev_get_gpio_in(pic_dev, 0x1b + i)); } =20 @@ -379,19 +376,17 @@ static void ppc_core99_init(MachineState *machine) /* We only emulate 2 out of 3 IDE controllers for now */ ide_drive_get(hd, ARRAY_SIZE(hd)); =20 - macio_ide =3D MACIO_IDE(object_resolve_path_component(OBJECT(macio), - "ide[0]")); + macio_ide =3D MACIO_IDE(object_resolve_path_component(macio, "ide[0]")= ); macio_ide_init_drives(macio_ide, hd); =20 - macio_ide =3D MACIO_IDE(object_resolve_path_component(OBJECT(macio), - "ide[1]")); + macio_ide =3D MACIO_IDE(object_resolve_path_component(macio, "ide[1]")= ); macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]); =20 if (has_adb) { if (has_pmu) { - dev =3D DEVICE(object_resolve_path_component(OBJECT(macio), "p= mu")); + dev =3D DEVICE(object_resolve_path_component(macio, "pmu")); } else { - dev =3D DEVICE(object_resolve_path_component(OBJECT(macio), "c= uda")); + dev =3D DEVICE(object_resolve_path_component(macio, "cuda")); } =20 adb_bus =3D qdev_get_child_bus(dev, "adb.0"); diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index cb67e44081..a497507f1d 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -90,9 +90,8 @@ static void ppc_heathrow_init(MachineState *machine) uint32_t kernel_base =3D 0, initrd_base =3D 0, cmdline_base =3D 0; int32_t kernel_size =3D 0, initrd_size =3D 0; PCIBus *pci_bus; - PCIDevice *macio; + Object *macio; MACIOIDEState *macio_ide; - ESCCState *escc; SysBusDevice *s; DeviceState *dev, *pic_dev, *grackle_dev; BusState *adb_bus; @@ -231,17 +230,16 @@ static void ppc_heathrow_init(MachineState *machine) pci_bus =3D PCI_HOST_BRIDGE(grackle_dev)->bus; =20 /* MacIO */ - macio =3D pci_new(PCI_DEVFN(16, 0), TYPE_OLDWORLD_MACIO); - dev =3D DEVICE(macio); - qdev_prop_set_uint64(dev, "frequency", tbfreq); + macio =3D OBJECT(pci_new(PCI_DEVFN(16, 0), TYPE_OLDWORLD_MACIO)); + qdev_prop_set_uint64(DEVICE(macio), "frequency", tbfreq); =20 - escc =3D ESCC(object_resolve_path_component(OBJECT(macio), "escc")); - qdev_prop_set_chr(DEVICE(escc), "chrA", serial_hd(0)); - qdev_prop_set_chr(DEVICE(escc), "chrB", serial_hd(1)); + dev =3D DEVICE(object_resolve_path_component(macio, "escc")); + qdev_prop_set_chr(dev, "chrA", serial_hd(0)); + qdev_prop_set_chr(dev, "chrB", serial_hd(1)); =20 - pci_realize_and_unref(macio, pci_bus, &error_fatal); + pci_realize_and_unref(PCI_DEVICE(macio), pci_bus, &error_fatal); =20 - pic_dev =3D DEVICE(object_resolve_path_component(OBJECT(macio), "pic")= ); + pic_dev =3D DEVICE(object_resolve_path_component(macio, "pic")); for (i =3D 0; i < 4; i++) { qdev_connect_gpio_out(grackle_dev, i, qdev_get_gpio_in(pic_dev, 0x15 + i)); @@ -269,16 +267,14 @@ static void ppc_heathrow_init(MachineState *machine) =20 /* MacIO IDE */ ide_drive_get(hd, ARRAY_SIZE(hd)); - macio_ide =3D MACIO_IDE(object_resolve_path_component(OBJECT(macio), - "ide[0]")); + macio_ide =3D MACIO_IDE(object_resolve_path_component(macio, "ide[0]")= ); macio_ide_init_drives(macio_ide, hd); =20 - macio_ide =3D MACIO_IDE(object_resolve_path_component(OBJECT(macio), - "ide[1]")); + macio_ide =3D MACIO_IDE(object_resolve_path_component(macio, "ide[1]")= ); macio_ide_init_drives(macio_ide, &hd[MAX_IDE_DEVS]); =20 /* MacIO CUDA/ADB */ - dev =3D DEVICE(object_resolve_path_component(OBJECT(macio), "cuda")); + dev =3D DEVICE(object_resolve_path_component(macio, "cuda")); adb_bus =3D qdev_get_child_bus(dev, "adb.0"); dev =3D qdev_new(TYPE_ADB_KEYBOARD); qdev_realize_and_unref(dev, adb_bus, &error_fatal); --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958362995581.9985354011562; Fri, 28 Oct 2022 04:59:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNyt-0001us-7A; Fri, 28 Oct 2022 07:56:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyZ-0001jB-Mm; Fri, 28 Oct 2022 07:56:43 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyL-0006LX-1F; Fri, 28 Oct 2022 07:56:39 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 8A16A75A165; Fri, 28 Oct 2022 13:56:23 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 63B9C75A163; Fri, 28 Oct 2022 13:56:23 +0200 (CEST) Message-Id: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 07/19] hw/ppc/mac.h: Move newworld specific parts out from shared header To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:23 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958364796100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Move the parts specific to and only used by mac99 out from the shared mac.h into mac_newworld.c where they better belong. Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland --- hw/ppc/mac.h | 24 ------------------------ hw/ppc/mac_newworld.c | 19 +++++++++++++++++++ hw/ppc/mac_oldworld.c | 1 + 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index a1fa8f8e41..e97087c7e7 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -26,15 +26,8 @@ #ifndef PPC_MAC_H #define PPC_MAC_H =20 -#include "qemu/units.h" #include "exec/memory.h" -#include "hw/boards.h" #include "hw/sysbus.h" -#include "hw/input/adb.h" -#include "hw/misc/mos6522.h" -#include "hw/pci/pci_host.h" -#include "hw/pci-host/uninorth.h" -#include "qom/object.h" =20 #define NVRAM_SIZE 0x2000 #define PROM_FILENAME "openbios-ppc" @@ -65,23 +58,6 @@ #define NEWWORLD_EXTING_GPIO1 0x2f #define NEWWORLD_EXTING_GPIO9 0x37 =20 -/* Core99 machine */ -#define TYPE_CORE99_MACHINE MACHINE_TYPE_NAME("mac99") -typedef struct Core99MachineState Core99MachineState; -DECLARE_INSTANCE_CHECKER(Core99MachineState, CORE99_MACHINE, - TYPE_CORE99_MACHINE) - -#define CORE99_VIA_CONFIG_CUDA 0x0 -#define CORE99_VIA_CONFIG_PMU 0x1 -#define CORE99_VIA_CONFIG_PMU_ADB 0x2 - -struct Core99MachineState { - /*< private >*/ - MachineState parent; - - uint8_t via_config; -}; - /* Grackle PCI */ #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost" =20 diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 4bfffa586b..873c9f5cb4 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -48,10 +48,13 @@ =20 #include "qemu/osdep.h" #include "qemu/datadir.h" +#include "qemu/units.h" #include "qapi/error.h" #include "hw/ppc/ppc.h" #include "hw/qdev-properties.h" #include "hw/ppc/mac.h" +#include "hw/boards.h" +#include "hw/pci-host/uninorth.h" #include "hw/input/adb.h" #include "hw/ppc/mac_dbdma.h" #include "hw/pci/pci.h" @@ -83,6 +86,22 @@ #define PROM_BASE 0xfff00000 #define PROM_SIZE (1 * MiB) =20 +#define TYPE_CORE99_MACHINE MACHINE_TYPE_NAME("mac99") +typedef struct Core99MachineState Core99MachineState; +DECLARE_INSTANCE_CHECKER(Core99MachineState, CORE99_MACHINE, + TYPE_CORE99_MACHINE) + +#define CORE99_VIA_CONFIG_CUDA 0x0 +#define CORE99_VIA_CONFIG_PMU 0x1 +#define CORE99_VIA_CONFIG_PMU_ADB 0x2 + +struct Core99MachineState { + /*< private >*/ + MachineState parent; + + uint8_t via_config; +}; + static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) { diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index a497507f1d..f323a49d7a 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -31,6 +31,7 @@ #include "hw/ppc/ppc.h" #include "hw/qdev-properties.h" #include "mac.h" +#include "hw/boards.h" #include "hw/input/adb.h" #include "sysemu/sysemu.h" #include "net/net.h" --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958234146789.930021397043; Fri, 28 Oct 2022 04:57:14 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNyk-0001nv-7r; Fri, 28 Oct 2022 07:56:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyZ-0001jD-SX; Fri, 28 Oct 2022 07:56:43 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyM-0006Ly-3e; Fri, 28 Oct 2022 07:56:39 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 932DF75A156; Fri, 28 Oct 2022 13:56:24 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 702E875A150; Fri, 28 Oct 2022 13:56:24 +0200 (CEST) Message-Id: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 08/19] hw/ppc/mac.h: Move macio specific parts out from shared header To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:24 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, PP_MIME_FAKE_ASCII_TEXT=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958236199100007 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Move the parts specific to and only used by macio out from the shared mac.h into macio.c where they better belong. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud\ufffd\ufffd Reviewed-by: Mark Cave-Ayland --- hw/misc/macio/macio.c | 5 +++-- hw/ppc/mac.h | 23 ----------------------- include/hw/misc/macio/macio.h | 21 +++++++++++++++++++++ 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index c1fad43f6c..f9f0758b03 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -37,8 +37,9 @@ #include "hw/intc/heathrow_pic.h" #include "trace.h" =20 -/* Note: this code is strongly inspirated from the corresponding code - * in PearPC */ +#define ESCC_CLOCK 3686400 + +/* Note: this code is strongly inspired by the corresponding code in PearP= C */ =20 /* * The mac-io has two interfaces to the ESCC. One is called "escc-legacy", diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index e97087c7e7..55cb02c990 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -35,29 +35,6 @@ #define KERNEL_LOAD_ADDR 0x01000000 #define KERNEL_GAP 0x00100000 =20 -#define ESCC_CLOCK 3686400 - -/* Old World IRQs */ -#define OLDWORLD_CUDA_IRQ 0x12 -#define OLDWORLD_ESCCB_IRQ 0x10 -#define OLDWORLD_ESCCA_IRQ 0xf -#define OLDWORLD_IDE0_IRQ 0xd -#define OLDWORLD_IDE0_DMA_IRQ 0x2 -#define OLDWORLD_IDE1_IRQ 0xe -#define OLDWORLD_IDE1_DMA_IRQ 0x3 - -/* New World IRQs */ -#define NEWWORLD_CUDA_IRQ 0x19 -#define NEWWORLD_PMU_IRQ 0x19 -#define NEWWORLD_ESCCB_IRQ 0x24 -#define NEWWORLD_ESCCA_IRQ 0x25 -#define NEWWORLD_IDE0_IRQ 0xd -#define NEWWORLD_IDE0_DMA_IRQ 0x2 -#define NEWWORLD_IDE1_IRQ 0xe -#define NEWWORLD_IDE1_DMA_IRQ 0x3 -#define NEWWORLD_EXTING_GPIO1 0x2f -#define NEWWORLD_EXTING_GPIO9 0x37 - /* Grackle PCI */ #define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost" =20 diff --git a/include/hw/misc/macio/macio.h b/include/hw/misc/macio/macio.h index 6c05f3bfd2..26cf15b1ce 100644 --- a/include/hw/misc/macio/macio.h +++ b/include/hw/misc/macio/macio.h @@ -38,6 +38,27 @@ #include "hw/ppc/openpic.h" #include "qom/object.h" =20 +/* Old World IRQs */ +#define OLDWORLD_CUDA_IRQ 0x12 +#define OLDWORLD_ESCCB_IRQ 0x10 +#define OLDWORLD_ESCCA_IRQ 0xf +#define OLDWORLD_IDE0_IRQ 0xd +#define OLDWORLD_IDE0_DMA_IRQ 0x2 +#define OLDWORLD_IDE1_IRQ 0xe +#define OLDWORLD_IDE1_DMA_IRQ 0x3 + +/* New World IRQs */ +#define NEWWORLD_CUDA_IRQ 0x19 +#define NEWWORLD_PMU_IRQ 0x19 +#define NEWWORLD_ESCCB_IRQ 0x24 +#define NEWWORLD_ESCCA_IRQ 0x25 +#define NEWWORLD_IDE0_IRQ 0xd +#define NEWWORLD_IDE0_DMA_IRQ 0x2 +#define NEWWORLD_IDE1_IRQ 0xe +#define NEWWORLD_IDE1_DMA_IRQ 0x3 +#define NEWWORLD_EXTING_GPIO1 0x2f +#define NEWWORLD_EXTING_GPIO9 0x37 + /* MacIO virtual bus */ #define TYPE_MACIO_BUS "macio-bus" OBJECT_DECLARE_SIMPLE_TYPE(MacIOBusState, MACIO_BUS) --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958327593945.9097871808991; Fri, 28 Oct 2022 04:58:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNys-0001sQ-Gm; Fri, 28 Oct 2022 07:56:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyZ-0001jE-SX; Fri, 28 Oct 2022 07:56:43 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyN-0006M8-4I; Fri, 28 Oct 2022 07:56:39 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id A5E5E75A166; Fri, 28 Oct 2022 13:56:25 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 7DC5B75A163; Fri, 28 Oct 2022 13:56:25 +0200 (CEST) Message-Id: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 09/19] hw/ppc/mac.h: Move grackle-pcihost type declaration out to a header To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:25 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958328629100004 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland --- MAINTAINERS | 1 + hw/pci-host/grackle.c | 14 +---------- hw/ppc/mac.h | 3 --- hw/ppc/mac_oldworld.c | 1 + include/hw/pci-host/grackle.h | 44 +++++++++++++++++++++++++++++++++++ 5 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 include/hw/pci-host/grackle.h diff --git a/MAINTAINERS b/MAINTAINERS index 32e495e165..8381c29759 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1345,6 +1345,7 @@ F: hw/intc/heathrow_pic.c F: hw/input/adb* F: include/hw/intc/heathrow_pic.h F: include/hw/input/adb* +F: include/hw/pci-host/grackle.h F: pc-bios/qemu_vga.ndrv =20 PReP diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c index b05facf463..e4c7303859 100644 --- a/hw/pci-host/grackle.c +++ b/hw/pci-host/grackle.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "hw/pci/pci_host.h" #include "hw/ppc/mac.h" #include "hw/qdev-properties.h" #include "hw/pci/pci.h" @@ -33,18 +32,7 @@ #include "qemu/module.h" #include "trace.h" #include "qom/object.h" - -OBJECT_DECLARE_SIMPLE_TYPE(GrackleState, GRACKLE_PCI_HOST_BRIDGE) - -struct GrackleState { - PCIHostState parent_obj; - - uint32_t ofw_addr; - qemu_irq irqs[4]; - MemoryRegion pci_mmio; - MemoryRegion pci_hole; - MemoryRegion pci_io; -}; +#include "hw/pci-host/grackle.h" =20 /* Don't know if this matches real hardware, but it agrees with OHW. */ static int pci_grackle_map_irq(PCIDevice *pci_dev, int irq_num) diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index 55cb02c990..fe77a6c6db 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -35,9 +35,6 @@ #define KERNEL_LOAD_ADDR 0x01000000 #define KERNEL_GAP 0x00100000 =20 -/* Grackle PCI */ -#define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost" - /* Mac NVRAM */ #define TYPE_MACIO_NVRAM "macio-nvram" OBJECT_DECLARE_SIMPLE_TYPE(MacIONVRAMState, MACIO_NVRAM) diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index f323a49d7a..47a1abf248 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -38,6 +38,7 @@ #include "hw/isa/isa.h" #include "hw/pci/pci.h" #include "hw/pci/pci_host.h" +#include "hw/pci-host/grackle.h" #include "hw/nvram/fw_cfg.h" #include "hw/char/escc.h" #include "hw/misc/macio/macio.h" diff --git a/include/hw/pci-host/grackle.h b/include/hw/pci-host/grackle.h new file mode 100644 index 0000000000..7ad3a779f0 --- /dev/null +++ b/include/hw/pci-host/grackle.h @@ -0,0 +1,44 @@ +/* + * QEMU Grackle PCI host (heathrow OldWorld PowerMac) + * + * Copyright (c) 2006-2007 Fabrice Bellard + * Copyright (c) 2007 Jocelyn Mayer + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#ifndef GRACKLE_H +#define GRACKLE_H + +#include "hw/pci/pci_host.h" + +#define TYPE_GRACKLE_PCI_HOST_BRIDGE "grackle-pcihost" +OBJECT_DECLARE_SIMPLE_TYPE(GrackleState, GRACKLE_PCI_HOST_BRIDGE) + +struct GrackleState { + PCIHostState parent_obj; + + uint32_t ofw_addr; + qemu_irq irqs[4]; + MemoryRegion pci_mmio; + MemoryRegion pci_hole; + MemoryRegion pci_io; +}; + +#endif --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958326404444.12161110204124; Fri, 28 Oct 2022 04:58:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNzS-0002RF-VQ; Fri, 28 Oct 2022 07:57:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyZ-0001jA-Lc; Fri, 28 Oct 2022 07:56:43 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyO-0006MH-8m; Fri, 28 Oct 2022 07:56:39 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id BE16C75A167; Fri, 28 Oct 2022 13:56:26 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 896AC75A150; Fri, 28 Oct 2022 13:56:26 +0200 (CEST) Message-Id: <5fa693334adf166d23931c81d81ada4e3441ed7d.1666957578.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 10/19] hw/ppc/mac.h: Move PROM and KERNEL defines to board code To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:26 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, PP_MIME_FAKE_ASCII_TEXT=0.001, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958328615100003 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The PROM_FILENAME and KERNEL_* defines are used by mac_oldworld and mac_newworld but they don't have to be identical so these could be moved to the individual boards. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud\ufffd\ufffd Reviewed-by: Mark Cave-Ayland --- hw/ppc/mac.h | 4 ---- hw/ppc/mac_newworld.c | 4 ++++ hw/ppc/mac_oldworld.c | 7 ++++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index fe77a6c6db..3e2df262ee 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -30,10 +30,6 @@ #include "hw/sysbus.h" =20 #define NVRAM_SIZE 0x2000 -#define PROM_FILENAME "openbios-ppc" - -#define KERNEL_LOAD_ADDR 0x01000000 -#define KERNEL_GAP 0x00100000 =20 /* Mac NVRAM */ #define TYPE_MACIO_NVRAM "macio-nvram" diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 873c9f5cb4..c75c59fe3e 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -83,9 +83,13 @@ =20 #define NDRV_VGA_FILENAME "qemu_vga.ndrv" =20 +#define PROM_FILENAME "openbios-ppc" #define PROM_BASE 0xfff00000 #define PROM_SIZE (1 * MiB) =20 +#define KERNEL_LOAD_ADDR 0x01000000 +#define KERNEL_GAP 0x00100000 + #define TYPE_CORE99_MACHINE MACHINE_TYPE_NAME("mac99") typedef struct Core99MachineState Core99MachineState; DECLARE_INSTANCE_CHECKER(Core99MachineState, CORE99_MACHINE, diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 47a1abf248..ae8e0ff30a 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -58,10 +58,15 @@ =20 #define NDRV_VGA_FILENAME "qemu_vga.ndrv" =20 -#define GRACKLE_BASE 0xfec00000 +#define PROM_FILENAME "openbios-ppc" #define PROM_BASE 0xffc00000 #define PROM_SIZE (4 * MiB) =20 +#define KERNEL_LOAD_ADDR 0x01000000 +#define KERNEL_GAP 0x00100000 + +#define GRACKLE_BASE 0xfec00000 + static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) { --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958439261906.2635475081267; Fri, 28 Oct 2022 05:00:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNzX-0002dG-AQ; Fri, 28 Oct 2022 07:57:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyb-0001jJ-8q; Fri, 28 Oct 2022 07:56:43 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyP-0006MQ-F4; Fri, 28 Oct 2022 07:56:40 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id E5E3975A15C; Fri, 28 Oct 2022 13:56:27 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 95F6A75A150; Fri, 28 Oct 2022 13:56:27 +0200 (CEST) Message-Id: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 11/19] hw/ppc/mac.h: Rename to include/hw/nvram/mac_nvram.h To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:27 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958441396100005 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" All that is left in mac.h now belongs to the nvram emulation so rename it accordingly and only include it where it is really used. Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland --- MAINTAINERS | 1 + hw/ide/macio.c | 1 - hw/intc/heathrow_pic.c | 1 - hw/intc/openpic.c | 1 - hw/misc/macio/cuda.c | 1 - hw/misc/macio/gpio.c | 1 - hw/misc/macio/macio.c | 1 - hw/misc/macio/pmu.c | 1 - hw/nvram/mac_nvram.c | 2 +- hw/pci-host/grackle.c | 1 - hw/pci-host/uninorth.c | 1 - hw/ppc/mac_newworld.c | 2 +- hw/ppc/mac_oldworld.c | 1 - include/hw/misc/macio/macio.h | 2 +- hw/ppc/mac.h =3D> include/hw/nvram/mac_nvram.h | 11 ++++++----- 15 files changed, 10 insertions(+), 18 deletions(-) rename hw/ppc/mac.h =3D> include/hw/nvram/mac_nvram.h (89%) diff --git a/MAINTAINERS b/MAINTAINERS index 8381c29759..0f179d1f38 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1328,6 +1328,7 @@ F: hw/nvram/mac_nvram.c F: hw/input/adb* F: include/hw/misc/macio/ F: include/hw/misc/mos6522.h +F: include/hw/nvram/mac_nvram.h F: include/hw/ppc/mac_dbdma.h F: include/hw/pci-host/uninorth.h F: include/hw/input/adb* diff --git a/hw/ide/macio.c b/hw/ide/macio.c index 1c15c37ec5..e604466acb 100644 --- a/hw/ide/macio.c +++ b/hw/ide/macio.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "hw/ppc/mac.h" #include "hw/ppc/mac_dbdma.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" diff --git a/hw/intc/heathrow_pic.c b/hw/intc/heathrow_pic.c index cb97c315da..13048a2735 100644 --- a/hw/intc/heathrow_pic.c +++ b/hw/intc/heathrow_pic.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "hw/ppc/mac.h" #include "migration/vmstate.h" #include "qemu/module.h" #include "hw/intc/heathrow_pic.h" diff --git a/hw/intc/openpic.c b/hw/intc/openpic.c index b0787e8ee7..c757adbe53 100644 --- a/hw/intc/openpic.c +++ b/hw/intc/openpic.c @@ -32,7 +32,6 @@ =20 #include "qemu/osdep.h" #include "hw/irq.h" -#include "hw/ppc/mac.h" #include "hw/pci/pci.h" #include "hw/ppc/openpic.h" #include "hw/ppc/ppc_e500.h" diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c index 1498113cfc..0d4c13319a 100644 --- a/hw/misc/macio/cuda.c +++ b/hw/misc/macio/cuda.c @@ -25,7 +25,6 @@ =20 #include "qemu/osdep.h" #include "hw/irq.h" -#include "hw/ppc/mac.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "hw/input/adb.h" diff --git a/hw/misc/macio/gpio.c b/hw/misc/macio/gpio.c index b1bcf830c3..c8ac5633b2 100644 --- a/hw/misc/macio/gpio.c +++ b/hw/misc/macio/gpio.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "hw/ppc/mac.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "hw/misc/macio/macio.h" diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index f9f0758b03..93a7c7bbc8 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -26,7 +26,6 @@ #include "qemu/osdep.h" #include "qapi/error.h" #include "qemu/module.h" -#include "hw/ppc/mac.h" #include "hw/misc/macio/cuda.h" #include "hw/pci/pci.h" #include "hw/ppc/mac_dbdma.h" diff --git a/hw/misc/macio/pmu.c b/hw/misc/macio/pmu.c index 336502a84b..70562ed8d0 100644 --- a/hw/misc/macio/pmu.c +++ b/hw/misc/macio/pmu.c @@ -29,7 +29,6 @@ */ =20 #include "qemu/osdep.h" -#include "hw/ppc/mac.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "hw/input/adb.h" diff --git a/hw/nvram/mac_nvram.c b/hw/nvram/mac_nvram.c index 11f2d31cdb..3d9ddda217 100644 --- a/hw/nvram/mac_nvram.c +++ b/hw/nvram/mac_nvram.c @@ -25,7 +25,7 @@ =20 #include "qemu/osdep.h" #include "hw/nvram/chrp_nvram.h" -#include "hw/ppc/mac.h" +#include "hw/nvram/mac_nvram.h" #include "hw/qdev-properties.h" #include "migration/vmstate.h" #include "qemu/cutils.h" diff --git a/hw/pci-host/grackle.c b/hw/pci-host/grackle.c index e4c7303859..95945ac0f4 100644 --- a/hw/pci-host/grackle.c +++ b/hw/pci-host/grackle.c @@ -24,7 +24,6 @@ */ =20 #include "qemu/osdep.h" -#include "hw/ppc/mac.h" #include "hw/qdev-properties.h" #include "hw/pci/pci.h" #include "hw/irq.h" diff --git a/hw/pci-host/uninorth.c b/hw/pci-host/uninorth.c index d25b62d6a5..aebd44d265 100644 --- a/hw/pci-host/uninorth.c +++ b/hw/pci-host/uninorth.c @@ -24,7 +24,6 @@ =20 #include "qemu/osdep.h" #include "hw/irq.h" -#include "hw/ppc/mac.h" #include "hw/qdev-properties.h" #include "qemu/module.h" #include "hw/pci/pci.h" diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index c75c59fe3e..eb597bbe20 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -52,7 +52,7 @@ #include "qapi/error.h" #include "hw/ppc/ppc.h" #include "hw/qdev-properties.h" -#include "hw/ppc/mac.h" +#include "hw/nvram/mac_nvram.h" #include "hw/boards.h" #include "hw/pci-host/uninorth.h" #include "hw/input/adb.h" diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index ae8e0ff30a..23d9268281 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -30,7 +30,6 @@ #include "qapi/error.h" #include "hw/ppc/ppc.h" #include "hw/qdev-properties.h" -#include "mac.h" #include "hw/boards.h" #include "hw/input/adb.h" #include "sysemu/sysemu.h" diff --git a/include/hw/misc/macio/macio.h b/include/hw/misc/macio/macio.h index 26cf15b1ce..95d30a1745 100644 --- a/include/hw/misc/macio/macio.h +++ b/include/hw/misc/macio/macio.h @@ -33,7 +33,7 @@ #include "hw/misc/macio/cuda.h" #include "hw/misc/macio/gpio.h" #include "hw/misc/macio/pmu.h" -#include "hw/ppc/mac.h" +#include "hw/nvram/mac_nvram.h" #include "hw/ppc/mac_dbdma.h" #include "hw/ppc/openpic.h" #include "qom/object.h" diff --git a/hw/ppc/mac.h b/include/hw/nvram/mac_nvram.h similarity index 89% rename from hw/ppc/mac.h rename to include/hw/nvram/mac_nvram.h index 3e2df262ee..baa9f6a5a6 100644 --- a/hw/ppc/mac.h +++ b/include/hw/nvram/mac_nvram.h @@ -1,5 +1,5 @@ /* - * QEMU PowerMac emulation shared definitions and prototypes + * PowerMac NVRAM emulation * * Copyright (c) 2004-2007 Fabrice Bellard * Copyright (c) 2007 Jocelyn Mayer @@ -23,8 +23,8 @@ * THE SOFTWARE. */ =20 -#ifndef PPC_MAC_H -#define PPC_MAC_H +#ifndef MAC_NVRAM_H +#define MAC_NVRAM_H =20 #include "exec/memory.h" #include "hw/sysbus.h" @@ -47,5 +47,6 @@ struct MacIONVRAMState { uint8_t *data; }; =20 -void pmac_format_nvram_partition (MacIONVRAMState *nvr, int len); -#endif /* PPC_MAC_H */ +void pmac_format_nvram_partition(MacIONVRAMState *nvr, int len); + +#endif /* MAC_NVRAM_H */ --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958283587313.213564157016; Fri, 28 Oct 2022 04:58:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNyw-000224-Hv; Fri, 28 Oct 2022 07:57:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyb-0001jI-8G; Fri, 28 Oct 2022 07:56:43 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyQ-0006MU-A1; Fri, 28 Oct 2022 07:56:40 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id C596875A160; Fri, 28 Oct 2022 13:56:28 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id A3C2475A15D; Fri, 28 Oct 2022 13:56:28 +0200 (CEST) Message-Id: <5b53c70438dfb46837af8a094e753706b06c4ec6.1666957578.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 12/19] mac_nvram: Use NVRAM_SIZE constant To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:28 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958284743100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The NVRAM_SIZE constant was defined but not used. Rename it to MACIO_NVRAM_SIZE to match the device model and use it where appropriate. Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland --- hw/misc/macio/macio.c | 2 +- hw/ppc/mac_newworld.c | 4 ++-- include/hw/nvram/mac_nvram.h | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c index 93a7c7bbc8..08dbdd7fc0 100644 --- a/hw/misc/macio/macio.c +++ b/hw/misc/macio/macio.c @@ -226,7 +226,7 @@ static void macio_oldworld_init(Object *obj) =20 object_initialize_child(OBJECT(s), "nvram", &os->nvram, TYPE_MACIO_NVR= AM); dev =3D DEVICE(&os->nvram); - qdev_prop_set_uint32(dev, "size", 0x2000); + qdev_prop_set_uint32(dev, "size", MACIO_NVRAM_SIZE); qdev_prop_set_uint32(dev, "it_shift", 4); =20 for (i =3D 0; i < 2; i++) { diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index eb597bbe20..6b2d781dea 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -450,12 +450,12 @@ static void ppc_core99_init(MachineState *machine) nvram_addr =3D 0xFFE00000; } dev =3D qdev_new(TYPE_MACIO_NVRAM); - qdev_prop_set_uint32(dev, "size", 0x2000); + qdev_prop_set_uint32(dev, "size", MACIO_NVRAM_SIZE); qdev_prop_set_uint32(dev, "it_shift", 1); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, nvram_addr); nvr =3D MACIO_NVRAM(dev); - pmac_format_nvram_partition(nvr, 0x2000); + pmac_format_nvram_partition(nvr, MACIO_NVRAM_SIZE); /* No PCI init: the BIOS will do it */ =20 dev =3D qdev_new(TYPE_FW_CFG_MEM); diff --git a/include/hw/nvram/mac_nvram.h b/include/hw/nvram/mac_nvram.h index baa9f6a5a6..b780aca470 100644 --- a/include/hw/nvram/mac_nvram.h +++ b/include/hw/nvram/mac_nvram.h @@ -29,9 +29,8 @@ #include "exec/memory.h" #include "hw/sysbus.h" =20 -#define NVRAM_SIZE 0x2000 +#define MACIO_NVRAM_SIZE 0x2000 =20 -/* Mac NVRAM */ #define TYPE_MACIO_NVRAM "macio-nvram" OBJECT_DECLARE_SIMPLE_TYPE(MacIONVRAMState, MACIO_NVRAM) =20 --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958397070632.1022266103815; Fri, 28 Oct 2022 04:59:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNyx-00023u-9i; Fri, 28 Oct 2022 07:57:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyb-0001jK-9F; Fri, 28 Oct 2022 07:56:43 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyR-0006Mf-CF; Fri, 28 Oct 2022 07:56:40 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id D0D6074638A; Fri, 28 Oct 2022 13:56:29 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id B0CE774633D; Fri, 28 Oct 2022 13:56:29 +0200 (CEST) Message-Id: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 13/19] mac_{old|new}world: Code style fix adding missing braces to if-s To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:29 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958398892100005 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland --- hw/ppc/mac_newworld.c | 6 ++++-- hw/ppc/mac_oldworld.c | 9 ++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 6b2d781dea..37123daa6b 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -202,14 +202,16 @@ static void ppc_core99_init(MachineState *machine) kernel_size =3D load_elf(machine->kernel_filename, NULL, translate_kernel_address, NULL, NULL, NULL, NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0); - if (kernel_size < 0) + if (kernel_size < 0) { kernel_size =3D load_aout(machine->kernel_filename, kernel_bas= e, machine->ram_size - kernel_base, bswap_needed, TARGET_PAGE_SIZE); - if (kernel_size < 0) + } + if (kernel_size < 0) { kernel_size =3D load_image_targphys(machine->kernel_filename, kernel_base, machine->ram_size - kernel_b= ase); + } if (kernel_size < 0) { error_report("could not load kernel '%s'", machine->kernel_filename); diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 23d9268281..558c639202 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -160,14 +160,16 @@ static void ppc_heathrow_init(MachineState *machine) kernel_size =3D load_elf(machine->kernel_filename, NULL, translate_kernel_address, NULL, NULL, NULL, NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0); - if (kernel_size < 0) + if (kernel_size < 0) { kernel_size =3D load_aout(machine->kernel_filename, kernel_bas= e, machine->ram_size - kernel_base, bswap_needed, TARGET_PAGE_SIZE); - if (kernel_size < 0) + } + if (kernel_size < 0) { kernel_size =3D load_image_targphys(machine->kernel_filename, kernel_base, machine->ram_size - kernel_b= ase); + } if (kernel_size < 0) { error_report("could not load kernel '%s'", machine->kernel_filename); @@ -291,8 +293,9 @@ static void ppc_heathrow_init(MachineState *machine) pci_create_simple(pci_bus, -1, "pci-ohci"); } =20 - if (graphic_depth !=3D 15 && graphic_depth !=3D 32 && graphic_depth != =3D 8) + if (graphic_depth !=3D 15 && graphic_depth !=3D 32 && graphic_depth != =3D 8) { graphic_depth =3D 15; + } =20 /* No PCI init: the BIOS will do it */ =20 --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958293654585.3962770304819; Fri, 28 Oct 2022 04:58:13 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNyy-00025Y-Uh; Fri, 28 Oct 2022 07:57:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyd-0001jz-GO; Fri, 28 Oct 2022 07:56:43 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyZ-0006NG-Qi; Fri, 28 Oct 2022 07:56:43 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id DA48A75A159; Fri, 28 Oct 2022 13:56:30 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id BFA4775A150; Fri, 28 Oct 2022 13:56:30 +0200 (CEST) Message-Id: In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 14/19] mac_newworld: Turn CORE99_VIA_CONFIG defines into an enum To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:30 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958294407100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This might allow the compiler to check values. Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland --- hw/ppc/mac_newworld.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 37123daa6b..601ea518f8 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -95,15 +95,17 @@ typedef struct Core99MachineState Core99MachineState; DECLARE_INSTANCE_CHECKER(Core99MachineState, CORE99_MACHINE, TYPE_CORE99_MACHINE) =20 -#define CORE99_VIA_CONFIG_CUDA 0x0 -#define CORE99_VIA_CONFIG_PMU 0x1 -#define CORE99_VIA_CONFIG_PMU_ADB 0x2 +typedef enum { + CORE99_VIA_CONFIG_CUDA =3D 0, + CORE99_VIA_CONFIG_PMU, + CORE99_VIA_CONFIG_PMU_ADB +} Core99ViaConfig; =20 struct Core99MachineState { /*< private >*/ MachineState parent; =20 - uint8_t via_config; + Core99ViaConfig via_config; }; =20 static void fw_cfg_boot_set(void *opaque, const char *boot_device, --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666960966344203.79247856615405; Fri, 28 Oct 2022 05:42:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNzY-0002kO-CF; Fri, 28 Oct 2022 07:57:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyd-0001ka-RA; Fri, 28 Oct 2022 07:56:44 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyZ-0006NI-S1; Fri, 28 Oct 2022 07:56:43 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id F085475A15D; Fri, 28 Oct 2022 13:56:31 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id CCBBA75A150; Fri, 28 Oct 2022 13:56:31 +0200 (CEST) Message-Id: <01e51bd77babbc3d0653df0b6ef43807348bd34c.1666957578.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 15/19] mac_newworld: Add machine types for different mac99 configs To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:31 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666960967170100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The mac99 machine emulates different machines depending on machine properties or even if it is run as qemu-system-ppc64 or qemu-system-ppc. This is very confusing for users and many hours were lost trying to explain it or finding out why commands users came up with are not working as expected. (E.g. Windows users might think qemu-system-ppc64 is just the 64 bit version of qemu-system-ppc and then fail to boot a 32 bit OS with -M mac99 trying to follow an example that had qemu-system-ppc.) To avoid such confusion, add explicit machine types for the different configs which will work the same with both qemu-system-ppc and qemu-system-ppc64 and also make the command line clearer for new users. Signed-off-by: BALATON Zoltan --- hw/ppc/mac_newworld.c | 94 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 601ea518f8..50b783d851 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -649,9 +649,103 @@ static const TypeInfo core99_machine_info =3D { }, }; =20 +static void powermac3_1_machine_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + + core99_machine_class_init(oc, data); + mc->desc =3D "Apple Power Mac G4 AGP (Sawtooth)"; + mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("7400_v2.9"); +} + +static void powermac3_1_instance_init(Object *obj) +{ + Core99MachineState *cms =3D CORE99_MACHINE(obj); + + cms->via_config =3D CORE99_VIA_CONFIG_PMU; + return; +} + +static const TypeInfo powermac3_1_machine_info =3D { + .name =3D MACHINE_TYPE_NAME("powermac3_1"), + .parent =3D TYPE_MACHINE, + .class_init =3D powermac3_1_machine_class_init, + .instance_init =3D powermac3_1_instance_init, + .instance_size =3D sizeof(Core99MachineState), + .interfaces =3D (InterfaceInfo[]) { + { TYPE_FW_PATH_PROVIDER }, + { } + }, +}; + +static void powerbook3_2_machine_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + + core99_machine_class_init(oc, data); + mc->desc =3D "Apple PowerBook G4 Titanium (Mercury)"; + mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("7400_v2.9"); +} + +static void powerbook3_2_instance_init(Object *obj) +{ + Core99MachineState *cms =3D CORE99_MACHINE(obj); + + cms->via_config =3D CORE99_VIA_CONFIG_PMU_ADB; + return; +} + +static const TypeInfo powerbook3_2_machine_info =3D { + .name =3D MACHINE_TYPE_NAME("powerbook3_2"), + .parent =3D TYPE_MACHINE, + .class_init =3D powerbook3_2_machine_class_init, + .instance_init =3D powerbook3_2_instance_init, + .instance_size =3D sizeof(Core99MachineState), + .interfaces =3D (InterfaceInfo[]) { + { TYPE_FW_PATH_PROVIDER }, + { } + }, +}; + +#ifdef TARGET_PPC64 +static void powermac7_3_machine_class_init(ObjectClass *oc, void *data) +{ + MachineClass *mc =3D MACHINE_CLASS(oc); + + core99_machine_class_init(oc, data); + mc->desc =3D "Apple Power Mac G5 (Niagara)"; + mc->default_cpu_type =3D POWERPC_CPU_TYPE_NAME("970fx_v3.1"); +} + +static void powermac7_3_instance_init(Object *obj) +{ + Core99MachineState *cms =3D CORE99_MACHINE(obj); + + cms->via_config =3D CORE99_VIA_CONFIG_PMU; + return; +} + +static const TypeInfo powermac7_3_machine_info =3D { + .name =3D MACHINE_TYPE_NAME("powermac7_3"), + .parent =3D TYPE_MACHINE, + .class_init =3D powermac7_3_machine_class_init, + .instance_init =3D powermac7_3_instance_init, + .instance_size =3D sizeof(Core99MachineState), + .interfaces =3D (InterfaceInfo[]) { + { TYPE_FW_PATH_PROVIDER }, + { } + }, +}; +#endif + static void mac_machine_register_types(void) { type_register_static(&core99_machine_info); + type_register_static(&powermac3_1_machine_info); + type_register_static(&powerbook3_2_machine_info); +#ifdef TARGET_PPC64 + type_register_static(&powermac7_3_machine_info); +#endif } =20 type_init(mac_machine_register_types) --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958433665598.3451641079926; Fri, 28 Oct 2022 05:00:33 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNzf-000318-7T; Fri, 28 Oct 2022 07:57:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNye-0001kp-4l; Fri, 28 Oct 2022 07:56:44 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNya-0006Nf-UD; Fri, 28 Oct 2022 07:56:43 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 001DD75A169; Fri, 28 Oct 2022 13:56:32 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id D761775A168; Fri, 28 Oct 2022 13:56:32 +0200 (CEST) Message-Id: <047f78fc4c3930dbafc0df19fe2fbfbead85ef88.1666957578.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 16/19] mac_newworld: Deprecate mac99 with G5 CPU To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:32 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958435439100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Besides resolving the confusing behaviour mentioned in previous commit this might also allow unifying qemu-system-ppc and qemu-system-ppc64 in the future. Signed-off-by: BALATON Zoltan --- hw/ppc/mac_newworld.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 50b783d851..2bba29686d 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -165,6 +165,12 @@ static void ppc_core99_init(MachineState *machine) qemu_register_reset(ppc_core99_reset, cpu); } =20 + if (object_property_find(OBJECT(machine), "via")) { + if (PPC_INPUT(env) =3D=3D PPC_FLAGS_INPUT_970) { + warn_report("mac99 with G5 CPU is deprecated, " + "use powermac7_3 instead"); + } + } /* allocate RAM */ if (machine->ram_size > 2 * GiB) { error_report("RAM size more than 2 GiB is not supported"); --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958389274191.55452915502735; Fri, 28 Oct 2022 04:59:49 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNzZ-0002o3-QN; Fri, 28 Oct 2022 07:57:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyd-0001kh-VZ; Fri, 28 Oct 2022 07:56:44 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNya-0006Nc-SU; Fri, 28 Oct 2022 07:56:43 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 110FC75A168; Fri, 28 Oct 2022 13:56:34 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id E526A75A135; Fri, 28 Oct 2022 13:56:33 +0200 (CEST) Message-Id: <685726e4e3a196493530ab0677e7e82d89bcb123.1666957578.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 17/19] mac_newworld: Deprecate mac99 "via" option To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:33 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958390838100007 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Setting emulated machine type with a property called "via" is confusing users so deprecate the "via" option in favour of newly added explicit machine types. The default via=3Dcuda option is not a valid config (no real Mac has this combination of hardware) so no machine type could be defined for that therefore it is kept for backwards compatibility with older QEMU versions for now but other options resembling real machines are deprecated. Signed-off-by: BALATON Zoltan --- hw/ppc/mac_newworld.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 2bba29686d..4ca9ab3e03 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -169,6 +169,15 @@ static void ppc_core99_init(MachineState *machine) if (PPC_INPUT(env) =3D=3D PPC_FLAGS_INPUT_970) { warn_report("mac99 with G5 CPU is deprecated, " "use powermac7_3 instead"); + } else { + if (core99_machine->via_config =3D=3D CORE99_VIA_CONFIG_PMU) { + warn_report("mac99,via=3Dpmu is deprecated, " + "use powermac3_1 instead"); + } + if (core99_machine->via_config =3D=3D CORE99_VIA_CONFIG_PMU_AD= B) { + warn_report("mac99,via=3Dpmu-adb is deprecated, " + "use powerbook3_2 instead"); + } } } /* allocate RAM */ --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958300782942.4377228820912; Fri, 28 Oct 2022 04:58:20 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNz0-00029U-Aa; Fri, 28 Oct 2022 07:57:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNye-0001lZ-RY; Fri, 28 Oct 2022 07:56:44 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNyb-0006Nl-2N; Fri, 28 Oct 2022 07:56:44 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 2A98775A16A; Fri, 28 Oct 2022 13:56:35 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 0917175A135; Fri, 28 Oct 2022 13:56:35 +0200 (CEST) Message-Id: <335a115b9ff6ea536590b9edd04278573ebb4ecb.1666957578.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 18/19] mac_newworld: Document deprecation To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:35 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=152.66.115.2; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -41 X-Spam_score: -4.2 X-Spam_bar: ---- X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958302444100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Also update PowerMac family docs with some more recent info. Signed-off-by: BALATON Zoltan --- docs/about/deprecated.rst | 7 +++++++ docs/system/ppc/powermac.rst | 12 ++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/docs/about/deprecated.rst b/docs/about/deprecated.rst index 93affe3669..07661af7fe 100644 --- a/docs/about/deprecated.rst +++ b/docs/about/deprecated.rst @@ -248,6 +248,13 @@ These old machine types are quite neglected nowadays a= nd thus might have various pitfalls with regards to live migration. Use a newer machine type instead. =20 +``mac99`` variants other than the default qemu-system-ppc version (since 7= .2) +''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''= ''' + +The ``mac99`` machine emulates different hardware depending on using +qemu-system-ppc64 or ``via`` property. To avoid confusion new machine +types has been added for these variants which are now preferred over +``mac99``. =20 Backend options --------------- diff --git a/docs/system/ppc/powermac.rst b/docs/system/ppc/powermac.rst index 04334ba210..d4a47a6881 100644 --- a/docs/system/ppc/powermac.rst +++ b/docs/system/ppc/powermac.rst @@ -4,8 +4,12 @@ PowerMac family boards (``g3beige``, ``mac99``) Use the executable ``qemu-system-ppc`` to simulate a complete PowerMac PowerPC system. =20 -- ``g3beige`` Heathrow based PowerMAC -- ``mac99`` Mac99 based PowerMAC +- ``g3beige`` Heathrow based old world Power Macintosh G3 +- ``mac99`` Core99 based generic PowerMac +- ``powermac3_1`` Power Mac G4 AGP (Sawtooth) +- ``powerbook3_2`` PowerBook G4 Titanium (Mercury) +- ``powermac7_3`` Power Mac G5 (Niagara) (only in ``qemu-system-ppc6= 4``) + =20 Supported devices ----------------- @@ -15,9 +19,9 @@ QEMU emulates the following PowerMac peripherals: * UniNorth or Grackle PCI Bridge * PCI VGA compatible card with VESA Bochs Extensions * 2 PMAC IDE interfaces with hard disk and CD-ROM support - * NE2000 PCI adapters + * Sungem PCI network adapter * Non Volatile RAM - * VIA-CUDA with ADB keyboard and mouse. + * VIA-CUDA or VIA-PMU99 with or without ADB or USB keyboard and mouse. =20 =20 Missing devices --=20 2.30.6 From nobody Sat May 18 08:14:15 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=eik.bme.hu Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1666958396298489.0713558670086; Fri, 28 Oct 2022 04:59:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ooNz7-0002GR-1l; Fri, 28 Oct 2022 07:57:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNye-0001lb-Ve; Fri, 28 Oct 2022 07:56:45 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ooNya-0006Nk-WD; Fri, 28 Oct 2022 07:56:44 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 530C075A135; Fri, 28 Oct 2022 13:56:36 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 197E775A16B; Fri, 28 Oct 2022 13:56:36 +0200 (CEST) Message-Id: <61dc9f56579662f9b97c6cc9fcdc0007665c064f.1666957578.git.balaton@eik.bme.hu> In-Reply-To: References: From: BALATON Zoltan Subject: [PATCH v6 19/19] mac_{old, new}world: Pass MacOS VGA NDRV in card ROM instead of fw_cfg To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org Cc: Mark Cave-Ayland Date: Fri, 28 Oct 2022 13:56:36 +0200 (CEST) X-Spam-Probability: 8% Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2001:738:2001:2001::2001; envelope-from=balaton@eik.bme.hu; helo=zero.eik.bme.hu X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZM-MESSAGEID: 1666958396883100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" OpenBIOS cannot run FCode ROMs yet but it can detect NDRV in VGA card ROM and add it to the device tree for MacOS. Pass the NDRV this way instead of via fw_cfg. This solves the problem with OpenBIOS also adding the NDRV to ati-vga which it does not work with. This does not need any changes to OpenBIOS as this NDRV ROM handling is already there but this patch also allows simplifying OpenBIOS later to remove the fw_cfg ndrv handling from the vga FCode and also drop the vga-ndrv? option which is not needed any more as users can disable the ndrv with -device VGA,romfile=3D"" (or override it with their own NDRV or ROM). Once FCode support is implemented in OpenBIOS, the proper FCode ROM can be set the same way so this paves the way to remove some hacks. Signed-off-by: BALATON Zoltan --- hw/ppc/mac_newworld.c | 18 ++++++------------ hw/ppc/mac_oldworld.c | 18 ++++++------------ 2 files changed, 12 insertions(+), 24 deletions(-) diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 4ca9ab3e03..104835b5a8 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -526,18 +526,6 @@ static void ppc_core99_init(MachineState *machine) fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_NVRAM_ADDR, nvram_addr); =20 - /* MacOS NDRV VGA driver */ - filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, NDRV_VGA_FILENAME); - if (filename) { - gchar *ndrv_file; - gsize ndrv_size; - - if (g_file_get_contents(filename, &ndrv_file, &ndrv_size, NULL)) { - fw_cfg_add_file(fw_cfg, "ndrv/qemu_vga.ndrv", ndrv_file, ndrv_= size); - } - g_free(filename); - } - qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); } =20 @@ -581,6 +569,11 @@ static int core99_kvm_type(MachineState *machine, cons= t char *arg) return 2; } =20 +static GlobalProperty props[] =3D { + /* MacOS NDRV VGA driver */ + { "VGA", "romfile", NDRV_VGA_FILENAME }, +}; + static void core99_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -601,6 +594,7 @@ static void core99_machine_class_init(ObjectClass *oc, = void *data) #endif mc->default_ram_id =3D "ppc_core99.ram"; mc->ignore_boot_device_suffixes =3D true; + compat_props_add(mc->compat_props, props, G_N_ELEMENTS(props)); fwc->get_dev_path =3D core99_fw_dev_path; } =20 diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 558c639202..801123c507 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -345,18 +345,6 @@ static void ppc_heathrow_init(MachineState *machine) fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_CLOCKFREQ, CLOCKFREQ); fw_cfg_add_i32(fw_cfg, FW_CFG_PPC_BUSFREQ, BUSFREQ); =20 - /* MacOS NDRV VGA driver */ - filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, NDRV_VGA_FILENAME); - if (filename) { - gchar *ndrv_file; - gsize ndrv_size; - - if (g_file_get_contents(filename, &ndrv_file, &ndrv_size, NULL)) { - fw_cfg_add_file(fw_cfg, "ndrv/qemu_vga.ndrv", ndrv_file, ndrv_= size); - } - g_free(filename); - } - qemu_register_boot_set(fw_cfg_boot_set, fw_cfg); } =20 @@ -401,6 +389,11 @@ static int heathrow_kvm_type(MachineState *machine, co= nst char *arg) return 2; } =20 +static GlobalProperty props[] =3D { + /* MacOS NDRV VGA driver */ + { "VGA", "romfile", NDRV_VGA_FILENAME }, +}; + static void heathrow_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -421,6 +414,7 @@ static void heathrow_class_init(ObjectClass *oc, void *= data) mc->default_display =3D "std"; mc->ignore_boot_device_suffixes =3D true; mc->default_ram_id =3D "ppc_heathrow.ram"; + compat_props_add(mc->compat_props, props, G_N_ELEMENTS(props)); fwc->get_dev_path =3D heathrow_fw_dev_path; } =20 --=20 2.30.6