From: Ben Gras Date: Sat, 18 May 2013 13:24:23 +0000 (+0000) Subject: at_wini: enable busmastering in pci if necessary X-Git-Tag: v3.3.0~978 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=225ed6d7bd2d83b79ebd4c1e10904c9462769530;p=minix.git at_wini: enable busmastering in pci if necessary --- diff --git a/drivers/at_wini/at_wini.c b/drivers/at_wini/at_wini.c index e59dbbd10..0968ddb2e 100644 --- a/drivers/at_wini/at_wini.c +++ b/drivers/at_wini/at_wini.c @@ -411,6 +411,18 @@ static int quirkmatch(struct quirk *table, u8_t bcr, u8_t scr, u8_t interface, u return 0; } +static void +pci_busmaster(int devind) +{ + u16_t cr; + + /* Enable busmastering 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); + } +} + /*===========================================================================* * init_params_pci * *===========================================================================*/ @@ -475,6 +487,7 @@ static void init_params_pci(int skip) w_instance, devind); continue; } + pci_busmaster(devind); if (sys_irqsetpolicy(irq, 0, &irq_hook) != OK) { printf("atapci: couldn't set IRQ policy %d\n", irq); continue; @@ -562,7 +575,7 @@ static void init_params_pci(int skip) if(pci_reserve_ok(devind) != OK) { printf("at_wini%ld (compat): pci_reserve %d failed!\n", w_instance, devind); - } + } else pci_busmaster(devind); } } }