Commit | Line | Data |
---|---|---|
920dae64 AT |
1 | \ ========== Copyright Header Begin ========================================== |
2 | \ | |
3 | \ Hypervisor Software File: probehub.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: @(#)probehub.fth 1.1 07/01/24 | |
43 | purpose: USB hub probing code to support USB 1.1 devices downstream | |
44 | \ See license at end of file | |
45 | ||
46 | hex | |
47 | ||
48 | \ There are two properties to support 1.1 hubs and devices: | |
49 | \ hub20-dev | |
50 | \ hub20-port | |
51 | \ | |
52 | \ hub20-dev is an integer property containing the assigned-address of | |
53 | \ a USB 2.0 hub. | |
54 | \ hub20-port is an integer property containing the downstream port# (based 1) | |
55 | \ of a USB 2.0 hub if the device attached to it is a 1.1 device. | |
56 | \ | |
57 | \ For example, if we have the following physical topology: | |
58 | \ USB 2.0 hub: port 1: 2.0 disk | |
59 | \ port 2: 1.1 hub port 1: disk | |
60 | \ port 2: disk | |
61 | \ port 3: 1.1 mouse | |
62 | \ port 4: none | |
63 | \ | |
64 | \ Then /usb/hub has the "hub20-dev" property. | |
65 | \ /usb/hub/hub has the "hub20-port" property of value 2. | |
66 | \ /usb/hub/mouse has the "hub20-port" property of value 3. | |
67 | \ | |
68 | \ In order to correctly communicate with the 1.1 hub and all the devices behind | |
69 | \ it, the /usb/hub hub20-dev value and the /usb/hub/hub hub20-port value are | |
70 | \ used in the Transaction Descriptor (qTD). | |
71 | \ | |
72 | \ Likewise, to correctly communicate with the mouse, the /usb/hub hub20-dev | |
73 | \ value and the /usb/hub/mouse hub20-port value are used in the qTD. | |
74 | ||
75 | : ?set-hub20-port ( speed dev port -- ) | |
76 | " hub20-dev" my-parent ihandle>phandle get-package-property 0= if | |
77 | 2drop nip swap speed-high <> if | |
78 | " hub20-port" int-property | |
79 | else | |
80 | drop | |
81 | then | |
82 | else | |
83 | 3drop | |
84 | then | |
85 | ; | |
86 | ' ?set-hub20-port to make-dev-property-hook | |
87 | ||
88 | : get-hub20-dev ( -- hub-dev ) | |
89 | " hub20-dev" get-inherited-property 0= if | |
90 | decode-int nip nip | |
91 | else | |
92 | 1 | |
93 | then | |
94 | ; | |
95 | ||
96 | : get-hub20-port ( port -- port' ) | |
97 | " hub20-port" get-inherited-property 0= if | |
98 | rot drop ( $ ) | |
99 | decode-int nip nip | |
100 | then | |
101 | ; | |
102 | ||
103 | \ Initialize USB 2.0 specific characteristics in di | |
104 | : set-usb20-char ( port dev -- ) | |
105 | get-hub20-dev over di-hub! | |
106 | swap get-hub20-port swap di-port! | |
107 | ; | |
108 | ||
109 | headers | |
110 | ||
111 | \ LICENSE_BEGIN | |
112 | \ Copyright (c) 2006 FirmWorks | |
113 | \ | |
114 | \ Permission is hereby granted, free of charge, to any person obtaining | |
115 | \ a copy of this software and associated documentation files (the | |
116 | \ "Software"), to deal in the Software without restriction, including | |
117 | \ without limitation the rights to use, copy, modify, merge, publish, | |
118 | \ distribute, sublicense, and/or sell copies of the Software, and to | |
119 | \ permit persons to whom the Software is furnished to do so, subject to | |
120 | \ the following conditions: | |
121 | \ | |
122 | \ The above copyright notice and this permission notice shall be | |
123 | \ included in all copies or substantial portions of the Software. | |
124 | \ | |
125 | \ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
126 | \ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
127 | \ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | |
128 | \ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | |
129 | \ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | |
130 | \ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | |
131 | \ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
132 | \ | |
133 | \ LICENSE_END |