Deleted Added
full compact
adv_isa.c (232883) adv_isa.c (241492)
1/*-
2 * Device probe and attach routines for the following
3 * Advanced Systems Inc. SCSI controllers:
4 *
5 * Connectivity Products:
6 * ABP510/5150 - Bus-Master ISA (240 CDB) *
7 * ABP5140 - Bus-Master ISA PnP (16 CDB) * **
8 * ABP5142 - Bus-Master ISA PnP with floppy (16 CDB) ***

--- 32 unchanged lines hidden (view full) ---

41 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
42 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
43 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
44 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45 * SUCH DAMAGE.
46 */
47
48#include <sys/cdefs.h>
1/*-
2 * Device probe and attach routines for the following
3 * Advanced Systems Inc. SCSI controllers:
4 *
5 * Connectivity Products:
6 * ABP510/5150 - Bus-Master ISA (240 CDB) *
7 * ABP5140 - Bus-Master ISA PnP (16 CDB) * **
8 * ABP5142 - Bus-Master ISA PnP with floppy (16 CDB) ***

--- 32 unchanged lines hidden (view full) ---

41 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
42 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
43 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
44 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
45 * SUCH DAMAGE.
46 */
47
48#include <sys/cdefs.h>
49__FBSDID("$FreeBSD: head/sys/dev/advansys/adv_isa.c 232883 2012-03-12 19:29:35Z scottl $");
49__FBSDID("$FreeBSD: head/sys/dev/advansys/adv_isa.c 241492 2012-10-12 21:31:44Z jhb $");
50
51#include <sys/param.h>
52#include <sys/systm.h>
53#include <sys/kernel.h>
54#include <sys/module.h>
55#include <sys/lock.h>
56#include <sys/mutex.h>
57

--- 72 unchanged lines hidden (view full) ---

130 if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &iobase, &iocount) == 0) {
131 user_iobase = 1;
132 for (;port_index <= max_port_index; port_index++)
133 if (iobase <= adv_isa_ioports[port_index])
134 break;
135 if ((port_index > max_port_index)
136 || (iobase != adv_isa_ioports[port_index])) {
137 if (bootverbose)
50
51#include <sys/param.h>
52#include <sys/systm.h>
53#include <sys/kernel.h>
54#include <sys/module.h>
55#include <sys/lock.h>
56#include <sys/mutex.h>
57

--- 72 unchanged lines hidden (view full) ---

130 if (bus_get_resource(dev, SYS_RES_IOPORT, 0, &iobase, &iocount) == 0) {
131 user_iobase = 1;
132 for (;port_index <= max_port_index; port_index++)
133 if (iobase <= adv_isa_ioports[port_index])
134 break;
135 if ((port_index > max_port_index)
136 || (iobase != adv_isa_ioports[port_index])) {
137 if (bootverbose)
138 printf("adv%d: Invalid baseport of 0x%lx specified. "
139 "Nearest valid baseport is 0x%x. Failing "
140 "probe.\n", device_get_unit(dev), iobase,
141 (port_index <= max_port_index) ?
142 adv_isa_ioports[port_index] :
143 adv_isa_ioports[max_port_index]);
138 device_printf(dev,
139 "Invalid baseport of 0x%lx specified. "
140 "Nearest valid baseport is 0x%x. Failing "
141 "probe.\n", iobase,
142 (port_index <= max_port_index) ?
143 adv_isa_ioports[port_index] :
144 adv_isa_ioports[max_port_index]);
144 return ENXIO;
145 }
146 max_port_index = port_index;
147 }
148
149 /* Perform the actual probing */
150 adv_set_isapnp_wait_for_key();
151 for (;port_index <= max_port_index; port_index++) {

--- 12 unchanged lines hidden (view full) ---

164 continue;
165
166 /* XXX what is the real portsize? */
167 iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid,
168 RF_ACTIVE);
169 if (iores == NULL)
170 continue;
171
145 return ENXIO;
146 }
147 max_port_index = port_index;
148 }
149
150 /* Perform the actual probing */
151 adv_set_isapnp_wait_for_key();
152 for (;port_index <= max_port_index; port_index++) {

--- 12 unchanged lines hidden (view full) ---

165 continue;
166
167 /* XXX what is the real portsize? */
168 iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT, &rid,
169 RF_ACTIVE);
170 if (iores == NULL)
171 continue;
172
172 if (adv_find_signature(rman_get_bustag(iores),
173 rman_get_bushandle(iores)) == 0) {
173 if (adv_find_signature(iores) == 0) {
174 bus_release_resource(dev, SYS_RES_IOPORT, 0, iores);
175 continue;
176 }
177
178 /*
179 * Got one. Now allocate our softc
180 * and see if we can initialize the card.
181 */
174 bus_release_resource(dev, SYS_RES_IOPORT, 0, iores);
175 continue;
176 }
177
178 /*
179 * Got one. Now allocate our softc
180 * and see if we can initialize the card.
181 */
182 adv = adv_alloc(dev, rman_get_bustag(iores),
183 rman_get_bushandle(iores));
182 adv = adv_alloc(dev, iores, 0);
184 if (adv == NULL) {
185 bus_release_resource(dev, SYS_RES_IOPORT, 0, iores);
186 break;
187 }
188
189 /*
190 * Stop the chip.
191 */

