Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / obp / pkg / fcode / sysprims.fth
CommitLineData
920dae64
AT
1\ ========== Copyright Header Begin ==========================================
2\
3\ Hypervisor Software File: sysprims.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: @(#)sysprims.fth 2.34 96/04/09
43purpose: FCode token number definitions for system (2-byte) FCodes
44copyright: Copyright 1990 Sun Microsystems, Inc. All Rights Reserved
45
46hex
47\ --- Memory allocation and mapping --------------------------------------
48\ v1 v2 000 1 (reserved - because alocated by single byte fcodes)
49
50v1 v2 001 1 byte-code: obsolete-fcode \ Was dma-alloc ( #bytes -- virtual )
51v1 v2 002 1 byte-code: my-address ( -- physical )
52v1 v2 003 1 byte-code: my-space ( -- space )
53v1 v2 004 1 byte-code: obsolete-fcode \ Was memmap ( physical space size -- virtual )
54v1 v2 005 1 byte-code: free-virtual ( virtual len -- )
55v1 v2 006 1 byte-code: obsolete-fcode \ Was >physical ( virtual -- physical space )
56
57\ 007 1
58\ 008 1
59\ 009 1
60\ 00a 1
61\ 00b 1
62\ 00c 1
63\ 00d 1
64\ 00e 1
65
66v1 v2 00f 1 byte-code: obsolete-fcode \ Was my-params ( -- addr len )
67v1 v2 010 1 byte-code: property ( val-adr val-len name-adr name-len -- )
68 \ Was attribute
69v1 v2 011 1 byte-code: encode-int ( n1 -- adr len )
70 \ Was xdrint
71v1 v2 012 1 byte-code: encode+ ( adr len1 adr len2-- adr len1+2 )
72 \ Was xdr+
73v1 v2 013 1 byte-code: encode-phys ( paddr space -- adr len )
74 \ Was xdrphys
75v1 v2 014 1 byte-code: encode-string ( adr len -- adr' len+1 )
76 \ Was xdrstring
77v2.1 015 1 byte-code: encode-bytes ( adr len -- adr' len+1 )
78 \ Was xdrbytes
79
80\ --- Shorthand Property Creation --------------------------------------
81v1 v2 016 1 byte-code: reg ( physical space size -- )
82v1 v2 017 1 byte-code: obsolete-fcode \ Was intr ( int-level vector -- )
83v1 018 1 byte-code: obsolete-fcode \ driver ( adr len -- )
84v1 v2 019 1 byte-code: model ( adr len -- )
85v1 v2 01a 1 byte-code: device-type ( adr len -- )
86 v2 01b 1 byte-code: parse-2int ( adr len -- address space )
87 \ Was decode-2int
88
89\ --- Driver Installation ------------------------------------------------
90v1 v2 01c 1 byte-code: is-install ( acf -- )
91v1 v2 01d 1 byte-code: is-remove ( acf -- )
92v1 v2 01e 1 byte-code: is-selftest ( acf -- )
93v1 v2 01f 1 byte-code: new-device ( -- )
94
95\ --- Selftest -----------------------------------------------------------
96v1 v2 020 1 byte-code: diagnostic-mode? ( -- flag )
97
98v1 v2 021 1 byte-code: obsolete-fcode \ Was display-status ( n -- )
99v1 v2 022 1 byte-code: memory-test-suite ( adr len -- status)
100v1 v2 023 1 byte-code: obsolete-fcode \ Was group-code ( -- adr )
101v1 v2 024 1 byte-code: mask ( -- adr )
102
103v1 v2 025 1 byte-code: get-msecs ( -- ms )
104v1 v2 026 1 byte-code: ms ( n -- )
105v1 v2 027 1 byte-code: finish-device ( -- )
106
107v3 028 1 byte-code: decode-phys ( adr1 len2 -- adr2 len2 phys.lo..hi )
108v3 029 1 byte-code: push-package ( phandle -- )
109v3 02a 1 byte-code: pop-package ( -- )
110v3 02b 1 byte-code: interpose ( adr len phandle -- )
111\ 02c
112\ 02d
113\ 02e
114\ 02f
115
116 v1 v2 030 1 byte-code: map-low ( phys size -- virt ) \ Was map-sbus
117
118\ --- Sbus Support - now obsolescent
119 v1 v2 031 1 byte-code: sbus-intr>cpu ( sbus-intr# -- cpu-intr# )
120\ v1 v2 037 1 -- [S-Bus support]
121
122\ --- P4 Bus address spaces - (these moved to /dev/p4bus/fcodeprims.fth) -
123\ v1 038 1 -- [P4 Bus support] obsolete
124\ v1 ... -- [P4 Bus support] obsolete
125\ v1 03f 1 -- [P4 Bus support] obsolete
126
127\ --- Interrupts (Think about this!) -------------------------------------
128\ 040 1 byte-code: catch-interrupt ( level vector -- )
129\ 041 1 byte-code: restore-interrupt ( level -- )
130\ 042 1 byte-code: interrupt-occurred? ( -- flag )
131\ 043 1 byte-code: enable-interrupt ( level -- )
132\ 044 1 byte-code: disable-interrupt ( level -- )
133\ 045 1
134\ 046 1
135\ 047 1
136\ 048 1
137\ 049 1
138\ 04a 1
139\ 04b 1
140\ 04c 1
141\ 04d 1
142\ 04e 1
143\ 04f 1
144
145\ TERMINAL/FRAMEBUFFER OPERATIONS (DISPLAY DEVICE FCODES)
146\ --- Terminal emulator values -------------------------------------------
147v1 v2 050 1 byte-code: #lines ( -- n )
148v1 v2 051 1 byte-code: #columns ( -- n )
149v1 v2 052 1 byte-code: line# ( -- n )
150v1 v2 053 1 byte-code: column# ( -- n )
151v1 v2 054 1 byte-code: inverse? ( -- flag )
152v1 v2 055 1 byte-code: inverse-screen? ( -- flag )
153\ v1 056 1 byte-code: frame-buffer-busy? ( -- flag ) \ Obsolete
154
155\ --- Terminal emulation low-level operations ----------------------------
156v1 v2 057 1 byte-code: draw-character ( char -- )
157v1 v2 058 1 byte-code: reset-screen ( -- )
158v1 v2 059 1 byte-code: toggle-cursor ( -- )
159v1 v2 05a 1 byte-code: erase-screen ( -- )
160v1 v2 05b 1 byte-code: blink-screen ( -- )
161v1 v2 05c 1 byte-code: invert-screen ( -- )
162v1 v2 05d 1 byte-code: insert-characters ( n -- )
163v1 v2 05e 1 byte-code: delete-characters ( n -- )
164v1 v2 05f 1 byte-code: insert-lines ( n -- )
165v1 v2 060 1 byte-code: delete-lines ( n -- )
166v1 v2 061 1 byte-code: draw-logo ( line# laddr lwidth lheight -- )
167
168\ --- Frame Buffer Text routines -----------------------------------------
169v1 v2 062 1 byte-code: frame-buffer-adr ( -- addr )
170v1 v2 063 1 byte-code: screen-height ( -- n )
171v1 v2 064 1 byte-code: screen-width ( -- n )
172v1 v2 065 1 byte-code: window-top ( -- n )
173v1 v2 066 1 byte-code: window-left ( -- n )
174
175\ 067 1
176\ 068 1
177\ 069 1
178
179\ --- Font ---------------------------------------------------------------
180v1 v2 06a 1 byte-code: default-font ( -- fntbase chrwidth chrheight fntbytes #1stchr #chrs )
181v1 v2 06b 1 byte-code: set-font ( fntbase chrwidth chrheight fntbytes #1stchr #chrs -- )
182v1 v2 06c 1 byte-code: char-height ( -- n )
183v1 v2 06d 1 byte-code: char-width ( -- n )
184v1 v2 06e 1 byte-code: >font ( char -- adr )
185v1 v2 06f 1 byte-code: fontbytes ( -- n ) \ Bytes/scan line, usu. 2
186
187\ --- 1-bit frame buffer routines ----------------------------------------
188\ The FB1 support package is obsolete in IEEE 1275
189
190v1 v2 070 1 byte-code: obsolete-fcode \ Was fb1-draw-character ( char -- )
191v1 v2 071 1 byte-code: obsolete-fcode \ Was fb1-reset-screen ( -- )
192v1 v2 072 1 byte-code: obsolete-fcode \ Was fb1-toggle-cursor ( -- )
193v1 v2 073 1 byte-code: obsolete-fcode \ Was fb1-erase-screen ( -- )
194v1 v2 074 1 byte-code: obsolete-fcode \ Was fb1-blink-screen ( -- )
195v1 v2 075 1 byte-code: obsolete-fcode \ Was fb1-invert-screen ( -- )
196v1 v2 076 1 byte-code: obsolete-fcode \ Was fb1-insert-characters ( #chars -- )
197v1 v2 077 1 byte-code: obsolete-fcode \ Was fb1-delete-characters ( #chars -- )
198v1 v2 078 1 byte-code: obsolete-fcode \ Was fb1-insert-lines ( #lines -- )
199v1 v2 079 1 byte-code: obsolete-fcode \ Was fb1-delete-lines ( #lines -- )
200v1 v2 07a 1 byte-code: obsolete-fcode \ Was fb1-draw-logo ( line# logoadr lwidth lheight -- )
201v1 v2 07b 1 byte-code: obsolete-fcode \ Was fb1-install ( width height #cols #lines -- )
202v1 v2 07c 1 byte-code: obsolete-fcode \ Was fb1-slide-up ( #lines -- )
203
204\ 07d 1
205\ 07e 1
206\ 07f 1
207
208\ --- 8-bit frame buffer routines ----------------------------------------
209v1 v2 080 1 byte-code: fb8-draw-character ( char -- )
210v1 v2 081 1 byte-code: fb8-reset-screen ( -- )
211v1 v2 082 1 byte-code: fb8-toggle-cursor ( -- )
212v1 v2 083 1 byte-code: fb8-erase-screen ( -- )
213v1 v2 084 1 byte-code: fb8-blink-screen ( -- )
214v1 v2 085 1 byte-code: fb8-invert-screen ( -- )
215v1 v2 086 1 byte-code: fb8-insert-characters ( #chars -- )
216v1 v2 087 1 byte-code: fb8-delete-characters ( #chars -- )
217v1 v2 088 1 byte-code: fb8-insert-lines ( #lines -- )
218v1 v2 089 1 byte-code: fb8-delete-lines ( #lines -- )
219v1 v2 08a 1 byte-code: fb8-draw-logo ( line# ladr lwidth lheight -- )
220v1 v2 08b 1 byte-code: fb8-install ( width height #cols #lines -- )
221
222\ 08c 1
223\ 08d 1
224\ 08e 1
225\ 08f 1
226
227\ --- VME Bus address spaces - (these moved to /dev/vmebus/fcodeprims.fth)
228\ v1 v2 090 1 -- [VME Bus support]
229\ v1 v2 ... -- [VME Bus support]
230\ v1 v2 096 1 -- [VME Bus support]
231
232\ --- NET OPERATIONS -----------------------------------------------------
233\ v1 0a0 1 byte-code: return-buffer
234\ v1 obs 0a1 1 byte-code: xmit-packet ( bufadr #bytes -- #sent )
235\ v1 obs 0a2 1 byte-code: poll-packet ( bufadr #bytes -- #received )
236\ v1 0a3 1 byte-code: local-mac-address ( adr len -- ) \ Driver sets this
237v1 v2 0a4 1 byte-code: mac-address ( -- adr len ) \ System sets this
238
239\ 0a5 1
240\ 0a6 1
241\ 0a7 1
242\ 0a8 1
243\ 0a9 1
244\ 0aa 1
245\ 0ab 1
246\ 0ac 1
247\ 0ad 1
248\ 0ae 1
249\ 0af 1
250
251\ 0b0 1
252\ ...
253\ 0ff 1
254
255\ --- Package and device handling ----------------------------------------
256\ 000 2 (reserved - because alocated by single byte fcodes)
257v2 001 2 byte-code: device-name ( addr len -- )
258v2 002 2 byte-code: my-args ( -- addr len )
259v2 003 2 byte-code: my-self ( -- ihandle )
260v2 004 2 byte-code: find-package ( adr len -- [phandle] ok? )
261v2 005 2 byte-code: open-package ( adr len phandle -- ihandle | 0 )
262v2 006 2 byte-code: close-package ( ihandle -- )
263v2 007 2 byte-code: find-method ( adr len phandle -- [acf] ok? )
264v2 008 2 byte-code: call-package ( acf ihandle -- )
265v2 009 2 byte-code: $call-parent ( adr len -- )
266v2 00a 2 byte-code: my-parent ( -- ihandle )
267v2 00b 2 byte-code: ihandle>phandle ( ihandle -- phandle )
268
269\ 00c 2
270
271v2 00d 2 byte-code: my-unit ( -- offset space )
272v2 00e 2 byte-code: $call-method ( adr len ihandle -- )
273v2 00f 2 byte-code: $open-package ( arg-adr,len name-adr,len -- ihandle | 0 )
274
275\ --- CPU information ----------------------------------------------------
276\ Obs v2 010 2 byte-code: processor-type ( -- processor-type )
277v2 011 2 byte-code: obsolete-fcode \ Was firmware-version ( -- n )
278v2 012 2 byte-code: obsolete-fcode \ Was fcode-version ( -- n )
279
280\ --- Asyncronous support ------------------------------------------------
281v2 013 2 byte-code: alarm ( acf n -- )
282
283\ --- User interface -----------------------------------------------------
284v2 014 2 byte-code: (is-user-word) ( adr len acf -- )
285
286\ --- Interpretation -----------------------------------------------------
287v2 015 2 byte-code: suspend-fcode ( -- )
288
289\ --- Error handling -----------------------------------------------------
290v2 016 2 byte-code: abort ( -- )
291v2 017 2 byte-code: catch ( acf -- error-code )
292v2 018 2 byte-code: throw ( error-code -- )
293v2.1 019 2 byte-code: user-abort ( -- )
294
295\ --- Package attributes -------------------------------------------------
296v2 01a 2 byte-code: get-my-property ( nam-adr nam-len -- [val-adr val-len] failed? )
297 \ Was get-my-attribute
298v2 01b 2 byte-code: decode-int ( val-adr val-len -- n )
299 \ Was xdrtoint
300v2 01c 2 byte-code: decode-string ( val-adr val-len -- adr len )
301 \ Was xdrtostring
302v2 01d 2 byte-code: get-inherited-property ( nam-adr nam-len -- [val-adr val-len] failed? )
303 \ Was get-inherited-attribute
304v2 01e 2 byte-code: delete-property ( nam-adr nam-len -- )
305 \ Was delete-attribute
306v2 01f 2 byte-code: get-package-property ( adr len phandle -- [val-adr val-len] failed? )
307 \ Was get-package-attribute
308
309\ --- aligned, atomic access ---------------------------------------------
310v2 020 2 byte-code: cpeek ( adr -- { byte true } | false )
311v2 021 2 byte-code: wpeek ( adr -- { word true } | false )
312v2 022 2 byte-code: lpeek ( adr -- { long true } | false )
313
314v2 023 2 byte-code: cpoke ( byte adr -- ok? )
315v2 024 2 byte-code: wpoke ( word adr -- ok? )
316v2 025 2 byte-code: lpoke ( long adr -- ok? )
317
318v3 026 2 byte-code: lwflip ( l1 -- l2 )
319v3 027 2 byte-code: lbflip ( l1 -- l2 )
320v3 028 2 byte-code: lbflips ( adr len -- )
321
322\ v2 029 2 byte-code: adr-mask ( n -- )
323\ 02a 2
324\ 02b 2
325\ 02c 2
326\ 02d 2
327
32864\ v3 02e 2 byte-code: rx@ ( xaddr -- o )
32964\ v3 02f 2 byte-code: rx! ( o xaddr -- )
330
331[ifdef] notdef
332\ These FCode Functions are installed in the token tables later, after their
333\ system-dependent implementations are defined. See ./regcodes.fth
334v2 030 2 byte-code: rb@ ( adr -- byte )
335v2 031 2 byte-code: rb! ( byte adr -- )
336v2 032 2 byte-code: rw@ ( adr -- word )
337v2 033 2 byte-code: rw! ( word adr -- )
338v2 034 2 byte-code: rl@ ( adr -- long )
339v2 035 2 byte-code: rl! ( long adr -- )
340[then]
341
342fload ${BP}/pkg/fcode/regcodes.fth
343
344v2 036 2 byte-code: wbflips ( adr len -- ) \ Was wflips
345v2 037 2 byte-code: lwflips ( adr len -- ) \ Was lflips
346
347\ --- probing of subordinate devices
348v2.2 038 2 byte-code: obsolete-fcode \ Was probe ( arg-str reg-str fcode-str -- )
349v2.2 039 2 byte-code: obsolete-fcode \ Was probe-virtual ( arg-str reg-str fcode-adr -- )
350
351\ 03a 2
352v2.3 03b 2 byte-code: child ( phandle -- phandle' )
353v2.3 03c 2 byte-code: peer ( phandle -- phandle' )
354v3 03d 2 byte-code: next-property
355 \ ( adr1 len1 phandle -- false | adr2 len2 true )
356v3 03e 2 byte-code: byte-load ( adr xt -- )
357v3 03f 2 byte-code: set-args ( arg-str unit-str -- )
358
359\ --- parsing argument strings
360v2 040 2 byte-code: left-parse-string ( adr len char -- adrR lenR adrL lenL )