port more changes to make PCI work
[linux-2.4.git] / Documentation / s390 / chandev.8
1 .TH chandev 8
2 .SH NAME
3 channel device layer
4 .Dd December 6, 2000
5 .Os Linux for Zseries
6
7 .SH SYNOPSIS
8 The channel device layer is a layer to provide a consistent interface for
9 configuration & default machine check (devices appearing & disappearing )
10 handling on Linux for s/390 & z/Series channel devices.
11
12
13 s/390 & z/Series channel devices include among others
14
15 .Bl -item
16 .It
17 lcs ( the most common ethernet/token ring/fddi standard on zSeries )
18 .It
19 ctc/escon hi speed like serial link standard on s/390 & z/Series.
20 .It
21 claw used to talk to cisco routers.
22 .It
23 qeth gigabit ethernet.
24 .It
25 osad used by osa/sf to configure osa devices, e.g. to share a osa card between 2 or more vm guests. osad is just added to the channel device layer for completeness, there are no plans at the current time to write a driver to exploit this under linux.
26 .It
27 These devices use two channels one read & one write for configuration &
28 or communication ( & a third channel the data channel in the case of gigabit ethernet ).
29 The motivation behind developing this layer was that there was a lot of
30 duplicate code among the channel device drivers for configuration. 
31 Also the lcs & ctc drivers tended to fight over 3088/08's & 3088/1F's which could 
32 be either 2216/3172 channel attached lcs compatible devices or escon/ctc pipes 
33 between guests & to resolve this fight both device drivers had to be configured 
34 separately,  this is now simplified by doing the configuration in a single place
35 ( the channel device layer ).
36
37 This layer isn't invasive & it is quite okay to use channel drivers
38 which don't use the channel device layer in conjunction with
39 drivers which do.
40 .El
41
42 .SH DESCRIPTION
43 The current setup can be read from /proc/chandev
44 arguments can be entered by...
45 .Bl -enum
46 .It
47 Piping to /proc/chandev.
48 e.g. echo reprobe >/proc/chandev
49 will cause uninitialised channel devices to be probed.
50 .It
51 Entering them into /etc/chandev.conf comments are prefixed with #.
52 .It
53 Or from the boot command line using the 'chandev=' keyword
54 e.g. chandev=noauto,0x0,0x480d;noauto,0x4810,0xffff
55 will allow only devno's 0x480e & 0x480f to be autodetected.
56 .El
57 .Bl -item
58 .It
59 Multiple options can be passed separated by semicolons, no spaces or newlines are allowed between parameters on the kernel parameter line as it complicates parsing, spaces are allowed in /proc/chandev & chandev.conf, newlines are allowed in chandev.conf only. To be consistent with other hotpluggable architectures the script pointed to /proc/sys/kernel/hotplug (normally /sbin/hotplug) will be called automatically on startup or a machine check of a device as follows.
60 /sbin/hotplug chandev <start starting_devnames> <machine_check (devname last/pre_recovery_status) (current/post_recovery_status)>.
61 The chandev layer doesn't open stdin stdout or stderr so it is advisable that you add the following lines to the start of your script, here is a sample script which starts devices as they become available.
62 .It
63 #!/bin/bash
64 .It
65 exec >/dev/console 2>&1 0>&1
66 .It
67 # Uncomment line below for debugging.
68 .It
69 # echo $*
70 .It
71 if [ "$1" = "chandev" ] && [ "$2" = "start" ]
72 .It
73 then
74 .It
75     shift 2
76 .It
77     while [ "$1" != "" ]  && [ "$1" != "machine_check" ]
78 .It
79     do
80 .It
81         isup=`ifconfig $1 2>/dev/null | grep UP`
82 .It
83         if [ "$isup" = "" ]
84 .It
85         then
86 .It
87              ifup $1
88 .It
89         fi
90 .It
91         shift
92 .It
93     done
94 .It
95 fi
96 .It
97 .It
98 e.g. if tr0 & ctc0 were starting up & eth0 & eth1 devices disappeared & eth2 got a revalidate machine check ( which is normally fully recoverable ) nearly simultainously the parameters would be.
99 .It
100 /sbin/hotplug chandev start tr0 ctc0 machine_check eth0 gone gone eth1 gone gone eth2 revalidate good
101 .It
102 This can be used for example to call /etc/rc.d/init.d/network start when a device appears & make the ipldelay kernel boot parameter obselete on native machines or recover from bad machine checks where the default machine check handling isn't adequete. The machine checks that can be presented as parameters are good not_operational no_path revalidate device_gone. Normally you wouldn't want to do anything like stop networking when a device disappears as this is hopefully temporary, I just added it to be complete. The chandev layer waits a few seconds for machine checks to settle before running /sbin/hotplug because several machine checks usually happen at once & the forked scripts would possibly race against each other to shutdown & start resources at the same time & behave rather stupidly.
103 .El
104
105
106
107 valid chandev arguments are <> indicate optional parameters, | indicate a choice.
108
109 .B glossary
110 .Bl -item
111 .It
112 devno: is a 16 bit unsigned number used to uniquely identify a subchannel to a device.
113 .It
114 force list: is a term specific to channel device layer describing a range of devno's to be forced to configure in a particular manner as opposed to autodetect
115 .El
116
117 .B commonly used options
118
119 .Bl -item
120 .It
121
122 .Bl -item
123 .It
124 .B (ctc|escon|lcs|osad|qeth)<devif_num>, 
125 read_devno,write_devno,<data_devno,memory_usage_in_k,port_no/protocol_no,checksum_received_ip_pkts,use_hw_stats>
126 .It
127 devif_num of -1 indicates you don't care what device interface number is chosen, omitting it indicates this is a range of devices for which you want to force to be detected as a particular type, qeth devices can't be forced as a range as it makes no sense for them.
128 The data_devno field is only valid for qeth devices, all parameters including & after memory_usage_in_k can be set optionally, if not set they
129 go to default values. memory_usage_in_k ( 0 the default ) means let the driver choose,checksum_received_ip_pkts & use_hw_stats are set to false
130 .It
131 e.g. ctc0,0x7c00,0x7c01
132 .It
133 Tells the channel layer to force ctc0 if detected to use cuu's 7c00 & 7c01 port,port_no is the relative adapter no on lcs, on ctc/escon this field is the ctc/escon protocol number ( default 0 ), don't do checksumming on received ip packets & as ctc doesn't have hardware stats so it ignores this parameter. This can be used for instance to force a device if it presents bad sense data to the IO layer & thus autodetection fails.
134 .It
135 lcs,0x7c00,0x7d00,4096,-1
136 All devices between 0x7c00 & 7d00 should be detected as lcs, let the driver use 4096k for each instance, don't care what port relative adapter number is chosen, don't checksum received ip packets & use hw stats .
137 .It
138 qeth1,0x7c00,0x7c01,0x7c02
139 .It
140 devif_num=1,read=0x7c00,write=0x7c01,data=0x7c02, don't checksum received ip packets & use hw stats.
141 .El
142 .It
143 .Bl -item
144 .B claw devif_num, 
145 read_devno,write_devno<,memory_usage_in_k,checksum_received_ip_pkts,use_hw_stats,>
146 host_name,adapter_name,api_type
147 .It
148 CLAW currently is not autodetected as the host_name,adapter_name & api_type
149 need to be set up, possibly some convention for setting these automatically
150 may be contrived in the future & auto detection may be done but currently there isn't any.
151 The names host_name,adapter_name,api_type may be 8 upto characters in length,
152 host_name is the name of this host, adapter_name is the name of the adjacent host,
153 api_type may be name 1 to 8 chars in length API & TCPIP are common values.
154 The remainder of the parameters are the same as the description for other ctc escon etc. 
155 .It
156 A typical setup may be
157 .It
158 claw0,0xe00,0xe01,linuxa,rs6k,TCPIP
159 .It
160 .El
161 .Bl -item
162 .It
163 .B add_parms
164 ,chan_type,<lo_devno,hi_devno,>string
165 .It
166 chan_type bitfield 
167 .It
168 ctc=0x1, escon=0x2, lcs=0x4, osad=0x8, qeth=0x10, claw=0x20.
169 .It
170 This is for device driver specific options passed as a string to the driver
171 not dealt with by the channel device layer it can't contain spaces.
172 low_devno & hi_devno are optional parameters to specify a range.
173 The channel device layer doesn't concatenate strings if device ranges overlap,
174 before passing to a device driver.
175 .El
176 .It
177
178 .Bl -item
179 .It
180 .B del_parms
181 <,chan_type,exact_match,lo_devno>
182 .It
183 This deletes some or all device driver specific options not specifying chan_type causes it to delete all the strings. exact_match=1 specifies only to remove driver parms where chan_type is exactly equal exact_match=0 specifies to remove parms where any bit matches chan_type.
184 lo_devno is an optional parameter the delete to only happen if lo_devno matches a lo_devno in one of the ranges.
185 .El
186 .It
187
188 .Bl -item
189 .It
190 .B noauto
191 <,lo_devno,hi_devno>
192 .It
193 Don't probe a range of device numbers for channel devices.
194 .El
195 .It
196
197 .Bl -item
198 .It
199 .B use_devno_names
200 .It
201 Tells the channel layer to assign device names based on the read channel cuu number.
202 .It
203 e.g. a token ring read channel 0x7c00 would have an interface called tr0x7c00 this avoids name collisions on devices.
204 .El
205
206
207 .B power user options
208
209
210 .Bl -item
211
212 .It
213 .Bl -item
214 .It
215 .B del_noauto
216 ,<devno>
217 .It
218  Delete a range or all noauto ranges when devno is within a range.
219 .El
220
221 .It
222 .Bl -item
223 .It
224 .B del_force
225 ,read_devno
226 .It
227 Delete a forced channel device from force list.
228 .El
229
230 .It
231 .Bl -item
232 .It
233 .B dont_use_devno_names
234 .It
235 Opposite to use_devno_names described above.
236 .El
237
238
239 .It
240 .Bl -item
241 .It
242 .B add_model
243 ,chan_type, cu_type, cu_model, dev_type, dev_model, max_port_no, automatic_machine_check_handling
244 .It
245 Tells the channel layer to probe for the device described, -1 for any of the parameters other than chan_type & automatic_machine_check_handling is a wildcard.
246 Set max_port_no to 0 for non lcs devices.
247 .It
248 auto machine check recovery bitfield
249 .It
250 not_operational=0x1, no_path=0x2, revalidate=0x4, gone=0x8
251 .It
252 chan_type bitfield
253 .It
254 ctc=0x1, escon=0x2, lcs=0x4, osad=0x8, qeth=0x10, claw=0x20
255 .El
256 .Bl -item
257 .It
258 .B del_model
259 ,cu_type,cu_model,dev_type,dev_model
260 .It
261 -1 for any parameter is a wildcard.
262 .El
263
264 .Bl -item
265 .It
266 .B del_all_models
267 .It 
268 should be obvious.
269 .El
270 .Bl -item
271 .It
272 .B  non_cautious_auto_detect
273 .It
274 Tells the channel device layer to attempt to auto detect devices even if their type/model pairs don't unambigously identify the device, e.g. 3088/1F's can either be escon CTC's or channel attached 3172 lcs compatible devices. If the wrong device driver attempts to probe these channels there may be big delays on startup or even a kernel lockup, use this option with caution.
275 .El
276 .Bl -item
277 .It
278 .B cautious_auto_detect
279 .It
280  See non_cautious_auto_detect this is the default.
281 .El
282 .Bl -item
283 .It
284 .B auto_msck
285 <,lo_devno>,<hi_devno>,auto_msck_recovery
286 .It
287 This is used to specify the kind of machine check recovery that occurs over a device range.
288 .El
289 .It
290 .Bl -item
291 .It
292 .B del_auto_msck
293 <,devno>
294 .It
295 Delete a range or all machine check recovery ranges when devno is within a range.
296 .El
297 .It
298 .Bl -item
299 .It
300 .B reset_clean
301 .It
302 Resets all model info, forced devices & noauto lists to null.
303 .El
304 .It
305 .Bl -item
306 .It
307 .B reset_conf
308 .It
309 Resets all model info, forced devices & noauto lists back to default settings.
310 .El
311 .It
312 .Bl -item
313 .It
314 .B reset_conf_clean
315 .It
316 Resets all model info, forced devices & noauto lists to empty.
317 .El
318 .It
319 .Bl -item
320 .It
321 .B shutdown
322 <device name|read devno>
323 .It
324 Shuts down a particular device by device name or read devno,
325 deregisters it & releases its interrupts
326 or shuts down all devices if no parameter is used.
327 .El
328 .It
329 .Bl -item
330 .It
331 .B reprobe
332 .It
333 Calls probe method for channels whose interrupts are not owned.
334 .El
335 .It
336 .Bl -item
337 .It
338 .B unregister_probe <probefunc_addr>
339 .It
340 unregisters a single probe function or all of them.
341 .El
342 .Bl -item
343 .It
344 .B unregister_probe_by_chan_type
345 .It
346 unregisters all probe functions which match the chan_type bitfield exactly,
347 useful if you want a configuration to survice a kernel upgrade.
348 .El
349 .Bl -item
350 .It
351 .B read_conf
352 .It
353 Read instructions from /etc/chandev.conf.
354 .El
355 .It
356 .Bl -item
357 .It
358 .B dont_read_conf
359 .It
360 Don't automatically read /etc/chandev.conf on boot.
361 .El
362 .Bl -item
363 .It
364 .B persist 
365 ,chan_type
366 .It
367 Force drivers modules to stay loaded even if no device is found,
368 this is useful for debugging & one wishes to examine debug entries in 
369 /proc/s390dbf/ to find out why a module failed to load.
370 .It
371 e.g.
372 .It
373 persist,-1 forces all devices to persist.
374 .It
375 persist,0 forces all channel devices to be non persistent.
376 .El
377
378 .It
379 e.g the following sequence of commands should be roughly equivalent
380 to rebooting for channel devices.
381 .Bl -item
382 .It
383 shutdown
384 .It
385 reset_conf
386 .It
387 read_conf
388 .It
389 reprobe
390 .El
391 .El
392
393 .SH SEE ALSO
394 .Bl -item
395 .It
396 If you wish to write a driver channel device layer compatible
397 .It
398 /linux/include/asm-s390/chandev.h for the apis which are commented.
399 .It
400 /linux/drivers/s390/misc/chandev.c for the code.
401 .El
402
403 .SH FILES
404 .Bl -item
405 .It
406 .B /proc/chandev
407 .It
408 cat /proc/chandev to see current options chosen.
409 .It
410 echo <command> >/proc/chandev to enter a new command
411 .It
412 .B /etc/chandev.conf 
413 .It
414 A file which can be used to configure the channel 
415 device layer.
416 .It
417 kernel parameters with the 
418 .B 'chandev=' 
419 keyword.
420 .It
421 .B /sbin/hotplug
422 .It 
423 A user script/executable which is run when devices come online "appear"
424 or go offline "disappear".
425 .El
426
427
428 .SH AUTHORS
429 DJ Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
430