ips_pci.c (232854) | ips_pci.c (254263) |
---|---|
1/*- 2 * Copyright (c) 2002 Adaptec Inc. 3 * All rights reserved. 4 * 5 * Written by: David Jeffery 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 13 unchanged lines hidden (view full) --- 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2002 Adaptec Inc. 3 * All rights reserved. 4 * 5 * Written by: David Jeffery 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions --- 13 unchanged lines hidden (view full) --- 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * SUCH DAMAGE. 27 */ 28 29#include <sys/cdefs.h> |
30__FBSDID("$FreeBSD: head/sys/dev/ips/ips_pci.c 232854 2012-03-12 08:03:51Z scottl $"); | 30__FBSDID("$FreeBSD: head/sys/dev/ips/ips_pci.c 254263 2013-08-12 23:30:01Z scottl $"); |
31 32#include <dev/ips/ipsreg.h> 33#include <dev/ips/ips.h> 34 35#include <dev/pci/pcireg.h> 36#include <dev/pci/pcivar.h> 37 38static int ips_pci_free(ips_softc_t *sc); --- 15 unchanged lines hidden (view full) --- 54 device_set_desc(dev, "Adaptec ServeRAID Adapter"); 55 return (BUS_PROBE_DEFAULT); 56 } 57 return(ENXIO); 58} 59 60static int ips_pci_attach(device_t dev) 61{ | 31 32#include <dev/ips/ipsreg.h> 33#include <dev/ips/ips.h> 34 35#include <dev/pci/pcireg.h> 36#include <dev/pci/pcivar.h> 37 38static int ips_pci_free(ips_softc_t *sc); --- 15 unchanged lines hidden (view full) --- 54 device_set_desc(dev, "Adaptec ServeRAID Adapter"); 55 return (BUS_PROBE_DEFAULT); 56 } 57 return(ENXIO); 58} 59 60static int ips_pci_attach(device_t dev) 61{ |
62 u_int32_t command; | |
63 ips_softc_t *sc; 64 65 66 if (resource_disabled(device_get_name(dev), device_get_unit(dev))) { 67 device_printf(dev, "device is disabled\n"); 68 /* but return 0 so the !$)$)*!$*) unit isn't reused */ 69 return (0); 70 } --- 19 unchanged lines hidden (view full) --- 90 } else if (pci_get_device(dev) == IPS_MARCO_DEVICE_ID){ 91 sc->ips_adapter_reinit = ips_morpheus_reinit; 92 sc->ips_adapter_intr = ips_morpheus_intr; 93 sc->ips_issue_cmd = ips_issue_morpheus_cmd; 94 sc->ips_poll_cmd = ips_morpheus_poll; 95 } else 96 goto error; 97 /* make sure busmastering is on */ | 62 ips_softc_t *sc; 63 64 65 if (resource_disabled(device_get_name(dev), device_get_unit(dev))) { 66 device_printf(dev, "device is disabled\n"); 67 /* but return 0 so the !$)$)*!$*) unit isn't reused */ 68 return (0); 69 } --- 19 unchanged lines hidden (view full) --- 89 } else if (pci_get_device(dev) == IPS_MARCO_DEVICE_ID){ 90 sc->ips_adapter_reinit = ips_morpheus_reinit; 91 sc->ips_adapter_intr = ips_morpheus_intr; 92 sc->ips_issue_cmd = ips_issue_morpheus_cmd; 93 sc->ips_poll_cmd = ips_morpheus_poll; 94 } else 95 goto error; 96 /* make sure busmastering is on */ |
98 command = pci_read_config(dev, PCIR_COMMAND, 1); 99 command |= PCIM_CMD_BUSMASTEREN; 100 pci_write_config(dev, PCIR_COMMAND, command, 1); | 97 pci_enable_busmaster(dev); |
101 /* seting up io space */ 102 sc->iores = NULL; | 98 /* seting up io space */ 99 sc->iores = NULL; |
103 if(command & PCIM_CMD_MEMEN){ 104 PRINTF(10, "trying MEMIO\n"); 105 if(pci_get_device(dev) == IPS_COPPERHEAD_DEVICE_ID) 106 sc->rid = PCIR_BAR(1); 107 else 108 sc->rid = PCIR_BAR(0); 109 sc->iotype = SYS_RES_MEMORY; 110 sc->iores = bus_alloc_resource_any(dev, sc->iotype, 111 &sc->rid, RF_ACTIVE); 112 } 113 if(!sc->iores && command & PCIM_CMD_PORTEN){ | 100 PRINTF(10, "trying MEMIO\n"); 101 if(pci_get_device(dev) == IPS_COPPERHEAD_DEVICE_ID) 102 sc->rid = PCIR_BAR(1); 103 else 104 sc->rid = PCIR_BAR(0); 105 sc->iotype = SYS_RES_MEMORY; 106 sc->iores = bus_alloc_resource_any(dev, sc->iotype, &sc->rid, 107 RF_ACTIVE); 108 if(!sc->iores){ |
114 PRINTF(10, "trying PORTIO\n"); 115 sc->rid = PCIR_BAR(0); 116 sc->iotype = SYS_RES_IOPORT; 117 sc->iores = bus_alloc_resource_any(dev, sc->iotype, 118 &sc->rid, RF_ACTIVE); 119 } 120 if(sc->iores == NULL){ 121 device_printf(dev, "resource allocation failed\n"); --- 117 unchanged lines hidden --- | 109 PRINTF(10, "trying PORTIO\n"); 110 sc->rid = PCIR_BAR(0); 111 sc->iotype = SYS_RES_IOPORT; 112 sc->iores = bus_alloc_resource_any(dev, sc->iotype, 113 &sc->rid, RF_ACTIVE); 114 } 115 if(sc->iores == NULL){ 116 device_printf(dev, "resource allocation failed\n"); --- 117 unchanged lines hidden --- |