3 The definition for USB hub.
5 Copyright (c) 2007, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
19 #include <IndustryStandard/Usb.h>
21 #define USB_ENDPOINT_ADDR(EpAddr) ((EpAddr) & 0x7F)
22 #define USB_ENDPOINT_TYPE(Desc) ((Desc)->Attributes & USB_ENDPOINT_TYPE_MASK)
25 USB_DESC_TYPE_HUB
= 0x29,
28 // Hub class control transfer target
30 USB_HUB_TARGET_HUB
= 0,
31 USB_HUB_TARGET_PORT
= 3,
34 // HUB class specific contrl transfer request type
36 USB_HUB_REQ_GET_STATUS
= 0,
37 USB_HUB_REQ_CLEAR_FEATURE
= 1,
38 USB_HUB_REQ_SET_FEATURE
= 3,
39 USB_HUB_REQ_GET_DESC
= 6,
40 USB_HUB_REQ_SET_DESC
= 7,
41 USB_HUB_REQ_CLEAR_TT
= 8,
42 USB_HUB_REQ_RESET_TT
= 9,
43 USB_HUB_REQ_GET_TT_STATE
= 10,
44 USB_HUB_REQ_STOP_TT
= 11,
48 // USB hub class feature selector
50 USB_HUB_C_HUB_LOCAL_POWER
= 0,
51 USB_HUB_C_HUB_OVER_CURRENT
= 1,
52 USB_HUB_PORT_CONNECTION
= 0,
53 USB_HUB_PORT_ENABLE
= 1,
54 USB_HUB_PORT_SUSPEND
= 2,
55 USB_HUB_PORT_OVER_CURRENT
= 3,
56 USB_HUB_PORT_RESET
= 4,
57 USB_HUB_PORT_POWER
= 8,
58 USB_HUB_PORT_LOW_SPEED
= 9,
59 USB_HUB_C_PORT_CONNECT
= 16,
60 USB_HUB_C_PORT_ENABLE
= 17,
61 USB_HUB_C_PORT_SUSPEND
= 18,
62 USB_HUB_C_PORT_OVER_CURRENT
= 19,
63 USB_HUB_C_PORT_RESET
= 20,
64 USB_HUB_PORT_TEST
= 21,
65 USB_HUB_PORT_INDICATOR
= 22,
68 // USB hub power control method. In gang power control
70 USB_HUB_GANG_POWER_CTRL
= 0,
71 USB_HUB_PORT_POWER_CTRL
= 0x01,
74 // USB hub status bits
76 USB_HUB_STAT_LOCAL_POWER
= 0x01,
77 USB_HUB_STAT_OVER_CURRENT
= 0x02,
78 USB_HUB_STAT_C_LOCAL_POWER
= 0x01,
79 USB_HUB_STAT_C_OVER_CURRENT
= 0x02,
81 USB_HUB_CLASS_CODE
= 0x09,
82 USB_HUB_SUBCLASS_CODE
= 0x00,
85 // Host software return timeout if port status doesn't change
86 // after 500ms(LOOP * STALL = 100 * 5ms), set by experience
88 USB_WAIT_PORT_STS_CHANGE_LOOP
= 100
93 // Hub descriptor, the last two fields are of variable lenght.
101 UINT8 HubContrCurrent
;
103 } EFI_USB_HUB_DESCRIPTOR
;
109 EFI_USB_PORT_FEATURE Feature
;
110 } USB_CHANGE_FEATURE_MAP
;
114 Clear the transaction translate buffer if full/low
115 speed control/bulk transfer failed and the transfer
116 uses this hub as translator.Remember to clear the TT
117 buffer of transaction translator, not that of the
120 @param UsbDev The Usb device.
121 @param Port The port of the hub.
122 @param DevAddr Address of the failed transaction.
123 @param EpNum The endpoint number of the failed transaction.
124 @param EpType The type of failed transaction.
126 @retval EFI_SUCCESS The TT buffer is cleared.
127 @retval Others Failed to clear the TT buffer.
131 UsbHubCtrlClearTTBuffer (
132 IN USB_DEVICE
*UsbDev
,
141 Test whether the interface is a hub interface.
143 @param UsbIf The interface to test.
145 @retval TRUE The interface is a hub interface.
146 @retval FALSE The interface isn't a hub interface.
151 IN USB_INTERFACE
*UsbIf
156 Ack the hub change bits. If these bits are not ACKed, Hub will
157 always return changed bit map from its interrupt endpoint.
159 @param UsbDev The Usb device.
161 @retval EFI_SUCCESS The hub change status is ACKed.
162 @retval Others Failed to ACK the hub status.
167 IN USB_DEVICE
*UsbDev
170 extern USB_HUB_API mUsbHubApi
;
171 extern USB_HUB_API mUsbRootHubApi
;