bt_isa.c (45791) | bt_isa.c (45796) |
---|---|
1/* 2 * Product specific probe and attach routines for: 3 * Buslogic BT-54X and BT-445 cards 4 * 5 * Copyright (c) 1998, 1999 Justin T. Gibbs 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * | 1/* 2 * Product specific probe and attach routines for: 3 * Buslogic BT-54X and BT-445 cards 4 * 5 * Copyright (c) 1998, 1999 Justin T. Gibbs 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without --- 12 unchanged lines hidden (view full) --- 21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27 * SUCH DAMAGE. 28 * |
29 * $Id: bt_isa.c,v 1.7 1999/04/06 21:15:18 phk Exp $ | 29 * $Id: bt_isa.c,v 1.8 1999/04/18 15:50:35 peter Exp $ |
30 */ 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/kernel.h> 35#include <sys/module.h> 36#include <sys/bus.h> 37 --- 62 unchanged lines hidden (view full) --- 100static void 101bt_isa_release_resources(device_t dev) 102{ 103 struct bt_softc *bt = device_get_softc(dev); 104 105 if (bt->port) 106 bus_release_resource(dev, SYS_RES_IOPORT, 0, bt->port); 107 if (bt->irq) | 30 */ 31 32#include <sys/param.h> 33#include <sys/systm.h> 34#include <sys/kernel.h> 35#include <sys/module.h> 36#include <sys/bus.h> 37 --- 62 unchanged lines hidden (view full) --- 100static void 101bt_isa_release_resources(device_t dev) 102{ 103 struct bt_softc *bt = device_get_softc(dev); 104 105 if (bt->port) 106 bus_release_resource(dev, SYS_RES_IOPORT, 0, bt->port); 107 if (bt->irq) |
108 bus_release_resource(dev, SYS_RES_IOPORT, 0, bt->irq); | 108 bus_release_resource(dev, SYS_RES_IRQ, 0, bt->irq); |
109 if (bt->drq) | 109 if (bt->drq) |
110 bus_release_resource(dev, SYS_RES_IOPORT, 0, bt->drq); | 110 bus_release_resource(dev, SYS_RES_DRQ, 0, bt->drq); |
111 bt_free_softc(dev); 112} 113 114/* 115 * Check if the device can be found at the port given 116 * and if so, set it up ready for further work 117 * as an argument, takes the isa_device structure from 118 * autoconf.c --- 45 unchanged lines hidden (view full) --- 164 printf("bt_isa_probe: Probe failed for card at 0x%x\n", 165 ioport); 166 bt_isa_release_resources(dev); 167 continue; 168 } 169 170 bt_isa_release_resources(dev); 171 | 111 bt_free_softc(dev); 112} 113 114/* 115 * Check if the device can be found at the port given 116 * and if so, set it up ready for further work 117 * as an argument, takes the isa_device structure from 118 * autoconf.c --- 45 unchanged lines hidden (view full) --- 164 printf("bt_isa_probe: Probe failed for card at 0x%x\n", 165 ioport); 166 bt_isa_release_resources(dev); 167 continue; 168 } 169 170 bt_isa_release_resources(dev); 171 |
172 isa_set_port(dev, ioport); |
|
172 isa_set_drq(dev, info.drq); 173 isa_set_irq(dev, info.irq); 174 175 return (0); 176 } 177 178 return (ENXIO); 179} 180 181/* 182 * Attach all the sub-devices we can find 183 */ 184static int 185bt_isa_attach(device_t dev) 186{ 187 struct bt_softc *bt = device_get_softc(dev); 188 bus_dma_filter_t *filter; 189 void *filter_arg; 190 bus_addr_t lowaddr; | 173 isa_set_drq(dev, info.drq); 174 isa_set_irq(dev, info.irq); 175 176 return (0); 177 } 178 179 return (ENXIO); 180} 181 182/* 183 * Attach all the sub-devices we can find 184 */ 185static int 186bt_isa_attach(device_t dev) 187{ 188 struct bt_softc *bt = device_get_softc(dev); 189 bus_dma_filter_t *filter; 190 void *filter_arg; 191 bus_addr_t lowaddr; |
191 int error; | 192 int error, drq; |
192 193 /* Initialise softc */ 194 error = bt_isa_alloc_resources(dev); 195 if (error) { 196 device_printf(dev, "can't allocate resources in bt_isa_attach\n"); 197 return error; 198 } 199 | 193 194 /* Initialise softc */ 195 error = bt_isa_alloc_resources(dev); 196 if (error) { 197 device_printf(dev, "can't allocate resources in bt_isa_attach\n"); 198 return error; 199 } 200 |
201 /* Program the DMA channel for external control */ 202 if ((drq = isa_get_drq(dev)) != -1) 203 isa_dmacascade(drq); 204 |
|
200 /* Allocate our parent dmatag */ 201 filter = NULL; 202 filter_arg = NULL; 203 lowaddr = BUS_SPACE_MAXADDR_24BIT; 204 if (bt->model[0] == '4') { 205 /* 206 * This is a VL adapter. Typically, VL devices have access 207 * to the full 32bit address space. On BT-445S adapters --- 23 unchanged lines hidden (view full) --- 231 /*maxsize*/BUS_SPACE_MAXSIZE_32BIT, 232 /*nsegments*/BUS_SPACE_UNRESTRICTED, 233 /*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT, 234 /*flags*/0, &bt->parent_dmat) != 0) { 235 bt_isa_release_resources(dev); 236 return (ENOMEM); 237 } 238 | 205 /* Allocate our parent dmatag */ 206 filter = NULL; 207 filter_arg = NULL; 208 lowaddr = BUS_SPACE_MAXADDR_24BIT; 209 if (bt->model[0] == '4') { 210 /* 211 * This is a VL adapter. Typically, VL devices have access 212 * to the full 32bit address space. On BT-445S adapters --- 23 unchanged lines hidden (view full) --- 236 /*maxsize*/BUS_SPACE_MAXSIZE_32BIT, 237 /*nsegments*/BUS_SPACE_UNRESTRICTED, 238 /*maxsegsz*/BUS_SPACE_MAXSIZE_32BIT, 239 /*flags*/0, &bt->parent_dmat) != 0) { 240 bt_isa_release_resources(dev); 241 return (ENOMEM); 242 } 243 |
239 if (bt_init(dev)) { | 244 error = bt_init(dev); 245 if (error) { |
240 bt_isa_release_resources(dev); 241 return (ENOMEM); 242 } 243 244 if (lowaddr != BUS_SPACE_MAXADDR_32BIT) { 245 /* DMA tag for our sense buffers */ 246 if (bus_dma_tag_create(bt->parent_dmat, /*alignment*/0, 247 /*boundary*/0, --- 87 unchanged lines hidden --- | 246 bt_isa_release_resources(dev); 247 return (ENOMEM); 248 } 249 250 if (lowaddr != BUS_SPACE_MAXADDR_32BIT) { 251 /* DMA tag for our sense buffers */ 252 if (bus_dma_tag_create(bt->parent_dmat, /*alignment*/0, 253 /*boundary*/0, --- 87 unchanged lines hidden --- |