From b49f4cacde202ebda43e578193bc9e834ba99767 Mon Sep 17 00:00:00 2001 From: David van Moolenbroek Date: Mon, 17 Nov 2014 19:19:36 +0000 Subject: [PATCH] rtl8139: enable bus mastering if needed This resolves #2. Change-Id: Ie6736f0d5a713025f09c18de7042ba44fbb1b2f8 --- minix/drivers/net/rtl8139/rtl8139.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/minix/drivers/net/rtl8139/rtl8139.c b/minix/drivers/net/rtl8139/rtl8139.c index a71f46090..6318d2fd9 100644 --- a/minix/drivers/net/rtl8139/rtl8139.c +++ b/minix/drivers/net/rtl8139/rtl8139.c @@ -411,7 +411,7 @@ re_t *rep; int skip; { int r, devind; - u16_t vid, did; + u16_t cr, vid, did; u32_t bar; u8_t ilr; #if VERBOSE @@ -437,7 +437,13 @@ int skip; printf("%s (%x/%x) at %s\n", dname, vid, did, pci_slot_name(devind)); #endif pci_reserve(devind); - /* printf("cr = 0x%x\n", pci_attr_r16(devind, PCI_CR)); */ + + /* Enable bus mastering if necessary. */ + cr = pci_attr_r16(devind, PCI_CR); + /* printf("cr = 0x%x\n", cr); */ + if (!(cr & PCI_CR_MAST_EN)) + pci_attr_w16(devind, PCI_CR, cr | PCI_CR_MAST_EN); + bar= pci_attr_r32(devind, PCI_BAR) & 0xffffffe0; if (bar < 0x400) { panic("base address is not properly configured");