xref: /OK3568_Linux_fs/kernel/Documentation/s390/3270.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun===============================
2*4882a593SmuzhiyunIBM 3270 Display System support
3*4882a593Smuzhiyun===============================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunThis file describes the driver that supports local channel attachment
6*4882a593Smuzhiyunof IBM 3270 devices.  It consists of three sections:
7*4882a593Smuzhiyun
8*4882a593Smuzhiyun	* Introduction
9*4882a593Smuzhiyun	* Installation
10*4882a593Smuzhiyun	* Operation
11*4882a593Smuzhiyun
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunIntroduction
14*4882a593Smuzhiyun============
15*4882a593Smuzhiyun
16*4882a593SmuzhiyunThis paper describes installing and operating 3270 devices under
17*4882a593SmuzhiyunLinux/390.  A 3270 device is a block-mode rows-and-columns terminal of
18*4882a593Smuzhiyunwhich I'm sure hundreds of millions were sold by IBM and clonemakers
19*4882a593Smuzhiyuntwenty and thirty years ago.
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunYou may have 3270s in-house and not know it.  If you're using the
22*4882a593SmuzhiyunVM-ESA operating system, define a 3270 to your virtual machine by using
23*4882a593Smuzhiyunthe command "DEF GRAF <hex-address>"  This paper presumes you will be
24*4882a593Smuzhiyundefining four 3270s with the CP/CMS commands:
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun	- DEF GRAF 620
27*4882a593Smuzhiyun	- DEF GRAF 621
28*4882a593Smuzhiyun	- DEF GRAF 622
29*4882a593Smuzhiyun	- DEF GRAF 623
30*4882a593Smuzhiyun
31*4882a593SmuzhiyunYour network connection from VM-ESA allows you to use x3270, tn3270, or
32*4882a593Smuzhiyunanother 3270 emulator, started from an xterm window on your PC or
33*4882a593Smuzhiyunworkstation.  With the DEF GRAF command, an application such as xterm,
34*4882a593Smuzhiyunand this Linux-390 3270 driver, you have another way of talking to your
35*4882a593SmuzhiyunLinux box.
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunThis paper covers installation of the driver and operation of a
38*4882a593Smuzhiyundialed-in x3270.
39*4882a593Smuzhiyun
40*4882a593Smuzhiyun
41*4882a593SmuzhiyunInstallation
42*4882a593Smuzhiyun============
43*4882a593Smuzhiyun
44*4882a593SmuzhiyunYou install the driver by installing a patch, doing a kernel build, and
45*4882a593Smuzhiyunrunning the configuration script (config3270.sh, in this directory).
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunWARNING:  If you are using 3270 console support, you must rerun the
48*4882a593Smuzhiyunconfiguration script every time you change the console's address (perhaps
49*4882a593Smuzhiyunby using the condev= parameter in silo's /boot/parmfile).  More precisely,
50*4882a593Smuzhiyunyou should rerun the configuration script every time your set of 3270s,
51*4882a593Smuzhiyunincluding the console 3270, changes subchannel identifier relative to
52*4882a593Smuzhiyunone another.  ReIPL as soon as possible after running the configuration
53*4882a593Smuzhiyunscript and the resulting /tmp/mkdev3270.
54*4882a593Smuzhiyun
55*4882a593SmuzhiyunIf you have chosen to make tub3270 a module, you add a line to a
56*4882a593Smuzhiyunconfiguration file under /etc/modprobe.d/.  If you are working on a VM
57*4882a593Smuzhiyunvirtual machine, you can use DEF GRAF to define virtual 3270 devices.
58*4882a593Smuzhiyun
59*4882a593SmuzhiyunYou may generate both 3270 and 3215 console support, or one or the
60*4882a593Smuzhiyunother, or neither.  If you generate both, the console type under VM is
61*4882a593Smuzhiyunnot changed.  Use #CP Q TERM to see what the current console type is.
62*4882a593SmuzhiyunUse #CP TERM CONMODE 3270 to change it to 3270.  If you generate only
63*4882a593Smuzhiyun3270 console support, then the driver automatically converts your console
64*4882a593Smuzhiyunat boot time to a 3270 if it is a 3215.
65*4882a593Smuzhiyun
66*4882a593SmuzhiyunIn brief, these are the steps:
67*4882a593Smuzhiyun
68*4882a593Smuzhiyun	1. Install the tub3270 patch
69*4882a593Smuzhiyun	2. (If a module) add a line to a file in `/etc/modprobe.d/*.conf`
70*4882a593Smuzhiyun	3. (If VM) define devices with DEF GRAF
71*4882a593Smuzhiyun	4. Reboot
72*4882a593Smuzhiyun	5. Configure
73*4882a593Smuzhiyun
74*4882a593SmuzhiyunTo test that everything works, assuming VM and x3270,
75*4882a593Smuzhiyun
76*4882a593Smuzhiyun	1. Bring up an x3270 window.
77*4882a593Smuzhiyun	2. Use the DIAL command in that window.
78*4882a593Smuzhiyun	3. You should immediately see a Linux login screen.
79*4882a593Smuzhiyun
80*4882a593SmuzhiyunHere are the installation steps in detail:
81*4882a593Smuzhiyun
82*4882a593Smuzhiyun	1.  The 3270 driver is a part of the official Linux kernel
83*4882a593Smuzhiyun	source.  Build a tree with the kernel source and any necessary
84*4882a593Smuzhiyun	patches.  Then do::
85*4882a593Smuzhiyun
86*4882a593Smuzhiyun		make oldconfig
87*4882a593Smuzhiyun		(If you wish to disable 3215 console support, edit
88*4882a593Smuzhiyun		.config; change CONFIG_TN3215's value to "n";
89*4882a593Smuzhiyun		and rerun "make oldconfig".)
90*4882a593Smuzhiyun		make image
91*4882a593Smuzhiyun		make modules
92*4882a593Smuzhiyun		make modules_install
93*4882a593Smuzhiyun
94*4882a593Smuzhiyun	2. (Perform this step only if you have configured tub3270 as a
95*4882a593Smuzhiyun	module.)  Add a line to a file `/etc/modprobe.d/*.conf` to automatically
96*4882a593Smuzhiyun	load the driver when it's needed.  With this line added, you will see
97*4882a593Smuzhiyun	login prompts appear on your 3270s as soon as boot is complete (or
98*4882a593Smuzhiyun	with emulated 3270s, as soon as you dial into your vm guest using the
99*4882a593Smuzhiyun	command "DIAL <vmguestname>").  Since the line-mode major number is
100*4882a593Smuzhiyun	227, the line to add should be::
101*4882a593Smuzhiyun
102*4882a593Smuzhiyun		alias char-major-227 tub3270
103*4882a593Smuzhiyun
104*4882a593Smuzhiyun	3. Define graphic devices to your vm guest machine, if you
105*4882a593Smuzhiyun	haven't already.  Define them before you reboot (reipl):
106*4882a593Smuzhiyun
107*4882a593Smuzhiyun		- DEFINE GRAF 620
108*4882a593Smuzhiyun		- DEFINE GRAF 621
109*4882a593Smuzhiyun		- DEFINE GRAF 622
110*4882a593Smuzhiyun		- DEFINE GRAF 623
111*4882a593Smuzhiyun
112*4882a593Smuzhiyun	4. Reboot.  The reboot process scans hardware devices, including
113*4882a593Smuzhiyun	3270s, and this enables the tub3270 driver once loaded to respond
114*4882a593Smuzhiyun	correctly to the configuration requests of the next step.  If
115*4882a593Smuzhiyun	you have chosen 3270 console support, your console now behaves
116*4882a593Smuzhiyun	as a 3270, not a 3215.
117*4882a593Smuzhiyun
118*4882a593Smuzhiyun	5. Run the 3270 configuration script config3270.  It is
119*4882a593Smuzhiyun	distributed in this same directory, Documentation/s390, as
120*4882a593Smuzhiyun	config3270.sh.  Inspect the output script it produces,
121*4882a593Smuzhiyun	/tmp/mkdev3270, and then run that script.  This will create the
122*4882a593Smuzhiyun	necessary character special device files and make the necessary
123*4882a593Smuzhiyun	changes to /etc/inittab.
124*4882a593Smuzhiyun
125*4882a593Smuzhiyun	Then notify /sbin/init that /etc/inittab has changed, by issuing
126*4882a593Smuzhiyun	the telinit command with the q operand::
127*4882a593Smuzhiyun
128*4882a593Smuzhiyun		cd Documentation/s390
129*4882a593Smuzhiyun		sh config3270.sh
130*4882a593Smuzhiyun		sh /tmp/mkdev3270
131*4882a593Smuzhiyun		telinit q
132*4882a593Smuzhiyun
133*4882a593Smuzhiyun	This should be sufficient for your first time.  If your 3270
134*4882a593Smuzhiyun	configuration has changed and you're reusing config3270, you
135*4882a593Smuzhiyun	should follow these steps::
136*4882a593Smuzhiyun
137*4882a593Smuzhiyun		Change 3270 configuration
138*4882a593Smuzhiyun		Reboot
139*4882a593Smuzhiyun		Run config3270 and /tmp/mkdev3270
140*4882a593Smuzhiyun		Reboot
141*4882a593Smuzhiyun
142*4882a593SmuzhiyunHere are the testing steps in detail:
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun	1. Bring up an x3270 window, or use an actual hardware 3278 or
145*4882a593Smuzhiyun	3279, or use the 3270 emulator of your choice.  You would be
146*4882a593Smuzhiyun	running the emulator on your PC or workstation.  You would use
147*4882a593Smuzhiyun	the command, for example::
148*4882a593Smuzhiyun
149*4882a593Smuzhiyun		x3270 vm-esa-domain-name &
150*4882a593Smuzhiyun
151*4882a593Smuzhiyun	if you wanted a 3278 Model 4 with 43 rows of 80 columns, the
152*4882a593Smuzhiyun	default model number.  The driver does not take advantage of
153*4882a593Smuzhiyun	extended attributes.
154*4882a593Smuzhiyun
155*4882a593Smuzhiyun	The screen you should now see contains a VM logo with input
156*4882a593Smuzhiyun	lines near the bottom.  Use TAB to move to the bottom line,
157*4882a593Smuzhiyun	probably labeled "COMMAND  ===>".
158*4882a593Smuzhiyun
159*4882a593Smuzhiyun	2. Use the DIAL command instead of the LOGIN command to connect
160*4882a593Smuzhiyun	to one of the virtual 3270s you defined with the DEF GRAF
161*4882a593Smuzhiyun	commands::
162*4882a593Smuzhiyun
163*4882a593Smuzhiyun		dial my-vm-guest-name
164*4882a593Smuzhiyun
165*4882a593Smuzhiyun	3. You should immediately see a login prompt from your
166*4882a593Smuzhiyun	Linux-390 operating system.  If that does not happen, you would
167*4882a593Smuzhiyun	see instead the line "DIALED TO my-vm-guest-name   0620".
168*4882a593Smuzhiyun
169*4882a593Smuzhiyun	To troubleshoot:  do these things.
170*4882a593Smuzhiyun
171*4882a593Smuzhiyun	A. Is the driver loaded?  Use the lsmod command (no operands)
172*4882a593Smuzhiyun	to find out.  Probably it isn't.  Try loading it manually, with
173*4882a593Smuzhiyun	the command "insmod tub3270".  Does that command give error
174*4882a593Smuzhiyun	messages?  Ha!  There's your problem.
175*4882a593Smuzhiyun
176*4882a593Smuzhiyun	B. Is the /etc/inittab file modified as in installation step 3
177*4882a593Smuzhiyun	above?  Use the grep command to find out; for instance, issue
178*4882a593Smuzhiyun	"grep 3270 /etc/inittab".  Nothing found?  There's your
179*4882a593Smuzhiyun	problem!
180*4882a593Smuzhiyun
181*4882a593Smuzhiyun	C. Are the device special files created, as in installation
182*4882a593Smuzhiyun	step 2 above?  Use the ls -l command to find out; for instance,
183*4882a593Smuzhiyun	issue "ls -l /dev/3270/tty620".  The output should start with the
184*4882a593Smuzhiyun	letter "c" meaning character device and should contain "227, 1"
185*4882a593Smuzhiyun	just to the left of the device name.  No such file?  no "c"?
186*4882a593Smuzhiyun	Wrong major number?  Wrong minor number?  There's your
187*4882a593Smuzhiyun	problem!
188*4882a593Smuzhiyun
189*4882a593Smuzhiyun	D. Do you get the message::
190*4882a593Smuzhiyun
191*4882a593Smuzhiyun		 "HCPDIA047E my-vm-guest-name 0620 does not exist"?
192*4882a593Smuzhiyun
193*4882a593Smuzhiyun	If so, you must issue the command "DEF GRAF 620" from your VM
194*4882a593Smuzhiyun	3215 console and then reboot the system.
195*4882a593Smuzhiyun
196*4882a593Smuzhiyun
197*4882a593Smuzhiyun
198*4882a593SmuzhiyunOPERATION.
199*4882a593Smuzhiyun==========
200*4882a593Smuzhiyun
201*4882a593SmuzhiyunThe driver defines three areas on the 3270 screen:  the log area, the
202*4882a593Smuzhiyuninput area, and the status area.
203*4882a593Smuzhiyun
204*4882a593SmuzhiyunThe log area takes up all but the bottom two lines of the screen.  The
205*4882a593Smuzhiyundriver writes terminal output to it, starting at the top line and going
206*4882a593Smuzhiyundown.  When it fills, the status area changes from "Linux Running" to
207*4882a593Smuzhiyun"Linux More...".  After a scrolling timeout of (default) 5 sec, the
208*4882a593Smuzhiyunscreen clears and more output is written, from the top down.
209*4882a593Smuzhiyun
210*4882a593SmuzhiyunThe input area extends from the beginning of the second-to-last screen
211*4882a593Smuzhiyunline to the start of the status area.  You type commands in this area
212*4882a593Smuzhiyunand hit ENTER to execute them.
213*4882a593Smuzhiyun
214*4882a593SmuzhiyunThe status area initializes to "Linux Running" to give you a warm
215*4882a593Smuzhiyunfuzzy feeling.  When the log area fills up and output awaits, it
216*4882a593Smuzhiyunchanges to "Linux More...".  At this time you can do several things or
217*4882a593Smuzhiyunnothing.  If you do nothing, the screen will clear in (default) 5 sec
218*4882a593Smuzhiyunand more output will appear.  You may hit ENTER with nothing typed in
219*4882a593Smuzhiyunthe input area to toggle between "Linux More..." and "Linux Holding",
220*4882a593Smuzhiyunwhich indicates no scrolling will occur.  (If you hit ENTER with "Linux
221*4882a593SmuzhiyunRunning" and nothing typed, the application receives a newline.)
222*4882a593Smuzhiyun
223*4882a593SmuzhiyunYou may change the scrolling timeout value.  For example, the following
224*4882a593Smuzhiyuncommand line::
225*4882a593Smuzhiyun
226*4882a593Smuzhiyun	echo scrolltime=60 > /proc/tty/driver/tty3270
227*4882a593Smuzhiyun
228*4882a593Smuzhiyunchanges the scrolling timeout value to 60 sec.  Set scrolltime to 0 if
229*4882a593Smuzhiyunyou wish to prevent scrolling entirely.
230*4882a593Smuzhiyun
231*4882a593SmuzhiyunOther things you may do when the log area fills up are:  hit PA2 to
232*4882a593Smuzhiyunclear the log area and write more output to it, or hit CLEAR to clear
233*4882a593Smuzhiyunthe log area and the input area and write more output to the log area.
234*4882a593Smuzhiyun
235*4882a593SmuzhiyunSome of the Program Function (PF) and Program Attention (PA) keys are
236*4882a593Smuzhiyunpreassigned special functions.  The ones that are not yield an alarm
237*4882a593Smuzhiyunwhen pressed.
238*4882a593Smuzhiyun
239*4882a593SmuzhiyunPA1 causes a SIGINT to the currently running application.  You may do
240*4882a593Smuzhiyunthe same thing from the input area, by typing "^C" and hitting ENTER.
241*4882a593Smuzhiyun
242*4882a593SmuzhiyunPA2 causes the log area to be cleared.  If output awaits, it is then
243*4882a593Smuzhiyunwritten to the log area.
244*4882a593Smuzhiyun
245*4882a593SmuzhiyunPF3 causes an EOF to be received as input by the application.  You may
246*4882a593Smuzhiyuncause an EOF also by typing "^D" and hitting ENTER.
247*4882a593Smuzhiyun
248*4882a593SmuzhiyunNo PF key is preassigned to cause a job suspension, but you may cause a
249*4882a593Smuzhiyunjob suspension by typing "^Z" and hitting ENTER.  You may wish to
250*4882a593Smuzhiyunassign this function to a PF key.  To make PF7 cause job suspension,
251*4882a593Smuzhiyunexecute the command::
252*4882a593Smuzhiyun
253*4882a593Smuzhiyun	echo pf7=^z > /proc/tty/driver/tty3270
254*4882a593Smuzhiyun
255*4882a593SmuzhiyunIf the input you type does not end with the two characters "^n", the
256*4882a593Smuzhiyundriver appends a newline character and sends it to the tty driver;
257*4882a593Smuzhiyunotherwise the driver strips the "^n" and does not append a newline.
258*4882a593SmuzhiyunThe IBM 3215 driver behaves similarly.
259*4882a593Smuzhiyun
260*4882a593SmuzhiyunPf10 causes the most recent command to be retrieved from the tube's
261*4882a593Smuzhiyuncommand stack (default depth 20) and displayed in the input area.  You
262*4882a593Smuzhiyunmay hit PF10 again for the next-most-recent command, and so on.  A
263*4882a593Smuzhiyuncommand is entered into the stack only when the input area is not made
264*4882a593Smuzhiyuninvisible (such as for password entry) and it is not identical to the
265*4882a593Smuzhiyuncurrent top entry.  PF10 rotates backward through the command stack;
266*4882a593SmuzhiyunPF11 rotates forward.  You may assign the backward function to any PF
267*4882a593Smuzhiyunkey (or PA key, for that matter), say, PA3, with the command::
268*4882a593Smuzhiyun
269*4882a593Smuzhiyun	echo -e pa3=\\033k > /proc/tty/driver/tty3270
270*4882a593Smuzhiyun
271*4882a593SmuzhiyunThis assigns the string ESC-k to PA3.  Similarly, the string ESC-j
272*4882a593Smuzhiyunperforms the forward function.  (Rationale:  In bash with vi-mode line
273*4882a593Smuzhiyunediting, ESC-k and ESC-j retrieve backward and forward history.
274*4882a593SmuzhiyunSuggestions welcome.)
275*4882a593Smuzhiyun
276*4882a593SmuzhiyunIs a stack size of twenty commands not to your liking?  Change it on
277*4882a593Smuzhiyunthe fly.  To change to saving the last 100 commands, execute the
278*4882a593Smuzhiyuncommand::
279*4882a593Smuzhiyun
280*4882a593Smuzhiyun	echo recallsize=100 > /proc/tty/driver/tty3270
281*4882a593Smuzhiyun
282*4882a593SmuzhiyunHave a command you issue frequently?  Assign it to a PF or PA key!  Use
283*4882a593Smuzhiyunthe command::
284*4882a593Smuzhiyun
285*4882a593Smuzhiyun	echo pf24="mkdir foobar; cd foobar" > /proc/tty/driver/tty3270
286*4882a593Smuzhiyun
287*4882a593Smuzhiyunto execute the commands mkdir foobar and cd foobar immediately when you
288*4882a593Smuzhiyunhit PF24.  Want to see the command line first, before you execute it?
289*4882a593SmuzhiyunUse the -n option of the echo command::
290*4882a593Smuzhiyun
291*4882a593Smuzhiyun	echo -n pf24="mkdir foo; cd foo" > /proc/tty/driver/tty3270
292*4882a593Smuzhiyun
293*4882a593Smuzhiyun
294*4882a593Smuzhiyun
295*4882a593SmuzhiyunHappy testing!  I welcome any and all comments about this document, the
296*4882a593Smuzhiyundriver, etc etc.
297*4882a593Smuzhiyun
298*4882a593SmuzhiyunDick Hitt <rbh00@utsglobal.com>
299