ips_pci.c (127135) | ips_pci.c (127205) |
---|---|
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 127135 2004-03-17 17:50:55Z njl $"); | 30__FBSDID("$FreeBSD: head/sys/dev/ips/ips_pci.c 127205 2004-03-19 17:36:47Z scottl $"); |
31 32#include <dev/ips/ips.h> 33 34static int ips_pci_free(ips_softc_t *sc); 35static void ips_intrhook(void *arg); 36 37static int ips_pci_probe(device_t dev) 38{ 39 40 if ((pci_get_vendor(dev) == IPS_VENDOR_ID) && 41 (pci_get_device(dev) == IPS_MORPHEUS_DEVICE_ID)) { 42 device_set_desc(dev, "IBM ServeRAID Adapter"); 43 return 0; 44 } else if ((pci_get_vendor(dev) == IPS_VENDOR_ID) && 45 (pci_get_device(dev) == IPS_COPPERHEAD_DEVICE_ID)) { 46 device_set_desc(dev, "IBM ServeRAID Adapter"); 47 return (0); | 31 32#include <dev/ips/ips.h> 33 34static int ips_pci_free(ips_softc_t *sc); 35static void ips_intrhook(void *arg); 36 37static int ips_pci_probe(device_t dev) 38{ 39 40 if ((pci_get_vendor(dev) == IPS_VENDOR_ID) && 41 (pci_get_device(dev) == IPS_MORPHEUS_DEVICE_ID)) { 42 device_set_desc(dev, "IBM ServeRAID Adapter"); 43 return 0; 44 } else if ((pci_get_vendor(dev) == IPS_VENDOR_ID) && 45 (pci_get_device(dev) == IPS_COPPERHEAD_DEVICE_ID)) { 46 device_set_desc(dev, "IBM ServeRAID Adapter"); 47 return (0); |
48 } | 48 } else if ((pci_get_vendor(dev) == IPS_VENDOR_ID_ADAPTEC) && 49 (pci_get_device(dev) == IPS_MARCO_DEVICE_ID)) { 50 device_set_desc(dev, "Adaptec ServeRAID Adapter"); 51 return (0); 52 } |
49 return(ENXIO); 50} 51 52static int ips_pci_attach(device_t dev) 53{ 54 u_int32_t command; 55 ips_softc_t *sc; 56 --- 15 unchanged lines hidden (view full) --- 72 if(pci_get_device(dev) == IPS_MORPHEUS_DEVICE_ID){ 73 sc->ips_adapter_reinit = ips_morpheus_reinit; 74 sc->ips_adapter_intr = ips_morpheus_intr; 75 sc->ips_issue_cmd = ips_issue_morpheus_cmd; 76 } else if(pci_get_device(dev) == IPS_COPPERHEAD_DEVICE_ID){ 77 sc->ips_adapter_reinit = ips_copperhead_reinit; 78 sc->ips_adapter_intr = ips_copperhead_intr; 79 sc->ips_issue_cmd = ips_issue_copperhead_cmd; | 53 return(ENXIO); 54} 55 56static int ips_pci_attach(device_t dev) 57{ 58 u_int32_t command; 59 ips_softc_t *sc; 60 --- 15 unchanged lines hidden (view full) --- 76 if(pci_get_device(dev) == IPS_MORPHEUS_DEVICE_ID){ 77 sc->ips_adapter_reinit = ips_morpheus_reinit; 78 sc->ips_adapter_intr = ips_morpheus_intr; 79 sc->ips_issue_cmd = ips_issue_morpheus_cmd; 80 } else if(pci_get_device(dev) == IPS_COPPERHEAD_DEVICE_ID){ 81 sc->ips_adapter_reinit = ips_copperhead_reinit; 82 sc->ips_adapter_intr = ips_copperhead_intr; 83 sc->ips_issue_cmd = ips_issue_copperhead_cmd; |
84 } else if (pci_get_device(dev) == IPS_MARCO_DEVICE_ID){ 85 sc->ips_adapter_reinit = ips_morpheus_reinit; 86 sc->ips_adapter_intr = ips_morpheus_intr; 87 sc->ips_issue_cmd = ips_issue_morpheus_cmd; |
|
80 } else 81 goto error; 82 /* make sure busmastering is on */ 83 command = pci_read_config(dev, PCIR_COMMAND, 1); 84 command |= PCIM_CMD_BUSMASTEREN; 85 pci_write_config(dev, PCIR_COMMAND, command, 1); 86 /* seting up io space */ 87 sc->iores = NULL; 88 if(command & PCIM_CMD_MEMEN){ 89 PRINTF(10, "trying MEMIO\n"); | 88 } else 89 goto error; 90 /* make sure busmastering is on */ 91 command = pci_read_config(dev, PCIR_COMMAND, 1); 92 command |= PCIM_CMD_BUSMASTEREN; 93 pci_write_config(dev, PCIR_COMMAND, command, 1); 94 /* seting up io space */ 95 sc->iores = NULL; 96 if(command & PCIM_CMD_MEMEN){ 97 PRINTF(10, "trying MEMIO\n"); |
90 if(pci_get_device(dev) == IPS_MORPHEUS_DEVICE_ID) 91 sc->rid = PCIR_BAR(0); | 98 if(pci_get_device(dev) == IPS_COPPERHEAD_DEVICE_ID) 99 sc->rid = PCIR_BAR(1); |
92 else | 100 else |
93 sc->rid = PCIR_BAR(1); | 101 sc->rid = PCIR_BAR(0); |
94 sc->iotype = SYS_RES_MEMORY; 95 sc->iores = bus_alloc_resource_any(dev, sc->iotype, 96 &sc->rid, RF_ACTIVE); 97 } 98 if(!sc->iores && command & PCIM_CMD_PORTEN){ 99 PRINTF(10, "trying PORTIO\n"); 100 sc->rid = PCIR_BAR(0); 101 sc->iotype = SYS_RES_IOPORT; --- 118 unchanged lines hidden --- | 102 sc->iotype = SYS_RES_MEMORY; 103 sc->iores = bus_alloc_resource_any(dev, sc->iotype, 104 &sc->rid, RF_ACTIVE); 105 } 106 if(!sc->iores && command & PCIM_CMD_PORTEN){ 107 PRINTF(10, "trying PORTIO\n"); 108 sc->rid = PCIR_BAR(0); 109 sc->iotype = SYS_RES_IOPORT; --- 118 unchanged lines hidden --- |