From nobody Fri Apr 19 03:19:41 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=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1602807788; cv=none; d=zohomail.com; s=zohoarc; b=ZxKnQuJkoiNbzG7b5E+nc2a9BsMb/q5QGGouBEZHkzim0CW4Tkm9xc5/aXYPicVvd0xgnaa7zJvFhtshi1tDlyXn9SFFOeixicGq3LRyKokftjyRQ20DtaKg4BukHXmXku3GXg4pgAxNlGZaFS6PgoWVgFy364SeG6RIFSDXmkc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602807788; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=0HE20xoO5Y/ebQ5mMs5nwvjIhYrqYGWd9BbG+Wd+MlQ=; b=c4MD9WRpO75KpMlg/4tASEWZh0wk4fjYEBSkDYmlAI+jPUtlbuKrT6/hHzSOL1u37PohwEPogQLoFMQRqi2wXht7AP+mq420Vi2Ui7NWR4UkTc/LCc4AEwJmobkBFCnHejTT75J5V6ALDuG8X60Lp3m4Z0DXtaRZP/M33y9nMIY= ARC-Authentication-Results: i=1; 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=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602807788307947.4890611970092; Thu, 15 Oct 2020 17:23:08 -0700 (PDT) Received: from localhost ([::1]:39764 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTDWV-0002oJ-6P for importer@patchew.org; Thu, 15 Oct 2020 20:23:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58808) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTDRV-0005il-1r; Thu, 15 Oct 2020 20:17:57 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:30047) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTDRM-0006vi-NX; Thu, 15 Oct 2020 20:17:56 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 6FA73747623; Fri, 16 Oct 2020 02:17:36 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id E954574761D; Fri, 16 Oct 2020 02:17:35 +0200 (CEST) Message-Id: <1789fdb8ceb8894720ea3082976a0a5a0f58f1ad.1602805637.git.balaton@eik.bme.hu> In-Reply-To: References: Subject: [PATCH v8 1/5] mac_oldworld: Allow loading binary ROM image Date: Fri, 16 Oct 2020 01:47:17 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/15 20:17:36 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan From: BALATON Zoltan via Content-Type: text/plain; charset="utf-8" The beige G3 Power Macintosh has a 4MB firmware ROM. Fix the size of the rom region and fall back to loading a binary image with -bios if loading ELF image failed. This allows testing emulation with a ROM image from real hardware as well as using an ELF OpenBIOS image. Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland --- hw/ppc/mac_oldworld.c | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 05e46ee6fe..0a40769b3e 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -59,6 +59,8 @@ #define NDRV_VGA_FILENAME "qemu_vga.ndrv" =20 #define GRACKLE_BASE 0xfec00000 +#define PROM_BASE 0xffc00000 +#define PROM_SIZE (4 * MiB) =20 static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) @@ -100,6 +102,7 @@ static void ppc_heathrow_init(MachineState *machine) SysBusDevice *s; DeviceState *dev, *pic_dev; BusState *adb_bus; + uint64_t bios_addr; int bios_size; unsigned int smp_cpus =3D machine->smp.cpus; uint16_t ppc_boot_device; @@ -128,24 +131,32 @@ static void ppc_heathrow_init(MachineState *machine) =20 memory_region_add_subregion(sysmem, 0, machine->ram); =20 - /* allocate and load BIOS */ - memory_region_init_rom(bios, NULL, "ppc_heathrow.bios", BIOS_SIZE, + /* allocate and load firmware ROM */ + memory_region_init_rom(bios, NULL, "ppc_heathrow.bios", PROM_SIZE, &error_fatal); + memory_region_add_subregion(sysmem, PROM_BASE, bios); =20 - if (bios_name =3D=3D NULL) + if (!bios_name) { bios_name =3D PROM_FILENAME; + } filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); - memory_region_add_subregion(sysmem, PROM_ADDR, bios); - - /* Load OpenBIOS (ELF) */ if (filename) { - bios_size =3D load_elf(filename, NULL, 0, NULL, NULL, NULL, NULL, = NULL, - 1, PPC_ELF_MACHINE, 0, 0); + /* Load OpenBIOS (ELF) */ + bios_size =3D load_elf(filename, NULL, NULL, NULL, NULL, &bios_add= r, + NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0); + /* Unfortunately, load_elf sign-extends reading elf32 */ + bios_addr =3D (target_ulong)bios_addr; + + if (bios_size <=3D 0) { + /* or load binary ROM image */ + bios_size =3D load_image_targphys(filename, PROM_BASE, PROM_SI= ZE); + bios_addr =3D PROM_BASE; + } g_free(filename); } else { bios_size =3D -1; } - if (bios_size < 0 || bios_size > BIOS_SIZE) { + if (bios_size < 0 || bios_addr - PROM_BASE + bios_size > PROM_SIZE) { error_report("could not load PowerPC bios '%s'", bios_name); exit(1); } --=20 2.21.3 From nobody Fri Apr 19 03:19:41 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=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1602807712; cv=none; d=zohomail.com; s=zohoarc; b=d71rrn1yjq5Z3DOlki/acjM3GhWpJJYKJS76jW6jYqyN11o7wc+3GxHmXK881/nKB174+f757jKoW/+4Hz8TfvKp65SAC40GCRyLZkNrXHSKpD0c4w+mrmBEkovX+43NeAnati4OBtq1Lcc0j8BhDPCxjrHAvYaL71Vax2nwUk4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602807712; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=6Wg4wbDNggffN4CsDUZ9JwyELGygMa7unCJelqbQSr8=; b=JjIq9UJV+wno6ZTOX/96XfO0Uvn1cPIvFGlFXokWxJrqY/tHr6Zuo9Oit0NX4scOAgSywPzvJ4XkWFmzNQ77RlxdDfSv6jnkLVlKVr1dJ4G5D6YZxBGNvpPzeDdhwRpqr8dokUYLworjbEtRJ3upRLQ2N0ULYvjRBT57oE4ZBkw= ARC-Authentication-Results: i=1; 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=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602807712717293.8997363940931; Thu, 15 Oct 2020 17:21:52 -0700 (PDT) Received: from localhost ([::1]:36472 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTDVH-0001Py-9q for importer@patchew.org; Thu, 15 Oct 2020 20:21:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58780) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTDRR-0005gn-82; Thu, 15 Oct 2020 20:17:53 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:30049) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTDRM-0006vg-LT; Thu, 15 Oct 2020 20:17:52 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 741D7747621; Fri, 16 Oct 2020 02:17:36 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id ED188747613; Fri, 16 Oct 2020 02:17:35 +0200 (CEST) Message-Id: <4d58ffe7645a0c746c8fed6aa8775c0867b624e0.1602805637.git.balaton@eik.bme.hu> In-Reply-To: References: Subject: [PATCH v8 2/5] mac_newworld: Allow loading binary ROM image Date: Fri, 16 Oct 2020 01:47:17 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/15 20:17:36 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan From: BALATON Zoltan via Fall back to load binary ROM image if loading ELF fails. This also moves PROM_BASE and PROM_SIZE defines to board as these are matching the ROM size and address on this board and removes the now unused PROM_ADDR and BIOS_SIZE defines from common mac.h. Signed-off-by: BALATON Zoltan Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Mark Cave-Ayland --- hw/ppc/mac.h | 2 -- hw/ppc/mac_newworld.c | 22 ++++++++++++++-------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/hw/ppc/mac.h b/hw/ppc/mac.h index f3976b9a45..22c8408078 100644 --- a/hw/ppc/mac.h +++ b/hw/ppc/mac.h @@ -39,10 +39,8 @@ /* SMP is not enabled, for now */ #define MAX_CPUS 1 =20 -#define BIOS_SIZE (1 * MiB) #define NVRAM_SIZE 0x2000 #define PROM_FILENAME "openbios-ppc" -#define PROM_ADDR 0xfff00000 =20 #define KERNEL_LOAD_ADDR 0x01000000 #define KERNEL_GAP 0x00100000 diff --git a/hw/ppc/mac_newworld.c b/hw/ppc/mac_newworld.c index 7a8dc09c8d..f9a1cc8944 100644 --- a/hw/ppc/mac_newworld.c +++ b/hw/ppc/mac_newworld.c @@ -82,6 +82,8 @@ =20 #define NDRV_VGA_FILENAME "qemu_vga.ndrv" =20 +#define PROM_BASE 0xfff00000 +#define PROM_SIZE (1 * MiB) =20 static void fw_cfg_boot_set(void *opaque, const char *boot_device, Error **errp) @@ -100,7 +102,7 @@ static void ppc_core99_reset(void *opaque) =20 cpu_reset(CPU(cpu)); /* 970 CPUs want to get their initial IP as part of their boot protoco= l */ - cpu->env.nip =3D PROM_ADDR + 0x100; + cpu->env.nip =3D PROM_BASE + 0x100; } =20 /* PowerPC Mac99 hardware initialisation */ @@ -154,25 +156,29 @@ static void ppc_core99_init(MachineState *machine) /* allocate RAM */ memory_region_add_subregion(get_system_memory(), 0, machine->ram); =20 - /* allocate and load BIOS */ - memory_region_init_rom(bios, NULL, "ppc_core99.bios", BIOS_SIZE, + /* allocate and load firmware ROM */ + memory_region_init_rom(bios, NULL, "ppc_core99.bios", PROM_SIZE, &error_fatal); + memory_region_add_subregion(get_system_memory(), PROM_BASE, bios); =20 - if (bios_name =3D=3D NULL) + if (!bios_name) { bios_name =3D PROM_FILENAME; + } filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); - memory_region_add_subregion(get_system_memory(), PROM_ADDR, bios); - - /* Load OpenBIOS (ELF) */ if (filename) { + /* Load OpenBIOS (ELF) */ bios_size =3D load_elf(filename, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1, PPC_ELF_MACHINE, 0, 0); =20 + if (bios_size <=3D 0) { + /* or load binary ROM image */ + 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 > BIOS_SIZE) { + if (bios_size < 0 || bios_size > PROM_SIZE) { error_report("could not load PowerPC bios '%s'", bios_name); exit(1); } --=20 2.21.3 From nobody Fri Apr 19 03:19:41 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=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1602807564; cv=none; d=zohomail.com; s=zohoarc; b=TYUAybIMtEbzG8+fREr8wwfxrplgknExAzyIXIUDW5SgZT8+KpG4O9/HSX+9p4GUlxgjqj49nWBYjfOnZfnV7Yvm8q5rwS/Tql5aHQ4LmJDpEHhb9B347F5nlmq6GfaOGnDYs/i7tSIidUW4XcgyPlV7oqNa5VwvI/Al+PHRa78= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602807564; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=0o0a/SKzqwW3qxAX17L4fOIvsd1lymtBb05mev+OTDE=; b=npPV/12OTFHQ+v/XYdPeoKkBorscqc4aAinV2yboA4Sdyxp/+GbxUytCuVRuWTGaHo8epgL+15oHaUdNy8T8Aqm4sRCQkx2jpBDVuQ1Z2HJbEGh7Nrr/ewT1z8zk67i3GYK4QNmj+XCP+GR2ioBWlaqwn9O3vZtKKWQscyy5UlQ= ARC-Authentication-Results: i=1; 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=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602807564336885.6283133605643; Thu, 15 Oct 2020 17:19:24 -0700 (PDT) Received: from localhost ([::1]:58582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTDSs-0007Dr-FW for importer@patchew.org; Thu, 15 Oct 2020 20:19:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58752) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTDRQ-0005gb-Fn; Thu, 15 Oct 2020 20:17:52 -0400 Received: from zero.eik.bme.hu ([152.66.115.2]:30046) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTDRM-0006vh-L2; Thu, 15 Oct 2020 20:17:51 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 725C1747627; Fri, 16 Oct 2020 02:17:36 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id F16CD747620; Fri, 16 Oct 2020 02:17:35 +0200 (CEST) Message-Id: In-Reply-To: References: Subject: [PATCH v8 3/5] mac_oldworld: Drop a variable, use get_system_memory() directly Date: Fri, 16 Oct 2020 01:47:17 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org 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-detected-operating-system: by eggs.gnu.org: First seen = 2020/10/15 20:17:36 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan From: BALATON Zoltan via Half of the occurances already use get_system_memory() directly instead of sysmem variable, convert the two other uses to get_system_memory() too which seems to be more common and drop the variable. Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/ppc/mac_oldworld.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 0a40769b3e..5b30fa0739 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -87,7 +87,6 @@ static void ppc_heathrow_init(MachineState *machine) const char *kernel_cmdline =3D machine->kernel_cmdline; const char *initrd_filename =3D machine->initrd_filename; const char *boot_device =3D machine->boot_order; - MemoryRegion *sysmem =3D get_system_memory(); PowerPCCPU *cpu =3D NULL; CPUPPCState *env =3D NULL; char *filename; @@ -129,12 +128,12 @@ static void ppc_heathrow_init(MachineState *machine) exit(1); } =20 - memory_region_add_subregion(sysmem, 0, machine->ram); + memory_region_add_subregion(get_system_memory(), 0, machine->ram); =20 /* allocate and load firmware ROM */ memory_region_init_rom(bios, NULL, "ppc_heathrow.bios", PROM_SIZE, &error_fatal); - memory_region_add_subregion(sysmem, PROM_BASE, bios); + memory_region_add_subregion(get_system_memory(), PROM_BASE, bios); =20 if (!bios_name) { bios_name =3D PROM_FILENAME; --=20 2.21.3 From nobody Fri Apr 19 03:19:41 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=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1602807564; cv=none; d=zohomail.com; s=zohoarc; b=BFsHtoxPkT0ojCxCfpPFDSaLaqDlGdvjme9UztgCqepBCYKdhjA6e+z4jKVMovFFdhTuwsKwQ2BzRDisalyRMvptiv+IXkZkMKqw3uqdjRhI6myzLMTwg7qSosq1EydK1vvSsEB5++JBAve8aHHiYK8e6aaEv647Qi0gMu8gytE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602807564; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=gurayrGYtFCeaWkh8RXYQBMaXli2LeLvYnMrAsvYGKQ=; b=TwIRBNh/olZYvSW2YmSkpZ2+gPGfSkQhHT5i2D7TbXa8nZdyWpIo/kUf3SNicjVCVpFCT4pDLgOyAK34IWvzYwPlXNCkNvS3mD9nv3Szyk3TQQRvRjk+z0CcaDYyrlVsodo1maMavrYEcoKGK5uOk1b+/hFXE+g3Pruxwq5sNrQ= ARC-Authentication-Results: i=1; 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=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602807564328112.20368398973449; Thu, 15 Oct 2020 17:19:24 -0700 (PDT) Received: from localhost ([::1]:58618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTDSs-0007Ek-FK for importer@patchew.org; Thu, 15 Oct 2020 20:19:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58788) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTDRR-0005gx-Jc; Thu, 15 Oct 2020 20:17:53 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:30048) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTDRM-0006vf-Kv; Thu, 15 Oct 2020 20:17:53 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 4D96C747626; Fri, 16 Oct 2020 02:17:36 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 01532747621; Fri, 16 Oct 2020 02:17:36 +0200 (CEST) Message-Id: In-Reply-To: References: Subject: [PATCH v8 4/5] mac_oldworld: Drop some variables Date: Fri, 16 Oct 2020 01:47:17 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org 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-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan From: BALATON Zoltan via 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. Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/ppc/mac_oldworld.c | 35 +++++++++++++++++------------------ 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 5b30fa0739..13eb9bafa1 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -83,14 +83,11 @@ static void ppc_heathrow_reset(void *opaque) static void ppc_heathrow_init(MachineState *machine) { ram_addr_t ram_size =3D machine->ram_size; - 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_order; PowerPCCPU *cpu =3D NULL; CPUPPCState *env =3D NULL; char *filename; - int linux_boot, i; + int i; MemoryRegion *bios =3D g_new(MemoryRegion, 1); uint32_t kernel_base, initrd_base, cmdline_base =3D 0; int32_t kernel_size, initrd_size; @@ -109,8 +106,6 @@ static void ppc_heathrow_init(MachineState *machine) void *fw_cfg; uint64_t tbfreq; =20 - linux_boot =3D (kernel_filename !=3D NULL); - /* init CPUs */ for (i =3D 0; i < smp_cpus; i++) { cpu =3D POWERPC_CPU(cpu_create(machine->cpu_type)); @@ -147,7 +142,7 @@ static void ppc_heathrow_init(MachineState *machine) bios_addr =3D (target_ulong)bios_addr; =20 if (bios_size <=3D 0) { - /* or load binary ROM image */ + /* or if could not load ELF try loading a binary ROM image */ bios_size =3D load_image_targphys(filename, PROM_BASE, PROM_SI= ZE); bios_addr =3D PROM_BASE; } @@ -160,7 +155,7 @@ static void ppc_heathrow_init(MachineState *machine) exit(1); } =20 - if (linux_boot) { + if (machine->kernel_filename) { int bswap_needed; =20 #ifdef BSWAP_NEEDED @@ -169,29 +164,32 @@ static void ppc_heathrow_init(MachineState *machine) bswap_needed =3D 0; #endif kernel_base =3D KERNEL_LOAD_ADDR; - 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, + kernel_size =3D load_aout(machine->kernel_filename, kernel_bas= e, 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); 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) { - initrd_base =3D TARGET_PAGE_ALIGN(kernel_base + kernel_size + = KERNEL_GAP); - initrd_size =3D load_image_targphys(initrd_filename, initrd_ba= se, + if (machine->initrd_filename) { + initrd_base =3D TARGET_PAGE_ALIGN(kernel_base + kernel_size + + KERNEL_GAP); + initrd_size =3D load_image_targphys(machine->initrd_filename, + initrd_base, ram_size - initrd_base); 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); @@ -343,9 +341,10 @@ static void ppc_heathrow_init(MachineState *machine) 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); - 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.21.3 From nobody Fri Apr 19 03:19:41 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=pass(p=none dis=none) header.from=nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1602807579; cv=none; d=zohomail.com; s=zohoarc; b=lI+/IRGk7V+sswWM0lQSDJkMBTNCai/E3778EqTvWnSBqytl8UJz0E9XOP6fMC8RsuBrqFsrIMcP1d3M27OKln7rlTp4Nd3YrJXSrlYV94c+9o0dR/TGRLCaUj++Tx+vxlZYtHE8RhYfYHhQA2ucK7kD+V/JuFeZpRAcKjQEYB8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1602807579; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=z7bnDodJyMFflzymi2Dk+fTmkiPFpSHhKb8QfmaVQ58=; b=Hx9aU4R316OnXYjtADB9vc7ugLTrz5vgC+smtWmBMx3p1FctVbv0MgBoBtF/X0k8j9AvzokcKXjcEw0NOPQUdX+Gaa1F1G6zHNld7btv6oh0i4rc5ZQJvI9jJvBxfIyG/3u0zA1IhFd6bb6VZ40PYiMuKfN9NNhgY1T0yRJRdrA= ARC-Authentication-Results: i=1; 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=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1602807579751315.6183977055671; Thu, 15 Oct 2020 17:19:39 -0700 (PDT) Received: from localhost ([::1]:59388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kTDT8-0007YE-Ir for importer@patchew.org; Thu, 15 Oct 2020 20:19:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58818) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTDRW-0005kz-Ck; Thu, 15 Oct 2020 20:17:58 -0400 Received: from zero.eik.bme.hu ([2001:738:2001:2001::2001]:30055) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kTDRR-0006yK-81; Thu, 15 Oct 2020 20:17:58 -0400 Received: from zero.eik.bme.hu (blah.eik.bme.hu [152.66.115.182]) by localhost (Postfix) with SMTP id 68EF074761F; Fri, 16 Oct 2020 02:17:36 +0200 (CEST) Received: by zero.eik.bme.hu (Postfix, from userid 432) id 0564A747622; Fri, 16 Oct 2020 02:17:36 +0200 (CEST) Message-Id: In-Reply-To: References: Subject: [PATCH v8 5/5] mac_oldworld: Change PCI address of macio to match real hardware Date: Fri, 16 Oct 2020 01:47:17 +0200 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: qemu-devel@nongnu.org, qemu-ppc@nongnu.org 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-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Cave-Ayland Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Reply-to: BALATON Zoltan From: BALATON Zoltan via Content-Type: text/plain; charset="utf-8" The board firmware expect these to be at fixed addresses and programs them without probing, this patch puts the macio device at the expected PCI address. Signed-off-by: BALATON Zoltan Reviewed-by: Mark Cave-Ayland --- hw/ppc/mac_oldworld.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/ppc/mac_oldworld.c b/hw/ppc/mac_oldworld.c index 13eb9bafa1..bb563e8aab 100644 --- a/hw/ppc/mac_oldworld.c +++ b/hw/ppc/mac_oldworld.c @@ -288,7 +288,7 @@ static void ppc_heathrow_init(MachineState *machine) ide_drive_get(hd, ARRAY_SIZE(hd)); =20 /* MacIO */ - macio =3D pci_new(-1, TYPE_OLDWORLD_MACIO); + macio =3D pci_new(PCI_DEVFN(16, 0), TYPE_OLDWORLD_MACIO); dev =3D DEVICE(macio); qdev_prop_set_uint64(dev, "frequency", tbfreq); object_property_set_link(OBJECT(macio), "pic", OBJECT(pic_dev), --=20 2.21.3