Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / obp / obp / dev / southbridge / isa / isa.fth
CommitLineData
920dae64
AT
1\ ========== Copyright Header Begin ==========================================
2\
3\ Hypervisor Software File: isa.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: @(#)isa.fth 1.7 02/05/24
43purpose:
44copyright: Copyright 1996-2002 Sun Microsystems, Inc. All Rights Reserved
45copyright: Use is subject to license terms.
46
47headers
48
49" isa" encode-string " name" property
50
512 encode-int " #address-cells" property
521 encode-int " #size-cells" property
53
54external
55: config-b@ ( offset -- b ) " config-b@" $call-parent ;
56: config-w@ ( offset -- w ) " config-w@" $call-parent ;
57: config-l@ ( offset -- l ) " config-l@" $call-parent ;
58
59: config-b! ( b offset -- ) " config-b!" $call-parent ;
60: config-w! ( w offset -- ) " config-w!" $call-parent ;
61: config-l! ( l offset -- ) " config-l!" $call-parent ;
62
63headers
64: my-b@ ( offset -- b ) my-space or config-b@ ;
65: my-w@ ( offset -- w ) my-space or config-w@ ;
66: my-l@ ( offset -- l ) my-space or config-l@ ;
67
68: my-b! ( b offset -- ) my-space or config-b! ;
69: my-w! ( w offset -- ) my-space or config-w! ;
70: my-l! ( l offset -- ) my-space or config-l! ;
71
72: en+ encode-int encode+ ;
73: 0+ 0 en+ ;
74
750 0 encode-bytes
76my-space en+ 0+ 0+ 0+ 0+
77my-space h# 8100.0010 or en+ 0+ 0+ 0+ h# 1.0000 en+ \ IO
78my-space h# 8200.0014 or en+ 0+ 0+ 0+ h# 10.0000 en+ \ 1meg memory
79[ifdef] isa-flashprom?
80my-space h# 8200.0018 or en+ 0+ h# f000.0000 en+ 0+ h# 10.0000 en+ \ flashprom
81[then]
82" reg" property
83
840 0 encode-bytes
850+ 0+ my-space h# 8100.0010 or en+ 0+ 0+ h# 1.0000 en+
861 en+ 0+ my-space h# 8200.0014 or en+ 0+ 0+ h# 10.0000 en+
87[ifdef] isa-flashprom?
882 en+ 0+ my-space h# 8200.0018 or en+ 0+ h# f000.0000 en+ h# 10.0000 en+
89[then]
90" ranges" property
91
92alias sb@ my-b@
93alias sb! my-b!
94
95external
96
97\ Southbridge does not really have the base registers, se we
98\ need to fake them.
99: map-in ( pa.lo pa.hi len -- va )
100 >r case ( lo )
101 0 of h# 10 h# 81 0 endof ( lo bar type off )
102 1 of h# 14 h# 82 0 endof ( lo bar type off )
103 2 of h# 18 h# 82 h# f000.0000 endof ( lo bar type off )
104 endcase ( lo bar type off )
105 >r d# 24 lshift ( lo bar type' )
106 my-space or or ( lo hi )
107 swap r> + 0 rot r> ( lo' 0 hi len )
108 " map-in" $call-parent ( va )
109;
110
111: map-out ( va len -- ) " map-out" $call-parent ;
112
113: dma-alloc ( n -- vaddr ) " dma-alloc" $call-parent ;
114: dma-free ( vaddr n -- ) " dma-free" $call-parent ;
115
116: dma-map-in ( vaddr n cache? -- devaddr ) " dma-map-in" $call-parent ;
117: dma-map-out ( vaddr devaddr n -- ) " dma-map-out" $call-parent ;
118
119: dma-sync ( vaddr devaddr n -- )
120 " dma-sync" ['] $call-parent
121 catch if
122 2drop 3drop \ no parent dma-sync, and none needed
123 then
124;
125
126: decode-unit parse-2int ;
127: encode-unit ( l h -- ) swap <# u#s drop ascii , hold u#s u#> ;
128: open ( -- ok? ) true ;
129: close ( -- ) ;
130
131headers
132
133