From patchwork Thu Aug 9 13:01:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 143847 Delivered-To: patches@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2065820ljj; Thu, 9 Aug 2018 06:01:25 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxMrafN4wsw9+qzNW1T9r4TOGyMxkVLN4LeOKskQt/WVcaVBH1QFB4Ht3bT/jo1LCMTNnW5 X-Received: by 2002:a1c:a6cc:: with SMTP id p195-v6mr1675664wme.76.1533819685125; Thu, 09 Aug 2018 06:01:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533819685; cv=none; d=google.com; s=arc-20160816; b=INEaLIm6HX3NhYbikBmB1lW4dFl7Psm8ircbrIijYPz5ULgltpfl2GRJXLoKQLD50h JFUaW68icGF9U3euaEj8r45Uiu/iPdOFqAi8KXon9nlyz2278c4yL5mgcGH/nA9C8J8R cgOLkrkmzYxPTKYxAXVL6jQ3f+Ue/BnHz424y85IeoCzOajpcVsAyUfqHcLAgNwQY6mT t25N9JLsqux+LLouuqs1qjaHVPkjc0NNeCt3rvKO4CdsYumLTAEEDZhYmF7tqJ9Friih wm2QWhOANFI6FNVQgQ4WtnRuI0avDNglcjeEk/VCQGdAATKQLTC/GkvGslUUyQg+eW7r 2dHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=UTgAwKsRzaWzVJiEbqM2Wr0I3FBYVwIq6h31cPjpn/4=; b=oq9m/8MFBQXK4sP34HRsVe8Yr+Tg7VRz882AZlx8IYAH92wfv+wq51qk+bPRLBdYR1 yiI7dM4Z3KriXlc7dodjiq87mkUiKjv8sMC/noqThQFRvESyuc6Jxc5mjZ9i/5QKUryR f62B4V+iLg+0hEyNjk/54KoMGnQDmt+6glMouxO2+cWhqlKOvKwJydsS/e+85lPTPtXX xMBwa1t4P15DxWxKoYRVGiW5YcmE38NawP2+Q6MDB1Ndlfpk6m82zsqBnz5OUG9ALWY3 NEf8b0K5CkKi2MRj3UipWKLtYMTAohA4xDtrb2dAY6W72GhYTcFrcr1ZyiJRd9lzpDhs Gt2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by mx.google.com with ESMTPS id 81-v6si6198986wrb.2.2018.08.09.06.01.25 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 09 Aug 2018 06:01:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) client-ip=2001:8b0:1d0::2; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::2 as permitted sender) smtp.mailfrom=pm215@archaic.org.uk; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1fnkZA-0003HQ-Lh; Thu, 09 Aug 2018 14:01:24 +0100 From: Peter Maydell To: qemu-arm@nongnu.org, qemu-devel@nongnu.org Cc: patches@linaro.org Subject: [PATCH 06/16] hw/misc/iotkit: Wire up the system control element Date: Thu, 9 Aug 2018 14:01:05 +0100 Message-Id: <20180809130115.28951-7-peter.maydell@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809130115.28951-1-peter.maydell@linaro.org> References: <20180809130115.28951-1-peter.maydell@linaro.org> Wire up the system control element's register banks. This is the last of the previously completely unimplemented components in the IoTKit. Signed-off-by: Peter Maydell --- include/hw/arm/iotkit.h | 4 +++- hw/arm/iotkit.c | 19 +++++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) -- 2.17.1 Reviewed-by: Philippe Mathieu-Daudé diff --git a/include/hw/arm/iotkit.h b/include/hw/arm/iotkit.h index 0f5c5101708..1ffa31d521b 100644 --- a/include/hw/arm/iotkit.h +++ b/include/hw/arm/iotkit.h @@ -58,7 +58,7 @@ #include "hw/timer/cmsdk-apb-timer.h" #include "hw/timer/cmsdk-apb-dualtimer.h" #include "hw/watchdog/cmsdk-apb-watchdog.h" -#include "hw/misc/unimp.h" +#include "hw/misc/iotkit-sysctl.h" #include "hw/or-irq.h" #include "hw/core/split-irq.h" @@ -97,6 +97,8 @@ typedef struct IoTKit { CMSDKAPBWatchdog nswatchdog; CMSDKAPBWatchdog swatchdog; + IoTKitSysCtl sysctl; + MemoryRegion container; MemoryRegion alias1; MemoryRegion alias2; diff --git a/hw/arm/iotkit.c b/hw/arm/iotkit.c index cb0ec456f39..5d59ed5489f 100644 --- a/hw/arm/iotkit.c +++ b/hw/arm/iotkit.c @@ -16,7 +16,6 @@ #include "hw/sysbus.h" #include "hw/registerfields.h" #include "hw/arm/iotkit.h" -#include "hw/misc/unimp.h" #include "hw/arm/arm.h" /* Clock frequency in HZ of the 32KHz "slow clock" */ @@ -151,6 +150,8 @@ static void iotkit_init(Object *obj) sizeof(s->nswatchdog), TYPE_CMSDK_APB_WATCHDOG); sysbus_init_child_obj(obj, "swatchdog", &s->swatchdog, sizeof(s->swatchdog), TYPE_CMSDK_APB_WATCHDOG); + sysbus_init_child_obj(obj, "iotkit-sysctl", &s->sysctl, sizeof(s->sysctl), + TYPE_IOTKIT_SYSCTL); object_initialize_child(obj, "nmi-orgate", &s->nmi_orgate, sizeof(s->nmi_orgate), TYPE_OR_IRQ, &error_abort, NULL); @@ -516,13 +517,15 @@ static void iotkit_realize(DeviceState *dev, Error **errp) qdev_get_gpio_in_named(dev_apb_ppc1, "cfg_sec_resp", 0)); - /* Using create_unimplemented_device() maps the stub into the - * system address space rather than into our container, but the - * overall effect to the guest is the same. - */ - create_unimplemented_device("SYSINFO", 0x40020000, 0x1000); - - create_unimplemented_device("SYSCONTROL", 0x50021000, 0x1000); + object_property_set_bool(OBJECT(&s->sysctl), true, "realized", &err); + if (err) { + error_propagate(errp, err); + return; + } + /* System information registers */ + sysbus_mmio_map(SYS_BUS_DEVICE(&s->sysctl), 0, 0x40020000); + /* System control registers */ + sysbus_mmio_map(SYS_BUS_DEVICE(&s->sysctl), 1, 0x50021000); /* This OR gate wires together outputs from the secure watchdogs to NMI */ object_property_set_int(OBJECT(&s->nmi_orgate), 2, "num-lines", &err);