TianoCore EDK2
master
Loading...
Searching...
No Matches
UsbHub.h
Go to the documentation of this file.
1
10
#ifndef _USB_HUB_H_
11
#define _USB_HUB_H_
12
13
#include <
IndustryStandard/Usb.h
>
14
15
#define USB_ENDPOINT_ADDR(EpAddr) ((EpAddr) & 0x7F)
16
#define USB_ENDPOINT_TYPE(Desc) ((Desc)->Attributes & USB_ENDPOINT_TYPE_MASK)
17
18
#define USB_DESC_TYPE_HUB 0x29
19
20
#define USB_DESC_TYPE_HUB_SUPER_SPEED 0x2a
21
22
//
23
// Hub class control transfer target
24
//
25
#define USB_HUB_TARGET_HUB 0
26
#define USB_HUB_TARGET_PORT 3
27
//
28
// HUB class specific contrl transfer request type
29
//
30
#define USB_HUB_REQ_GET_STATUS 0
31
#define USB_HUB_REQ_CLEAR_FEATURE 1
32
#define USB_HUB_REQ_SET_FEATURE 3
33
#define USB_HUB_REQ_GET_DESC 6
34
#define USB_HUB_REQ_SET_DESC 7
35
#define USB_HUB_REQ_CLEAR_TT 8
36
#define USB_HUB_REQ_RESET_TT 9
37
#define USB_HUB_REQ_GET_TT_STATE 10
38
#define USB_HUB_REQ_STOP_TT 11
39
40
#define USB_HUB_REQ_SET_DEPTH 12
41
42
//
43
// USB hub class feature selector
44
//
45
#define USB_HUB_C_HUB_LOCAL_POWER 0
46
#define USB_HUB_C_HUB_OVER_CURRENT 1
47
#define USB_HUB_PORT_CONNECTION 0
48
#define USB_HUB_PORT_ENABLE 1
49
#define USB_HUB_PORT_SUSPEND 2
50
#define USB_HUB_PORT_OVER_CURRENT 3
51
#define USB_HUB_PORT_RESET 4
52
53
#define USB_HUB_PORT_LINK_STATE 5
54
55
#define USB_HUB_PORT_POWER 8
56
#define USB_HUB_PORT_LOW_SPEED 9
57
#define USB_HUB_C_PORT_CONNECT 16
58
#define USB_HUB_C_PORT_ENABLE 17
59
#define USB_HUB_C_PORT_SUSPEND 18
60
#define USB_HUB_C_PORT_OVER_CURRENT 19
61
#define USB_HUB_C_PORT_RESET 20
62
#define USB_HUB_PORT_TEST 21
63
#define USB_HUB_PORT_INDICATOR 22
64
65
#define USB_HUB_C_PORT_LINK_STATE 25
66
#define USB_HUB_PORT_REMOTE_WAKE_MASK 27
67
#define USB_HUB_BH_PORT_RESET 28
68
#define USB_HUB_C_BH_PORT_RESET 29
69
70
//
71
// Constant value for Port Status & Port Change Status of SuperSpeed port
72
//
73
#define USB_SS_PORT_STAT_C_BH_RESET 0x0020
74
#define USB_SS_PORT_STAT_C_PORT_LINK_STATE 0x0040
75
//
76
// USB hub power control method. In gang power control
77
//
78
#define USB_HUB_GANG_POWER_CTRL 0
79
#define USB_HUB_PORT_POWER_CTRL 0x01
80
//
81
// USB hub status bits
82
//
83
#define USB_HUB_STAT_LOCAL_POWER 0x01
84
#define USB_HUB_STAT_OVER_CURRENT 0x02
85
#define USB_HUB_STAT_C_LOCAL_POWER 0x01
86
#define USB_HUB_STAT_C_OVER_CURRENT 0x02
87
88
#define USB_HUB_CLASS_CODE 0x09
89
#define USB_HUB_SUBCLASS_CODE 0x00
90
91
//
92
// Host software return timeout if port status doesn't change
93
// after 500ms(LOOP * STALL = 5000 * 0.1ms), set by experience
94
//
95
#define USB_WAIT_PORT_STS_CHANGE_LOOP 5000
96
97
#pragma pack(1)
98
//
99
// Hub descriptor, the last two fields are of variable length.
100
//
101
typedef
struct
{
102
UINT8 Length;
103
UINT8 DescType;
104
UINT8 NumPorts;
105
UINT16 HubCharacter;
106
UINT8 PwrOn2PwrGood;
107
UINT8 HubContrCurrent;
108
UINT8 Filler[16];
109
}
EFI_USB_HUB_DESCRIPTOR
;
110
111
#pragma pack()
112
113
typedef
struct
{
114
UINT16 ChangedBit;
115
EFI_USB_PORT_FEATURE
Feature;
116
}
USB_CHANGE_FEATURE_MAP
;
117
135
EFI_STATUS
136
UsbHubCtrlClearTTBuffer
(
137
IN
USB_DEVICE
*UsbDev,
138
IN
UINT8 Port,
139
IN
UINT16 DevAddr,
140
IN
UINT16 EpNum,
141
IN
UINT16 EpType
142
);
143
153
BOOLEAN
154
UsbIsHubInterface
(
155
IN
USB_INTERFACE
*UsbIf
156
);
157
168
EFI_STATUS
169
UsbHubAckHubStatus
(
170
IN
USB_DEVICE
*UsbDev
171
);
172
173
extern
USB_HUB_API
mUsbHubApi;
174
extern
USB_HUB_API
mUsbRootHubApi;
175
#endif
IN
#define IN
Definition:
Base.h:279
EFI_USB_PORT_FEATURE
EFI_USB_PORT_FEATURE
Definition:
Usb2HostController.h:60
EFI_STATUS
RETURN_STATUS EFI_STATUS
Definition:
UefiBaseType.h:29
Usb.h
UsbHubCtrlClearTTBuffer
EFI_STATUS UsbHubCtrlClearTTBuffer(IN USB_DEVICE *UsbDev, IN UINT8 Port, IN UINT16 DevAddr, IN UINT16 EpNum, IN UINT16 EpType)
Definition:
UsbHub.c:164
UsbHubAckHubStatus
EFI_STATUS UsbHubAckHubStatus(IN USB_DEVICE *UsbDev)
Definition:
UsbHub.c:395
UsbIsHubInterface
BOOLEAN UsbIsHubInterface(IN USB_INTERFACE *UsbIf)
Definition:
UsbHub.c:429
_USB_DEVICE
Definition:
UsbBus.h:160
_USB_HUB_API
Definition:
UsbBus.h:274
_USB_INTERFACE
Definition:
UsbBus.h:197
EFI_USB_HUB_DESCRIPTOR
Definition:
Xhci.h:129
USB_CHANGE_FEATURE_MAP
Definition:
UsbHub.h:113
MdeModulePkg
Bus
Usb
UsbBusDxe
UsbHub.h
Generated on Fri Nov 15 2024 18:01:10 for TianoCore EDK2 by
1.9.6