From: David van Moolenbroek Date: Mon, 1 Dec 2014 17:11:44 +0000 (+0000) Subject: fxp: enable bus mastering if needed X-Git-Url: http://zhaoyanbai.com/repos/man.dnssec-keyfromlabel.html?a=commitdiff_plain;h=2e5374621d0ee46689a6673b7c85915efd905067;p=minix.git fxp: enable bus mastering if needed This is required for at least QEMU. However, as of writing, QEMU also requires fixes in its epro100 emulator before this driver can use it. Change-Id: Ie5c5ffe4311b1a0e581bc687f1c15de3a85f4a30 --- diff --git a/minix/drivers/net/fxp/fxp.c b/minix/drivers/net/fxp/fxp.c index 90ec370b6..d6aa9067b 100644 --- a/minix/drivers/net/fxp/fxp.c +++ b/minix/drivers/net/fxp/fxp.c @@ -424,7 +424,7 @@ static void fxp_pci_conf() static int fxp_probe(fxp_t *fp, int skip) { int r, devind; - u16_t vid, did; + u16_t vid, did, cr; u32_t bar; u8_t ilr, rev; char *str; @@ -452,6 +452,11 @@ static int fxp_probe(fxp_t *fp, int skip) #endif pci_reserve(devind); + /* Enable bus mastering if necessary. */ + cr = pci_attr_r16(devind, PCI_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_2) & 0xffffffe0; if (bar < 0x400) { panic("fxp_probe: base address is not properly configured");