Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: hub.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: @(#)hub.fth 1.1 07/01/04 | |
43 | purpose: USB Hub Driver | |
44 | copyright: Copyright 2007 Sun Microsystems, Inc. All Rights Reserved | |
45 | \ See license at end of file | |
46 | ||
47 | \ Utilities (Sun) | |
48 | fload ${BP}/dev/utilities/misc.fth | |
49 | ||
50 | hex | |
51 | ||
52 | " usb_hub" encode-string " device_type" property | |
53 | 1 encode-int " #address-cells" property \ SUN note - 1 cell | |
54 | 0 encode-int " #size-cells" property | |
55 | ||
56 | external | |
57 | ||
58 | \ A usb device node defines an address space of the form | |
59 | \ "port,interface". port and interface are both integers. | |
60 | \ parse-2int converts a text string (e.g. "3,1") into a pair of | |
61 | \ binary integers. | |
62 | ||
63 | \ : decode-unit ( addr len -- interface port ) parse-2int ; | |
64 | \ : encode-unit ( interface port -- adr len ) | |
65 | \ >r <# u#s drop ascii , hold r> u#s u#> \ " port,interface" | |
66 | \ ; | |
67 | ||
68 | \ SUN Note - single-cell unit address | |
69 | : decode-unit ( addr len -- lun ) push-hex $number if 0 then pop-base ; | |
70 | : encode-unit ( lun -- adr len ) push-hex (u.) pop-base ; | |
71 | ||
72 | : open ( -- flag ) true ; | |
73 | : close ( -- ) ; | |
74 | ||
75 | headers | |
76 | ||
77 | : is-hub20? ( -- flag ) | |
78 | " high-speed" get-my-property 0= if 2drop true else false then | |
79 | ; | |
80 | : hub-id ( -- dev ) | |
81 | " assigned-address" get-my-property if | |
82 | ." Property: assigned-address not found." abort | |
83 | then | |
84 | decode-int nip nip | |
85 | ; | |
86 | : probe-hub ( -- ) | |
87 | ['] hub-id catch 0= if | |
88 | is-hub20? if | |
89 | dup encode-int " hub20-dev" property | |
90 | then | |
91 | probe-hub-xt execute | |
92 | then | |
93 | ; | |
94 | ||
95 | probe-hub | |
96 | ||
97 | \ LICENSE_BEGIN | |
98 | \ Copyright (c) 2006 FirmWorks | |
99 | \ | |
100 | \ Permission is hereby granted, free of charge, to any person obtaining | |
101 | \ a copy of this software and associated documentation files (the | |
102 | \ "Software"), to deal in the Software without restriction, including | |
103 | \ without limitation the rights to use, copy, modify, merge, publish, | |
104 | \ distribute, sublicense, and/or sell copies of the Software, and to | |
105 | \ permit persons to whom the Software is furnished to do so, subject to | |
106 | \ the following conditions: | |
107 | \ | |
108 | \ The above copyright notice and this permission notice shall be | |
109 | \ included in all copies or substantial portions of the Software. | |
110 | \ | |
111 | \ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
112 | \ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
113 | \ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
114 | \ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
115 | \ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
116 | \ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
117 | \ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
118 | \ | |
119 | \ LICENSE_END |