Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / obp / arch / sun4u / config / console.fth
CommitLineData
920dae64
AT
1\ ========== Copyright Header Begin ==========================================
2\
3\ Hypervisor Software File: console.fth
4\
5\ Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
6\
7\ - Do no alter or remove copyright notices
8\
9\ - Redistribution and use of this software in source and binary forms, with
10\ or without modification, are permitted provided that the following
11\ conditions are met:
12\
13\ - Redistribution of source code must retain the above copyright notice,
14\ this list of conditions and the following disclaimer.
15\
16\ - Redistribution in binary form must reproduce the above copyright notice,
17\ this list of conditions and the following disclaimer in the
18\ documentation and/or other materials provided with the distribution.
19\
20\ Neither the name of Sun Microsystems, Inc. or the names of contributors
21\ may be used to endorse or promote products derived from this software
22\ without specific prior written permission.
23\
24\ This software is provided "AS IS," without a warranty of any kind.
25\ ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES,
26\ INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A
27\ PARTICULAR PURPOSE OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN
28\ MICROSYSTEMS, INC. ("SUN") AND ITS LICENSORS SHALL NOT BE LIABLE FOR
29\ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
30\ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN
31\ OR ITS LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR
32\ FOR DIRECT, INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE
33\ DAMAGES, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY,
34\ ARISING OUT OF THE USE OF OR INABILITY TO USE THIS SOFTWARE, EVEN IF
35\ SUN HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
36\
37\ You acknowledge that this software is not designed, licensed or
38\ intended for use in the design, construction, operation or maintenance of
39\ any nuclear facility.
40\
41\ ========== Copyright Header End ============================================
42id: @(#)console.fth 1.5 01/04/06
43purpose:
44copyright: Copyright 1999-2001 Sun Microsystems, Inc. All Rights Reserved
45
46headerless
47
48defer finish-device-hook ( -- ) ' noop is finish-device-hook
49
50headers
51
52overload: finish-device ( -- ) finish-device-hook finish-device ;
53' finish-device 0 h# 127 set-token
54
55headerless
56
57vocabulary console-claimer
58also console-claimer definitions
59
60: make-my-alias ( name$ -- )
61 ['] aliases $vfind if drop exit then ( -- )
62 my-self ihandle>phandle ( name$ phandle )
63 dup " reg" rot get-package-property if ( name$ phandle )
64 3drop ( -- )
65 else ( name$ phandle xdr,len )
66 2drop ( name$ phandle )
67 phandle>devname ( name$ path$ )
68 $devalias ( -- )
69 then
70;
71
72: keyboard$ " keyboard" ;
73: mouse$ " mouse" ;
74
750 value kbd-tmp
760 value mouse-tmp
77
78: install-device-hook ( acf acf -- )
79 ['] finish-device-hook behavior swap do-is
80 to finish-device-hook
81;
82: reset-device-hook ( acf -- )
83 to finish-device-hook
84 finish-device-hook
85;
86
87: install-keyboard-alias ( -- )
88 kbd-tmp reset-device-hook
89 keyboard$ make-my-alias
90;
91: install-mouse-alias ( -- )
92 mouse-tmp reset-device-hook
93 mouse$ make-my-alias
94;
95
96also magic-properties definitions
97headers
98
99overload: name ( xdr,len name$ -- )
100 \ This is horrible, and is here only because using the keyboard and mouse
101 \ properties was considered to be SUN centric as USB code could be written
102 \ by a 3rd party and used as a console on SUN machines, and unless the
103 \ keyboard/mouse properties were formally defined their use was ambiguous.
104 2over decode-string 2swap 2drop
105 2dup keyboard$ $= if
106 2drop ['] install-keyboard-alias ['] kbd-tmp install-device-hook
107 else
108 mouse$ $= if
109 ['] install-mouse-alias ['] mouse-tmp install-device-hook
110 then
111 then
112 name
113;
114
115: keyboard ( 0 0 str$ -- 0 0 )
116 2 pick 0= if
117 keyboard$ make-my-alias
118 then
119;
120
121: mouse ( 0 0 str$ -- 0 0 )
122 2 pick 0= if
123 mouse$ make-my-alias
124 then
125;
126
127previous previous definitions
128
129headerless