From nobody Fri May 17 10:13:49 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 1685884605413201.95290376663786; Sun, 4 Jun 2023 06:16:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nZl-0004wT-6d; Sun, 04 Jun 2023 09:15:17 -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 1q5nZf-0004vY-OR for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15: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 1q5nZX-0002xq-0q for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:11 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5nZL-0005pb-VG; Sun, 04 Jun 2023 14:14:56 +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=YH3u+lBKxTGmU9U2PS6xpkAsnUA2aD2sNi6w+PFhK3U=; b=BMf9mi+Rmh/ZpQPTfLfogANcDC +Fi2OMgKtXGX4MA8jU+0dmLKNuhao2YHReurYOHjYMeX8tImad8um7le8dFD2UFhl14HCAZg/ZhuD FnchpWzb1ZrKs9f7UlGcHZpKSCmV+aQy5yPFnU5GvdNcM4N20Z9WMAjBoCkAktb9qJNj/fMXerg1c wM9a1FxppmRsd8SjZdIUhL4OdHdCIXWlwGXWzf9b4fPbra7V3GKy5hXJjdKklsp3xPh2QV5CWgAs6 iezyndsiGSVgDn7NaD0J4a4twePadRf+Mk3/giE1BZbeT7d8pprBW/RaeONgwNNcrejcQ8RPeUnua +BRUMLBUP5la9gkW0DxpJTO5jtLLprNC6Hpbh/fCwhnhp2H24oAYS44/TrQCXUUW9dxxt/QaMPX9B j8evgItmernKzGW69sfQmtiEZt2MZtJ4qFQtzYWsPq7GE1Iy2nzQ/32s9GTbkzAnKp9+/wfS+9/Yi z5gq5/C35YvhNMtbcTszWN6pmR6ZZ+hI2qCZ/kqrVxL6YnzJ00itwWRh0yRIg76NJWeb2WXu8eHzC i6iMZQtaOf1OrRUdq5bB5AoJhFjun6qER+WsMPKW3emaCJRVr7IzFgbgDN6Onskndkojv6NmsfFdG oDF363gDSDeqwuLwWwU/D5YG737aaAfPKHTrEzDGw=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:28 +0100 Message-Id: <20230604131450.428797-2-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-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: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 01/23] 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: 1685884606016100001 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 b35ecafbc7..1aead224e2 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 10:13:49 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 1685884650212838.2707106831546; Sun, 4 Jun 2023 06:17:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nZg-0004vv-Dr; Sun, 04 Jun 2023 09:15: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 1q5nZd-0004vM-HP for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:10 -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 1q5nZc-00039K-2A for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:09 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5nZQ-0005pb-5d; Sun, 04 Jun 2023 14:15: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=MJBJHbWsV58rgXcVZCGJHmGb2yKop8kK0XAJfFHj7cA=; b=VFyOkleTUr+jLdfpuD49tELPmb ipuqUIIHc5yLVt9S+vu44pjNNhjIka24qtuevg10gE8OAaGgvp/MgtYBQutbXDdYkga6grUAKGBvQ hl/j2zYgSO4nN7cdTsFecchsu26I3mRFowcbOUjnJNttAnu0zdrA+49+4Ujk4EBtzMzOQYGWQV+0S OA4kSTGtenmD4IC2jvNPWR8zYy00QTaQeZ4WIQJ/T2N5V66wGnIaz3OMZl0nUG+1nUS7Ie0hFsiWe geaYqbic5kO34qTflX7uQmCU8vaaPU1W3Mmp/b35S6gA+55uHLGCFnftotdAbTPEFktfg9lm5L/yB FupegbPWLGzpNtUjOXpdy5M2QB3pRDKTRQPAHGqbSlwRPLebsyEznuttuq8IaV5gfLLZKN8KKLeoI v14kNPQfe8Fu/rdAsA2uiksHdFnW6ZFt0Nd5wdlU9XPPS0eXQYNK4vNX/F4vNByYHtsi7aFlX11lz JU+D2zSGRWfPVV7dgw7FNc9lZeI1f8ZohjjN/sWU7r6VC9r7Qe0AF3lIKXe3GbJ9pgsEEbVCkopRR X4WsxZNMEAcIBgFalzIB8C97ehaKZpN9Xumgnn0R/p4kvM2dfJ8OFksoqVQMVJxcqE3Y3u78J33MZ YDKMq1BexqYvcTVNXSFN59xDh9TPKZj42E6KJhBuE=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:29 +0100 Message-Id: <20230604131450.428797-3-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-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: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 02/23] 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: 1685884652208100006 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 1aead224e2..bb9e857632 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 10:13:49 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 1685884605324153.15596427574565; Sun, 4 Jun 2023 06:16:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nZf-0004vW-KW; Sun, 04 Jun 2023 09:15:11 -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 1q5nZd-0004vE-6l for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:09 -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 1q5nZb-00039S-J4 for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:08 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5nZU-0005pb-Ay; Sun, 04 Jun 2023 14:15: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=4HLTz89PI9B/7HGfhkRY3rVqulCZOMgnt6vYD2pTJug=; b=a19R+XoWeUPd6x/Lcvwm8iZSan 7TRbSRll/g10AAyYY7nhxEEwzmchxQMSnKud1h8xLSEoBNY2T5E5SGd5ek29zRuEAbozNAIoFXwAj qC1EH2hukzlrBkgwHKPr0TI4Z7bzCpaY/OSAikrrkf6I62A5Uftlbd2iBM7/pC3kccHt0kRJYFUmw nrrWFJCDG+S6KxCM45M7/2NR6o6CQu9wgg4ZHq5tZoOVaTO/f0c+5iCFACl8ezg43vPb1riLxbQlo /0L5sNhdEuHL8hb8CONF7N11bLjc3/rdiEyMsVLMDJepeU16uaOLZVFaYbax2689nvXHsYv35uSBb hGZtytnTGoozLnhZP4bxbV4i93J80e1UpYezfZCd/DXcgI9L5wu3zi8RmpWtbgyCvTaIusYQJPaSt 7v+PqMmW5cOM8vVFaEQbrdm8R9+05fUxJ8qqEP3FOhpdIga6wtdsPBc2gpUgikT2oI1/MQchRIhTk QsP2lpGVstETNJjApYcMO7nQD4sJ48M0WdFHlJi30/WPh5V1LkgVg9okuzST19gnxfXXsOQIDTsnA h+C0NX+/eN3IO3ubV2RLV114MeH7yxxA0r8UKXuV/Adjm0qpgRA0qXjeECvLKkHuPCC2nySRzZ025 V1gLN46UvBFW0ZFMD+yOaMn+lcRhdLXSupBfd1nPc=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:30 +0100 Message-Id: <20230604131450.428797-4-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-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: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 03/23] 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: 1685884606028100002 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 89f274f85e..80bfd8859f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1234,6 +1234,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 bb9e857632..93a3f96991 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 10:13:49 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 1685884607080845.8898851253483; Sun, 4 Jun 2023 06:16:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nZl-0004wU-6h; Sun, 04 Jun 2023 09:15:17 -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 1q5nZh-0004wF-Gp for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15: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 1q5nZf-0003BF-Ns for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:12 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5nZU-0005pb-Mk; Sun, 04 Jun 2023 14:15: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=KJoFUtJkX0Pp6ysiE37fPcjZrz3Q6qAu63rzfHq7wcM=; b=Rn7XyWe4VqZXFBA7yHIhmuxNob HwsBfVeQYQFk4Eu/8PXme01tvPyZrS/YkGBjbPEVCGIbldvWG4uJRtZ3Ih3bAr5wRHxnypqgmGUFZ 2zKSgaLmBmxrOKgp7ixJdw0aEKkTZabZBXOxZ8kJc5ozW8BimhB4t/gxhot6pYHxCHEVacnHXaAv+ gvCW2h0453WkuccSYbOrv3HdhfSq5Geyk1fagJ64in7GXz6ZO7bWS/8ZGZ7XCIhxZV/nqlAaTSVbp qqJSDbWad9RuUm1F9hqPqbF15UrmZCIOxT6ox8AKeAtLRajmbiF1nPw1h9V1vITxx5DEu/DyKDTpZ vm3e0uws+yvGPA8JHKOD5qc/bD9JAasRWaUkE7IcaB5qRj0EyWu6GW6JYBy5Tw6WagZu6sUqeFfrU jnPovM0bDeAIQJiS7LsnXoBwdXxWFpcZJy+MEtfr5nXWSq6Q/3ZhTq8sYQjF22ICRHdnavXmKBEty jMH7ihxx289PXIlBivjlgCis03EZjfbqnibEEVqD6mZZT4EZOb2BZO9VSFpE+44l0WzSL/TvZqD5f qUgr9zNkCC0xKS3FX9c6w33z0GQIfbG3y0MwW4lUg84CLow6uyXE3z1aynMYFOb3ZlOjiL+MVC3PR bGxFArz7fRjsYpgMbY0orFQcJDXvIJH3++/ByMZsY=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:31 +0100 Message-Id: <20230604131450.428797-5-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-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: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 04/23] 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: 1685884608021100019 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 93a3f96991..3730b30dd1 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 10:13:49 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 1685884613551592.8941947451806; Sun, 4 Jun 2023 06:16:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nZq-0004xO-IQ; Sun, 04 Jun 2023 09:15: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 1q5nZl-0004ww-KZ for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:18 -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 1q5nZj-0003CY-St for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:17 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5nZY-0005pb-RC; Sun, 04 Jun 2023 14:15: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: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=uiA+iBrIUGwJgans3597z4RdyCllduP9PgIaDRs4FCY=; b=ISqYnIWLCb3jveLPAKx/82VQ3x IU+p1p10L9oUpS2qKL0724Gbb3BOqkc6R11FvJWOAYLuZ/9hbirQovOycQ+4+dOKrxEz31nqCWKNv s1dClSd6NjN4YoggKS8TbcKPswt1ICvNFu00OSWNliIFukjThC/egB+lxGBg8sjNXo4U5gboIzyjp Zvh8+aJtlTu+YYHpBqElUuhDhmmhHEROq+/DJ2V/KBiW3WhLLSnR72iIqv3A9d6e9ldkZcjp77yXk +LCRywJm41KXaKzOCQ16wyPG2a/m/RtXVWlnN0iMJik8RyMdB5Xa3K78kGW5lWPO7MQy4p+UrYXCN S5MkRYzls1YP6v8nJSOn3ffJw7Cb9JP0p1wH7WbpwSgkgl2728ty2h22SCBPtU0YdYfSLucpUiCGj 7JrVXWbhGLFVYnfcQBRGp47Lciv90Vs1a58ik45JawOg/JL8lxFuu4AC5YSJ+SSd/jSzgnCaBEb2n MThBBNQjVFfmlNz7h7fyWZzTnlXbpqUPD3J5meJYpLd+9mpTZ9NhkUWL+ex+Um4mlr6NoiZm9Gw8w HdIp2Z1tSlzJ3VmXw8q/ZwqAz51CN4OxpWhxTH/zoO/doGm4w1VIOM54MRcqdEAZtJ4l9ceQ8LLt8 psaKvwsP4nCPts0HMMt+Cj9bj5vZ7pUm9BA+lSv6c=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:32 +0100 Message-Id: <20230604131450.428797-6-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 05/23] 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: 1685884615562100005 Content-Type: text/plain; charset="utf-8" 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 3730b30dd1..d0ceb64b70 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); + object_property_set_bool(OBJECT(&m->cpu), "realized", true, &error_fat= al); + 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 10:13:49 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 168588465015465.10338371671457; Sun, 4 Jun 2023 06:17:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nZs-0004xk-74; Sun, 04 Jun 2023 09:15: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 1q5nZp-0004xD-OD for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15: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 1q5nZo-0003DD-0D for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:21 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5nZd-0005pb-0b; Sun, 04 Jun 2023 14:15: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=nsrKsmdJAxjZBcLntlZIWUZO3Tx5BxstZRAzmRMyoRE=; b=iS6pQygg1Js+VFOLQbVCLve0Bw 5p9gYBsZ1c+towuf3y2XLjKO/F+FFgSl1bEhdjVlQrvesArEcp2w2zaaiOcUeazWtpEoaTMKfJHRq VeW68Qxatr/hi1pOd7n6eY+l5rIZBr8sv1U0fGq/6bZIzDrlooPaF5q4eFqxXW3Am0yV65l6fK9cc u3OCL0AUhlzI/bKOwK4R4MC4dobmaWlQuNk+I5tctO5Tl+6tTtDDUrhXWoDC3tdCf7NImKw63AdMH POyuUgVkWd35Eh6TBEtgrjqgq1Igr9JFpe7BSjKSqUe/N2fxdwWKC75w+wFN0PieI53WYrVOpU8AM CUioKEuT5mcc/z8pGuERZDyOqRcy2otYDMRR6dE09LOppDM8VX2TbPggoQgAqa/FLf+e3YF5KjxoP saXsSYBf2jp385Y9HJ6qUART/APl7WKrqjHfrNr1qwpILdLkkg9zD0ABIi8yjljCvuSqMnQ/L6TjD WxUD7ffoW5LC5wBF08imWAklH8+bm+eMHq4KIhMk7nl/zid5b8q7XTq0U5wPD1GuuITK3ZeZYASaC c5TzJu6HOwQZpuyz65l4tHMJencvWtKLyilFrVLh7T89eHUqNJe4QBCmJwA4Ej1LWcrQk59/xwwBE GD5FxFjbhDrNym0fSoDNRtEivf+cCiAaXPHlfALeI=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:33 +0100 Message-Id: <20230604131450.428797-7-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-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: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 06/23] 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: 1685884652160100005 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 d0ceb64b70..f99241fe16 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 10:13:49 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 1685884605407253.00068942787004; Sun, 4 Jun 2023 06:16:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5na3-00050C-VG; Sun, 04 Jun 2023 09:15: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 1q5nZv-0004yI-Jb for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15: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 1q5nZs-0003Dh-Ll for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:27 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5nZh-0005pb-93; Sun, 04 Jun 2023 14:15:17 +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=4LO1ThVsZN/0PeZznSTMo3pXoeEgUZMBQuCab2KgtX8=; b=gNKW75VvgGa+XG5XuPfK5Flpd7 m/4o5eQ8yEGCdflr11YudAU1vlixKqGvX3+yGbGb9VA1MdSDP7cLtkm0LWYBFH4mU+94DHIts9qjn 5EIXhpuO/D4KpYOgCfe3A/v1qdYNCZcxoidd2sxUv6XxLi7KMF6cn5M3AyQ8VWh34/eq24sbb8+UD 4vRQV/GgdTMdla2Z6r1KOPGUz0THvT8rOjuzs+B1ZvRCInkVpGtyhaSYkKDJo+mDi+NYcfg44k7pu phQ7c77YB/GVWLeI62Z1ZKPxCOrdAhKrvBfFdBm3+CLJMI0MhNkTYo930AErXUB7uW/pKaeMDfrrW M39sa1+vX91Vmh67utD/dDhzgJeVfoFa71bXY4APz+LF33q4lqP5du+u4rDYQnFehWAbXRCPJzjcS qLgRX0fTRHAI9bIH8hmjjkOr+oIfEAfmVL4/hi5d5G0Fv40gTlV07zxe584kO94UxybfHpWN5brT5 /YSAinAPnrPAJnTBqfNfP08gV7xGzF83pItD5RvN1GEYWrcnkyCqptKQKtqRSiTIscnEjKOR89kN1 rpy2HEwhVZ6I+GwmXOBwVkYfGsAPDWhNOX/d6npmnoh4/DGlgCu/UFYoUN1BtyWfNa2IaLdAMvAAY JMy2WfKEZ90/RedbDCShGYWYdfFgbxXzZdvAizZOQ=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:34 +0100 Message-Id: <20230604131450.428797-8-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 07/23] 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: 1685884606034100003 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 80bfd8859f..1ca818e617 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1223,6 +1223,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 @@ -1235,6 +1236,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..793bdb110c --- /dev/null +++ b/hw/m68k/q800-glue.c @@ -0,0 +1,252 @@ +/* + * 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. + */ + +#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 f99241fe16..fa63e2aacb 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 10:13:49 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 1685884882080386.83483099952946; Sun, 4 Jun 2023 06:21:22 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5na4-00050H-Db; Sun, 04 Jun 2023 09:15: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 1q5nZz-0004ye-BG for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15: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 1q5nZw-0003EA-9f for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:30 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5nZl-0005pb-8k; Sun, 04 Jun 2023 14:15:21 +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=ou0sCOxRxOKtd24TsmvfldbedfGZ3RJhT6/PU91IP6g=; b=oZ+INaKF3Egpte+YmTgdLPExM/ T/zPvq/wscB5TJcxjZYuVCH5v3LGiyR+dxrl9999ZsE8cZENjtx7X5eRfyzWuCwB2mdR6+jSfXE8C CHvjta9m9y5u26IYFka545zlTT670BfCcErkDp67QDCHkfB6unCPB3scG/V5WHzhXZGS58bIHH/cN iBWaKQmvpmBgNCBYjyBf1uXU6pDyVzmxepgGfvuS/3PGPESs39HeXyDVQfnWc83y2Pwhjr56GHVjT P929Xvw9HPyWvgxsql+yGheSd3vIzV2yaxCRFrRxeHQQUrXCUMuwCE2lZ+YddG5B900/SELBYk9r8 JwL3npV7b1JKxHg/DtI/wHsaJhFgSUZmUBrcFn+MEbRj9Y2yUBeZ2wiH5JPfh2+/nRDajvfbiWzxw V6tXtl5mIgV5kAy4NQFSKV6Cvo4tGYaL5ycsLsiTmRNXxpaisKG7w9mzgK04Ha97+hA3BlwWeFZTu TEphZakzM9jVEjI4LuXF0GncYjO/sfwKGfJqFQGi8/Rom5UBMAPwXnGliKqzay2EpBWiYGhjcoOt2 jd2uOogPU6xFzQhCgA9VgDHLGmEiWN7i5eC1e8CvZREREjnBwqursvwDzZY/J8lWSh6Fq8YmE97YP /49BI5tsqqXOzBRjBeNwB9XNT184Xxm3sg8Y3L8lU=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:35 +0100 Message-Id: <20230604131450.428797-9-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-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: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 08/23] 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: 1685884883107100003 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 fa63e2aacb..7aa391a322 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(DEVICE(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 10:13:49 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 1685884615223848.2007849616238; Sun, 4 Jun 2023 06:16:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5na6-000517-Ns; Sun, 04 Jun 2023 09:15:38 -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 1q5nZz-0004yd-9T for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15: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 1q5nZw-0003EP-J8 for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:30 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5nZp-0005pb-DW; Sun, 04 Jun 2023 14:15:21 +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=dDPci5a9L9240J5PYw+F0RRtRjaNYijeJosPZNQTXMU=; b=FOwgWD2PT6MzR+b1ihrJuxyZR5 W1jz9WyfZkUusR7bGu2Pq/rtNOx+s+C79ddIQwHvxukOxBnn+SOVA9QwdwbPPSH30eVq1d9LTQV6n NQH7tg6Qkjy54tuODKfemQnG4HiqaYAhhsoekxc3r+9g/KEIj1XfrTSZ1Yf7OQTJBTCk/8/jHsRhk Z05BVOy6h3OSGJf+Ru++F3ZueOoGotiIbrU+ZsKP4ebSG5y45rFnMRslMxLVem83M5Z8ILfKPcV3X zLPdHVXydu2c4C6VPV9zT/izUm8u9pR8NG1Xbz5WmO2dlWmTYv0sg/KIge6e4lMg4TxV85E4W5+7f an5DKFYLl6B8MOEG8XmYAs8mkqM0pDPnHEyNL5iNshr1FJ0SnIvefCUP7l7VbkZCarDbAag+vV52H zDl0g8IjSFE1rXgWtbNLcsm6HoPxWfF/QIGz6p2ncwU+Jv6YusI7RIolzyFk3FOk9gOueWbYa9hdU nUiN7IcqnRQmbZkxxWb7ucIYmFu6y+JkA6l+P8UFZRbxZAdkjSJxxx+Nd3fdrQ4Whyv9EcH3pw2oJ UTNtuCsgUa7SUmF46iDTfrL/oD3Z14rBejxRdd5OhkpQ+yfbu5WwFh32LIH7HGFgTTnTFZujdfJSn CDrwc9iSw+QhBqcJnNnYSaLvxvapKpEEUs5yxW1gs=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:36 +0100 Message-Id: <20230604131450.428797-10-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 09/23] 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: 1685884616017100009 Content-Type: text/plain; charset="utf-8" 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 7aa391a322..6682c81ac8 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 10:13:49 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 1685884646247330.922092354907; Sun, 4 Jun 2023 06:17:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5na7-00051P-Ek; Sun, 04 Jun 2023 09:15: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 1q5na3-0004zu-9c for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:35 -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 1q5na0-0003FS-CX for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:34 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5nZp-0005pb-ML; Sun, 04 Jun 2023 14:15:25 +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=eEFw788dh569iCUFSIkapMHiytAnsouf6PVjvltvkNs=; b=XeBY1kx/J8N365nvNqVu55X15t RSLf6Gk9gvKQh/I5KuXDXovRZQLbI8vlU6l6SJ+fGyJWmbQcV/+sijBops2oEvizbElbSfQheeKKz 7btV7CJi3o04jkMpBBrfP98VzaPRsRSk4sEhTqsJYCu5LaebI5zyIBz+a/YI0r20wpQlfF7eCAcsY 0kZTq3gBQzQTMVcBVKdaEFMVWhSQjumgyb+Vn0uyR4v10tri2A2i25T6eK3gLsrvZUHD2ijo9ongn 94QDT6j95gG9AirhZBdeurrvvo5HCNceJZac/REORSYWGpenbQCxdGRAFsxM+pd2AC6D7WmJM9qkM D+VSyR1KpJURYEhadrCqc/9nj+Hl1umy1oHQgNs069w1RQb7ociOvwoE9GeMhtLaYP5F4vwjKqzWV nySSDVpx8IE3Wzo93q3vpWO3CL65qOLmlXb3IB40jO3DS+OSftFuZT88qTYm1KkFDMgqtG860dOYz gj4W7z8dUJ/MOfUe82YO/JwP2Lg8dg7XmbJ6ZdCHrcVO16Yja587wKTwSmZQ0PC10E+Sf3ov6EQLQ DrSqQ+rK5/86LSYz9zE0EDg6Xuipv9eYM5aJgEo22LJavvyYSqRgw4mV+1m2u6/q6/HajVRxr91ea WY2PtR9sXcp2sBJ3fItrOtXH26FbvLqucjoocbcqs=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:37 +0100 Message-Id: <20230604131450.428797-11-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 10/23] 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: 1685884647724100005 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 Reviewed-by: Philippe Mathieu-Daud=C3=A9 --- 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 6682c81ac8..cb4fcdcfb8 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(DEVICE(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 10:13:49 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 1685884644233942.2817830328737; Sun, 4 Jun 2023 06:17:24 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nab-0005Fa-BZ; Sun, 04 Jun 2023 09:16:09 -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 1q5na7-00051M-6y for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:39 -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 1q5na4-0003Fk-Bq for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:38 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5nZt-0005pb-Cn; Sun, 04 Jun 2023 14:15: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=GoSrfdMa7FtxTsiUvQLcTnsKtHWPh+7AwYagX7qlsbA=; b=OI9xezd1+SF2dWNJsP3jARQ9sX OfwpVo0w75/KMBeo+tEAEPUBVeh/o5sytrL96f9G/AUMEmYbC2kjBTk42Qu/a9X10GVPeigjjcKNW hMPCBJqay4f2dhhY8ufxyAI/msLajFUhxcWxxJgx7DGvcnspPbJSM8Q/FnmfAHALBhkhbW4zXdeHY 652KDF1J41jjbhJ9y7QH+Dl6nxO6fY//61l543DAsmpRIB290l0Xa0/MqcblOU/bISAw2glY+cK96 md7+UbkcX6A2MrcK16ViiRZqHvSI1YeKIUu6GNrC60oZI1HO/sUSl46/J/j3JjczSGb4MmiO+2top dgezZSoleRJLhgVxk7hXvsCU7IX9tFI3u9RTzYBOmgRiyuLKNcuycZOqb+c6E0Rxjw1BafVpHHIN6 Pri0vJlTcWIO9ZgDQ7X74uCoARXutVygEWYwp4r/Mg7GUdGabGHkBJY0SY6G/q1/1pXSRpvejaoiY 7iQ63ltABMwCoI825Py1u+yazdCJudoop6GA+BXTXTlN78xFEPKbc2Y9IdVytnoY9GUkiPvNLFJ55 DFj0cm1FgZ444wFcmK42rCgs3Q5/opxc7jpyYY0Bl8nuXFO84gN4SYvHBkPwuQ+7pk5HQhxaxvA0z 4s3aKkvGsLER/FUFkujPhHgXr0u8LIh5Hi87VZ27s=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:38 +0100 Message-Id: <20230604131450.428797-12-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-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: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 11/23] 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: 1685884646174100003 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 cb4fcdcfb8..a0bc8bec9c 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 10:13:49 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 1685884657161658.9096644524557; Sun, 4 Jun 2023 06:17:37 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nab-0005Fd-Cy; Sun, 04 Jun 2023 09:16:09 -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 1q5naC-00058z-DJ for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:48 -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 1q5na8-0003GH-Re for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:42 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5nZw-0005pb-VA; Sun, 04 Jun 2023 14:15:33 +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=2TySnD1VO5VsyV0QUWVI8BiN2FR1GvOIVUcAzFtjBBw=; b=clsa6K1hzaZRKGz73kIaq/XR98 blrKxHxz3weF7X4sRvoMeiW2vRJDbGZd8frkDH99Ff4PSxyrXFQiKnBbmxGdU7nTNSe82R3YXfY1Q DxydiO/KzHiNTv+EbWR2SGN1nGy0B1I1FXRzD8n3YZuTLHT6y4/+QyYe9UMxgaES9p+M3qEKUVH22 HYYyyiVaLH6tENkdgFDiIbFsBEGOPXz57LGQCndPK4qKSksKPfYGo5fKWjxM95N8F2PyERYKpemFT chJR32DXgSQ5rZv0fNzgyg4b6UjScDKTxOm5yC+e8cJy04TXOYKWZ6KiLwc4hymzRZ6xZuBwGHHuh c34TyWcKVhjt/Cv3F2Ry442H9UiSyLOcPpJwmSxpBxSGD0L6EFvGmVudgXytfs9YcgRSHML3aLfbn Odze0IAgRqBb9YGYj8tWUfQVi0X4IhWChvxfSe3YNzdNIoCXzM0brV/YgoZ+NlIdFhmcPTVjLGGC6 +vh5Ffr6p5lUudwUqyh8ixhTQ0TrWT4kP8V4M9IVzBPn7VcGNFcGxMA+Zzj9D3Ljwd/av/njC0G36 Sw6UBo6RqEeSs5AYPjNoD8SqnKEmg1xTnlRLNUGV+CPSvReB0x9+LOxP/rbzgjPFW4B4/tdepCQDe NbF5AMoNwVTfsRnrww+6IKQyrjrLnWb72YcjULOdU=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:39 +0100 Message-Id: <20230604131450.428797-13-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-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: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 12/23] 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: 1685884658238100003 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 a0bc8bec9c..c2e937a929 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 10:13:49 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 1685884615600159.8758746523672; Sun, 4 Jun 2023 06:16:55 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5naw-0005l3-2H; Sun, 04 Jun 2023 09:16: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 1q5naE-0005B0-Cu for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:48 -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 1q5naC-0003Hw-9h for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:46 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5na1-0005pb-7V; Sun, 04 Jun 2023 14:15:37 +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=ccu+z5ixmJ4omX8wXuXv5D+as4aYuWWYFhrhG/lsgC8=; b=NZsW2oiYleFuBQaBIhoIFrfBmI PzVRvhCbe2XX5iStV3/ShEGcjktwbwegncHr/qy5qo5t2veagAnQSVxAtUZuWXntkVWaZ7rx96ZiA 0xo1g+9FhURhKmdHRoMQPuKm18SJVdoNXXhcvlP60mO2CbQlpT76AVKOk77zA3P9z3TYb+gdx1XC/ rlAyXCYz3TDSgPRx9IVDogJIZX/e6uHN3t7cXqjOdo0ObxtOW2m/sQkNT4y5i4G1ITkODzhSYeUdD R2AZ1vvht0ejHmZebG2TmRU/1ybh1Vf86QeQMRR31ABPUl+CZ21zExIFOV52E2XGYJWECH89e+2dB uR/kJmTMLpIjumdhdMqOy4mqqQ8GNIGQugqN2UDFla57sPAehnPqQeJjqpLY9SswYlYmuWvPorNm8 fTKCTz+JEJtJfh61gzOzwzvwpD8VT0ju6d0TxInSRL39Ni+1qiqBGaSBOwX5kfGQC1nVWW8C3oK8y h+duOON+qvz8ZTnufMjlYCpOPVHxCe/Yvvkt3k+/2lvnkNe2VFNzJRS0FnC0TzkcTXAZq6sv2OPfc bFjuZIEcFQhSLYBOeQm41gNxMY4mFJsXgtGOc0+xMPCaKI1Jl3lq47qv4NPjI4aruYWTsvPwlxGxu 20lAgdOSkbuOU/7CNeplLzs5qx6k3B4g1ndTFyZCs=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:40 +0100 Message-Id: <20230604131450.428797-14-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 13/23] 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: 1685884616026100010 Content-Type: text/plain; charset="utf-8" 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 Acked-by: Jason Wang 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 10:13:49 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 168588461484714.122913099749553; Sun, 4 Jun 2023 06:16:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5naz-0005wh-4s; Sun, 04 Jun 2023 09:16:33 -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 1q5naJ-0005Cl-0l for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:52 -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 1q5naH-0003N6-A6 for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:15:50 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5na5-0005pb-DF; Sun, 04 Jun 2023 14:15:41 +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=m8Ws36/ibzHqa/LjGs7DfgC8ToUC3HAMQijXnOBRy44=; b=v0WjkVWML8vIyp1YUAKwnjCpnP dhgzv8o7vQ0cQmT+YYV0UBoFogjZ+CwZ45jEkvCbD29NVD/ycULc8EBPLKfw0PGwD7jmmWZ/zmzg5 mhyattYAI2iW3s7Q6nukTkAA0fMB/lSamJ8qDv0aX9N2MDeWrybUx9081eSK4D5+y1hrJcscNZuVE GEdQzGjbU4f8oR0BPvww28Fu9MDl3AYgNJgCMjV5TAH3MzeLPLbx5ErTSxcroKWkw77lLkmCXmDwo LNFkmvp//0RwDMc0fXNiu5mes+ISDma5zZfsq1JXspSD3X0ozemenvNqXNvcdTt5TDpaSDk6MQ3mJ MzcwA4xlLg4aohCdW+D2nQV5NimZ1VLGhhN31N6OObE6R+BadY7CICW1H+DEBdSd2oulgfUuTmdqC 1ipmVGFk3BisE3XKGj0crQRHlsYKgyatwPTAL4/3DyzopY9kxnkgV+MsncTcBN2iHtn1Ze6BQ7AJR 7Z2RMteqhvD5zDjJixvH6myuxxQ2wSPIFp3Nnp5aRtsiQGzo/euDRDundnAqACOtRiyZfjdIM5V89 oLnrgzwhNc2Xsof7G6MGZhfrp88/z4AeTh3QGyCzjRbCdw8RcylS+VLhdJZ7daVGPV5voqB7yl8eE Ze1XDyhodZxfwMNl8iz6AKlAaVYs1FM84meSM9hm4=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:41 +0100 Message-Id: <20230604131450.428797-15-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-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: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 14/23] 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: 1685884616063100011 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 c2e937a929..05194a06a0 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 10:13:49 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 1685884617406323.4426234502863; Sun, 4 Jun 2023 06:16:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nav-0005jq-Sd; Sun, 04 Jun 2023 09:16: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 1q5naW-0005G2-Oq for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16:09 -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 1q5naU-0003PE-9V for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16:04 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5na9-0005pb-HY; Sun, 04 Jun 2023 14:15:45 +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=QNXQppW/q3QQ69pwXolhiMZC7XJSaN13KUEFZEi33rs=; b=Hjnb8B22ei8IrQEquJNY0lMDM1 KmfXUPQnQ1aOz9ZmNRn7RIGsD52jO1hYmnNeiBJg2oq4w06CcF7jsd9gbvJj945527iZZcUu94Fx5 DLL1rKlU6Yb5+jH6f/EmTGj3M8E6KG6Wz1RXCYDis3mV812m/Abd/+4f/dHR8Z7xPvaJ+Qs7C4OMZ jrXsx1dc37i0jTKcsWTJMGUNFSXzsfR/qtP/sysjB6ED1QsmRRL/nb5gOowKVR3AttIqEaSN9HjOz jNyGskMLLTgeaq1Lyrt7kk7HghsquyAWTovEhk+vImBv13GWEwZGFQgm6UcmSWz/q1mgAkmpbu0un Lz5PIuDLTGJp44Dn0GqmI1cC3xK/qk1WSEt0GTFTd+sG19SgdqekmKrSqdX1zKVRA4Wvm0Jfl/S4Q NI89V67N/7bsY8JUC5dRfZfjfh0BwDcmldPPEcTXbn/YIuU9UniUQQk1oEi9GJC/68FU+l1+LnPKi kQcdApNnHLCWNtZIBs+vaDDK+gVCU3hruKGNwjsicAxyhtsdmzJJByFQHw15ixr/uopJ4Lm4EhRuc XeBZtaLqT9TEMgXaghibFK7mDKcl1cRfXtiLoCw+EyhP70B6nwYJS2o7Ivgs54Sn7fiw/BtT1z6aX DeDI14yzwONY/6tPknhk5tAwLt5r2GrLzJ3/0Dq5o=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:42 +0100 Message-Id: <20230604131450.428797-16-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-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: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 15/23] 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: 1685884619543100027 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 05194a06a0..c5cec46d99 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 10:13:49 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 1685884798836260.0924898186396; Sun, 4 Jun 2023 06:19:58 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nb0-0006A1-C2; Sun, 04 Jun 2023 09:16:34 -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 1q5naa-0005GL-2j for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16:09 -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 1q5naY-0003Po-CD for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16:07 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5naD-0005pb-EG; Sun, 04 Jun 2023 14:15: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=Xc7hFVwEDCnyUxLHXAa7ISumT9rOer7aIQ6/FzNx6ac=; b=oB8kuVSFpKfh+tpY919xhpQelq plD6JmdA/RhiCY994bsQf/LMmQwGSAlBi3EWqtlsLl3aGbAUHrqXa52VaIk+PmZL08/crEdroWQzf rwU7BXsp9TlTn8HkpJE4OLTbY8P/RP+scztxVC+lbrkezlRLuqUh6Pw3EWFSjrUK5v3EtZDfIK7np F61W4YyHZXwtQ0/dAeLY6++HDebcznASL6lAjQrs/naIJlyiTO6R8cU8RXnPfwlMmC7d/5fGsKQMi wghzXpRL2zDG9hsrKgfmEwDU62WP9u0rslDzyRqIZbzDN+bCSfyh0h3kL+JJGh7Db4hL0Alla9Q91 pzFYt/qT3OZdoIaAhYHtbK7bmOnIxg6uBHRSkgltYQk7s/9KhwLQN6LYVqhJq/SWzDsNGc2kMkQqB YA/nkfWhayjIny8ujZDh6IfbuzXc9ZXSSMVrQ9Xu+hKBtIh6mNT/dxGZ134R+vpHhQwBpJVeejlA4 5ejFIT78MnZn9pSqYQ+CmwnHv3bbuVxOvRLeMAk/17U/UxsVVUFb8HnAkwNKM8Ci9pKaZsWIC9POT TuCoItAuammeY5gxLciX+/NmEzw6naQh/CvmrKOthFq8oYwy12sUT88gPaQwS5b0f2Uw3/L00ugrY vqKTBX2IGHrfLiELUIIRTXF9STNzIIIaxXWpLpuH4=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:43 +0100 Message-Id: <20230604131450.428797-17-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-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: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 16/23] 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: 1685884800508100007 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 c5cec46d99..0a415a7c6a 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(DEVICE(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 10:13:49 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 1685884838484869.3321356430633; Sun, 4 Jun 2023 06:20:38 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nb2-0006UI-CA; Sun, 04 Jun 2023 09:16: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 1q5naf-0005MN-4I for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16:19 -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 1q5nac-0003QY-Gi for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16:12 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5naH-0005pb-J3; Sun, 04 Jun 2023 14:15: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=clKmotId3U/HxuPuiq+tTA3PIfrLG6vioCf0pl2bbvM=; b=wicUn9I7FkbxVgFQHcI25aa73X nbgn78WGONvRuY8TcP8Tc76+Is7YkoyYDNDF67Op5l5n1ggAY0vkJBv5xhavUm+mAzeqf5SXTsAB5 mqtnwrBFHXOZ6fqED6bpkyf/EnKBwnacJ5txELbtbGNosIbJxZeKdrpYwQ5iL/RCRtNHxcNZ5N9s+ fCcxTTWhVot0l1jId03AbdeGC4tangLZkbjjAD85a7rfodVVsMprnvgcoMCuXHe/4D0SW9rOwf1K3 O4Xg9nXjNhvzxAtvAEZzqY44n7b/w70UfgXeYIpazeF/h5pU/LiU+TUBejEvkjsKmGJBx3Tj6Dq91 Kig/mdSLuVSL0/MfWOpYamH+zaiRO71AKceuaczp7g2BsH9cpMyJJwmej/QX5kyUx0wPT9dm7xQYS Am5j0ER8aFXeGGDDO/dYE7P+MQiKNjzeit1p4drDxu2nNYj+wkB60gbkgm6nLQwrkr8v3zZC68wjb WCoortPGkYO02dxb+dRcGVxb3WwsDFASmdVY5UUCzBgBO6Rt1aoGTFRG5ZlZ6b72/XpQNCaFzc/hG A6p36gvsSZkV2rvOEI0JL/gXOV7TR09+ALvOG6DTIYeeXaQyLDXnvcCvIfq1xS3imowMI29zYzuA1 DUw/OBHVQkjkki259AKBSomwf+T2f2pNfcwTxpqww=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:44 +0100 Message-Id: <20230604131450.428797-18-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-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: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 17/23] 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: 1685884838955100003 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 0a415a7c6a..3ab4607134 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 10:13:49 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 1685884850491207.9291235304596; Sun, 4 Jun 2023 06:20:50 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nb1-0006Ld-D4; Sun, 04 Jun 2023 09:16: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 1q5naj-0005SP-21 for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16:19 -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 1q5nag-0003Qv-3b for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16:16 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5naL-0005pb-Np; Sun, 04 Jun 2023 14:15: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=brwLK4R+JeAc8ypKQkb2TIV3nhS/M5mLv6JQqyF4IOg=; b=yr8QRbEFiXtiAj0g1US2DrNUES 9EsfjUxTfXw/H7b9RhjpBNKBjzeZdIj1/YHRS6ulAsyaV127etNO+KUjLK5Ja4VRVmfC35wS+Rr0z a8QsKfpwNcpLwjyZ6AnUkhf/S0awCqTHSJDYz/mYH1HnhrY4EKktKNW9oAZ2DURSU1KOFifiGJxlA JGXxfk2gTr8b5dAyyO/5CMCpvdTTvW5PxKXwLIhuT7X3ZWkwCtk5LgVTVK9+jNAXOcPDavWyePTAR 7uNp/w3FJ1DyZpjzGM1d0i60QuqkP3m1XFBegkydvQPjvWpgZE/TYy9rjG9opc0V6er46UUGQqLRe lUN042Ct1i8pI54kCuRBLRrLYYcTMSLStQA1rYsRmz5PvsBHvNsdpOC4MhTjsLkUn1PCWH68n5JqI nRhw9r01jx+oQptF9rmqfUsjNqOIuwCNwph6CuWP1abvJJoOcbFGWKr1vcCBd3PQ2425pl9RslxNQ n74ZPqUIPCbs6mYCoDcMfqY7OU6YTcnPmP9osIg9LEBAJBdP+np5mIT4Dda9WHIGdMcwnEo0plsZd ViGCs2ExNHTxxnR7AyB9zHxYIoBursO5bi/oExAtqzS+YZr0Z9RTiXcvNJUrkO9sAfe0X77mK1cFP iNH2f66lFS0m/o40nonCbLOdlF1NJV9z31dLk7R0Q=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:45 +0100 Message-Id: <20230604131450.428797-19-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-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: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 18/23] 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: 1685884850780100002 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 3ab4607134..d6e19ff18c 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 10:13:49 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 168588461493057.12571782794964; Sun, 4 Jun 2023 06:16:54 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nb0-0006D8-Kp; Sun, 04 Jun 2023 09:16:34 -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 1q5nam-0005dB-5m for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16: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 1q5nak-0003RG-Gw for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16:19 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5naP-0005pb-Ar; Sun, 04 Jun 2023 14:16: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: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=4FTNGMNpfBmoYplOuv63uab/o22vwhYtwC3P/5ofNaQ=; b=ZHJqTxzbb2bnd5K9loFwxr2UBS A9CIHH85Bp/OekicjwZ5msSFMYxtgtl4+ZYNEVp57KLfs5nd+0H0df900fdcVzTwL2ynQ51ZDPcie Q8XdH1b0dbxSIdtgi86dJbqfF3XMMbRytHkxXIim2XiP0yDQf6+E/XGor5/Mi+5YI0i4VHffzA2df M4C+x9KQC4U34aNrV0ejs/iD9uZp9KixR43IWp20b9Ag/H+NMTgguqvNC76ts7jCNRQwzJx+DFRmj 14kCzEkg0rRGkY6D7SlyJkkE+NWdf3uBcQ9R//ZwKk8FoiHtABEma3Wh7vzFft8FpxVMGIQF85PrC oH8fr28x7Bp8ZY4q/7m4RHW5vwBN8YfLo68RL5kouMBf9jRc/X3EuWqGed1otaXBv7yhHVxNvbUuD G0TLAqwB7jrC/9J1+t1TN5gxDPRbVYCKHcf/OFTCi2qFYnnStZT8Du6cgpoi5hbRtBMvYJkPZAOoJ eY/ZYuDb8difbtgMRSTSV3Aj1DiqBLGhdPPpkmNS4tHQ3+l/0DR1TaELexVNwLSN4tkIk7LGDq38E Lxd2vQ9e5Hrkfy4LPeD+OCuYmkAbiAr2AJqqEcCMGghFqA4ELuIN2JPU1NTBPDjwNgrZU3C48IcqX p3Nbgyd/y6ehwypTnoXzueg1Bsjo3swnHmQGDwX5c=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:46 +0100 Message-Id: <20230604131450.428797-20-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 19/23] 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: 1685884615560100004 Content-Type: text/plain; charset="utf-8" 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 d6e19ff18c..14879310ca 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 10:13:49 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 1685884797288269.6999678135811; Sun, 4 Jun 2023 06:19:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nb3-0006cz-9j; Sun, 04 Jun 2023 09:16:37 -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 1q5naq-0005fL-4K for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16: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 1q5nao-0003Rd-PT for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16:23 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5naT-0005pb-IU; Sun, 04 Jun 2023 14:16: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: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=pm4eOzasyKQj39odUPiLGUIgTcok2oRRMLuxlqhyDDA=; b=ed5Uu/kpfBOFh+NTn7FTcvKwTO MM0m7YgNfG5AevD/lG8Yw+j/hu0Ak4inB+fzbDQHWb+9AhaVyWNkD41Z/GlJtwwzuK8fvWgSw+OuZ 5WrejvwrHcfz9QUGD5bINpJLw6oYVOP4oqOAy7x1dJgcc/ket4FmRKglLLaH1YIuqbf2TE4whv5vb Dh83Sxn/kssLkEDQmbLC5EtVah15WUiS35UYCfqgi0DcVN1IXT7MtQeDLxTQAWz3fcyxmtfQd0RbL FmiJ4mjjk6iVdz0SQXl8OPddhKhcLrP0MhKEx8y7tcuxZjygiBtaLhNh2dvVsEMM3fGntCYVi/TKU vc8gKsF78pqBEMrvXhie+RjsdOlHXX0q4yv+zP0CZxhz9TE+ESM+TS41krFt8URadIwJy64xJJX2n DKanHQLpfraJAuJpl8mvyKitUD7YVJGRbaC10+d7o8Ou1ESDAe6+dMOJ2CG9vaCZV/ZTGeQ8zKkTC b47m9XxpkilqwCOOGTbAzhJfDjMemyvvqua6Pl6sbkoK/YCvYWK1+ZX4oQ5czQI8aUv5DM00lMtMU ZQqA2rNvXB8hl34LILG2Sdl20JX8zK9CEW9Ht+3kwlWgOMIspI2yzPLA533KGDFhgcNZHaYEDP/cG n9KPOy+ENjce+0ae+g7vQoKXHgeaOXcy5nHIK2jlg=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:47 +0100 Message-Id: <20230604131450.428797-21-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 20/23] 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: 1685884798708100003 Content-Type: text/plain; charset="utf-8" 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 14879310ca..df2765dbd1 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 10:13:49 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 SMTP id 1685884817384304.64038720584495; Sun, 4 Jun 2023 06:20:17 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nb4-0006lO-9D; Sun, 04 Jun 2023 09:16:38 -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 1q5nat-0005km-Hb for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16: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 1q5nas-0003S6-1S for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16:27 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5naX-0005pb-OI; Sun, 04 Jun 2023 14:16: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=+aXf0G7JGpdKOLC9fsWE7r1BLKcLsBCKo0c5m8i+WGA=; b=u0/daZifN/kjKSGrT8XOMOSoMf VTqstEZGYGrIFVHBoSe28Pgzy630iHRvm3PZ1AEue1tvyp3nVxBACW7TAoBTDR82iVO+X1k9r8GmM XzuD+0u01DTQoXfWDCy2U5bs6RFk1QyxEdTuiliYTKNjuVrPk8mOUvsYTxgBeZhj4WjtOZaEiaBIl wgApPptf31TRgKx941tabQJqExwC3k52M1l5JfEoPUqXUztDT85MgvHO1uNZj8da3rbE/A14EVfmv NpfpHdnveKKy0QBGFY2rLjNm5AqHzix+rXFExKlX8Gtdx244UWImar78ikOCxsddyHtm5WHedhUoK nH9hy0DqfIKpDX/XJP2/myOcBxNzkVeVEf+iNgxFGJCzygpkLfB6kTuWgdjq5E5NIhUDtMDBqI0op lYZonj1i+GYRYRDNamnvW8RPoSXYq6C2YRga3x62WEGSE5v8zcnKy9sNVwAtGoupRDTYlonneLSWN SDwX6QHz0mS43/LYMJ19VmT6kijHnRA+pVBFJNGp55h9ZByUz/oAepcF3WjTOqrG0PkaEy9uFisXc oCnMaysYJ2UabSSVP7t/9G0sMo8sN8SxiTHoA2+zoanVUwS6if9S5x8SwCaClwm506YnAuOkZXQqF 7mdP7h+GHPv2kWaqR20T377LplO9yojXdWLTD7Fho=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:48 +0100 Message-Id: <20230604131450.428797-22-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-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: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 21/23] 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: 1685884818766100001 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 df2765dbd1..d314ea40f1 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 10:13:49 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 1685884631424860.3313781096939; Sun, 4 Jun 2023 06:17:11 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nb6-0006rj-2x; Sun, 04 Jun 2023 09:16:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q5nax-0005r6-R4 for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16:32 -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 1q5naw-0003Sd-Bf for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16:31 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5nab-0005pb-8e; Sun, 04 Jun 2023 14:16: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: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=0x8maena32Fvgeyj7fGrgJAl5j 9zaGJozISQ+fbL1yM0eylBYg1KtSlYJDg9zX0RxPcVU/s1bBn6ol0yMAGGfSuMCH7JGv6jvisW1NX vaVkuGxTbBTeTi5LfF+3i6RjR+c4wQv+wwg/G5gkeaUEfLcGNLF5DKbB0cTPHFSvVImH0Scd1VPRC m+9VXBjzK8MvL2Ly2q0r1ytckKX+51q5nbsiP5CALNwcYJ5AqV+qN9W4M6f+BqWkaQSZDlSZUt8c4 VJ4PvOfXcI9h7C5aVZY6ZboDPxQATO4n86YZqIWzkdmfKSjQIPirEbQpBJc0KlXXh1em5iGFZXHOM eBnnrNBg+yxaimLOZLh52GTxQm/JT+ObfqmcYhQe6k3i09otUKNYSs5OXDxd/BU8C36oNySIS6xJh l7xEz6zfD5NecvewU1z49phqrXX34K91PU47RpxIxDUn1BPIL83GSY8B+ifKkbtL0tDIWRxW8LVaW nbREty2Ax01/phbhvy2sRiqAXAwNS/Z71ArBRR59oyiJ/y/nVOCPhtCm+V1tABVrmo+UorMxh9KEZ g9iqzgPGjYN6gpp4hQK35iUay/0h//ps4MyFNvO++8M2z7cgIB6AnU0zLatyBDb8KsTYIaujf/mJS Xtu1zNUsWBY1784MR+euuxF+aX+/v/76J4iRlo7Sc=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:49 +0100 Message-Id: <20230604131450.428797-23-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 22/23] 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: 1685884633611100003 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 10:13:49 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 1685884617395156.80786569258134; Sun, 4 Jun 2023 06:16:57 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q5nb5-0006u5-IR; Sun, 04 Jun 2023 09:16: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 1q5nb2-0006U2-7K for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16: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 1q5nb0-0003T2-H6 for qemu-devel@nongnu.org; Sun, 04 Jun 2023 09:16:35 -0400 Received: from [2a00:23c4:8bac:6900:b726:cf58:4c12:f013] (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 1q5naf-0005pb-DV; Sun, 04 Jun 2023 14:16:17 +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=yX/L/FJb6hYc5phF/Mt5+XnBJg UYsX62S4DyzbZH0cC0oUtWesPDWAjVYp8oGasce5jMNO/4amohir5I/ZK/JRHcognE7Wthrg2VwRV yS6TnrPFcwkV8HQp/fuHdQqip7a8hykyprAW/3c1MyRb/P9UHT80B4sI6jiZF8eB202PF6zjIpQi6 6ZytWubfo21bsMxBUCgODyXRCuhjI/sfGT30ejMiJ+qpCdPXd8EouArnyQ29P4FDYoiCaEIkUtJbx wPVa4ysrmucQWnMv3X3GD1lsxjXYhPqKQmMEMLpYk7YLR6epYabxWqH8G0ANYRMzJEVs5Ed6BUgd0 amqMd100WeMyRyyPx1/N0ipyNcZxyqR/TZkFBNi7N/WVuPidFfgih9qth6UYgUmSQfk7ygEwGQnps O+8hDOoY1hcBPzdDYaTYPvNQH+DTKojYFnqs7YALScdR3Lze0qb0xwAWXcsKC6YF2tRxYv511bCnv ASaDb1omHoO1ICZVtdsLwgqoEtQbchiW18D8fK0bXVLkf6wCRkzz/yD5rWpPNmxUHM2AVgQJT/5XX Vqm67u7C955FARSwI8+9AopzP0uX6nvOXjxtkE03YGCfchr2XO9L6CFWQFv61vTTZMS6RBzlpk8n8 QFnSjLdqvTvsjD/7joXN/OGEVHAztdyK0W+UbxDHM=; From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 4 Jun 2023 14:14:50 +0100 Message-Id: <20230604131450.428797-24-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> References: <20230604131450.428797-1-mark.cave-ayland@ilande.co.uk> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-SA-Exim-Connect-IP: 2a00:23c4:8bac:6900:b726:cf58:4c12:f013 X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH v3 23/23] 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: 1685884618045100023 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