From patchwork Tue Jan 19 08:36:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 366152 Delivered-To: patch@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp546205jam; Tue, 19 Jan 2021 00:42:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJz54e41PniXQAh61BnvNZs1gWs43f5fwBitq7IPE+I30uHKvLdy8b0fjG3rzWrJY8tWolkW X-Received: by 2002:a25:5015:: with SMTP id e21mr4732398ybb.14.1611045723508; Tue, 19 Jan 2021 00:42:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611045723; cv=none; d=google.com; s=arc-20160816; b=0wgE+UoJf5MQ+v0zZypyE+ZnBgdIVFAvJ6q84E4P9I7EcgbPwUnlWwo9C2ps01ZLWX VZr1QWOcdHC6EgqdG7zIjf7VtJkHfkPgfEjitBvuIYcynf2BfDoTO+MdF7D6Zhsb6MeW 2wA7ZDMZJt906cm+0oFE+t6FwVhfCdBSrFEUiLvqSKhJ2VST2Jisj7thIJfsbgsX1TvU B0KeYf+A2aRJlwC8+0zewFnWF1ysz1XH7hs5Km08+XkaMi/a/+Vl5sL/YywubaFmPpSf ybo09nLRB8DRuvY26S18SWDM8ozpukg5MrNwO09F/FBKKHSng8OhJeS+DTTXpzRscNUG Siyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from; bh=+FrPA9D7tgOJmnuV/QM70BzMEZV7Pu2xLl9GXYEW1X4=; b=it2RQLAzEL+sO3wiBdxSeIB01EiPvYciJ9PBL1XF8iuFE4w5zTuSzCbIDX28cIpYgx thlVVvoTwmVaVXS9mEk6gB3nWtMzI7xmVfPRaA5P7ujI5VAn17Z3jhAYGbHjJk7LOa3F 2fIdVIYOMuJAkjz1V8gQYWJ9TFp6NxGu7RCaOEpObEY01A+YSoeAty0Jw+8U5rkZTemP EmDKzJL4Zir0McM5MHSnqCV0m3zfYcMtqMpmF4D4Pp/eHW+2+tr7seHqiWCVH0uZYar+ 2O4uXXzOXZgHK5dH6TFZ5M/4ns4TpW0t11gvuge3NtKyJuldldy57hCG6v5Eonofj14G yqSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q188si22121706ybc.262.2021.01.19.00.42.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Jan 2021 00:42:03 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([::1]:43362 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1maQ-00074Q-UN for patch@linaro.org; Tue, 19 Jan 2021 03:42:02 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34428) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1mVZ-0008JX-9U for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:37:01 -0500 Received: from mail-wm1-f48.google.com ([209.85.128.48]:51865) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1mVX-0003Uy-E1 for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:37:01 -0500 Received: by mail-wm1-f48.google.com with SMTP id m2so511108wmm.1 for ; Tue, 19 Jan 2021 00:36:59 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=+FrPA9D7tgOJmnuV/QM70BzMEZV7Pu2xLl9GXYEW1X4=; b=mSSW6eRjz8cNU9qKYhljx/G83WCPk4R4qAA5dZuU1zRsl5fQltQZxDWOIlYUQlee9A gQfRUu9mbZNeRTvcVsjWFkxHeVtN/+du0zQUcUKEQOdJRj5H7+Ja+Z8HVkv0uc3z4wfW Q+Gq5cpEn63u71Vtryt2aewipqpCRU6I3v2N0vk+uvDRV4gp4SvjCYoH0YWIdngxE4tI YuXhDWg2+CH5yegb+HkoBULZGE+95e72tkl3/4YdrLNO1Sr7pXi686FinXhBqs/MsrFQ tvYfCw+/LQaIzvM0YyuRFpbt74hurnQyXkYbjaIKUOr0iwnc2IIqVK6VK5z9iPphJcQ0 FiTA== X-Gm-Message-State: AOAM533i5nOw6XxqsUtt/6mvwAmXOODXjKh+7MiYA9xsooqPcoBqXGmQ tMkTEuGtKj1I+/z9j0UUzwWdDyz0Uv8= X-Received: by 2002:a1c:9cd8:: with SMTP id f207mr3019373wme.155.1611045417969; Tue, 19 Jan 2021 00:36:57 -0800 (PST) Received: from localhost.localdomain (pd9e83aed.dip0.t-ipconnect.de. [217.232.58.237]) by smtp.gmail.com with ESMTPSA id z14sm540833wrm.5.2021.01.19.00.36.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 00:36:57 -0800 (PST) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 08/11] hw/m68k/next-cube: Move rtc into NeXTPC struct Date: Tue, 19 Jan 2021 09:36:14 +0100 Message-Id: <20210119083617.6337-9-huth@tuxfamily.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210119083617.6337-1-huth@tuxfamily.org> References: <20210119083617.6337-1-huth@tuxfamily.org> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.128.48; envelope-from=th.huth@gmail.com; helo=mail-wm1-f48.google.com X-Spam_score_int: -13 X-Spam_score: -1.4 X-Spam_bar: - X-Spam_report: (-1.4 / 5.0 requ) BAYES_00=-1.9, FREEMAIL_FORGED_FROMDOMAIN=0.248, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.248, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Move the rtc into the NeXTPC struct. Since this is the last use of the 'backdoor' NextState pointer we can now remove that. Probably the RTC should be its own device at some point: in hardware there is a separate MCS1850 RTC chip connected to the Peripheral Controller via a 1-bit serial interface. That goes beyond the remit of the current refactoring, though. Signed-off-by: Peter Maydell Message-Id: <20210115201206.17347-9-peter.maydell@linaro.org> Signed-off-by: Thomas Huth --- hw/m68k/next-cube.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) -- 2.29.2 diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 7dcd39aab9..57f9e9f837 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -78,8 +78,6 @@ struct NeXTState { qemu_irq scsi_dma; qemu_irq scsi_reset; qemu_irq *fd_irq; - - NextRtc rtc; }; #define TYPE_NEXT_PC "next-pc" @@ -89,9 +87,6 @@ OBJECT_DECLARE_SIMPLE_TYPE(NeXTPC, NEXT_PC) struct NeXTPC { SysBusDevice parent_obj; - /* Temporary until all functionality has been moved into this device */ - NeXTState *ns; - M68kCPU *cpu; MemoryRegion mmiomem; @@ -103,6 +98,8 @@ struct NeXTPC { uint8_t scsi_csr_2; uint32_t int_mask; uint32_t int_status; + + NextRtc rtc; }; /* Thanks to NeXT forums for this */ @@ -131,7 +128,7 @@ static void nextscr2_write(NeXTPC *s, uint32_t val, int size) static int phase; static uint8_t old_scr2; uint8_t scr2_2; - NextRtc *rtc = &s->ns->rtc; + NextRtc *rtc = &s->rtc; if (size == 4) { scr2_2 = (val >> 8) & 0xFF; @@ -865,6 +862,11 @@ static void next_pc_reset(DeviceState *dev) /* 0x0000XX00 << vital bits */ s->scr1 = 0x00011102; s->scr2 = 0x00ff0c80; + + s->rtc.status = 0x90; + + /* Load RTC RAM - TODO: provide possibility to load contents from file */ + memcpy(s->rtc.ram, rtc_ram2, 32); } static void next_pc_realize(DeviceState *dev, Error **errp) @@ -921,7 +923,6 @@ static void next_cube_init(MachineState *machine) MemoryRegion *bmapm2 = g_new(MemoryRegion, 1); MemoryRegion *sysmem = get_system_memory(); const char *bios_name = machine->firmware ?: ROM_FILE; - NeXTState *ns = NEXT_MACHINE(machine); DeviceState *dev; DeviceState *pcdev; @@ -941,13 +942,6 @@ static void next_cube_init(MachineState *machine) pcdev = qdev_new(TYPE_NEXT_PC); object_property_set_link(OBJECT(pcdev), "cpu", OBJECT(cpu), &error_abort); sysbus_realize_and_unref(SYS_BUS_DEVICE(pcdev), &error_fatal); - /* Temporary while we refactor this code */ - NEXT_PC(pcdev)->ns = ns; - - ns->rtc.status = 0x90; - - /* Load RTC RAM - TODO: provide possibility to load contents from file */ - memcpy(ns->rtc.ram, rtc_ram2, 32); /* 64MB RAM starting at 0x04000000 */ memory_region_add_subregion(sysmem, 0x04000000, machine->ram);