Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: devargs.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: @(#)devargs.fth 1.3 07/01/23 | |
43 | purpose: Process device arguments. | |
44 | copyright: Copyright 2007 Sun Microsystems, Inc. All Rights Reserved | |
45 | copyright: Use is subject to license terms. | |
46 | ||
47 | headerless | |
48 | ||
49 | : $= ( adr1 len1 adr2 len2 -- same? ) | |
50 | rot tuck <> if 3drop false exit then ( adr1 adr2 len1 ) | |
51 | comp 0= | |
52 | ; | |
53 | ||
54 | : device-argument? ( arg$ -- flag ) | |
55 | ascii = left-parse-string 2swap 2drop ( key$ ) | |
56 | 2dup " speed" $= -rot | |
57 | 2dup " duplex" $= -rot | |
58 | 2dup " link-clock" $= -rot | |
59 | 2dup " promiscuous" $= -rot | |
60 | 2drop or or or ( flag ) | |
61 | ; | |
62 | ||
63 | : set-device-parameter ( arg$ -- ) | |
64 | 2dup " speed=10" $= if 2drop speed=10 exit then | |
65 | 2dup " speed=100" $= if 2drop speed=100 exit then | |
66 | 2dup " speed=1000" $= if 2drop speed=1000 exit then | |
67 | 2dup " speed=10000" $= if 2drop speed=10000 exit then | |
68 | 2dup " speed=auto" $= if 2drop speed=auto exit then | |
69 | 2dup " duplex=half" $= if 2drop duplex=half exit then | |
70 | 2dup " duplex=full" $= if 2drop duplex=full exit then | |
71 | 2dup " duplex=auto" $= if 2drop duplex=auto exit then | |
72 | 2dup " link-clock=master" $= if 2drop link-clock=master exit then | |
73 | 2dup " link-clock=slave" $= if 2drop link-clock=slave exit then | |
74 | 2dup " link-clock=auto" $= if 2drop link-clock=auto exit then | |
75 | 2dup " promiscuous" $= if 2drop mode=promiscuous exit then | |
76 | type ." not supported" cr | |
77 | ; | |
78 | ||
79 | : parse-devargs ( args$ -- obptftp-args$ ) | |
80 | begin | |
81 | 2dup ascii , left-parse-string 2dup device-argument? if | |
82 | set-device-parameter 2swap 2drop | |
83 | else | |
84 | 2drop 2drop exit | |
85 | then | |
86 | again | |
87 | ; | |
88 | ||
89 | : publish-properties ( -- ) | |
90 | user-speed case | |
91 | auto-speed of " auto" endof | |
92 | 10Mbps of " 10" endof | |
93 | 100Mbps of " 100" endof | |
94 | 1000Mbps of " 1000" endof | |
95 | 10Gbps of " 10000" endof | |
96 | endcase encode-string " speed" property | |
97 | ||
98 | user-duplex case | |
99 | auto-duplex of " auto" endof | |
100 | half-duplex of " half" endof | |
101 | full-duplex of " full" endof | |
102 | endcase encode-string " duplex" property | |
103 | ||
104 | gmii-phy? if | |
105 | user-link-clock case | |
106 | auto-link-clock of " auto" endof | |
107 | master-link-clock of " master" endof | |
108 | slave-link-clock of " slave" endof | |
109 | endcase encode-string " link-clock" property | |
110 | then | |
111 | ; | |
112 | ||
113 | headers |