Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: bge-h.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 ============================================ | |
42 | id: @(#)bge-h.fth 1.5 07/05/30 | |
43 | purpose: data structure definitions | |
44 | copyright: Copyright 2007 Sun Microsystems, Inc. All Rights Reserved | |
45 | copyright: Use is subject to license terms. | |
46 | ||
47 | headers | |
48 | ||
49 | 0 instance value breg-base \ Controller mem-base address | |
50 | 0 instance value bmem-base \ Host mem-base address | |
51 | 0 instance value cpu-dma-base \ cpu mapped dma base | |
52 | 0 instance value io-dma-base \ device mapped dma base | |
53 | 0 instance value pci-$line-size \ PCI Cache Line Size | |
54 | 0 instance value pci-dev-id \ PCI Device ID | |
55 | 0 instance value pci-rev-id \ PCI Revision ID | |
56 | 0 instance value pci-max-latency \ PCI Max Latency | |
57 | ||
58 | h# 1647 constant BCM-5703 \ 5703 Device ID | |
59 | h# 16a7 constant BCM-5703a \ 5703 alternate Device ID | |
60 | h# 1648 constant BCM-5704 \ 5704 Device ID | |
61 | h# 1668 constant BCM-5714 \ 5714 Device ID | |
62 | h# 1678 constant BCM-5715 \ 5715 Device ID | |
63 | h# 1659 constant BCM-5721 \ 5721 Device ID | |
64 | ||
65 | d# 128 constant #rxbufs \ # of Receive Buffers for consumption | |
66 | d# 2048 constant /rxbuf \ Size of each Receicve Buffer | |
67 | 1 constant #rxrings \ # of rx rings | |
68 | ||
69 | \ | |
70 | \ 5714,5715,5721 do not support /rxring=1024, 512 does not work for 5704 | |
71 | \ | |
72 | 2 my-w@ dup to pci-dev-id | |
73 | dup BCM-5721 = | |
74 | over BCM-5715 = or | |
75 | swap BCM-5714 = or | |
76 | ||
77 | if d# 512 else d# 1024 then | |
78 | instance value /rxring \ # of rx RBDs per ring (mini's disabled) | |
79 | ||
80 | 1 constant #txbufs \ # of Send Buffers for consumption | |
81 | d# 2048 constant /txbuf \ Size of each Send Buffer | |
82 | 1 constant #txrings \ # of tx rings | |
83 | d# 512 constant /txring \ # of tx RBDs per ring | |
84 | d# 512 constant /std-ring \ # of BDs in Standard Ring | |
85 | h# 80 constant /statistics-blk \ Size of statistics block | |
86 | ||
87 | \ Ring Control Buffer: | |
88 | struct | |
89 | /x field >rcb-host-adr \ Host-side Ring Buffer Address | |
90 | /l field >rcb-len-flags \ length and flag fields | |
91 | /l field >rcb-nic-adr \ Controller-side Ring Buffer Address | |
92 | constant /rcb | |
93 | ||
94 | \ Transmit Buffer Descriptor | |
95 | struct | |
96 | /x field >txbd-host-adr \ Host-side Transmit Buffer Address | |
97 | /w field >txbd-len \ 0 = no buffer accociated | |
98 | /w field >txbd-flags \ control flags | |
99 | /w field >txbd-rsvd \ reserved (set to 0) | |
100 | /w field >txbd-vlan \ vlan tag | |
101 | constant /txbd | |
102 | ||
103 | \ Receive Buffer Descriptor | |
104 | struct | |
105 | /x field >rxbd-host-adr \ Host-side Receive Buffer Address | |
106 | /w field >rxbd-index \ host index | |
107 | /w field >rxbd-len \ length of buffer ready to receive | |
108 | /w field >rxbd-type \ producer rings = 0, return rings = ignore | |
109 | /w field >rxbd-flags \ control flags (FRAME_HAS_ERROR = b10) | |
110 | /w field >rxbd-ip-cksum \ producer ring = 0, 0 or ffff is ok | |
111 | /w field >rxbd-tcp-cksum \ producer ring = 0 | |
112 | /w field >rxbd-err-flags \ only valid if FRAME_HAS_ERROR set | |
113 | /w field >rxbd-vlan \ Vlan tag | |
114 | /l field >rxbd-rsvd \ reserved (set to 0) | |
115 | /l field >rxbd-opaque \ used to pass info from p-ring to r-ring | |
116 | constant /rxbd | |
117 | ||
118 | h# 400 constant rxbd-flags.frame-err \ Frame has error (error field valid) | |
119 | 1 constant rxbd-err.bad-crc \ packet has bad ethernet crc | |
120 | 2 constant rxbd-err.coll-detect \ collision was encountered | |
121 | 4 constant rxbd-err.link-lost \ link lost - packet incomplete | |
122 | 8 constant rxbd-err.phy-err \ undef err, could mean bad alignment | |
123 | h# 10 constant rxbd-err.odd-nibble \ odd nibbles, packet may be corrupt | |
124 | h# 20 constant rxbd-err.mac-abort \ mac aborted during receive, ouch | |
125 | h# 40 constant rxbd-err.too-small \ packet less than 64 bytes | |
126 | h# 80 constant rxbd-err.truncated \ not enough resources for packet | |
127 | h# 100 constant rxbd-err.giant \ packet larger than MTU Size | |
128 | ||
129 | \ Status Block | |
130 | struct | |
131 | /l field >status-word \ Status Error Information | |
132 | /l field >status-tag \ Different on every DMA (am-I-updated?) | |
133 | /w field >status-std-ci \ Standard Producer Ring Consumer Index | |
134 | /w field >status-jmb-ci \ Jumbo Producer Ring Consumer Index | |
135 | /w field >status-rsvd \ Reserved | |
136 | /w field >status-mini-ci \ Mini Producer Ring Consumer Index | |
137 | d# 16 /l * field >status-i-base \ Rx and Tx rings (1-16) indicies | |
138 | constant /status-blk | |
139 | ||
140 | : >status-tx-ci-n ( base-adr n -- offset ) \ Offset of TX Ring n | |
141 | 1- /l * swap >status-i-base + \ Consumer Index | |
142 | ; | |
143 | : >status-rx-pi-n ( base-adr n -- ) \ Offset of Rx Ring n | |
144 | >status-tx-ci-n /w + \ Producer Index | |
145 | ; | |
146 | ||
147 | struct | |
148 | /status-blk field >dma-status-blk \ Status Block | |
149 | /std-ring /rxbd * field >dma-std-ring \ Standard Prod Ring | |
150 | #rxrings /rxring /rxbd * * field >dma-rx-rings \ Return Rings | |
151 | #txrings /txring /txbd * * field >dma-tx-rings \ Send Rings | |
152 | #rxbufs /rxbuf * field >dma-rx-bufs \ Receive Buffers | |
153 | #txbufs /txbuf * field >dma-tx-bufs \ Send Buffers | |
154 | /statistics-blk field >dma-stat-blk \ Statistic Block | |
155 | constant /dma-blk | |
156 | \ hpm = High Priority Mailbox | |
157 | h# 204 constant hpm-im0 \ hpm Interupt Mailbox 0 | |
158 | h# 274 constant hpm-jumbo-pi \ hpm Jumbo Producer Ring Index | |
159 | h# 27c constant hpm-mini-pi \ hpm Mini Producer Ring Index | |
160 | h# 284 constant hpm-rrci0 \ hpm Return Ring 0 Consumer Index | |
161 | h# 304 constant hpm-txpi0 \ hpm Transmit Ring 0 (host)Producer Index | |
162 | h# 26c constant hpm-spr-pi \ hpm Standard Producer Ring Index | |
163 | ||
164 | : status-blk ( -- offset ) cpu-dma-base >dma-status-blk ; | |
165 | : rrbd0 ( -- adr ) cpu-dma-base >dma-rx-rings ; | |
166 | : txbd0 ( -- adr ) cpu-dma-base >dma-tx-rings ; | |
167 | : std0 ( -- adr ) cpu-dma-base >dma-std-ring ; | |
168 | : txbuf0 ( -- adr ) cpu-dma-base >dma-tx-bufs ; | |
169 | : rxbuf0 ( -- adr ) cpu-dma-base >dma-rx-bufs ; | |
170 | ||
171 | d# 1518 constant mtu-size |