From 28bd1409da1e9911c4152b06c5c7b89235e2b17a Mon Sep 17 00:00:00 2001 From: scottl Date: Mon, 12 Aug 2013 23:30:01 +0000 Subject: Update PCI drivers to no longer look at the MEMIO-enabled bit in the PCI command register. The lazy BAR allocation code in FreeBSD sometimes disables this bit when it detects a range conflict, and will re-enable it on demand when a driver allocates the BAR. Thus, the bit is no longer a reliable indication of capability, and should not be checked. This results in the elimination of a lot of code from drivers, and also gives the opportunity to simplify a lot of drivers to use a helper API to set the busmaster enable bit. This changes fixes some recent reports of disk controllers and their associated drives/enclosures disappearing during boot. Submitted by: jhb Reviewed by: jfv, marius, achadd, achim MFC after: 1 day --- sys/dev/mps/mps_pci.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'sys/dev/mps') diff --git a/sys/dev/mps/mps_pci.c b/sys/dev/mps/mps_pci.c index e64acdc..5417ae6 100644 --- a/sys/dev/mps/mps_pci.c +++ b/sys/dev/mps/mps_pci.c @@ -183,7 +183,6 @@ mps_pci_attach(device_t dev) { struct mps_softc *sc; struct mps_ident *m; - uint16_t command; int error; sc = device_get_softc(dev); @@ -193,18 +192,7 @@ mps_pci_attach(device_t dev) sc->mps_flags = m->flags; /* Twiddle basic PCI config bits for a sanity check */ - command = pci_read_config(dev, PCIR_COMMAND, 2); - command |= PCIM_CMD_BUSMASTEREN; - pci_write_config(dev, PCIR_COMMAND, command, 2); - command = pci_read_config(dev, PCIR_COMMAND, 2); - if ((command & PCIM_CMD_BUSMASTEREN) == 0) { - mps_printf(sc, "Cannot enable PCI busmaster\n"); - return (ENXIO); - } - if ((command & PCIM_CMD_MEMEN) == 0) { - mps_printf(sc, "PCI memory window not available\n"); - return (ENXIO); - } + pci_enable_busmaster(dev); /* Allocate the System Interface Register Set */ sc->mps_regs_rid = PCIR_BAR(1); -- cgit v1.1