This source file includes following definitions.
- scsi_unregister
- scsi_register
- scsi_init
- sd_init
- sd_init1
- sd_attach
- sr_init
- sr_init1
- sr_attach
- st_init
- st_init1
- st_attach
- sg_init
- sg_init1
- sg_attach
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 #include <linux/config.h>
17 #include "../block/blk.h"
18 #include <linux/kernel.h>
19 #include <linux/string.h>
20 #include "scsi.h"
21
22 #ifndef NULL
23 #define NULL 0L
24 #endif
25
26 #define HOSTS_C
27
28 #include "hosts.h"
29
30 #ifdef CONFIG_SCSI_AHA152X
31 #include "aha152x.h"
32 #endif
33
34 #ifdef CONFIG_SCSI_AHA1542
35 #include "aha1542.h"
36 #endif
37
38 #ifdef CONFIG_SCSI_AHA1740
39 #include "aha1740.h"
40 #endif
41
42 #ifdef CONFIG_SCSI_BUSLOGIC
43 #include "buslogic.h"
44 #endif
45
46 #ifdef CONFIG_SCSI_FUTURE_DOMAIN
47 #include "fdomain.h"
48 #endif
49
50 #ifdef CONFIG_SCSI_GENERIC_NCR5380
51 #include "g_NCR5380.h"
52 #endif
53
54 #ifdef CONFIG_SCSI_IN2000
55 #include "in2000.h"
56 #endif
57
58 #ifdef CONFIG_SCSI_PAS16
59 #include "pas16.h"
60 #endif
61
62 #ifdef CONFIG_SCSI_SEAGATE
63 #include "seagate.h"
64 #endif
65
66 #ifdef CONFIG_SCSI_T128
67 #include "t128.h"
68 #endif
69
70 #ifdef CONFIG_SCSI_ULTRASTOR
71 #include "ultrastor.h"
72 #endif
73
74 #ifdef CONFIG_SCSI_7000FASST
75 #include "wd7000.h"
76 #endif
77
78 #ifdef CONFIG_SCSI_DEBUG
79 #include "scsi_debug.h"
80 #endif
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101 #define NO_CONTROLLER {NULL, NULL, NULL, NULL, NULL, NULL, NULL, \
102 NULL, NULL, 0, 0, 0, 0, 0, 0}
103
104
105
106
107
108
109
110
111 Scsi_Host_Template scsi_hosts[] =
112 {
113 #ifdef CONFIG_SCSI_ULTRASTOR
114 ULTRASTOR_14F,
115 #endif
116 #ifdef CONFIG_SCSI_AHA152X
117 AHA152X,
118 #endif
119
120 #ifdef CONFIG_SCSI_BUSLOGIC
121 BUSLOGIC,
122 #endif
123 #ifdef CONFIG_SCSI_AHA1542
124 AHA1542,
125 #endif
126 #ifdef CONFIG_SCSI_AHA1740
127 AHA1740,
128 #endif
129 #ifdef CONFIG_SCSI_FUTURE_DOMAIN
130 FDOMAIN_16X0,
131 #endif
132 #ifdef CONFIG_SCSI_IN2000
133 IN2000,
134 #endif
135 #ifdef CONFIG_SCSI_GENERIC_NCR5380
136 GENERIC_NCR5380,
137 #endif
138 #ifdef CONFIG_SCSI_PAS16
139 MV_PAS16,
140 #endif
141 #ifdef CONFIG_SCSI_SEAGATE
142 SEAGATE_ST0X,
143 #endif
144 #ifdef CONFIG_SCSI_T128
145 TRANTOR_T128,
146 #endif
147 #ifdef CONFIG_SCSI_7000FASST
148 WD7000,
149 #endif
150 #ifdef CONFIG_SCSI_DEBUG
151 SCSI_DEBUG,
152 #endif
153 };
154
155 #define MAX_SCSI_HOSTS (sizeof(scsi_hosts) / sizeof(Scsi_Host_Template))
156
157
158
159
160
161 struct Scsi_Host * scsi_hostlist = NULL;
162
163 static int scsi_init_memory_start = 0;
164
165 int max_scsi_hosts = 0;
166 static int next_host = 0;
167
168 void
169 scsi_unregister(struct Scsi_Host * sh, int j){
170 struct Scsi_Host * shpnt;
171
172 if(((unsigned int) sh) + sizeof(struct Scsi_Host) + j != scsi_init_memory_start)
173 panic("Unable to unregister scsi host");
174 if(scsi_hostlist == sh)
175 scsi_hostlist = NULL;
176 else {
177 shpnt = scsi_hostlist;
178 while(shpnt->next != sh) shpnt = shpnt->next;
179 shpnt->next = shpnt->next->next;
180
181 };
182 next_host--;
183 scsi_init_memory_start = (unsigned int) sh;
184 }
185
186
187
188
189
190 struct Scsi_Host * scsi_register(int i, int j){
191 struct Scsi_Host * retval, *shpnt;
192 retval = (struct Scsi_Host*) scsi_init_memory_start;
193 scsi_init_memory_start += sizeof(struct Scsi_Host) + j;
194 retval->host_busy = 0;
195 retval->host_no = next_host++;
196 retval->host_queue = NULL;
197 retval->host_wait = NULL;
198 retval->last_reset = 0;
199 retval->irq = 0;
200 retval->hostt = &scsi_hosts[i];
201 retval->next = NULL;
202 #ifdef DEBUG
203 printk("Register %x %x: %d %d\n", retval, retval->hostt, i, j);
204 #endif
205
206
207
208 retval->this_id = scsi_hosts[i].this_id;
209 retval->sg_tablesize = scsi_hosts[i].sg_tablesize;
210 retval->unchecked_isa_dma = scsi_hosts[i].unchecked_isa_dma;
211
212 if(!scsi_hostlist)
213 scsi_hostlist = retval;
214 else
215 {
216 shpnt = scsi_hostlist;
217 while(shpnt->next) shpnt = shpnt->next;
218 shpnt->next = retval;
219 }
220
221 return retval;
222 }
223
224 unsigned int
225 scsi_init(unsigned long memory_start,unsigned long memory_end)
226 {
227 static int called = 0;
228 int i, j, count, pcount;
229
230 count = 0;
231
232 if(called) return memory_start;
233
234 scsi_init_memory_start = memory_start;
235 called = 1;
236 for (i = 0; i < MAX_SCSI_HOSTS; ++i)
237 {
238
239
240
241
242
243 pcount = next_host;
244 if ((scsi_hosts[i].detect) &&
245 (scsi_hosts[i].present =
246 scsi_hosts[i].detect(i)))
247 {
248
249
250 if(pcount == next_host) {
251 if(scsi_hosts[i].present > 1)
252 panic("Failure to register low-level scsi driver");
253
254
255 scsi_register(i,0);
256 };
257 for(j = 0; j < scsi_hosts[i].present; j++)
258 printk ("scsi%d : %s\n",
259 count++, scsi_hosts[i].name);
260 }
261 }
262 printk ("scsi : %d hosts.\n", count);
263
264 max_scsi_hosts = count;
265 return scsi_init_memory_start;
266 }
267
268 #ifndef CONFIG_BLK_DEV_SD
269 unsigned long sd_init(unsigned long memory_start, unsigned long memory_end){
270 return memory_start;
271 };
272 unsigned long sd_init1(unsigned long memory_start, unsigned long memory_end){
273 return memory_start;
274 };
275 void sd_attach(Scsi_Device * SDp){
276 };
277 int NR_SD=-1;
278 int MAX_SD=0;
279 #endif
280
281
282 #ifndef CONFIG_BLK_DEV_SR
283 unsigned long sr_init(unsigned long memory_start, unsigned long memory_end){
284 return memory_start;
285 };
286 unsigned long sr_init1(unsigned long memory_start, unsigned long memory_end){
287 return memory_start;
288 };
289 void sr_attach(Scsi_Device * SDp){
290 };
291 int NR_SR=-1;
292 int MAX_SR=0;
293 #endif
294
295
296 #ifndef CONFIG_CHR_DEV_ST
297 unsigned long st_init(unsigned long memory_start, unsigned long memory_end){
298 return memory_start;
299 };
300 unsigned long st_init1(unsigned long memory_start, unsigned long memory_end){
301 return memory_start;
302 };
303 void st_attach(Scsi_Device * SDp){
304 };
305 int NR_ST=-1;
306 int MAX_ST=0;
307 #endif
308
309 #ifndef CONFIG_CHR_DEV_SG
310 unsigned long sg_init(unsigned long memory_start, unsigned long memory_end){
311 return memory_start;
312 };
313 unsigned long sg_init1(unsigned long memory_start, unsigned long memory_end){
314 return memory_start;
315 };
316 void sg_attach(Scsi_Device * SDp){
317 };
318 int NR_SG=-1;
319 int MAX_SG=0;
320 #endif