[ipxe-devel] [PATCH] [rtl8139] Only perform 8bit ioport access on the ChipCmd register

Julian Pidancet julian.pidancet at gmail.com
Mon Nov 14 21:00:20 UTC 2011


This trivial patch replaces the 16bit read (inw) on the ChipCmd register
with a 8bit read (inb). ChipCmd is only 8bit large and 0x38 is
undocumented.

FYI: This was causing an issue when used with qemu emulated rtl8139
device which was improperly aligning IOs. I've already reported the
issue along with a patch on the qemu mailing list:
http://lists.nongnu.org/archive/html/qemu-devel/2011-11/msg01937.html

Signed-off-by: Julian Pidancet <julian.pidancet at gmail.com>
---
 src/drivers/net/rtl8139.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/drivers/net/rtl8139.c b/src/drivers/net/rtl8139.c
index ebe84fb..2da8223 100644
--- a/src/drivers/net/rtl8139.c
+++ b/src/drivers/net/rtl8139.c
@@ -434,7 +434,7 @@ static void rtl_poll ( struct net_device *netdev ) {
 	}
 
 	/* Handle received packets */
-	while ( ! ( inw ( rtl->ioaddr + ChipCmd ) & RxBufEmpty ) ) {
+	while ( ! ( inb ( rtl->ioaddr + ChipCmd ) & RxBufEmpty ) ) {
 		rx_status = * ( ( uint16_t * )
 				( rtl->rx.ring + rtl->rx.offset ) );
 		rx_len = * ( ( uint16_t * )
-- 
Julian Pidancet




More information about the ipxe-devel mailing list