Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: niu.tok | |
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 ============================================ | |
42 | id: @(#)niu.tok 1.1 07/01/23 | |
43 | purpose: | |
44 | copyright: Copyright 2007 Sun Microsystems, Inc. All Rights Reserved. | |
45 | copyright: Use is subject to license terms. | |
46 | ||
47 | Fcode-version3 | |
48 | ||
49 | headerless | |
50 | ||
51 | \ Certain registers are not defined in the legion simulation model for NIU. | |
52 | \ Use this to toggle between simulation mode and hardware mode. | |
53 | \ [define] legion | |
54 | ||
55 | fload ${BP}/dev/network/common/link-params.fth | |
56 | fload ${BP}/dev/utilities/misc.fth | |
57 | fload ${BP}/dev/network/neptune/niu/util.fth | |
58 | fload ${BP}/dev/network/neptune/global.fth | |
59 | fload ${BP}/dev/network/neptune/reg-defs.fth | |
60 | fload ${BP}/dev/network/neptune/util.fth | |
61 | fload ${BP}/dev/network/neptune/niu/map.fth | |
62 | fload ${BP}/dev/network/neptune/mif.fth | |
63 | fload ${BP}/dev/network/common/mif/mii-h.fth | |
64 | fload ${BP}/dev/network/common/mif/gmii-h.fth | |
65 | fload ${BP}/dev/network/neptune/bcm8704.fth | |
66 | fload ${BP}/dev/network/neptune/niu/ti.fth | |
67 | fload ${BP}/dev/network/neptune/xmac.fth | |
68 | fload ${BP}/dev/network/neptune/niu/redirect.fth | |
69 | fload ${BP}/dev/network/neptune/classifier.fth | |
70 | fload ${BP}/dev/network/neptune/core.fth | |
71 | fload ${BP}/dev/network/common/devargs.fth | |
72 | fload ${BP}/dev/network/neptune/pkg.fth | |
73 | fload ${BP}/dev/network/neptune/niu/md-access.fth | |
74 | ||
75 | " network" encode-string " name" property | |
76 | ||
77 | " tx-dma-channels" required-prop | |
78 | drop dup x@ swap /x + x@ swap encode-int rot encode-int encode+ " tx-dma-channels" property | |
79 | " rx-dma-channels" required-prop | |
80 | drop dup x@ swap /x + x@ swap encode-int rot encode-int encode+ " rx-dma-channels" property | |
81 | ||
82 | " compatible" required-prop " compatible" property | |
83 | " device-type" required-prop encode-string " device_type" property | |
84 | " phy-type" required-prop encode-string " phy-type" property | |
85 | ||
86 | " mac-addresses" required-prop 2dup | |
87 | encode-bytes " mac-addresses" property | |
88 | drop 6 encode-bytes " local-mac-address" property | |
89 | ||
90 | h# ffff.ffff 0 lxjoin constant reg-mask | |
91 | ||
92 | \ The 'reg' property for the NIU ports have 4 entries, as described | |
93 | \ by the device binding. | |
94 | \ 0: configuration entry | |
95 | \ 1: PIO region | |
96 | \ 2: VIO1 region | |
97 | \ 3: VIO2 region | |
98 | : make-reg-property ( -- ) | |
99 | 0 0 encode-bytes | |
100 | my-space en+ 0 en+ 0 enx+ \ config | |
101 | my-space en+ 0 en+ h# 1000000 enx+ \ PIO | |
102 | my-space en+ h# 1000000 en+ h# 8000 enx+ \ VIO1 | |
103 | my-space en+ h# 5000000 en+ h# 8000 enx+ \ VIO2 | |
104 | " reg" property | |
105 | ; | |
106 | ||
107 | make-reg-property | |
108 | ||
109 | : get-interrupts ( -- ix ... i1 x ) | |
110 | my-node " interrupts" -1 md-find-prop dup if ( prop | 0 ) | |
111 | md-decode-prop ascii d = if ( val | buf,len ) | |
112 | \ d == data block, multiple interrups | |
113 | dup /x / >r ( buf,len )( R: x ) | |
114 | begin ( buf,len' ) | |
115 | /x - 2dup + x@ -rot dup 0= ( ix ... buf,len' done? ) | |
116 | until ( ix ... buf,len' ) | |
117 | 2drop r> ( ix ... i1 x )( R: ) | |
118 | else ( prop ) | |
119 | \ v == data value, one interrupt | |
120 | 1 ( i1 x ) | |
121 | then ( ix ... i1 x ) | |
122 | then ( ix ... i1 x ) | |
123 | ; | |
124 | ||
125 | : make-interrupt-property ( -- ) | |
126 | 0 0 encode-bytes 2>r | |
127 | get-interrupts 2r> | |
128 | rot 0 ?do rot en+ loop | |
129 | " interrupts" property | |
130 | ; | |
131 | ||
132 | make-interrupt-property | |
133 | ||
134 | depend-load debugging? ${BP}/dev/network/neptune/niu/debug.fth | |
135 | ||
136 | ||
137 | end0 |