From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44331) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlTvQ-0001h7-DF for qemu-devel@nongnu.org; Sun, 11 Oct 2015 23:37:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZlTvL-0006uW-Nk for qemu-devel@nongnu.org; Sun, 11 Oct 2015 23:37:24 -0400 Received: from mail-qk0-x22b.google.com ([2607:f8b0:400d:c09::22b]:35804) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlTvL-0006uS-JO for qemu-devel@nongnu.org; Sun, 11 Oct 2015 23:37:19 -0400 Received: by qkap81 with SMTP id p81so54304248qka.2 for ; Sun, 11 Oct 2015 20:37:19 -0700 (PDT) From: Michael Davidsaver Date: Sun, 11 Oct 2015 23:36:25 -0400 Message-Id: <1444620986-20262-2-git-send-email-mdavidsaver@gmail.com> In-Reply-To: References: Subject: [Qemu-devel] [PATCH v3 2/3] armv7-m: Implement SYSRESETREQ List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: Peter Maydell , Michael Davidsaver , qemu-devel@nongnu.org Implement the SYSRESETREQ bit of the AIRCR register for armv7-m (ie. cortex-m3) to trigger a GPIO out. Signed-off-by: Michael Davidsaver --- hw/intc/armv7m_nvic.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/hw/intc/armv7m_nvic.c b/hw/intc/armv7m_nvic.c index 3ec8408..6fc167e 100644 --- a/hw/intc/armv7m_nvic.c +++ b/hw/intc/armv7m_nvic.c @@ -28,6 +28,7 @@ typedef struct { MemoryRegion gic_iomem_alias; MemoryRegion container; uint32_t num_irq; + qemu_irq sysresetreq; } nvic_state; #define TYPE_NVIC "armv7m_nvic" @@ -348,10 +349,13 @@ static void nvic_writel(nvic_state *s, uint32_t offset, uint32_t value) break; case 0xd0c: /* Application Interrupt/Reset Control. */ if ((value >> 16) == 0x05fa) { + if (value & 4) { + qemu_irq_pulse(s->sysresetreq); + } if (value & 2) { qemu_log_mask(LOG_UNIMP, "VECTCLRACTIVE unimplemented\n"); } - if (value & 5) { + if (value & 1) { qemu_log_mask(LOG_UNIMP, "AIRCR system reset unimplemented\n"); } if (value & 0x700) { @@ -535,11 +539,14 @@ static void armv7m_nvic_instance_init(Object *obj) * value in the GICState struct. */ GICState *s = ARM_GIC_COMMON(obj); + DeviceState *dev = DEVICE(obj); + nvic_state *nvic = NVIC(obj); /* The ARM v7m may have anything from 0 to 496 external interrupt * IRQ lines. We default to 64. Other boards may differ and should * set the num-irq property appropriately. */ s->num_irq = 64; + qdev_init_gpio_out_named(dev, &nvic->sysresetreq, "SYSRESETREQ", 1); } static void armv7m_nvic_class_init(ObjectClass *klass, void *data) -- 2.1.4