--- 41 unchanged lines hidden (view full) ---

233 /* lowaddr */ lowaddr,
234 /* highaddr */ BUS_SPACE_MAXADDR,
235 /* filter */ NULL,
236 /* filterarg */ NULL,
237 /* maxsize */ maxsize,
238 /* nsegments */ ~0,
239 /* maxsegsz */ maxsegsz,
240 /* flags */ 0,
183 if (adv == NULL) {
184 bus_release_resource(dev, SYS_RES_IOPORT, 0, iores);
185 break;
186 }
187
188 /*
189 * Stop the chip.
190 */

--- 41 unchanged lines hidden (view full) ---

232 /* lowaddr */ lowaddr,
233 /* highaddr */ BUS_SPACE_MAXADDR,
234 /* filter */ NULL,
235 /* filterarg */ NULL,
236 /* maxsize */ maxsize,
237 /* nsegments */ ~0,
238 /* maxsegsz */ maxsegsz,
239 /* flags */ 0,
241 /* lockfunc */ busdma_lock_mutex,
242 /* lockarg */ &Giant,
240 /* lockfunc */ NULL,
241 /* lockarg */ NULL,
243 &adv->parent_dmat);
244
245 if (error != 0) {
242 &adv->parent_dmat);
243
244 if (error != 0) {
246 printf("%s: Could not allocate DMA tag - error %d\n",
247 adv_name(adv), error);
245 device_printf(dev,
246 "Could not allocate DMA tag - error %d\n", error);
248 adv_free(adv);
249 bus_release_resource(dev, SYS_RES_IOPORT, 0, iores);
250 break;
251 }
252
253 adv->init_level += 2;
254
255 if (overrun_buf == NULL) {

--- 74 unchanged lines hidden (view full) ---

330 bus_set_resource(dev, SYS_RES_IRQ, 0,
331 adv_get_chip_irq(adv), 1);
332 else
333 adv_set_chip_irq(adv, irq);
334
335 irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
336 RF_ACTIVE);
337 if (irqres == NULL ||
247 adv_free(adv);
248 bus_release_resource(dev, SYS_RES_IOPORT, 0, iores);
249 break;
250 }
251
252 adv->init_level += 2;
253
254 if (overrun_buf == NULL) {

--- 74 unchanged lines hidden (view full) ---

329 bus_set_resource(dev, SYS_RES_IRQ, 0,
330 adv_get_chip_irq(adv), 1);
331 else
332 adv_set_chip_irq(adv, irq);
333
334 irqres = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
335 RF_ACTIVE);
336 if (irqres == NULL ||
338 bus_setup_intr(dev, irqres, INTR_TYPE_CAM|INTR_ENTROPY,
339 NULL, adv_intr, adv, &ih)) {
337 bus_setup_intr(dev, irqres, INTR_TYPE_CAM|INTR_ENTROPY|
338 INTR_MPSAFE, NULL, adv_intr, adv, &ih) != 0) {
339 if (irqres != NULL)
340 bus_release_resource(dev, SYS_RES_IRQ, rid,
341 irqres);
340 bus_dmamap_unload(overrun_dmat, overrun_dmamap);
341 bus_dmamem_free(overrun_dmat, overrun_buf,
342 overrun_dmamap);
343 bus_dma_tag_destroy(overrun_dmat);
344 adv_free(adv);
345 bus_release_resource(dev, SYS_RES_IOPORT, 0, iores);
346 break;
347 }

--- 85 unchanged lines hidden ---
342 bus_dmamap_unload(overrun_dmat, overrun_dmamap);
343 bus_dmamem_free(overrun_dmat, overrun_buf,
344 overrun_dmamap);
345 bus_dma_tag_destroy(overrun_dmat);
346 adv_free(adv);
347 bus_release_resource(dev, SYS_RES_IOPORT, 0, iores);
348 break;
349 }

--- 85 unchanged lines hidden ---