TianoCore EDK2 master
Loading...
Searching...
No Matches
HubPeim.h
Go to the documentation of this file.
1
10#ifndef _PEI_HUB_PEIM_H_
11#define _PEI_HUB_PEIM_H_
12
13//
14// Hub feature numbers
15//
16#define C_HUB_LOCAL_POWER 0
17#define C_HUB_OVER_CURRENT 1
18
19//
20// Hub class code & sub class code
21//
22#define CLASS_CODE_HUB 0x09
23#define SUB_CLASS_CODE_HUB 0
24
25//
26// Hub Status & Hub Change bit masks
27//
28#define HUB_STATUS_LOCAL_POWER 0x0001
29#define HUB_STATUS_OVERCURRENT 0x0002
30
31#define HUB_CHANGE_LOCAL_POWER 0x0001
32#define HUB_CHANGE_OVERCURRENT 0x0002
33
34//
35// Hub Characteristics
36//
37#define HUB_CHAR_LPSM 0x0003
38#define HUB_CHAR_COMPOUND 0x0004
39#define HUB_CHAR_OCPM 0x0018
40
41//
42// Standard hub request and request type
43// By [Spec-USB20/Chapter-11.24]
44//
45#define USB_HUB_CLEAR_FEATURE 0x01
46#define USB_HUB_CLEAR_FEATURE_REQ_TYPE 0x20
47
48#define USB_HUB_CLEAR_FEATURE_PORT 0x01
49#define USB_HUB_CLEAR_FEATURE_PORT_REQ_TYPE 0x23
50
51#define USB_HUB_GET_BUS_STATE 0x02
52#define USB_HUB_GET_BUS_STATE_REQ_TYPE 0xA3
53
54#define USB_HUB_GET_DESCRIPTOR 0x06
55#define USB_HUB_GET_DESCRIPTOR_REQ_TYPE 0xA0
56
57#define USB_HUB_GET_HUB_STATUS 0x00
58#define USB_HUB_GET_HUB_STATUS_REQ_TYPE 0xA0
59
60#define USB_HUB_GET_PORT_STATUS 0x00
61#define USB_HUB_GET_PORT_STATUS_REQ_TYPE 0xA3
62
63#define USB_HUB_SET_DESCRIPTOR 0x07
64#define USB_HUB_SET_DESCRIPTOR_REQ_TYPE 0x20
65
66#define USB_HUB_SET_HUB_FEATURE 0x03
67#define USB_HUB_SET_HUB_FEATURE_REQ_TYPE 0x20
68
69#define USB_HUB_SET_PORT_FEATURE 0x03
70#define USB_HUB_SET_PORT_FEATURE_REQ_TYPE 0x23
71
72#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
73#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
74
75#define USB_HUB_REQ_SET_DEPTH 12
76
77#define MAXBYTES 8
78#pragma pack(1)
79//
80// Hub descriptor, the last two fields are of variable length.
81//
82typedef struct {
83 UINT8 Length;
84 UINT8 DescriptorType;
85 UINT8 NbrPorts;
86 UINT8 HubCharacteristics[2];
87 UINT8 PwrOn2PwrGood;
88 UINT8 HubContrCurrent;
89 UINT8 Filler[MAXBYTES];
91
92typedef struct {
93 UINT16 HubStatus;
94 UINT16 HubChangeStatus;
96
97#pragma pack()
98
114 IN EFI_PEI_SERVICES **PeiServices,
115 IN PEI_USB_IO_PPI *UsbIoPpi,
116 IN UINT8 Port,
117 OUT UINT32 *PortStatus
118 );
119
135 IN EFI_PEI_SERVICES **PeiServices,
136 IN PEI_USB_IO_PPI *UsbIoPpi,
137 IN UINT8 Port,
138 IN UINT8 Value
139 );
140
155 IN EFI_PEI_SERVICES **PeiServices,
156 IN PEI_USB_IO_PPI *UsbIoPpi,
157 OUT UINT32 *HubStatus
158 );
159
175 IN EFI_PEI_SERVICES **PeiServices,
176 IN PEI_USB_IO_PPI *UsbIoPpi,
177 IN UINT8 Port,
178 IN UINT8 Value
179 );
180
195 IN EFI_PEI_SERVICES **PeiServices,
196 IN PEI_USB_IO_PPI *UsbIoPpi,
197 IN UINT8 Value
198 );
199
217 IN EFI_PEI_SERVICES **PeiServices,
218 IN PEI_USB_DEVICE *PeiUsbDevice,
219 IN PEI_USB_IO_PPI *UsbIoPpi,
220 IN UINTN DescriptorSize,
221 OUT EFI_USB_HUB_DESCRIPTOR *HubDescriptor
222 );
223
236 IN EFI_PEI_SERVICES **PeiServices,
237 IN PEI_USB_DEVICE *PeiUsbDevice
238 );
239
248VOID
250 IN EFI_PEI_SERVICES **PeiServices,
251 IN PEI_USB_IO_PPI *UsbIoPpi,
252 IN UINT8 PortNum
253 );
254
255#endif
UINT64 UINTN
EFI_STATUS PeiGetHubDescriptor(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_DEVICE *PeiUsbDevice, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINTN DescriptorSize, OUT EFI_USB_HUB_DESCRIPTOR *HubDescriptor)
Definition: HubPeim.c:244
EFI_STATUS PeiHubClearPortFeature(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 Port, IN UINT8 Value)
Definition: HubPeim.c:116
EFI_STATUS PeiDoHubConfig(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_DEVICE *PeiUsbDevice)
Definition: HubPeim.c:373
VOID PeiResetHubPort(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 PortNum)
Definition: HubPeim.c:484
EFI_STATUS PeiHubGetHubStatus(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, OUT UINT32 *HubStatus)
Definition: HubPeim.c:159
EFI_STATUS PeiHubClearHubFeature(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 Value)
Definition: HubPeim.c:200
EFI_STATUS PeiHubGetPortStatus(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 Port, OUT UINT32 *PortStatus)
Definition: HubPeim.c:28
EFI_STATUS PeiHubSetPortFeature(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 Port, IN UINT8 Value)
Definition: HubPeim.c:72
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29