From patchwork Fri Oct 7 07:19:47 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 118261 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 AECD3B70F5 for ; Fri, 7 Oct 2011 19:11:08 +1100 (EST) Received: from localhost ([::1]:51800 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RC4kT-0002Co-8X for incoming@patchwork.ozlabs.org; Fri, 07 Oct 2011 03:21:37 -0400 Received: from eggs.gnu.org ([140.186.70.92]:45384) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RC4jF-00081C-GA for qemu-devel@nongnu.org; Fri, 07 Oct 2011 03:20:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RC4jB-0004K5-6n for qemu-devel@nongnu.org; Fri, 07 Oct 2011 03:20:20 -0400 Received: from thoth.sbs.de ([192.35.17.2]:21596) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RC4jA-0004JM-P7 for qemu-devel@nongnu.org; Fri, 07 Oct 2011 03:20:17 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id p977KE9e019185; Fri, 7 Oct 2011 09:20:15 +0200 Received: from mchn199C.mchp.siemens.de ([139.22.57.218]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id p977K5Dv029837; Fri, 7 Oct 2011 09:20:14 +0200 From: Jan Kiszka To: Anthony Liguori , qemu-devel Date: Fri, 7 Oct 2011 09:19:47 +0200 Message-Id: X-Mailer: git-send-email 1.7.3.4 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.2 Cc: Blue Swirl Subject: [Qemu-devel] [PATCH v2 14/23] i8259: Fix poll command 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 This was probably never used so far: According to the spec, polling means ack'ing the pending IRQ and setting its corresponding bit in isr. Moreover, we have to signal a pending IRQ via bit 7 of the returned value, and we must not return a spurious IRQ if none is pending. This implements the poll command without the help of pic_poll_read which is left untouched as pic_intack_read is still using it. Signed-off-by: Jan Kiszka --- hw/i8259.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/hw/i8259.c b/hw/i8259.c index bb257e6..31962c0 100644 --- a/hw/i8259.c +++ b/hw/i8259.c @@ -393,7 +393,13 @@ static uint64_t pic_ioport_read(void *opaque, target_phys_addr_t addr1, int ret; if (s->poll) { - ret = pic_poll_read(s); + ret = pic_get_irq(s); + if (ret >= 0) { + pic_intack(s, ret); + ret |= 0x80; + } else { + ret = 0; + } s->poll = 0; } else { if (addr == 0) {