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/sym/sym_hipd.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'sys/dev/sym') diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c index 8dc7361..3ace75b 100644 --- a/sys/dev/sym/sym_hipd.c +++ b/sys/dev/sym/sym_hipd.c @@ -8528,11 +8528,9 @@ sym_pci_attach(device_t dev) /* * Alloc/get/map/retrieve everything that deals with MMIO. */ - if ((command & PCIM_CMD_MEMEN) != 0) { - int regs_id = SYM_PCI_MMIO; - np->mmio_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, - ®s_id, RF_ACTIVE); - } + i = SYM_PCI_MMIO; + np->mmio_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &i, + RF_ACTIVE); if (!np->mmio_res) { device_printf(dev, "failed to allocate MMIO resources\n"); goto attach_failed; @@ -8555,11 +8553,8 @@ sym_pci_attach(device_t dev) * User want us to use normal IO with PCI. * Alloc/get/map/retrieve everything that deals with IO. */ - if ((command & PCI_COMMAND_IO_ENABLE) != 0) { - int regs_id = SYM_PCI_IO; - np->io_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, - ®s_id, RF_ACTIVE); - } + i = SYM_PCI_IO; + np->io_res = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &i, RF_ACTIVE); if (!np->io_res) { device_printf(dev, "failed to allocate IO resources\n"); goto attach_failed; @@ -8571,8 +8566,7 @@ sym_pci_attach(device_t dev) * If the chip has RAM. * Alloc/get/map/retrieve the corresponding resources. */ - if ((np->features & (FE_RAM|FE_RAM8K)) && - (command & PCIM_CMD_MEMEN) != 0) { + if (np->features & (FE_RAM|FE_RAM8K)) { int regs_id = SYM_PCI_RAM; if (np->features & FE_64BIT) regs_id = SYM_PCI_RAM64; -- cgit v1.1