/** @file\r
The module to produce Usb Bus PPI.\r
\r
-Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
- \r
+Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions\r
of the BSD License which accompanies this distribution. The\r
\r
/**\r
The enumeration routine to detect device change.\r
- \r
+\r
@param PeiServices Describes the list of possible PEI Services.\r
@param UsbHcPpi The pointer of PEI_USB_HOST_CONTROLLER_PPI instance.\r
@param Usb2HcPpi The pointer of PEI_USB2_HOST_CONTROLLER_PPI instance.\r
\r
/**\r
Configure new detected usb device.\r
- \r
+\r
@param PeiServices Describes the list of possible PEI Services.\r
@param PeiUsbDevice The pointer of PEI_USB_DEVICE instance.\r
@param Port The port to be configured.\r
\r
/**\r
Get all configurations from a detected usb device.\r
- \r
+\r
@param PeiServices Describes the list of possible PEI Services.\r
@param PeiUsbDevice The pointer of PEI_USB_DEVICE instance.\r
\r
\r
/**\r
Get the start position of next wanted descriptor.\r
- \r
+\r
@param Buffer Buffer containing data to parse.\r
@param Length Buffer length.\r
@param DescType Descriptor type.\r
\r
/**\r
The entrypoint of the module, it will enumerate all HCs.\r
- \r
+\r
@param FileHandle Handle of the file being invoked.\r
@param PeiServices Describes the list of possible PEI Services.\r
\r
}\r
\r
//\r
- // gPeiUsbHostControllerPpiGuid and gPeiUsb2HostControllerPpiGuid should not \r
+ // gPeiUsbHostControllerPpiGuid and gPeiUsb2HostControllerPpiGuid should not\r
// be produced at the same time\r
//\r
Index = 0;\r
Index,\r
NULL,\r
(VOID **) &Usb2HcPpi\r
- ); \r
+ );\r
if (EFI_ERROR (Status)) {\r
//\r
// No more host controller, break out\r
//\r
break;\r
- } \r
- PeiUsbEnumeration ((EFI_PEI_SERVICES **) PeiServices, NULL, Usb2HcPpi); \r
+ }\r
+ PeiUsbEnumeration ((EFI_PEI_SERVICES **) PeiServices, NULL, Usb2HcPpi);\r
Index++;\r
}\r
}\r
- \r
+\r
if (Index == 0) {\r
return EFI_UNSUPPORTED;\r
}\r
/**\r
The Hub Enumeration just scans the hub ports one time. It also\r
doesn't support hot-plug.\r
- \r
+\r
@param PeiServices Describes the list of possible PEI Services.\r
@param PeiUsbDevice The pointer of PEI_USB_DEVICE instance.\r
@param CurrentAddress The DeviceAddress of usb device.\r
NewPeiUsbDevice->IsHub = 0x0;\r
NewPeiUsbDevice->DownStreamPortNo = 0x0;\r
\r
- if (((PortStatus.PortChangeStatus & USB_PORT_STAT_C_RESET) == 0) || \r
+ if (((PortStatus.PortChangeStatus & USB_PORT_STAT_C_RESET) == 0) ||\r
((PortStatus.PortStatus & (USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE)) == 0)) {\r
//\r
- // If the port already has reset change flag and is connected and enabled, skip the port reset logic. \r
+ // If the port already has reset change flag and is connected and enabled, skip the port reset logic.\r
//\r
PeiResetHubPort (PeiServices, UsbIoPpi, (UINT8)(Index + 1));\r
- \r
+\r
PeiHubGetPortStatus (\r
PeiServices,\r
UsbIoPpi,\r
\r
/**\r
The enumeration routine to detect device change.\r
- \r
+\r
@param PeiServices Describes the list of possible PEI Services.\r
@param UsbHcPpi The pointer of PEI_USB_HOST_CONTROLLER_PPI instance.\r
@param Usb2HcPpi The pointer of PEI_USB2_HOST_CONTROLLER_PPI instance.\r
PeiServices,\r
Usb2HcPpi,\r
(UINT8 *) &NumOfRootPort\r
- ); \r
+ );\r
} else if (UsbHcPpi != NULL) {\r
UsbHcPpi->GetRootHubPortNumber (\r
PeiServices,\r
Usb2HcPpi,\r
(UINT8) Index,\r
&PortStatus\r
- ); \r
+ );\r
} else {\r
UsbHcPpi->GetRootHubPortStatus (\r
PeiServices,\r
PeiUsbDevice->IsHub = 0x0;\r
PeiUsbDevice->DownStreamPortNo = 0x0;\r
\r
- if (((PortStatus.PortChangeStatus & USB_PORT_STAT_C_RESET) == 0) || \r
+ if (((PortStatus.PortChangeStatus & USB_PORT_STAT_C_RESET) == 0) ||\r
((PortStatus.PortStatus & (USB_PORT_STAT_CONNECTION | USB_PORT_STAT_ENABLE)) == 0)) {\r
//\r
- // If the port already has reset change flag and is connected and enabled, skip the port reset logic. \r
+ // If the port already has reset change flag and is connected and enabled, skip the port reset logic.\r
//\r
ResetRootPort (\r
PeiServices,\r
Usb2HcPpi,\r
(UINT8) Index,\r
EfiUsbPortResetChange\r
- ); \r
+ );\r
} else {\r
UsbHcPpi->ClearRootHubPortFeature (\r
PeiServices,\r
\r
/**\r
Configure new detected usb device.\r
- \r
+\r
@param PeiServices Describes the list of possible PEI Services.\r
@param PeiUsbDevice The pointer of PEI_USB_DEVICE instance.\r
@param Port The port to be configured.\r
\r
/**\r
Get all configurations from a detected usb device.\r
- \r
+\r
@param PeiServices Describes the list of possible PEI Services.\r
@param PeiUsbDevice The pointer of PEI_USB_DEVICE instance.\r
\r
\r
/**\r
Get the start position of next wanted descriptor.\r
- \r
+\r
@param Buffer Buffer containing data to parse.\r
@param Length Buffer length.\r
@param DescType Descriptor type.\r
\r
/**\r
Send reset signal over the given root hub port.\r
- \r
+\r
@param PeiServices Describes the list of possible PEI Services.\r
@param UsbHcPpi The pointer of PEI_USB_HOST_CONTROLLER_PPI instance.\r
@param Usb2HcPpi The pointer of PEI_USB2_HOST_CONTROLLER_PPI instance.\r
\r
if (Usb2HcPpi != NULL) {\r
MicroSecondDelay (200 * 1000);\r
- \r
+\r
//\r
// reset root port\r
//\r
PortNum,\r
EfiUsbPortReset\r
);\r
- \r
+\r
if (EFI_ERROR (Status)) {\r
DEBUG ((EFI_D_ERROR, "SetRootHubPortFeature EfiUsbPortReset Failed\n"));\r
return;\r
}\r
- \r
+\r
//\r
// Drive the reset signal for at least 50ms. Check USB 2.0 Spec\r
// section 7.1.7.5 for timing requirements.\r
PortNum,\r
EfiUsbPortReset\r
);\r
- \r
+\r
if (EFI_ERROR (Status)) {\r
DEBUG ((EFI_D_ERROR, "ClearRootHubPortFeature EfiUsbPortReset Failed\n"));\r
return;\r
Usb2HcPpi,\r
PortNum,\r
&PortStatus\r
- ); \r
+ );\r
if (EFI_ERROR (Status)) {\r
return;\r
}\r
PortNum,\r
EfiUsbPortConnectChange\r
);\r
- \r
+\r
//\r
// Set port enable\r
//\r
PortNum,\r
EfiUsbPortEnable\r
);\r
- \r
+\r
Usb2HcPpi->ClearRootHubPortFeature (\r
PeiServices,\r
Usb2HcPpi,\r
PortNum,\r
EfiUsbPortEnableChange\r
);\r
- \r
+\r
MicroSecondDelay ((RetryIndex + 1) * 50 * 1000);\r
} else {\r
MicroSecondDelay (200 * 1000);\r
- \r
+\r
//\r
// reset root port\r
//\r
PortNum,\r
EfiUsbPortReset\r
);\r
- \r
+\r
if (EFI_ERROR (Status)) {\r
DEBUG ((EFI_D_ERROR, "SetRootHubPortFeature EfiUsbPortReset Failed\n"));\r
return;\r
}\r
- \r
+\r
//\r
// Drive the reset signal for at least 50ms. Check USB 2.0 Spec\r
// section 7.1.7.5 for timing requirements.\r
//\r
MicroSecondDelay (USB_SET_ROOT_PORT_RESET_STALL);\r
- \r
+\r
//\r
// clear reset root port\r
//\r
PortNum,\r
EfiUsbPortReset\r
);\r
- \r
+\r
if (EFI_ERROR (Status)) {\r
DEBUG ((EFI_D_ERROR, "ClearRootHubPortFeature EfiUsbPortReset Failed\n"));\r
return;\r
}\r
- \r
+\r
MicroSecondDelay (USB_CLR_ROOT_PORT_RESET_STALL);\r
\r
//\r
UsbHcPpi,\r
PortNum,\r
&PortStatus\r
- ); \r
+ );\r
if (EFI_ERROR (Status)) {\r
return;\r
}\r
PortNum,\r
EfiUsbPortConnectChange\r
);\r
- \r
+\r
//\r
// Set port enable\r
//\r
PortNum,\r
EfiUsbPortEnable\r
);\r
- \r
+\r
UsbHcPpi->ClearRootHubPortFeature (\r
PeiServices,\r
UsbHcPpi,\r
PortNum,\r
EfiUsbPortEnableChange\r
);\r
- \r
+\r
MicroSecondDelay ((RetryIndex + 1) * 50 * 1000);\r
}\r
return;\r