From owner-freebsd-bugs@FreeBSD.ORG Fri Aug 9 18:10:01 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 982F3549 for ; Fri, 9 Aug 2013 18:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 855E827D2 for ; Fri, 9 Aug 2013 18:10:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r79IA1t5048946 for ; Fri, 9 Aug 2013 18:10:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r79IA1kq048945; Fri, 9 Aug 2013 18:10:01 GMT (envelope-from gnats) Date: Fri, 9 Aug 2013 18:10:01 GMT Message-Id: <201308091810.r79IA1kq048945@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: John Baldwin Subject: Re: kern/181148: [ata] sas expanders not available in 9.2-RC1 [regression] X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: John Baldwin List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Aug 2013 18:10:01 -0000 The following reply was made to PR kern/181148; it has been noted by GNATS. From: John Baldwin To: bug-followup@freebsd.org, harrison@biostat.wisc.edu Cc: scottl@freebsd.org, Doug White 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