From patchwork Sun Jul 2 15:48:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Mark Cave-Ayland X-Patchwork-Id: 1802388 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (4096-bit key; unprotected) header.d=ilande.co.uk header.i=@ilande.co.uk header.a=rsa-sha256 header.s=20220518 header.b=ehV/y37B; dkim-atps=neutral Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QvD5G4z5fz242S for ; Mon, 3 Jul 2023 01:49:37 +1000 (AEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFzJm-0004KW-V9; Sun, 02 Jul 2023 11:48:54 -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 1qFzJl-0004Jn-5p for qemu-devel@nongnu.org; Sun, 02 Jul 2023 11:48:53 -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 1qFzJj-0007Lp-74 for qemu-devel@nongnu.org; Sun, 02 Jul 2023 11:48:52 -0400 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: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=PPMj66S4AR+zQNZH7Pwp4zOeuubmZYuCpDvcWz4FrSw=; b=ehV/y37B8/1NHo+xZ9IMOY8Ffy Pqu/ji98L2JQ2IPd7zcbMJPdFT+ASJIFr0mPI+NHZBm9l9Vj7CjTOe6fTNrmT7cA0FAqoGYKt4JlI BbaMd/hqMohxKxc83L9lF3acDfA9/UEPO82tbrgbuv/pkG/2ppOl5x0SmJBy8oKVOxWqJp9brTMFR YdDzOw6cerdiANi9Va1Zv99j+74JWxnG3Tia70jDTFz4lTkz2qmicBs1USmSu+xWcL+dd0Sjk+pa4 ml8Ify/G9Rp/1CQyyzSEanEsnG5FnlNfRNi+53zO54Fsx9ysEiBzVNDFqGwKSsozIr3xps7voLWXG FDX82w6hZ1XGQWco0LtEE77MCXCS/fy0gbq0u0/Xrjun+3Qaxw55qOsuFgT7jXK2XV8Rrvq6PCouj pBrcRBnzxltd46CQ1LZolsSAJIjWkL4CPstOnAxiQmby2lzgC0rta4IMPmRPjWaMiu9gYpsPQtKY0 bEIYwCUCnvLURneWjOCMosZoTONvjoE8XJJSO9aIn7PxwSrRW55xX6TF+ff89hdPJg+dB9TB48S9s odR+Y8tb+8yoH90bVR4yx4kjNsrTXQ3eRhuOuVF0DOL1WRW7zW56G0sO1mr0WTVXVKjttnC5chYlu qctz6iPJtLg+EyVwNHxrCJFX9CwgU6eFpmI17kMZI=; Received: from [2a00:23c4:8bad:df00:f732:dd76:7417:d15b] (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 1qFzJQ-0001Ji-19; Sun, 02 Jul 2023 16:48:36 +0100 From: Mark Cave-Ayland To: laurent@vivier.eu, qemu-devel@nongnu.org Date: Sun, 2 Jul 2023 16:48:17 +0100 Message-Id: <20230702154838.722809-1-mark.cave-ayland@ilande.co.uk> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a00:23c4:8bad:df00:f732:dd76:7417:d15b X-SA-Exim-Mail-From: mark.cave-ayland@ilande.co.uk Subject: [PATCH 00/21] q800: add support for booting MacOS Classic - part 2 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 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+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org [MCA: the original series has now been split into 2 separate parts. Here is the second and final series of patches. As there are a number of differences from the original series, I've left off any previous review tags.] This series contains the remaining patches needed to allow QEMU's q800 machine to boot MacOS Classic when used in conjunction with a real Quadra 800 ROM image. In fact with this series applied it is possible to boot all of the following OSs: - MacOS 7.1 - 8.1, with or without virtual memory enabled - A/UX 3.0.1 - NetBSD 9.3 - Linux (via EMILE) If you are ready to experience some 90s nostalgia then all you need is to grab yourself a copy of the Quadra 800 ROM (checksum 0xf1acad13) and a suitable install ISO as follows: # Prepare a PRAM image $ qemu-img create -f raw pram.img 256b # Launch QEMU with blank disk and install CDROM $ ./qemu-system-m68k \ -M q800 \ -m 128 \ -bios Quadra800.rom \ -drive file=pram.img,format=raw,if=mtd \ -drive file=disk.img,media=disk,format=raw,if=none,id=hd \ -device scsi-hd,scsi-id=0,drive=hd \ -drive file=cdrom.iso,media=cdrom,if=none,id=cd \ -device scsi-cd,scsi-id=3,drive=cd And off you go! For more in-depth information about the installation process I highly recommend the installation guide over at emaculation.com [1]. Compatibility is generally very good, and I'm pleased to report it is possible to run one of the most popular productivity apps from the 90s [2]. I'd like to add a big thank you to all the people who have helped me work on this series, including testing on real hardware, answering questions about MacOS Classic internals and helping to diagnose and fix bugs in the 68k emulation. In particular thanks go to Laurent Vivier, Finn Thain, Howard Spoelstra, Volker RĂ¼melin, Richard Henderson, Martin Husemann, Rin Okuyama, Elliot Nunn, and SolraBizna. Signed-off-by: Mark Cave-Ayland [1] https://www.emaculation.com/doku.php/qemu [2] https://www.youtube.com/watch?v=yI21gURQ1Ew Mark Cave-Ayland (21): q800-glue.c: convert to Resettable interface q800: add djMEMC memory controller q800: add machine id register q800: implement additional machine id bits on VIA1 port A q800: add IOSB subsystem q800: allow accesses to RAM area even if less memory is available audio: add Apple Sound Chip (ASC) emulation asc: generate silence if FIFO empty but engine still running q800: add Apple Sound Chip (ASC) audio to machine q800: add easc bool machine class property to switch between ASC and EASC swim: add trace events for IWM and ISM registers swim: split into separate IWM and ISM register blocks swim: update IWM/ISM register block decoding mac_via: work around underflow in TimeDBRA timing loop in SETUPTIMEK mac_via: workaround NetBSD ADB bus enumeration issue mac_via: implement ADB_STATE_IDLE state if shift register in input mode mac_via: always clear ADB interrupt when switching to A/UX mode q800: add ESCC alias at 0xc000 q800: add alias for MacOS toolbox ROM at 0x40000000 mac_via: allow unaligned access to VIA1 registers mac_via: extend timer calibration hack to work with A/UX MAINTAINERS | 6 + hw/audio/Kconfig | 3 + hw/audio/asc.c | 708 ++++++++++++++++++++++++++++++++++++ hw/audio/meson.build | 1 + hw/audio/trace-events | 10 + hw/block/swim.c | 261 ++++++++----- hw/block/trace-events | 8 + hw/m68k/Kconfig | 3 + hw/m68k/q800-glue.c | 18 +- hw/m68k/q800.c | 136 ++++++- hw/misc/Kconfig | 6 + hw/misc/djmemc.c | 135 +++++++ hw/misc/iosb.c | 137 +++++++ hw/misc/mac_via.c | 268 +++++++++++++- hw/misc/meson.build | 2 + hw/misc/trace-events | 12 + include/hw/audio/asc.h | 80 ++++ include/hw/block/swim.h | 21 +- include/hw/m68k/q800-glue.h | 4 +- include/hw/m68k/q800.h | 11 + include/hw/misc/djmemc.h | 30 ++ include/hw/misc/iosb.h | 25 ++ include/hw/misc/mac_via.h | 3 + 23 files changed, 1770 insertions(+), 118 deletions(-) create mode 100644 hw/audio/asc.c create mode 100644 hw/misc/djmemc.c create mode 100644 hw/misc/iosb.c create mode 100644 include/hw/audio/asc.h create mode 100644 include/hw/misc/djmemc.h create mode 100644 include/hw/misc/iosb.h