Deleted Added
sdiff udiff text old ( 45791 ) new ( 45796 )
full compact
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 $
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);
109 if (bt->drq)
110 bus_release_resource(dev, SYS_RES_IOPORT, 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
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;
191 int error;
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
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
239 if (bt_init(dev)) {
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 ---