From patchwork Tue Jan 19 08:36:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12029509 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 49796C433DB for ; Tue, 19 Jan 2021 08:38:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 9851023131 for ; Tue, 19 Jan 2021 08:38:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9851023131 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tuxfamily.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58248 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1mWs-0001XP-K0 for qemu-devel@archiver.kernel.org; Tue, 19 Jan 2021 03:38:22 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34318) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1mVV-0008HS-EW for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:36:57 -0500 Received: from mail-wm1-f49.google.com ([209.85.128.49]:35043) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1mVT-0003Rc-P6 for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:36:57 -0500 Received: by mail-wm1-f49.google.com with SMTP id e15so9498886wme.0 for ; Tue, 19 Jan 2021 00:36:55 -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=UTQI37oR54GYDHZtQ+wpT20H2kBawm8mU+1wQ7QZ7Qw=; b=lZFvVuILz0BBVmtQzLvMTcVwFE5pdl38i5wsU3shbgujTEbT09JViXbSteUDq7Ugbx 9IY6TQIkZkfKSE8Htfii1uINMyyoSlbN07kUSyLa9+sd/vfRUoPZF0qXo/c8OBd+Nlnb sjbBTJwPGBt7k+f0F5j59GGTK22Wj3DuMLCeQlwWgFOfldyukE1s2UZAR8LdSamc8L1R kX3Ikfp2w8JpbL+6dOGVIu3nrgucF0rbVyaTPfIy6aLiBzeeArpgXyK/Rz7PeJiVIyjP cRCtxSY2BgiJ+wDBXbvUoLu+cWtqhpHdJt16LKb/SD77jJI4vy3/WPGdk0fXJqMU0Klg YmCQ== X-Gm-Message-State: AOAM5307UU9O2I2TV+PbVWLqYBhHsFTpbYe0YkqGu+UlZf5cF8MvFqya rEx2oG7RqMm3bM7Pw5esdeti0BpcHwg= X-Google-Smtp-Source: ABdhPJx8vxCbcDqvpT4C02AYwfS5E+q20jsSzbfxnBTMB5CXNIMsEEqWbfdWzxAOv4SbQ8YndLCOlA== X-Received: by 2002:a7b:c08f:: with SMTP id r15mr3027594wmh.22.1611045413789; Tue, 19 Jan 2021 00:36:53 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 00:36:53 -0800 (PST) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 01/11] hw/m68k/next-cube: Make next_irq() function static Date: Tue, 19 Jan 2021 09:36:07 +0100 Message-Id: <20210119083617.6337-2-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.49; envelope-from=th.huth@gmail.com; helo=mail-wm1-f49.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell The next_irq() function is global, but isn't actually used anywhere outside next-cube.c. Make it static. Signed-off-by: Peter Maydell Message-Id: <20210115201206.17347-2-peter.maydell@linaro.org> Signed-off-by: Thomas Huth --- hw/m68k/next-cube.c | 2 +- include/hw/m68k/next-cube.h | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 37bc35dfa4..f622d6589c 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -724,7 +724,7 @@ static const MemoryRegionOps dma_ops = { * TODO: set the shift numbers as values in the enum, so the first switch * will not be needed */ -void next_irq(void *opaque, int number, int level) +static void next_irq(void *opaque, int number, int level) { M68kCPU *cpu = opaque; int shift = 0; diff --git a/include/hw/m68k/next-cube.h b/include/hw/m68k/next-cube.h index a3be2b32ab..5a56c354b8 100644 --- a/include/hw/m68k/next-cube.h +++ b/include/hw/m68k/next-cube.h @@ -42,6 +42,4 @@ enum next_irqs { NEXT_SND_I }; -void next_irq(void *opaque, int number, int level); - #endif /* NEXT_CUBE_H */ From patchwork Tue Jan 19 08:36:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12029513 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B3532C433E9 for ; Tue, 19 Jan 2021 08:38:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3175923131 for ; Tue, 19 Jan 2021 08:38:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3175923131 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tuxfamily.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1mWu-0001ZM-6u for qemu-devel@archiver.kernel.org; Tue, 19 Jan 2021 03:38:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34358) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1mVW-0008Hn-Pu for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:36:58 -0500 Received: from mail-wm1-f44.google.com ([209.85.128.44]:35039) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1mVT-0003Rf-RN for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:36:58 -0500 Received: by mail-wm1-f44.google.com with SMTP id e15so9498902wme.0 for ; Tue, 19 Jan 2021 00:36:55 -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=mdT/NKhm7BBrmMcwwEVr39Cma+q1XER1MJBfOZkvxpI=; b=FjnNrTFkxzXyKIouh+cjQHOw5JAgKkCOQhFnXnx9hh2Dyerfs5yO7lIr6gR6xiwBy2 kpoiSYxg4vm/Q9SfmbeFnQI2RWQ7nmo85F3gE8mn32qF60jOMEGW9r4NF0cEyQBkli85 ky/ePMsic8YaI7Udy/VWHS1xpipGq12x+EtAHFiaYugEuZr8x7Q3OVbnQhpgfanYcRnP pVxwuP4WQCDPx1qpRYkeBy4W+kiOdNFyK0B6Otns4toJdBS8cJKTKJGp2rx1Kl8AcVKn ktF7Oa7KP06oau99fRDvUxphIKk+fTV2rCZ17MQafrNpRQ8EKGi3RBVj+iLgM2ZoVARs RDWg== X-Gm-Message-State: AOAM530ScvBwPHSXZ8dqCTO1qCiGv1glNZGvOmC++rIxtHdVEqaB7/ji oyn+NvjIAyWO7cinUH/f8SwfOVUGF6w= X-Google-Smtp-Source: ABdhPJzjL221h+S83MRnf/c+FP9K5pdvS9nw/nBJCAMvJ6UXAz2XFx9udtUUZQox8V2npt9kBwziNA== X-Received: by 2002:a05:600c:20c:: with SMTP id 12mr2933323wmi.125.1611045414386; Tue, 19 Jan 2021 00:36:54 -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.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 00:36:54 -0800 (PST) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 02/11] hw/m68k/next-cube: Move register/interrupt functionality into a device Date: Tue, 19 Jan 2021 09:36:08 +0100 Message-Id: <20210119083617.6337-3-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.44; envelope-from=th.huth@gmail.com; helo=mail-wm1-f44.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Currently the next-cube board code open-codes a lot of handling of interrupts and some miscellaneous registers. Move this into a proper QOM device. In the real hardware this functionality seems to be the responsibility of the Peripheral Controller (PC) chip, so name the device that. There are several different things that will need to be moved into this device: * the mmio_iops register set * the scr_ops register set * the next_irq IRQ handling To ease review, we structure the change as a sequence of commits: in this first commit we create the skeleton of the NeXTPC device with no content, but with a backdoor pointer to the NeXTState machine's state struct so we can move parts of the code and still have refactored and non-refactored code using the same struct data fields. Further commits will move functionality into the new device piece by piece. At the end we will be able to remove the backdoor pointer because all the data fields will be in the NeXTPC struct and not the NeXTState struct. We'll add the VMState for the new device at the end of all that; this is in theory a migration compatibility break but this machine does not currently support migration at all anyway. Signed-off-by: Peter Maydell Message-Id: <20210115201206.17347-3-peter.maydell@linaro.org> [huth: Add a comment in front of struct NeXTPC] Signed-off-by: Thomas Huth --- hw/m68k/next-cube.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index f622d6589c..262ff4ead0 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -90,6 +90,17 @@ struct NeXTState { NextRtc rtc; }; +#define TYPE_NEXT_PC "next-pc" +OBJECT_DECLARE_SIMPLE_TYPE(NeXTPC, NEXT_PC) + +/* NeXT Peripheral Controller */ +struct NeXTPC { + SysBusDevice parent_obj; + + /* Temporary until all functionality has been moved into this device */ + NeXTState *ns; +}; + /* Thanks to NeXT forums for this */ /* static const uint8_t rtc_ram3[32] = { @@ -857,6 +868,31 @@ static void next_escc_init(M68kCPU *cpu) sysbus_mmio_map(s, 0, 0x2118000); } +static void next_pc_reset(DeviceState *dev) +{ +} + +static void next_pc_realize(DeviceState *dev, Error **errp) +{ +} + +static void next_pc_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + dc->desc = "NeXT Peripheral Controller"; + dc->realize = next_pc_realize; + dc->reset = next_pc_reset; + /* We will add the VMState in a later commit */ +} + +static const TypeInfo next_pc_info = { + .name = TYPE_NEXT_PC, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(NeXTPC), + .class_init = next_pc_class_init, +}; + static void next_cube_init(MachineState *machine) { M68kCPU *cpu; @@ -871,6 +907,7 @@ static void next_cube_init(MachineState *machine) const char *bios_name = machine->firmware ?: ROM_FILE; NeXTState *ns = NEXT_MACHINE(machine); DeviceState *dev; + DeviceState *pcdev; /* Initialize the cpu core */ cpu = M68K_CPU(cpu_create(machine->cpu_type)); @@ -884,6 +921,12 @@ static void next_cube_init(MachineState *machine) env->vbr = 0; env->sr = 0x2700; + /* Peripheral Controller */ + pcdev = qdev_new(TYPE_NEXT_PC); + sysbus_realize_and_unref(SYS_BUS_DEVICE(pcdev), &error_fatal); + /* Temporary while we refactor this code */ + NEXT_PC(pcdev)->ns = ns; + /* Set internal registers to initial values */ /* 0x0000XX00 << vital bits */ ns->scr1 = 0x00011102; @@ -978,6 +1021,7 @@ static const TypeInfo next_typeinfo = { static void next_register_type(void) { type_register_static(&next_typeinfo); + type_register_static(&next_pc_info); } type_init(next_register_type) From patchwork Tue Jan 19 08:36:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12029551 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EA14C433DB for ; Tue, 19 Jan 2021 08:41:11 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A6B2423121 for ; Tue, 19 Jan 2021 08:41:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A6B2423121 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tuxfamily.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38786 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1mZX-00058o-NQ for qemu-devel@archiver.kernel.org; Tue, 19 Jan 2021 03:41:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1mVX-0008I5-7S for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:36:59 -0500 Received: from mail-wm1-f42.google.com ([209.85.128.42]:39459) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1mVU-0003S0-D2 for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:36:58 -0500 Received: by mail-wm1-f42.google.com with SMTP id u14so11698884wmq.4 for ; Tue, 19 Jan 2021 00:36:56 -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=JZjaybeQucdS72xYzX/rOD4vrUc5IR1ekV46Zvg1Aco=; b=pq+mBNe/nQvyIVw4vraXnZs+CQODzWtF09HokWwXD0vbkgETbgt1lJ0sMkdHTHY+MD s00cUHD1aLPCVmuplEY2bWxZtLe5K65+ky9Uxrt94A/lsj1O7yogdmV4RvQpZdydeGUT ZF9WGUe4aiZvCbS4GxNGS5vZjsqV1NJKOlAVAlB3qYit/TjPszfPjgTlH5ZoDaVmPLOC h3m3aVAFrJqWMOP39qYR8nBU4np7+LAXLXi0v2kjp2jLuQS4b1jyJES5n7MDYucP4Vci QAe2tnhGEvdOL9khhJWgVtHyF3HXucbsltIh6QWGw0MsXxhN6WabEpvCVISJMf1ceRNZ Zm9g== X-Gm-Message-State: AOAM532ToYIx0TshkfkqBxi+NkqVsCxU9FG664QkQ00aZVVdM5Eda8yo QO8wsaqGGrHXQrZR0dTx3DOykJC94Gc= X-Google-Smtp-Source: ABdhPJyqKQB8eIDrq1rf9pvt3bq0oUFhItUdgTBMw/3OGCAUIz+ZZvlBqFb619aZXbE2kIyrskufKQ== X-Received: by 2002:a1c:7d8e:: with SMTP id y136mr3031403wmc.94.1611045414973; Tue, 19 Jan 2021 00:36:54 -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.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 00:36:54 -0800 (PST) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 03/11] hw/m68k/next-cube: Move mmio_ops into NeXTPC device Date: Tue, 19 Jan 2021 09:36:09 +0100 Message-Id: <20210119083617.6337-4-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.42; envelope-from=th.huth@gmail.com; helo=mail-wm1-f42.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Move the registers handled by the mmio_ops struct into the NeXTPC device. This allows us to also move the scr1 and scr2 data fields. Signed-off-by: Peter Maydell Message-Id: <20210115201206.17347-4-peter.maydell@linaro.org> Signed-off-by: Thomas Huth --- hw/m68k/next-cube.c | 80 +++++++++++++++++++++++++-------------------- 1 file changed, 44 insertions(+), 36 deletions(-) diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 262ff4ead0..17a020e2a0 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -84,9 +84,6 @@ struct NeXTState { qemu_irq scsi_reset; qemu_irq *fd_irq; - uint32_t scr1; - uint32_t scr2; - NextRtc rtc; }; @@ -99,6 +96,11 @@ struct NeXTPC { /* Temporary until all functionality has been moved into this device */ NeXTState *ns; + + MemoryRegion mmiomem; + + uint32_t scr1; + uint32_t scr2; }; /* Thanks to NeXT forums for this */ @@ -121,13 +123,13 @@ static const uint8_t rtc_ram2[32] = { #define SCR2_RTDATA 0x4 #define SCR2_TOBCD(x) (((x / 10) << 4) + (x % 10)) -static void nextscr2_write(NeXTState *s, uint32_t val, int size) +static void nextscr2_write(NeXTPC *s, uint32_t val, int size) { static int led; static int phase; static uint8_t old_scr2; uint8_t scr2_2; - NextRtc *rtc = &s->rtc; + NextRtc *rtc = &s->ns->rtc; if (size == 4) { scr2_2 = (val >> 8) & 0xFF; @@ -239,7 +241,7 @@ static void nextscr2_write(NeXTState *s, uint32_t val, int size) /* clear FTU */ if (rtc->value & 0x04) { rtc->status = rtc->status & (~0x18); - s->int_status = s->int_status & (~0x04); + s->ns->int_status = s->ns->int_status & (~0x04); } } } @@ -255,7 +257,7 @@ static void nextscr2_write(NeXTState *s, uint32_t val, int size) old_scr2 = scr2_2; } -static uint32_t mmio_readb(NeXTState *s, hwaddr addr) +static uint32_t mmio_readb(NeXTPC *s, hwaddr addr) { switch (addr) { case 0xc000: @@ -285,7 +287,7 @@ static uint32_t mmio_readb(NeXTState *s, hwaddr addr) } } -static uint32_t mmio_readw(NeXTState *s, hwaddr addr) +static uint32_t mmio_readw(NeXTPC *s, hwaddr addr) { switch (addr) { default: @@ -294,16 +296,16 @@ static uint32_t mmio_readw(NeXTState *s, hwaddr addr) } } -static uint32_t mmio_readl(NeXTState *s, hwaddr addr) +static uint32_t mmio_readl(NeXTPC *s, hwaddr addr) { switch (addr) { case 0x7000: - /* DPRINTF("Read INT status: %x\n", s->int_status); */ - return s->int_status; + /* DPRINTF("Read INT status: %x\n", s->ns->int_status); */ + return s->ns->int_status; case 0x7800: - DPRINTF("MMIO Read INT mask: %x\n", s->int_mask); - return s->int_mask; + DPRINTF("MMIO Read INT mask: %x\n", s->ns->int_mask); + return s->ns->int_mask; case 0xc000: return s->scr1; @@ -317,7 +319,7 @@ static uint32_t mmio_readl(NeXTState *s, hwaddr addr) } } -static void mmio_writeb(NeXTState *s, hwaddr addr, uint32_t val) +static void mmio_writeb(NeXTPC *s, hwaddr addr, uint32_t val) { switch (addr) { case 0xd003: @@ -329,21 +331,21 @@ static void mmio_writeb(NeXTState *s, hwaddr addr, uint32_t val) } -static void mmio_writew(NeXTState *s, hwaddr addr, uint32_t val) +static void mmio_writew(NeXTPC *s, hwaddr addr, uint32_t val) { DPRINTF("MMIO Write W\n"); } -static void mmio_writel(NeXTState *s, hwaddr addr, uint32_t val) +static void mmio_writel(NeXTPC *s, hwaddr addr, uint32_t val) { switch (addr) { case 0x7000: - DPRINTF("INT Status old: %x new: %x\n", s->int_status, val); - s->int_status = val; + DPRINTF("INT Status old: %x new: %x\n", s->ns->int_status, val); + s->ns->int_status = val; break; case 0x7800: - DPRINTF("INT Mask old: %x new: %x\n", s->int_mask, val); - s->int_mask = val; + DPRINTF("INT Mask old: %x new: %x\n", s->ns->int_mask, val); + s->ns->int_mask = val; break; case 0xc000: DPRINTF("SCR1 Write: %x\n", val); @@ -359,15 +361,15 @@ static void mmio_writel(NeXTState *s, hwaddr addr, uint32_t val) static uint64_t mmio_readfn(void *opaque, hwaddr addr, unsigned size) { - NeXTState *ns = NEXT_MACHINE(opaque); + NeXTPC *s = NEXT_PC(opaque); switch (size) { case 1: - return mmio_readb(ns, addr); + return mmio_readb(s, addr); case 2: - return mmio_readw(ns, addr); + return mmio_readw(s, addr); case 4: - return mmio_readl(ns, addr); + return mmio_readl(s, addr); default: g_assert_not_reached(); } @@ -376,17 +378,17 @@ static uint64_t mmio_readfn(void *opaque, hwaddr addr, unsigned size) static void mmio_writefn(void *opaque, hwaddr addr, uint64_t value, unsigned size) { - NeXTState *ns = NEXT_MACHINE(opaque); + NeXTPC *s = NEXT_PC(opaque); switch (size) { case 1: - mmio_writeb(ns, addr, value); + mmio_writeb(s, addr, value); break; case 2: - mmio_writew(ns, addr, value); + mmio_writew(s, addr, value); break; case 4: - mmio_writel(ns, addr, value); + mmio_writel(s, addr, value); break; default: g_assert_not_reached(); @@ -870,10 +872,23 @@ static void next_escc_init(M68kCPU *cpu) static void next_pc_reset(DeviceState *dev) { + NeXTPC *s = NEXT_PC(dev); + + /* Set internal registers to initial values */ + /* 0x0000XX00 << vital bits */ + s->scr1 = 0x00011102; + s->scr2 = 0x00ff0c80; } static void next_pc_realize(DeviceState *dev, Error **errp) { + NeXTPC *s = NEXT_PC(dev); + SysBusDevice *sbd = SYS_BUS_DEVICE(dev); + + memory_region_init_io(&s->mmiomem, OBJECT(s), &mmio_ops, s, + "next.mmio", 0xD0000); + + sysbus_init_mmio(sbd, &s->mmiomem); } static void next_pc_class_init(ObjectClass *klass, void *data) @@ -898,7 +913,6 @@ static void next_cube_init(MachineState *machine) M68kCPU *cpu; CPUM68KState *env; MemoryRegion *rom = g_new(MemoryRegion, 1); - MemoryRegion *mmiomem = g_new(MemoryRegion, 1); MemoryRegion *scrmem = g_new(MemoryRegion, 1); MemoryRegion *dmamem = g_new(MemoryRegion, 1); MemoryRegion *bmapm1 = g_new(MemoryRegion, 1); @@ -927,10 +941,6 @@ static void next_cube_init(MachineState *machine) /* Temporary while we refactor this code */ NEXT_PC(pcdev)->ns = ns; - /* Set internal registers to initial values */ - /* 0x0000XX00 << vital bits */ - ns->scr1 = 0x00011102; - ns->scr2 = 0x00ff0c80; ns->rtc.status = 0x90; /* Load RTC RAM - TODO: provide possibility to load contents from file */ @@ -945,9 +955,7 @@ static void next_cube_init(MachineState *machine) sysbus_mmio_map(SYS_BUS_DEVICE(dev), 0, 0x0B000000); /* MMIO */ - memory_region_init_io(mmiomem, NULL, &mmio_ops, machine, "next.mmio", - 0xD0000); - memory_region_add_subregion(sysmem, 0x02000000, mmiomem); + sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 0, 0x02000000); /* BMAP memory */ memory_region_init_ram_shared_nomigrate(bmapm1, NULL, "next.bmapmem", 64, From patchwork Tue Jan 19 08:36:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12029515 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C19A7C43381 for ; Tue, 19 Jan 2021 08:38:25 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2DCC422241 for ; Tue, 19 Jan 2021 08:38:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2DCC422241 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tuxfamily.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:58356 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1mWt-0001Zx-Vt for qemu-devel@archiver.kernel.org; Tue, 19 Jan 2021 03:38:24 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1mVX-0008I1-4f for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:36:59 -0500 Received: from mail-wm1-f53.google.com ([209.85.128.53]:36049) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1mVV-0003SX-20 for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:36:58 -0500 Received: by mail-wm1-f53.google.com with SMTP id v184so11678577wma.1 for ; Tue, 19 Jan 2021 00:36:56 -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=bcRnfVy7lP2i4f76m7mIxUR7K5WFGMUIp6qMDA3g1pw=; b=PhtWh7GkLcOSv96hZj4jqSZKMkbWwXEySiquja2ahL1ZWTpmZ2aFhkqSdQTGMls9jr IxNM5ahRBEQvLx0Br1gIHOBK+Xz8243DvcCRrwgP0v07Uj2lLmoLdl7x0EFmbXG4d3sy mAgNO+DGUgTRKJnmSTNGP7CG58Wiw31e4rmEvo3+mxE9EBrhY2pmBB1nawPHWXsYPWWR GSN2HHQ4ZYRy3E8QId6lWO2EaKNAOSMKVslx2qpmWzxyMVK4ltw4HcR06AjFiC3pHY5K PoRm8CF/ptROGYAHdJW+tT3bMe8LpWkhOUbpGgn1dfRd+A5XDmuxHnmfxRMT7oiapJS6 ejcA== X-Gm-Message-State: AOAM530uS3IqU16MlFdFpbkSoU4rMC7u2Xk4WyMCm73z9nXBla2s4p+2 yhVH8CWDnkWHIRd5epz73IJFIF1o0wQ= X-Google-Smtp-Source: ABdhPJyhchbbX92dReUA2X6aIv4o+Q8xaZhP0jnSwMNHqYohGt/+i5qRqP/nLTxINmGpQ47A9qEcqg== X-Received: by 2002:a1c:b7d6:: with SMTP id h205mr2973882wmf.182.1611045415522; Tue, 19 Jan 2021 00:36:55 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 00:36:55 -0800 (PST) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 04/11] hw/m68k/next-cube: Move scr_ops into NeXTPC device Date: Tue, 19 Jan 2021 09:36:10 +0100 Message-Id: <20210119083617.6337-5-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.53; envelope-from=th.huth@gmail.com; helo=mail-wm1-f53.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Move the registers handled by the scr_ops struct into the NeXTPC device. Signed-off-by: Peter Maydell Message-Id: <20210115201206.17347-5-peter.maydell@linaro.org> Signed-off-by: Thomas Huth --- hw/m68k/next-cube.c | 50 ++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 17a020e2a0..7d44bcf783 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -76,8 +76,6 @@ struct NeXTState { uint32_t int_mask; uint32_t int_status; - uint8_t scsi_csr_1; - uint8_t scsi_csr_2; next_dma dma[10]; qemu_irq *scsi_irq; qemu_irq scsi_dma; @@ -98,9 +96,12 @@ struct NeXTPC { NeXTState *ns; MemoryRegion mmiomem; + MemoryRegion scrmem; uint32_t scr1; uint32_t scr2; + uint8_t scsi_csr_1; + uint8_t scsi_csr_2; }; /* Thanks to NeXT forums for this */ @@ -403,7 +404,7 @@ static const MemoryRegionOps mmio_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -static uint32_t scr_readb(NeXTState *s, hwaddr addr) +static uint32_t scr_readb(NeXTPC *s, hwaddr addr) { switch (addr) { case 0x14108: @@ -437,13 +438,13 @@ static uint32_t scr_readb(NeXTState *s, hwaddr addr) } } -static uint32_t scr_readw(NeXTState *s, hwaddr addr) +static uint32_t scr_readw(NeXTPC *s, hwaddr addr) { DPRINTF("BMAP Read W @ %x\n", (unsigned int)addr); return 0; } -static uint32_t scr_readl(NeXTState *s, hwaddr addr) +static uint32_t scr_readl(NeXTPC *s, hwaddr addr) { DPRINTF("BMAP Read L @ %x\n", (unsigned int)addr); return 0; @@ -456,7 +457,7 @@ static uint32_t scr_readl(NeXTState *s, hwaddr addr) #define SCSICSR_CPUDMA 0x10 /* if set, dma enabled */ #define SCSICSR_INTMASK 0x20 /* if set, interrupt enabled */ -static void scr_writeb(NeXTState *s, hwaddr addr, uint32_t value) +static void scr_writeb(NeXTPC *s, hwaddr addr, uint32_t value) { switch (addr) { case 0x14108: @@ -502,9 +503,9 @@ static void scr_writeb(NeXTState *s, hwaddr addr, uint32_t value) DPRINTF("SCSICSR CPUDMA\n"); /* qemu_irq_raise(s->scsi_dma); */ - s->int_status |= 0x4000000; + s->ns->int_status |= 0x4000000; } else { - s->int_status &= ~(0x4000000); + s->ns->int_status &= ~(0x4000000); } if (value & SCSICSR_INTMASK) { DPRINTF("SCSICSR INTMASK\n"); @@ -534,27 +535,27 @@ static void scr_writeb(NeXTState *s, hwaddr addr, uint32_t value) } } -static void scr_writew(NeXTState *s, hwaddr addr, uint32_t value) +static void scr_writew(NeXTPC *s, hwaddr addr, uint32_t value) { DPRINTF("BMAP Write W @ %x with %x\n", (unsigned int)addr, value); } -static void scr_writel(NeXTState *s, hwaddr addr, uint32_t value) +static void scr_writel(NeXTPC *s, hwaddr addr, uint32_t value) { DPRINTF("BMAP Write L @ %x with %x\n", (unsigned int)addr, value); } static uint64_t scr_readfn(void *opaque, hwaddr addr, unsigned size) { - NeXTState *ns = NEXT_MACHINE(opaque); + NeXTPC *s = NEXT_PC(opaque); switch (size) { case 1: - return scr_readb(ns, addr); + return scr_readb(s, addr); case 2: - return scr_readw(ns, addr); + return scr_readw(s, addr); case 4: - return scr_readl(ns, addr); + return scr_readl(s, addr); default: g_assert_not_reached(); } @@ -563,17 +564,17 @@ static uint64_t scr_readfn(void *opaque, hwaddr addr, unsigned size) static void scr_writefn(void *opaque, hwaddr addr, uint64_t value, unsigned size) { - NeXTState *ns = NEXT_MACHINE(opaque); + NeXTPC *s = NEXT_PC(opaque); switch (size) { case 1: - scr_writeb(ns, addr, value); + scr_writeb(s, addr, value); break; case 2: - scr_writew(ns, addr, value); + scr_writew(s, addr, value); break; case 4: - scr_writel(ns, addr, value); + scr_writel(s, addr, value); break; default: g_assert_not_reached(); @@ -887,8 +888,10 @@ static void next_pc_realize(DeviceState *dev, Error **errp) memory_region_init_io(&s->mmiomem, OBJECT(s), &mmio_ops, s, "next.mmio", 0xD0000); - + memory_region_init_io(&s->scrmem, OBJECT(s), &scr_ops, s, + "next.scr", 0x20000); sysbus_init_mmio(sbd, &s->mmiomem); + sysbus_init_mmio(sbd, &s->scrmem); } static void next_pc_class_init(ObjectClass *klass, void *data) @@ -913,7 +916,6 @@ static void next_cube_init(MachineState *machine) M68kCPU *cpu; CPUM68KState *env; MemoryRegion *rom = g_new(MemoryRegion, 1); - MemoryRegion *scrmem = g_new(MemoryRegion, 1); MemoryRegion *dmamem = g_new(MemoryRegion, 1); MemoryRegion *bmapm1 = g_new(MemoryRegion, 1); MemoryRegion *bmapm2 = g_new(MemoryRegion, 1); @@ -957,6 +959,9 @@ static void next_cube_init(MachineState *machine) /* MMIO */ sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 0, 0x02000000); + /* BMAP IO - acts as a catch-all for now */ + sysbus_mmio_map(SYS_BUS_DEVICE(pcdev), 1, 0x02100000); + /* BMAP memory */ memory_region_init_ram_shared_nomigrate(bmapm1, NULL, "next.bmapmem", 64, true, &error_fatal); @@ -965,11 +970,6 @@ static void next_cube_init(MachineState *machine) memory_region_init_alias(bmapm2, NULL, "next.bmapmem2", bmapm1, 0x0, 64); memory_region_add_subregion(sysmem, 0x820c0000, bmapm2); - /* BMAP IO - acts as a catch-all for now */ - memory_region_init_io(scrmem, NULL, &scr_ops, machine, "next.scr", - 0x20000); - memory_region_add_subregion(sysmem, 0x02100000, scrmem); - /* KBD */ dev = qdev_new(TYPE_NEXTKBD); sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal); From patchwork Tue Jan 19 08:36:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12029519 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9D4FC433DB for ; Tue, 19 Jan 2021 08:40:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 359D523121 for ; Tue, 19 Jan 2021 08:40:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 359D523121 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tuxfamily.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38536 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1mZL-00051O-7M for qemu-devel@archiver.kernel.org; Tue, 19 Jan 2021 03:40:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34384) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1mVX-0008IO-EC for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:36:59 -0500 Received: from mail-wr1-f50.google.com ([209.85.221.50]:42104) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1mVV-0003T6-QL for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:36:59 -0500 Received: by mail-wr1-f50.google.com with SMTP id m4so18815512wrx.9 for ; Tue, 19 Jan 2021 00:36:57 -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=xTkFz7/GSvc/noBB/aNkyxHiQFLLyYH2++7ga90kzbA=; b=N7kiPbmMJDYZCFgv7HqPMf+BV3eIZV0K4hRZ9h/tvVNSZPHxaipJVa9uBr8WD/K347 HStYVyi/KIcx8qxRl4Hbh3LaFuVMLAEYnK+R2p9FawEeyLsLEVSeYI/Ydj1ah4NSadqc EpcRxDHzpgu4wUWfPunX0VJ4jAjVaWrfHjg/k6CIPYOkuNrXS+AsUIwyCFVGV/MaIuR2 V3nKT6smauvB7jQJJWeH3yqTfFS9O1PDk7zzOJdX27EvGOvGmLvM49lgQA7zi3fr3vaM Uy7LitWDArAfq4hOG79zFLazYfs4GBluTRov1B+HaErAMAZMqwEx9F51mVSDflXSEwfx EiCg== X-Gm-Message-State: AOAM532fyR8lsAVN4mqgiw5rdUSrQ+mPCdGGL3vk2bvwWlfGooUWg41a WRyy/QSRmKo3L74vhFfKkdLMWpWwbRw= X-Google-Smtp-Source: ABdhPJwUB/XoJey95xEC30BujZFGYhwWH/WmdBTZIZoshdePEMOKDxF6maqsbanFXh3IQ2vTNMH0Pg== X-Received: by 2002:adf:8290:: with SMTP id 16mr3104352wrc.27.1611045416189; Tue, 19 Jan 2021 00:36:56 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 00:36:55 -0800 (PST) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 05/11] hw/m68k/next-cube: Make next_irq take NeXTPC* as its opaque Date: Tue, 19 Jan 2021 09:36:11 +0100 Message-Id: <20210119083617.6337-6-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.221.50; envelope-from=th.huth@gmail.com; helo=mail-wr1-f50.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Make the next_irq function take a NeXTPC* as its opaque rather than the M68kCPU*. This will make it simpler to turn the next_irq function into a gpio input line of the NeXTPC device in the next commit. For this to work we have to pass the CPU to the NeXTPC device via a link property, in the same way we do in q800.c (and for the same reason). Signed-off-by: Peter Maydell Message-Id: <20210115201206.17347-6-peter.maydell@linaro.org> Signed-off-by: Thomas Huth --- hw/m68k/next-cube.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 7d44bcf783..83e219a79a 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -95,6 +95,8 @@ struct NeXTPC { /* Temporary until all functionality has been moved into this device */ NeXTState *ns; + M68kCPU *cpu; + MemoryRegion mmiomem; MemoryRegion scrmem; @@ -740,9 +742,9 @@ static const MemoryRegionOps dma_ops = { */ static void next_irq(void *opaque, int number, int level) { - M68kCPU *cpu = opaque; + NeXTPC *s = NEXT_PC(opaque); + M68kCPU *cpu = s->cpu; int shift = 0; - NeXTState *ns = NEXT_MACHINE(qdev_get_machine()); /* first switch sets interupt status */ /* DPRINTF("IRQ %i\n",number); */ @@ -797,14 +799,14 @@ static void next_irq(void *opaque, int number, int level) * this HAS to be wrong, the interrupt handlers in mach and together * int_status and int_mask and return if there is a hit */ - if (ns->int_mask & (1 << shift)) { + if (s->ns->int_mask & (1 << shift)) { DPRINTF("%x interrupt masked @ %x\n", 1 << shift, cpu->env.pc); /* return; */ } /* second switch triggers the correct interrupt */ if (level) { - ns->int_status |= 1 << shift; + s->ns->int_status |= 1 << shift; switch (number) { /* level 3 - floppy, kbd/mouse, power, ether rx/tx, scsi, clock */ @@ -833,7 +835,7 @@ static void next_irq(void *opaque, int number, int level) break; } } else { - ns->int_status &= ~(1 << shift); + s->ns->int_status &= ~(1 << shift); cpu_reset_interrupt(CPU(cpu), CPU_INTERRUPT_HARD); } } @@ -848,9 +850,9 @@ static void next_serial_irq(void *opaque, int n, int level) } } -static void next_escc_init(M68kCPU *cpu) +static void next_escc_init(DeviceState *pcdev) { - qemu_irq *ser_irq = qemu_allocate_irqs(next_serial_irq, cpu, 2); + qemu_irq *ser_irq = qemu_allocate_irqs(next_serial_irq, pcdev, 2); DeviceState *dev; SysBusDevice *s; @@ -894,6 +896,17 @@ static void next_pc_realize(DeviceState *dev, Error **errp) sysbus_init_mmio(sbd, &s->scrmem); } +/* + * 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 next_pc_properties[] = { + DEFINE_PROP_LINK("cpu", NeXTPC, cpu, TYPE_M68K_CPU, M68kCPU *), + DEFINE_PROP_END_OF_LIST(), +}; + static void next_pc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -901,6 +914,7 @@ static void next_pc_class_init(ObjectClass *klass, void *data) dc->desc = "NeXT Peripheral Controller"; dc->realize = next_pc_realize; dc->reset = next_pc_reset; + device_class_set_props(dc, next_pc_properties); /* We will add the VMState in a later commit */ } @@ -939,6 +953,7 @@ static void next_cube_init(MachineState *machine) /* Peripheral Controller */ 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; @@ -997,7 +1012,7 @@ static void next_cube_init(MachineState *machine) } /* Serial */ - next_escc_init(cpu); + next_escc_init(pcdev); /* TODO: */ /* Network */ From patchwork Tue Jan 19 08:36:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12029517 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C27B6C433E0 for ; Tue, 19 Jan 2021 08:40:53 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 220E123121 for ; Tue, 19 Jan 2021 08:40:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 220E123121 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tuxfamily.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1mZI-000506-0i for qemu-devel@archiver.kernel.org; Tue, 19 Jan 2021 03:40:52 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34392) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1mVX-0008Ic-UB for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:37:00 -0500 Received: from mail-wr1-f49.google.com ([209.85.221.49]:41978) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1mVW-0003Tu-7G for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:36:59 -0500 Received: by mail-wr1-f49.google.com with SMTP id a12so18806649wrv.8 for ; Tue, 19 Jan 2021 00:36:57 -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=f2G0ytv9WcsWXoZLiyBGCtsUjm9fyhsF0T8dbHJkcok=; b=RXRGJngghecGOsYqlaQyd3314WdD5lrio2zuGeAmikrZCTiBb6d7wHaWg84A92J0TM njihVaOd+ZFAk42SkD+P/eH8pcF4alltY/hPlVZsTdfebeCe6wJSV4U38onYJ1g4Z3JJ uk6t1PB8uY3qKcJbVaAsNX1LoW7UCZrzGKaXozhEdPW8CFPp+fVBOOkhM1fgmgVrFoDJ FzaofttYY2QVjmZXJtcXvdh7xzRqHMM56pTG+pIbTeq8Ja+hl3hq7OjtD224l/7kpYuI cpi4VrdYhcQqDDMkUOcHeoFrwSYqxasoX+nURCYINuTnZISwiC/3mVR/4OFnMEneAoX+ eiSA== X-Gm-Message-State: AOAM533uak0+2P/L9013S64HwteguLusw5pT+t45XKj7WcPjixj5ygG9 MnZW/sbzXDh61N4yuobctCJHgrGpvhw= X-Google-Smtp-Source: ABdhPJxGKMAu/tFHAjV9xqcJefdUM9EuAEd4MnirLha9HSVzYmcSFi0ha9RgBIPxD4hCbbJ4y76BoQ== X-Received: by 2002:a5d:5181:: with SMTP id k1mr3092583wrv.226.1611045416745; Tue, 19 Jan 2021 00:36:56 -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.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 00:36:56 -0800 (PST) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 06/11] hw/m68k/next-cube: Move int_status and int_mask to NeXTPC struct Date: Tue, 19 Jan 2021 09:36:12 +0100 Message-Id: <20210119083617.6337-7-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.221.49; envelope-from=th.huth@gmail.com; helo=mail-wr1-f49.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell All the code which accesses int_status and int_mask is now doing so via the NeXTPC->NeXTState indirection, so we can move these fields into the NeXTPC struct where they belong. Signed-off-by: Peter Maydell Message-Id: <20210115201206.17347-7-peter.maydell@linaro.org> Signed-off-by: Thomas Huth --- hw/m68k/next-cube.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 83e219a79a..9b9b051231 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -73,9 +73,6 @@ typedef struct NextRtc { struct NeXTState { MachineState parent; - uint32_t int_mask; - uint32_t int_status; - next_dma dma[10]; qemu_irq *scsi_irq; qemu_irq scsi_dma; @@ -104,6 +101,8 @@ struct NeXTPC { uint32_t scr2; uint8_t scsi_csr_1; uint8_t scsi_csr_2; + uint32_t int_mask; + uint32_t int_status; }; /* Thanks to NeXT forums for this */ @@ -244,7 +243,7 @@ static void nextscr2_write(NeXTPC *s, uint32_t val, int size) /* clear FTU */ if (rtc->value & 0x04) { rtc->status = rtc->status & (~0x18); - s->ns->int_status = s->ns->int_status & (~0x04); + s->int_status = s->int_status & (~0x04); } } } @@ -303,12 +302,12 @@ static uint32_t mmio_readl(NeXTPC *s, hwaddr addr) { switch (addr) { case 0x7000: - /* DPRINTF("Read INT status: %x\n", s->ns->int_status); */ - return s->ns->int_status; + /* DPRINTF("Read INT status: %x\n", s->int_status); */ + return s->int_status; case 0x7800: - DPRINTF("MMIO Read INT mask: %x\n", s->ns->int_mask); - return s->ns->int_mask; + DPRINTF("MMIO Read INT mask: %x\n", s->int_mask); + return s->int_mask; case 0xc000: return s->scr1; @@ -343,12 +342,12 @@ static void mmio_writel(NeXTPC *s, hwaddr addr, uint32_t val) { switch (addr) { case 0x7000: - DPRINTF("INT Status old: %x new: %x\n", s->ns->int_status, val); - s->ns->int_status = val; + DPRINTF("INT Status old: %x new: %x\n", s->int_status, val); + s->int_status = val; break; case 0x7800: - DPRINTF("INT Mask old: %x new: %x\n", s->ns->int_mask, val); - s->ns->int_mask = val; + DPRINTF("INT Mask old: %x new: %x\n", s->int_mask, val); + s->int_mask = val; break; case 0xc000: DPRINTF("SCR1 Write: %x\n", val); @@ -505,9 +504,9 @@ static void scr_writeb(NeXTPC *s, hwaddr addr, uint32_t value) DPRINTF("SCSICSR CPUDMA\n"); /* qemu_irq_raise(s->scsi_dma); */ - s->ns->int_status |= 0x4000000; + s->int_status |= 0x4000000; } else { - s->ns->int_status &= ~(0x4000000); + s->int_status &= ~(0x4000000); } if (value & SCSICSR_INTMASK) { DPRINTF("SCSICSR INTMASK\n"); @@ -799,14 +798,14 @@ static void next_irq(void *opaque, int number, int level) * this HAS to be wrong, the interrupt handlers in mach and together * int_status and int_mask and return if there is a hit */ - if (s->ns->int_mask & (1 << shift)) { + if (s->int_mask & (1 << shift)) { DPRINTF("%x interrupt masked @ %x\n", 1 << shift, cpu->env.pc); /* return; */ } /* second switch triggers the correct interrupt */ if (level) { - s->ns->int_status |= 1 << shift; + s->int_status |= 1 << shift; switch (number) { /* level 3 - floppy, kbd/mouse, power, ether rx/tx, scsi, clock */ @@ -835,7 +834,7 @@ static void next_irq(void *opaque, int number, int level) break; } } else { - s->ns->int_status &= ~(1 << shift); + s->int_status &= ~(1 << shift); cpu_reset_interrupt(CPU(cpu), CPU_INTERRUPT_HARD); } } From patchwork Tue Jan 19 08:36:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12029521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D2A6C433E0 for ; Tue, 19 Jan 2021 08:41:04 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2A7A423121 for ; Tue, 19 Jan 2021 08:41:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2A7A423121 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tuxfamily.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38788 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1mZT-00058q-3L for qemu-devel@archiver.kernel.org; Tue, 19 Jan 2021 03:41:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1mVY-0008Il-9e for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:37:00 -0500 Received: from mail-wm1-f44.google.com ([209.85.128.44]:56298) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1mVW-0003Uf-Nh for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:37:00 -0500 Received: by mail-wm1-f44.google.com with SMTP id c124so15681756wma.5 for ; Tue, 19 Jan 2021 00:36:58 -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=glVtI5cyV9govITmJ39bqSL+NJwToQB6R6WAWUrnoKU=; b=O/4SKCx6oISAQU5AIioQSoLyrRjhCCFUv7oycTMKq4hYxulr7NxnSOVxq/dD7+8ezG 7+XcoqF5BMj3W0FuR08Vi8gP8m/6eqZQQrI0SvDiOdn+XhA/JKZb2GHstHyvxnKNkw/m M3LqgfaTz1yePnGM1r7q6NW8JUPZ24mFwpdyOh4mSXp/hyIIy596O+eEVi4o0t+SUuj1 XZmIQ5EmiEGS/0Q+SFRov3e1eIsrHLPeMQIoMpfk+2b0E+qA/Q/+i7/5EUymx/DzrpOu xri69q1BFaTMoesaOxu71w7Yfwis1uJcZ7XdHTgXUNhIF4ruk5j1bJlV/2nvt6c5umRt TA/g== X-Gm-Message-State: AOAM530M8C0u2NTR19f1klvzqfkKO/4DvtTCO5V1wxR75MFHX1xBx4n4 3saMmLfWXTy9+zSPsqrcGoMIe3VSuJs= X-Google-Smtp-Source: ABdhPJyQgd4aRnxoXwQ58uQU/d+BKsH7Er3s7qgYivE73+2k/chrm2XPMAGHzlqwm/YivS0eNGeZFw== X-Received: by 2002:a05:600c:210b:: with SMTP id u11mr3033958wml.16.1611045417368; 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.56 (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 07/11] hw/m68k/next-cube: Make next_irq GPIO inputs to NEXT_PC device Date: Tue, 19 Jan 2021 09:36:13 +0100 Message-Id: <20210119083617.6337-8-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.44; envelope-from=th.huth@gmail.com; helo=mail-wm1-f44.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Make the next_irq function be GPIO inputs to the NEXT_PC device, rather than a freestanding set of qemu_irq lines. This fixes a minor Coverity issue where it correctly points out the trivial memory leak of the memory allocated in the call to qemu_allocate_irqs(). Fixes: CID 1421962 Signed-off-by: Peter Maydell Message-Id: <20210115201206.17347-8-peter.maydell@linaro.org> Signed-off-by: Thomas Huth --- hw/m68k/next-cube.c | 21 ++++----------------- include/hw/m68k/next-cube.h | 3 ++- 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 9b9b051231..7dcd39aab9 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -735,10 +735,6 @@ static const MemoryRegionOps dma_ops = { .endianness = DEVICE_NATIVE_ENDIAN, }; -/* - * TODO: set the shift numbers as values in the enum, so the first switch - * will not be needed - */ static void next_irq(void *opaque, int number, int level) { NeXTPC *s = NEXT_PC(opaque); @@ -839,19 +835,8 @@ static void next_irq(void *opaque, int number, int level) } } -static void next_serial_irq(void *opaque, int n, int level) -{ - /* DPRINTF("SCC IRQ NUM %i\n",n); */ - if (n) { - next_irq(opaque, NEXT_SCC_DMA_I, level); - } else { - next_irq(opaque, NEXT_SCC_I, level); - } -} - static void next_escc_init(DeviceState *pcdev) { - qemu_irq *ser_irq = qemu_allocate_irqs(next_serial_irq, pcdev, 2); DeviceState *dev; SysBusDevice *s; @@ -867,8 +852,8 @@ static void next_escc_init(DeviceState *pcdev) s = SYS_BUS_DEVICE(dev); sysbus_realize_and_unref(s, &error_fatal); - sysbus_connect_irq(s, 0, ser_irq[0]); - sysbus_connect_irq(s, 1, ser_irq[1]); + sysbus_connect_irq(s, 0, qdev_get_gpio_in(pcdev, NEXT_SCC_I)); + sysbus_connect_irq(s, 1, qdev_get_gpio_in(pcdev, NEXT_SCC_DMA_I)); sysbus_mmio_map(s, 0, 0x2118000); } @@ -887,6 +872,8 @@ static void next_pc_realize(DeviceState *dev, Error **errp) NeXTPC *s = NEXT_PC(dev); SysBusDevice *sbd = SYS_BUS_DEVICE(dev); + qdev_init_gpio_in(dev, next_irq, NEXT_NUM_IRQS); + memory_region_init_io(&s->mmiomem, OBJECT(s), &mmio_ops, s, "next.mmio", 0xD0000); memory_region_init_io(&s->scrmem, OBJECT(s), &scr_ops, s, diff --git a/include/hw/m68k/next-cube.h b/include/hw/m68k/next-cube.h index 5a56c354b8..d38c52d540 100644 --- a/include/hw/m68k/next-cube.h +++ b/include/hw/m68k/next-cube.h @@ -39,7 +39,8 @@ enum next_irqs { NEXT_ENRX_DMA_I, NEXT_SCSI_DMA_I, NEXT_SCC_DMA_I, - NEXT_SND_I + NEXT_SND_I, + NEXT_NUM_IRQS }; #endif /* NEXT_CUBE_H */ 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: 12029557 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC74DC433E0 for ; Tue, 19 Jan 2021 08:43:07 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 13D0423121 for ; Tue, 19 Jan 2021 08:43:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13D0423121 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tuxfamily.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46410 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1mbR-0008Kp-2I for qemu-devel@archiver.kernel.org; Tue, 19 Jan 2021 03:43:05 -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-Google-Smtp-Source: ABdhPJxhMLvj7kZJPKqVlwn91K69jZM6OYgwISFKZ5aDfdK77i5ZITJ4LYK1BxMx3Lffh7EFpkLQkA== 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+qemu-devel=archiver.kernel.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(-) 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); From patchwork Tue Jan 19 08:36:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12029559 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8CE26C433DB for ; Tue, 19 Jan 2021 08:45:08 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E843E23131 for ; Tue, 19 Jan 2021 08:45:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E843E23131 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tuxfamily.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:50790 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1mdP-0001lP-0F for qemu-devel@archiver.kernel.org; Tue, 19 Jan 2021 03:45:07 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34438) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1mVZ-0008Jn-M0 for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:37:01 -0500 Received: from mail-wr1-f47.google.com ([209.85.221.47]:36538) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1mVY-0003Vt-3C for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:37:01 -0500 Received: by mail-wr1-f47.google.com with SMTP id 6so11547764wri.3 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=Lp8e+6CNq3PfO/lG5V1bR2jAbjEfRw8uEWg2058AyFU=; b=klIV5NYmQwkloh4SynoEb6Wz2DZCAbMYn6tMgGuRZRxnWZqLsYfd0qqbylq84y0NC0 tZkmwR5HQafKC0fMnsxdi3DI7KzgfT6MZtKuYgGkqd7W19m0JJz1BS/f813JGQ9Qmwmu Us/qHtriOyp9eKNO16Nf/vROPwd+Q2DAvaMywsQHXUWFhL2dC9unhMcK9c44Toow580K PyYdtylG7q3BUozIgj/V3CLysJKSXUYcmUtrPgnCdWHabZMAe1LH2jMg3HdUndV4Xdx0 7A5HrbQYY/pLTAwIxtygXQDuPriR/DOAGDw0MljpOluKrZ5scpTbiqfNuay1qSknhKsq RWhg== X-Gm-Message-State: AOAM531u3e3Nk/Uw3gE8omne3cCYM02pgB18Zet7iIq5Cu7uOqWOriQ4 V6uUwtZDfQ5hexQMa9I3wYV38B/+vbc= X-Google-Smtp-Source: ABdhPJxjGcXowrZlsbQpIwzmvS7XjGkgESMuy3ZucjlqqyHpw6f+tDtJBY4hxnXhpiomnX9RtBAn2g== X-Received: by 2002:a5d:660c:: with SMTP id n12mr3165700wru.291.1611045418609; Tue, 19 Jan 2021 00:36:58 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 00:36:58 -0800 (PST) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 09/11] hw/m68k/next-cube: Remove unused fields from NeXTState Date: Tue, 19 Jan 2021 09:36:15 +0100 Message-Id: <20210119083617.6337-10-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.221.47; envelope-from=th.huth@gmail.com; helo=mail-wr1-f47.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell The fields scsi_irq, scsi_dma, scsi_reset and fd_irq in NeXTState are all unused, except in commented out "this should do something like this" code. Remove the unused fields. As and when the functionality that might use them is added, we can put in the correct kind of wiring (which might or might not need to be a qemu_irq, but which in any case will need to be in the NeXTPC device, not in NeXTState). Signed-off-by: Peter Maydell Message-Id: <20210115201206.17347-10-peter.maydell@linaro.org> Signed-off-by: Thomas Huth --- hw/m68k/next-cube.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 57f9e9f837..1f6a2d58a1 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -74,10 +74,6 @@ struct NeXTState { MachineState parent; next_dma dma[10]; - qemu_irq *scsi_irq; - qemu_irq scsi_dma; - qemu_irq scsi_reset; - qemu_irq *fd_irq; }; #define TYPE_NEXT_PC "next-pc" From patchwork Tue Jan 19 08:36:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12029555 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6131C433DB for ; Tue, 19 Jan 2021 08:43:02 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0CC4523121 for ; Tue, 19 Jan 2021 08:43:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0CC4523121 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tuxfamily.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46288 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1mbN-0008Ht-0I for qemu-devel@archiver.kernel.org; Tue, 19 Jan 2021 03:43:01 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34454) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1mVb-0008La-DD for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:37:03 -0500 Received: from mail-wm1-f50.google.com ([209.85.128.50]:40845) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1mVZ-0003WI-1V for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:37:02 -0500 Received: by mail-wm1-f50.google.com with SMTP id c127so454462wmf.5 for ; Tue, 19 Jan 2021 00:37:00 -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=82040SlXkePZdzPsM+5O3xrDuN6hQ94MWNkWdWB/RtM=; b=SOcNXFGq6JsB/0JhUXprh2DS4FlsHfu+L31+EpcMvotInLIiMhzAEX33bTYiuuG6eB MunPJV3PTskGk0vEoPyJFkc1bVtxNq4804liPVWS0QbnseVNmRCPt+gWGJ3AD86PRXEQ gTuRPlB1FZQOWQhERjtp1aqjiE6LOl7XPVWLJQY34MvNJi6gnxPDp9l+5+ctu3Ot/oTf oAm1jtp1qZWevMUA4sfjlY/WeVBJPZ9gVbqETgWHBaBgRrl7OmpFMD7bZbBeFyzC674W 0jayJqhHvOXOLqd+M+2STlHPdmEwnxLqNFOMCuRQaIvQqPGy+QTxy14dmSynFZVnBsZG l9Og== X-Gm-Message-State: AOAM533h+StK5wkYd3WarKKXzpmtSmDFxkpVC4P3+GGcX7dkEnYnqc0q nWK+8HvDL0m40Gr5seV8QL+GFgpTuA8= X-Google-Smtp-Source: ABdhPJz1MeapYtDenA0eRj4MBre1WajUelG1XlvtrUFcBLh9kFYwKvo7XpI92MjFIeW/jFzkSZw+aQ== X-Received: by 2002:a7b:c31a:: with SMTP id k26mr2924228wmj.72.1611045419262; Tue, 19 Jan 2021 00:36:59 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 00:36:59 -0800 (PST) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 10/11] hw/m68k/next-cube: Add vmstate for NeXTPC device Date: Tue, 19 Jan 2021 09:36:16 +0100 Message-Id: <20210119083617.6337-11-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.50; envelope-from=th.huth@gmail.com; helo=mail-wm1-f50.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell Add the vmstate for the new NeXTPC devic; this is in theory a migration compatibility break, but this machine doesn't have working migration currently anyway. Signed-off-by: Peter Maydell Message-Id: <20210115201206.17347-11-peter.maydell@linaro.org> Signed-off-by: Thomas Huth --- hw/m68k/next-cube.c | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/hw/m68k/next-cube.c b/hw/m68k/next-cube.c index 1f6a2d58a1..92b45d760f 100644 --- a/hw/m68k/next-cube.c +++ b/hw/m68k/next-cube.c @@ -28,6 +28,7 @@ #include "qapi/error.h" #include "ui/console.h" #include "target/m68k/cpu.h" +#include "migration/vmstate.h" /* #define DEBUG_NEXT */ #ifdef DEBUG_NEXT @@ -891,6 +892,37 @@ static Property next_pc_properties[] = { DEFINE_PROP_END_OF_LIST(), }; +static const VMStateDescription next_rtc_vmstate = { + .name = "next-rtc", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT8_ARRAY(ram, NextRtc, 32), + VMSTATE_UINT8(command, NextRtc), + VMSTATE_UINT8(value, NextRtc), + VMSTATE_UINT8(status, NextRtc), + VMSTATE_UINT8(control, NextRtc), + VMSTATE_UINT8(retval, NextRtc), + VMSTATE_END_OF_LIST() + }, +}; + +static const VMStateDescription next_pc_vmstate = { + .name = "next-pc", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT32(scr1, NeXTPC), + VMSTATE_UINT32(scr2, NeXTPC), + VMSTATE_UINT32(int_mask, NeXTPC), + VMSTATE_UINT32(int_status, NeXTPC), + VMSTATE_UINT8(scsi_csr_1, NeXTPC), + VMSTATE_UINT8(scsi_csr_2, NeXTPC), + VMSTATE_STRUCT(rtc, NeXTPC, 0, next_rtc_vmstate, NextRtc), + VMSTATE_END_OF_LIST() + }, +}; + static void next_pc_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); @@ -899,7 +931,7 @@ static void next_pc_class_init(ObjectClass *klass, void *data) dc->realize = next_pc_realize; dc->reset = next_pc_reset; device_class_set_props(dc, next_pc_properties); - /* We will add the VMState in a later commit */ + dc->vmsd = &next_pc_vmstate; } static const TypeInfo next_pc_info = { From patchwork Tue Jan 19 08:36:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 12029553 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2114C433DB for ; Tue, 19 Jan 2021 08:42:56 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 84B2423121 for ; Tue, 19 Jan 2021 08:42:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 84B2423121 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tuxfamily.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:46124 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l1mbH-0008Dr-HV for qemu-devel@archiver.kernel.org; Tue, 19 Jan 2021 03:42:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:34456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l1mVb-0008Lb-DF for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:37:03 -0500 Received: from mail-wm1-f42.google.com ([209.85.128.42]:34051) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1l1mVZ-0003X1-AG for qemu-devel@nongnu.org; Tue, 19 Jan 2021 03:37:02 -0500 Received: by mail-wm1-f42.google.com with SMTP id o10so1146057wmc.1 for ; Tue, 19 Jan 2021 00:37:00 -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=9vd6hpkLzyfwiYIVLQKmNQ3i0ap+mf7O3NsDnvrqQJc=; b=hmGbYELQ68oSibwpONMtKQCQlU9kl2fFkcA8X/qX+8CZ8VmKCKEgYPohqlIEK9oKT/ CeDm3BjTvuUUe/3sg+Izmw2PH3b+Bt+kcixbAZ5+j+cE5SUOvBSxIEXgFCYeQEuGce8p wtsbFRERuJJQLHLYLVIrFw8nEgd7BMAl4BvdcNRPgd0h13r9uIXPQT0LmC1S3XklM3mf /C8Z/+qLogLKKc2hZzvgmLsJtrSA4ZOvC+suMqIlB4Sdy2/uoXonfU07oezLAUIfLZro rNn42cKJBjNyq60goAQvhRhaYbvuOfzkM8nS9nvc4v5OkYROUJLY9pjlbwaIOBwifUjh qVJA== X-Gm-Message-State: AOAM533Mdu5mb10kBtjCuy7pKz2QZ+QcPbtMj2wAmrJfpO01M5pffagp eXxOJu+Ohj2ndqQ4Rj/6H50CJKk7PUE= X-Google-Smtp-Source: ABdhPJxBP2jMnvQs9er9yG8+heNItgVQ1T5RZJDJXJoOUTxO0dWrxTFnNirx+N/daUrs+/Rc57019g== X-Received: by 2002:a1c:e0d4:: with SMTP id x203mr2915627wmg.160.1611045419932; Tue, 19 Jan 2021 00:36:59 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Jan 2021 00:36:59 -0800 (PST) From: Thomas Huth To: qemu-devel@nongnu.org, Peter Maydell Subject: [PULL 11/11] hw/m68k/next-cube: Add missing header comment to next-cube.h Date: Tue, 19 Jan 2021 09:36:17 +0100 Message-Id: <20210119083617.6337-12-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.42; envelope-from=th.huth@gmail.com; helo=mail-wm1-f42.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+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" From: Peter Maydell The next-cube.h file is missing the usual copyright-and-license header; add it (same as the next-cube.c one). Signed-off-by: Peter Maydell Message-Id: <20210115201206.17347-12-peter.maydell@linaro.org> Signed-off-by: Thomas Huth --- include/hw/m68k/next-cube.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/hw/m68k/next-cube.h b/include/hw/m68k/next-cube.h index d38c52d540..43577282d1 100644 --- a/include/hw/m68k/next-cube.h +++ b/include/hw/m68k/next-cube.h @@ -1,3 +1,13 @@ +/* + * NeXT Cube + * + * Copyright (c) 2011 Bryce Lanham + * + * This code 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. + */ #ifndef NEXT_CUBE_H #define NEXT_CUBE_H