2 * Linux driver attachment glue for aic7770 based controllers.
4 * Copyright (c) 2000-2003 Adaptec Inc.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer,
12 * without modification.
13 * 2. Redistributions in binary form must reproduce at minimum a disclaimer
14 * substantially similar to the "NO WARRANTY" disclaimer below
15 * ("Disclaimer") and any redistribution must be conditioned upon
16 * including a substantially similar Disclaimer requirement for further
17 * binary redistribution.
18 * 3. Neither the names of the above-listed copyright holders nor the names
19 * of any contributors may be used to endorse or promote products derived
20 * from this software without specific prior written permission.
22 * Alternatively, this software may be distributed under the terms of the
23 * GNU General Public License ("GPL") version 2 as published by the Free
24 * Software Foundation.
27 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR
30 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
31 * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
35 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
36 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 * POSSIBILITY OF SUCH DAMAGES.
39 * $Id: //depot/aic7xxx/linux/drivers/scsi/aic7xxx/aic7770_osm.c#14 $
42 #include "aic7xxx_osm.h"
44 #include <linux/device.h>
45 #include <linux/eisa.h>
48 aic7770_map_registers(struct ahc_softc *ahc, u_int port)
51 * Lock out other contenders for our i/o space.
53 if (request_region(port, AHC_EISA_IOSIZE, "aic7xxx") == 0)
55 ahc->tag = BUS_SPACE_PIO;
56 ahc->bsh.ioport = port;
61 aic7770_map_int(struct ahc_softc *ahc, u_int irq)
67 if ((ahc->flags & AHC_EDGE_INTERRUPT) == 0)
70 error = request_irq(irq, ahc_linux_isr, shared, "aic7xxx", ahc);
72 ahc->platform_data->irq = irq;
78 aic7770_probe(struct device *dev)
80 struct eisa_device *edev = to_eisa_device(dev);
81 u_int eisaBase = edev->base_addr+AHC_EISA_SLOT_OFFSET;
82 struct ahc_softc *ahc;
87 sprintf(buf, "ahc_eisa:%d", eisaBase >> 12);
88 name = malloc(strlen(buf) + 1, M_DEVBUF, M_NOWAIT);
92 ahc = ahc_alloc(&aic7xxx_driver_template, name);
95 error = aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data,
103 dev_set_drvdata(dev, ahc);
105 error = ahc_linux_register_host(ahc, &aic7xxx_driver_template);
110 aic7770_remove(struct device *dev)
112 struct ahc_softc *ahc = dev_get_drvdata(dev);
116 ahc_intr_enable(ahc, FALSE);
123 static struct eisa_device_id aic7770_ids[] = {
124 { "ADP7771", 0 }, /* AHA 274x */
125 { "ADP7756", 1 }, /* AHA 284x BIOS enabled */
126 { "ADP7757", 2 }, /* AHA 284x BIOS disabled */
127 { "ADP7782", 3 }, /* AHA 274x Olivetti OEM */
128 { "ADP7783", 4 }, /* AHA 274x Olivetti OEM (Differential) */
129 { "ADP7770", 5 }, /* AIC7770 generic */
133 static struct eisa_driver aic7770_driver = {
134 .id_table = aic7770_ids,
137 .probe = aic7770_probe,
138 .remove = aic7770_remove,
143 ahc_linux_eisa_init(void)
145 return eisa_driver_register(&aic7770_driver);
149 ahc_linux_eisa_exit(void)
151 eisa_driver_unregister(&aic7770_driver);