qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Michael Davidsaver <mdavidsaver@gmail.com>
To: Peter Crosthwaite <crosthwaitepeter@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Michael Davidsaver <mdavidsaver@gmail.com>,
	qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH v3 2/3] armv7-m: Implement SYSRESETREQ
Date: Sun, 11 Oct 2015 23:36:25 -0400	[thread overview]
Message-ID: <1444620986-20262-2-git-send-email-mdavidsaver@gmail.com> (raw)
In-Reply-To: <CAPokK=pVrdOgTvQ7cGBW1KbevOY1kTq691BLjQVXCfmQm-04Mg@mail.gmail.com>

Implement the SYSRESETREQ bit of the AIRCR register
for armv7-m (ie. cortex-m3) to trigger a GPIO out.

Signed-off-by: Michael Davidsaver <mdavidsaver@gmail.com>
---
 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

  parent reply	other threads:[~2015-10-12  3:37 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-08 15:40 [Qemu-devel] [PATCH] Exit on reset for armv7-m Michael Davidsaver
2015-10-08 15:40 ` [Qemu-devel] [PATCH] armv7-m: exit on external reset request Michael Davidsaver
2015-10-09 16:59   ` Peter Maydell
2015-10-09 17:25     ` Michael Davidsaver
2015-10-09 18:18       ` Peter Crosthwaite
2015-10-09 18:51         ` Michael Davidsaver
2015-10-10 14:35           ` Michael Davidsaver
2015-10-10 18:54             ` [Qemu-devel] [PATCH v2] " Michael Davidsaver
2015-10-11 15:06               ` Peter Crosthwaite
2015-10-12  3:36                 ` [Qemu-devel] [PATCH v3 1/3] armv7-m: Return DeviceState* from armv7m_init() Michael Davidsaver
2015-10-30 21:15                   ` Peter Crosthwaite
2015-10-30 21:20                     ` Peter Crosthwaite
2015-10-30 21:35                       ` Peter Maydell
2015-10-12  3:36                 ` Michael Davidsaver [this message]
2015-10-30 21:16                   ` [Qemu-devel] [PATCH v3 2/3] armv7-m: Implement SYSRESETREQ Peter Crosthwaite
2015-10-12  3:36                 ` [Qemu-devel] [PATCH v3 3/3] stellaris: exit on external reset request Michael Davidsaver
2015-10-30 21:13                   ` Peter Crosthwaite
2015-10-08 20:09 ` [Qemu-devel] [PATCH] Exit on reset for armv7-m Peter Crosthwaite
2015-10-09  1:24   ` Michael Davidsaver
2015-10-09  4:21     ` Peter Crosthwaite

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444620986-20262-2-git-send-email-mdavidsaver@gmail.com \
    --to=mdavidsaver@gmail.com \
    --cc=crosthwaitepeter@gmail.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).