|
|
1.1 root 1: \ *****************************************************************************
2: \ * Copyright (c) 2011 IBM Corporation
3: \ * All rights reserved.
4: \ * This program and the accompanying materials
5: \ * are made available under the terms of the BSD License
6: \ * which accompanies this distribution, and is available at
7: \ * http://www.opensource.org/licenses/bsd-license.php
8: \ *
9: \ * Contributors:
10: \ * IBM Corporation - initial implementation
11: \ ****************************************************************************/
12:
13: \ KVM/qemu RTAS
14:
15: \ rtas control block
16:
17: 4d0 cp
18:
19: STRUCT
20: /l field rtas>token
21: /l field rtas>nargs
22: /l field rtas>nret
23: /l field rtas>args0
24: /l field rtas>args1
25: /l field rtas>args2
26: /l field rtas>args3
27: /l field rtas>args4
28: /l field rtas>args5
29: /l field rtas>args6
30: /l field rtas>args7
31: /l C * field rtas>args
32: /l field rtas>bla
33: CONSTANT /rtas-control-block
34:
35: CREATE rtas-cb /rtas-control-block allot
36: rtas-cb /rtas-control-block erase
37:
38: 0 VALUE rtas-base
39: 0 VALUE rtas-size
40: 0 VALUE rtas-entry
41: 0 VALUE rtas-node
42:
43: \ Locate qemu RTAS, remove the linux,... properties we really don't
44: \ want them to stick around
45:
46: 4d1 cp
47:
48: : find-qemu-rtas ( -- )
49: " /rtas" find-device get-node to rtas-node
50:
51: " linux,rtas-base" rtas-node get-package-property IF
52: device-end EXIT THEN
53: drop l@ to rtas-base
54: " linux,rtas-base" delete-property
55:
56: " rtas-size" rtas-node get-package-property IF
57: device-end EXIT THEN
58: drop l@ to rtas-size
59:
60: " linux,rtas-entry" rtas-node get-package-property IF
61: rtas-base to rtas-entry
62: ELSE
63: drop l@ to rtas-entry
64: " linux,rtas-entry" delete-property
65: THEN
66:
67: \ ." RTAS found, base=" rtas-base . ." size=" rtas-size . cr
68:
69: device-end
70: ;
71: find-qemu-rtas
72:
73: 4d2 cp
74:
75: : enter-rtas ( -- )
76: rtas-cb rtas-base 0 rtas-entry call-c drop
77: ;
78:
79: : rtas-get-token ( str len -- token | 0 )
80: rtas-node get-package-property IF 0 ELSE drop l@ THEN
81: ;
82:
83: : rtas-start-cpu ( pid loc r3 -- status )
84: " start-cpu" rtas-get-token rtas-cb rtas>token l!
85: 3 rtas-cb rtas>nargs l!
86: 1 rtas-cb rtas>nret l!
87: rtas-cb rtas>args2 l!
88: rtas-cb rtas>args1 l!
89: rtas-cb rtas>args0 l!
90: 0 rtas-cb rtas>args3 l!
91: enter-rtas
92: rtas-cb rtas>args3 l@
93: ;
94:
95: : rtas-set-tce-bypass ( unit enable -- )
96: " ibm,set-tce-bypass" rtas-get-token rtas-cb rtas>token l!
97: 2 rtas-cb rtas>nargs l!
98: 0 rtas-cb rtas>nret l!
99: rtas-cb rtas>args1 l!
100: rtas-cb rtas>args0 l!
101: enter-rtas
102: ;
103:
104: : rtas-quiesce ( -- )
105: " quiesce" rtas-get-token rtas-cb rtas>token l!
106: 0 rtas-cb rtas>nargs l!
107: 0 rtas-cb rtas>nret l!
108: enter-rtas
109: ;
110:
111: : of-start-cpu rtas-start-cpu ;
112:
113: \ Methods of the rtas node proper
114: rtas-node set-node
115:
116: : open true ;
117: : close ;
118:
119: : instantiate-rtas ( adr -- entry )
120: dup rtas-base swap rtas-size move
121: rtas-entry rtas-base - +
122: ;
123:
124: device-end
125:
126: 4d8 cp
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.