2 * Copyright (c) 2007-2019 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 * This guest OS has a very simple purpose. It is responsible for
30 * displaying the login splash, prompting the user for a username and
31 * password, and then querying CP to verify that the password is correct.
32 * If correct, CP will detach the rdev from this guest, and attach it to the
35 * +------------------------------------------------+
36 * | +------------------------------------+ |
38 * | | +--------+ +-------+ +---------+ | +----+|
39 * | | |virt_cpu| |storage| |virt_cons|<--+-->|rdev||
40 * | | +--------+ +-------+ +---------+ | +----+|
44 * | | +--------+ +--------+ +--------+ | |
45 * | | |virt_dev| |virt_dev| |virt_dev| | |
46 * | | +--------+ +--------+ +--------+ | |
47 * | +------------------------------------+ |
49 * | +------------------------------------+ |
51 * | | +--------+ +-------+ +---------+ | +----+|
52 * | | |virt_cpu| |storage| |virt_cons|<--+-->|rdev||
53 * | | +--------+ +-------+ +---------+ | +----+|
57 * | | +--------+ +--------+ +--------+ | |
58 * | | |virt_dev| |virt_dev| |virt_dev| | |
59 * | | +--------+ +--------+ +--------+ | |
60 * | +------------------------------------+ |
66 * | +------------------------------------+ |
67 * | | virt_sys (*LOGIN) | |
68 * | | +--------+ +-------+ +---------+ | |
69 * | | |virt_cpu| |storage| |virt_cons| | |
70 * | | +--------+ +-------+ +---------+ | |
71 * | | +--------+ | +----+|
72 * | | |virt_dev|<--+-->|rdev||
73 * | | +--------+ | +----+|
74 * | | +--------+ | +----+|
75 * | | |virt_dev|<--+-->|rdev||
76 * | | +--------+ | +----+|
77 * | | +--------+ | +----+|
78 * | | |virt_dev|<--+-->|rdev||
79 * | | +--------+ | +----+|
80 * | +------------------------------------+ |
81 * +------------------------------------------------+
84 * In other words, here are the actions that CP takes:
88 * - attach operator console to *LOGIN
91 * - alloc virt sys, virt cpu, virt devices, virt cons, storage
92 * - detach console rdev from *LOGIN
93 * - attach console rdev to virt cons
96 * - free virt sys, virt cpu, virt devices, virt cons, storage
97 * - attach console rdev to *LOGIN
100 * - detach console rdev from virt cons
101 * - attach console rdev to *LOGIN
104 * - detach console rdev from *LOGIN
105 * - attach console rdev to virt cons
108 struct psw disabled_wait
= { .w
= 1, .ea
= 1, .ba
= 1, .ptr
= 0xfafafa, };
109 struct psw enabled_wait
= { .io
= 1, .m
= 1, .w
= 1, .ea
= 1, .ba
= 1, };
111 static struct psw __new_rst
= { .ea
= 1, .ba
= 1, .ptr
= ADDR64(&rst_int
), };
112 static struct psw __new_ext
= { .ea
= 1, .ba
= 1, .ptr
= ADDR64(&ext_int
), };
113 static struct psw __new_svc
= { .ea
= 1, .ba
= 1, .ptr
= ADDR64(&svc_int
), };
114 static struct psw __new_prg
= { .ea
= 1, .ba
= 1, .ptr
= ADDR64(&prg_int
), };
115 static struct psw __new_mch
= { .ea
= 1, .ba
= 1, .ptr
= ADDR64(&mch_int
), };
116 static struct psw __new_io
= { .ea
= 1, .ba
= 1, .ptr
= ADDR64(&io_int
), };
118 static void init_io(void)
124 /* enable all I/O interrupt classes */
137 static void init_mch(void)
143 /* enable Channel-Report-Pending Machine Check Interruption subclass */
151 /* set up interrupt PSWs */
152 memcpy(&psw_rst_new
, &__new_rst
, sizeof(struct psw
));
153 memcpy(&psw_ext_new
, &__new_ext
, sizeof(struct psw
));
154 memcpy(&psw_svc_new
, &__new_svc
, sizeof(struct psw
));
155 memcpy(&psw_prg_new
, &__new_prg
, sizeof(struct psw
));
156 memcpy(&psw_mch_new
, &__new_mch
, sizeof(struct psw
));
157 memcpy(&psw_io_new
, &__new_io
, sizeof(struct psw
));
159 /* enable all 8 I/O classes */
164 /* this enables I/O & MCH interrupts */
165 lpswe(&enabled_wait
);