ida_pci.c (143160) | ida_pci.c (144991) |
---|---|
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 --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> | 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 --- 11 unchanged lines hidden (view full) --- 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 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/sys/dev/ida/ida_pci.c 143160 2005-03-05 18:17:35Z imp $"); | 28__FBSDID("$FreeBSD: head/sys/dev/ida/ida_pci.c 144991 2005-04-13 05:06:57Z mdodd $"); |
29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/module.h> 34 35#include <sys/bio.h> 36#include <sys/bus.h> --- 207 unchanged lines hidden (view full) --- 244 int error, rid; 245 246 command = pci_read_config(dev, PCIR_COMMAND, 1); 247 248 /* 249 * it appears that this board only does MEMIO access. 250 */ 251 if ((command & PCIM_CMD_MEMEN) == 0) { | 29 30#include <sys/param.h> 31#include <sys/systm.h> 32#include <sys/kernel.h> 33#include <sys/module.h> 34 35#include <sys/bio.h> 36#include <sys/bus.h> --- 207 unchanged lines hidden (view full) --- 244 int error, rid; 245 246 command = pci_read_config(dev, PCIR_COMMAND, 1); 247 248 /* 249 * it appears that this board only does MEMIO access. 250 */ 251 if ((command & PCIM_CMD_MEMEN) == 0) { |
252 device_printf(dev, "Only memory mapped I/O is supported\n"); | 252 device_printf(dev, "Only memory mapped I/O is supported\n"); |
253 return (ENXIO); 254 } 255 256 ida = (struct ida_softc *)device_get_softc(dev); 257 ida->dev = dev; 258 ida->cmd = *board->accessor; 259 ida->flags = board->flags; 260 --- 26 unchanged lines hidden (view full) --- 287 &ida->parent_dmat); 288 if (error != 0) { 289 device_printf(dev, "can't allocate DMA tag\n"); 290 ida_free(ida); 291 return (ENOMEM); 292 } 293 294 rid = 0; | 253 return (ENXIO); 254 } 255 256 ida = (struct ida_softc *)device_get_softc(dev); 257 ida->dev = dev; 258 ida->cmd = *board->accessor; 259 ida->flags = board->flags; 260 --- 26 unchanged lines hidden (view full) --- 287 &ida->parent_dmat); 288 if (error != 0) { 289 device_printf(dev, "can't allocate DMA tag\n"); 290 ida_free(ida); 291 return (ENOMEM); 292 } 293 294 rid = 0; |
295 ida->irq_res_type = SYS_RES_IRQ; | 295 ida->irq_res_type = SYS_RES_IRQ; |
296 ida->irq = bus_alloc_resource_any(dev, ida->irq_res_type, &rid, 297 RF_ACTIVE | RF_SHAREABLE); | 296 ida->irq = bus_alloc_resource_any(dev, ida->irq_res_type, &rid, 297 RF_ACTIVE | RF_SHAREABLE); |
298 if (ida->irq == NULL) { 299 ida_free(ida); 300 return (ENOMEM); 301 } | 298 if (ida->irq == NULL) { 299 ida_free(ida); 300 return (ENOMEM); 301 } |
302 error = bus_setup_intr(dev, ida->irq, INTR_TYPE_BIO | INTR_ENTROPY, 303 ida_intr, ida, &ida->ih); 304 if (error) { 305 device_printf(dev, "can't setup interrupt\n"); 306 ida_free(ida); 307 return (ENOMEM); 308 } 309 310 error = ida_init(ida); 311 if (error) { | 302 error = bus_setup_intr(dev, ida->irq, INTR_TYPE_BIO | INTR_ENTROPY, 303 ida_intr, ida, &ida->ih); 304 if (error) { 305 device_printf(dev, "can't setup interrupt\n"); 306 ida_free(ida); 307 return (ENOMEM); 308 } 309 310 error = ida_init(ida); 311 if (error) { |
312 ida_free(ida); 313 return (error); 314 } | 312 ida_free(ida); 313 return (error); 314 } |
315 ida_attach(ida); 316 ida->flags |= IDA_ATTACHED; 317 318 return (0); 319} 320 321DRIVER_MODULE(ida, pci, ida_pci_driver, ida_devclass, 0, 0); | 315 ida_attach(ida); 316 ida->flags |= IDA_ATTACHED; 317 318 return (0); 319} 320 321DRIVER_MODULE(ida, pci, ida_pci_driver, ida_devclass, 0, 0); |