1/*- 2 * Copyright (c) 1999,2000 Jonathan Lemon 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 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 * $FreeBSD: head/sys/dev/ida/ida_pci.c 63934 2000-07-27 22:24:44Z jlemon $ |
27 */ 28 29#include <sys/param.h> 30#include <sys/systm.h> 31#include <sys/kernel.h> 32 33#include <sys/bio.h> 34#include <sys/bus.h> --- 190 unchanged lines hidden (view full) --- 225 if ((command & PCIM_CMD_MEMEN) == 0) { 226 device_printf(dev, "Only memory mapped I/O is supported\n"); 227 return (ENXIO); 228 } 229 230 ida = (struct ida_softc *)device_get_softc(dev); 231 ida->dev = dev; 232 |
233 board = ida_pci_match(pci_get_devid(dev)); |
234 if (board == NULL) |
235 board = ida_pci_match(pci_get_subdevice(dev)); |
236 ida->cmd = *board->accessor; 237 238 ida->regs_res_type = SYS_RES_MEMORY; 239 ida->regs_res_id = IDA_PCI_MEMADDR; |
240 if (board->board == IDA_DEVICEID_DEC_SMART) 241 ida->regs_res_id = PCIR_MAPS; 242 |
243 ida->regs = bus_alloc_resource(dev, ida->regs_res_type, 244 &ida->regs_res_id, 0, ~0, 1, RF_ACTIVE); 245 if (ida->regs == NULL) { |
246 device_printf(dev, "can't allocate memory resources\n"); |
247 return (ENOMEM); 248 } 249 250 error = bus_dma_tag_create(/*parent*/NULL, /*alignment*/1, 251 /*boundary*/0, /*lowaddr*/BUS_SPACE_MAXADDR_32BIT, 252 /*highaddr*/BUS_SPACE_MAXADDR, /*filter*/NULL, /*filterarg*/NULL, 253 /*maxsize*/MAXBSIZE, /*nsegments*/IDA_NSEG, 254 /*maxsegsize*/BUS_SPACE_MAXSIZE_32BIT, /*flags*/BUS_DMA_ALLOCNOW, --- 15 unchanged lines hidden (view full) --- 270 error = bus_setup_intr(dev, ida->irq, INTR_TYPE_BIO, 271 ida_intr, ida, &ida->ih); 272 if (error) { 273 device_printf(dev, "can't setup interrupt\n"); 274 ida_free(ida); 275 return (ENOMEM); 276 } 277 |
278 ida->flags = 0; |
279 error = ida_init(ida); 280 if (error) { 281 ida_free(ida); 282 return (error); 283 } 284 ida_attach(ida); |
285 ida->flags |= IDA_ATTACHED; |
286 287 return (0); 288} 289 290DRIVER_MODULE(ida, pci, ida_pci_driver, ida_devclass, 0, 0); |