From: David van Moolenbroek Date: Mon, 17 Nov 2014 19:19:36 +0000 (+0000) Subject: rtl8139: enable bus mastering if needed X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=refs%2Fchanges%2F93%2F2893%2F1;p=minix.git rtl8139: enable bus mastering if needed This resolves #2. Change-Id: Ie6736f0d5a713025f09c18de7042ba44fbb1b2f8 --- 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");