From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44333) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlTvQ-0001h8-Dc 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 1ZlTvM-0006uh-AB for qemu-devel@nongnu.org; Sun, 11 Oct 2015 23:37:24 -0400 Received: from mail-qk0-x235.google.com ([2607:f8b0:400d:c09::235]:36005) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlTvM-0006ub-6e for qemu-devel@nongnu.org; Sun, 11 Oct 2015 23:37:20 -0400 Received: by qkht68 with SMTP id t68so54099528qkh.3 for ; Sun, 11 Oct 2015 20:37:20 -0700 (PDT) From: Michael Davidsaver Date: Sun, 11 Oct 2015 23:36:26 -0400 Message-Id: <1444620986-20262-3-git-send-email-mdavidsaver@gmail.com> In-Reply-To: References: Subject: [Qemu-devel] [PATCH v3 3/3] stellaris: exit on external reset request List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Crosthwaite Cc: Peter Maydell , Michael Davidsaver , qemu-devel@nongnu.org Add GPIO in for the stellaris board which calls qemu_system_reset_request() on reset request. Signed-off-by: Michael Davidsaver --- hw/arm/stellaris.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hw/arm/stellaris.c b/hw/arm/stellaris.c index 82a4ad5..0114e0a 100644 --- a/hw/arm/stellaris.c +++ b/hw/arm/stellaris.c @@ -16,6 +16,7 @@ #include "net/net.h" #include "hw/boards.h" #include "exec/address-spaces.h" +#include "sysemu/sysemu.h" #define GPIO_A 0 #define GPIO_B 1 @@ -1176,6 +1177,14 @@ static int stellaris_adc_init(SysBusDevice *sbd) return 0; } +static +void do_sys_reset(void *opaque, int n, int level) +{ + if (level) { + qemu_system_reset_request(); + } +} + /* Board init. */ static stellaris_board_info stellaris_boards[] = { { "LM3S811EVB", @@ -1243,6 +1252,9 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model, nvic = armv7m_init(system_memory, flash_size, NUM_IRQ_LINES, kernel_filename, cpu_model); + qdev_connect_gpio_out_named(nvic, "SYSRESETREQ", 0, + qemu_allocate_irq(&do_sys_reset, NULL, 0)); + if (board->dc1 & (1 << 16)) { dev = sysbus_create_varargs(TYPE_STELLARIS_ADC, 0x40038000, qdev_get_gpio_in(nvic, 14), -- 2.1.4