Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / obp / pkg / sun4v-asr / package.fth
CommitLineData
920dae64
AT
1\ ========== Copyright Header Begin ==========================================
2\
3\ Hypervisor Software File: package.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: @(#)package.fth 1.2 06/06/02
43purpose: asr package methods
44copyright: Copyright 2006 Sun Microsystems, Inc. All Rights Reserved
45copyright: Use is subject to license terms.
46
47headerless
48
49alias query-ok<> 0<>
50
51: do-query ( nexus$ unit$ -- status )
52 ['] (query) catch if ( flags )
53 2drop 2drop
54 cmn-error[ " ASR Query Failed" ]cmn-end
55 query-ok exit
56 then ( flags )
57
58 case
59 flag-user-disabled of
60 query-u-dis
61 endof
62 flag-diag-disabled of
63 query-d-dis
64 endof
65 flag-user-disabled flag-diag-disabled or of
66 query-ud-dis
67 endof
68 flag-user-disabled flag-override or of
69 query-ovr
70 endof
71 flag-diag-disabled flag-override or of
72 query-d-dis
73 endof
74 0 of
75 query-ok
76 endof
77 endcase ( status )
78;
79
80external
81
82defer query
83
84headerless
85
86: setup-query ( -- )
87 ['] do-query is query
88;
89
900 value open-state
91
92external
93
94: open ( -- okay? )
95 open-state 0= if
96 1 to open-state
97 (asr-attach)
98 svc-open
99 setup-query
100 then
101 true
102;
103
104: close ( -- ) ;
105
106: update ( key$ rsn$ src func -- status )
107 >r >r ( key$ rsn$ ) ( r: func src )
108 dup max-reason-buf-len > if
109 2drop 2drop r> r> 2drop
110 asr-reason-too-big exit
111 then
112 2over nip 0= if
113 2drop 2drop r> r> 2drop
114 asr-unknown-key exit
115 then
116 r> r> ( key$ rsn$ src func )
117
118 case ( key$ rsn$ src )
119 1 of nip nip (enable) endof ( status )
120 -1 of (disable) endof ( status )
121 endcase
122;
123
124headerless