32 OUT UINT32 *PortStatus
42 DeviceRequest.RequestType = USB_HUB_GET_PORT_STATUS_REQ_TYPE;
43 DeviceRequest.Request = USB_HUB_GET_PORT_STATUS;
44 DeviceRequest.Index = Port;
45 DeviceRequest.Length = (UINT16)
sizeof (UINT32);
47 return UsbIoPpi->UsbControlTransfer (
52 PcdGet32 (PcdUsbTransferTimeoutValue),
86 DeviceRequest.RequestType = USB_HUB_SET_PORT_FEATURE_REQ_TYPE;
87 DeviceRequest.Request = USB_HUB_SET_PORT_FEATURE;
88 DeviceRequest.Value = Value;
89 DeviceRequest.Index = Port;
91 return UsbIoPpi->UsbControlTransfer (
96 PcdGet32 (PcdUsbTransferTimeoutValue),
130 DeviceRequest.RequestType = USB_HUB_CLEAR_FEATURE_PORT_REQ_TYPE;
131 DeviceRequest.Request = USB_HUB_CLEAR_FEATURE_PORT;
132 DeviceRequest.Value = Value;
133 DeviceRequest.Index = Port;
135 return UsbIoPpi->UsbControlTransfer (
140 PcdGet32 (PcdUsbTransferTimeoutValue),
162 OUT UINT32 *HubStatus
172 DeviceRequest.RequestType = USB_HUB_GET_HUB_STATUS_REQ_TYPE;
173 DeviceRequest.Request = USB_HUB_GET_HUB_STATUS;
174 DeviceRequest.Length = (UINT16)
sizeof (UINT32);
176 return UsbIoPpi->UsbControlTransfer (
181 PcdGet32 (PcdUsbTransferTimeoutValue),
213 DeviceRequest.RequestType = USB_HUB_CLEAR_FEATURE_REQ_TYPE;
214 DeviceRequest.Request = USB_HUB_CLEAR_FEATURE;
215 DeviceRequest.Value = Value;
217 return UsbIoPpi->UsbControlTransfer (
222 PcdGet32 (PcdUsbTransferTimeoutValue),
258 USB_DT_SUPERSPEED_HUB :
264 DevReq.RequestType = USB_RT_HUB | 0x80;
265 DevReq.Request = USB_HUB_GET_DESCRIPTOR;
266 DevReq.Value = (UINT16)(DescType << 8);
267 DevReq.Length = (UINT16)DescriptorSize;
269 return UsbIoPpi->UsbControlTransfer (
274 PcdGet32 (PcdUsbTransferTimeoutValue),
276 (UINT16)DescriptorSize
311 if (EFI_ERROR (Status)) {
318 return PeiGetHubDescriptor (PeiServices, PeiUsbDevice, UsbIoPpi, HubDescriptor->Length, HubDescriptor);
346 DevReq.RequestType = USB_RT_HUB;
347 DevReq.Request = USB_HUB_REQ_SET_DEPTH;
348 DevReq.Value = PeiUsbDevice->Tier;
351 return UsbIoPpi->UsbControlTransfer (
356 PcdGet32 (PcdUsbTransferTimeoutValue),
378 UINT8 HubDescBuffer[256];
385 UsbIoPpi = &PeiUsbDevice->UsbIoPpi;
402 if (EFI_ERROR (Status)) {
403 return EFI_DEVICE_ERROR;
406 PeiUsbDevice->DownStreamPortNo = HubDescriptor->NbrPorts;
409 DEBUG ((DEBUG_INFO,
"PeiDoHubConfig: Set Hub Depth as 0x%x\n", PeiUsbDevice->Tier));
419 for (Index = 0; Index < PeiUsbDevice->DownStreamPortNo; Index++) {
426 if (EFI_ERROR (Status)) {
427 DEBUG ((DEBUG_ERROR,
"PeiDoHubConfig: PeiHubSetPortFeature EfiUsbPortPower failed %x\n", Index));
432 DEBUG ((DEBUG_INFO,
"PeiDoHubConfig: HubDescriptor.PwrOn2PwrGood: 0x%x\n", HubDescriptor->PwrOn2PwrGood));
433 if (HubDescriptor->PwrOn2PwrGood > 0) {
445 if (EFI_ERROR (Status)) {
446 return EFI_DEVICE_ERROR;
451 if ((HubStatus.HubChangeStatus & HUB_CHANGE_LOCAL_POWER) != 0) {
462 if ((HubStatus.HubChangeStatus & HUB_CHANGE_OVERCURRENT) != 0) {
517 for (Index = 0; Index < USB_WAIT_PORT_STS_CHANGE_LOOP; Index++) {
522 (UINT32 *)&HubPortStatus
525 if (EFI_ERROR (Status)) {
529 if (USB_BIT_IS_SET (HubPortStatus.PortChangeStatus, USB_PORT_STAT_C_RESET)) {
536 if (Index == USB_WAIT_PORT_STS_CHANGE_LOOP) {
537 DEBUG ((DEBUG_ERROR,
"PeiResetHubPort: reset not finished in time on port %d\n", PortNum));
548 EfiUsbPortResetChange
557 EfiUsbPortConnectChange
578 EfiUsbPortEnableChange
UINTN EFIAPI MicroSecondDelay(IN UINTN MicroSeconds)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
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)
EFI_STATUS PeiHubClearPortFeature(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 Port, IN UINT8 Value)
EFI_STATUS PeiDoHubConfig(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_DEVICE *PeiUsbDevice)
EFI_STATUS PeiUsbHubReadDesc(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_DEVICE *PeiUsbDevice, IN PEI_USB_IO_PPI *UsbIoPpi, OUT EFI_USB_HUB_DESCRIPTOR *HubDescriptor)
VOID PeiResetHubPort(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 PortNum)
EFI_STATUS PeiHubGetHubStatus(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, OUT UINT32 *HubStatus)
EFI_STATUS PeiHubClearHubFeature(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 Value)
EFI_STATUS PeiHubGetPortStatus(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 Port, OUT UINT32 *PortStatus)
EFI_STATUS PeiUsbHubCtrlSetHubDepth(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_DEVICE *PeiUsbDevice, IN PEI_USB_IO_PPI *UsbIoPpi)
EFI_STATUS PeiHubSetPortFeature(IN EFI_PEI_SERVICES **PeiServices, IN PEI_USB_IO_PPI *UsbIoPpi, IN UINT8 Port, IN UINT8 Value)
#define DEBUG(Expression)
#define EFI_USB_SPEED_SUPER
4.8 Gb/s, USB 3.0 XHCI HC.
#define PcdGet32(TokenName)