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 = NULL;
112
113 static Scsi_Host_Template builtin_scsi_hosts[] =
114 {
115 #ifdef CONFIG_SCSI_ULTRASTOR
116 ULTRASTOR_14F,
117 #endif
118 #ifdef CONFIG_SCSI_AHA152X
119 AHA152X,
120 #endif
121
122 #ifdef CONFIG_SCSI_BUSLOGIC
123 BUSLOGIC,
124 #endif
125 #ifdef CONFIG_SCSI_AHA1542
126 AHA1542,
127 #endif
128 #ifdef CONFIG_SCSI_AHA1740
129 AHA1740,
130 #endif
131 #ifdef CONFIG_SCSI_FUTURE_DOMAIN
132 FDOMAIN_16X0,
133 #endif
134 #ifdef CONFIG_SCSI_IN2000
135 IN2000,
136 #endif
137 #ifdef CONFIG_SCSI_GENERIC_NCR5380
138 GENERIC_NCR5380,
139 #endif
140 #ifdef CONFIG_SCSI_PAS16
141 MV_PAS16,
142 #endif
143 #ifdef CONFIG_SCSI_SEAGATE
144 SEAGATE_ST0X,
145 #endif
146 #ifdef CONFIG_SCSI_T128
147 TRANTOR_T128,
148 #endif
149 #ifdef CONFIG_SCSI_7000FASST
150 WD7000,
151 #endif
152 #ifdef CONFIG_SCSI_DEBUG
153 SCSI_DEBUG,
154 #endif
155 };
156
157 #define MAX_SCSI_HOSTS (sizeof(builtin_scsi_hosts) / sizeof(Scsi_Host_Template))
158
159
160
161
162
163 struct Scsi_Host * scsi_hostlist = NULL;
164
165 int max_scsi_hosts = 0;
166 static int next_host = 0;
167
168 void
169 scsi_unregister(struct Scsi_Host * sh){
170 struct Scsi_Host * shpnt;
171 int j;
172
173 j = sh->extra_bytes;
174
175 if(scsi_hostlist == sh)
176 scsi_hostlist = NULL;
177 else {
178 shpnt = scsi_hostlist;
179 while(shpnt->next != sh) shpnt = shpnt->next;
180 shpnt->next = shpnt->next->next;
181 };
182 next_host--;
183 scsi_init_free((char *) sh, sizeof(struct Scsi_Host) + j);
184 }
185
186
187
188
189
190 struct Scsi_Host * scsi_register(Scsi_Host_Template * tpnt, int j){
191 struct Scsi_Host * retval, *shpnt;
192 retval = scsi_init_malloc(sizeof(struct Scsi_Host) + j);
193 retval->host_busy = 0;
194 if(j > 0xffff) panic("Too many extra bytes requested\n");
195 retval->extra_bytes = j;
196 retval->loaded_as_module = scsi_loadable_module_flag;
197 retval->host_no = next_host++;
198 retval->host_queue = NULL;
199 retval->host_wait = NULL;
200 retval->last_reset = 0;
201 retval->irq = 0;
202 retval->hostt = tpnt;
203 retval->next = NULL;
204 #ifdef DEBUG
205 printk("Register %x %x: %d %d\n", retval, retval->hostt, i, j);
206 #endif
207
208
209
210 retval->this_id = tpnt->this_id;
211 retval->sg_tablesize = tpnt->sg_tablesize;
212 retval->unchecked_isa_dma = tpnt->unchecked_isa_dma;
213
214 if(!scsi_hostlist)
215 scsi_hostlist = retval;
216 else
217 {
218 shpnt = scsi_hostlist;
219 while(shpnt->next) shpnt = shpnt->next;
220 shpnt->next = retval;
221 }
222
223 return retval;
224 }
225
226 unsigned int scsi_init()
227 {
228 static int called = 0;
229 int i, j, count, pcount;
230 Scsi_Host_Template * tpnt;
231 count = 0;
232
233 if(called) return 0;
234
235 called = 1;
236 for (tpnt = &builtin_scsi_hosts[0], i = 0; i < MAX_SCSI_HOSTS; ++i, tpnt++)
237 {
238
239
240
241
242
243 pcount = next_host;
244 if ((tpnt->detect) &&
245 (tpnt->present =
246 tpnt->detect(tpnt)))
247 {
248
249
250 if(pcount == next_host) {
251 if(tpnt->present > 1)
252 panic("Failure to register low-level scsi driver");
253
254
255 scsi_register(tpnt,0);
256 };
257 tpnt->next = scsi_hosts;
258 scsi_hosts = tpnt;
259 for(j = 0; j < tpnt->present; j++)
260 printk ("scsi%d : %s\n",
261 count++, tpnt->name);
262 }
263 }
264 printk ("scsi : %d hosts.\n", count);
265
266 max_scsi_hosts = count;
267 return 0;
268 }
269
270 #ifndef CONFIG_BLK_DEV_SD
271 unsigned long sd_init(unsigned long memory_start, unsigned long memory_end){
272 return memory_start;
273 };
274 void sd_init1(){
275 return;
276 };
277 void sd_attach(Scsi_Device * SDp){
278 };
279 int NR_SD=-1;
280 int MAX_SD=0;
281 #endif
282
283
284 #ifndef CONFIG_BLK_DEV_SR
285 unsigned long sr_init(unsigned long memory_start, unsigned long memory_end){
286 return memory_start;
287 };
288 void sr_init1(){
289 return;
290 };
291 void sr_attach(Scsi_Device * SDp){
292 };
293 int NR_SR=-1;
294 int MAX_SR=0;
295 #endif
296
297
298 #ifndef CONFIG_CHR_DEV_ST
299 unsigned long st_init(unsigned long memory_start, unsigned long memory_end){
300 return memory_start;
301 };
302 void st_init1(){
303 return;
304 };
305 void st_attach(Scsi_Device * SDp){
306 };
307 int NR_ST=-1;
308 int MAX_ST=0;
309 #endif
310
311 #ifndef CONFIG_CHR_DEV_SG
312 unsigned long sg_init(unsigned long memory_start, unsigned long memory_end){
313 return memory_start;
314 };
315 void sg_init1(){
316 return;
317 };
318 void sg_attach(Scsi_Device * SDp){
319 };
320 int NR_SG=-1;
321 int MAX_SG=0;
322 #endif