From patchwork Wed Aug 24 18:04:09 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 111389 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id F2517B6F00 for ; Thu, 25 Aug 2011 04:04:23 +1000 (EST) Received: from localhost ([::1]:56462 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwHoK-0006wu-1r for incoming@patchwork.ozlabs.org; Wed, 24 Aug 2011 14:04:20 -0400 Received: from eggs.gnu.org ([140.186.70.92]:50415) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwHoE-0006uF-7I for qemu-devel@nongnu.org; Wed, 24 Aug 2011 14:04:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QwHoD-00054v-4q for qemu-devel@nongnu.org; Wed, 24 Aug 2011 14:04:14 -0400 Received: from mnementh.archaic.org.uk ([81.2.115.146]:52238) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QwHoC-00054j-Tk for qemu-devel@nongnu.org; Wed, 24 Aug 2011 14:04:13 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.72) (envelope-from ) id 1QwHo9-0004ph-FD; Wed, 24 Aug 2011 19:04:09 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Wed, 24 Aug 2011 19:04:09 +0100 Message-Id: <1314209049-18554-1-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.2.5 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 81.2.115.146 Cc: Avi Kivity , patches@linaro.org Subject: [Qemu-devel] [PATCH] hw/integratorcp: Fix bugs in writes to CM_CTRL system register X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Fix a number of bugs in the implementation of writes to the CM_CTRL system register: * write to cm_ctrl, not cm_init ! * an '&' vs '^' typo meant we would write the inverse of the bits * handling the LED via printf() meant we spew lots of output to stdout when Linux uses the LED as a heartbeat indicator * we would hw_error() if a reset was requested rather than actually resetting Signed-off-by: Peter Maydell --- Avi -- I don't think this will conflict with your memory API conversion patch. hw/integratorcp.c | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 deletions(-) diff --git a/hw/integratorcp.c b/hw/integratorcp.c index 2814108..cb0adfc 100644 --- a/hw/integratorcp.c +++ b/hw/integratorcp.c @@ -13,6 +13,7 @@ #include "boards.h" #include "arm-misc.h" #include "net.h" +#include "sysemu.h" typedef struct { SysBusDevice busdev; @@ -118,15 +119,20 @@ static void integratorcm_do_remap(integratorcm_state *s, int flash) static void integratorcm_set_ctrl(integratorcm_state *s, uint32_t value) { if (value & 8) { - hw_error("Board reset\n"); + qemu_system_reset_request(); } - if ((s->cm_init ^ value) & 4) { + if ((s->cm_ctrl ^ value) & 4) { integratorcm_do_remap(s, (value & 4) == 0); } - if ((s->cm_init ^ value) & 1) { - printf("Green LED %s\n", (value & 1) ? "on" : "off"); + if ((s->cm_ctrl ^ value) & 1) { + /* (value & 1) != 0 means the green "MISC LED" is lit. + * We don't have any nice place to display LEDs. printf is a bad + * idea because Linux uses the LED as a heartbeat and the output + * will swamp anything else on the terminal. + */ } - s->cm_init = (s->cm_init & ~ 5) | (value ^ 5); + /* Note that the RESET bit [3] always reads as zero */ + s->cm_ctrl = (s->cm_ctrl & ~5) | (value & 5); } static void integratorcm_update(integratorcm_state *s)