From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865189963509.26958759621346; Fri, 17 Sep 2021 00:53:09 -0700 (PDT) Received: from localhost ([::1]:42112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8gG-0007Eu-Uh for importer@patchew.org; Fri, 17 Sep 2021 03:53:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38546) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8eO-0004YE-Gk for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:12 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41698 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8eL-0005DG-Sa for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:11 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8eD-0007Od-Ei; Fri, 17 Sep 2021 08:51:05 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:38 +0100 Message-Id: <20210917075057.20924-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 01/20] nubus-device: rename slot_nb variable to slot X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865191776100003 This is in preparation for creating a qdev property of the same name. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/nubus/nubus-device.c | 14 +++++++------- include/hw/nubus/nubus.h | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c index ffe78a8823..be01269563 100644 --- a/hw/nubus/nubus-device.c +++ b/hw/nubus/nubus-device.c @@ -87,7 +87,7 @@ static void nubus_register_format_block(NubusDevice *dev) char *fblock_name; =20 fblock_name =3D g_strdup_printf("nubus-slot-%d-format-block", - dev->slot_nb); + dev->slot); =20 hwaddr fblock_offset =3D memory_region_size(&dev->slot_mem) - FBLOCK_S= IZE; memory_region_init_io(&dev->fblock_io, NULL, &nubus_format_block_ops, @@ -142,7 +142,7 @@ void nubus_register_rom(NubusDevice *dev, const uint8_t= *rom, uint32_t size, /* ROM */ =20 dev->rom =3D rom; - rom_name =3D g_strdup_printf("nubus-slot-%d-rom", dev->slot_nb); + rom_name =3D g_strdup_printf("nubus-slot-%d-rom", dev->slot); memory_region_init_io(&dev->rom_io, NULL, &mac_nubus_rom_ops, dev, rom_name, size); memory_region_set_readonly(&dev->rom_io, true); @@ -167,12 +167,12 @@ static void nubus_device_realize(DeviceState *dev, Er= ror **errp) return; } =20 - nd->slot_nb =3D nubus->current_slot++; - name =3D g_strdup_printf("nubus-slot-%d", nd->slot_nb); + nd->slot =3D nubus->current_slot++; + name =3D g_strdup_printf("nubus-slot-%d", nd->slot); =20 - if (nd->slot_nb < NUBUS_FIRST_SLOT) { + if (nd->slot < NUBUS_FIRST_SLOT) { /* Super */ - slot_offset =3D (nd->slot_nb - 6) * NUBUS_SUPER_SLOT_SIZE; + slot_offset =3D (nd->slot - 6) * NUBUS_SUPER_SLOT_SIZE; =20 memory_region_init(&nd->slot_mem, OBJECT(dev), name, NUBUS_SUPER_SLOT_SIZE); @@ -180,7 +180,7 @@ static void nubus_device_realize(DeviceState *dev, Erro= r **errp) &nd->slot_mem); } else { /* Normal */ - slot_offset =3D nd->slot_nb * NUBUS_SLOT_SIZE; + slot_offset =3D nd->slot * NUBUS_SLOT_SIZE; =20 memory_region_init(&nd->slot_mem, OBJECT(dev), name, NUBUS_SLOT_SI= ZE); memory_region_add_subregion(&nubus->slot_io, slot_offset, diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h index e2b5cf260b..424309dd73 100644 --- a/include/hw/nubus/nubus.h +++ b/include/hw/nubus/nubus.h @@ -42,7 +42,7 @@ struct NubusBus { struct NubusDevice { DeviceState qdev; =20 - int slot_nb; + int slot; MemoryRegion slot_mem; =20 /* Format Block */ --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865196588949.2283672679476; Fri, 17 Sep 2021 00:53:16 -0700 (PDT) Received: from localhost ([::1]:42742 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8gN-0007dv-Hs for importer@patchew.org; Fri, 17 Sep 2021 03:53:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38590) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8eT-0004ny-KZ for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:17 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41702 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8eR-0005HO-3r for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:16 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8eH-0007Od-LY; Fri, 17 Sep 2021 08:51:09 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:39 +0100 Message-Id: <20210917075057.20924-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 02/20] nubus-device: expose separate super slot memory region X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865198435100001 According to "Designing Cards and Drivers for the Macintosh Family" each ph= ysical nubus slot can access 2 separate address ranges: a super slot memory region= which is 256MB and a standard slot memory region which is 16MB. Currently a Nubus device uses the physical slot number to determine whether= it is using a standard slot memory region or a super slot memory region rather th= an exposing both memory regions for use as required. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/nubus/nubus-device.c | 36 ++++++++++++++++++------------------ include/hw/nubus/nubus.h | 1 + 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c index be01269563..36203848e5 100644 --- a/hw/nubus/nubus-device.c +++ b/hw/nubus/nubus-device.c @@ -168,26 +168,26 @@ static void nubus_device_realize(DeviceState *dev, Er= ror **errp) } =20 nd->slot =3D nubus->current_slot++; - name =3D g_strdup_printf("nubus-slot-%d", nd->slot); - - if (nd->slot < NUBUS_FIRST_SLOT) { - /* Super */ - slot_offset =3D (nd->slot - 6) * NUBUS_SUPER_SLOT_SIZE; - - memory_region_init(&nd->slot_mem, OBJECT(dev), name, - NUBUS_SUPER_SLOT_SIZE); - memory_region_add_subregion(&nubus->super_slot_io, slot_offset, - &nd->slot_mem); - } else { - /* Normal */ - slot_offset =3D nd->slot * NUBUS_SLOT_SIZE; - - memory_region_init(&nd->slot_mem, OBJECT(dev), name, NUBUS_SLOT_SI= ZE); - memory_region_add_subregion(&nubus->slot_io, slot_offset, - &nd->slot_mem); - } =20 + /* Super */ + slot_offset =3D (nd->slot - 6) * NUBUS_SUPER_SLOT_SIZE; + + name =3D g_strdup_printf("nubus-super-slot-%x", nd->slot); + memory_region_init(&nd->super_slot_mem, OBJECT(dev), name, + NUBUS_SUPER_SLOT_SIZE); + memory_region_add_subregion(&nubus->super_slot_io, slot_offset, + &nd->super_slot_mem); + g_free(name); + + /* Normal */ + slot_offset =3D nd->slot * NUBUS_SLOT_SIZE; + + name =3D g_strdup_printf("nubus-slot-%x", nd->slot); + memory_region_init(&nd->slot_mem, OBJECT(dev), name, NUBUS_SLOT_SIZE); + memory_region_add_subregion(&nubus->slot_io, slot_offset, + &nd->slot_mem); g_free(name); + nubus_register_format_block(nd); } =20 diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h index 424309dd73..89b0976aaa 100644 --- a/include/hw/nubus/nubus.h +++ b/include/hw/nubus/nubus.h @@ -43,6 +43,7 @@ struct NubusDevice { DeviceState qdev; =20 int slot; + MemoryRegion super_slot_mem; MemoryRegion slot_mem; =20 /* Format Block */ --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865356236377.28375978983615; Fri, 17 Sep 2021 00:55:56 -0700 (PDT) Received: from localhost ([::1]:51192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8ix-0004o7-8D for importer@patchew.org; Fri, 17 Sep 2021 03:55:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8eV-0004yN-Rj for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:19 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41710 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8eU-0005LZ-AV for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:19 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8eL-0007Od-Qj; Fri, 17 Sep 2021 08:51:13 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:40 +0100 Message-Id: <20210917075057.20924-4-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 03/20] nubus-device: add device slot parameter X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865358606100001 Content-Type: text/plain; charset="utf-8" This prepares for allowing Nubus devices to be placed in a specific slot in= stead of always being auto-allocated by the bus itself. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/nubus/nubus-device.c | 6 ++++++ include/hw/nubus/nubus.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c index 36203848e5..c1832f73da 100644 --- a/hw/nubus/nubus-device.c +++ b/hw/nubus/nubus-device.c @@ -191,12 +191,18 @@ static void nubus_device_realize(DeviceState *dev, Er= ror **errp) nubus_register_format_block(nd); } =20 +static Property nubus_device_properties[] =3D { + DEFINE_PROP_INT32("slot", NubusDevice, slot, -1), + DEFINE_PROP_END_OF_LIST() +}; + static void nubus_device_class_init(ObjectClass *oc, void *data) { DeviceClass *dc =3D DEVICE_CLASS(oc); =20 dc->realize =3D nubus_device_realize; dc->bus_type =3D TYPE_NUBUS_BUS; + device_class_set_props(dc, nubus_device_properties); } =20 static const TypeInfo nubus_device_type_info =3D { diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h index 89b0976aaa..357f621d15 100644 --- a/include/hw/nubus/nubus.h +++ b/include/hw/nubus/nubus.h @@ -42,7 +42,7 @@ struct NubusBus { struct NubusDevice { DeviceState qdev; =20 - int slot; + int32_t slot; MemoryRegion super_slot_mem; MemoryRegion slot_mem; =20 --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865202900834.4791135595603; Fri, 17 Sep 2021 00:53:22 -0700 (PDT) Received: from localhost ([::1]:43278 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8gT-000802-Qc for importer@patchew.org; Fri, 17 Sep 2021 03:53:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8ea-0005EC-A7 for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:24 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41716 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8eY-0005PL-JA for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:24 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8eQ-0007Od-27; Fri, 17 Sep 2021 08:51:18 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:41 +0100 Message-Id: <20210917075057.20924-5-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 04/20] nubus: use bitmap to manage available slots X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865204871100001 Content-Type: text/plain; charset="utf-8" Convert nubus_device_realize() to use a bitmap to manage available slots to= allow for future Nubus devices to be plugged into arbitrary slots from the comman= d line. Update mac_nubus_bridge_init() to only allow slots 0x9 to 0xe on a Macintosh machines as documented in "Desigining Cards and Drivers for the Macintosh F= amily". Signed-off-by: Mark Cave-Ayland --- hw/nubus/mac-nubus-bridge.c | 3 +++ hw/nubus/nubus-bus.c | 2 +- hw/nubus/nubus-device.c | 29 +++++++++++++++++++++++++---- include/hw/nubus/nubus.h | 4 ++-- 4 files changed, 31 insertions(+), 7 deletions(-) diff --git a/hw/nubus/mac-nubus-bridge.c b/hw/nubus/mac-nubus-bridge.c index 7c329300b8..c1d77e2bc7 100644 --- a/hw/nubus/mac-nubus-bridge.c +++ b/hw/nubus/mac-nubus-bridge.c @@ -18,6 +18,9 @@ static void mac_nubus_bridge_init(Object *obj) =20 s->bus =3D NUBUS_BUS(qbus_create(TYPE_NUBUS_BUS, DEVICE(s), NULL)); =20 + /* Macintosh only has slots 0x9 to 0xe available */ + s->bus->slot_available_mask =3D MAKE_64BIT_MASK(9, 6); + sysbus_init_mmio(sbd, &s->bus->super_slot_io); sysbus_init_mmio(sbd, &s->bus->slot_io); } diff --git a/hw/nubus/nubus-bus.c b/hw/nubus/nubus-bus.c index 5c13452308..404c1032e0 100644 --- a/hw/nubus/nubus-bus.c +++ b/hw/nubus/nubus-bus.c @@ -84,7 +84,7 @@ static void nubus_init(Object *obj) nubus, "nubus-slots", NUBUS_SLOT_NB * NUBUS_SLOT_SIZE); =20 - nubus->current_slot =3D NUBUS_FIRST_SLOT; + nubus->slot_available_mask =3D MAKE_64BIT_MASK(0, 16); } =20 static void nubus_class_init(ObjectClass *oc, void *data) diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c index c1832f73da..d91a1e4af3 100644 --- a/hw/nubus/nubus-device.c +++ b/hw/nubus/nubus-device.c @@ -160,14 +160,35 @@ static void nubus_device_realize(DeviceState *dev, Er= ror **errp) NubusDevice *nd =3D NUBUS_DEVICE(dev); char *name; hwaddr slot_offset; + uint16_t s; + + if (nd->slot =3D=3D -1) { + /* No slot specified, find first available free slot */ + s =3D ctz32(nubus->slot_available_mask); + if (s !=3D 32) { + nd->slot =3D s; + } else { + error_setg(errp, "Cannot register nubus card, no free slot " + "available"); + return; + } + } else { + /* Slot specified, make sure the slot is available */ + if (!(nubus->slot_available_mask & BIT(nd->slot))) { + error_setg(errp, "Cannot register nubus card, slot %d is " + "unavailable or already occupied", nd->slot); + return; + } + } =20 - if (nubus->current_slot < NUBUS_FIRST_SLOT || - nubus->current_slot > NUBUS_LAST_SLOT) { - error_setg(errp, "Cannot register nubus card, not enough slots"); + if (nd->slot < NUBUS_FIRST_SLOT || nd->slot > NUBUS_LAST_SLOT) { + error_setg(errp, "Cannot register nubus card, slot must be " + "between %d and %d", NUBUS_FIRST_SLOT, + NUBUS_LAST_SLOT); return; } =20 - nd->slot =3D nubus->current_slot++; + nubus->slot_available_mask &=3D ~BIT(nd->slot); =20 /* Super */ slot_offset =3D (nd->slot - 6) * NUBUS_SUPER_SLOT_SIZE; diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h index 357f621d15..8ff4736259 100644 --- a/include/hw/nubus/nubus.h +++ b/include/hw/nubus/nubus.h @@ -19,7 +19,7 @@ #define NUBUS_SLOT_SIZE 0x01000000 #define NUBUS_SLOT_NB 0xF =20 -#define NUBUS_FIRST_SLOT 0x9 +#define NUBUS_FIRST_SLOT 0x0 #define NUBUS_LAST_SLOT 0xF =20 #define TYPE_NUBUS_DEVICE "nubus-device" @@ -36,7 +36,7 @@ struct NubusBus { MemoryRegion super_slot_io; MemoryRegion slot_io; =20 - int current_slot; + uint32_t slot_available_mask; }; =20 struct NubusDevice { --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865361792257.5723698346261; Fri, 17 Sep 2021 00:56:01 -0700 (PDT) Received: from localhost ([::1]:51712 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8j2-00058q-Nt for importer@patchew.org; Fri, 17 Sep 2021 03:56:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38668) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8ea-0005FV-Sb for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:24 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41722 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8eZ-0005PP-03 for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:24 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8eU-0007Od-8o; Fri, 17 Sep 2021 08:51:18 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:42 +0100 Message-Id: <20210917075057.20924-6-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 05/20] nubus: move slot bitmap checks from NubusDevice realize() to BusClass check_address() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865362791100003 Content-Type: text/plain; charset="utf-8" Allow Nubus to manage the slot allocations itself using the BusClass check_= address() virtual function rather than managing this during NubusDevice realize(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/nubus/nubus-bus.c | 37 +++++++++++++++++++++++++++++++++++++ hw/nubus/nubus-device.c | 29 ----------------------------- 2 files changed, 37 insertions(+), 29 deletions(-) diff --git a/hw/nubus/nubus-bus.c b/hw/nubus/nubus-bus.c index 404c1032e0..141876b579 100644 --- a/hw/nubus/nubus-bus.c +++ b/hw/nubus/nubus-bus.c @@ -87,11 +87,48 @@ static void nubus_init(Object *obj) nubus->slot_available_mask =3D MAKE_64BIT_MASK(0, 16); } =20 +static bool nubus_check_address(BusState *bus, DeviceState *dev, Error **e= rrp) +{ + NubusDevice *nd =3D NUBUS_DEVICE(dev); + NubusBus *nubus =3D NUBUS_BUS(bus); + uint16_t s; + + if (nd->slot =3D=3D -1) { + /* No slot specified, find first available free slot */ + s =3D ctz32(nubus->slot_available_mask); + if (s !=3D 32) { + nd->slot =3D s; + } else { + error_setg(errp, "Cannot register nubus card, no free slot " + "available"); + return false; + } + } else { + /* Slot specified, make sure the slot is available */ + if (!(nubus->slot_available_mask & BIT(nd->slot))) { + error_setg(errp, "Cannot register nubus card, slot %d is " + "unavailable or already occupied", nd->slot); + return false; + } + } + + if (nd->slot < NUBUS_FIRST_SLOT || nd->slot > NUBUS_LAST_SLOT) { + error_setg(errp, "Cannot register nubus card, slot must be " + "between %d and %d", NUBUS_FIRST_SLOT, + NUBUS_LAST_SLOT); + return false; + } + + nubus->slot_available_mask &=3D ~BIT(nd->slot); + return true; +} + static void nubus_class_init(ObjectClass *oc, void *data) { BusClass *bc =3D BUS_CLASS(oc); =20 bc->realize =3D nubus_realize; + bc->check_address =3D nubus_check_address; } =20 static const TypeInfo nubus_bus_info =3D { diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c index d91a1e4af3..7a32c8c95b 100644 --- a/hw/nubus/nubus-device.c +++ b/hw/nubus/nubus-device.c @@ -160,35 +160,6 @@ static void nubus_device_realize(DeviceState *dev, Err= or **errp) NubusDevice *nd =3D NUBUS_DEVICE(dev); char *name; hwaddr slot_offset; - uint16_t s; - - if (nd->slot =3D=3D -1) { - /* No slot specified, find first available free slot */ - s =3D ctz32(nubus->slot_available_mask); - if (s !=3D 32) { - nd->slot =3D s; - } else { - error_setg(errp, "Cannot register nubus card, no free slot " - "available"); - return; - } - } else { - /* Slot specified, make sure the slot is available */ - if (!(nubus->slot_available_mask & BIT(nd->slot))) { - error_setg(errp, "Cannot register nubus card, slot %d is " - "unavailable or already occupied", nd->slot); - return; - } - } - - if (nd->slot < NUBUS_FIRST_SLOT || nd->slot > NUBUS_LAST_SLOT) { - error_setg(errp, "Cannot register nubus card, slot must be " - "between %d and %d", NUBUS_FIRST_SLOT, - NUBUS_LAST_SLOT); - return; - } - - nubus->slot_available_mask &=3D ~BIT(nd->slot); =20 /* Super */ slot_offset =3D (nd->slot - 6) * NUBUS_SUPER_SLOT_SIZE; --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865352321227.22538053756136; Fri, 17 Sep 2021 00:55:52 -0700 (PDT) Received: from localhost ([::1]:50608 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8it-0004Qg-2t for importer@patchew.org; Fri, 17 Sep 2021 03:55:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38690) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8ee-0005M5-P5 for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:29 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41728 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8ed-0005SM-A9 for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:28 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8eU-0007Od-LI; Fri, 17 Sep 2021 08:51:22 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:43 +0100 Message-Id: <20210917075057.20924-7-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 06/20] nubus: implement BusClass get_dev_path() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865354245100001 Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/nubus/nubus-bus.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hw/nubus/nubus-bus.c b/hw/nubus/nubus-bus.c index 141876b579..63e7d66b95 100644 --- a/hw/nubus/nubus-bus.c +++ b/hw/nubus/nubus-bus.c @@ -87,6 +87,21 @@ static void nubus_init(Object *obj) nubus->slot_available_mask =3D MAKE_64BIT_MASK(0, 16); } =20 +static char *nubus_get_dev_path(DeviceState *dev) +{ + NubusDevice *nd =3D NUBUS_DEVICE(dev); + BusState *bus =3D qdev_get_parent_bus(dev); + char *p =3D qdev_get_dev_path(bus->parent); + + if (p) { + char *ret =3D g_strdup_printf("%s/%s/%02x", p, bus->name, nd->slot= ); + g_free(p); + return ret; + } else { + return g_strdup_printf("%s/%02x", bus->name, nd->slot); + } +} + static bool nubus_check_address(BusState *bus, DeviceState *dev, Error **e= rrp) { NubusDevice *nd =3D NUBUS_DEVICE(dev); @@ -129,6 +144,7 @@ static void nubus_class_init(ObjectClass *oc, void *dat= a) =20 bc->realize =3D nubus_realize; bc->check_address =3D nubus_check_address; + bc->get_dev_path =3D nubus_get_dev_path; } =20 static const TypeInfo nubus_bus_info =3D { --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865479741218.36980141871084; Fri, 17 Sep 2021 00:57:59 -0700 (PDT) Received: from localhost ([::1]:58464 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8kw-0001Ey-Q6 for importer@patchew.org; Fri, 17 Sep 2021 03:57:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38722) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8ek-0005Nm-5c for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:37 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41734 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8eh-0005Wr-6k for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:33 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8eY-0007Od-TD; Fri, 17 Sep 2021 08:51:26 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:44 +0100 Message-Id: <20210917075057.20924-8-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 07/20] nubus: add trace-events for empty slot accesses X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865481912100001 Increase the max_access_size to 4 bytes for empty Nubus slot and super slot accesses to allow tracing of the Nubus enumeration process by the guest OS. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/nubus/nubus-bus.c | 10 +++++++--- hw/nubus/trace-events | 7 +++++++ hw/nubus/trace.h | 1 + meson.build | 1 + 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 hw/nubus/trace-events create mode 100644 hw/nubus/trace.h diff --git a/hw/nubus/nubus-bus.c b/hw/nubus/nubus-bus.c index 63e7d66b95..39182db065 100644 --- a/hw/nubus/nubus-bus.c +++ b/hw/nubus/nubus-bus.c @@ -11,6 +11,7 @@ #include "qemu/osdep.h" #include "hw/nubus/nubus.h" #include "qapi/error.h" +#include "trace.h" =20 =20 static NubusBus *nubus_find(void) @@ -23,12 +24,13 @@ static void nubus_slot_write(void *opaque, hwaddr addr,= uint64_t val, unsigned int size) { /* read only */ + trace_nubus_slot_write(addr, val, size); } =20 - static uint64_t nubus_slot_read(void *opaque, hwaddr addr, unsigned int size) { + trace_nubus_slot_read(addr, size); return 0; } =20 @@ -38,7 +40,7 @@ static const MemoryRegionOps nubus_slot_ops =3D { .endianness =3D DEVICE_BIG_ENDIAN, .valid =3D { .min_access_size =3D 1, - .max_access_size =3D 1, + .max_access_size =3D 4, }, }; =20 @@ -46,11 +48,13 @@ static void nubus_super_slot_write(void *opaque, hwaddr= addr, uint64_t val, unsigned int size) { /* read only */ + trace_nubus_super_slot_write(addr, val, size); } =20 static uint64_t nubus_super_slot_read(void *opaque, hwaddr addr, unsigned int size) { + trace_nubus_super_slot_read(addr, size); return 0; } =20 @@ -60,7 +64,7 @@ static const MemoryRegionOps nubus_super_slot_ops =3D { .endianness =3D DEVICE_BIG_ENDIAN, .valid =3D { .min_access_size =3D 1, - .max_access_size =3D 1, + .max_access_size =3D 4, }, }; =20 diff --git a/hw/nubus/trace-events b/hw/nubus/trace-events new file mode 100644 index 0000000000..e31833d694 --- /dev/null +++ b/hw/nubus/trace-events @@ -0,0 +1,7 @@ +# See docs/devel/tracing.txt for syntax documentation. + +# nubus-bus.c +nubus_slot_read(uint64_t addr, int size) "reading unassigned addr 0x%"PRIx= 64 " size %d" +nubus_slot_write(uint64_t addr, uint64_t val, int size) "writing unassigne= d addr 0x%"PRIx64 " value 0x%"PRIx64 " size %d" +nubus_super_slot_read(uint64_t addr, int size) "reading unassigned addr 0x= %"PRIx64 " size %d" +nubus_super_slot_write(uint64_t addr, uint64_t val, int size) "writing una= ssigned addr 0x%"PRIx64 " value 0x%"PRIx64 " size %d" diff --git a/hw/nubus/trace.h b/hw/nubus/trace.h new file mode 100644 index 0000000000..3749420da1 --- /dev/null +++ b/hw/nubus/trace.h @@ -0,0 +1 @@ +#include "trace/trace-hw_nubus.h" diff --git a/meson.build b/meson.build index 2711cbb789..612ce671b5 100644 --- a/meson.build +++ b/meson.build @@ -2135,6 +2135,7 @@ if have_system 'hw/misc/macio', 'hw/net', 'hw/net/can', + 'hw/nubus', 'hw/nvme', 'hw/nvram', 'hw/pci', --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865471477735.0084840822108; Fri, 17 Sep 2021 00:57:51 -0700 (PDT) Received: from localhost ([::1]:58092 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8ko-0000zw-DV for importer@patchew.org; Fri, 17 Sep 2021 03:57:50 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38748) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8em-0005Nu-Ov for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:39 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41740 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8el-0005aX-8t for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:36 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8ed-0007Od-0V; Fri, 17 Sep 2021 08:51:30 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:45 +0100 Message-Id: <20210917075057.20924-9-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 08/20] nubus: generate bus error when attempting to access empty slots X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865473413100001 According to "Designing Cards and Drivers for the Macintosh Family" any att= empt to access an unimplemented address location on Nubus generates a bus error.= MacOS uses a custom bus error handler to detect empty Nubus slots, and with the c= urrent implementation assumes that all slots are occupied as the Nubus transactions never fail. Switch nubus_slot_ops and nubus_super_slot_ops over to use {read,write}_wit= h_attrs and hard-code them to return MEMTX_DECODE_ERROR so that unoccupied Nubus sl= ots will generate the expected bus error. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/nubus/nubus-bus.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/hw/nubus/nubus-bus.c b/hw/nubus/nubus-bus.c index 39182db065..a617459a4f 100644 --- a/hw/nubus/nubus-bus.c +++ b/hw/nubus/nubus-bus.c @@ -20,23 +20,23 @@ static NubusBus *nubus_find(void) return NUBUS_BUS(object_resolve_path_type("", TYPE_NUBUS_BUS, NULL)); } =20 -static void nubus_slot_write(void *opaque, hwaddr addr, uint64_t val, - unsigned int size) +static MemTxResult nubus_slot_write(void *opaque, hwaddr addr, uint64_t va= l, + unsigned size, MemTxAttrs attrs) { - /* read only */ trace_nubus_slot_write(addr, val, size); + return MEMTX_DECODE_ERROR; } =20 -static uint64_t nubus_slot_read(void *opaque, hwaddr addr, - unsigned int size) +static MemTxResult nubus_slot_read(void *opaque, hwaddr addr, uint64_t *da= ta, + unsigned size, MemTxAttrs attrs) { trace_nubus_slot_read(addr, size); - return 0; + return MEMTX_DECODE_ERROR; } =20 static const MemoryRegionOps nubus_slot_ops =3D { - .read =3D nubus_slot_read, - .write =3D nubus_slot_write, + .read_with_attrs =3D nubus_slot_read, + .write_with_attrs =3D nubus_slot_write, .endianness =3D DEVICE_BIG_ENDIAN, .valid =3D { .min_access_size =3D 1, @@ -44,23 +44,25 @@ static const MemoryRegionOps nubus_slot_ops =3D { }, }; =20 -static void nubus_super_slot_write(void *opaque, hwaddr addr, uint64_t val, - unsigned int size) +static MemTxResult nubus_super_slot_write(void *opaque, hwaddr addr, + uint64_t val, unsigned size, + MemTxAttrs attrs) { - /* read only */ trace_nubus_super_slot_write(addr, val, size); + return MEMTX_DECODE_ERROR; } =20 -static uint64_t nubus_super_slot_read(void *opaque, hwaddr addr, - unsigned int size) +static MemTxResult nubus_super_slot_read(void *opaque, hwaddr addr, + uint64_t *data, unsigned size, + MemTxAttrs attrs) { trace_nubus_super_slot_read(addr, size); - return 0; + return MEMTX_DECODE_ERROR; } =20 static const MemoryRegionOps nubus_super_slot_ops =3D { - .read =3D nubus_super_slot_read, - .write =3D nubus_super_slot_write, + .read_with_attrs =3D nubus_super_slot_read, + .write_with_attrs =3D nubus_super_slot_write, .endianness =3D DEVICE_BIG_ENDIAN, .valid =3D { .min_access_size =3D 1, --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865604935137.66511919405525; Fri, 17 Sep 2021 01:00:04 -0700 (PDT) Received: from localhost ([::1]:36598 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8mx-0005Ua-JL for importer@patchew.org; Fri, 17 Sep 2021 04:00:03 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38766) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8en-0005O2-MR for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:41 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41746 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8el-0005ar-GZ for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:37 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8eh-0007Od-1k; Fri, 17 Sep 2021 08:51:31 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:46 +0100 Message-Id: <20210917075057.20924-10-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 09/20] macfb: don't register declaration ROM X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865606059100001 Content-Type: text/plain; charset="utf-8" The macfb device is an on-board framebuffer and so is initialised by the system declaration ROM included within the MacOS toolbox ROM. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/display/macfb.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/hw/display/macfb.c b/hw/display/macfb.c index d8183b9bbd..76808b69cc 100644 --- a/hw/display/macfb.c +++ b/hw/display/macfb.c @@ -383,10 +383,6 @@ static void macfb_sysbus_realize(DeviceState *dev, Err= or **errp) sysbus_init_mmio(SYS_BUS_DEVICE(s), &ms->mem_vram); } =20 -const uint8_t macfb_rom[] =3D { - 255, 0, 0, 0, -}; - static void macfb_nubus_realize(DeviceState *dev, Error **errp) { NubusDevice *nd =3D NUBUS_DEVICE(dev); @@ -399,8 +395,6 @@ static void macfb_nubus_realize(DeviceState *dev, Error= **errp) macfb_common_realize(dev, ms, errp); memory_region_add_subregion(&nd->slot_mem, DAFB_BASE, &ms->mem_ctrl); memory_region_add_subregion(&nd->slot_mem, VIDEO_BASE, &ms->mem_vram); - - nubus_register_rom(nd, macfb_rom, sizeof(macfb_rom), 1, 9, 0xf); } =20 static void macfb_sysbus_reset(DeviceState *d) --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865616143237.75340570644414; Fri, 17 Sep 2021 01:00:16 -0700 (PDT) Received: from localhost ([::1]:37066 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8n9-0005np-0i for importer@patchew.org; Fri, 17 Sep 2021 04:00:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8eo-0005O4-45 for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:41 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41750 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8em-0005av-0f for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:37 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8eh-0007Od-Aj; Fri, 17 Sep 2021 08:51:31 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:47 +0100 Message-Id: <20210917075057.20924-11-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 10/20] nubus-device: remove nubus_register_rom() and nubus_register_format_block() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865617158100001 Content-Type: text/plain; charset="utf-8" Since there is no need to generate a dummy declaration ROM, remove both nubus_register_rom() and nubus_register_format_block(). These will shortly = be replaced with a mechanism to optionally load a declaration ROM from disk to allow real images to be used within QEMU. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/nubus/nubus-device.c | 143 --------------------------------------- include/hw/nubus/nubus.h | 19 ------ 2 files changed, 162 deletions(-) diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c index 7a32c8c95b..9c1992ceb0 100644 --- a/hw/nubus/nubus-device.c +++ b/hw/nubus/nubus-device.c @@ -13,147 +13,6 @@ #include "qapi/error.h" =20 =20 -/* The Format Block Structure */ - -#define FBLOCK_DIRECTORY_OFFSET 0 -#define FBLOCK_LENGTH 4 -#define FBLOCK_CRC 8 -#define FBLOCK_REVISION_LEVEL 12 -#define FBLOCK_FORMAT 13 -#define FBLOCK_TEST_PATTERN 14 -#define FBLOCK_RESERVED 18 -#define FBLOCK_BYTE_LANES 19 - -#define FBLOCK_SIZE 20 -#define FBLOCK_PATTERN_VAL 0x5a932bc7 - -static uint64_t nubus_fblock_read(void *opaque, hwaddr addr, unsigned int = size) -{ - NubusDevice *dev =3D opaque; - uint64_t val; - -#define BYTE(v, b) (((v) >> (24 - 8 * (b))) & 0xff) - switch (addr) { - case FBLOCK_BYTE_LANES: - val =3D dev->byte_lanes; - val |=3D (val ^ 0xf) << 4; - break; - case FBLOCK_RESERVED: - val =3D 0x00; - break; - case FBLOCK_TEST_PATTERN...FBLOCK_TEST_PATTERN + 3: - val =3D BYTE(FBLOCK_PATTERN_VAL, addr - FBLOCK_TEST_PATTERN); - break; - case FBLOCK_FORMAT: - val =3D dev->rom_format; - break; - case FBLOCK_REVISION_LEVEL: - val =3D dev->rom_rev; - break; - case FBLOCK_CRC...FBLOCK_CRC + 3: - val =3D BYTE(dev->rom_crc, addr - FBLOCK_CRC); - break; - case FBLOCK_LENGTH...FBLOCK_LENGTH + 3: - val =3D BYTE(dev->rom_length, addr - FBLOCK_LENGTH); - break; - case FBLOCK_DIRECTORY_OFFSET...FBLOCK_DIRECTORY_OFFSET + 3: - val =3D BYTE(dev->directory_offset, addr - FBLOCK_DIRECTORY_OFFSET= ); - break; - default: - val =3D 0; - break; - } - return val; -} - -static void nubus_fblock_write(void *opaque, hwaddr addr, uint64_t val, - unsigned int size) -{ - /* read only */ -} - -static const MemoryRegionOps nubus_format_block_ops =3D { - .read =3D nubus_fblock_read, - .write =3D nubus_fblock_write, - .endianness =3D DEVICE_BIG_ENDIAN, - .valid =3D { - .min_access_size =3D 1, - .max_access_size =3D 1, - } -}; - -static void nubus_register_format_block(NubusDevice *dev) -{ - char *fblock_name; - - fblock_name =3D g_strdup_printf("nubus-slot-%d-format-block", - dev->slot); - - hwaddr fblock_offset =3D memory_region_size(&dev->slot_mem) - FBLOCK_S= IZE; - memory_region_init_io(&dev->fblock_io, NULL, &nubus_format_block_ops, - dev, fblock_name, FBLOCK_SIZE); - memory_region_add_subregion(&dev->slot_mem, fblock_offset, - &dev->fblock_io); - - g_free(fblock_name); -} - -static void mac_nubus_rom_write(void *opaque, hwaddr addr, uint64_t val, - unsigned int size) -{ - /* read only */ -} - -static uint64_t mac_nubus_rom_read(void *opaque, hwaddr addr, - unsigned int size) -{ - NubusDevice *dev =3D opaque; - - return dev->rom[addr]; -} - -static const MemoryRegionOps mac_nubus_rom_ops =3D { - .read =3D mac_nubus_rom_read, - .write =3D mac_nubus_rom_write, - .endianness =3D DEVICE_BIG_ENDIAN, - .valid =3D { - .min_access_size =3D 1, - .max_access_size =3D 1, - }, -}; - - -void nubus_register_rom(NubusDevice *dev, const uint8_t *rom, uint32_t siz= e, - int revision, int format, uint8_t byte_lanes) -{ - hwaddr rom_offset; - char *rom_name; - - /* FIXME : really compute CRC */ - dev->rom_length =3D 0; - dev->rom_crc =3D 0; - - dev->rom_rev =3D revision; - dev->rom_format =3D format; - - dev->byte_lanes =3D byte_lanes; - dev->directory_offset =3D -size; - - /* ROM */ - - dev->rom =3D rom; - rom_name =3D g_strdup_printf("nubus-slot-%d-rom", dev->slot); - memory_region_init_io(&dev->rom_io, NULL, &mac_nubus_rom_ops, - dev, rom_name, size); - memory_region_set_readonly(&dev->rom_io, true); - - rom_offset =3D memory_region_size(&dev->slot_mem) - FBLOCK_SIZE + - dev->directory_offset; - memory_region_add_subregion(&dev->slot_mem, rom_offset, &dev->rom_io); - - g_free(rom_name); -} - static void nubus_device_realize(DeviceState *dev, Error **errp) { NubusBus *nubus =3D NUBUS_BUS(qdev_get_parent_bus(dev)); @@ -179,8 +38,6 @@ static void nubus_device_realize(DeviceState *dev, Error= **errp) memory_region_add_subregion(&nubus->slot_io, slot_offset, &nd->slot_mem); g_free(name); - - nubus_register_format_block(nd); } =20 static Property nubus_device_properties[] =3D { diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h index 8ff4736259..87a97516c7 100644 --- a/include/hw/nubus/nubus.h +++ b/include/hw/nubus/nubus.h @@ -45,25 +45,6 @@ struct NubusDevice { int32_t slot; MemoryRegion super_slot_mem; MemoryRegion slot_mem; - - /* Format Block */ - - MemoryRegion fblock_io; - - uint32_t rom_length; - uint32_t rom_crc; - uint8_t rom_rev; - uint8_t rom_format; - uint8_t byte_lanes; - int32_t directory_offset; - - /* ROM */ - - MemoryRegion rom_io; - const uint8_t *rom; }; =20 -void nubus_register_rom(NubusDevice *dev, const uint8_t *rom, uint32_t siz= e, - int revision, int format, uint8_t byte_lanes); - #endif --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865485187514.5061040616903; Fri, 17 Sep 2021 00:58:05 -0700 (PDT) Received: from localhost ([::1]:58884 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8l2-0001XS-0l for importer@patchew.org; Fri, 17 Sep 2021 03:58:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38770) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8eo-0005O5-Mi for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:41 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41758 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8em-0005b1-AY for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:38 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8eh-0007Od-PC; Fri, 17 Sep 2021 08:51:32 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:48 +0100 Message-Id: <20210917075057.20924-12-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 11/20] nubus-device: add romfile property for loading declaration ROMs X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io X-Spam_score_int: 0 X-Spam_score: 0.0 X-Spam_bar: / X-Spam_report: (0.0 / 5.0 requ) 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865486134100003 Content-Type: text/plain; charset="utf-8" The declaration ROM is located at the top-most address of the standard slot space. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/nubus/nubus-device.c | 44 +++++++++++++++++++++++++++++++++++++++- include/hw/nubus/nubus.h | 6 ++++++ 2 files changed, 49 insertions(+), 1 deletion(-) diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c index 9c1992ceb0..3da0db4d54 100644 --- a/hw/nubus/nubus-device.c +++ b/hw/nubus/nubus-device.c @@ -9,16 +9,21 @@ */ =20 #include "qemu/osdep.h" +#include "qemu/datadir.h" +#include "hw/loader.h" #include "hw/nubus/nubus.h" #include "qapi/error.h" +#include "qemu/error-report.h" =20 =20 static void nubus_device_realize(DeviceState *dev, Error **errp) { NubusBus *nubus =3D NUBUS_BUS(qdev_get_parent_bus(dev)); NubusDevice *nd =3D NUBUS_DEVICE(dev); - char *name; + char *name, *path; hwaddr slot_offset; + int64_t size; + int ret; =20 /* Super */ slot_offset =3D (nd->slot - 6) * NUBUS_SUPER_SLOT_SIZE; @@ -38,10 +43,47 @@ static void nubus_device_realize(DeviceState *dev, Erro= r **errp) memory_region_add_subregion(&nubus->slot_io, slot_offset, &nd->slot_mem); g_free(name); + + /* Declaration ROM */ + if (nd->romfile !=3D NULL) { + path =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, nd->romfile); + if (path =3D=3D NULL) { + path =3D g_strdup(nd->romfile); + } + + size =3D get_image_size(path); + if (size < 0) { + error_setg(errp, "failed to find romfile \"%s\"", nd->romfile); + g_free(path); + return; + } else if (size =3D=3D 0) { + error_setg(errp, "romfile \"%s\" is empty", nd->romfile); + g_free(path); + return; + } else if (size > NUBUS_DECL_ROM_MAX_SIZE) { + error_setg(errp, "romfile \"%s\" too large (maximum size 128K)= ", + nd->romfile); + g_free(path); + return; + } + + name =3D g_strdup_printf("nubus-slot-%x-declaration-rom", nd->slot= ); + memory_region_init_rom(&nd->decl_rom, OBJECT(dev), name, size, + &error_abort); + ret =3D load_image_mr(path, &nd->decl_rom); + g_free(path); + if (ret < 0) { + error_setg(errp, "could not load romfile \"%s\"", nd->romfile); + return; + } + memory_region_add_subregion(&nd->slot_mem, NUBUS_SLOT_SIZE - size, + &nd->decl_rom); + } } =20 static Property nubus_device_properties[] =3D { DEFINE_PROP_INT32("slot", NubusDevice, slot, -1), + DEFINE_PROP_STRING("romfile", NubusDevice, romfile), DEFINE_PROP_END_OF_LIST() }; =20 diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h index 87a97516c7..0c9f50c32e 100644 --- a/include/hw/nubus/nubus.h +++ b/include/hw/nubus/nubus.h @@ -12,6 +12,7 @@ #include "hw/qdev-properties.h" #include "exec/address-spaces.h" #include "qom/object.h" +#include "qemu/units.h" =20 #define NUBUS_SUPER_SLOT_SIZE 0x10000000U #define NUBUS_SUPER_SLOT_NB 0x9 @@ -39,12 +40,17 @@ struct NubusBus { uint32_t slot_available_mask; }; =20 +#define NUBUS_DECL_ROM_MAX_SIZE (128 * KiB) + struct NubusDevice { DeviceState qdev; =20 int32_t slot; MemoryRegion super_slot_mem; MemoryRegion slot_mem; + + char *romfile; + MemoryRegion decl_rom; }; =20 #endif --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865588091349.38685062923037; Fri, 17 Sep 2021 00:59:48 -0700 (PDT) Received: from localhost ([::1]:36224 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8mh-0005FY-2w for importer@patchew.org; Fri, 17 Sep 2021 03:59:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38872) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8fD-00064T-3X for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:03 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41764 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8f0-0005eJ-Tc for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:02 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8ei-0007Od-5K; Fri, 17 Sep 2021 08:51:35 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:49 +0100 Message-Id: <20210917075057.20924-13-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 12/20] nubus: move nubus to its own 32-bit address space X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865588814100001 According to "Designing Cards and Drivers for the Macintosh Family" the Nub= us has its own 32-bit address space based upon physical slot addressing. Move Nubus to its own 32-bit address space and then use memory region alias= es to map available slot and super slot ranges into the q800 system address space via the Macintosh Nubus bridge. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/m68k/q800.c | 8 +++----- hw/nubus/mac-nubus-bridge.c | 15 +++++++++++++-- hw/nubus/nubus-bus.c | 18 ++++++++++++++++++ hw/nubus/nubus-device.c | 2 +- include/hw/nubus/mac-nubus-bridge.h | 2 ++ include/hw/nubus/nubus.h | 10 +++++++--- 6 files changed, 44 insertions(+), 11 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 5ba87f789c..0a0051a296 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -67,9 +67,6 @@ #define ASC_BASE (IO_BASE + 0x14000) #define SWIM_BASE (IO_BASE + 0x1E000) =20 -#define NUBUS_SUPER_SLOT_BASE 0x60000000 -#define NUBUS_SLOT_BASE 0xf0000000 - #define SONIC_PROM_SIZE 0x1000 =20 /* @@ -396,8 +393,9 @@ static void q800_init(MachineState *machine) =20 dev =3D qdev_new(TYPE_MAC_NUBUS_BRIDGE); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, NUBUS_SUPER_SLOT_BASE); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 9 * NUBUS_SUPER_SLOT_SIZE); + sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE + + 9 * NUBUS_SLOT_SIZE); =20 nubus =3D MAC_NUBUS_BRIDGE(dev)->bus; =20 diff --git a/hw/nubus/mac-nubus-bridge.c b/hw/nubus/mac-nubus-bridge.c index c1d77e2bc7..574bc7831e 100644 --- a/hw/nubus/mac-nubus-bridge.c +++ b/hw/nubus/mac-nubus-bridge.c @@ -21,8 +21,19 @@ static void mac_nubus_bridge_init(Object *obj) /* Macintosh only has slots 0x9 to 0xe available */ s->bus->slot_available_mask =3D MAKE_64BIT_MASK(9, 6); =20 - sysbus_init_mmio(sbd, &s->bus->super_slot_io); - sysbus_init_mmio(sbd, &s->bus->slot_io); + /* Aliases for slots 0x9 to 0xe */ + memory_region_init_alias(&s->super_slot_alias, obj, "super-slot-alias", + &s->bus->nubus_mr, + 9 * NUBUS_SUPER_SLOT_SIZE, + 6 * NUBUS_SUPER_SLOT_SIZE); + + memory_region_init_alias(&s->slot_alias, obj, "slot-alias", + &s->bus->nubus_mr, + NUBUS_SLOT_BASE + 9 * NUBUS_SLOT_SIZE, + 6 * NUBUS_SLOT_SIZE); + + sysbus_init_mmio(sbd, &s->super_slot_alias); + sysbus_init_mmio(sbd, &s->slot_alias); } =20 static void mac_nubus_bridge_class_init(ObjectClass *klass, void *data) diff --git a/hw/nubus/nubus-bus.c b/hw/nubus/nubus-bus.c index a617459a4f..ab3515fb75 100644 --- a/hw/nubus/nubus-bus.c +++ b/hw/nubus/nubus-bus.c @@ -70,25 +70,42 @@ static const MemoryRegionOps nubus_super_slot_ops =3D { }, }; =20 +static void nubus_unrealize(BusState *bus) +{ + NubusBus *nubus =3D NUBUS_BUS(bus); + + address_space_destroy(&nubus->nubus_as); +} + static void nubus_realize(BusState *bus, Error **errp) { + NubusBus *nubus =3D NUBUS_BUS(bus); + if (!nubus_find()) { error_setg(errp, "at most one %s device is permitted", TYPE_NUBUS_= BUS); return; } + + address_space_init(&nubus->nubus_as, &nubus->nubus_mr, "nubus"); } =20 static void nubus_init(Object *obj) { NubusBus *nubus =3D NUBUS_BUS(obj); =20 + memory_region_init(&nubus->nubus_mr, obj, "nubus", 0x100000000); + memory_region_init_io(&nubus->super_slot_io, obj, &nubus_super_slot_op= s, nubus, "nubus-super-slots", NUBUS_SUPER_SLOT_NB * NUBUS_SUPER_SLOT_SIZE); + memory_region_add_subregion(&nubus->nubus_mr, 0x0, &nubus->super_slot_= io); =20 memory_region_init_io(&nubus->slot_io, obj, &nubus_slot_ops, nubus, "nubus-slots", NUBUS_SLOT_NB * NUBUS_SLOT_SIZE); + memory_region_add_subregion(&nubus->nubus_mr, + NUBUS_SUPER_SLOT_NB * NUBUS_SUPER_SLOT_SIZ= E, + &nubus->slot_io); =20 nubus->slot_available_mask =3D MAKE_64BIT_MASK(0, 16); } @@ -149,6 +166,7 @@ static void nubus_class_init(ObjectClass *oc, void *dat= a) BusClass *bc =3D BUS_CLASS(oc); =20 bc->realize =3D nubus_realize; + bc->unrealize =3D nubus_unrealize; bc->check_address =3D nubus_check_address; bc->get_dev_path =3D nubus_get_dev_path; } diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c index 3da0db4d54..9cecb487a1 100644 --- a/hw/nubus/nubus-device.c +++ b/hw/nubus/nubus-device.c @@ -26,7 +26,7 @@ static void nubus_device_realize(DeviceState *dev, Error = **errp) int ret; =20 /* Super */ - slot_offset =3D (nd->slot - 6) * NUBUS_SUPER_SLOT_SIZE; + slot_offset =3D nd->slot * NUBUS_SUPER_SLOT_SIZE; =20 name =3D g_strdup_printf("nubus-super-slot-%x", nd->slot); memory_region_init(&nd->super_slot_mem, OBJECT(dev), name, diff --git a/include/hw/nubus/mac-nubus-bridge.h b/include/hw/nubus/mac-nub= us-bridge.h index 36aa098dd4..650fd24eab 100644 --- a/include/hw/nubus/mac-nubus-bridge.h +++ b/include/hw/nubus/mac-nubus-bridge.h @@ -19,6 +19,8 @@ struct MacNubusState { SysBusDevice sysbus_dev; =20 NubusBus *bus; + MemoryRegion super_slot_alias; + MemoryRegion slot_alias; }; =20 #endif diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h index 0c9f50c32e..0b9f74d4ac 100644 --- a/include/hw/nubus/nubus.h +++ b/include/hw/nubus/nubus.h @@ -15,13 +15,14 @@ #include "qemu/units.h" =20 #define NUBUS_SUPER_SLOT_SIZE 0x10000000U -#define NUBUS_SUPER_SLOT_NB 0x9 +#define NUBUS_SUPER_SLOT_NB 0xf =20 +#define NUBUS_SLOT_BASE (NUBUS_SUPER_SLOT_SIZE * NUBUS_SUPER_SLOT_NB) #define NUBUS_SLOT_SIZE 0x01000000 -#define NUBUS_SLOT_NB 0xF +#define NUBUS_SLOT_NB 0xf =20 #define NUBUS_FIRST_SLOT 0x0 -#define NUBUS_LAST_SLOT 0xF +#define NUBUS_LAST_SLOT 0xf =20 #define TYPE_NUBUS_DEVICE "nubus-device" OBJECT_DECLARE_SIMPLE_TYPE(NubusDevice, NUBUS_DEVICE) @@ -34,6 +35,9 @@ OBJECT_DECLARE_SIMPLE_TYPE(NubusBus, NUBUS_BUS) struct NubusBus { BusState qbus; =20 + AddressSpace nubus_as; + MemoryRegion nubus_mr; + MemoryRegion super_slot_io; MemoryRegion slot_io; =20 --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865825488289.5795532787412; Fri, 17 Sep 2021 01:03:45 -0700 (PDT) Received: from localhost ([::1]:42684 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8qW-0001L9-Cu for importer@patchew.org; Fri, 17 Sep 2021 04:03:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38832) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8f7-0005fy-7u for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:57 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41770 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8f4-0005hn-LF for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:51:56 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8el-0007Od-RF; Fri, 17 Sep 2021 08:51:39 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:50 +0100 Message-Id: <20210917075057.20924-14-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 13/20] nubus-bridge: introduce separate NubusBridge structure X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865827305100001 This is to allow the Nubus bridge to store its own additional state. Also u= pdate the comment in the file header to reflect that nubus-bridge is not specific= to the Macintosh. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/nubus/nubus-bridge.c | 4 ++-- include/hw/nubus/mac-nubus-bridge.h | 2 +- include/hw/nubus/nubus.h | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/hw/nubus/nubus-bridge.c b/hw/nubus/nubus-bridge.c index cd8c6a91eb..95662568c5 100644 --- a/hw/nubus/nubus-bridge.c +++ b/hw/nubus/nubus-bridge.c @@ -1,5 +1,5 @@ /* - * QEMU Macintosh Nubus + * QEMU Nubus * * Copyright (c) 2013-2018 Laurent Vivier * @@ -22,7 +22,7 @@ static void nubus_bridge_class_init(ObjectClass *klass, v= oid *data) static const TypeInfo nubus_bridge_info =3D { .name =3D TYPE_NUBUS_BRIDGE, .parent =3D TYPE_SYS_BUS_DEVICE, - .instance_size =3D sizeof(SysBusDevice), + .instance_size =3D sizeof(NubusBridge), .class_init =3D nubus_bridge_class_init, }; =20 diff --git a/include/hw/nubus/mac-nubus-bridge.h b/include/hw/nubus/mac-nub= us-bridge.h index 650fd24eab..7365038966 100644 --- a/include/hw/nubus/mac-nubus-bridge.h +++ b/include/hw/nubus/mac-nubus-bridge.h @@ -16,7 +16,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(MacNubusState, MAC_NUBUS_BRIDGE) =20 struct MacNubusState { - SysBusDevice sysbus_dev; + NubusBridge parent_obj; =20 NubusBus *bus; MemoryRegion super_slot_alias; diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h index 0b9f74d4ac..bb2e70e1d1 100644 --- a/include/hw/nubus/nubus.h +++ b/include/hw/nubus/nubus.h @@ -10,6 +10,7 @@ #define HW_NUBUS_NUBUS_H =20 #include "hw/qdev-properties.h" +#include "hw/sysbus.h" #include "exec/address-spaces.h" #include "qom/object.h" #include "qemu/units.h" @@ -31,6 +32,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(NubusDevice, NUBUS_DEVICE) OBJECT_DECLARE_SIMPLE_TYPE(NubusBus, NUBUS_BUS) =20 #define TYPE_NUBUS_BRIDGE "nubus-bridge" +OBJECT_DECLARE_SIMPLE_TYPE(NubusBridge, NUBUS_BRIDGE); =20 struct NubusBus { BusState qbus; @@ -57,4 +59,8 @@ struct NubusDevice { MemoryRegion decl_rom; }; =20 +struct NubusBridge { + SysBusDevice parent_obj; +}; + #endif --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631866081833967.9168495023852; Fri, 17 Sep 2021 01:08:01 -0700 (PDT) Received: from localhost ([::1]:49246 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8ue-0005zw-Su for importer@patchew.org; Fri, 17 Sep 2021 04:08:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38844) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8fA-0005sb-Bv for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:00 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41776 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8f7-0005kj-LI for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:00 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8ep-0007Od-QR; Fri, 17 Sep 2021 08:51:43 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:51 +0100 Message-Id: <20210917075057.20924-15-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 14/20] mac-nubus-bridge: rename MacNubusState to MacNubusBridge X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631866083747100001 This better reflects that the mac-nubus-bridge device is derived from the nubus-bridge device, and that the structure represents the state of the bri= dge device and not the Nubus itself. Also update the comment in the file header= to reflect that mac-nubus-bridge is specific to the Macintosh. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/nubus/mac-nubus-bridge.c | 8 +++++--- include/hw/nubus/mac-nubus-bridge.h | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/nubus/mac-nubus-bridge.c b/hw/nubus/mac-nubus-bridge.c index 574bc7831e..76ea403f80 100644 --- a/hw/nubus/mac-nubus-bridge.c +++ b/hw/nubus/mac-nubus-bridge.c @@ -1,5 +1,7 @@ /* - * Copyright (c) 2013-2018 Laurent Vivier + * QEMU Macintosh Nubus + * + * Copyright (c) 2013-2018 Laurent Vivier * * This work is licensed under the terms of the GNU GPL, version 2 or late= r. * See the COPYING file in the top-level directory. @@ -13,7 +15,7 @@ =20 static void mac_nubus_bridge_init(Object *obj) { - MacNubusState *s =3D MAC_NUBUS_BRIDGE(obj); + MacNubusBridge *s =3D MAC_NUBUS_BRIDGE(obj); SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); =20 s->bus =3D NUBUS_BUS(qbus_create(TYPE_NUBUS_BUS, DEVICE(s), NULL)); @@ -47,7 +49,7 @@ static const TypeInfo mac_nubus_bridge_info =3D { .name =3D TYPE_MAC_NUBUS_BRIDGE, .parent =3D TYPE_NUBUS_BRIDGE, .instance_init =3D mac_nubus_bridge_init, - .instance_size =3D sizeof(MacNubusState), + .instance_size =3D sizeof(MacNubusBridge), .class_init =3D mac_nubus_bridge_class_init, }; =20 diff --git a/include/hw/nubus/mac-nubus-bridge.h b/include/hw/nubus/mac-nub= us-bridge.h index 7365038966..d9bb11db31 100644 --- a/include/hw/nubus/mac-nubus-bridge.h +++ b/include/hw/nubus/mac-nubus-bridge.h @@ -13,9 +13,9 @@ #include "qom/object.h" =20 #define TYPE_MAC_NUBUS_BRIDGE "mac-nubus-bridge" -OBJECT_DECLARE_SIMPLE_TYPE(MacNubusState, MAC_NUBUS_BRIDGE) +OBJECT_DECLARE_SIMPLE_TYPE(MacNubusBridge, MAC_NUBUS_BRIDGE) =20 -struct MacNubusState { +struct MacNubusBridge { NubusBridge parent_obj; =20 NubusBus *bus; --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 163186585023126.65431083995429; Fri, 17 Sep 2021 01:04:10 -0700 (PDT) Received: from localhost ([::1]:43394 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8qv-0001oz-7y for importer@patchew.org; Fri, 17 Sep 2021 04:04:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38880) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8fD-00067J-SY for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:03 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41782 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8fB-0005oK-8k for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:03 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8et-0007Od-Cm; Fri, 17 Sep 2021 08:51:47 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:52 +0100 Message-Id: <20210917075057.20924-16-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 15/20] nubus: move NubusBus from mac-nubus-bridge to nubus-bridge X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865851610100001 Now that Nubus has its own address space rather than mapping directly into = the system bus, move the Nubus reference from MacNubusBridge to NubusBridge. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/m68k/q800.c | 2 +- hw/nubus/mac-nubus-bridge.c | 9 ++++----- hw/nubus/nubus-bridge.c | 9 +++++++++ include/hw/nubus/mac-nubus-bridge.h | 1 - include/hw/nubus/nubus.h | 2 ++ 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 0a0051a296..46befe0898 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -397,7 +397,7 @@ static void q800_init(MachineState *machine) sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE + 9 * NUBUS_SLOT_SIZE); =20 - nubus =3D MAC_NUBUS_BRIDGE(dev)->bus; + nubus =3D NUBUS_BRIDGE(dev)->bus; =20 /* framebuffer in nubus slot #9 */ =20 diff --git a/hw/nubus/mac-nubus-bridge.c b/hw/nubus/mac-nubus-bridge.c index 76ea403f80..4854e7e546 100644 --- a/hw/nubus/mac-nubus-bridge.c +++ b/hw/nubus/mac-nubus-bridge.c @@ -16,21 +16,20 @@ static void mac_nubus_bridge_init(Object *obj) { MacNubusBridge *s =3D MAC_NUBUS_BRIDGE(obj); + NubusBridge *nb =3D NUBUS_BRIDGE(obj); SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); =20 - s->bus =3D NUBUS_BUS(qbus_create(TYPE_NUBUS_BUS, DEVICE(s), NULL)); - /* Macintosh only has slots 0x9 to 0xe available */ - s->bus->slot_available_mask =3D MAKE_64BIT_MASK(9, 6); + nb->bus->slot_available_mask =3D MAKE_64BIT_MASK(9, 6); =20 /* Aliases for slots 0x9 to 0xe */ memory_region_init_alias(&s->super_slot_alias, obj, "super-slot-alias", - &s->bus->nubus_mr, + &nb->bus->nubus_mr, 9 * NUBUS_SUPER_SLOT_SIZE, 6 * NUBUS_SUPER_SLOT_SIZE); =20 memory_region_init_alias(&s->slot_alias, obj, "slot-alias", - &s->bus->nubus_mr, + &nb->bus->nubus_mr, NUBUS_SLOT_BASE + 9 * NUBUS_SLOT_SIZE, 6 * NUBUS_SLOT_SIZE); =20 diff --git a/hw/nubus/nubus-bridge.c b/hw/nubus/nubus-bridge.c index 95662568c5..3b68d4435c 100644 --- a/hw/nubus/nubus-bridge.c +++ b/hw/nubus/nubus-bridge.c @@ -12,6 +12,14 @@ #include "hw/sysbus.h" #include "hw/nubus/nubus.h" =20 + +static void nubus_bridge_init(Object *obj) +{ + NubusBridge *s =3D NUBUS_BRIDGE(obj); + + s->bus =3D NUBUS_BUS(qbus_create(TYPE_NUBUS_BUS, DEVICE(s), NULL)); +} + static void nubus_bridge_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); @@ -22,6 +30,7 @@ static void nubus_bridge_class_init(ObjectClass *klass, v= oid *data) static const TypeInfo nubus_bridge_info =3D { .name =3D TYPE_NUBUS_BRIDGE, .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_init =3D nubus_bridge_init, .instance_size =3D sizeof(NubusBridge), .class_init =3D nubus_bridge_class_init, }; diff --git a/include/hw/nubus/mac-nubus-bridge.h b/include/hw/nubus/mac-nub= us-bridge.h index d9bb11db31..45ec610d52 100644 --- a/include/hw/nubus/mac-nubus-bridge.h +++ b/include/hw/nubus/mac-nubus-bridge.h @@ -18,7 +18,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(MacNubusBridge, MAC_NUBUS_BRID= GE) struct MacNubusBridge { NubusBridge parent_obj; =20 - NubusBus *bus; MemoryRegion super_slot_alias; MemoryRegion slot_alias; }; diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h index bb2e70e1d1..2c83e7f7b8 100644 --- a/include/hw/nubus/nubus.h +++ b/include/hw/nubus/nubus.h @@ -61,6 +61,8 @@ struct NubusDevice { =20 struct NubusBridge { SysBusDevice parent_obj; + + NubusBus *bus; }; =20 #endif --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631866166120293.0150053148469; Fri, 17 Sep 2021 01:09:26 -0700 (PDT) Received: from localhost ([::1]:53248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8w1-0000L7-7O for importer@patchew.org; Fri, 17 Sep 2021 04:09:25 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38898) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8fH-0006JP-Np for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:08 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41788 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8fF-0005rd-Hg for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:07 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8ex-0007Od-3c; Fri, 17 Sep 2021 08:51:51 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:53 +0100 Message-Id: <20210917075057.20924-17-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 16/20] nubus-bridge: embed the NubusBus object directly within nubus-bridge X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631866168206100001 Since nubus-bridge is a container for NubusBus then it should be embedded directly within the bridge device using qbus_create_inplace(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/m68k/q800.c | 2 +- hw/nubus/mac-nubus-bridge.c | 7 ++++--- hw/nubus/nubus-bridge.c | 3 ++- include/hw/nubus/nubus.h | 2 +- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 46befe0898..e34df1a829 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -397,7 +397,7 @@ static void q800_init(MachineState *machine) sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE + 9 * NUBUS_SLOT_SIZE); =20 - nubus =3D NUBUS_BRIDGE(dev)->bus; + nubus =3D &NUBUS_BRIDGE(dev)->bus; =20 /* framebuffer in nubus slot #9 */ =20 diff --git a/hw/nubus/mac-nubus-bridge.c b/hw/nubus/mac-nubus-bridge.c index 4854e7e546..f764b2f562 100644 --- a/hw/nubus/mac-nubus-bridge.c +++ b/hw/nubus/mac-nubus-bridge.c @@ -18,18 +18,19 @@ static void mac_nubus_bridge_init(Object *obj) MacNubusBridge *s =3D MAC_NUBUS_BRIDGE(obj); NubusBridge *nb =3D NUBUS_BRIDGE(obj); SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); + NubusBus *bus =3D &nb->bus; =20 /* Macintosh only has slots 0x9 to 0xe available */ - nb->bus->slot_available_mask =3D MAKE_64BIT_MASK(9, 6); + bus->slot_available_mask =3D MAKE_64BIT_MASK(9, 6); =20 /* Aliases for slots 0x9 to 0xe */ memory_region_init_alias(&s->super_slot_alias, obj, "super-slot-alias", - &nb->bus->nubus_mr, + &bus->nubus_mr, 9 * NUBUS_SUPER_SLOT_SIZE, 6 * NUBUS_SUPER_SLOT_SIZE); =20 memory_region_init_alias(&s->slot_alias, obj, "slot-alias", - &nb->bus->nubus_mr, + &bus->nubus_mr, NUBUS_SLOT_BASE + 9 * NUBUS_SLOT_SIZE, 6 * NUBUS_SLOT_SIZE); =20 diff --git a/hw/nubus/nubus-bridge.c b/hw/nubus/nubus-bridge.c index 3b68d4435c..1adda7f5a6 100644 --- a/hw/nubus/nubus-bridge.c +++ b/hw/nubus/nubus-bridge.c @@ -16,8 +16,9 @@ static void nubus_bridge_init(Object *obj) { NubusBridge *s =3D NUBUS_BRIDGE(obj); + NubusBus *bus =3D &s->bus; =20 - s->bus =3D NUBUS_BUS(qbus_create(TYPE_NUBUS_BUS, DEVICE(s), NULL)); + qbus_create_inplace(bus, sizeof(s->bus), TYPE_NUBUS_BUS, DEVICE(s), NU= LL); } =20 static void nubus_bridge_class_init(ObjectClass *klass, void *data) diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h index 2c83e7f7b8..cf9a585a91 100644 --- a/include/hw/nubus/nubus.h +++ b/include/hw/nubus/nubus.h @@ -62,7 +62,7 @@ struct NubusDevice { struct NubusBridge { SysBusDevice parent_obj; =20 - NubusBus *bus; + NubusBus bus; }; =20 #endif --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865822308443.4866494845626; Fri, 17 Sep 2021 01:03:42 -0700 (PDT) Received: from localhost ([::1]:42484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8qR-0001Cw-Si for importer@patchew.org; Fri, 17 Sep 2021 04:03:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38922) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8fL-0006PQ-8y for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:11 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41794 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8fJ-0005vP-Vw for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:11 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8f1-0007Od-9X; Fri, 17 Sep 2021 08:51:55 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:54 +0100 Message-Id: <20210917075057.20924-18-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 17/20] nubus-bridge: make slot_available_mask a qdev property X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865823076100001 Content-Type: text/plain; charset="utf-8" This is to allow Macintosh machines to further specify which slots are avai= lable since the number of addressable slots may not match the number of physical = slots present in the machine. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/nubus/nubus-bridge.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/hw/nubus/nubus-bridge.c b/hw/nubus/nubus-bridge.c index 1adda7f5a6..2c7c4ee121 100644 --- a/hw/nubus/nubus-bridge.c +++ b/hw/nubus/nubus-bridge.c @@ -21,11 +21,18 @@ static void nubus_bridge_init(Object *obj) qbus_create_inplace(bus, sizeof(s->bus), TYPE_NUBUS_BUS, DEVICE(s), NU= LL); } =20 +static Property nubus_bridge_properties[] =3D { + DEFINE_PROP_UINT32("slot-available-mask", NubusBridge, + bus.slot_available_mask, 0xffff), + DEFINE_PROP_END_OF_LIST() +}; + static void nubus_bridge_class_init(ObjectClass *klass, void *data) { DeviceClass *dc =3D DEVICE_CLASS(klass); =20 dc->fw_name =3D "nubus"; + device_class_set_props(dc, nubus_bridge_properties); } =20 static const TypeInfo nubus_bridge_info =3D { --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631866260780529.3004214910671; Fri, 17 Sep 2021 01:11:00 -0700 (PDT) Received: from localhost ([::1]:55728 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8xX-00022A-SC for importer@patchew.org; Fri, 17 Sep 2021 04:10:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8fR-0006UT-6N for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:17 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41798 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8fO-0005yW-0F for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:16 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8f5-0007Od-Fm; Fri, 17 Sep 2021 08:51:59 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:55 +0100 Message-Id: <20210917075057.20924-19-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 18/20] nubus: add support for slot IRQs X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631866262770100001 Content-Type: text/plain; charset="utf-8" Each Nubus slot has an IRQ line that can be used to request service from the CPU. Connect the IRQs to the Nubus bridge so that they can be wired up usin= g qdev gpios accordingly, and introduce a new nubus_set_irq() function that can be= used by Nubus devices to control the slot IRQ. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/nubus/nubus-bridge.c | 2 ++ hw/nubus/nubus-device.c | 8 ++++++++ include/hw/nubus/nubus.h | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/hw/nubus/nubus-bridge.c b/hw/nubus/nubus-bridge.c index 2c7c4ee121..0366d925a9 100644 --- a/hw/nubus/nubus-bridge.c +++ b/hw/nubus/nubus-bridge.c @@ -19,6 +19,8 @@ static void nubus_bridge_init(Object *obj) NubusBus *bus =3D &s->bus; =20 qbus_create_inplace(bus, sizeof(s->bus), TYPE_NUBUS_BUS, DEVICE(s), NU= LL); + + qdev_init_gpio_out(DEVICE(s), bus->irqs, NUBUS_IRQS); } =20 static Property nubus_bridge_properties[] =3D { diff --git a/hw/nubus/nubus-device.c b/hw/nubus/nubus-device.c index 9cecb487a1..4856e81991 100644 --- a/hw/nubus/nubus-device.c +++ b/hw/nubus/nubus-device.c @@ -10,12 +10,20 @@ =20 #include "qemu/osdep.h" #include "qemu/datadir.h" +#include "hw/irq.h" #include "hw/loader.h" #include "hw/nubus/nubus.h" #include "qapi/error.h" #include "qemu/error-report.h" =20 =20 +void nubus_set_irq(NubusDevice *nd, int level) +{ + NubusBus *nubus =3D NUBUS_BUS(qdev_get_parent_bus(DEVICE(nd))); + + qemu_set_irq(nubus->irqs[nd->slot], level); +} + static void nubus_device_realize(DeviceState *dev, Error **errp) { NubusBus *nubus =3D NUBUS_BUS(qdev_get_parent_bus(dev)); diff --git a/include/hw/nubus/nubus.h b/include/hw/nubus/nubus.h index cf9a585a91..1c487f74ac 100644 --- a/include/hw/nubus/nubus.h +++ b/include/hw/nubus/nubus.h @@ -25,6 +25,8 @@ #define NUBUS_FIRST_SLOT 0x0 #define NUBUS_LAST_SLOT 0xf =20 +#define NUBUS_IRQS 16 + #define TYPE_NUBUS_DEVICE "nubus-device" OBJECT_DECLARE_SIMPLE_TYPE(NubusDevice, NUBUS_DEVICE) =20 @@ -44,6 +46,8 @@ struct NubusBus { MemoryRegion slot_io; =20 uint32_t slot_available_mask; + + qemu_irq irqs[NUBUS_IRQS]; }; =20 #define NUBUS_DECL_ROM_MAX_SIZE (128 * KiB) @@ -59,6 +63,8 @@ struct NubusDevice { MemoryRegion decl_rom; }; =20 +void nubus_set_irq(NubusDevice *nd, int level); + struct NubusBridge { SysBusDevice parent_obj; =20 --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631865347823561.2160595968174; Fri, 17 Sep 2021 00:55:47 -0700 (PDT) Received: from localhost ([::1]:50442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8io-0004IX-Lq for importer@patchew.org; Fri, 17 Sep 2021 03:55:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38956) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8fU-0006WL-0b for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:20 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41806 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8fS-000622-Ll for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:19 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8f9-0007Od-NO; Fri, 17 Sep 2021 08:52:04 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:56 +0100 Message-Id: <20210917075057.20924-20-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 19/20] q800: wire up nubus IRQs X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631865349548100001 Content-Type: text/plain; charset="utf-8" Nubus IRQs are routed to the CPU through the VIA2 device so wire up the IRQs using gpios accordingly. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index e34df1a829..fbc45a301f 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -396,6 +396,11 @@ static void q800_init(MachineState *machine) sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 9 * NUBUS_SUPER_SLOT_SIZE); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE + 9 * NUBUS_SLOT_SIZE); + for (i =3D 0; i < VIA2_NUBUS_IRQ_NB; i++) { + qdev_connect_gpio_out(dev, 9 + i, + qdev_get_gpio_in_named(via2_dev, "nubus-irq", + VIA2_NUBUS_IRQ_9 + i)= ); + } =20 nubus =3D &NUBUS_BRIDGE(dev)->bus; =20 --=20 2.20.1 From nobody Fri May 3 19:30:29 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1631866360258746.5112768567151; Fri, 17 Sep 2021 01:12:40 -0700 (PDT) Received: from localhost ([::1]:57856 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mR8z8-0003Wf-VK for importer@patchew.org; Fri, 17 Sep 2021 04:12:38 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38968) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8fY-0006aO-K3 for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:25 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]:41810 helo=mail.default.ilande.bv.iomart.io) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mR8fW-00064h-15 for qemu-devel@nongnu.org; Fri, 17 Sep 2021 03:52:23 -0400 Received: from host109-153-84-64.range109-153.btcentralplus.com ([109.153.84.64] helo=kentang.home) by mail.default.ilande.bv.iomart.io with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mR8fE-0007Od-2d; Fri, 17 Sep 2021 08:52:07 +0100 From: Mark Cave-Ayland To: qemu-devel@nongnu.org, laurent@vivier.eu Date: Fri, 17 Sep 2021 08:50:57 +0100 Message-Id: <20210917075057.20924-21-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> References: <20210917075057.20924-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 109.153.84.64 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 20/20] q800: configure nubus available slots for Quadra 800 X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.default.ilande.bv.iomart.io) 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:41c9:1:41f::167; envelope-from=mark.cave-ayland@ilande.co.uk; helo=mail.default.ilande.bv.iomart.io 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZM-MESSAGEID: 1631866361895100001 Content-Type: text/plain; charset="utf-8" Slot 0x9 is reserved for use by the in-built framebuffer whilst only slots 0xc, 0xd and 0xe physically exist on the Quadra 800. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index fbc45a301f..63f42764eb 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -78,6 +78,13 @@ =20 #define MAC_CLOCK 3686418 =20 +/* + * Slot 0x9 is reserved for use by the in-built framebuffer whilst only + * slots 0xc, 0xd and 0xe physically exist on the Quadra 800 + */ +#define Q800_NUBUS_SLOTS_AVAILABLE (BIT(0x9) | BIT(0xc) | BIT(0xd) | \ + BIT(0xe)) + /* * The GLUE (General Logic Unit) is an Apple custom integrated circuit chip * that performs a variety of functions (RAM management, clock generation,= ...). @@ -392,6 +399,8 @@ static void q800_init(MachineState *machine) /* NuBus */ =20 dev =3D qdev_new(TYPE_MAC_NUBUS_BRIDGE); + qdev_prop_set_uint32(dev, "slot-available-mask", + Q800_NUBUS_SLOTS_AVAILABLE); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 9 * NUBUS_SUPER_SLOT_SIZE); sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE + --=20 2.20.1