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