This source file includes following definitions.
- aic7770_map_registers
- aic7770_map_int
- aic7770_probe
- aic7770_remove
- ahc_linux_eisa_init
- ahc_linux_eisa_exit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42 #include "aic7xxx_osm.h"
43
44 #include <linux/device.h>
45 #include <linux/eisa.h>
46
47 int
48 aic7770_map_registers(struct ahc_softc *ahc, u_int port)
49 {
50
51
52
53 if (!request_region(port, AHC_EISA_IOSIZE, "aic7xxx"))
54 return (ENOMEM);
55 ahc->tag = BUS_SPACE_PIO;
56 ahc->bsh.ioport = port;
57 return (0);
58 }
59
60 int
61 aic7770_map_int(struct ahc_softc *ahc, u_int irq)
62 {
63 int error;
64 int shared;
65
66 shared = 0;
67 if ((ahc->flags & AHC_EDGE_INTERRUPT) == 0)
68 shared = IRQF_SHARED;
69
70 error = request_irq(irq, ahc_linux_isr, shared, "aic7xxx", ahc);
71 if (error == 0)
72 ahc->platform_data->irq = irq;
73
74 return (-error);
75 }
76
77 static int
78 aic7770_probe(struct device *dev)
79 {
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;
83 char buf[80];
84 char *name;
85 int error;
86
87 sprintf(buf, "ahc_eisa:%d", eisaBase >> 12);
88 name = kstrdup(buf, GFP_ATOMIC);
89 if (name == NULL)
90 return (ENOMEM);
91 ahc = ahc_alloc(&aic7xxx_driver_template, name);
92 if (ahc == NULL)
93 return (ENOMEM);
94 ahc->dev = dev;
95 error = aic7770_config(ahc, aic7770_ident_table + edev->id.driver_data,
96 eisaBase);
97 if (error != 0) {
98 ahc->bsh.ioport = 0;
99 ahc_free(ahc);
100 return (error);
101 }
102
103 dev_set_drvdata(dev, ahc);
104
105 error = ahc_linux_register_host(ahc, &aic7xxx_driver_template);
106 return (error);
107 }
108
109 static int
110 aic7770_remove(struct device *dev)
111 {
112 struct ahc_softc *ahc = dev_get_drvdata(dev);
113 u_long s;
114
115 if (ahc->platform_data && ahc->platform_data->host)
116 scsi_remove_host(ahc->platform_data->host);
117
118 ahc_lock(ahc, &s);
119 ahc_intr_enable(ahc, FALSE);
120 ahc_unlock(ahc, &s);
121
122 ahc_free(ahc);
123 return 0;
124 }
125
126 static struct eisa_device_id aic7770_ids[] = {
127 { "ADP7771", 0 },
128 { "ADP7756", 1 },
129 { "ADP7757", 2 },
130 { "ADP7782", 3 },
131 { "ADP7783", 4 },
132 { "ADP7770", 5 },
133 { "" }
134 };
135 MODULE_DEVICE_TABLE(eisa, aic7770_ids);
136
137 static struct eisa_driver aic7770_driver = {
138 .id_table = aic7770_ids,
139 .driver = {
140 .name = "aic7xxx",
141 .probe = aic7770_probe,
142 .remove = aic7770_remove,
143 }
144 };
145
146 int
147 ahc_linux_eisa_init(void)
148 {
149 return eisa_driver_register(&aic7770_driver);
150 }
151
152 void
153 ahc_linux_eisa_exit(void)
154 {
155 eisa_driver_unregister(&aic7770_driver);
156 }