From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51301) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTAIu-00059S-90 for qemu-devel@nongnu.org; Wed, 23 Nov 2011 05:43:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RTAIo-0005of-5s for qemu-devel@nongnu.org; Wed, 23 Nov 2011 05:43:48 -0500 Received: from mtagate1.uk.ibm.com ([194.196.100.161]:51158) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RTAIn-0005ls-Rs for qemu-devel@nongnu.org; Wed, 23 Nov 2011 05:43:42 -0500 Received: from d06nrmr1707.portsmouth.uk.ibm.com (d06nrmr1707.portsmouth.uk.ibm.com [9.149.39.225]) by mtagate1.uk.ibm.com (8.13.1/8.13.1) with ESMTP id pANAhfYC006234 for ; Wed, 23 Nov 2011 10:43:41 GMT Received: from d06av11.portsmouth.uk.ibm.com (d06av11.portsmouth.uk.ibm.com [9.149.37.252]) by d06nrmr1707.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id pANAheCE2117810 for ; Wed, 23 Nov 2011 10:43:40 GMT Received: from d06av11.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av11.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id pANAheN9023896 for ; Wed, 23 Nov 2011 03:43:40 -0700 From: Stefan Hajnoczi Date: Wed, 23 Nov 2011 10:42:31 +0000 Message-Id: <1322044952-15792-3-git-send-email-stefanha@linux.vnet.ibm.com> In-Reply-To: <1322044952-15792-1-git-send-email-stefanha@linux.vnet.ibm.com> References: <1322044952-15792-1-git-send-email-stefanha@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 2/3] rtl8139: Fix invalid IO access alignment List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anthony Liguori , Stefan Hajnoczi , Julian Pidancet From: Julian Pidancet 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. Reposting this here because it is trivial enough and the original post on qemu-devel didn't attract much attention. Also, the inw() which was causing the issue has been replaced with an inb() in upstream iPXE: https://git.ipxe.org/ipxe.git/commit/91dd64ad25baa27954a7518e73df4fca8a2d0c93 Signed-off-by: Julian Pidancet Signed-off-by: Stefan Hajnoczi --- 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: -- 1.7.7.1