kern/181148: [ata] sas expanders not available in 9.2-RC1 [regression]

John Baldwin jhb at freebsd.org
Fri Aug 9 18:10:01 UTC 2013


The following reply was made to PR kern/181148; it has been noted by GNATS.

From: John Baldwin <jhb at freebsd.org>
To: bug-followup at freebsd.org,
 harrison at biostat.wisc.edu
Cc: scottl at freebsd.org,
 Doug White <dwhite at freebsd.org>
Subject: Re: kern/181148: [ata] sas expanders not available in 9.2-RC1 [regression]
Date: Fri, 9 Aug 2013 14:05:46 -0400

 The mps(4) driver is just broken.  9.2 includes a fix that if your BIOS 
 writers can't do simple math and allocate conflicting resources, it disables 
 decoding of the device where it finds the conflict.  Later if a device driver 
 expicitly asks to use that resource, the PCI bus will allocate a fresh 
 resource range that doesn't conflict if possible.  If it suceeds it re-enables 
 decoding.  The mps(4) driver checks to see if decoding is enabled before it 
 calls bus_alloc_resource().  It should not.  It should assume that if 
 bus_alloc_resource() succeeds, everything is fine and decoding will be 
 enabled.  Try this fix:
 
 Index: mps_pci.c
 ===================================================================
 --- mps_pci.c	(revision 254147)
 +++ mps_pci.c	(working copy)
 @@ -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);
 
 -- 
 John Baldwin


More information about the freebsd-bugs mailing list