From patchwork Mon Nov 14 20:35:13 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julian Pidancet X-Patchwork-Id: 125599 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 EC69AB7211 for ; Tue, 15 Nov 2011 06:43:27 +1100 (EST) Received: from localhost ([::1]:48052 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RQ2Qz-0005rf-3u for incoming@patchwork.ozlabs.org; Mon, 14 Nov 2011 14:43:13 -0500 Received: from eggs.gnu.org ([140.186.70.92]:53185) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RQ2Qt-0005rV-Rn for qemu-devel@nongnu.org; Mon, 14 Nov 2011 14:43:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RQ2Qs-0005Yk-Ra for qemu-devel@nongnu.org; Mon, 14 Nov 2011 14:43:07 -0500 Received: from mail-wy0-f173.google.com ([74.125.82.173]:61639) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RQ2Qs-0005YW-NC for qemu-devel@nongnu.org; Mon, 14 Nov 2011 14:43:06 -0500 Received: by wyg34 with SMTP id 34so1111319wyg.4 for ; Mon, 14 Nov 2011 11:43:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=SqCx4A0Gm8NzlfCs+ogvUZxPexaJ2eg3y9ah4awaMGc=; b=ayrGIo+aNet7TjXVThXstauS2jZa0GO/B7s7cCiMKMzOmpRiLpMrMe0p1JtLvVwWna jQ01GsdvXF2ySbPa7vZz/amtdXxdseFVr9Pa5+ZNFdXv10h8o/silReg1p7mHaAtlCfB 9vWW8W/9+2mqPsf5j9CG7VE2vggpOBXuZgnWk= Received: by 10.227.198.83 with SMTP id en19mr4302444wbb.26.1321299785187; Mon, 14 Nov 2011 11:43:05 -0800 (PST) Received: from localhost.localdomain (188-223-88-44.zone14.bethere.co.uk. [188.223.88.44]) by mx.google.com with ESMTPS id ep13sm20486737wbb.8.2011.11.14.11.43.02 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 14 Nov 2011 11:43:04 -0800 (PST) From: Julian Pidancet To: qemu-devel@nongnu.org Date: Mon, 14 Nov 2011 20:35:13 +0000 Message-Id: <77eaa9e77eb6236511d0fe4f209664c8855f8062.1321302712.git.julian.pidancet@gmail.com> X-Mailer: git-send-email 1.7.3.4 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.82.173 Cc: stefanha@gmail.com, Julian Pidancet Subject: [Qemu-devel] [PATCH v2] rtl8139: Fix invalid IO access alignment 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 patch makes iPXE work with the rtl8139 emulation. The rtl8139 driver in iPXE issues a 16bit access on the ChipCmd register (offset 0x37) to check the status of the rx buffer. The offset of the ioport access was getting fixed up to 0x36 in qemu, causing the value read in iPXE to be invalid. This fixes an issue with iPXE reporting timeouts during TFTP transfers. v2: Remove completely the 0xff masks as they're useless since the calling functions already do the job. Signed-off-by: Julian Pidancet --- hw/rtl8139.c | 14 +------------- 1 files changed, 1 insertions(+), 13 deletions(-) diff --git a/hw/rtl8139.c b/hw/rtl8139.c index 4c37993..aa8ed0a 100644 --- a/hw/rtl8139.c +++ b/hw/rtl8139.c @@ -1971,7 +1971,7 @@ static int rtl8139_cplus_transmit_one(RTL8139State *s) cplus_tx_ring_desc += 16 * descriptor; DPRINTF("+++ C+ mode reading TX descriptor %d from host memory at " - "%08x0x%08x = 0x"DMA_ADDR_FMT"\n", descriptor, s->TxAddr[1], + "%08x %08x = 0x"DMA_ADDR_FMT"\n", descriptor, s->TxAddr[1], s->TxAddr[0], cplus_tx_ring_desc); uint32_t val, txdw0,txdw1,txbufLO,txbufHI; @@ -2713,8 +2713,6 @@ static void rtl8139_io_writeb(void *opaque, uint8_t addr, uint32_t val) { RTL8139State *s = opaque; - addr &= 0xff; - switch (addr) { case MAC0 ... MAC0+5: @@ -2800,8 +2798,6 @@ static void rtl8139_io_writew(void *opaque, uint8_t addr, uint32_t val) { RTL8139State *s = opaque; - addr &= 0xfe; - switch (addr) { case IntrMask: @@ -2900,8 +2896,6 @@ static void rtl8139_io_writel(void *opaque, uint8_t addr, uint32_t val) { RTL8139State *s = opaque; - addr &= 0xfc; - switch (addr) { case RxMissed: @@ -2969,8 +2963,6 @@ static uint32_t rtl8139_io_readb(void *opaque, uint8_t addr) RTL8139State *s = opaque; int ret; - addr &= 0xff; - switch (addr) { case MAC0 ... MAC0+5: @@ -3043,8 +3035,6 @@ static uint32_t rtl8139_io_readw(void *opaque, uint8_t addr) RTL8139State *s = opaque; uint32_t ret; - addr &= 0xfe; /* mask lower bit */ - switch (addr) { case IntrMask: @@ -3120,8 +3110,6 @@ static uint32_t rtl8139_io_readl(void *opaque, uint8_t addr) RTL8139State *s = opaque; uint32_t ret; - addr &= 0xfc; /* also mask low 2 bits */ - switch (addr) { case RxMissed: