dpt_eisa.c (170872) | dpt_eisa.c (241593) |
---|---|
1/*- 2 * Copyright (c) 1997, 2000 Matthew N. Dodd <winter@jurai.net> 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 --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1997, 2000 Matthew N. Dodd <winter@jurai.net> 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 --- 12 unchanged lines hidden (view full) --- 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 */ 27 28#include <sys/cdefs.h> |
29__FBSDID("$FreeBSD: head/sys/dev/dpt/dpt_eisa.c 170872 2007-06-17 05:55:54Z scottl $"); | 29__FBSDID("$FreeBSD: head/sys/dev/dpt/dpt_eisa.c 241593 2012-10-15 16:29:08Z jhb $"); |
30 31#include "opt_eisa.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/module.h> 37#include <sys/lock.h> --- 62 unchanged lines hidden (view full) --- 100 101 return 0; 102} 103 104static int 105dpt_eisa_attach (device_t dev) 106{ 107 dpt_softc_t * dpt; | 30 31#include "opt_eisa.h" 32 33#include <sys/param.h> 34#include <sys/systm.h> 35#include <sys/kernel.h> 36#include <sys/module.h> 37#include <sys/lock.h> --- 62 unchanged lines hidden (view full) --- 100 101 return 0; 102} 103 104static int 105dpt_eisa_attach (device_t dev) 106{ 107 dpt_softc_t * dpt; |
108 int s; | |
109 int error = 0; 110 111 dpt = device_get_softc(dev); 112 dpt->dev = dev; | 108 int error = 0; 109 110 dpt = device_get_softc(dev); 111 dpt->dev = dev; |
112 dpt_alloc(dev); |
|
113 114 dpt->io_rid = 0; 115 dpt->io_type = SYS_RES_IOPORT; 116 dpt->irq_rid = 0; 117 118 error = dpt_alloc_resources(dev); 119 if (error) { 120 goto bad; 121 } 122 | 113 114 dpt->io_rid = 0; 115 dpt->io_type = SYS_RES_IOPORT; 116 dpt->irq_rid = 0; 117 118 error = dpt_alloc_resources(dev); 119 if (error) { 120 goto bad; 121 } 122 |
123 dpt_alloc(dev); 124 | |
125 /* Allocate a dmatag representing the capabilities of this attachment */ | 123 /* Allocate a dmatag representing the capabilities of this attachment */ |
126 /* XXX Should be a child of the EISA bus dma tag */ 127 if (bus_dma_tag_create( /* parent */ NULL, | 124 if (bus_dma_tag_create( /* parent */ bus_get_dma_tag(dev), |
128 /* alignemnt */ 1, 129 /* boundary */ 0, 130 /* lowaddr */ BUS_SPACE_MAXADDR_32BIT, 131 /* highaddr */ BUS_SPACE_MAXADDR, 132 /* filter */ NULL, 133 /* filterarg */ NULL, 134 /* maxsize */ BUS_SPACE_MAXSIZE_32BIT, 135 /* nsegments */ ~0, 136 /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, 137 /* flags */ 0, | 125 /* alignemnt */ 1, 126 /* boundary */ 0, 127 /* lowaddr */ BUS_SPACE_MAXADDR_32BIT, 128 /* highaddr */ BUS_SPACE_MAXADDR, 129 /* filter */ NULL, 130 /* filterarg */ NULL, 131 /* maxsize */ BUS_SPACE_MAXSIZE_32BIT, 132 /* nsegments */ ~0, 133 /* maxsegsz */ BUS_SPACE_MAXSIZE_32BIT, 134 /* flags */ 0, |
138 /* lockfunc */ busdma_lock_mutex, 139 /* lockarg */ &Giant, | 135 /* lockfunc */ NULL, 136 /* lockarg */ NULL, |
140 &dpt->parent_dmat) != 0) { 141 error = ENXIO; 142 goto bad; 143 } 144 | 137 &dpt->parent_dmat) != 0) { 138 error = ENXIO; 139 goto bad; 140 } 141 |
145 s = splcam(); 146 | |
147 if (dpt_init(dpt) != 0) { | 142 if (dpt_init(dpt) != 0) { |
148 splx(s); | |
149 error = ENXIO; 150 goto bad; 151 } 152 153 /* Register with the XPT */ 154 dpt_attach(dpt); 155 | 143 error = ENXIO; 144 goto bad; 145 } 146 147 /* Register with the XPT */ 148 dpt_attach(dpt); 149 |
156 splx(s); 157 158 if (bus_setup_intr(dev, dpt->irq_res, INTR_TYPE_CAM | INTR_ENTROPY, 159 NULL, dpt_intr, dpt, &dpt->ih)) { | 150 if (bus_setup_intr(dev, dpt->irq_res, INTR_TYPE_CAM | INTR_ENTROPY | 151 INTR_MPSAFE, NULL, dpt_intr, dpt, &dpt->ih)) { |
160 device_printf(dev, "Unable to register interrupt handler\n"); 161 error = ENXIO; 162 goto bad; 163 } 164 165 return (error); 166 167 bad: --- 52 unchanged lines hidden --- | 152 device_printf(dev, "Unable to register interrupt handler\n"); 153 error = ENXIO; 154 goto bad; 155 } 156 157 return (error); 158 159 bad: --- 52 unchanged lines hidden --- |