ips_pci.c (119690) | ips_pci.c (119997) |
---|---|
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 119690 2003-09-02 17:30:40Z jhb $"); | 30__FBSDID("$FreeBSD: head/sys/dev/ips/ips_pci.c 119997 2003-09-11 23:30:28Z ps $"); |
31 32#include <dev/ips/ips.h> 33 34static int ips_pci_free(ips_softc_t *sc); | 31 32#include <dev/ips/ips.h> 33 34static int ips_pci_free(ips_softc_t *sc); |
35static void ips_intrhook(void *arg); |
|
35 36static int ips_pci_probe(device_t dev) 37{ 38 39 if ((pci_get_vendor(dev) == IPS_VENDOR_ID) && 40 (pci_get_device(dev) == IPS_MORPHEUS_DEVICE_ID)) { 41 device_set_desc(dev, "IBM ServeRAID Adapter"); 42 return 0; --- 84 unchanged lines hidden (view full) --- 127 /* maxsegsize*/ BUS_SPACE_MAXSIZE_32BIT, 128 /* flags */ 0, 129 /* lockfunc */ busdma_lock_mutex, 130 /* lockarg */ &Giant, 131 &sc->adapter_dmatag) != 0) { 132 printf("IPS can't alloc dma tag\n"); 133 goto error; 134 } | 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; --- 84 unchanged lines hidden (view full) --- 128 /* maxsegsize*/ BUS_SPACE_MAXSIZE_32BIT, 129 /* flags */ 0, 130 /* lockfunc */ busdma_lock_mutex, 131 /* lockarg */ &Giant, 132 &sc->adapter_dmatag) != 0) { 133 printf("IPS can't alloc dma tag\n"); 134 goto error; 135 } |
135 if(ips_adapter_init(sc)) | 136 sc->ips_ich.ich_func = ips_intrhook; 137 sc->ips_ich.ich_arg = sc; 138 if (config_intrhook_establish(&sc->ips_ich) != 0) { 139 printf("IPS can't establish configuration hook\n"); |
136 goto error; | 140 goto error; |
137 sc->configured = 1; | 141 } |
138 return 0; 139error: 140 ips_pci_free(sc); 141 return (ENXIO); 142} 143 | 142 return 0; 143error: 144 ips_pci_free(sc); 145 return (ENXIO); 146} 147 |
148static void 149ips_intrhook(void *arg) 150{ 151 struct ips_softc *sc = (struct ips_softc *)arg; 152 153 config_intrhook_disestablish(&sc->ips_ich); 154 if (ips_adapter_init(sc)) 155 ips_pci_free(sc); 156 else 157 sc->configured = 1; 158} 159 |
|
144static int ips_pci_free(ips_softc_t *sc) 145{ 146 if(sc->adapter_dmatag) 147 bus_dma_tag_destroy(sc->adapter_dmatag); 148 if(sc->irqcookie) 149 bus_teardown_intr(sc->dev, sc->irqres, sc->irqcookie); 150 if(sc->irqres) 151 bus_release_resource(sc->dev, SYS_RES_IRQ, sc->irqrid, sc->irqres); --- 47 unchanged lines hidden --- | 160static int ips_pci_free(ips_softc_t *sc) 161{ 162 if(sc->adapter_dmatag) 163 bus_dma_tag_destroy(sc->adapter_dmatag); 164 if(sc->irqcookie) 165 bus_teardown_intr(sc->dev, sc->irqres, sc->irqcookie); 166 if(sc->irqres) 167 bus_release_resource(sc->dev, SYS_RES_IRQ, sc->irqrid, sc->irqres); --- 47 unchanged lines hidden --- |