diff options
Diffstat (limited to 'MdeModulePkg/Bus/Usb/UsbBusPei')
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.c | 196 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.h | 117 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.c | 57 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.h | 106 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBusPei/UsbIoPeim.c | 215 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.c | 533 | ||||
-rw-r--r-- | MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.h | 123 |
7 files changed, 675 insertions, 672 deletions
diff --git a/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.c b/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.c index ce6db0b048..df38227eed 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.c +++ b/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.c @@ -26,10 +26,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/
EFI_STATUS
PeiHubGetPortStatus (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- IN UINT8 Port,
- OUT UINT32 *PortStatus
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ IN UINT8 Port,
+ OUT UINT32 *PortStatus
)
{
EFI_USB_DEVICE_REQUEST DeviceRequest;
@@ -42,8 +42,7 @@ PeiHubGetPortStatus ( DeviceRequest.RequestType = USB_HUB_GET_PORT_STATUS_REQ_TYPE;
DeviceRequest.Request = USB_HUB_GET_PORT_STATUS;
DeviceRequest.Index = Port;
- DeviceRequest.Length = (UINT16) sizeof (UINT32);
-
+ DeviceRequest.Length = (UINT16)sizeof (UINT32);
return UsbIoPpi->UsbControlTransfer (
PeiServices,
@@ -54,7 +53,6 @@ PeiHubGetPortStatus ( PortStatus,
sizeof (UINT32)
);
-
}
/**
@@ -72,13 +70,13 @@ PeiHubGetPortStatus ( **/
EFI_STATUS
PeiHubSetPortFeature (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- IN UINT8 Port,
- IN UINT8 Value
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ IN UINT8 Port,
+ IN UINT8 Value
)
{
- EFI_USB_DEVICE_REQUEST DeviceRequest;
+ EFI_USB_DEVICE_REQUEST DeviceRequest;
ZeroMem (&DeviceRequest, sizeof (EFI_USB_DEVICE_REQUEST));
@@ -116,13 +114,13 @@ PeiHubSetPortFeature ( **/
EFI_STATUS
PeiHubClearPortFeature (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- IN UINT8 Port,
- IN UINT8 Value
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ IN UINT8 Port,
+ IN UINT8 Value
)
{
- EFI_USB_DEVICE_REQUEST DeviceRequest;
+ EFI_USB_DEVICE_REQUEST DeviceRequest;
ZeroMem (&DeviceRequest, sizeof (EFI_USB_DEVICE_REQUEST));
@@ -159,9 +157,9 @@ PeiHubClearPortFeature ( **/
EFI_STATUS
PeiHubGetHubStatus (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- OUT UINT32 *HubStatus
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ OUT UINT32 *HubStatus
)
{
EFI_USB_DEVICE_REQUEST DeviceRequest;
@@ -173,7 +171,7 @@ PeiHubGetHubStatus ( //
DeviceRequest.RequestType = USB_HUB_GET_HUB_STATUS_REQ_TYPE;
DeviceRequest.Request = USB_HUB_GET_HUB_STATUS;
- DeviceRequest.Length = (UINT16) sizeof (UINT32);
+ DeviceRequest.Length = (UINT16)sizeof (UINT32);
return UsbIoPpi->UsbControlTransfer (
PeiServices,
@@ -186,8 +184,6 @@ PeiHubGetHubStatus ( );
}
-
-
/**
Clear specified feature on a given hub.
@@ -202,12 +198,12 @@ PeiHubGetHubStatus ( **/
EFI_STATUS
PeiHubClearHubFeature (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- IN UINT8 Value
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ IN UINT8 Value
)
{
- EFI_USB_DEVICE_REQUEST DeviceRequest;
+ EFI_USB_DEVICE_REQUEST DeviceRequest;
ZeroMem (&DeviceRequest, sizeof (EFI_USB_DEVICE_REQUEST));
@@ -218,15 +214,15 @@ PeiHubClearHubFeature ( DeviceRequest.Request = USB_HUB_CLEAR_FEATURE;
DeviceRequest.Value = Value;
- return UsbIoPpi->UsbControlTransfer (
- PeiServices,
- UsbIoPpi,
- &DeviceRequest,
- EfiUsbNoData,
- PcdGet32 (PcdUsbTransferTimeoutValue),
- NULL,
- 0
- );
+ return UsbIoPpi->UsbControlTransfer (
+ PeiServices,
+ UsbIoPpi,
+ &DeviceRequest,
+ EfiUsbNoData,
+ PcdGet32 (PcdUsbTransferTimeoutValue),
+ NULL,
+ 0
+ );
}
/**
@@ -246,15 +242,15 @@ PeiHubClearHubFeature ( **/
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
+ 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_USB_DEVICE_REQUEST DevReq;
- UINT8 DescType;
+ EFI_USB_DEVICE_REQUEST DevReq;
+ UINT8 DescType;
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
@@ -267,18 +263,18 @@ PeiGetHubDescriptor ( //
DevReq.RequestType = USB_RT_HUB | 0x80;
DevReq.Request = USB_HUB_GET_DESCRIPTOR;
- DevReq.Value = (UINT16) (DescType << 8);
- DevReq.Length = (UINT16) DescriptorSize;
-
- return UsbIoPpi->UsbControlTransfer (
- PeiServices,
- UsbIoPpi,
- &DevReq,
- EfiUsbDataIn,
- PcdGet32 (PcdUsbTransferTimeoutValue),
- HubDescriptor,
- (UINT16)DescriptorSize
- );
+ DevReq.Value = (UINT16)(DescType << 8);
+ DevReq.Length = (UINT16)DescriptorSize;
+
+ return UsbIoPpi->UsbControlTransfer (
+ PeiServices,
+ UsbIoPpi,
+ &DevReq,
+ EfiUsbDataIn,
+ PcdGet32 (PcdUsbTransferTimeoutValue),
+ HubDescriptor,
+ (UINT16)DescriptorSize
+ );
}
/**
@@ -299,13 +295,13 @@ PeiGetHubDescriptor ( **/
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
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_DEVICE *PeiUsbDevice,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ OUT EFI_USB_HUB_DESCRIPTOR *HubDescriptor
)
{
- EFI_STATUS Status;
+ EFI_STATUS Status;
//
// First get the hub descriptor length
@@ -335,12 +331,13 @@ PeiUsbHubReadDesc ( **/
EFI_STATUS
PeiUsbHubCtrlSetHubDepth (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_DEVICE *PeiUsbDevice,
- IN PEI_USB_IO_PPI *UsbIoPpi
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_DEVICE *PeiUsbDevice,
+ IN PEI_USB_IO_PPI *UsbIoPpi
)
{
- EFI_USB_DEVICE_REQUEST DevReq;
+ EFI_USB_DEVICE_REQUEST DevReq;
+
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
//
@@ -351,15 +348,15 @@ PeiUsbHubCtrlSetHubDepth ( DevReq.Value = PeiUsbDevice->Tier;
DevReq.Length = 0;
- return UsbIoPpi->UsbControlTransfer (
- PeiServices,
- UsbIoPpi,
- &DevReq,
- EfiUsbNoData,
- PcdGet32 (PcdUsbTransferTimeoutValue),
- NULL,
- 0
- );
+ return UsbIoPpi->UsbControlTransfer (
+ PeiServices,
+ UsbIoPpi,
+ &DevReq,
+ EfiUsbNoData,
+ PcdGet32 (PcdUsbTransferTimeoutValue),
+ NULL,
+ 0
+ );
}
/**
@@ -374,8 +371,8 @@ PeiUsbHubCtrlSetHubDepth ( **/
EFI_STATUS
PeiDoHubConfig (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_DEVICE *PeiUsbDevice
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_DEVICE *PeiUsbDevice
)
{
UINT8 HubDescBuffer[256];
@@ -391,17 +388,17 @@ PeiDoHubConfig ( // The length field of descriptor is UINT8 type, so the buffer
// with 256 bytes is enough to hold the descriptor data.
//
- HubDescriptor = (EFI_USB_HUB_DESCRIPTOR *) HubDescBuffer;
+ HubDescriptor = (EFI_USB_HUB_DESCRIPTOR *)HubDescBuffer;
//
// Get the hub descriptor
//
Status = PeiUsbHubReadDesc (
- PeiServices,
- PeiUsbDevice,
- UsbIoPpi,
- HubDescriptor
- );
+ PeiServices,
+ PeiUsbDevice,
+ UsbIoPpi,
+ HubDescriptor
+ );
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
}
@@ -421,18 +418,18 @@ PeiDoHubConfig ( //
for (Index = 0; Index < PeiUsbDevice->DownStreamPortNo; Index++) {
Status = PeiHubSetPortFeature (
- PeiServices,
- UsbIoPpi,
- (UINT8) (Index + 1),
- EfiUsbPortPower
- );
+ PeiServices,
+ UsbIoPpi,
+ (UINT8)(Index + 1),
+ EfiUsbPortPower
+ );
if (EFI_ERROR (Status)) {
- DEBUG (( DEBUG_ERROR, "PeiDoHubConfig: PeiHubSetPortFeature EfiUsbPortPower failed %x\n", Index));
+ DEBUG ((DEBUG_ERROR, "PeiDoHubConfig: PeiHubSetPortFeature EfiUsbPortPower failed %x\n", Index));
continue;
}
}
- DEBUG (( DEBUG_INFO, "PeiDoHubConfig: HubDescriptor.PwrOn2PwrGood: 0x%x\n", HubDescriptor->PwrOn2PwrGood));
+ DEBUG ((DEBUG_INFO, "PeiDoHubConfig: HubDescriptor.PwrOn2PwrGood: 0x%x\n", HubDescriptor->PwrOn2PwrGood));
if (HubDescriptor->PwrOn2PwrGood > 0) {
MicroSecondDelay (HubDescriptor->PwrOn2PwrGood * USB_SET_PORT_POWER_STALL);
}
@@ -441,10 +438,10 @@ PeiDoHubConfig ( // Clear Hub Status Change
//
Status = PeiHubGetHubStatus (
- PeiServices,
- UsbIoPpi,
- (UINT32 *) &HubStatus
- );
+ PeiServices,
+ UsbIoPpi,
+ (UINT32 *)&HubStatus
+ );
if (EFI_ERROR (Status)) {
return EFI_DEVICE_ERROR;
} else {
@@ -458,6 +455,7 @@ PeiDoHubConfig ( C_HUB_LOCAL_POWER
);
}
+
//
// Hub change overcurrent happens
//
@@ -484,14 +482,14 @@ PeiDoHubConfig ( **/
VOID
PeiResetHubPort (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- IN UINT8 PortNum
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ IN UINT8 PortNum
)
{
- EFI_STATUS Status;
- UINTN Index;
- EFI_USB_PORT_STATUS HubPortStatus;
+ EFI_STATUS Status;
+ UINTN Index;
+ EFI_USB_PORT_STATUS HubPortStatus;
MicroSecondDelay (100 * 1000);
@@ -521,7 +519,7 @@ PeiResetHubPort ( PeiServices,
UsbIoPpi,
PortNum,
- (UINT32 *) &HubPortStatus
+ (UINT32 *)&HubPortStatus
);
if (EFI_ERROR (Status)) {
diff --git a/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.h b/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.h index 2a6d911a06..abf5ba7142 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.h +++ b/MdeModulePkg/Bus/Usb/UsbBusPei/HubPeim.h @@ -10,7 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef _PEI_HUB_PEIM_H_
#define _PEI_HUB_PEIM_H_
-
//
// Hub feature numbers
//
@@ -35,45 +34,45 @@ SPDX-License-Identifier: BSD-2-Clause-Patent //
// Hub Characteristics
//
-#define HUB_CHAR_LPSM 0x0003
-#define HUB_CHAR_COMPOUND 0x0004
-#define HUB_CHAR_OCPM 0x0018
+#define HUB_CHAR_LPSM 0x0003
+#define HUB_CHAR_COMPOUND 0x0004
+#define HUB_CHAR_OCPM 0x0018
//
// Standard hub request and request type
// By [Spec-USB20/Chapter-11.24]
//
-#define USB_HUB_CLEAR_FEATURE 0x01
-#define USB_HUB_CLEAR_FEATURE_REQ_TYPE 0x20
+#define USB_HUB_CLEAR_FEATURE 0x01
+#define USB_HUB_CLEAR_FEATURE_REQ_TYPE 0x20
-#define USB_HUB_CLEAR_FEATURE_PORT 0x01
-#define USB_HUB_CLEAR_FEATURE_PORT_REQ_TYPE 0x23
+#define USB_HUB_CLEAR_FEATURE_PORT 0x01
+#define USB_HUB_CLEAR_FEATURE_PORT_REQ_TYPE 0x23
-#define USB_HUB_GET_BUS_STATE 0x02
-#define USB_HUB_GET_BUS_STATE_REQ_TYPE 0xA3
+#define USB_HUB_GET_BUS_STATE 0x02
+#define USB_HUB_GET_BUS_STATE_REQ_TYPE 0xA3
-#define USB_HUB_GET_DESCRIPTOR 0x06
-#define USB_HUB_GET_DESCRIPTOR_REQ_TYPE 0xA0
+#define USB_HUB_GET_DESCRIPTOR 0x06
+#define USB_HUB_GET_DESCRIPTOR_REQ_TYPE 0xA0
-#define USB_HUB_GET_HUB_STATUS 0x00
-#define USB_HUB_GET_HUB_STATUS_REQ_TYPE 0xA0
+#define USB_HUB_GET_HUB_STATUS 0x00
+#define USB_HUB_GET_HUB_STATUS_REQ_TYPE 0xA0
-#define USB_HUB_GET_PORT_STATUS 0x00
-#define USB_HUB_GET_PORT_STATUS_REQ_TYPE 0xA3
+#define USB_HUB_GET_PORT_STATUS 0x00
+#define USB_HUB_GET_PORT_STATUS_REQ_TYPE 0xA3
-#define USB_HUB_SET_DESCRIPTOR 0x07
-#define USB_HUB_SET_DESCRIPTOR_REQ_TYPE 0x20
+#define USB_HUB_SET_DESCRIPTOR 0x07
+#define USB_HUB_SET_DESCRIPTOR_REQ_TYPE 0x20
-#define USB_HUB_SET_HUB_FEATURE 0x03
-#define USB_HUB_SET_HUB_FEATURE_REQ_TYPE 0x20
+#define USB_HUB_SET_HUB_FEATURE 0x03
+#define USB_HUB_SET_HUB_FEATURE_REQ_TYPE 0x20
-#define USB_HUB_SET_PORT_FEATURE 0x03
-#define USB_HUB_SET_PORT_FEATURE_REQ_TYPE 0x23
+#define USB_HUB_SET_PORT_FEATURE 0x03
+#define USB_HUB_SET_PORT_FEATURE_REQ_TYPE 0x23
-#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
-#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
+#define USB_RT_HUB (USB_TYPE_CLASS | USB_RECIP_DEVICE)
+#define USB_RT_PORT (USB_TYPE_CLASS | USB_RECIP_OTHER)
-#define USB_HUB_REQ_SET_DEPTH 12
+#define USB_HUB_REQ_SET_DEPTH 12
#define MAXBYTES 8
#pragma pack(1)
@@ -81,21 +80,22 @@ SPDX-License-Identifier: BSD-2-Clause-Patent // Hub descriptor, the last two fields are of variable length.
//
typedef struct {
- UINT8 Length;
- UINT8 DescriptorType;
- UINT8 NbrPorts;
- UINT8 HubCharacteristics[2];
- UINT8 PwrOn2PwrGood;
- UINT8 HubContrCurrent;
- UINT8 Filler[MAXBYTES];
+ UINT8 Length;
+ UINT8 DescriptorType;
+ UINT8 NbrPorts;
+ UINT8 HubCharacteristics[2];
+ UINT8 PwrOn2PwrGood;
+ UINT8 HubContrCurrent;
+ UINT8 Filler[MAXBYTES];
} EFI_USB_HUB_DESCRIPTOR;
typedef struct {
- UINT16 HubStatus;
- UINT16 HubChangeStatus;
+ UINT16 HubStatus;
+ UINT16 HubChangeStatus;
} EFI_USB_HUB_STATUS;
#pragma pack()
+
/**
Get a given hub port status.
@@ -111,10 +111,10 @@ typedef struct { **/
EFI_STATUS
PeiHubGetPortStatus (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- IN UINT8 Port,
- OUT UINT32 *PortStatus
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ IN UINT8 Port,
+ OUT UINT32 *PortStatus
);
/**
@@ -132,13 +132,12 @@ PeiHubGetPortStatus ( **/
EFI_STATUS
PeiHubSetPortFeature (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- IN UINT8 Port,
- IN UINT8 Value
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ IN UINT8 Port,
+ IN UINT8 Value
);
-
/**
Get a given hub status.
@@ -153,9 +152,9 @@ PeiHubSetPortFeature ( **/
EFI_STATUS
PeiHubGetHubStatus (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- OUT UINT32 *HubStatus
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ OUT UINT32 *HubStatus
);
/**
@@ -173,10 +172,10 @@ PeiHubGetHubStatus ( **/
EFI_STATUS
PeiHubClearPortFeature (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- IN UINT8 Port,
- IN UINT8 Value
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ IN UINT8 Port,
+ IN UINT8 Value
);
/**
@@ -193,9 +192,9 @@ PeiHubClearPortFeature ( **/
EFI_STATUS
PeiHubClearHubFeature (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- IN UINT8 Value
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ IN UINT8 Value
);
/**
@@ -234,8 +233,8 @@ PeiGetHubDescriptor ( **/
EFI_STATUS
PeiDoHubConfig (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_DEVICE *PeiUsbDevice
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_DEVICE *PeiUsbDevice
);
/**
@@ -248,11 +247,9 @@ PeiDoHubConfig ( **/
VOID
PeiResetHubPort (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- IN UINT8 PortNum
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ IN UINT8 PortNum
);
#endif
-
-
diff --git a/MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.c b/MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.c index 1385b0ab59..8cb205e58a 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.c +++ b/MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.c @@ -28,23 +28,23 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/
EFI_STATUS
PeiUsbGetDescriptor (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- IN UINT16 Value,
- IN UINT16 Index,
- IN UINT16 DescriptorLength,
- OUT VOID *Descriptor
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ IN UINT16 Value,
+ IN UINT16 Index,
+ IN UINT16 DescriptorLength,
+ OUT VOID *Descriptor
)
{
EFI_USB_DEVICE_REQUEST DevReq;
ASSERT (UsbIoPpi != NULL);
- DevReq.RequestType = USB_DEV_GET_DESCRIPTOR_REQ_TYPE;
- DevReq.Request = USB_DEV_GET_DESCRIPTOR;
- DevReq.Value = Value;
- DevReq.Index = Index;
- DevReq.Length = DescriptorLength;
+ DevReq.RequestType = USB_DEV_GET_DESCRIPTOR_REQ_TYPE;
+ DevReq.Request = USB_DEV_GET_DESCRIPTOR;
+ DevReq.Value = Value;
+ DevReq.Index = Index;
+ DevReq.Length = DescriptorLength;
return UsbIoPpi->UsbControlTransfer (
PeiServices,
@@ -71,20 +71,20 @@ PeiUsbGetDescriptor ( **/
EFI_STATUS
PeiUsbSetDeviceAddress (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- IN UINT16 AddressValue
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ IN UINT16 AddressValue
)
{
EFI_USB_DEVICE_REQUEST DevReq;
ASSERT (UsbIoPpi != NULL);
- DevReq.RequestType = USB_DEV_SET_ADDRESS_REQ_TYPE;
- DevReq.Request = USB_DEV_SET_ADDRESS;
- DevReq.Value = AddressValue;
- DevReq.Index = 0;
- DevReq.Length = 0;
+ DevReq.RequestType = USB_DEV_SET_ADDRESS_REQ_TYPE;
+ DevReq.Request = USB_DEV_SET_ADDRESS;
+ DevReq.Value = AddressValue;
+ DevReq.Index = 0;
+ DevReq.Length = 0;
return UsbIoPpi->UsbControlTransfer (
PeiServices,
@@ -97,8 +97,6 @@ PeiUsbSetDeviceAddress ( );
}
-
-
/**
Configure a usb device to Configuration 1.
@@ -112,16 +110,17 @@ PeiUsbSetDeviceAddress ( **/
EFI_STATUS
PeiUsbSetConfiguration (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi
)
{
EFI_USB_DEVICE_REQUEST DevReq;
+
ZeroMem (&DevReq, sizeof (EFI_USB_DEVICE_REQUEST));
- DevReq.RequestType = USB_DEV_SET_CONFIGURATION_REQ_TYPE;
- DevReq.Request = USB_DEV_SET_CONFIGURATION;
- DevReq.Value = 1;
+ DevReq.RequestType = USB_DEV_SET_CONFIGURATION_REQ_TYPE;
+ DevReq.Request = USB_DEV_SET_CONFIGURATION;
+ DevReq.Value = 1;
return UsbIoPpi->UsbControlTransfer (
PeiServices,
@@ -168,12 +167,12 @@ IsPortConnect ( **/
UINTN
PeiUsbGetDeviceSpeed (
- IN UINT16 PortStatus
+ IN UINT16 PortStatus
)
{
if ((PortStatus & USB_PORT_STAT_LOW_SPEED) != 0) {
return EFI_USB_SPEED_LOW;
- } else if ((PortStatus & USB_PORT_STAT_HIGH_SPEED) != 0){
+ } else if ((PortStatus & USB_PORT_STAT_HIGH_SPEED) != 0) {
return EFI_USB_SPEED_HIGH;
} else if ((PortStatus & USB_PORT_STAT_SUPER_SPEED) != 0) {
return EFI_USB_SPEED_SUPER;
@@ -181,5 +180,3 @@ PeiUsbGetDeviceSpeed ( return EFI_USB_SPEED_FULL;
}
}
-
-
diff --git a/MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.h b/MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.h index 48b8e594b2..23f531e8bc 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.h +++ b/MdeModulePkg/Bus/Usb/UsbBusPei/PeiUsbLib.h @@ -10,34 +10,33 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef _PEI_USB_LIB_H_
#define _PEI_USB_LIB_H_
-
//
// Standard device request and request type
// By [Spec-USB20/Chapter-9.4]
//
-#define USB_DEV_GET_STATUS 0x00
-#define USB_DEV_GET_STATUS_REQ_TYPE_D 0x80 // Receiver : Device
-#define USB_DEV_GET_STATUS_REQ_TYPE_I 0x81 // Receiver : Interface
-#define USB_DEV_GET_STATUS_REQ_TYPE_E 0x82 // Receiver : Endpoint
+#define USB_DEV_GET_STATUS 0x00
+#define USB_DEV_GET_STATUS_REQ_TYPE_D 0x80 // Receiver : Device
+#define USB_DEV_GET_STATUS_REQ_TYPE_I 0x81 // Receiver : Interface
+#define USB_DEV_GET_STATUS_REQ_TYPE_E 0x82 // Receiver : Endpoint
-#define USB_DEV_CLEAR_FEATURE 0x01
-#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_D 0x00 // Receiver : Device
-#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_I 0x01 // Receiver : Interface
-#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_E 0x02 // Receiver : Endpoint
+#define USB_DEV_CLEAR_FEATURE 0x01
+#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_D 0x00 // Receiver : Device
+#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_I 0x01 // Receiver : Interface
+#define USB_DEV_CLEAR_FEATURE_REQ_TYPE_E 0x02 // Receiver : Endpoint
-#define USB_DEV_SET_FEATURE 0x03
-#define USB_DEV_SET_FEATURE_REQ_TYPE_D 0x00 // Receiver : Device
-#define USB_DEV_SET_FEATURE_REQ_TYPE_I 0x01 // Receiver : Interface
-#define USB_DEV_SET_FEATURE_REQ_TYPE_E 0x02 // Receiver : Endpoint
+#define USB_DEV_SET_FEATURE 0x03
+#define USB_DEV_SET_FEATURE_REQ_TYPE_D 0x00 // Receiver : Device
+#define USB_DEV_SET_FEATURE_REQ_TYPE_I 0x01 // Receiver : Interface
+#define USB_DEV_SET_FEATURE_REQ_TYPE_E 0x02 // Receiver : Endpoint
-#define USB_DEV_SET_ADDRESS 0x05
-#define USB_DEV_SET_ADDRESS_REQ_TYPE 0x00
+#define USB_DEV_SET_ADDRESS 0x05
+#define USB_DEV_SET_ADDRESS_REQ_TYPE 0x00
-#define USB_DEV_GET_DESCRIPTOR 0x06
-#define USB_DEV_GET_DESCRIPTOR_REQ_TYPE 0x80
+#define USB_DEV_GET_DESCRIPTOR 0x06
+#define USB_DEV_GET_DESCRIPTOR_REQ_TYPE 0x80
-#define USB_DEV_SET_DESCRIPTOR 0x07
-#define USB_DEV_SET_DESCRIPTOR_REQ_TYPE 0x00
+#define USB_DEV_SET_DESCRIPTOR 0x07
+#define USB_DEV_SET_DESCRIPTOR_REQ_TYPE 0x00
#define USB_DEV_GET_CONFIGURATION 0x08
#define USB_DEV_GET_CONFIGURATION_REQ_TYPE 0x80
@@ -45,42 +44,42 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #define USB_DEV_SET_CONFIGURATION 0x09
#define USB_DEV_SET_CONFIGURATION_REQ_TYPE 0x00
-#define USB_DEV_GET_INTERFACE 0x0A
-#define USB_DEV_GET_INTERFACE_REQ_TYPE 0x81
+#define USB_DEV_GET_INTERFACE 0x0A
+#define USB_DEV_GET_INTERFACE_REQ_TYPE 0x81
-#define USB_DEV_SET_INTERFACE 0x0B
-#define USB_DEV_SET_INTERFACE_REQ_TYPE 0x01
+#define USB_DEV_SET_INTERFACE 0x0B
+#define USB_DEV_SET_INTERFACE_REQ_TYPE 0x01
-#define USB_DEV_SYNCH_FRAME 0x0C
-#define USB_DEV_SYNCH_FRAME_REQ_TYPE 0x82
+#define USB_DEV_SYNCH_FRAME 0x0C
+#define USB_DEV_SYNCH_FRAME_REQ_TYPE 0x82
//
// USB Descriptor types
//
-#define USB_DT_DEVICE 0x01
-#define USB_DT_CONFIG 0x02
-#define USB_DT_STRING 0x03
-#define USB_DT_INTERFACE 0x04
-#define USB_DT_ENDPOINT 0x05
-#define USB_DT_HUB 0x29
-#define USB_DT_SUPERSPEED_HUB 0x2A
-#define USB_DT_HID 0x21
+#define USB_DT_DEVICE 0x01
+#define USB_DT_CONFIG 0x02
+#define USB_DT_STRING 0x03
+#define USB_DT_INTERFACE 0x04
+#define USB_DT_ENDPOINT 0x05
+#define USB_DT_HUB 0x29
+#define USB_DT_SUPERSPEED_HUB 0x2A
+#define USB_DT_HID 0x21
//
// USB request type
//
-#define USB_TYPE_STANDARD (0x00 << 5)
-#define USB_TYPE_CLASS (0x01 << 5)
-#define USB_TYPE_VENDOR (0x02 << 5)
-#define USB_TYPE_RESERVED (0x03 << 5)
+#define USB_TYPE_STANDARD (0x00 << 5)
+#define USB_TYPE_CLASS (0x01 << 5)
+#define USB_TYPE_VENDOR (0x02 << 5)
+#define USB_TYPE_RESERVED (0x03 << 5)
//
// USB request targer device
//
-#define USB_RECIP_DEVICE 0x00
-#define USB_RECIP_INTERFACE 0x01
-#define USB_RECIP_ENDPOINT 0x02
-#define USB_RECIP_OTHER 0x03
+#define USB_RECIP_DEVICE 0x00
+#define USB_RECIP_INTERFACE 0x01
+#define USB_RECIP_ENDPOINT 0x02
+#define USB_RECIP_OTHER 0x03
typedef enum {
EfiUsbEndpointHalt,
@@ -114,12 +113,12 @@ typedef enum { **/
EFI_STATUS
PeiUsbGetDescriptor (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- IN UINT16 Value,
- IN UINT16 Index,
- IN UINT16 DescriptorLength,
- OUT VOID *Descriptor
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ IN UINT16 Value,
+ IN UINT16 Index,
+ IN UINT16 DescriptorLength,
+ OUT VOID *Descriptor
);
/**
@@ -136,12 +135,11 @@ PeiUsbGetDescriptor ( **/
EFI_STATUS
PeiUsbSetDeviceAddress (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi,
- IN UINT16 AddressValue
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi,
+ IN UINT16 AddressValue
);
-
/**
Configure a usb device to Configuration 1.
@@ -155,8 +153,8 @@ PeiUsbSetDeviceAddress ( **/
EFI_STATUS
PeiUsbSetConfiguration (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *UsbIoPpi
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *UsbIoPpi
);
/**
@@ -183,7 +181,7 @@ IsPortConnect ( **/
UINTN
PeiUsbGetDeviceSpeed (
- IN UINT16 PortStatus
+ IN UINT16 PortStatus
);
#endif
diff --git a/MdeModulePkg/Bus/Usb/UsbBusPei/UsbIoPeim.c b/MdeModulePkg/Bus/Usb/UsbBusPei/UsbIoPeim.c index 4b292b7feb..c4283521ff 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusPei/UsbIoPeim.c +++ b/MdeModulePkg/Bus/Usb/UsbBusPei/UsbIoPeim.c @@ -33,29 +33,30 @@ SPDX-License-Identifier: BSD-2-Clause-Patent EFI_STATUS
EFIAPI
PeiUsbControlTransfer (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This,
- IN EFI_USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT32 Timeout,
- IN OUT VOID *Data OPTIONAL,
- IN UINTN DataLength OPTIONAL
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This,
+ IN EFI_USB_DEVICE_REQUEST *Request,
+ IN EFI_USB_DATA_DIRECTION Direction,
+ IN UINT32 Timeout,
+ IN OUT VOID *Data OPTIONAL,
+ IN UINTN DataLength OPTIONAL
)
{
- EFI_STATUS Status;
- PEI_USB_DEVICE *PeiUsbDev;
- UINT32 TransferResult;
- EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor;
- UINT8 EndpointIndex;
+ EFI_STATUS Status;
+ PEI_USB_DEVICE *PeiUsbDev;
+ UINT32 TransferResult;
+ EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor;
+ UINT8 EndpointIndex;
PeiUsbDev = PEI_USB_DEVICE_FROM_THIS (This);
EndpointDescriptor = NULL;
- EndpointIndex = 0;
+ EndpointIndex = 0;
if ((Request->Request == USB_REQ_CLEAR_FEATURE) &&
(Request->RequestType == USB_DEV_CLEAR_FEATURE_REQ_TYPE_E) &&
- (Request->Value == USB_FEATURE_ENDPOINT_HALT)) {
+ (Request->Value == USB_FEATURE_ENDPOINT_HALT))
+ {
//
// Request->Index is the Endpoint Address, use it to get the Endpoint Index.
//
@@ -79,33 +80,33 @@ PeiUsbControlTransfer ( if (PeiUsbDev->Usb2HcPpi != NULL) {
Status = PeiUsbDev->Usb2HcPpi->ControlTransfer (
- PeiServices,
- PeiUsbDev->Usb2HcPpi,
- PeiUsbDev->DeviceAddress,
- PeiUsbDev->DeviceSpeed,
- PeiUsbDev->MaxPacketSize0,
- Request,
- Direction,
- Data,
- &DataLength,
- Timeout,
- &(PeiUsbDev->Translator),
- &TransferResult
- );
+ PeiServices,
+ PeiUsbDev->Usb2HcPpi,
+ PeiUsbDev->DeviceAddress,
+ PeiUsbDev->DeviceSpeed,
+ PeiUsbDev->MaxPacketSize0,
+ Request,
+ Direction,
+ Data,
+ &DataLength,
+ Timeout,
+ &(PeiUsbDev->Translator),
+ &TransferResult
+ );
} else {
Status = PeiUsbDev->UsbHcPpi->ControlTransfer (
- PeiServices,
- PeiUsbDev->UsbHcPpi,
- PeiUsbDev->DeviceAddress,
- PeiUsbDev->DeviceSpeed,
- (UINT8) PeiUsbDev->MaxPacketSize0,
- Request,
- Direction,
- Data,
- &DataLength,
- Timeout,
- &TransferResult
- );
+ PeiServices,
+ PeiUsbDev->UsbHcPpi,
+ PeiUsbDev->DeviceAddress,
+ PeiUsbDev->DeviceSpeed,
+ (UINT8)PeiUsbDev->MaxPacketSize0,
+ Request,
+ Direction,
+ Data,
+ &DataLength,
+ Timeout,
+ &TransferResult
+ );
}
//
@@ -113,9 +114,10 @@ PeiUsbControlTransfer ( //
if ((Request->Request == USB_REQ_CLEAR_FEATURE) &&
(Request->RequestType == USB_DEV_CLEAR_FEATURE_REQ_TYPE_E) &&
- (Request->Value == USB_FEATURE_ENDPOINT_HALT)) {
+ (Request->Value == USB_FEATURE_ENDPOINT_HALT))
+ {
if ((PeiUsbDev->DataToggle & (1 << EndpointIndex)) != 0) {
- PeiUsbDev->DataToggle = (UINT16) (PeiUsbDev->DataToggle ^ (1 << EndpointIndex));
+ PeiUsbDev->DataToggle = (UINT16)(PeiUsbDev->DataToggle ^ (1 << EndpointIndex));
}
}
@@ -147,30 +149,30 @@ PeiUsbControlTransfer ( EFI_STATUS
EFIAPI
PeiUsbBulkTransfer (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This,
- IN UINT8 DeviceEndpoint,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN Timeout
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This,
+ IN UINT8 DeviceEndpoint,
+ IN OUT VOID *Data,
+ IN OUT UINTN *DataLength,
+ IN UINTN Timeout
)
{
- EFI_STATUS Status;
- PEI_USB_DEVICE *PeiUsbDev;
- UINT32 TransferResult;
- UINTN MaxPacketLength;
- UINT8 DataToggle;
- UINT8 OldToggle;
- EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor;
- UINT8 EndpointIndex;
- VOID *Data2[EFI_USB_MAX_BULK_BUFFER_NUM];
-
- PeiUsbDev = PEI_USB_DEVICE_FROM_THIS (This);
+ EFI_STATUS Status;
+ PEI_USB_DEVICE *PeiUsbDev;
+ UINT32 TransferResult;
+ UINTN MaxPacketLength;
+ UINT8 DataToggle;
+ UINT8 OldToggle;
+ EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescriptor;
+ UINT8 EndpointIndex;
+ VOID *Data2[EFI_USB_MAX_BULK_BUFFER_NUM];
+
+ PeiUsbDev = PEI_USB_DEVICE_FROM_THIS (This);
EndpointDescriptor = NULL;
- EndpointIndex = 0;
- Data2[0] = Data;
- Data2[1] = NULL;
+ EndpointIndex = 0;
+ Data2[0] = Data;
+ Data2[1] = NULL;
while (EndpointIndex < MAX_ENDPOINT) {
Status = PeiUsbGetEndpointDescriptor (PeiServices, This, EndpointIndex, &EndpointDescriptor);
@@ -200,36 +202,36 @@ PeiUsbBulkTransfer ( if (PeiUsbDev->Usb2HcPpi != NULL) {
Status = PeiUsbDev->Usb2HcPpi->BulkTransfer (
- PeiServices,
- PeiUsbDev->Usb2HcPpi,
- PeiUsbDev->DeviceAddress,
- DeviceEndpoint,
- PeiUsbDev->DeviceSpeed,
- MaxPacketLength,
- Data2,
- DataLength,
- &DataToggle,
- Timeout,
- &(PeiUsbDev->Translator),
- &TransferResult
- );
+ PeiServices,
+ PeiUsbDev->Usb2HcPpi,
+ PeiUsbDev->DeviceAddress,
+ DeviceEndpoint,
+ PeiUsbDev->DeviceSpeed,
+ MaxPacketLength,
+ Data2,
+ DataLength,
+ &DataToggle,
+ Timeout,
+ &(PeiUsbDev->Translator),
+ &TransferResult
+ );
} else {
Status = PeiUsbDev->UsbHcPpi->BulkTransfer (
- PeiServices,
- PeiUsbDev->UsbHcPpi,
- PeiUsbDev->DeviceAddress,
- DeviceEndpoint,
- (UINT8) MaxPacketLength,
- Data,
- DataLength,
- &DataToggle,
- Timeout,
- &TransferResult
- );
+ PeiServices,
+ PeiUsbDev->UsbHcPpi,
+ PeiUsbDev->DeviceAddress,
+ DeviceEndpoint,
+ (UINT8)MaxPacketLength,
+ Data,
+ DataLength,
+ &DataToggle,
+ Timeout,
+ &TransferResult
+ );
}
if (OldToggle != DataToggle) {
- PeiUsbDev->DataToggle = (UINT16) (PeiUsbDev->DataToggle ^ (1 << EndpointIndex));
+ PeiUsbDev->DataToggle = (UINT16)(PeiUsbDev->DataToggle ^ (1 << EndpointIndex));
}
DEBUG ((DEBUG_INFO, "PeiUsbBulkTransfer: %r\n", Status));
@@ -250,14 +252,15 @@ PeiUsbBulkTransfer ( EFI_STATUS
EFIAPI
PeiUsbGetInterfaceDescriptor (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This,
- OUT EFI_USB_INTERFACE_DESCRIPTOR **InterfaceDescriptor
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This,
+ OUT EFI_USB_INTERFACE_DESCRIPTOR **InterfaceDescriptor
)
{
PEI_USB_DEVICE *PeiUsbDev;
- PeiUsbDev = PEI_USB_DEVICE_FROM_THIS (This);
- *InterfaceDescriptor = PeiUsbDev->InterfaceDesc;
+
+ PeiUsbDev = PEI_USB_DEVICE_FROM_THIS (This);
+ *InterfaceDescriptor = PeiUsbDev->InterfaceDesc;
return EFI_SUCCESS;
}
@@ -276,10 +279,10 @@ PeiUsbGetInterfaceDescriptor ( EFI_STATUS
EFIAPI
PeiUsbGetEndpointDescriptor (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This,
- IN UINT8 EndpointIndex,
- OUT EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptor
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This,
+ IN UINT8 EndpointIndex,
+ OUT EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptor
)
{
PEI_USB_DEVICE *PeiUsbDev;
@@ -317,8 +320,8 @@ PeiUsbGetEndpointDescriptor ( EFI_STATUS
EFIAPI
PeiUsbPortReset (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This
)
{
PEI_USB_DEVICE *PeiUsbDev;
@@ -338,14 +341,14 @@ PeiUsbPortReset ( //
// Set address
//
- Address = PeiUsbDev->DeviceAddress;
- PeiUsbDev->DeviceAddress = 0;
+ Address = PeiUsbDev->DeviceAddress;
+ PeiUsbDev->DeviceAddress = 0;
Status = PeiUsbSetDeviceAddress (
- PeiServices,
- This,
- Address
- );
+ PeiServices,
+ This,
+ Address
+ );
if (EFI_ERROR (Status)) {
return Status;
@@ -357,9 +360,9 @@ PeiUsbPortReset ( // Set default configuration
//
Status = PeiUsbSetConfiguration (
- PeiServices,
- This
- );
+ PeiServices,
+ This
+ );
return Status;
}
diff --git a/MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.c b/MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.c index 12dc975e88..6ea4495162 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.c +++ b/MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.c @@ -14,7 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent //
// UsbIo PPI interface function
//
-PEI_USB_IO_PPI mUsbIoPpi = {
+PEI_USB_IO_PPI mUsbIoPpi = {
PeiUsbControlTransfer,
PeiUsbBulkTransfer,
PeiUsbGetInterfaceDescriptor,
@@ -22,7 +22,7 @@ PEI_USB_IO_PPI mUsbIoPpi = { PeiUsbPortReset
};
-EFI_PEI_PPI_DESCRIPTOR mUsbIoPpiList = {
+EFI_PEI_PPI_DESCRIPTOR mUsbIoPpiList = {
(EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
&gPeiUsbIoPpiGuid,
NULL
@@ -42,9 +42,9 @@ EFI_PEI_PPI_DESCRIPTOR mUsbIoPpiList = { **/
EFI_STATUS
PeiUsbEnumeration (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi,
- IN PEI_USB2_HOST_CONTROLLER_PPI *Usb2HcPpi
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi,
+ IN PEI_USB2_HOST_CONTROLLER_PPI *Usb2HcPpi
);
/**
@@ -62,10 +62,10 @@ PeiUsbEnumeration ( **/
EFI_STATUS
PeiConfigureUsbDevice (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_DEVICE *PeiUsbDevice,
- IN UINT8 Port,
- IN OUT UINT8 *DeviceAddress
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_DEVICE *PeiUsbDevice,
+ IN UINT8 Port,
+ IN OUT UINT8 *DeviceAddress
);
/**
@@ -81,8 +81,8 @@ PeiConfigureUsbDevice ( **/
EFI_STATUS
PeiUsbGetAllConfiguration (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_DEVICE *PeiUsbDevice
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_DEVICE *PeiUsbDevice
);
/**
@@ -100,11 +100,11 @@ PeiUsbGetAllConfiguration ( **/
EFI_STATUS
GetExpectedDescriptor (
- IN UINT8 *Buffer,
- IN UINTN Length,
- IN UINT8 DescType,
- IN UINT8 DescLength,
- OUT UINTN *ParsedBytes
+ IN UINT8 *Buffer,
+ IN UINTN Length,
+ IN UINT8 DescType,
+ IN UINT8 DescLength,
+ OUT UINTN *ParsedBytes
);
/**
@@ -121,14 +121,14 @@ GetExpectedDescriptor ( EFI_STATUS
EFIAPI
PeimInitializeUsb (
- IN EFI_PEI_FILE_HANDLE FileHandle,
- IN CONST EFI_PEI_SERVICES **PeiServices
+ IN EFI_PEI_FILE_HANDLE FileHandle,
+ IN CONST EFI_PEI_SERVICES **PeiServices
)
{
- EFI_STATUS Status;
- UINTN Index;
- PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi;
- PEI_USB2_HOST_CONTROLLER_PPI *Usb2HcPpi;
+ EFI_STATUS Status;
+ UINTN Index;
+ PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi;
+ PEI_USB2_HOST_CONTROLLER_PPI *Usb2HcPpi;
if (!EFI_ERROR (PeiServicesRegisterForShadow (FileHandle))) {
return EFI_SUCCESS;
@@ -147,7 +147,7 @@ PeimInitializeUsb ( &gPeiUsbHostControllerPpiGuid,
Index,
NULL,
- (VOID **) &UsbHcPpi
+ (VOID **)&UsbHcPpi
);
if (EFI_ERROR (Status)) {
//
@@ -155,7 +155,8 @@ PeimInitializeUsb ( //
break;
}
- PeiUsbEnumeration ((EFI_PEI_SERVICES **) PeiServices, UsbHcPpi, NULL);
+
+ PeiUsbEnumeration ((EFI_PEI_SERVICES **)PeiServices, UsbHcPpi, NULL);
Index++;
}
@@ -168,7 +169,7 @@ PeimInitializeUsb ( &gPeiUsb2HostControllerPpiGuid,
Index,
NULL,
- (VOID **) &Usb2HcPpi
+ (VOID **)&Usb2HcPpi
);
if (EFI_ERROR (Status)) {
//
@@ -176,7 +177,8 @@ PeimInitializeUsb ( //
break;
}
- PeiUsbEnumeration ((EFI_PEI_SERVICES **) PeiServices, NULL, Usb2HcPpi);
+
+ PeiUsbEnumeration ((EFI_PEI_SERVICES **)PeiServices, NULL, Usb2HcPpi);
Index++;
}
}
@@ -203,9 +205,9 @@ PeimInitializeUsb ( **/
EFI_STATUS
PeiHubEnumeration (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_DEVICE *PeiUsbDevice,
- IN UINT8 *CurrentAddress
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_DEVICE *PeiUsbDevice,
+ IN UINT8 *CurrentAddress
)
{
UINTN Index;
@@ -218,19 +220,17 @@ PeiHubEnumeration ( UINTN InterfaceIndex;
UINTN EndpointIndex;
-
- UsbIoPpi = &PeiUsbDevice->UsbIoPpi;
+ UsbIoPpi = &PeiUsbDevice->UsbIoPpi;
DEBUG ((DEBUG_INFO, "PeiHubEnumeration: DownStreamPortNo: %x\n", PeiUsbDevice->DownStreamPortNo));
for (Index = 0; Index < PeiUsbDevice->DownStreamPortNo; Index++) {
-
Status = PeiHubGetPortStatus (
- PeiServices,
- UsbIoPpi,
- (UINT8) (Index + 1),
- (UINT32 *) &PortStatus
- );
+ PeiServices,
+ UsbIoPpi,
+ (UINT8)(Index + 1),
+ (UINT32 *)&PortStatus
+ );
if (EFI_ERROR (Status)) {
continue;
@@ -248,22 +248,22 @@ PeiHubEnumeration ( // Begin to deal with the new device
//
MemPages = sizeof (PEI_USB_DEVICE) / EFI_PAGE_SIZE + 1;
- Status = PeiServicesAllocatePages (
- EfiBootServicesCode,
- MemPages,
- &AllocateAddress
- );
+ Status = PeiServicesAllocatePages (
+ EfiBootServicesCode,
+ MemPages,
+ &AllocateAddress
+ );
if (EFI_ERROR (Status)) {
return EFI_OUT_OF_RESOURCES;
}
- NewPeiUsbDevice = (PEI_USB_DEVICE *) ((UINTN) AllocateAddress);
+ NewPeiUsbDevice = (PEI_USB_DEVICE *)((UINTN)AllocateAddress);
ZeroMem (NewPeiUsbDevice, sizeof (PEI_USB_DEVICE));
- NewPeiUsbDevice->Signature = PEI_USB_DEVICE_SIGNATURE;
- NewPeiUsbDevice->DeviceAddress = 0;
- NewPeiUsbDevice->MaxPacketSize0 = 8;
- NewPeiUsbDevice->DataToggle = 0;
+ NewPeiUsbDevice->Signature = PEI_USB_DEVICE_SIGNATURE;
+ NewPeiUsbDevice->DeviceAddress = 0;
+ NewPeiUsbDevice->MaxPacketSize0 = 8;
+ NewPeiUsbDevice->DataToggle = 0;
CopyMem (
&(NewPeiUsbDevice->UsbIoPpi),
&mUsbIoPpi,
@@ -275,39 +275,40 @@ PeiHubEnumeration ( sizeof (EFI_PEI_PPI_DESCRIPTOR)
);
NewPeiUsbDevice->UsbIoPpiList.Ppi = &NewPeiUsbDevice->UsbIoPpi;
- NewPeiUsbDevice->AllocateAddress = (UINTN) AllocateAddress;
+ NewPeiUsbDevice->AllocateAddress = (UINTN)AllocateAddress;
NewPeiUsbDevice->UsbHcPpi = PeiUsbDevice->UsbHcPpi;
NewPeiUsbDevice->Usb2HcPpi = PeiUsbDevice->Usb2HcPpi;
- NewPeiUsbDevice->Tier = (UINT8) (PeiUsbDevice->Tier + 1);
+ NewPeiUsbDevice->Tier = (UINT8)(PeiUsbDevice->Tier + 1);
NewPeiUsbDevice->IsHub = 0x0;
NewPeiUsbDevice->DownStreamPortNo = 0x0;
if (((PortStatus.PortChangeStatus & USB_PORT_STAT_C_RESET) == 0) ||
- ((PortStatus.PortStatus & (USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE)) == 0)) {
+ ((PortStatus.PortStatus & (USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE)) == 0))
+ {
//
// If the port already has reset change flag and is connected and enabled, skip the port reset logic.
//
PeiResetHubPort (PeiServices, UsbIoPpi, (UINT8)(Index + 1));
PeiHubGetPortStatus (
- PeiServices,
- UsbIoPpi,
- (UINT8) (Index + 1),
- (UINT32 *) &PortStatus
- );
+ PeiServices,
+ UsbIoPpi,
+ (UINT8)(Index + 1),
+ (UINT32 *)&PortStatus
+ );
} else {
PeiHubClearPortFeature (
PeiServices,
UsbIoPpi,
- (UINT8) (Index + 1),
+ (UINT8)(Index + 1),
EfiUsbPortResetChange
);
}
- NewPeiUsbDevice->DeviceSpeed = (UINT8) PeiUsbGetDeviceSpeed (PortStatus.PortStatus);
+ NewPeiUsbDevice->DeviceSpeed = (UINT8)PeiUsbGetDeviceSpeed (PortStatus.PortStatus);
DEBUG ((DEBUG_INFO, "Device Speed =%d\n", PeiUsbDevice->DeviceSpeed));
- if (USB_BIT_IS_SET (PortStatus.PortStatus, USB_PORT_STAT_SUPER_SPEED)){
+ if (USB_BIT_IS_SET (PortStatus.PortStatus, USB_PORT_STAT_SUPER_SPEED)) {
NewPeiUsbDevice->MaxPacketSize0 = 512;
} else if (USB_BIT_IS_SET (PortStatus.PortStatus, USB_PORT_STAT_HIGH_SPEED)) {
NewPeiUsbDevice->MaxPacketSize0 = 64;
@@ -317,12 +318,12 @@ PeiHubEnumeration ( NewPeiUsbDevice->MaxPacketSize0 = 8;
}
- if(NewPeiUsbDevice->DeviceSpeed != EFI_USB_SPEED_HIGH) {
+ if (NewPeiUsbDevice->DeviceSpeed != EFI_USB_SPEED_HIGH) {
if (PeiUsbDevice->DeviceSpeed == EFI_USB_SPEED_HIGH) {
NewPeiUsbDevice->Translator.TranslatorPortNumber = (UINT8)Index;
NewPeiUsbDevice->Translator.TranslatorHubAddress = *CurrentAddress;
} else {
- CopyMem(&(NewPeiUsbDevice->Translator), &(PeiUsbDevice->Translator), sizeof(EFI_USB2_HC_TRANSACTION_TRANSLATOR));
+ CopyMem (&(NewPeiUsbDevice->Translator), &(PeiUsbDevice->Translator), sizeof (EFI_USB2_HC_TRANSACTION_TRANSLATOR));
}
}
@@ -330,21 +331,22 @@ PeiHubEnumeration ( // Configure that Usb Device
//
Status = PeiConfigureUsbDevice (
- PeiServices,
- NewPeiUsbDevice,
- (UINT8) (Index + 1),
- CurrentAddress
- );
+ PeiServices,
+ NewPeiUsbDevice,
+ (UINT8)(Index + 1),
+ CurrentAddress
+ );
if (EFI_ERROR (Status)) {
continue;
}
+
DEBUG ((DEBUG_INFO, "PeiHubEnumeration: PeiConfigureUsbDevice Success\n"));
Status = PeiServicesInstallPpi (&NewPeiUsbDevice->UsbIoPpiList);
if (NewPeiUsbDevice->InterfaceDesc->InterfaceClass == 0x09) {
- NewPeiUsbDevice->IsHub = 0x1;
+ NewPeiUsbDevice->IsHub = 0x1;
Status = PeiDoHubConfig (PeiServices, NewPeiUsbDevice);
if (EFI_ERROR (Status)) {
@@ -359,19 +361,20 @@ PeiHubEnumeration ( // Begin to deal with the new device
//
MemPages = sizeof (PEI_USB_DEVICE) / EFI_PAGE_SIZE + 1;
- Status = PeiServicesAllocatePages (
- EfiBootServicesCode,
- MemPages,
- &AllocateAddress
- );
+ Status = PeiServicesAllocatePages (
+ EfiBootServicesCode,
+ MemPages,
+ &AllocateAddress
+ );
if (EFI_ERROR (Status)) {
return EFI_OUT_OF_RESOURCES;
}
+
CopyMem ((VOID *)(UINTN)AllocateAddress, NewPeiUsbDevice, sizeof (PEI_USB_DEVICE));
- NewPeiUsbDevice = (PEI_USB_DEVICE *) ((UINTN) AllocateAddress);
- NewPeiUsbDevice->AllocateAddress = (UINTN) AllocateAddress;
+ NewPeiUsbDevice = (PEI_USB_DEVICE *)((UINTN)AllocateAddress);
+ NewPeiUsbDevice->AllocateAddress = (UINTN)AllocateAddress;
NewPeiUsbDevice->UsbIoPpiList.Ppi = &NewPeiUsbDevice->UsbIoPpi;
- NewPeiUsbDevice->InterfaceDesc = NewPeiUsbDevice->InterfaceDescList[InterfaceIndex];
+ NewPeiUsbDevice->InterfaceDesc = NewPeiUsbDevice->InterfaceDescList[InterfaceIndex];
for (EndpointIndex = 0; EndpointIndex < NewPeiUsbDevice->InterfaceDesc->NumEndpoints; EndpointIndex++) {
NewPeiUsbDevice->EndpointDesc[EndpointIndex] = NewPeiUsbDevice->EndpointDescList[InterfaceIndex][EndpointIndex];
}
@@ -379,7 +382,7 @@ PeiHubEnumeration ( Status = PeiServicesInstallPpi (&NewPeiUsbDevice->UsbIoPpiList);
if (NewPeiUsbDevice->InterfaceDesc->InterfaceClass == 0x09) {
- NewPeiUsbDevice->IsHub = 0x1;
+ NewPeiUsbDevice->IsHub = 0x1;
Status = PeiDoHubConfig (PeiServices, NewPeiUsbDevice);
if (EFI_ERROR (Status)) {
@@ -393,7 +396,6 @@ PeiHubEnumeration ( }
}
-
return EFI_SUCCESS;
}
@@ -411,9 +413,9 @@ PeiHubEnumeration ( **/
EFI_STATUS
PeiUsbEnumeration (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi,
- IN PEI_USB2_HOST_CONTROLLER_PPI *Usb2HcPpi
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi,
+ IN PEI_USB2_HOST_CONTROLLER_PPI *Usb2HcPpi
)
{
UINT8 NumOfRootPort;
@@ -430,15 +432,15 @@ PeiUsbEnumeration ( CurrentAddress = 0;
if (Usb2HcPpi != NULL) {
Usb2HcPpi->GetRootHubPortNumber (
- PeiServices,
- Usb2HcPpi,
- (UINT8 *) &NumOfRootPort
- );
+ PeiServices,
+ Usb2HcPpi,
+ (UINT8 *)&NumOfRootPort
+ );
} else if (UsbHcPpi != NULL) {
UsbHcPpi->GetRootHubPortNumber (
PeiServices,
UsbHcPpi,
- (UINT8 *) &NumOfRootPort
+ (UINT8 *)&NumOfRootPort
);
} else {
ASSERT (FALSE);
@@ -453,19 +455,20 @@ PeiUsbEnumeration ( //
if (Usb2HcPpi != NULL) {
Usb2HcPpi->GetRootHubPortStatus (
- PeiServices,
- Usb2HcPpi,
- (UINT8) Index,
- &PortStatus
- );
+ PeiServices,
+ Usb2HcPpi,
+ (UINT8)Index,
+ &PortStatus
+ );
} else {
UsbHcPpi->GetRootHubPortStatus (
PeiServices,
UsbHcPpi,
- (UINT8) Index,
+ (UINT8)Index,
&PortStatus
);
}
+
DEBUG ((DEBUG_INFO, "USB Status --- Port: %x ConnectChange[%04x] Status[%04x]\n", Index, PortStatus.PortChangeStatus, PortStatus.PortStatus));
//
// Only handle connection/enable/overcurrent/reset change.
@@ -475,22 +478,22 @@ PeiUsbEnumeration ( } else {
if (IsPortConnect (PortStatus.PortStatus)) {
MemPages = sizeof (PEI_USB_DEVICE) / EFI_PAGE_SIZE + 1;
- Status = PeiServicesAllocatePages (
- EfiBootServicesCode,
- MemPages,
- &AllocateAddress
- );
+ Status = PeiServicesAllocatePages (
+ EfiBootServicesCode,
+ MemPages,
+ &AllocateAddress
+ );
if (EFI_ERROR (Status)) {
return EFI_OUT_OF_RESOURCES;
}
- PeiUsbDevice = (PEI_USB_DEVICE *) ((UINTN) AllocateAddress);
+ PeiUsbDevice = (PEI_USB_DEVICE *)((UINTN)AllocateAddress);
ZeroMem (PeiUsbDevice, sizeof (PEI_USB_DEVICE));
- PeiUsbDevice->Signature = PEI_USB_DEVICE_SIGNATURE;
- PeiUsbDevice->DeviceAddress = 0;
- PeiUsbDevice->MaxPacketSize0 = 8;
- PeiUsbDevice->DataToggle = 0;
+ PeiUsbDevice->Signature = PEI_USB_DEVICE_SIGNATURE;
+ PeiUsbDevice->DeviceAddress = 0;
+ PeiUsbDevice->MaxPacketSize0 = 8;
+ PeiUsbDevice->DataToggle = 0;
CopyMem (
&(PeiUsbDevice->UsbIoPpi),
&mUsbIoPpi,
@@ -501,15 +504,16 @@ PeiUsbEnumeration ( &mUsbIoPpiList,
sizeof (EFI_PEI_PPI_DESCRIPTOR)
);
- PeiUsbDevice->UsbIoPpiList.Ppi = &PeiUsbDevice->UsbIoPpi;
- PeiUsbDevice->AllocateAddress = (UINTN) AllocateAddress;
- PeiUsbDevice->UsbHcPpi = UsbHcPpi;
- PeiUsbDevice->Usb2HcPpi = Usb2HcPpi;
- PeiUsbDevice->IsHub = 0x0;
- PeiUsbDevice->DownStreamPortNo = 0x0;
+ PeiUsbDevice->UsbIoPpiList.Ppi = &PeiUsbDevice->UsbIoPpi;
+ PeiUsbDevice->AllocateAddress = (UINTN)AllocateAddress;
+ PeiUsbDevice->UsbHcPpi = UsbHcPpi;
+ PeiUsbDevice->Usb2HcPpi = Usb2HcPpi;
+ PeiUsbDevice->IsHub = 0x0;
+ PeiUsbDevice->DownStreamPortNo = 0x0;
if (((PortStatus.PortChangeStatus & USB_PORT_STAT_C_RESET) == 0) ||
- ((PortStatus.PortStatus & (USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE)) == 0)) {
+ ((PortStatus.PortStatus & (USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE)) == 0))
+ {
//
// If the port already has reset change flag and is connected and enabled, skip the port reset logic.
//
@@ -525,39 +529,39 @@ PeiUsbEnumeration ( Usb2HcPpi->GetRootHubPortStatus (
PeiServices,
Usb2HcPpi,
- (UINT8) Index,
+ (UINT8)Index,
&PortStatus
);
} else {
UsbHcPpi->GetRootHubPortStatus (
PeiServices,
UsbHcPpi,
- (UINT8) Index,
+ (UINT8)Index,
&PortStatus
);
}
} else {
if (Usb2HcPpi != NULL) {
Usb2HcPpi->ClearRootHubPortFeature (
- PeiServices,
- Usb2HcPpi,
- (UINT8) Index,
- EfiUsbPortResetChange
- );
+ PeiServices,
+ Usb2HcPpi,
+ (UINT8)Index,
+ EfiUsbPortResetChange
+ );
} else {
UsbHcPpi->ClearRootHubPortFeature (
PeiServices,
UsbHcPpi,
- (UINT8) Index,
+ (UINT8)Index,
EfiUsbPortResetChange
);
}
}
- PeiUsbDevice->DeviceSpeed = (UINT8) PeiUsbGetDeviceSpeed (PortStatus.PortStatus);
+ PeiUsbDevice->DeviceSpeed = (UINT8)PeiUsbGetDeviceSpeed (PortStatus.PortStatus);
DEBUG ((DEBUG_INFO, "Device Speed =%d\n", PeiUsbDevice->DeviceSpeed));
- if (USB_BIT_IS_SET (PortStatus.PortStatus, USB_PORT_STAT_SUPER_SPEED)){
+ if (USB_BIT_IS_SET (PortStatus.PortStatus, USB_PORT_STAT_SUPER_SPEED)) {
PeiUsbDevice->MaxPacketSize0 = 512;
} else if (USB_BIT_IS_SET (PortStatus.PortStatus, USB_PORT_STAT_HIGH_SPEED)) {
PeiUsbDevice->MaxPacketSize0 = 64;
@@ -571,15 +575,16 @@ PeiUsbEnumeration ( // Configure that Usb Device
//
Status = PeiConfigureUsbDevice (
- PeiServices,
- PeiUsbDevice,
- Index,
- &CurrentAddress
- );
+ PeiServices,
+ PeiUsbDevice,
+ Index,
+ &CurrentAddress
+ );
if (EFI_ERROR (Status)) {
continue;
}
+
DEBUG ((DEBUG_INFO, "PeiUsbEnumeration: PeiConfigureUsbDevice Success\n"));
Status = PeiServicesInstallPpi (&PeiUsbDevice->UsbIoPpiList);
@@ -600,19 +605,20 @@ PeiUsbEnumeration ( // Begin to deal with the new device
//
MemPages = sizeof (PEI_USB_DEVICE) / EFI_PAGE_SIZE + 1;
- Status = PeiServicesAllocatePages (
- EfiBootServicesCode,
- MemPages,
- &AllocateAddress
- );
+ Status = PeiServicesAllocatePages (
+ EfiBootServicesCode,
+ MemPages,
+ &AllocateAddress
+ );
if (EFI_ERROR (Status)) {
return EFI_OUT_OF_RESOURCES;
}
+
CopyMem ((VOID *)(UINTN)AllocateAddress, PeiUsbDevice, sizeof (PEI_USB_DEVICE));
- PeiUsbDevice = (PEI_USB_DEVICE *) ((UINTN) AllocateAddress);
- PeiUsbDevice->AllocateAddress = (UINTN) AllocateAddress;
+ PeiUsbDevice = (PEI_USB_DEVICE *)((UINTN)AllocateAddress);
+ PeiUsbDevice->AllocateAddress = (UINTN)AllocateAddress;
PeiUsbDevice->UsbIoPpiList.Ppi = &PeiUsbDevice->UsbIoPpi;
- PeiUsbDevice->InterfaceDesc = PeiUsbDevice->InterfaceDescList[InterfaceIndex];
+ PeiUsbDevice->InterfaceDesc = PeiUsbDevice->InterfaceDescList[InterfaceIndex];
for (EndpointIndex = 0; EndpointIndex < PeiUsbDevice->InterfaceDesc->NumEndpoints; EndpointIndex++) {
PeiUsbDevice->EndpointDesc[EndpointIndex] = PeiUsbDevice->EndpointDescList[InterfaceIndex][EndpointIndex];
}
@@ -656,16 +662,16 @@ PeiUsbEnumeration ( **/
EFI_STATUS
PeiConfigureUsbDevice (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_DEVICE *PeiUsbDevice,
- IN UINT8 Port,
- IN OUT UINT8 *DeviceAddress
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_DEVICE *PeiUsbDevice,
+ IN UINT8 Port,
+ IN OUT UINT8 *DeviceAddress
)
{
- EFI_USB_DEVICE_DESCRIPTOR DeviceDescriptor;
- EFI_STATUS Status;
- PEI_USB_IO_PPI *UsbIoPpi;
- UINT8 Retry;
+ EFI_USB_DEVICE_DESCRIPTOR DeviceDescriptor;
+ EFI_STATUS Status;
+ PEI_USB_IO_PPI *UsbIoPpi;
+ UINT8 Retry;
UsbIoPpi = &PeiUsbDevice->UsbIoPpi;
Status = EFI_SUCCESS;
@@ -674,7 +680,7 @@ PeiConfigureUsbDevice ( // Get USB device descriptor
//
- for (Retry = 0; Retry < 3; Retry ++) {
+ for (Retry = 0; Retry < 3; Retry++) {
Status = PeiUsbGetDescriptor (
PeiServices,
UsbIoPpi,
@@ -701,18 +707,19 @@ PeiConfigureUsbDevice ( PeiUsbDevice->MaxPacketSize0 = DeviceDescriptor.MaxPacketSize0;
}
- (*DeviceAddress) ++;
+ (*DeviceAddress)++;
Status = PeiUsbSetDeviceAddress (
- PeiServices,
- UsbIoPpi,
- *DeviceAddress
- );
+ PeiServices,
+ UsbIoPpi,
+ *DeviceAddress
+ );
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "PeiUsbSetDeviceAddress Failed: %r\n", Status));
return Status;
}
+
MicroSecondDelay (USB_SET_DEVICE_ADDRESS_STALL);
PeiUsbDevice->DeviceAddress = *DeviceAddress;
@@ -721,13 +728,13 @@ PeiConfigureUsbDevice ( // Get whole USB device descriptor
//
Status = PeiUsbGetDescriptor (
- PeiServices,
- UsbIoPpi,
- (USB_DT_DEVICE << 8),
- 0,
- (UINT16) sizeof (EFI_USB_DEVICE_DESCRIPTOR),
- &DeviceDescriptor
- );
+ PeiServices,
+ UsbIoPpi,
+ (USB_DT_DEVICE << 8),
+ 0,
+ (UINT16)sizeof (EFI_USB_DEVICE_DESCRIPTOR),
+ &DeviceDescriptor
+ );
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "PeiUsbGetDescriptor First Failed\n"));
@@ -738,18 +745,19 @@ PeiConfigureUsbDevice ( // Get its default configuration and its first interface
//
Status = PeiUsbGetAllConfiguration (
- PeiServices,
- PeiUsbDevice
- );
+ PeiServices,
+ PeiUsbDevice
+ );
if (EFI_ERROR (Status)) {
return Status;
}
+
MicroSecondDelay (USB_GET_CONFIG_DESCRIPTOR_STALL);
Status = PeiUsbSetConfiguration (
- PeiServices,
- UsbIoPpi
- );
+ PeiServices,
+ UsbIoPpi
+ );
if (EFI_ERROR (Status)) {
return Status;
@@ -771,20 +779,20 @@ PeiConfigureUsbDevice ( **/
EFI_STATUS
PeiUsbGetAllConfiguration (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_DEVICE *PeiUsbDevice
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_DEVICE *PeiUsbDevice
)
{
- EFI_STATUS Status;
- EFI_USB_CONFIG_DESCRIPTOR *ConfigDesc;
- PEI_USB_IO_PPI *UsbIoPpi;
- UINT16 ConfigDescLength;
- UINT8 *Ptr;
- UINTN SkipBytes;
- UINTN LengthLeft;
- UINTN InterfaceIndex;
- UINTN Index;
- UINTN NumOfEndpoint;
+ EFI_STATUS Status;
+ EFI_USB_CONFIG_DESCRIPTOR *ConfigDesc;
+ PEI_USB_IO_PPI *UsbIoPpi;
+ UINT16 ConfigDescLength;
+ UINT8 *Ptr;
+ UINTN SkipBytes;
+ UINTN LengthLeft;
+ UINTN InterfaceIndex;
+ UINTN Index;
+ UINTN NumOfEndpoint;
UsbIoPpi = &PeiUsbDevice->UsbIoPpi;
@@ -792,22 +800,23 @@ PeiUsbGetAllConfiguration ( // First get its 4-byte configuration descriptor
//
Status = PeiUsbGetDescriptor (
- PeiServices,
- UsbIoPpi,
- (USB_DT_CONFIG << 8), // Value
- 0, // Index
- 4, // Length
- PeiUsbDevice->ConfigurationData
- );
+ PeiServices,
+ UsbIoPpi,
+ (USB_DT_CONFIG << 8), // Value
+ 0, // Index
+ 4, // Length
+ PeiUsbDevice->ConfigurationData
+ );
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "PeiUsbGet Config Descriptor First Failed\n"));
return Status;
}
+
MicroSecondDelay (USB_GET_CONFIG_DESCRIPTOR_STALL);
- ConfigDesc = (EFI_USB_CONFIG_DESCRIPTOR *) PeiUsbDevice->ConfigurationData;
- ConfigDescLength = ConfigDesc->TotalLength;
+ ConfigDesc = (EFI_USB_CONFIG_DESCRIPTOR *)PeiUsbDevice->ConfigurationData;
+ ConfigDescLength = ConfigDesc->TotalLength;
//
// Reject if TotalLength even cannot cover itself.
@@ -827,52 +836,52 @@ PeiUsbGetAllConfiguration ( // Then we get the total descriptors for this configuration
//
Status = PeiUsbGetDescriptor (
- PeiServices,
- UsbIoPpi,
- (USB_DT_CONFIG << 8),
- 0,
- ConfigDescLength,
- PeiUsbDevice->ConfigurationData
- );
+ PeiServices,
+ UsbIoPpi,
+ (USB_DT_CONFIG << 8),
+ 0,
+ ConfigDescLength,
+ PeiUsbDevice->ConfigurationData
+ );
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "PeiUsbGet Config Descriptor all Failed\n"));
return Status;
}
+
//
// Parse this configuration descriptor
// First get the current config descriptor;
//
Status = GetExpectedDescriptor (
- PeiUsbDevice->ConfigurationData,
- ConfigDescLength,
- USB_DT_CONFIG,
- (UINT8) sizeof (EFI_USB_CONFIG_DESCRIPTOR),
- &SkipBytes
- );
+ PeiUsbDevice->ConfigurationData,
+ ConfigDescLength,
+ USB_DT_CONFIG,
+ (UINT8)sizeof (EFI_USB_CONFIG_DESCRIPTOR),
+ &SkipBytes
+ );
if (EFI_ERROR (Status)) {
return Status;
}
- Ptr = PeiUsbDevice->ConfigurationData + SkipBytes;
- PeiUsbDevice->ConfigDesc = (EFI_USB_CONFIG_DESCRIPTOR *) Ptr;
+ Ptr = PeiUsbDevice->ConfigurationData + SkipBytes;
+ PeiUsbDevice->ConfigDesc = (EFI_USB_CONFIG_DESCRIPTOR *)Ptr;
- Ptr += sizeof (EFI_USB_CONFIG_DESCRIPTOR);
+ Ptr += sizeof (EFI_USB_CONFIG_DESCRIPTOR);
LengthLeft = ConfigDescLength - SkipBytes - sizeof (EFI_USB_CONFIG_DESCRIPTOR);
for (InterfaceIndex = 0; InterfaceIndex < PeiUsbDevice->ConfigDesc->NumInterfaces; InterfaceIndex++) {
-
//
// Get the interface descriptor
//
Status = GetExpectedDescriptor (
- Ptr,
- LengthLeft,
- USB_DT_INTERFACE,
- (UINT8) sizeof (EFI_USB_INTERFACE_DESCRIPTOR),
- &SkipBytes
- );
+ Ptr,
+ LengthLeft,
+ USB_DT_INTERFACE,
+ (UINT8)sizeof (EFI_USB_INTERFACE_DESCRIPTOR),
+ &SkipBytes
+ );
if (EFI_ERROR (Status)) {
return Status;
@@ -880,11 +889,12 @@ PeiUsbGetAllConfiguration ( Ptr += SkipBytes;
if (InterfaceIndex == 0) {
- PeiUsbDevice->InterfaceDesc = (EFI_USB_INTERFACE_DESCRIPTOR *) Ptr;
+ PeiUsbDevice->InterfaceDesc = (EFI_USB_INTERFACE_DESCRIPTOR *)Ptr;
}
- PeiUsbDevice->InterfaceDescList[InterfaceIndex] = (EFI_USB_INTERFACE_DESCRIPTOR *) Ptr;
- Ptr += sizeof (EFI_USB_INTERFACE_DESCRIPTOR);
+ PeiUsbDevice->InterfaceDescList[InterfaceIndex] = (EFI_USB_INTERFACE_DESCRIPTOR *)Ptr;
+
+ Ptr += sizeof (EFI_USB_INTERFACE_DESCRIPTOR);
LengthLeft -= SkipBytes;
LengthLeft -= sizeof (EFI_USB_INTERFACE_DESCRIPTOR);
@@ -899,12 +909,12 @@ PeiUsbGetAllConfiguration ( // Get the endpoint descriptor
//
Status = GetExpectedDescriptor (
- Ptr,
- LengthLeft,
- USB_DT_ENDPOINT,
- (UINT8) sizeof (EFI_USB_ENDPOINT_DESCRIPTOR),
- &SkipBytes
- );
+ Ptr,
+ LengthLeft,
+ USB_DT_ENDPOINT,
+ (UINT8)sizeof (EFI_USB_ENDPOINT_DESCRIPTOR),
+ &SkipBytes
+ );
if (EFI_ERROR (Status)) {
return Status;
@@ -912,11 +922,12 @@ PeiUsbGetAllConfiguration ( Ptr += SkipBytes;
if (InterfaceIndex == 0) {
- PeiUsbDevice->EndpointDesc[Index] = (EFI_USB_ENDPOINT_DESCRIPTOR *) Ptr;
+ PeiUsbDevice->EndpointDesc[Index] = (EFI_USB_ENDPOINT_DESCRIPTOR *)Ptr;
}
- PeiUsbDevice->EndpointDescList[InterfaceIndex][Index] = (EFI_USB_ENDPOINT_DESCRIPTOR *) Ptr;
- Ptr += sizeof (EFI_USB_ENDPOINT_DESCRIPTOR);
+ PeiUsbDevice->EndpointDescList[InterfaceIndex][Index] = (EFI_USB_ENDPOINT_DESCRIPTOR *)Ptr;
+
+ Ptr += sizeof (EFI_USB_ENDPOINT_DESCRIPTOR);
LengthLeft -= SkipBytes;
LengthLeft -= sizeof (EFI_USB_ENDPOINT_DESCRIPTOR);
}
@@ -940,15 +951,15 @@ PeiUsbGetAllConfiguration ( **/
EFI_STATUS
GetExpectedDescriptor (
- IN UINT8 *Buffer,
- IN UINTN Length,
- IN UINT8 DescType,
- IN UINT8 DescLength,
- OUT UINTN *ParsedBytes
+ IN UINT8 *Buffer,
+ IN UINTN Length,
+ IN UINT8 DescType,
+ IN UINT8 DescLength,
+ OUT UINTN *ParsedBytes
)
{
- USB_DESC_HEAD *Head;
- UINTN Offset;
+ USB_DESC_HEAD *Head;
+ UINTN Offset;
//
// Total length is too small that cannot hold the single descriptor header plus data.
@@ -1020,17 +1031,16 @@ GetExpectedDescriptor ( **/
VOID
ResetRootPort (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi,
- IN PEI_USB2_HOST_CONTROLLER_PPI *Usb2HcPpi,
- IN UINT8 PortNum,
- IN UINT8 RetryIndex
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi,
+ IN PEI_USB2_HOST_CONTROLLER_PPI *Usb2HcPpi,
+ IN UINT8 PortNum,
+ IN UINT8 RetryIndex
)
{
- EFI_STATUS Status;
- UINTN Index;
- EFI_USB_PORT_STATUS PortStatus;
-
+ EFI_STATUS Status;
+ UINTN Index;
+ EFI_USB_PORT_STATUS PortStatus;
if (Usb2HcPpi != NULL) {
MicroSecondDelay (200 * 1000);
@@ -1039,11 +1049,11 @@ ResetRootPort ( // reset root port
//
Status = Usb2HcPpi->SetRootHubPortFeature (
- PeiServices,
- Usb2HcPpi,
- PortNum,
- EfiUsbPortReset
- );
+ PeiServices,
+ Usb2HcPpi,
+ PortNum,
+ EfiUsbPortReset
+ );
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "SetRootHubPortFeature EfiUsbPortReset Failed\n"));
@@ -1060,11 +1070,11 @@ ResetRootPort ( // clear reset root port
//
Status = Usb2HcPpi->ClearRootHubPortFeature (
- PeiServices,
- Usb2HcPpi,
- PortNum,
- EfiUsbPortReset
- );
+ PeiServices,
+ Usb2HcPpi,
+ PortNum,
+ EfiUsbPortReset
+ );
if (EFI_ERROR (Status)) {
DEBUG ((DEBUG_ERROR, "ClearRootHubPortFeature EfiUsbPortReset Failed\n"));
@@ -1103,35 +1113,35 @@ ResetRootPort ( }
Usb2HcPpi->ClearRootHubPortFeature (
- PeiServices,
- Usb2HcPpi,
- PortNum,
- EfiUsbPortResetChange
- );
+ PeiServices,
+ Usb2HcPpi,
+ PortNum,
+ EfiUsbPortResetChange
+ );
Usb2HcPpi->ClearRootHubPortFeature (
- PeiServices,
- Usb2HcPpi,
- PortNum,
- EfiUsbPortConnectChange
- );
+ PeiServices,
+ Usb2HcPpi,
+ PortNum,
+ EfiUsbPortConnectChange
+ );
//
// Set port enable
//
- Usb2HcPpi->SetRootHubPortFeature(
- PeiServices,
- Usb2HcPpi,
- PortNum,
- EfiUsbPortEnable
- );
+ Usb2HcPpi->SetRootHubPortFeature (
+ PeiServices,
+ Usb2HcPpi,
+ PortNum,
+ EfiUsbPortEnable
+ );
Usb2HcPpi->ClearRootHubPortFeature (
- PeiServices,
- Usb2HcPpi,
- PortNum,
- EfiUsbPortEnableChange
- );
+ PeiServices,
+ Usb2HcPpi,
+ PortNum,
+ EfiUsbPortEnableChange
+ );
MicroSecondDelay ((RetryIndex + 1) * 50 * 1000);
} else {
@@ -1221,7 +1231,7 @@ ResetRootPort ( //
// Set port enable
//
- UsbHcPpi->SetRootHubPortFeature(
+ UsbHcPpi->SetRootHubPortFeature (
PeiServices,
UsbHcPpi,
PortNum,
@@ -1237,5 +1247,6 @@ ResetRootPort ( MicroSecondDelay ((RetryIndex + 1) * 50 * 1000);
}
+
return;
}
diff --git a/MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.h b/MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.h index 776edba6bb..69d1126da0 100644 --- a/MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.h +++ b/MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.h @@ -10,7 +10,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #ifndef _PEI_USB_PEIM_H_
#define _PEI_USB_PEIM_H_
-
#include <PiPei.h>
#include <Ppi/UsbHostController.h>
@@ -32,43 +31,43 @@ SPDX-License-Identifier: BSD-2-Clause-Patent //
#pragma pack(1)
typedef struct {
- UINT8 Len;
- UINT8 Type;
+ UINT8 Len;
+ UINT8 Type;
} USB_DESC_HEAD;
#pragma pack()
-#define MAX_INTERFACE 8
-#define MAX_ENDPOINT 16
+#define MAX_INTERFACE 8
+#define MAX_ENDPOINT 16
#define PEI_USB_DEVICE_SIGNATURE SIGNATURE_32 ('U', 's', 'b', 'D')
typedef struct {
- UINTN Signature;
- PEI_USB_IO_PPI UsbIoPpi;
- EFI_PEI_PPI_DESCRIPTOR UsbIoPpiList;
- UINT16 MaxPacketSize0;
- UINT16 DataToggle;
- UINT8 DeviceAddress;
- UINT8 DeviceSpeed;
- UINT8 IsHub;
- UINT8 DownStreamPortNo;
- UINTN AllocateAddress;
- PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi;
- PEI_USB2_HOST_CONTROLLER_PPI *Usb2HcPpi;
- UINT8 ConfigurationData[1024];
- EFI_USB_CONFIG_DESCRIPTOR *ConfigDesc;
- EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDesc;
- EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescList[MAX_INTERFACE];
- EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDesc[MAX_ENDPOINT];
- EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescList[MAX_INTERFACE][MAX_ENDPOINT];
- EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator;
- UINT8 Tier;
+ UINTN Signature;
+ PEI_USB_IO_PPI UsbIoPpi;
+ EFI_PEI_PPI_DESCRIPTOR UsbIoPpiList;
+ UINT16 MaxPacketSize0;
+ UINT16 DataToggle;
+ UINT8 DeviceAddress;
+ UINT8 DeviceSpeed;
+ UINT8 IsHub;
+ UINT8 DownStreamPortNo;
+ UINTN AllocateAddress;
+ PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi;
+ PEI_USB2_HOST_CONTROLLER_PPI *Usb2HcPpi;
+ UINT8 ConfigurationData[1024];
+ EFI_USB_CONFIG_DESCRIPTOR *ConfigDesc;
+ EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDesc;
+ EFI_USB_INTERFACE_DESCRIPTOR *InterfaceDescList[MAX_INTERFACE];
+ EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDesc[MAX_ENDPOINT];
+ EFI_USB_ENDPOINT_DESCRIPTOR *EndpointDescList[MAX_INTERFACE][MAX_ENDPOINT];
+ EFI_USB2_HC_TRANSACTION_TRANSLATOR Translator;
+ UINT8 Tier;
} PEI_USB_DEVICE;
-#define PEI_USB_DEVICE_FROM_THIS(a) CR (a, PEI_USB_DEVICE, UsbIoPpi, PEI_USB_DEVICE_SIGNATURE)
+#define PEI_USB_DEVICE_FROM_THIS(a) CR (a, PEI_USB_DEVICE, UsbIoPpi, PEI_USB_DEVICE_SIGNATURE)
-#define USB_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))
+#define USB_BIT_IS_SET(Data, Bit) ((BOOLEAN)(((Data) & (Bit)) == (Bit)))
-#define USB_BUS_1_MILLISECOND 1000
+#define USB_BUS_1_MILLISECOND 1000
//
// Wait for port reset, refers to specification
@@ -78,13 +77,13 @@ typedef struct { // According to USB2.0, Chapter 11.5.1.5 Resetting,
// the worst case for TDRST is 20ms
//
-#define USB_SET_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND)
-#define USB_SET_ROOT_PORT_RESET_STALL (50 * USB_BUS_1_MILLISECOND)
+#define USB_SET_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND)
+#define USB_SET_ROOT_PORT_RESET_STALL (50 * USB_BUS_1_MILLISECOND)
//
// Wait for clear roothub port reset, set by experience
//
-#define USB_CLR_ROOT_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND)
+#define USB_CLR_ROOT_PORT_RESET_STALL (20 * USB_BUS_1_MILLISECOND)
//
// Wait for port statue reg change, set by experience
@@ -95,24 +94,24 @@ typedef struct { // Host software return timeout if port status doesn't change
// after 500ms(LOOP * STALL = 5000 * 0.1ms), set by experience
//
-#define USB_WAIT_PORT_STS_CHANGE_LOOP 5000
+#define USB_WAIT_PORT_STS_CHANGE_LOOP 5000
//
// Wait for hub port power-on, refers to specification
// [USB20-11.23.2]
//
-#define USB_SET_PORT_POWER_STALL (2 * USB_BUS_1_MILLISECOND)
+#define USB_SET_PORT_POWER_STALL (2 * USB_BUS_1_MILLISECOND)
//
// Wait for set device address, refers to specification
// [USB20-9.2.6.3, it says 2ms]
//
-#define USB_SET_DEVICE_ADDRESS_STALL (2 * USB_BUS_1_MILLISECOND)
+#define USB_SET_DEVICE_ADDRESS_STALL (2 * USB_BUS_1_MILLISECOND)
//
// Wait for get configuration descriptor, set by experience
//
-#define USB_GET_CONFIG_DESCRIPTOR_STALL (1 * USB_BUS_1_MILLISECOND)
+#define USB_GET_CONFIG_DESCRIPTOR_STALL (1 * USB_BUS_1_MILLISECOND)
/**
Submits control transfer to a target USB device.
@@ -137,13 +136,13 @@ typedef struct { EFI_STATUS
EFIAPI
PeiUsbControlTransfer (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This,
- IN EFI_USB_DEVICE_REQUEST *Request,
- IN EFI_USB_DATA_DIRECTION Direction,
- IN UINT32 Timeout,
- IN OUT VOID *Data OPTIONAL,
- IN UINTN DataLength OPTIONAL
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This,
+ IN EFI_USB_DEVICE_REQUEST *Request,
+ IN EFI_USB_DATA_DIRECTION Direction,
+ IN UINT32 Timeout,
+ IN OUT VOID *Data OPTIONAL,
+ IN UINTN DataLength OPTIONAL
);
/**
@@ -170,12 +169,12 @@ PeiUsbControlTransfer ( EFI_STATUS
EFIAPI
PeiUsbBulkTransfer (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This,
- IN UINT8 DeviceEndpoint,
- IN OUT VOID *Data,
- IN OUT UINTN *DataLength,
- IN UINTN Timeout
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This,
+ IN UINT8 DeviceEndpoint,
+ IN OUT VOID *Data,
+ IN OUT UINTN *DataLength,
+ IN UINTN Timeout
);
/**
@@ -192,9 +191,9 @@ PeiUsbBulkTransfer ( EFI_STATUS
EFIAPI
PeiUsbGetInterfaceDescriptor (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This,
- OUT EFI_USB_INTERFACE_DESCRIPTOR **InterfaceDescriptor
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This,
+ OUT EFI_USB_INTERFACE_DESCRIPTOR **InterfaceDescriptor
);
/**
@@ -212,10 +211,10 @@ PeiUsbGetInterfaceDescriptor ( EFI_STATUS
EFIAPI
PeiUsbGetEndpointDescriptor (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This,
- IN UINT8 EndpointIndex,
- OUT EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptor
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This,
+ IN UINT8 EndpointIndex,
+ OUT EFI_USB_ENDPOINT_DESCRIPTOR **EndpointDescriptor
);
/**
@@ -231,8 +230,8 @@ PeiUsbGetEndpointDescriptor ( EFI_STATUS
EFIAPI
PeiUsbPortReset (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_IO_PPI *This
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_IO_PPI *This
);
/**
@@ -247,11 +246,11 @@ PeiUsbPortReset ( **/
VOID
ResetRootPort (
- IN EFI_PEI_SERVICES **PeiServices,
- IN PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi,
- IN PEI_USB2_HOST_CONTROLLER_PPI *Usb2HcPpi,
- IN UINT8 PortNum,
- IN UINT8 RetryIndex
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN PEI_USB_HOST_CONTROLLER_PPI *UsbHcPpi,
+ IN PEI_USB2_HOST_CONTROLLER_PPI *Usb2HcPpi,
+ IN UINT8 PortNum,
+ IN UINT8 RetryIndex
);
#endif
|