From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337737163106.41196990021831; Wed, 21 Jun 2023 01:55:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtbQ-0001uT-3K; Wed, 21 Jun 2023 04:54:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbP-0001tz-4N for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:11 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbM-00035G-N7 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:10 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtbA-0001ZB-2f; Wed, 21 Jun 2023 09:54:00 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=A3/WkMfkaejjywJyaK8uB5G9dA8YvQzmw0BKHuM085M=; b=lbZT5qUWcnG2plZem0q01atRqP 9Lx7D9gVXl01FGpX1YYaAsbetDulAXXO3ELaIdXSa+YTaFe5HGtyIKYOPz3LXa8+nHrIGkKYJXhC6 Wa279eIePpTGgxib9PUurPEbGT191gS0ZNtTp5OliE0icz+Vfc2QmJizLrbKiL3bEWcJPKewOZDlD 5knx5VV8ZcVb3iZSRP2tMPV1CirUHEAulNKYhBrPv9bCJdisubUDMG9VETBY4gnrkXG4N84D4CtWf x1mT0wSYV74ohzLDoNw8wBnjIsskUomX633bZSCIuMkAm6WSls7Ayvgi8GSePYY5Nt/la2GcbpBsR mjJc/MPUgAUjWXSI+MepwBkkgQ/EYghbp7Uzls1HdiFyh4w9lRxQo6mbIAQlheqxoniKgbGO2N2yP inlhwHiIrNURGX2CMidjmoKtse1P0Yzc1I0JA1PlqltgR5nHQ6EqcUQ66n+YGxsPxTvZpaL43I2zq UI1r9qWl/aOPxpdnTbBlJCYLohNwVL99ynZ9PGR1hA8UvmaYpd503vrj42o4dMRVgr3/DPJ5LThnN 6VdipTqemBRyt9ALTdj4x4xqZV8nSpILxMLup2LHxJxbfn0f1z1lSuLid+kqFk6/OpWutCmig3For cHmNp/2Gbcms3EjNtM7y4zAbu7F2GOtSNfBRQwO6s=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:30 +0100 Message-Id: <20230621085353.113233-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 01/24] q800: fix up minor spacing issues in hw_compat_q800 GlobalProperty array X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337737899100003 Ensure there is a space before the final closing brace for all global properties. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/m68k/q800.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 68f0cd8cac..dda57c60bf 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -719,14 +719,14 @@ static void q800_init(MachineState *machine) } =20 static GlobalProperty hw_compat_q800[] =3D { - { "scsi-hd", "quirk_mode_page_vendor_specific_apple", "on"}, + { "scsi-hd", "quirk_mode_page_vendor_specific_apple", "on" }, { "scsi-hd", "vendor", " SEAGATE" }, { "scsi-hd", "product", " ST225N" }, { "scsi-hd", "ver", "1.0 " }, - { "scsi-cd", "quirk_mode_page_apple_vendor", "on"}, - { "scsi-cd", "quirk_mode_sense_rom_use_dbd", "on"}, - { "scsi-cd", "quirk_mode_page_vendor_specific_apple", "on"}, - { "scsi-cd", "quirk_mode_page_truncated", "on"}, + { "scsi-cd", "quirk_mode_page_apple_vendor", "on" }, + { "scsi-cd", "quirk_mode_sense_rom_use_dbd", "on" }, + { "scsi-cd", "quirk_mode_page_vendor_specific_apple", "on" }, + { "scsi-cd", "quirk_mode_page_truncated", "on" }, { "scsi-cd", "vendor", "MATSHITA" }, { "scsi-cd", "product", "CD-ROM CR-8005" }, { "scsi-cd", "ver", "1.0k" }, --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337704742382.702661514237; Wed, 21 Jun 2023 01:55:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtbS-0001v3-MV; Wed, 21 Jun 2023 04:54:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbR-0001ud-AU for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:13 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbP-0003DK-O7 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:13 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtbE-0001ZB-C7; Wed, 21 Jun 2023 09:54:04 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=IRzrPR9ntrOayXydUShbDK23mwAnImbRkwCubHvvs3Y=; b=jWpz3g8hscs/bKGN7+mTUemI/Z Xyf2C5NGOzaq8a7hX8KXIuoFKC+hmZ3HD1SawYhfktfmW50aGfxy4MhGF6oPkfdsCoUvK1N8xVLqG LzgpPYqNqW8LeenT+9nrfn+/jSjreBcpAlaIySrlXTiCAQRDgSMyV0Q4El0cn2Mau6oYeNNIonCXx z0sSBFzlMHiVWz9GPVZenZ3ohRfVyD5wi8eeulRdunl5ODJF6FzzKHCN5QAe6nbiWdg5sGXb63mNM C0uqQF1MdQhaohNLPx96bLCzSmzHe640w9GXfvo73OjQx+OAlLYk+LfwUInXwfP/+wd6ZVxDNLNjD 6ZkX/EUwuUioo7w30KauRwCJ6Sc3ofh+2I4a4MAizMK79Jt0YHCih+7spNSbu/ECbsra+S9/fIbmC KMqind4xICG64lCkAHHIH1vnryt0Au3mn2b/cS/5NlcVAuYrfwg6WGkpDkRX9AbEpPbMPHKOimrEm m6m0iamt+k0XmGMFW9KTsOxtKyW1M5i3mtlkCqTFenJsa/Rl+0jVCuqy89gjdL4yHddtUOK/bNO+B MfE5VlWzf68YNmuOMFcBxFgKe42P8/X1jEg4hVGPIW8Sc3AXKemnLJy1sBSmdtJ6BPI4qv+4Txd8O 25RKJbQ9GYPX00vk7mT2PIDe8fciJfws4VpDNG/yk=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:31 +0100 Message-Id: <20230621085353.113233-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 02/24] q800: add missing space after parent object in GLUEState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337705825100001 This brings GLUEState in line with our current QOM guidelines. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index dda57c60bf..465c510c18 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -100,6 +100,7 @@ OBJECT_DECLARE_SIMPLE_TYPE(GLUEState, GLUE) =20 struct GLUEState { SysBusDevice parent_obj; + M68kCPU *cpu; uint8_t ipr; uint8_t auxmode; --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337808149276.49801764228425; Wed, 21 Jun 2023 01:56:48 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtbX-0001vH-7f; Wed, 21 Jun 2023 04:54:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbV-0001v8-CJ for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:17 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbT-0003Lf-RV for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:17 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtbI-0001ZB-JQ; Wed, 21 Jun 2023 09:54:08 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=9lasJdKtCrbK4QgvPkXoDKIi80sC10wxU9yjgj6rCWk=; b=nN/uuQwpVUQ6b5/bCcxUc4BsLp +6lcib/Lm4nyyxdBxhAFupIoqlYHpuvlHfb+ZcaSRHSLcKK9DHKptoUcNLNIT9XpOfZclCkpkA6Zq HqcbeFUh+VWynabu8QcNnXaKqdXStOwJS/O2bKlcegNTc/JhAiU0dHVqJN8RwBjxYOGKETXSgcVHc XDMzpnCLutaWv8/EsiMT9QwRlU+D4cbGra5N9ABeK9a/Xu2WU78FhLTzt9GeJOoZbhW/bDjJhLCM3 cjdre26l1/2k/fjcagrtLJZMON9CwFtEmecFRN1prQ025+hf2UNzEP+28e7fcfZAFCxTYXcIHqe4I FoU9tUz2EmBudyaZsbz/drFxS/JiWxqWloDHHrUGtJWj8Ac4bpda6FvgUiVKcZK3/Sb6lxPgbT5nD cSIMNL3yD9b+NOA+9h4cdSKiWguebQcebdPw+oLStHajfSeHRVlwA6Z7UjBnCxqgOkE7ZPVhUPV2G HgVj5fsWp2tmKhCpCa819TaKvMm2VtGFR6RY8NfKL7TEVr3JW3Ko1363blabRAbtZQbpssakE0hLz cQ3n+eGfIZ4pTukpl3NCiCV6plWqWC0hZ1wiWXjBwQDzsl1Ep7X3f9IFlnKRQQqgJnL8NY/W4gQEl WhZOQK4gYodmIP6kLMS6jmBomZoJHlWXDwLWxJ4jg=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:32 +0100 Message-Id: <20230621085353.113233-4-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 03/24] q800: introduce Q800MachineState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337810116100007 This provides an overall container and owner for Machine-related objects su= ch as MemoryRegions. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 1 + hw/m68k/q800.c | 2 ++ include/hw/m68k/q800.h | 40 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 include/hw/m68k/q800.h diff --git a/MAINTAINERS b/MAINTAINERS index 88b5a7ee0a..748a66fbaa 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1236,6 +1236,7 @@ F: include/hw/misc/mac_via.h F: include/hw/nubus/* F: include/hw/display/macfb.h F: include/hw/block/swim.h +F: include/hw/m68k/q800.h =20 virt M: Laurent Vivier diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 465c510c18..c0256c8a90 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -38,6 +38,7 @@ #include "standard-headers/asm-m68k/bootinfo.h" #include "standard-headers/asm-m68k/bootinfo-mac.h" #include "bootinfo.h" +#include "hw/m68k/q800.h" #include "hw/misc/mac_via.h" #include "hw/input/adb.h" #include "hw/nubus/mac-nubus-bridge.h" @@ -749,6 +750,7 @@ static void q800_machine_class_init(ObjectClass *oc, vo= id *data) static const TypeInfo q800_machine_typeinfo =3D { .name =3D MACHINE_TYPE_NAME("q800"), .parent =3D TYPE_MACHINE, + .instance_size =3D sizeof(Q800MachineState), .class_init =3D q800_machine_class_init, }; =20 diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h new file mode 100644 index 0000000000..f3bc17aa1b --- /dev/null +++ b/include/hw/m68k/q800.h @@ -0,0 +1,40 @@ +/* + * QEMU Motorla 680x0 Macintosh hardware System Emulator + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#ifndef HW_Q800_H +#define HW_Q800_H + +#include "hw/boards.h" +#include "qom/object.h" + +/* + * The main Q800 machine + */ + +struct Q800MachineState { + MachineState parent_obj; +}; + +#define TYPE_Q800_MACHINE MACHINE_TYPE_NAME("q800") +OBJECT_DECLARE_SIMPLE_TYPE(Q800MachineState, Q800_MACHINE) + +#endif --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337705301779.8518956680298; Wed, 21 Jun 2023 01:55:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtba-0001vq-TD; Wed, 21 Jun 2023 04:54:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbZ-0001vi-H3 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:21 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbY-0003cT-0L for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:21 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtbM-0001ZB-Hk; Wed, 21 Jun 2023 09:54:12 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=nmM/4gzs4L7qGQ7k4E+4KvRFO3wMFBE9VaIv9LgbDF8=; b=J8zt9WKC/gSFIMogBji2c8BJv+ bwpMePdILzE5E1OL+EpGMjlKrFRQavr9LXsHAetkRGSuNX9vXdinpBsRwqmm+s5KEck46/cBeMjgf ciLkV29m9Q2BtpZdtV4827RCJeRhi2GWQuz85azxxy1J9NXkF7GBSa371UC1FkItTGuJdTW0cFr/L s0miHRMgMky9RZWYqWR4N9+hzNnrOstSqUaj2tU0/p9XdJNQvEUIe9xT2s3OTjy/YctokJuPSqlvn kvzyyVINNbvA3LE7tal2GviCyVmE0BuSxQmOUbVEd2q4EKjOPkbjnFiqH5zcqutOsQkZtyHw3Pfk4 Nyrt84cIzC7xYxiKZnxNwvawymwmB8MWXdCjIREeKJlWYQQWiQxifsDXIkgAD6swBoNu32vvIE65q cHpEKdH1Tzm7juugcR0JDQ5siu9PmpHwuOx1YLAosnIlTcVmA71pWYo+24FCRsDjHkqX0QysvBtKj WXqAeQx5bXcLgrnfuXBqqD3OH4LXPurnLjGQG/ToEB6GfW8TweTcypt4ZCqsTZior7hlmkhNF00ns iYcHkyubQE4KVC+6ouhOJ7JZDV0nYhA+5Gx3jY63Fd5+iv7/E3rKmIT/Uj7wwj7C/uXrRr7LtW0x6 JGJdSHUWKCtpCs9kccaG1jlM6Bd+L5V+s83tp/gNE=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:33 +0100 Message-Id: <20230621085353.113233-5-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 04/24] q800: rename q800_init() to q800_machine_init() X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337706140100003 This will enable us later to distinguish between QOM initialisation and mac= hine initialisation. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/m68k/q800.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index c0256c8a90..062a3c6c76 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -362,7 +362,7 @@ static uint8_t fake_mac_rom[] =3D { 0x60, 0xFE /* bras [self] */ }; =20 -static void q800_init(MachineState *machine) +static void q800_machine_init(MachineState *machine) { M68kCPU *cpu =3D NULL; int linux_boot; @@ -738,8 +738,9 @@ static const size_t hw_compat_q800_len =3D G_N_ELEMENTS= (hw_compat_q800); static void q800_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); + mc->desc =3D "Macintosh Quadra 800"; - mc->init =3D q800_init; + mc->init =3D q800_machine_init; mc->default_cpu_type =3D M68K_CPU_TYPE_NAME("m68040"); mc->max_cpus =3D 1; mc->block_default_type =3D IF_SCSI; --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337883699403.4191931739065; Wed, 21 Jun 2023 01:58:03 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtbf-0001wQ-39; Wed, 21 Jun 2023 04:54:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbd-0001wG-H3 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:25 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbc-0003r3-12 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:25 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtbQ-0001ZB-Of; Wed, 21 Jun 2023 09:54:16 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=mOZytEsd0UVLwJIqYYXRX4coqdpplABUTflvJ2Sfdvs=; b=IAAv/1N4nwBehXUzoy5PrSJCGs QkqGf4z41vHpe3INmUi7+duVfhUTXqMJZsCKWO6vgMrR153xprMg7RVmguNnapnzT+f5xMPauhJT4 BdkbOkkkM7nWBv6rMsyRiYz0SyKB+aK05rwhFeaxTa9BxERcigQ0PjXmcCBvdSoBEQnoi/QOClPNm V919JRHL60f6ygQgWlb5ZIa0jnM15GaHIlZvSQbtCax/VTVJBm4ZkBPQuvahfYR//TBg0XxzmFEZp 8RIiJvxUzG7kTdKTsdRXTM7nkECUDxFwicEig1hNVIqTB6L5P4WDtI8Jz90cCQmObn2Mxqr2kwfEk Yio+HxFVKXsA4MCgNshSQO/ijPAr3vvm31/G5sFRfe8FyMCgtP2PwAqfEQnlBks24y80AeB4eH2bj X0YWj39JOODTqpP+mP4AiLDPYM81FXKibGZiYTZwsHvR/Z+xcoaVwRlc3qbm3JwjBzXtBlLas9lm9 2GRNsbj38Lm+hDSGfxYjN9y51K1zzdvDr+GPcROxsZK/JOvv2cLvKHF+P6bD2FxeorCSu5h6r+5c0 +wZ7vygsxYyWT5AOpqE1YC7dUHElbLsY0cw03jX/2kSXRr49tX1DgHTvE54ddfr77+bGa3rP42LKY XbFlSX3hmLktpPqFMjW9RJ3oQQ3RrVveLJ1ELIrFo=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:34 +0100 Message-Id: <20230621085353.113233-6-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 05/24] q800: move CPU object into Q800MachineState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337884446100001 Also change the instantiation of the CPU to use object_initialize_child() followed by a separate realisation. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/m68k/q800.c | 18 +++++++++++++----- include/hw/m68k/q800.h | 3 +++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 062a3c6c76..2b651de3c1 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -364,7 +364,7 @@ static uint8_t fake_mac_rom[] =3D { =20 static void q800_machine_init(MachineState *machine) { - M68kCPU *cpu =3D NULL; + Q800MachineState *m =3D Q800_MACHINE(machine); int linux_boot; int32_t kernel_size; uint64_t elf_entry; @@ -407,8 +407,9 @@ static void q800_machine_init(MachineState *machine) } =20 /* init CPUs */ - cpu =3D M68K_CPU(cpu_create(machine->cpu_type)); - qemu_register_reset(main_cpu_reset, cpu); + object_initialize_child(OBJECT(machine), "cpu", &m->cpu, machine->cpu_= type); + qdev_realize(DEVICE(&m->cpu), NULL, &error_fatal); + qemu_register_reset(main_cpu_reset, &m->cpu); =20 /* RAM */ memory_region_add_subregion(get_system_memory(), 0, machine->ram); @@ -430,7 +431,8 @@ static void q800_machine_init(MachineState *machine) =20 /* IRQ Glue */ glue =3D qdev_new(TYPE_GLUE); - object_property_set_link(OBJECT(glue), "cpu", OBJECT(cpu), &error_abor= t); + object_property_set_link(OBJECT(glue), "cpu", OBJECT(&m->cpu), + &error_abort); sysbus_realize_and_unref(SYS_BUS_DEVICE(glue), &error_fatal); =20 /* VIA 1 */ @@ -605,7 +607,7 @@ static void q800_machine_init(MachineState *machine) =20 macfb_mode =3D (NUBUS_MACFB(dev)->macfb).mode; =20 - cs =3D CPU(cpu); + cs =3D CPU(&m->cpu); if (linux_boot) { uint64_t high; void *param_blob, *param_ptr, *param_rng_seed; @@ -735,6 +737,11 @@ static GlobalProperty hw_compat_q800[] =3D { }; static const size_t hw_compat_q800_len =3D G_N_ELEMENTS(hw_compat_q800); =20 +static const char *q800_machine_valid_cpu_types[] =3D { + M68K_CPU_TYPE_NAME("m68040"), + NULL +}; + static void q800_machine_class_init(ObjectClass *oc, void *data) { MachineClass *mc =3D MACHINE_CLASS(oc); @@ -742,6 +749,7 @@ static void q800_machine_class_init(ObjectClass *oc, vo= id *data) mc->desc =3D "Macintosh Quadra 800"; mc->init =3D q800_machine_init; mc->default_cpu_type =3D M68K_CPU_TYPE_NAME("m68040"); + mc->valid_cpu_types =3D q800_machine_valid_cpu_types; mc->max_cpus =3D 1; mc->block_default_type =3D IF_SCSI; mc->default_ram_id =3D "m68k_mac.ram"; diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h index f3bc17aa1b..4cb1a51dfe 100644 --- a/include/hw/m68k/q800.h +++ b/include/hw/m68k/q800.h @@ -25,6 +25,7 @@ =20 #include "hw/boards.h" #include "qom/object.h" +#include "target/m68k/cpu-qom.h" =20 /* * The main Q800 machine @@ -32,6 +33,8 @@ =20 struct Q800MachineState { MachineState parent_obj; + + M68kCPU cpu; }; =20 #define TYPE_Q800_MACHINE MACHINE_TYPE_NAME("q800") --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337885906986.4628123975423; Wed, 21 Jun 2023 01:58:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtbi-0001x7-UD; Wed, 21 Jun 2023 04:54:30 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbh-0001wg-0o for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:29 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbf-0003wv-Ie for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:28 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtbU-0001ZB-Nj; Wed, 21 Jun 2023 09:54:20 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=gTeIpHlEh1+FjdTZFv1BDfDouv7S37+TGLF5yBGy8K4=; b=JbeKW90Qp2aLFMCyM3FvvBPYtT grhMqisonz2HmrIxf3l6ZYvErPS6TETCDMNDYuUjTlNRxLSTffPixwQHdoI/rUOfEGSI2MXI/8lL2 9FIWL+oWns6JZEw2w6Y81DxFfs5Wfp3ibNvkUB5vPF9xD+PnumdWf1nqhGd179lDSGD7rYwNwRPzy 9sI16epxt9NkExnjvQt7wtQ/LHWyQBgs8JheJbHNpZSQH3/98mNhcNsRHev6KGRIFiy7qxZDKmxjK v/6yRvZgOOF0hBxUB7I5vGmKX1DdbiVLNkKYvITetbhNgXexPJH2B6w9qG9pj7q7iUzGbUvhRavrI cvuTdbQfvPYEkOXWHz0PMCCDVt1PNefn1S1sP65k4DQMGxKHqM5Kvlqt2VLSr1ixnagW54VmR+GRZ uMKK5uuMZPrUxh3vScq93BLiIMbMsSEzrvfnwUlenWFe0U5d1f7JLefZGnVHpOU9pepgNaJSOPnQi 8SbAl0UOhLtxiuMcqOhaArvb9BR6LW/BNYGtcdDiIdCsg8beHbY7C+w0o61DrjVMuBWzeQqeJKx83 fUGmf9x53CuV8oGc90EccmksG1SC1+ENurTNLbpAE+m5ylNOQLdp7/GiX0SJ192uqmbO222HfpmeA VEm2ATd0U3zD+E3DjeMaH+x9fKJHb6K3EYos5k/2A=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:35 +0100 Message-Id: <20230621085353.113233-7-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 06/24] q800: move ROM memory region to Q800MachineState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337886464100007 Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 13 +++++-------- include/hw/m68k/q800.h | 2 ++ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 2b651de3c1..9f9668c2b4 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -372,7 +372,6 @@ static void q800_machine_init(MachineState *machine) int bios_size; ram_addr_t initrd_base; int32_t initrd_size; - MemoryRegion *rom; MemoryRegion *io; MemoryRegion *dp8393x_prom =3D g_new(MemoryRegion, 1); uint8_t *prom; @@ -646,11 +645,10 @@ static void q800_machine_init(MachineState *machine) BOOTINFO1(param_ptr, BI_MAC_VROW, macfb_mode->stride); BOOTINFO1(param_ptr, BI_MAC_SCCBASE, SCC_BASE); =20 - rom =3D g_malloc(sizeof(*rom)); - memory_region_init_ram_ptr(rom, NULL, "m68k_fake_mac.rom", + memory_region_init_ram_ptr(&m->rom, NULL, "m68k_fake_mac.rom", sizeof(fake_mac_rom), fake_mac_rom); - memory_region_set_readonly(rom, true); - memory_region_add_subregion(get_system_memory(), MACROM_ADDR, rom); + memory_region_set_readonly(&m->rom, true); + memory_region_add_subregion(get_system_memory(), MACROM_ADDR, &m->= rom); =20 if (kernel_cmdline) { BOOTINFOSTR(param_ptr, BI_COMMAND_LINE, @@ -692,11 +690,10 @@ static void q800_machine_init(MachineState *machine) } else { uint8_t *ptr; /* allocate and load BIOS */ - rom =3D g_malloc(sizeof(*rom)); - memory_region_init_rom(rom, NULL, "m68k_mac.rom", MACROM_SIZE, + memory_region_init_rom(&m->rom, NULL, "m68k_mac.rom", MACROM_SIZE, &error_abort); filename =3D qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); - memory_region_add_subregion(get_system_memory(), MACROM_ADDR, rom); + memory_region_add_subregion(get_system_memory(), MACROM_ADDR, &m->= rom); =20 /* Load MacROM binary */ if (filename) { diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h index 4cb1a51dfe..d1f1ae4b88 100644 --- a/include/hw/m68k/q800.h +++ b/include/hw/m68k/q800.h @@ -26,6 +26,7 @@ #include "hw/boards.h" #include "qom/object.h" #include "target/m68k/cpu-qom.h" +#include "exec/memory.h" =20 /* * The main Q800 machine @@ -35,6 +36,7 @@ struct Q800MachineState { MachineState parent_obj; =20 M68kCPU cpu; + MemoryRegion rom; }; =20 #define TYPE_Q800_MACHINE MACHINE_TYPE_NAME("q800") --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337796231572.9715411263379; Wed, 21 Jun 2023 01:56:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtbo-0001y6-Iz; Wed, 21 Jun 2023 04:54:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbm-0001xL-FV for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:34 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbj-0004Ab-QQ for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:34 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtbY-0001ZB-AV; Wed, 21 Jun 2023 09:54:24 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=j8lzhw4Is21zkmLwqtHAQ8FQVEhAZpMTlTOTfzm73zU=; b=GGAfjVK0EZrLKogGfbQFEAoy6K mv5Zrcjf340O1Y8IDSymdxLolt6Wppk/bBLg0XTU0XxEYHyTxZx3jBYetR7tu9pUgQgelbEdvbVYs /JBrRorbv5FzXAFK90OzCyaTpqF4xZkSIQebHNcSD5D2ZcjdITjy86N5vi5HHMhd+oUGFspiK5eq3 eRXXT1+t8XZCQ2etyL6XUfIYt1W+yjEkPWsF7EA0xA4lZRcuJ9cs/Yfh73xL5orLRVGtPUXTDc/PU 57aJOakk7BFb6dCFw4ExR8uEKa5vsI9mDlFfyQTl5vxzYZd7GZSIrzp/I8VU8xuS6Rzir1Yv+fLPw ULG9q5pcwVEHkMsitXFlcjvEjeIkPcM/SY2hnylUwoqwEgcnRsYdL6UvdbvdxNe7152lOTyoHDXn2 MUUxXNTIOAEdN4kz93JzPApoJvrKepIG8yFzILGetWxBluHGOoQkqxKLK5ASYD05/1LeLIfxwSCx5 7Fo7LC7knOzvnbxCbujPo72b7GMVNZ7vH0cUt+kHIy/bQUNOlGjSZHHFt0w7VkRctiIozKr0Dbcur pOcS0HbVpk5Nn/XBI1vbBgzIODcM/sdT31lL30zDObY549HGoN/ahMWn1cVVuRWx3dN4DdLkM4IZF rHbq1JoNTemvULJzvw1M4+61bUcQa2uHsIxozC278=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:36 +0100 Message-Id: <20230621085353.113233-8-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 07/24] q800: move GLUE device into separate q800-glue.c file X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337798103100012 Content-Type: text/plain; charset="utf-8" This will allow the q800-glue.h header to be included separately so that the GLUE device can be referenced externally. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- MAINTAINERS | 2 + hw/m68k/meson.build | 2 +- hw/m68k/q800-glue.c | 252 ++++++++++++++++++++++++++++++++++++ hw/m68k/q800.c | 238 +--------------------------------- include/hw/m68k/q800-glue.h | 50 +++++++ 5 files changed, 306 insertions(+), 238 deletions(-) create mode 100644 hw/m68k/q800-glue.c create mode 100644 include/hw/m68k/q800-glue.h diff --git a/MAINTAINERS b/MAINTAINERS index 748a66fbaa..7f323cd2eb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1225,6 +1225,7 @@ q800 M: Laurent Vivier S: Maintained F: hw/m68k/q800.c +F: hw/m68k/q800-glue.c F: hw/misc/mac_via.c F: hw/nubus/* F: hw/display/macfb.c @@ -1237,6 +1238,7 @@ F: include/hw/nubus/* F: include/hw/display/macfb.h F: include/hw/block/swim.h F: include/hw/m68k/q800.h +F: include/hw/m68k/q800-glue.h =20 virt M: Laurent Vivier diff --git a/hw/m68k/meson.build b/hw/m68k/meson.build index 31248641d3..84bc68fa4e 100644 --- a/hw/m68k/meson.build +++ b/hw/m68k/meson.build @@ -2,7 +2,7 @@ m68k_ss =3D ss.source_set() m68k_ss.add(when: 'CONFIG_AN5206', if_true: files('an5206.c', 'mcf5206.c')) m68k_ss.add(when: 'CONFIG_MCF5208', if_true: files('mcf5208.c', 'mcf_intc.= c')) m68k_ss.add(when: 'CONFIG_NEXTCUBE', if_true: files('next-kbd.c', 'next-cu= be.c')) -m68k_ss.add(when: 'CONFIG_Q800', if_true: files('q800.c')) +m68k_ss.add(when: 'CONFIG_Q800', if_true: files('q800.c', 'q800-glue.c')) m68k_ss.add(when: 'CONFIG_M68K_VIRT', if_true: files('virt.c')) =20 hw_arch +=3D {'m68k': m68k_ss} diff --git a/hw/m68k/q800-glue.c b/hw/m68k/q800-glue.c new file mode 100644 index 0000000000..e81f9438f1 --- /dev/null +++ b/hw/m68k/q800-glue.c @@ -0,0 +1,252 @@ +/* + * QEMU q800 logic GLUE (General Logic Unit) + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#include "qemu/osdep.h" +#include "cpu.h" +#include "hw/m68k/q800-glue.h" +#include "hw/boards.h" +#include "hw/irq.h" +#include "hw/nmi.h" +#include "hw/qdev-properties.h" +#include "migration/vmstate.h" + +/* + * The GLUE (General Logic Unit) is an Apple custom integrated circuit chip + * that performs a variety of functions (RAM management, clock generation,= ...). + * The GLUE chip receives interrupt requests from various devices, + * assign priority to each, and asserts one or more interrupt line to the + * CPU. + */ + +/* + * The GLUE logic on the Quadra 800 supports 2 different IRQ routing modes + * controlled from the VIA1 auxmode GPIO (port B bit 6) which are document= ed + * in NetBSD as follows: + * + * A/UX mode (Linux, NetBSD, auxmode GPIO low) + * + * Level 0: Spurious: ignored + * Level 1: Software + * Level 2: VIA2 (except ethernet, sound) + * Level 3: Ethernet + * Level 4: Serial (SCC) + * Level 5: Sound + * Level 6: VIA1 + * Level 7: NMIs: parity errors, RESET button, YANCC error + * + * Classic mode (default: used by MacOS, A/UX 3.0.1, auxmode GPIO high) + * + * Level 0: Spurious: ignored + * Level 1: VIA1 (clock, ADB) + * Level 2: VIA2 (NuBus, SCSI) + * Level 3: + * Level 4: Serial (SCC) + * Level 5: + * Level 6: + * Level 7: Non-maskable: parity errors, RESET button + * + * Note that despite references to A/UX mode in Linux and NetBSD, at least + * A/UX 3.0.1 still uses Classic mode. + */ + +static void GLUE_set_irq(void *opaque, int irq, int level) +{ + GLUEState *s =3D opaque; + int i; + + if (s->auxmode) { + /* Classic mode */ + switch (irq) { + case GLUE_IRQ_IN_VIA1: + irq =3D 0; + break; + + case GLUE_IRQ_IN_VIA2: + irq =3D 1; + break; + + case GLUE_IRQ_IN_SONIC: + /* Route to VIA2 instead */ + qemu_set_irq(s->irqs[GLUE_IRQ_NUBUS_9], level); + return; + + case GLUE_IRQ_IN_ESCC: + irq =3D 3; + break; + + case GLUE_IRQ_IN_NMI: + irq =3D 6; + break; + + default: + g_assert_not_reached(); + } + } else { + /* A/UX mode */ + switch (irq) { + case GLUE_IRQ_IN_VIA1: + irq =3D 5; + break; + + case GLUE_IRQ_IN_VIA2: + irq =3D 1; + break; + + case GLUE_IRQ_IN_SONIC: + irq =3D 2; + break; + + case GLUE_IRQ_IN_ESCC: + irq =3D 3; + break; + + case GLUE_IRQ_IN_NMI: + irq =3D 6; + break; + + default: + g_assert_not_reached(); + } + } + + if (level) { + s->ipr |=3D 1 << irq; + } else { + s->ipr &=3D ~(1 << irq); + } + + for (i =3D 7; i >=3D 0; i--) { + if ((s->ipr >> i) & 1) { + m68k_set_irq_level(s->cpu, i + 1, i + 25); + return; + } + } + m68k_set_irq_level(s->cpu, 0, 0); +} + +static void glue_auxmode_set_irq(void *opaque, int irq, int level) +{ + GLUEState *s =3D GLUE(opaque); + + s->auxmode =3D level; +} + +static void glue_nmi(NMIState *n, int cpu_index, Error **errp) +{ + GLUEState *s =3D GLUE(n); + + /* Hold NMI active for 100ms */ + GLUE_set_irq(s, GLUE_IRQ_IN_NMI, 1); + timer_mod(s->nmi_release, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 100); +} + +static void glue_nmi_release(void *opaque) +{ + GLUEState *s =3D GLUE(opaque); + + GLUE_set_irq(s, GLUE_IRQ_IN_NMI, 0); +} + +static void glue_reset(DeviceState *dev) +{ + GLUEState *s =3D GLUE(dev); + + s->ipr =3D 0; + s->auxmode =3D 0; + + timer_del(s->nmi_release); +} + +static const VMStateDescription vmstate_glue =3D { + .name =3D "q800-glue", + .version_id =3D 0, + .minimum_version_id =3D 0, + .fields =3D (VMStateField[]) { + VMSTATE_UINT8(ipr, GLUEState), + VMSTATE_UINT8(auxmode, GLUEState), + VMSTATE_TIMER_PTR(nmi_release, GLUEState), + VMSTATE_END_OF_LIST(), + }, +}; + +/* + * If the m68k CPU implemented its inbound irq lines as GPIO lines + * rather than via the m68k_set_irq_level() function we would not need + * this cpu link property and could instead provide outbound IRQ lines + * that the board could wire up to the CPU. + */ +static Property glue_properties[] =3D { + DEFINE_PROP_LINK("cpu", GLUEState, cpu, TYPE_M68K_CPU, M68kCPU *), + DEFINE_PROP_END_OF_LIST(), +}; + +static void glue_finalize(Object *obj) +{ + GLUEState *s =3D GLUE(obj); + + timer_free(s->nmi_release); +} + +static void glue_init(Object *obj) +{ + DeviceState *dev =3D DEVICE(obj); + GLUEState *s =3D GLUE(dev); + + qdev_init_gpio_in(dev, GLUE_set_irq, 8); + qdev_init_gpio_in_named(dev, glue_auxmode_set_irq, "auxmode", 1); + + qdev_init_gpio_out(dev, s->irqs, 1); + + /* NMI release timer */ + s->nmi_release =3D timer_new_ms(QEMU_CLOCK_VIRTUAL, glue_nmi_release, = s); +} + +static void glue_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc =3D DEVICE_CLASS(klass); + NMIClass *nc =3D NMI_CLASS(klass); + + dc->vmsd =3D &vmstate_glue; + dc->reset =3D glue_reset; + device_class_set_props(dc, glue_properties); + nc->nmi_monitor_handler =3D glue_nmi; +} + +static const TypeInfo glue_info =3D { + .name =3D TYPE_GLUE, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(GLUEState), + .instance_init =3D glue_init, + .instance_finalize =3D glue_finalize, + .class_init =3D glue_class_init, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_NMI }, + { } + }, +}; + +static void glue_register_types(void) +{ + type_register_static(&glue_info); +} + +type_init(glue_register_types) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 9f9668c2b4..9f9de2ebaf 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -28,7 +28,6 @@ #include "cpu.h" #include "hw/boards.h" #include "hw/or-irq.h" -#include "hw/nmi.h" #include "elf.h" #include "hw/loader.h" #include "ui/console.h" @@ -39,6 +38,7 @@ #include "standard-headers/asm-m68k/bootinfo-mac.h" #include "bootinfo.h" #include "hw/m68k/q800.h" +#include "hw/m68k/q800-glue.h" #include "hw/misc/mac_via.h" #include "hw/input/adb.h" #include "hw/nubus/mac-nubus-bridge.h" @@ -88,241 +88,6 @@ #define Q800_NUBUS_SLOTS_AVAILABLE (BIT(0x9) | BIT(0xc) | BIT(0xd) | \ BIT(0xe)) =20 -/* - * The GLUE (General Logic Unit) is an Apple custom integrated circuit chip - * that performs a variety of functions (RAM management, clock generation,= ...). - * The GLUE chip receives interrupt requests from various devices, - * assign priority to each, and asserts one or more interrupt line to the - * CPU. - */ - -#define TYPE_GLUE "q800-glue" -OBJECT_DECLARE_SIMPLE_TYPE(GLUEState, GLUE) - -struct GLUEState { - SysBusDevice parent_obj; - - M68kCPU *cpu; - uint8_t ipr; - uint8_t auxmode; - qemu_irq irqs[1]; - QEMUTimer *nmi_release; -}; - -#define GLUE_IRQ_IN_VIA1 0 -#define GLUE_IRQ_IN_VIA2 1 -#define GLUE_IRQ_IN_SONIC 2 -#define GLUE_IRQ_IN_ESCC 3 -#define GLUE_IRQ_IN_NMI 4 - -#define GLUE_IRQ_NUBUS_9 0 - -/* - * The GLUE logic on the Quadra 800 supports 2 different IRQ routing modes - * controlled from the VIA1 auxmode GPIO (port B bit 6) which are document= ed - * in NetBSD as follows: - * - * A/UX mode (Linux, NetBSD, auxmode GPIO low) - * - * Level 0: Spurious: ignored - * Level 1: Software - * Level 2: VIA2 (except ethernet, sound) - * Level 3: Ethernet - * Level 4: Serial (SCC) - * Level 5: Sound - * Level 6: VIA1 - * Level 7: NMIs: parity errors, RESET button, YANCC error - * - * Classic mode (default: used by MacOS, A/UX 3.0.1, auxmode GPIO high) - * - * Level 0: Spurious: ignored - * Level 1: VIA1 (clock, ADB) - * Level 2: VIA2 (NuBus, SCSI) - * Level 3: - * Level 4: Serial (SCC) - * Level 5: - * Level 6: - * Level 7: Non-maskable: parity errors, RESET button - * - * Note that despite references to A/UX mode in Linux and NetBSD, at least - * A/UX 3.0.1 still uses Classic mode. - */ - -static void GLUE_set_irq(void *opaque, int irq, int level) -{ - GLUEState *s =3D opaque; - int i; - - if (s->auxmode) { - /* Classic mode */ - switch (irq) { - case GLUE_IRQ_IN_VIA1: - irq =3D 0; - break; - - case GLUE_IRQ_IN_VIA2: - irq =3D 1; - break; - - case GLUE_IRQ_IN_SONIC: - /* Route to VIA2 instead */ - qemu_set_irq(s->irqs[GLUE_IRQ_NUBUS_9], level); - return; - - case GLUE_IRQ_IN_ESCC: - irq =3D 3; - break; - - case GLUE_IRQ_IN_NMI: - irq =3D 6; - break; - - default: - g_assert_not_reached(); - } - } else { - /* A/UX mode */ - switch (irq) { - case GLUE_IRQ_IN_VIA1: - irq =3D 5; - break; - - case GLUE_IRQ_IN_VIA2: - irq =3D 1; - break; - - case GLUE_IRQ_IN_SONIC: - irq =3D 2; - break; - - case GLUE_IRQ_IN_ESCC: - irq =3D 3; - break; - - case GLUE_IRQ_IN_NMI: - irq =3D 6; - break; - - default: - g_assert_not_reached(); - } - } - - if (level) { - s->ipr |=3D 1 << irq; - } else { - s->ipr &=3D ~(1 << irq); - } - - for (i =3D 7; i >=3D 0; i--) { - if ((s->ipr >> i) & 1) { - m68k_set_irq_level(s->cpu, i + 1, i + 25); - return; - } - } - m68k_set_irq_level(s->cpu, 0, 0); -} - -static void glue_auxmode_set_irq(void *opaque, int irq, int level) -{ - GLUEState *s =3D GLUE(opaque); - - s->auxmode =3D level; -} - -static void glue_nmi(NMIState *n, int cpu_index, Error **errp) -{ - GLUEState *s =3D GLUE(n); - - /* Hold NMI active for 100ms */ - GLUE_set_irq(s, GLUE_IRQ_IN_NMI, 1); - timer_mod(s->nmi_release, qemu_clock_get_ms(QEMU_CLOCK_VIRTUAL) + 100); -} - -static void glue_nmi_release(void *opaque) -{ - GLUEState *s =3D GLUE(opaque); - - GLUE_set_irq(s, GLUE_IRQ_IN_NMI, 0); -} - -static void glue_reset(DeviceState *dev) -{ - GLUEState *s =3D GLUE(dev); - - s->ipr =3D 0; - s->auxmode =3D 0; - - timer_del(s->nmi_release); -} - -static const VMStateDescription vmstate_glue =3D { - .name =3D "q800-glue", - .version_id =3D 0, - .minimum_version_id =3D 0, - .fields =3D (VMStateField[]) { - VMSTATE_UINT8(ipr, GLUEState), - VMSTATE_UINT8(auxmode, GLUEState), - VMSTATE_TIMER_PTR(nmi_release, GLUEState), - VMSTATE_END_OF_LIST(), - }, -}; - -/* - * If the m68k CPU implemented its inbound irq lines as GPIO lines - * rather than via the m68k_set_irq_level() function we would not need - * this cpu link property and could instead provide outbound IRQ lines - * that the board could wire up to the CPU. - */ -static Property glue_properties[] =3D { - DEFINE_PROP_LINK("cpu", GLUEState, cpu, TYPE_M68K_CPU, M68kCPU *), - DEFINE_PROP_END_OF_LIST(), -}; - -static void glue_finalize(Object *obj) -{ - GLUEState *s =3D GLUE(obj); - - timer_free(s->nmi_release); -} - -static void glue_init(Object *obj) -{ - DeviceState *dev =3D DEVICE(obj); - GLUEState *s =3D GLUE(dev); - - qdev_init_gpio_in(dev, GLUE_set_irq, 8); - qdev_init_gpio_in_named(dev, glue_auxmode_set_irq, "auxmode", 1); - - qdev_init_gpio_out(dev, s->irqs, 1); - - /* NMI release timer */ - s->nmi_release =3D timer_new_ms(QEMU_CLOCK_VIRTUAL, glue_nmi_release, = s); -} - -static void glue_class_init(ObjectClass *klass, void *data) -{ - DeviceClass *dc =3D DEVICE_CLASS(klass); - NMIClass *nc =3D NMI_CLASS(klass); - - dc->vmsd =3D &vmstate_glue; - dc->reset =3D glue_reset; - device_class_set_props(dc, glue_properties); - nc->nmi_monitor_handler =3D glue_nmi; -} - -static const TypeInfo glue_info =3D { - .name =3D TYPE_GLUE, - .parent =3D TYPE_SYS_BUS_DEVICE, - .instance_size =3D sizeof(GLUEState), - .instance_init =3D glue_init, - .instance_finalize =3D glue_finalize, - .class_init =3D glue_class_init, - .interfaces =3D (InterfaceInfo[]) { - { TYPE_NMI }, - { } - }, -}; =20 static void main_cpu_reset(void *opaque) { @@ -763,7 +528,6 @@ static const TypeInfo q800_machine_typeinfo =3D { static void q800_machine_register_types(void) { type_register_static(&q800_machine_typeinfo); - type_register_static(&glue_info); } =20 type_init(q800_machine_register_types) diff --git a/include/hw/m68k/q800-glue.h b/include/hw/m68k/q800-glue.h new file mode 100644 index 0000000000..c1817b01a5 --- /dev/null +++ b/include/hw/m68k/q800-glue.h @@ -0,0 +1,50 @@ +/* + * QEMU q800 logic glue + * + * Permission is hereby granted, free of charge, to any person obtaining a= copy + * of this software and associated documentation files (the "Software"), t= o deal + * in the Software without restriction, including without limitation the r= ights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or se= ll + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included= in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS= OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OT= HER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING= FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS = IN + * THE SOFTWARE. + */ + +#ifndef HW_Q800_GLUE_H +#define HW_Q800_GLUE_H + +#include "qemu/osdep.h" +#include "hw/sysbus.h" + +#define TYPE_GLUE "q800-glue" +OBJECT_DECLARE_SIMPLE_TYPE(GLUEState, GLUE) + +struct GLUEState { + SysBusDevice parent_obj; + + M68kCPU *cpu; + uint8_t ipr; + uint8_t auxmode; + qemu_irq irqs[1]; + QEMUTimer *nmi_release; +}; + +#define GLUE_IRQ_IN_VIA1 0 +#define GLUE_IRQ_IN_VIA2 1 +#define GLUE_IRQ_IN_SONIC 2 +#define GLUE_IRQ_IN_ESCC 3 +#define GLUE_IRQ_IN_NMI 4 + +#define GLUE_IRQ_NUBUS_9 0 + +#endif --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337877141404.6214258995535; Wed, 21 Jun 2023 01:57:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtbn-0001xq-LC; Wed, 21 Jun 2023 04:54:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbl-0001x9-Hs for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:33 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbk-0004Af-5v for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:33 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtbc-0001ZB-Hp; Wed, 21 Jun 2023 09:54:24 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=dGA6TvJ9RkMAIMqnKUXOKS5DXTkn63/tgtvw4J7l2B8=; b=LLTMff4KAnEOcuWxpnz0/fBXq/ bjvqZQOHiDegqFKKL2jkY0YAKOr/R83gAt15wFeIOjjY03APGlMVj01e/ghkt34jPSfM8C/PlM6NQ wfO6ARopTy0W7M8P505ibCq1rOtusUunWGZpM8zEBL6dikohBLC6mL/nCRD5WtHuMKdBgjaUpObBa 3brd2WuPQRlImrWdkHyUVr4PdiJw7l+Dmr0f1FHXVMWS/KEMPPyuI7YrniMip5nllOsYlGf2cnSeb p5kxlAu7AgN9DwBlBNBoES4XM+fozEw2YsC+L09GDUi5Z3GkhGO23j0oq2BX0veBzKlBKoOBz9/3H nje/X6Vfnwd8DFA1fFjmR5EEJhujQ+E0bIBp6DWqtO4MCsw11WQQf1C4RgA5+MY1wFKbzpMETGanY 74yYaIJMKoj9C3LAxILlAIpoQYnRpgZjJXvIuCGB8g+E2rWq9YmvrlEhA+p4PbCFOQS9yrpL/uy6C oE332/NIdlS3c/CABu4x3wDh6ns0VXoNx6Z6cy32ZhqmsHjfJrbtyHjhBtWka09OeI3sykTS6/uK3 hgM+95puQEhwcgSJT6rSYmQMevACKuJu4YWOIAp8ryqToGVc+H3qLspJ0scXvsA6g+Se5zqg6mcGz v6nNoOzvnOkqrG339KkiEfMS0+f1K/k3P42lmxqgo=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:37 +0100 Message-Id: <20230621085353.113233-9-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 08/24] q800-glue.c: switch TypeInfo registration to use DEFINE_TYPES() macro X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337878373100003 Content-Type: text/plain; charset="utf-8" The use of the DEFINE_TYPES() macro will soon be recommended over the use of calling type_init() directly. Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/m68k/q800-glue.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/hw/m68k/q800-glue.c b/hw/m68k/q800-glue.c index e81f9438f1..34c4f0e987 100644 --- a/hw/m68k/q800-glue.c +++ b/hw/m68k/q800-glue.c @@ -231,22 +231,19 @@ static void glue_class_init(ObjectClass *klass, void = *data) nc->nmi_monitor_handler =3D glue_nmi; } =20 -static const TypeInfo glue_info =3D { - .name =3D TYPE_GLUE, - .parent =3D TYPE_SYS_BUS_DEVICE, - .instance_size =3D sizeof(GLUEState), - .instance_init =3D glue_init, - .instance_finalize =3D glue_finalize, - .class_init =3D glue_class_init, - .interfaces =3D (InterfaceInfo[]) { - { TYPE_NMI }, - { } +static const TypeInfo glue_info_types[] =3D { + { + .name =3D TYPE_GLUE, + .parent =3D TYPE_SYS_BUS_DEVICE, + .instance_size =3D sizeof(GLUEState), + .instance_init =3D glue_init, + .instance_finalize =3D glue_finalize, + .class_init =3D glue_class_init, + .interfaces =3D (InterfaceInfo[]) { + { TYPE_NMI }, + { } + }, }, }; =20 -static void glue_register_types(void) -{ - type_register_static(&glue_info); -} - -type_init(glue_register_types) +DEFINE_TYPES(glue_info_types) --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337796676267.51385272035293; Wed, 21 Jun 2023 01:56:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtbr-0001yd-6Z; Wed, 21 Jun 2023 04:54:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbp-0001y7-NW for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:37 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbn-0004Hx-VM for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:37 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtbc-0001ZB-Rp; Wed, 21 Jun 2023 09:54:28 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=/n5zrLSaDtDHJ3zOJR4Mz9pGiZmeehSFr5RKyw5k2Qw=; b=yMkId6fXsV1cjiWwjeYxAYukkc KUjgsfVEUGvvx0B8sy4MJsIqTlcRGDMmoxtAjD/KteLWMsP1OuGiDyw+jq51T0FHKX527ukxK1Kkt fcN+2aqGxNkfYpKz/WsHi3AbAXxXBppC702rOm6ZvCgzy9f41gxel74b2D905/yl3MHqLk3bWAmw4 jyLqX0xDVQ3h/MZ0kgBiIXkPSO+8GMJ6Gdu0lmHBA3ZG2qGvOir0O7tOt6e2AVaA+/dST6WkN5aoX qdE/UABzfLyT/MR4GMV4Io+IGNgpvYzwXSjUWqwdKFGd/bMHPwSRxC4kQPwV8H76z7Deg4nWzE5W4 d61tMgwcXUypyeOwLYx4MTQ+aFmnLuZ0XV50WSHIXhK/seIzrYe6a7yIZqdbnE9yxl3YbF6Pd0aEo 40Ff8xp+LIhXBHpYDUG1VdliKMNYk/nbfSBH8PXdd+RjStDXWAUGqa+j47enc4KvvjAZha5LRMed2 cRIAfWe8krzPiGdQakNHZDhKVPRYmnJ2ehJ9dYP+Jbw624szcspCMTBtw+rsiER0gKecQBNwtUK8x kpn0xjRq4VncNAbk/Qgs40QxrVG6bA1O58Q9Wpdc/E7dq4ba7sxtught5+NVn83RVC7xgGSaZJonq BFT7ni068F1wxvAAxWrzXuYop71guhR0QiQxd0vQI=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:38 +0100 Message-Id: <20230621085353.113233-10-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 09/24] q800: move GLUE device to Q800MachineState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337798146100015 Also change the instantiation of the GLUE device to use object_initialize_c= hild(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 24 ++++++++++++++---------- include/hw/m68k/q800.h | 2 ++ 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 9f9de2ebaf..505e50d4af 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -158,7 +158,6 @@ static void q800_machine_init(MachineState *machine) SysBusDevice *sysbus; BusState *adb_bus; NubusBus *nubus; - DeviceState *glue; DriveInfo *dinfo; uint8_t rng_seed[32]; =20 @@ -194,10 +193,10 @@ static void q800_machine_init(MachineState *machine) } =20 /* IRQ Glue */ - glue =3D qdev_new(TYPE_GLUE); - object_property_set_link(OBJECT(glue), "cpu", OBJECT(&m->cpu), + object_initialize_child(OBJECT(machine), "glue", &m->glue, TYPE_GLUE); + object_property_set_link(OBJECT(&m->glue), "cpu", OBJECT(&m->cpu), &error_abort); - sysbus_realize_and_unref(SYS_BUS_DEVICE(glue), &error_fatal); + sysbus_realize(SYS_BUS_DEVICE(&m->glue), &error_fatal); =20 /* VIA 1 */ via1_dev =3D qdev_new(TYPE_MOS6522_Q800_VIA1); @@ -208,10 +207,12 @@ static void q800_machine_init(MachineState *machine) sysbus =3D SYS_BUS_DEVICE(via1_dev); sysbus_realize_and_unref(sysbus, &error_fatal); sysbus_mmio_map(sysbus, 1, VIA_BASE); - sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(glue, GLUE_IRQ_IN_VIA1)= ); + sysbus_connect_irq(sysbus, 0, + qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_VIA1= )); /* A/UX mode */ qdev_connect_gpio_out(via1_dev, 0, - qdev_get_gpio_in_named(glue, "auxmode", 0)); + qdev_get_gpio_in_named(DEVICE(&m->glue), + "auxmode", 0)); =20 adb_bus =3D qdev_get_child_bus(via1_dev, "adb.0"); dev =3D qdev_new(TYPE_ADB_KEYBOARD); @@ -224,7 +225,8 @@ static void q800_machine_init(MachineState *machine) sysbus =3D SYS_BUS_DEVICE(via2_dev); sysbus_realize_and_unref(sysbus, &error_fatal); sysbus_mmio_map(sysbus, 1, VIA_BASE + VIA_SIZE); - sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(glue, GLUE_IRQ_IN_VIA2)= ); + sysbus_connect_irq(sysbus, 0, + qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_VIA2= )); =20 /* MACSONIC */ =20 @@ -257,7 +259,8 @@ static void q800_machine_init(MachineState *machine) sysbus =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(sysbus, &error_fatal); sysbus_mmio_map(sysbus, 0, SONIC_BASE); - sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(glue, GLUE_IRQ_IN_SONIC= )); + sysbus_connect_irq(sysbus, 0, + qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_SONI= C)); =20 memory_region_init_rom(dp8393x_prom, NULL, "dp8393x-q800.prom", SONIC_PROM_SIZE, &error_fatal); @@ -294,7 +297,8 @@ static void q800_machine_init(MachineState *machine) sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(escc_orgate, 0)); sysbus_connect_irq(sysbus, 1, qdev_get_gpio_in(escc_orgate, 1)); qdev_connect_gpio_out(escc_orgate, 0, - qdev_get_gpio_in(glue, GLUE_IRQ_IN_ESCC)); + qdev_get_gpio_in(DEVICE(&m->glue), + GLUE_IRQ_IN_ESCC)); sysbus_mmio_map(sysbus, 0, SCC_BASE); =20 /* SCSI */ @@ -349,7 +353,7 @@ static void q800_machine_init(MachineState *machine) * Since the framebuffer in slot 0x9 uses a separate IRQ, wire the unu= sed * IRQ via GLUE for use by SONIC Ethernet in classic mode */ - qdev_connect_gpio_out(glue, GLUE_IRQ_NUBUS_9, + qdev_connect_gpio_out(DEVICE(&m->glue), GLUE_IRQ_NUBUS_9, qdev_get_gpio_in_named(via2_dev, "nubus-irq", VIA2_NUBUS_IRQ_9)); =20 diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h index d1f1ae4b88..fda42e0a1c 100644 --- a/include/hw/m68k/q800.h +++ b/include/hw/m68k/q800.h @@ -27,6 +27,7 @@ #include "qom/object.h" #include "target/m68k/cpu-qom.h" #include "exec/memory.h" +#include "hw/m68k/q800-glue.h" =20 /* * The main Q800 machine @@ -37,6 +38,7 @@ struct Q800MachineState { =20 M68kCPU cpu; MemoryRegion rom; + GLUEState glue; }; =20 #define TYPE_Q800_MACHINE MACHINE_TYPE_NAME("q800") --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337877478545.2616675272261; Wed, 21 Jun 2023 01:57:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtbv-0001zP-Qq; Wed, 21 Jun 2023 04:54:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbt-0001z1-U0 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:41 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbs-0004Wd-Cs for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:41 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtbg-0001ZB-Qn; Wed, 21 Jun 2023 09:54:32 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=G5t5ipRhnuU7HWC3tuyTy5Ua/29wM49HI5NqUNxvl9o=; b=IMStdqkDFjQwq1skdYU34M0Yqp zKkFmQv3HHzNE41nYqcZlO3t6Sdewp8RNWPiX9gpNdeOO7aKHrsphSolBIyMtiRhVMnt6WRV0sJez DeA5pZRve5NjtafWiZaJsQgJk8rSOEsinwY0hZPD46qDdrKMeX7NrBtMbNYZuyycUdJoVBdXp+o4o 6XbvXxRxgCPDMT6juIHUvHFR5Tz0LwQ12PQIFXavdRlOEX0JA+zsI8MgfoBh+j5i/RLfEKF8FpQme wwYUfp4vxdg7+BpDbgmD7gq71AMrm55OEdx/Zap7+xhcaigMAqLFVryhMsrqM7Yl3pmNHr9x8imXc 445qzTRNAUXitOh1pmssYIX75puoFTcWKCJ1drfwoIXu+sfTIznq9777OIvkQYgV+qoNKw2zcKpIZ Za0tEJx8gNrBnUTKN4+HHjIJNc7rfxyyI1kNnQTSxSwaoqqzOKv+ypdxUAl/CXyL8+8ubxUxPDLhv qVDHubtmvUOrvi658IexKmwPSdalB5nJKGQQzi1mY/s+nFRL5evGmQuDNdKKIhxGtjYKvFJCRhb0h AKjgELTc59HrPe2sqIX5w5I/rujlOD7RxCX+SAE8vNOBpLBC0qhUFRlheCwpxSlibtg8OhonDqHLN EXXHiG2j8nG15FkBZRjTaVFZdcW9rn7aruusqk9WE=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:39 +0100 Message-Id: <20230621085353.113233-11-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 10/24] q800: introduce mac-io container 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.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337878903100005 Move all devices from the IO region to within the container in preparation for updating the IO aliasing mechanism. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/m68k/q800.c | 6 ++++++ include/hw/m68k/q800.h | 1 + 2 files changed, 7 insertions(+) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 505e50d4af..359bdf3443 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -177,6 +177,12 @@ static void q800_machine_init(MachineState *machine) /* RAM */ memory_region_add_subregion(get_system_memory(), 0, machine->ram); =20 + /* + * Create container for all IO devices + */ + memory_region_init(&m->macio, OBJECT(machine), "mac-io", IO_SLICE); + memory_region_add_subregion(get_system_memory(), IO_BASE, &m->macio); + /* * Memory from IO_BASE to IO_BASE + IO_SLICE is repeated * from IO_BASE + IO_SLICE to IO_BASE + IO_SIZE diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h index fda42e0a1c..17067dfad7 100644 --- a/include/hw/m68k/q800.h +++ b/include/hw/m68k/q800.h @@ -39,6 +39,7 @@ struct Q800MachineState { M68kCPU cpu; MemoryRegion rom; GLUEState glue; + MemoryRegion macio; }; =20 #define TYPE_Q800_MACHINE MACHINE_TYPE_NAME("q800") --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 168733779612550.7165273005221; Wed, 21 Jun 2023 01:56:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtbz-0001zi-6d; Wed, 21 Jun 2023 04:54:47 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbx-0001zX-MX for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:45 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbv-0004m5-PC for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:45 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtbk-0001ZB-P7; Wed, 21 Jun 2023 09:54:36 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zS18JJKibJJt7HbVwcUvhHP+/lNCZnCNg8iKw3QG1ns=; b=LOg4IiA8xcsLZw6M/jtU2evVej NkNSk4jpoe9NlgJ5pb2HMoQjdobnTFE801SXYLve6jPJHwhlD4ZV/gcbkQVgK0ALuR1wiT7l0VSqf 6GZD+uLeV1GLEyxdmJVtifVxNDoR5LJN+HFPpZ5Intd01AleeNR+rby8v0BneTrO5xLniQiU9Rmbc kEmjUodRSd5mIOULOQz9EcvDhCmPYGbler/AVrqV4M/4RLrS7JLcCVjemQrjQPuSlzIeGhINjzp8o w7u38qLP3bUGyvbSszdtT6Tyutx0Fe3/CxTKzpOw+OgKCt5QUAhGgcmJu1RIt0yfl5eMFOnjFI5/j uDhTLrx/r1eSEIVeISaT877+Fco6grUdxrd5auhN5DoamOFXRObMyCm90EiRRabcmPCacTS/Q8Jcm Ep4FbXQyPULaaFzpqd3BtScrBJOGzp5P3HJ8MaQHHVZ/aqWYG/14660IEDVpstNdKSSouMNQ8nHf3 QD1bP/dO3GaF2Q1PmQOa39Of5bnKiv4CcQ9SErI/JuUgofV83YlOjnHMrEDJIKNJXpER62O40PYBk I509PojhWvw6Nl4EEAYHgrqfafK6drWXxRyWS/j7PE+01kWHD/q73KafHoiOOPEQzvv6/e9Q/wYql 2lXU7rscCh622bZJgKxspge13lFU3Z76Vi41L18k8=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:40 +0100 Message-Id: <20230621085353.113233-12-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 11/24] q800: reimplement mac-io region aliasing using IO 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.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337796502100001 Content-Type: text/plain; charset="utf-8" The current use of aliased memory regions causes us 2 problems: firstly the output of "info qom-tree" is absolutely huge and difficult to read, and secondly we have already reached the internal limit for memory regions as adding any new memory region into the mac-io region causes QEMU to assert with "phys_section_add: Assertion `map->sections_nb < TARGET_PAGE_SIZE' failed". Implement the mac-io region aliasing using a single IO memory region that applies IO_SLICE_MASK representing the maximum size of the aliased region a= nd then forwarding the access to the existing mac-io memory region using the address space API. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 100 +++++++++++++++++++++++++++++++++-------- include/hw/m68k/q800.h | 1 + 2 files changed, 82 insertions(+), 19 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 359bdf3443..51b8d8ec3c 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -59,6 +59,7 @@ =20 #define IO_BASE 0x50000000 #define IO_SLICE 0x00040000 +#define IO_SLICE_MASK (IO_SLICE - 1) #define IO_SIZE 0x04000000 =20 #define VIA_BASE (IO_BASE + 0x00000) @@ -127,6 +128,68 @@ static uint8_t fake_mac_rom[] =3D { 0x60, 0xFE /* bras [self] */ }; =20 +static MemTxResult macio_alias_read(void *opaque, hwaddr addr, uint64_t *d= ata, + unsigned size, MemTxAttrs attrs) +{ + MemTxResult r; + uint32_t val; + + addr &=3D IO_SLICE_MASK; + addr |=3D IO_BASE; + + switch (size) { + case 4: + val =3D address_space_ldl_be(&address_space_memory, addr, attrs, &= r); + break; + case 2: + val =3D address_space_lduw_be(&address_space_memory, addr, attrs, = &r); + break; + case 1: + val =3D address_space_ldub(&address_space_memory, addr, attrs, &r); + break; + default: + g_assert_not_reached(); + } + + *data =3D val; + return r; +} + +static MemTxResult macio_alias_write(void *opaque, hwaddr addr, uint64_t v= alue, + unsigned size, MemTxAttrs attrs) +{ + MemTxResult r; + + addr &=3D IO_SLICE_MASK; + addr |=3D IO_BASE; + + switch (size) { + case 4: + address_space_stl_be(&address_space_memory, addr, value, attrs, &r= ); + break; + case 2: + address_space_stw_be(&address_space_memory, addr, value, attrs, &r= ); + break; + case 1: + address_space_stb(&address_space_memory, addr, value, attrs, &r); + break; + default: + g_assert_not_reached(); + } + + return r; +} + +static const MemoryRegionOps macio_alias_ops =3D { + .read_with_attrs =3D macio_alias_read, + .write_with_attrs =3D macio_alias_write, + .endianness =3D DEVICE_BIG_ENDIAN, + .valid =3D { + .min_access_size =3D 1, + .max_access_size =3D 4, + }, +}; + static void q800_machine_init(MachineState *machine) { Q800MachineState *m =3D Q800_MACHINE(machine); @@ -137,10 +200,8 @@ static void q800_machine_init(MachineState *machine) int bios_size; ram_addr_t initrd_base; int32_t initrd_size; - MemoryRegion *io; MemoryRegion *dp8393x_prom =3D g_new(MemoryRegion, 1); uint8_t *prom; - const int io_slice_nb =3D (IO_SIZE / IO_SLICE) - 1; int i, checksum; MacFbMode *macfb_mode; ram_addr_t ram_size =3D machine->ram_size; @@ -187,16 +248,10 @@ static void q800_machine_init(MachineState *machine) * Memory from IO_BASE to IO_BASE + IO_SLICE is repeated * from IO_BASE + IO_SLICE to IO_BASE + IO_SIZE */ - io =3D g_new(MemoryRegion, io_slice_nb); - for (i =3D 0; i < io_slice_nb; i++) { - char *name =3D g_strdup_printf("mac_m68k.io[%d]", i + 1); - - memory_region_init_alias(&io[i], NULL, name, get_system_memory(), - IO_BASE, IO_SLICE); - memory_region_add_subregion(get_system_memory(), - IO_BASE + (i + 1) * IO_SLICE, &io[i]); - g_free(name); - } + memory_region_init_io(&m->macio_alias, OBJECT(machine), &macio_alias_o= ps, + &m->macio, "mac-io.alias", IO_SIZE - IO_SLICE); + memory_region_add_subregion(get_system_memory(), IO_BASE + IO_SLICE, + &m->macio_alias); =20 /* IRQ Glue */ object_initialize_child(OBJECT(machine), "glue", &m->glue, TYPE_GLUE); @@ -212,7 +267,8 @@ static void q800_machine_init(MachineState *machine) } sysbus =3D SYS_BUS_DEVICE(via1_dev); sysbus_realize_and_unref(sysbus, &error_fatal); - sysbus_mmio_map(sysbus, 1, VIA_BASE); + memory_region_add_subregion(&m->macio, VIA_BASE - IO_BASE, + sysbus_mmio_get_region(sysbus, 1)); sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_VIA1= )); /* A/UX mode */ @@ -230,7 +286,8 @@ static void q800_machine_init(MachineState *machine) via2_dev =3D qdev_new(TYPE_MOS6522_Q800_VIA2); sysbus =3D SYS_BUS_DEVICE(via2_dev); sysbus_realize_and_unref(sysbus, &error_fatal); - sysbus_mmio_map(sysbus, 1, VIA_BASE + VIA_SIZE); + memory_region_add_subregion(&m->macio, VIA_BASE - IO_BASE + VIA_SIZE, + sysbus_mmio_get_region(sysbus, 1)); sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_VIA2= )); =20 @@ -264,7 +321,8 @@ static void q800_machine_init(MachineState *machine) OBJECT(get_system_memory()), &error_abort); sysbus =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(sysbus, &error_fatal); - sysbus_mmio_map(sysbus, 0, SONIC_BASE); + memory_region_add_subregion(&m->macio, SONIC_BASE - IO_BASE, + sysbus_mmio_get_region(sysbus, 0)); sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_SONI= C)); =20 @@ -305,7 +363,8 @@ static void q800_machine_init(MachineState *machine) qdev_connect_gpio_out(escc_orgate, 0, qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_ESCC)); - sysbus_mmio_map(sysbus, 0, SCC_BASE); + memory_region_add_subregion(&m->macio, SCC_BASE - IO_BASE, + sysbus_mmio_get_region(sysbus, 0)); =20 /* SCSI */ =20 @@ -325,8 +384,10 @@ static void q800_machine_init(MachineState *machine) VIA2_IRQ_SCSI_BIT))); sysbus_connect_irq(sysbus, 1, qemu_irq_invert(qdev_get_gpio_in(via2_de= v, VIA2_IRQ_SCSI_DATA_BIT))= ); - sysbus_mmio_map(sysbus, 0, ESP_BASE); - sysbus_mmio_map(sysbus, 1, ESP_PDMA); + memory_region_add_subregion(&m->macio, ESP_BASE - IO_BASE, + sysbus_mmio_get_region(sysbus, 0)); + memory_region_add_subregion(&m->macio, ESP_PDMA - IO_BASE, + sysbus_mmio_get_region(sysbus, 1)); =20 scsi_bus_legacy_handle_cmdline(&esp->bus); =20 @@ -334,7 +395,8 @@ static void q800_machine_init(MachineState *machine) =20 dev =3D qdev_new(TYPE_SWIM); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, SWIM_BASE); + memory_region_add_subregion(&m->macio, SWIM_BASE - IO_BASE, + sysbus_mmio_get_region(SYS_BUS_DEVICE(dev)= , 0)); =20 /* NuBus */ =20 diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h index 17067dfad7..1ed38bf0b1 100644 --- a/include/hw/m68k/q800.h +++ b/include/hw/m68k/q800.h @@ -40,6 +40,7 @@ struct Q800MachineState { MemoryRegion rom; GLUEState glue; MemoryRegion macio; + MemoryRegion macio_alias; }; =20 #define TYPE_Q800_MACHINE MACHINE_TYPE_NAME("q800") --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337791890654.9853635828113; Wed, 21 Jun 2023 01:56:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtc3-0002Du-SZ; Wed, 21 Jun 2023 04:54:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtc1-000209-Qm for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:49 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtbz-0004y6-Uf for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:49 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtbo-0001ZB-Iy; Wed, 21 Jun 2023 09:54:40 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Hgn7fXSrE/W9zsNw8mhlO1HrfJGuwV2yh6U5VsK5Bs0=; b=oAiQ38j1NjGVmVL7JdQd0Tn30c H1NzhXXr9asJd5eOYgALYV4R0a/YvwWid5QpBKYjHm3iyzplIMBNkvu/lxw1tjCLRZXwQITDqBSxj ptcviQGQol1Hw4laXu4SX8dcW444Yb4BOJDHjLJzUFHJv4JDjOuDN6eWGET0Ruq93JKKaic4p0U5P cfOBbgoN8ZzjyjI9tFier+75PZZ26DFJdAVHmaCJuGhW71sBm8ulN+ywNAU3+rG320tWcwVWoyeXJ wwAyUFy98vpRalkSd2tkhugOknNvXiGScLraOzZsIcWDPUWYcFVV7dXLzAyqPzDWtRA9boWiWbT3G 3fmrJBgYirNtwX6o8Ol0vbPYq2y55Pa6BLf3TaU1yfOoZG3hClBSKj6cPNftiS1SOfhT+by7580sA d0j1e/Eit2KCvUU+KSOI8qNSanPP7tzGyOJIlX93bbm2r4U2V9to7RT4qUYIiFqbaiSiD0dfJ/5lz ZhZxOyufkfr2np6xFerSPVriA3F1TNiG8mJxS1csMHe8EgVdQpNsxl7Ezcf925bS0cHwGs/S9csdV nJwUM0cnOunNFyCJchrRRu+kW8Z8CUshmKE6LXS+AGAkaxLf4mST6FymYV5QVaCPrgbgeEE6sFLel Al3jop/zSzJOfu4OfJE6aCPR/2HKh9SB94Vr3wLiU=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:41 +0100 Message-Id: <20230621085353.113233-13-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 12/24] q800: move VIA1 device to Q800MachineState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337792070100001 Also change the instantiation of the VIA1 device to use object_initialize_c= hild(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 16 +++++++++------- include/hw/m68k/q800.h | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 51b8d8ec3c..fccdad5f3c 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -212,7 +212,7 @@ static void q800_machine_init(MachineState *machine) hwaddr parameters_base; CPUState *cs; DeviceState *dev; - DeviceState *via1_dev, *via2_dev; + DeviceState *via2_dev; DeviceState *escc_orgate; SysBusESPState *sysbus_esp; ESPState *esp; @@ -260,23 +260,25 @@ static void q800_machine_init(MachineState *machine) sysbus_realize(SYS_BUS_DEVICE(&m->glue), &error_fatal); =20 /* VIA 1 */ - via1_dev =3D qdev_new(TYPE_MOS6522_Q800_VIA1); + object_initialize_child(OBJECT(machine), "via1", &m->via1, + TYPE_MOS6522_Q800_VIA1); dinfo =3D drive_get(IF_MTD, 0, 0); if (dinfo) { - qdev_prop_set_drive(via1_dev, "drive", blk_by_legacy_dinfo(dinfo)); + qdev_prop_set_drive(DEVICE(&m->via1), "drive", + blk_by_legacy_dinfo(dinfo)); } - sysbus =3D SYS_BUS_DEVICE(via1_dev); - sysbus_realize_and_unref(sysbus, &error_fatal); + sysbus =3D SYS_BUS_DEVICE(&m->via1); + sysbus_realize(sysbus, &error_fatal); memory_region_add_subregion(&m->macio, VIA_BASE - IO_BASE, sysbus_mmio_get_region(sysbus, 1)); sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_VIA1= )); /* A/UX mode */ - qdev_connect_gpio_out(via1_dev, 0, + qdev_connect_gpio_out(DEVICE(&m->via1), 0, qdev_get_gpio_in_named(DEVICE(&m->glue), "auxmode", 0)); =20 - adb_bus =3D qdev_get_child_bus(via1_dev, "adb.0"); + adb_bus =3D qdev_get_child_bus(DEVICE(&m->via1), "adb.0"); dev =3D qdev_new(TYPE_ADB_KEYBOARD); qdev_realize_and_unref(dev, adb_bus, &error_fatal); dev =3D qdev_new(TYPE_ADB_MOUSE); diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h index 1ed38bf0b1..5cf66d08a0 100644 --- a/include/hw/m68k/q800.h +++ b/include/hw/m68k/q800.h @@ -28,6 +28,7 @@ #include "target/m68k/cpu-qom.h" #include "exec/memory.h" #include "hw/m68k/q800-glue.h" +#include "hw/misc/mac_via.h" =20 /* * The main Q800 machine @@ -39,6 +40,7 @@ struct Q800MachineState { M68kCPU cpu; MemoryRegion rom; GLUEState glue; + MOS6522Q800VIA1State via1; MemoryRegion macio; MemoryRegion macio_alias; }; --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337904617715.1148408747254; Wed, 21 Jun 2023 01:58:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtc7-0002ih-Gv; Wed, 21 Jun 2023 04:54:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtc6-0002XB-2H for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:54 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtc4-0004zK-An for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:53 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtbs-0001ZB-Qi; Wed, 21 Jun 2023 09:54:44 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=97WVBbwGfzQuIWAFxaogL9KiX4lqQnmxG3FLJB91MDw=; b=fsl3MxI0cc3POGOMIrFRmxgZwP Ayyh82uTF65jroo+6PQfRyrUepkBIDwxnKbVBYEHQq0l/6a9YzFj04r5b6b5y5dEROlZBhV5S2NCB asCLS2FsAwetOLaasPreQLCXgiKdOMxnyKH4ocbV08P1pXZv729UtZ8HL6OW9nvScZ5xfQqUHaNLv u6CMipy+Cf+MmATYEa8fYdvbGArbpX68sGiZfuR2sovVQzbe7pUbNyDdoMGl4/TsXNAazZ74xxdyB bL5TF7SbEPzC1EIxbmvSAxeM9PiROZm+e4hBc0qoav07IyouDY4mOdt7ebHVYDczxKCUpH3yRun7B UPxn72X+c/Z/qWIp3+sW8H+smu5DdFGgCwlOrRohCcXsCEXUZIYmpkl66tD/ol5/5TInPOWQwA45B D0JSSRxhHjG1uZGbDrFbTA5AOA3CydIo5PrbBfB9pmGUqHgABFP/hG3/VcLlDsbxATDU7yGrkIq9D 6hiI5yQGLbQO0XSsLczpvTm+c9Ur5r7OhorgCmoDyb+NGC+Ubs3n6YIbtALxO712l3O7bwAduUjYE mycZxtBE+pWhhastSuzbc2c51nFzdZfAakkyYJ+ZgAD3W09XxYT3KfG4mwL9gDH5VPOVUX3bm/yaq MuGbSvVQb7CLt8DWSmPTNFGgMyO8LCK1aaRAf1bdY=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:42 +0100 Message-Id: <20230621085353.113233-14-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 13/24] q800: move VIA2 device to Q800MachineState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337905075100005 Also change the instantiation of the VIA2 device to use object_initialize_c= hild(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 27 ++++++++++++++++----------- include/hw/m68k/q800.h | 1 + 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index fccdad5f3c..988b4981b8 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -212,7 +212,6 @@ static void q800_machine_init(MachineState *machine) hwaddr parameters_base; CPUState *cs; DeviceState *dev; - DeviceState *via2_dev; DeviceState *escc_orgate; SysBusESPState *sysbus_esp; ESPState *esp; @@ -285,9 +284,10 @@ static void q800_machine_init(MachineState *machine) qdev_realize_and_unref(dev, adb_bus, &error_fatal); =20 /* VIA 2 */ - via2_dev =3D qdev_new(TYPE_MOS6522_Q800_VIA2); - sysbus =3D SYS_BUS_DEVICE(via2_dev); - sysbus_realize_and_unref(sysbus, &error_fatal); + object_initialize_child(OBJECT(machine), "via2", &m->via2, + TYPE_MOS6522_Q800_VIA2); + sysbus =3D SYS_BUS_DEVICE(&m->via2); + sysbus_realize(sysbus, &error_fatal); memory_region_add_subregion(&m->macio, VIA_BASE - IO_BASE + VIA_SIZE, sysbus_mmio_get_region(sysbus, 1)); sysbus_connect_irq(sysbus, 0, @@ -382,10 +382,14 @@ static void q800_machine_init(MachineState *machine) sysbus =3D SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(sysbus, &error_fatal); /* SCSI and SCSI data IRQs are negative edge triggered */ - sysbus_connect_irq(sysbus, 0, qemu_irq_invert(qdev_get_gpio_in(via2_de= v, - VIA2_IRQ_SCSI_BIT))); - sysbus_connect_irq(sysbus, 1, qemu_irq_invert(qdev_get_gpio_in(via2_de= v, - VIA2_IRQ_SCSI_DATA_BIT))= ); + sysbus_connect_irq(sysbus, 0, + qemu_irq_invert( + qdev_get_gpio_in(DEVICE(&m->via2), + VIA2_IRQ_SCSI_BIT))); + sysbus_connect_irq(sysbus, 1, + qemu_irq_invert( + qdev_get_gpio_in(DEVICE(&m->via2), + VIA2_IRQ_SCSI_DATA_BIT)= )); memory_region_add_subregion(&m->macio, ESP_BASE - IO_BASE, sysbus_mmio_get_region(sysbus, 0)); memory_region_add_subregion(&m->macio, ESP_PDMA - IO_BASE, @@ -411,11 +415,12 @@ static void q800_machine_init(MachineState *machine) sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE + MAC_NUBUS_FIRST_SLOT * NUBUS_SLOT_SIZE); qdev_connect_gpio_out(dev, 9, - qdev_get_gpio_in_named(via2_dev, "nubus-irq", + qdev_get_gpio_in_named(DEVICE(&m->via2), "nubus-= irq", VIA2_NUBUS_IRQ_INTVIDEO)); for (i =3D 1; i < VIA2_NUBUS_IRQ_NB; i++) { qdev_connect_gpio_out(dev, 9 + i, - qdev_get_gpio_in_named(via2_dev, "nubus-irq", + qdev_get_gpio_in_named(DEVICE(&m->via2), + "nubus-irq", VIA2_NUBUS_IRQ_9 + i)= ); } =20 @@ -424,7 +429,7 @@ static void q800_machine_init(MachineState *machine) * IRQ via GLUE for use by SONIC Ethernet in classic mode */ qdev_connect_gpio_out(DEVICE(&m->glue), GLUE_IRQ_NUBUS_9, - qdev_get_gpio_in_named(via2_dev, "nubus-irq", + qdev_get_gpio_in_named(DEVICE(&m->via2), "nubus-= irq", VIA2_NUBUS_IRQ_9)); =20 nubus =3D &NUBUS_BRIDGE(dev)->bus; diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h index 5cf66d08a0..06c771635b 100644 --- a/include/hw/m68k/q800.h +++ b/include/hw/m68k/q800.h @@ -41,6 +41,7 @@ struct Q800MachineState { MemoryRegion rom; GLUEState glue; MOS6522Q800VIA1State via1; + MOS6522Q800VIA2State via2; MemoryRegion macio; MemoryRegion macio_alias; }; --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337739349168.17543154477778; Wed, 21 Jun 2023 01:55:39 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtcB-00033a-LY; Wed, 21 Jun 2023 04:54:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcA-0002wr-9F for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:58 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtc8-000500-Fq for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:54:58 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtbx-0001ZB-19; Wed, 21 Jun 2023 09:54:49 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=apUR2AcU/GV1nUWjdATL9pqMQIij0c+zFxaLq8ZRd7w=; b=HluD/dCm5bx3YNv+STJB8vhSvP soSwcMa1CzC6Eofo7W6F+CDmvUo2VWhPKkzmCVkD30ux0AHmuLC/9JEB0joLRFutRncQGZJRhje/8 wvUOgkOEpXAF0mu/7E8K7DiQcYZmABlYXreow9h3YbqTXVYBTYrRJW77gwHMue/LEGoxMZLxYAFaP uB9iCqIqhPKDXizU86HO8rZkQyc9wRzuhSooJDNWXPlhkVdTIT9Oj+PSiZrDFprefbRWcAUhdxakW Y/S3NsjfqILwaZYaWsWOcu0B+xuDJ3rxxCFt4iselkGx7IPfGsBzlL40gHNSfaP4HCqumj7DwBiyj HhmTzplSB2df3ywJogGlHsMQWneqMEBTwxWk6XqsxqKjWKr3Us8mCXhNEWGOPJybSb+9XOEAmtKZr Y4ub5DVfc6bugwbhbVI2eaI9OBcJpeAVcOYJQK58yw4liwJdtei9CYNd1tU1tNwvphHvDApPy+C9y stTrS3t9Sevr6a7giaLCivVbYayb+JgR7TtEdFGI/rvf/2mN/tTsTykMn2y5+faXX6vOF9qqUg/3w KQRNkDkArM1EcJd1qzHf6nZ42lT4WOA1Cyk8+hegP7LGhUlpwPSCxlk97JQkZ3047ZS6yq9gLnjz6 7PVappy7ltnvpia9M7hrc9kPgeqYON2UgvHFeLnsA=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:43 +0100 Message-Id: <20230621085353.113233-15-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 14/24] hw/net/dp8393x.c: move TYPE_DP8393X and dp8393xState into dp8393x.h X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337740191100001 This is to enable them to be used outside of dp8393x.c. Signed-off-by: Mark Cave-Ayland CC: Jason Wang Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/net/dp8393x.c | 32 +-------------------- include/hw/net/dp8393x.h | 60 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 31 deletions(-) create mode 100644 include/hw/net/dp8393x.h diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c index 45b954e46c..a596f7fbc6 100644 --- a/hw/net/dp8393x.c +++ b/hw/net/dp8393x.c @@ -20,6 +20,7 @@ #include "qemu/osdep.h" #include "hw/irq.h" #include "hw/qdev-properties.h" +#include "hw/net/dp8393x.h" #include "hw/sysbus.h" #include "migration/vmstate.h" #include "net/net.h" @@ -85,7 +86,6 @@ static const char *reg_names[] =3D { #define SONIC_MPT 0x2e #define SONIC_MDT 0x2f #define SONIC_DCR2 0x3f -#define SONIC_REG_COUNT 0x40 =20 #define SONIC_CR_HTX 0x0001 #define SONIC_CR_TXP 0x0002 @@ -139,36 +139,6 @@ static const char *reg_names[] =3D { #define SONIC_DESC_EOL 0x0001 #define SONIC_DESC_ADDR 0xFFFE =20 -#define TYPE_DP8393X "dp8393x" -OBJECT_DECLARE_SIMPLE_TYPE(dp8393xState, DP8393X) - -struct dp8393xState { - SysBusDevice parent_obj; - - /* Hardware */ - uint8_t it_shift; - bool big_endian; - bool last_rba_is_full; - qemu_irq irq; - int irq_level; - QEMUTimer *watchdog; - int64_t wt_last_update; - NICConf conf; - NICState *nic; - MemoryRegion mmio; - - /* Registers */ - uint16_t cam[16][3]; - uint16_t regs[SONIC_REG_COUNT]; - - /* Temporaries */ - uint8_t tx_buffer[0x10000]; - int loopback_packet; - - /* Memory access */ - MemoryRegion *dma_mr; - AddressSpace as; -}; =20 /* * Accessor functions for values which are formed by diff --git a/include/hw/net/dp8393x.h b/include/hw/net/dp8393x.h new file mode 100644 index 0000000000..4a3f7478be --- /dev/null +++ b/include/hw/net/dp8393x.h @@ -0,0 +1,60 @@ +/* + * QEMU NS SONIC DP8393x netcard + * + * Copyright (c) 2008-2009 Herve Poussineau + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see . + */ + +#ifndef HW_NET_DP8393X_H +#define HW_NET_DP8393X_H + +#include "hw/sysbus.h" +#include "net/net.h" +#include "exec/memory.h" + +#define SONIC_REG_COUNT 0x40 + +#define TYPE_DP8393X "dp8393x" +OBJECT_DECLARE_SIMPLE_TYPE(dp8393xState, DP8393X) + +struct dp8393xState { + SysBusDevice parent_obj; + + /* Hardware */ + uint8_t it_shift; + bool big_endian; + bool last_rba_is_full; + qemu_irq irq; + int irq_level; + QEMUTimer *watchdog; + int64_t wt_last_update; + NICConf conf; + NICState *nic; + MemoryRegion mmio; + + /* Registers */ + uint16_t cam[16][3]; + uint16_t regs[SONIC_REG_COUNT]; + + /* Temporaries */ + uint8_t tx_buffer[0x10000]; + int loopback_packet; + + /* Memory access */ + MemoryRegion *dma_mr; + AddressSpace as; +}; + +#endif --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337737457769.0111468748031; Wed, 21 Jun 2023 01:55:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtcY-0003az-Oy; Wed, 21 Jun 2023 04:55:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcO-0003Np-6B for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:16 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcM-00050S-Lz for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:11 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtc1-0001ZB-82; Wed, 21 Jun 2023 09:54:53 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=EOk9C1LephgeYrzHSr/Iao6dFyKhO8TARh1/pIHN4ps=; b=PPfkWZP8icUYAEp46hqieXviAa i9aWnJD5Q2oKhN1uoX750/PGxSg5KN4KgyqHYkrP9/YMeX9xV0GhOTViUjoRYTpGTT/RHT3frVUxG 3ckWofU47fiM1VkDLmvHne7Wp4B2zXfEjBN3ICcYbL743hBV9L3W5HbaclKPYPqK5VGpHhNMJLNps hxumhnbpY43qbtuoiXDXqUFXY+ycBsMdV2DkXC4AkzLWcHe5Zb+BIt2UwPBubwZkGbqoz9DYJwJhe SGi7AzaR/IlHNVDBe9w9igMQwa5vFp8Jl17ptUTbAHFF8h9WHa5PoeVCDb7GLQApfp3HEHGZ0S4/U pPc1XMjmNQnas+2EpzZQtf1MtkoVnWIdMWSGEUDyk4krTJVUzSelTt/qQnmd6NYXGiCJFZK6Ssx9n F8m3/Bh80X7RD0GwuZeu3IU2tnPl4KtJSz884q53aNZGY+jWuYMNrsgUBa2s5HId0LtP+5cq7MFLf qI8jtmgntDkL4WcfgWMQU+NpILpqkcy5mrOxjpfaO7JpAxBEbcVg06skD5oJ0eVvjOZF4rbBGvy7T 8a2RUL3sOd/nDFyAHqOkuxF1cY+KSqHsCxSyCsNV+TCACbEtRmgP8xSm5NscA6RBlz1LSwB2Jv73E vXjIeLTDoDWbIIDho7QikFj1jM4rG7iW/GJpYaoDw=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:44 +0100 Message-Id: <20230621085353.113233-16-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 15/24] q800: move dp8393x device to Q800MachineState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337738120100007 Also change the instantiation of the dp8393x device to use object_initializ= e_child(). Signed-off-by: Mark Cave-Ayland CC: Jason Wang Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 6 ++++-- include/hw/m68k/q800.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 988b4981b8..13806613fa 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -315,14 +315,16 @@ static void q800_machine_init(MachineState *machine) nd_table[0].macaddr.a[1] =3D 0x00; nd_table[0].macaddr.a[2] =3D 0x07; =20 - dev =3D qdev_new("dp8393x"); + object_initialize_child(OBJECT(machine), "dp8393x", &m->dp8393x, + TYPE_DP8393X); + dev =3D DEVICE(&m->dp8393x); qdev_set_nic_properties(dev, &nd_table[0]); qdev_prop_set_uint8(dev, "it_shift", 2); qdev_prop_set_bit(dev, "big_endian", true); object_property_set_link(OBJECT(dev), "dma_mr", OBJECT(get_system_memory()), &error_abort); sysbus =3D SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(sysbus, &error_fatal); + sysbus_realize(sysbus, &error_fatal); memory_region_add_subregion(&m->macio, SONIC_BASE - IO_BASE, sysbus_mmio_get_region(sysbus, 0)); sysbus_connect_irq(sysbus, 0, diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h index 06c771635b..d11bc020ed 100644 --- a/include/hw/m68k/q800.h +++ b/include/hw/m68k/q800.h @@ -29,6 +29,7 @@ #include "exec/memory.h" #include "hw/m68k/q800-glue.h" #include "hw/misc/mac_via.h" +#include "hw/net/dp8393x.h" =20 /* * The main Q800 machine @@ -42,6 +43,7 @@ struct Q800MachineState { GLUEState glue; MOS6522Q800VIA1State via1; MOS6522Q800VIA2State via2; + dp8393xState dp8393x; MemoryRegion macio; MemoryRegion macio_alias; }; --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337796750547.7881658555632; Wed, 21 Jun 2023 01:56:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtcV-0003Vf-Um; Wed, 21 Jun 2023 04:55:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcS-0003O4-An for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:17 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcQ-00055n-GO for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:16 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtc5-0001ZB-H0; Wed, 21 Jun 2023 09:54:57 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=4IL1GZjuekZgVUgNf/eYQgnMiGylOKscGLf22vZHKTI=; b=HND2W/y5LQs/Kp8E9ATh5WBed7 qujp9bOU4M/mB71QVmNzseaNAB12b10/hzprAjSvRoj31L1PaMynwtNyfvmhr/4NQa9DjLisMpyAd otL1XzUjb+DQuH59XpQYxqvDl9dO2yswLlho3madH9jilaz5bLIqthfbBH8EbGdoBpdMOWGG4xxoq yf6u9ZWVo5uhzeylv8s+BNUptQ0DnG0cialBtxNSIyNGj6NYC+IY7VomA2k6hTYqYFZhkRVuydVTv v7f3w8oBxSLkhFa63gZrKPaPx2rS5IEHV2ffjNZDYlUqkfuzW3oePow+oehJ0gaKynKEiclh65um5 pcxpklnsSyh+LwHjNDQHxJfVFB1HYhOiQm8M+biQsG9D6/UGGOQ7KIK7ju+cG0QnlBV0KZ6rt8LyH FWfJq1eSinc43RhmGIjRBUWaPQwgg6sIRESsTO2I4PQ/4FKCI6GwnMEAdg7jnHjsRSy5z7VCK+/CX jNmjcB/7OlMB32wTbae4bDkSBp1rnk4PAMGQipx0nlipH4LXwaqBKXLejfPP85q339xCGCm3ch3R+ GQWNzzskS0yyBo8DUUL/+Nsj6bp/nmd4zq9MIf8/XBnx0mUqRQZTRkE0HUJSDWUs7I2TofQD989/3 XYpWfVGCG0eS/mzJW+aJzIdtHNUKFxME1hk3KFCu8=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:45 +0100 Message-Id: <20230621085353.113233-17-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 16/24] q800: move ESCC device to Q800MachineState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337798082100011 Also change the instantiation of the ESCC device to use object_initialize_c= hild(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 6 ++++-- include/hw/m68k/q800.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 13806613fa..8bf94b2511 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -346,7 +346,9 @@ static void q800_machine_init(MachineState *machine) =20 /* SCC */ =20 - dev =3D qdev_new(TYPE_ESCC); + object_initialize_child(OBJECT(machine), "escc", &m->escc, + TYPE_ESCC); + dev =3D DEVICE(&m->escc); qdev_prop_set_uint32(dev, "disabled", 0); qdev_prop_set_uint32(dev, "frequency", MAC_CLOCK); qdev_prop_set_uint32(dev, "it_shift", 1); @@ -356,7 +358,7 @@ static void q800_machine_init(MachineState *machine) qdev_prop_set_uint32(dev, "chnBtype", 0); qdev_prop_set_uint32(dev, "chnAtype", 0); sysbus =3D SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(sysbus, &error_fatal); + sysbus_realize(sysbus, &error_fatal); =20 /* Logically OR both its IRQs together */ escc_orgate =3D DEVICE(object_new(TYPE_OR_IRQ)); diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h index d11bc020ed..9e76a3fe7c 100644 --- a/include/hw/m68k/q800.h +++ b/include/hw/m68k/q800.h @@ -30,6 +30,7 @@ #include "hw/m68k/q800-glue.h" #include "hw/misc/mac_via.h" #include "hw/net/dp8393x.h" +#include "hw/char/escc.h" =20 /* * The main Q800 machine @@ -44,6 +45,7 @@ struct Q800MachineState { MOS6522Q800VIA1State via1; MOS6522Q800VIA2State via2; dp8393xState dp8393x; + ESCCState escc; MemoryRegion macio; MemoryRegion macio_alias; }; --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337902455600.9809710662979; Wed, 21 Jun 2023 01:58:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtcf-000433-Bo; Wed, 21 Jun 2023 04:55:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcX-0003bI-87 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:22 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcV-0005CH-It for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:21 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtc9-0001ZB-3x; Wed, 21 Jun 2023 09:55:01 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=pXQDIeepsnxHYQr31JaWhSYDz8x3tMfRXLO170qcJGM=; b=WewUjSIwL23QCYLma67dcjhL38 6tPLKaNElAal9N5uNDHa0dFmsvzlkkShog41j+G2xEljwkjiIgUVznTCocjhA8fGgtrLCK+0iVn65 UWfUxoCgwXWg/v8MqdVqcOKQyigMCVsvg0d8fWfkGoscxRxtDqvuGDH+mPcJoCRQgc/asfM3KsbkI OhtxMJsFesmCgMCRu8ovn3M/mO0Id/oiP++ZhdF4iqH4KnLWZBzqovwPz0eJTxdnOHn8v0rpzfiuN 8iUvhZe+TZXvzfOsAxGm18HsAtN/D0emnXx1MH6mtIeU+tJqV+CDJYWazWQmA9+imXEFNWP8qIgNU r8clcHOstUHnU5Cqg5XhCPhD9ciQCvC9puKQplkLDt6TjAUuZeTpCCT6lhP1Jd8xnXR/XCDcDqw62 jfNJcP2xI798n0UCNfuKYlB4QL/F3sRc2REUnJ9SgiIbpDawAYIAh1ViOgQznWT1QpofQqB7NF14T iOTV+lUTyxZTs1K/HfJ02MYyf0l4TKC1AokM92Gk2IB8nDmpSUn/zTWONo6qQ04ZtttN9z9RR20iU OELpQeGycw9bnM6I3spsa2lwNCT6F3W+CgKCTebPmJhCIdrMSVfViD2FZ15SUtSq26GsOCaVMdRgO CJ60iWkpYpApWwFCsnz/YkSCgyRsQ/cOBu+2sfJcc=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:46 +0100 Message-Id: <20230621085353.113233-18-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 17/24] q800: move escc_orgate device to Q800MachineState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337904531100003 Also change the instantiation of the escc_orgate device to use object_initi= alize_child(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 16 +++++++++------- include/hw/m68k/q800.h | 2 ++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 8bf94b2511..c6314c6bf9 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -212,7 +212,6 @@ static void q800_machine_init(MachineState *machine) hwaddr parameters_base; CPUState *cs; DeviceState *dev; - DeviceState *escc_orgate; SysBusESPState *sysbus_esp; ESPState *esp; SysBusDevice *sysbus; @@ -361,12 +360,15 @@ static void q800_machine_init(MachineState *machine) sysbus_realize(sysbus, &error_fatal); =20 /* Logically OR both its IRQs together */ - escc_orgate =3D DEVICE(object_new(TYPE_OR_IRQ)); - object_property_set_int(OBJECT(escc_orgate), "num-lines", 2, &error_fa= tal); - qdev_realize_and_unref(escc_orgate, NULL, &error_fatal); - sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(escc_orgate, 0)); - sysbus_connect_irq(sysbus, 1, qdev_get_gpio_in(escc_orgate, 1)); - qdev_connect_gpio_out(escc_orgate, 0, + object_initialize_child(OBJECT(machine), "escc_orgate", &m->escc_orgat= e, + TYPE_OR_IRQ); + object_property_set_int(OBJECT(&m->escc_orgate), "num-lines", 2, + &error_fatal); + dev =3D DEVICE(&m->escc_orgate); + qdev_realize(dev, NULL, &error_fatal); + sysbus_connect_irq(sysbus, 0, qdev_get_gpio_in(dev, 0)); + sysbus_connect_irq(sysbus, 1, qdev_get_gpio_in(dev, 1)); + qdev_connect_gpio_out(dev, 0, qdev_get_gpio_in(DEVICE(&m->glue), GLUE_IRQ_IN_ESCC)); memory_region_add_subregion(&m->macio, SCC_BASE - IO_BASE, diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h index 9e76a3fe7c..36e1bd8e4e 100644 --- a/include/hw/m68k/q800.h +++ b/include/hw/m68k/q800.h @@ -31,6 +31,7 @@ #include "hw/misc/mac_via.h" #include "hw/net/dp8393x.h" #include "hw/char/escc.h" +#include "hw/or-irq.h" =20 /* * The main Q800 machine @@ -46,6 +47,7 @@ struct Q800MachineState { MOS6522Q800VIA2State via2; dp8393xState dp8393x; ESCCState escc; + OrIRQState escc_orgate; MemoryRegion macio; MemoryRegion macio_alias; }; --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337885623515.1876057902721; Wed, 21 Jun 2023 01:58:05 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtcc-0003qq-G6; Wed, 21 Jun 2023 04:55:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcX-0003bJ-Mt for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:22 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcW-0005CL-6G for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:21 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtcD-0001ZB-B0; Wed, 21 Jun 2023 09:55:01 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=sncyEHaQSMpZyBZ1oN3ljGXQJc1wBNFfTjjYtea7LC4=; b=lW7Wixe5cvy+LxqpuC9+eESiqk 2/Qu2Hv+z/+yGsTpaC7KfSP3XoRdzGFLx++KbusRSCR67h+I1MfQ4nWSAT8XGRH3Kc/BiJjVufjhe ZC4LV9S2WpPd20VL9o9ulXUwMxrrZe9M6WwGZLt52hjkSos2Rtq1+hm33X0dkyeQs10VMP+Vd59Af p8jBogYk50Whi5Ur5EhnSnsws30pEd0bSb5BQJ8gCgqyDeT5785afhYYUxudKu8POXJZdyZNDZZAm 3Y+pVgO6h8ZRl5mN3v0LwTlOPXOQ437gCKkJOUu5m/7tLI290R2OA8i+SKexDbNIz7PNkXXlUBAxC 1DMRhMKOl2d5PIzIq96IbpRtOoE091jWTC9I6Mb6dcZYbD7ak65co/A/67c2hJyvObnXOxqf0+J5T 60krGxR1BaoL0SUfD9ru6QL0warzIh7brql8zHejKRzeyQXe3BJX8rp+EhTyayUWnht9CPwgnYEDq Mw3RE1IfKFi0mZuXDptQwBiadejvOSUShM1A8o1dVKRHuyj5Rq2mSJAK/RB/UZHUDBci3ulIFVfM1 9GEmf5Tj8gbgSGM3p8LJ7AtpvjxwZH6qoyRMI9FEqWtCGO5MVu9fKHCBmbpNtUFt7ecQ0o9y2UFhU O9t2nyfEL5IDe1pqvNLSuXnLFgsAPHX4nmVU6RNUs=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:47 +0100 Message-Id: <20230621085353.113233-19-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 18/24] q800: move ESP device to Q800MachineState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337886461100006 Also change the instantiation of the ESP device to use object_initialize_ch= ild(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 9 +++++---- include/hw/m68k/q800.h | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index c6314c6bf9..9da46f4456 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -376,8 +376,9 @@ static void q800_machine_init(MachineState *machine) =20 /* SCSI */ =20 - dev =3D qdev_new(TYPE_SYSBUS_ESP); - sysbus_esp =3D SYSBUS_ESP(dev); + object_initialize_child(OBJECT(machine), "esp", &m->esp, + TYPE_SYSBUS_ESP); + sysbus_esp =3D SYSBUS_ESP(&m->esp); esp =3D &sysbus_esp->esp; esp->dma_memory_read =3D NULL; esp->dma_memory_write =3D NULL; @@ -385,8 +386,8 @@ static void q800_machine_init(MachineState *machine) sysbus_esp->it_shift =3D 4; esp->dma_enabled =3D 1; =20 - sysbus =3D SYS_BUS_DEVICE(dev); - sysbus_realize_and_unref(sysbus, &error_fatal); + sysbus =3D SYS_BUS_DEVICE(&m->esp); + sysbus_realize(sysbus, &error_fatal); /* SCSI and SCSI data IRQs are negative edge triggered */ sysbus_connect_irq(sysbus, 0, qemu_irq_invert( diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h index 36e1bd8e4e..8f23e0c4c6 100644 --- a/include/hw/m68k/q800.h +++ b/include/hw/m68k/q800.h @@ -32,6 +32,7 @@ #include "hw/net/dp8393x.h" #include "hw/char/escc.h" #include "hw/or-irq.h" +#include "hw/scsi/esp.h" =20 /* * The main Q800 machine @@ -48,6 +49,7 @@ struct Q800MachineState { dp8393xState dp8393x; ESCCState escc; OrIRQState escc_orgate; + SysBusESPState esp; MemoryRegion macio; MemoryRegion macio_alias; }; --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337826741858.7802305002087; Wed, 21 Jun 2023 01:57:06 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtcf-00040n-3R; Wed, 21 Jun 2023 04:55:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtca-0003pS-Q9 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:25 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcZ-0005Eb-9n for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:24 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtcD-0001ZB-NV; Wed, 21 Jun 2023 09:55:05 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=SkGZyrVHhxcbNhX9L2LKzyKkY105Cq1IuxEjje4FaX4=; b=W5IeJC+MnzaDcO+PcrdSkzA98L 3NNvHuZH83vsRyztz1h6DX+WMImW6QPx9tVrfHXyU7mX7p79V0pWzVsKHa5rlate6RtQBHnMUCl5e HBOkK3JkccxTR+Q921E1H04QOCSi+MRTEoWR+CgNICagMVwX/y3Gdi4PafY5BJV+nCLylNSDyK732 S7baIvMUfyuwqW5F7RRqNoiUcOnLwHPOS4igbyhPOpUoVwBUBjhRhKoN8v8f48AeKSbO/BHqmhoJA qr1yBkq0pLHWsFmrTRZ/9ldB2uQbdmUkOlEb5nOYs5V6knImDAl5DlzAEzoXiOwwwtbBKLGJSYlnw JQs0peKp68jkH1xKNOzSx4QmOA9Rltv42RCKe25FhGV9sMvEiTC9LymLn6i0ypD0JCIyVCMZDQZ00 WDu5uQUn5wTsDmBnPzv+2aPxaL3ExnSWZlqXcMO/y3ywwFmWxXE0BS3DR7mCv/Gtv5w0Yvx6tUoNz fZHMsf4zGuLeuaQvuFTJ2DgJ2QgThe3QUr04BXGyjK/npNHhy6mt2nnriLvsIn3v2p2n+yAiB4A2V rGwFJbAD353dpJcGQAKUS6NoYwk/ex0hH0rXvoJsQHiXbclR3VzQQjbsd+EvGhLFaTuo97KEeJd/F G9bG83wr/YyKwfbsHlnn/ASsuoxeh7ZSFtUZWdVN4=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:48 +0100 Message-Id: <20230621085353.113233-20-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 19/24] q800: move SWIM device to Q800MachineState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337828150100003 Also change the instantiation of the SWIM device to use object_initialize_c= hild(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 8 +++++--- include/hw/m68k/q800.h | 2 ++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 9da46f4456..50fc7de9a2 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -406,10 +406,12 @@ static void q800_machine_init(MachineState *machine) =20 /* SWIM floppy controller */ =20 - dev =3D qdev_new(TYPE_SWIM); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); + object_initialize_child(OBJECT(machine), "swim", &m->swim, + TYPE_SWIM); + sysbus =3D SYS_BUS_DEVICE(&m->swim); + sysbus_realize(sysbus, &error_fatal); memory_region_add_subregion(&m->macio, SWIM_BASE - IO_BASE, - sysbus_mmio_get_region(SYS_BUS_DEVICE(dev)= , 0)); + sysbus_mmio_get_region(sysbus, 0)); =20 /* NuBus */ =20 diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h index 8f23e0c4c6..06e095ae29 100644 --- a/include/hw/m68k/q800.h +++ b/include/hw/m68k/q800.h @@ -33,6 +33,7 @@ #include "hw/char/escc.h" #include "hw/or-irq.h" #include "hw/scsi/esp.h" +#include "hw/block/swim.h" =20 /* * The main Q800 machine @@ -50,6 +51,7 @@ struct Q800MachineState { ESCCState escc; OrIRQState escc_orgate; SysBusESPState esp; + Swim swim; MemoryRegion macio; MemoryRegion macio_alias; }; --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337767300297.6471299380719; Wed, 21 Jun 2023 01:56:07 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtck-00049v-3x; Wed, 21 Jun 2023 04:55:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcf-00046U-WC for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:30 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcd-0005FY-74 for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:29 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtcH-0001ZB-NE; Wed, 21 Jun 2023 09:55:09 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=NkGsfKnqZKVHgn7j3dDfmqDAr6NLQVzR90yX1G8XW3U=; b=kPaqnmVqSVzfOvT2rNCty/PhZU tvuNibay/ZUtE+yYMVq/Z9cmnYhj2dya/ToFn+WBIWylIHjg7qCM9N02qXiQUxy70whteSUKeHFG7 AqW8dIz2LD+eluwlrzIYAcmUvNBw4fOW4HG6aTVN0v+oDqvyF+ZS2uCo/rRszxbZWnmjWq+rmhtmp oXOjLeCchHaGHTllAau2A1GzGmy0Qk2lh82rPj8+CsXz3IDwim77RdQ6+NGGP1lfkin+Cxlp9TST1 TyiiiAYUuLsW0xeTgqzlAcvd2z/lLMeEkzqjOcqOsUzECKYV8g9tYwtxgmB06W660FupBbEaM+3yo svEXnatgDQvzDI87Dcky4bT1aID1i/csK1zvouiKnQyBYQv0O8PMdlRpiMSJa3J5qDIL3+UHJY8+r o3MCWXMV99rplRMmw9Kcr+qG06ND+BuGKFD/goYbN0wQz1yQ+TnZ1l5AX4NyFADKNhji8SXe5AIF8 VZybEsAZ1pr1e0BgOB3x2Va5AEM55cUpXJU2KE675+tRIYZzWjDXWhKT3ZREwkOEY9Q+H+EMoVdXe vNSGH5tovWUE8IKxYHSipYKtRDsUinbMBTkJK7g7p6HCt8OGwcukbDFpENnd2EhgfWEGL2DZfV50z dIQYgZQL6qCNvxNMrn5V+vROhfyUMULcqb/jUz2LA=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:49 +0100 Message-Id: <20230621085353.113233-21-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 20/24] q800: move mac-nubus-bridge device to Q800MachineState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337768482100001 Also change the instantiation of the mac-nubus-bridge device to use object_initialize_child() and map the Nubus address space using memory_region_add_subregion() instead of sysbus_mmio_map(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/m68k/q800.c | 21 ++++++++++++++------- include/hw/m68k/q800.h | 2 ++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index 50fc7de9a2..b22651931a 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -415,14 +415,21 @@ static void q800_machine_init(MachineState *machine) =20 /* NuBus */ =20 - dev =3D qdev_new(TYPE_MAC_NUBUS_BRIDGE); - qdev_prop_set_uint32(dev, "slot-available-mask", + object_initialize_child(OBJECT(machine), "mac-nubus-bridge", + &m->mac_nubus_bridge, + TYPE_MAC_NUBUS_BRIDGE); + sysbus =3D SYS_BUS_DEVICE(&m->mac_nubus_bridge); + dev =3D DEVICE(&m->mac_nubus_bridge); + qdev_prop_set_uint32(DEVICE(&m->mac_nubus_bridge), "slot-available-mas= k", Q800_NUBUS_SLOTS_AVAILABLE); - sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, - MAC_NUBUS_FIRST_SLOT * NUBUS_SUPER_SLOT_SIZE); - sysbus_mmio_map(SYS_BUS_DEVICE(dev), 1, NUBUS_SLOT_BASE + - MAC_NUBUS_FIRST_SLOT * NUBUS_SLOT_SIZE); + sysbus_realize(sysbus, &error_fatal); + memory_region_add_subregion(get_system_memory(), + MAC_NUBUS_FIRST_SLOT * NUBUS_SUPER_SLOT_SI= ZE, + sysbus_mmio_get_region(sysbus, 0)); + memory_region_add_subregion(get_system_memory(), + NUBUS_SLOT_BASE + + MAC_NUBUS_FIRST_SLOT * NUBUS_SLOT_SIZE, + sysbus_mmio_get_region(sysbus, 1)); qdev_connect_gpio_out(dev, 9, qdev_get_gpio_in_named(DEVICE(&m->via2), "nubus-= irq", VIA2_NUBUS_IRQ_INTVIDEO)); diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h index 06e095ae29..8f2c572a81 100644 --- a/include/hw/m68k/q800.h +++ b/include/hw/m68k/q800.h @@ -34,6 +34,7 @@ #include "hw/or-irq.h" #include "hw/scsi/esp.h" #include "hw/block/swim.h" +#include "hw/nubus/mac-nubus-bridge.h" =20 /* * The main Q800 machine @@ -52,6 +53,7 @@ struct Q800MachineState { OrIRQState escc_orgate; SysBusESPState esp; Swim swim; + MacNubusBridge mac_nubus_bridge; MemoryRegion macio; MemoryRegion macio_alias; }; --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337806307865.4353783317342; Wed, 21 Jun 2023 01:56:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtd2-0004m3-KX; Wed, 21 Jun 2023 04:55:52 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtck-0004Az-9v for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:36 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtch-0005GE-4K for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:33 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtcL-0001ZB-Ul; Wed, 21 Jun 2023 09:55:13 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=B3LhSM9tOUVZLir2gQou8hgFdFwVhZHN4ayOtaUGQVU=; b=wJW2W8zoOkeAEowvdZzuXFIRqZ aHU70FbCJZp0KP69EG3kVYQaxLWdRVU849SKsSJwGS+QVzSPCIFgBsc3K3ETQlQLuASof9+0MWXZU 7HlpOMXvJP5nM+K4lVFInl32/BZOa8f1i+L1Ak5Tpx/3/cIjWZHF/ZhpNibACHNolXOpcXMOBQxkU gPAj2kM5qWR626q+Fo+XmHQ5K1KuHKiuCkzROvB6CCwZ7o6SrFON0zxc6BZE431yqxX2Xch115B8x FbkncUC8DDudytXFCz1JNgrTRZh78SgJBXq6swtjX1bIX4gta8m9sFRJZRLOcPRaJT5T7yt9NdeJs 3LY8Epo7JBZIpDDV1vYSOGOTsiTQnzRRXQNjM3A78KKJYp+YLzk/WwEorVlDKapteYJIPIDl5gdaZ zaRaz+RssQ4CHk2KEH+syAtG8eZsL6N+eBaro3g7g75GcHhL3kanw6bXMApEx6EqJznQRAHB7FrRg 9u1RfFH/EhdQe4teqnxueDNluW8tBaj883seiWxFqmb3hOcqRjiDV9SlKsy+bcizXulYN1duLtFzl Ih6bdr8zBBAYsdcSC3jY2kbDG0jN2ovReiFT4ZNN/pmad2nDylTshNhNJ5isjp5EvDP4u9KS9ravu bIe95vE231te/xgADXgkqz6bqzKds1YTbQLT/tucs=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:50 +0100 Message-Id: <20230621085353.113233-22-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 21/24] q800: don't access Nubus bus directly from the mac-nubus-bridge device X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337808097100001 Instead use the qdev_get_child_bus() function which is intended for this ex= act purpose. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- hw/m68k/q800.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index b22651931a..a32e6fbf8d 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -448,7 +448,7 @@ static void q800_machine_init(MachineState *machine) qdev_get_gpio_in_named(DEVICE(&m->via2), "nubus-= irq", VIA2_NUBUS_IRQ_9)); =20 - nubus =3D &NUBUS_BRIDGE(dev)->bus; + nubus =3D NUBUS_BUS(qdev_get_child_bus(dev, "nubus-bus.0")); =20 /* framebuffer in nubus slot #9 */ =20 --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337757983319.531308180011; Wed, 21 Jun 2023 01:55:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtd1-0004ga-Lk; Wed, 21 Jun 2023 04:55:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcl-0004B6-Mu for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:36 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcj-0005I2-8W for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:35 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtcP-0001ZB-Tr; Wed, 21 Jun 2023 09:55:15 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:Content-Type: MIME-Version:References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To: Cc:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=v40vpYHE+yMJwxHl5cD/t//CNeaQ4+I2oXSKoSJvkaY=; b=yoe2QTHDq74pnhUDmVXhXYnXNT N4Erpvdy9joMMLVGHx9AHa404Bezhu5F4l4tvzgK6wJcZxDdGPiYUalj+LWbgI2Q/txBVItBdtbVt b+JwOaOZhWJQHf+P/pVmU7CLsGg/CzVEDDYiW58Jdm11eeDCwbG7sTZh2HJhMDGdY+JVaqZWGnWyN R0wIw42D79SJnyh//2rbaMZHxbuIEQgoGrgHFjQ+k2Cwaz6EzQrzmsN5f6JEvfjSm5coIrzkNfOA9 N+MyKDBTB8of9qU81xCYw3k4Bt59vzap0QkDFclnsOVp6NuwX6CEQRb8jZVctneyJYCpCcGSLRGME Frpe7DzJ9V4Ks/lRokpFBi0iBvE0XJksydlj6jWEF6Msc+ZgzPQGdNxHXL0lCXRqj2ywKWLUB9MEs O5sjN6LjNKHX8F2t0lVU1Xo2AtlSVPp90fgiKM0h7nWuJiJaAfxVi56mJfRFicoGGzobQouyVpzC7 aBGnnBtRX8wMY7JO45cNcdsHS1Z//wbU5LBczgDAidFiyJIiPFntrMVuPD2+dY4X6eoD5aYUcTzFs kXC4wFcwNQ7qVy1YrJfXgSf5OnZzYr2XXlYD5iDX90fuJsl87Nma/mX5UKpBgFmp7eVeOPGtRlFW/ QxR0BIkNfaY5DmCcqcCB9u9UGrZ2M0kWjhskNEPaM=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:51 +0100 Message-Id: <20230621085353.113233-23-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-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: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 22/24] q800: move macfb device to Q800MachineState X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337759968100007 Also change the instantiation of the macfb device to use object_initialize_= child(). Signed-off-by: Mark Cave-Ayland Reviewed-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Laurent Vivier --- hw/m68k/q800.c | 6 ++++-- include/hw/m68k/q800.h | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/hw/m68k/q800.c b/hw/m68k/q800.c index a32e6fbf8d..b770b71d54 100644 --- a/hw/m68k/q800.c +++ b/hw/m68k/q800.c @@ -452,7 +452,9 @@ static void q800_machine_init(MachineState *machine) =20 /* framebuffer in nubus slot #9 */ =20 - dev =3D qdev_new(TYPE_NUBUS_MACFB); + object_initialize_child(OBJECT(machine), "macfb", &m->macfb, + TYPE_NUBUS_MACFB); + dev =3D DEVICE(&m->macfb); qdev_prop_set_uint32(dev, "slot", 9); qdev_prop_set_uint32(dev, "width", graphic_width); qdev_prop_set_uint32(dev, "height", graphic_height); @@ -462,7 +464,7 @@ static void q800_machine_init(MachineState *machine) } else { qdev_prop_set_uint8(dev, "display", MACFB_DISPLAY_VGA); } - qdev_realize_and_unref(dev, BUS(nubus), &error_fatal); + qdev_realize(dev, BUS(nubus), &error_fatal); =20 macfb_mode =3D (NUBUS_MACFB(dev)->macfb).mode; =20 diff --git a/include/hw/m68k/q800.h b/include/hw/m68k/q800.h index 8f2c572a81..b3d77f1cba 100644 --- a/include/hw/m68k/q800.h +++ b/include/hw/m68k/q800.h @@ -35,6 +35,7 @@ #include "hw/scsi/esp.h" #include "hw/block/swim.h" #include "hw/nubus/mac-nubus-bridge.h" +#include "hw/display/macfb.h" =20 /* * The main Q800 machine @@ -54,6 +55,7 @@ struct Q800MachineState { SysBusESPState esp; Swim swim; MacNubusBridge mac_nubus_bridge; + MacfbNubusState macfb; MemoryRegion macio; MemoryRegion macio_alias; }; --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337878684635.7494843482594; Wed, 21 Jun 2023 01:57:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtd5-0004tI-3i; Wed, 21 Jun 2023 04:55:55 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcp-0004Po-OY for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:43 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtco-0005Jj-4l for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:39 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtcS-0001ZB-2U; Wed, 21 Jun 2023 09:55:19 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=mEdEKrn8U4oFpRm6aYVrdum8IY3Swn/ona6HoA0rkf8=; b=jfgXiJUJGBoBqK7rh/22WmDxmx Q+umK9wPPbjjfy1BSLQXJixPh6L/TxBJWfpVI1jcnj57c8OPsck7ZFHVWQQlU+OBaBw/G54gbqTyE kfYMUW7y1uk/IFIrW47Mb112O7c1VQ0qKUBXyluvXLIJ+358ueXd59g35eMh7zRLmtmzfVakA86av Ct3Ngf6+K55lfwR2JeoY5Z1eimQlau422mSkYFdSEG3UqztfcS9QCgZ9KtLtQ/h1zcPKAUGqcmXoR j7ZDyoUZWw1U3LBomsBDYo7FkwFyJaREYqlxGx7u4qwhK9aZ+6iI3/F2QTcCRXdtRg8qpXEWbWsJp SoDLdmhHAU36l7kdulOAoMzMeZvwFWXuWvlA+LOY2eUXp6x+QlsqN/4JcP2001drd08BFf9XAAd7F vk4pBgQLYS1X/TeqgLgqUDsS5ghFj3CHLSW3NcxeFfK7TGLHGKbZXNMmRh7MkPI/moXpr8HLOBWMX o6/05baHtn9qy6Oe7eyzQpexVybDV/7Iu32uVL3LLoz/GSabnve7ZO/oUSqVmP6G8s9lFbQb75QOL HJutVXtGR3bNdGESjNd7bLtTA5j8jyOZ/UHgMwcNVEjJP4VXMmxs0F8N7J2WObPdyPxmyPOaKFieH ip51xKuDN0YPKmNpLI+DpqVvon/W5k62T6ZcXalT0=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:52 +0100 Message-Id: <20230621085353.113233-24-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 23/24] mac_via: fix rtc command decoding from PRAM addresses 0x0 to 0xf X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337880434100011 Content-Type: text/plain; charset="utf-8" A comparison between the rtc command table included in the comment and the = code itself shows that the decoding for PRAM addresses 0x0 to 0xf is being done = on the raw command, and not the shifted version held in value. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/misc/mac_via.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c index 076d18e5fd..85c2e65856 100644 --- a/hw/misc/mac_via.c +++ b/hw/misc/mac_via.c @@ -399,7 +399,7 @@ static int via1_rtc_compact_cmd(uint8_t value) } else if ((value & 0x1c) =3D=3D 0x08) { /* RAM address 0x10 to 0x13 */ return read | (REG_PRAM_ADDR + 0x10 + (value & 0x03)); - } else if ((value & 0x43) =3D=3D 0x41) { + } else if ((value & 0x10) =3D=3D 0x10) { /* RAM address 0x00 to 0x0f */ return read | (REG_PRAM_ADDR + (value & 0x0f)); } --=20 2.30.2 From nobody Fri May 17 08:25:10 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=ilande.co.uk Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1687337796073755.0216173550556; Wed, 21 Jun 2023 01:56:36 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qBtd3-0004oC-TH; Wed, 21 Jun 2023 04:55:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcw-0004bK-2R for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:47 -0400 Received: from mail.ilande.co.uk ([2001:41c9:1:41f::167]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qBtcu-0005Mm-2N for qemu-devel@nongnu.org; Wed, 21 Jun 2023 04:55:45 -0400 Received: from host86-130-37-216.range86-130.btcentralplus.com ([86.130.37.216] helo=kentang.home) by mail.ilande.co.uk with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qBtcV-0001ZB-UU; Wed, 21 Jun 2023 09:55:26 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=ilande.co.uk; s=20220518; h=Subject:Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:To:From:Sender:Reply-To:Cc: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=RZPPecDlHV4Qw2k5yjU6Ai2tqsGrdK9RgBx7NxHeIkY=; b=Ufb+XBFsG2PyS7xGN5yvR8EGdw cZvH1zOKsTSRWw4ff4klUYj+Kh5bt5OAf3dAHOqotdN/RaKne3prT83XiSoopkA/3SYSuCemQtLF2 uquXNKIkjKwSdBEwawLFI666HGihTtbAaUaBaXqSmcj8h3+Zca0eeNmM4v+bLTDP2uSb294/yxvV2 22lBY4sFKDL/V8ExkQB6nWp2SY5rFWByny6SHMuwyMrZiqXea9OmA7Isq/X4zWbvJi1l3TpbgDCLJ 8DEB6fcbHPvvGQTPUv+KhIbGIZ7MnTdDwCUh/eJFi6vI6hVBnd3R+dd0jHQJqyT0jzpXX8Tz6tfi8 04bBgAKxa/clxJHIn5ORzNescmnw3yOgea2hYKv2uogL/ZyhFBW3RXAfC0YWea/et4DOJyoM0z4Pv UBQYkTNiFer+BylvXvhQGCI6SngIRLn/cKiYv4WYcQF20iTFnBm+cttknOsJH4H0Zh9nBHq2ry4b4 eIgml2adeFR6t7M7OCDhS8crHVpEu/7OKQmUkkdXj9vuARHdmExFqLg6SbYRpXfq6VQKMfmX1669Z x4gCEUPZQy2lTgJkYV6gAQ4qO6CV9/9CeSRnPl8iWGz844aNfdoeRxGnk/lmBo34yC6L8oUN8B83s JTt6vHQ1KJdazIkNS94rAfG2PgXWv0ezDJudQaWd4=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Wed, 21 Jun 2023 09:53:53 +0100 Message-Id: <20230621085353.113233-25-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> References: <20230621085353.113233-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 86.130.37.216 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v4 24/24] mac_via: fix rtc command decoding for the PRAM seconds registers X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on mail.ilande.co.uk) 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.ilande.co.uk X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1687337798125100013 Content-Type: text/plain; charset="utf-8" Analysis of the MacOS toolbox ROM code shows that on startup it attempts 2 separate reads of the seconds registers with commands 0x9d...0x91 followed = by 0x8d..0x81 without resetting the command to its initial value. The PRAM sec= onds value is only accepted when the values of the 2 separate reads match. From this we conclude that bit 4 of the rtc command is not decoded or we do= n't care about its value when reading the PRAM seconds registers. Implement this decoding change so that both reads return successfully which allows the Mac= OS toolbox ROM to correctly set the date/time. Signed-off-by: Mark Cave-Ayland Reviewed-by: Laurent Vivier --- hw/misc/mac_via.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/misc/mac_via.c b/hw/misc/mac_via.c index 85c2e65856..0787a0268d 100644 --- a/hw/misc/mac_via.c +++ b/hw/misc/mac_via.c @@ -362,10 +362,10 @@ static void pram_update(MOS6522Q800VIA1State *v1s) * * Command byte Register addressed by the command * - * z0000001 Seconds register 0 (lowest-order byte) - * z0000101 Seconds register 1 - * z0001001 Seconds register 2 - * z0001101 Seconds register 3 (highest-order byte) + * z00x0001 Seconds register 0 (lowest-order byte) + * z00x0101 Seconds register 1 + * z00x1001 Seconds register 2 + * z00x1101 Seconds register 3 (highest-order byte) * 00110001 Test register (write-only) * 00110101 Write-Protect Register (write-only) * z010aa01 RAM address 100aa ($10-$13) (first 20 bytes only) @@ -373,6 +373,7 @@ static void pram_update(MOS6522Q800VIA1State *v1s) * z0111aaa Extended memory designator and sector number * * For a read request, z=3D1, for a write z=3D0 + * The letter x indicates don't care * The letter a indicates bits whose value depend on what parameter * RAM byte you want to address */ @@ -389,7 +390,7 @@ static int via1_rtc_compact_cmd(uint8_t value) } if ((value & 0x03) =3D=3D 0x01) { value >>=3D 2; - if ((value & 0x1c) =3D=3D 0) { + if ((value & 0x18) =3D=3D 0) { /* seconds registers */ return read | (REG_0 + (value & 0x03)); } else if ((value =3D=3D 0x0c) && !read) { --=20 2.30.2