mfi_pci.c (233711) | mfi_pci.c (254263) |
---|---|
1/*- 2 * Copyright (c) 2006 IronPort Systems 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 37 unchanged lines hidden (view full) --- 46 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 48 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 49 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 50 * SUCH DAMAGE. 51 */ 52 53#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2006 IronPort Systems 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 37 unchanged lines hidden (view full) --- 46 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 48 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 49 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 50 * SUCH DAMAGE. 51 */ 52 53#include <sys/cdefs.h> |
54__FBSDID("$FreeBSD: head/sys/dev/mfi/mfi_pci.c 233711 2012-03-30 23:05:48Z ambrisko $"); | 54__FBSDID("$FreeBSD: head/sys/dev/mfi/mfi_pci.c 254263 2013-08-12 23:30:01Z scottl $"); |
55 56/* PCI/PCI-X/PCIe bus interface for the LSI MegaSAS controllers */ 57 58#include "opt_mfi.h" 59 60#include <sys/param.h> 61#include <sys/systm.h> 62#include <sys/kernel.h> --- 119 unchanged lines hidden (view full) --- 182 return (ENXIO); 183} 184 185static int 186mfi_pci_attach(device_t dev) 187{ 188 struct mfi_softc *sc; 189 struct mfi_ident *m; | 55 56/* PCI/PCI-X/PCIe bus interface for the LSI MegaSAS controllers */ 57 58#include "opt_mfi.h" 59 60#include <sys/param.h> 61#include <sys/systm.h> 62#include <sys/kernel.h> --- 119 unchanged lines hidden (view full) --- 182 return (ENXIO); 183} 184 185static int 186mfi_pci_attach(device_t dev) 187{ 188 struct mfi_softc *sc; 189 struct mfi_ident *m; |
190 uint32_t command; | |
191 int count, error; 192 193 sc = device_get_softc(dev); 194 bzero(sc, sizeof(*sc)); 195 sc->mfi_dev = dev; 196 m = mfi_find_ident(dev); 197 sc->mfi_flags = m->flags; 198 | 190 int count, error; 191 192 sc = device_get_softc(dev); 193 bzero(sc, sizeof(*sc)); 194 sc->mfi_dev = dev; 195 m = mfi_find_ident(dev); 196 sc->mfi_flags = m->flags; 197 |
199 /* Verify that the adapter can be set up in PCI space */ 200 command = pci_read_config(dev, PCIR_COMMAND, 2); 201 command |= PCIM_CMD_BUSMASTEREN; 202 pci_write_config(dev, PCIR_COMMAND, command, 2); 203 command = pci_read_config(dev, PCIR_COMMAND, 2); 204 if ((command & PCIM_CMD_BUSMASTEREN) == 0) { 205 device_printf(dev, "Can't enable PCI busmaster\n"); 206 return (ENXIO); 207 } 208 if ((command & PCIM_CMD_MEMEN) == 0) { 209 device_printf(dev, "PCI memory window not available\n"); 210 return (ENXIO); 211 } | 198 /* Ensure busmastering is enabled */ 199 pci_enable_busmaster(dev); |
212 213 /* Allocate PCI registers */ 214 if ((sc->mfi_flags & MFI_FLAGS_1064R) || 215 (sc->mfi_flags & MFI_FLAGS_1078)) { 216 /* 1068/1078: Memory mapped BAR is at offset 0x10 */ 217 sc->mfi_regs_rid = PCIR_BAR(0); 218 } 219 else if ((sc->mfi_flags & MFI_FLAGS_GEN2) || --- 118 unchanged lines hidden --- | 200 201 /* Allocate PCI registers */ 202 if ((sc->mfi_flags & MFI_FLAGS_1064R) || 203 (sc->mfi_flags & MFI_FLAGS_1078)) { 204 /* 1068/1078: Memory mapped BAR is at offset 0x10 */ 205 sc->mfi_regs_rid = PCIR_BAR(0); 206 } 207 else if ((sc->mfi_flags & MFI_FLAGS_GEN2) || --- 118 unchanged lines hidden --- |