]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Bus/Usb/UsbBusPei/UsbPeim.c
MdeModulePkg: Clean up source files
[mirror_edk2.git] / MdeModulePkg / Bus / Usb / UsbBusPei / UsbPeim.c
index a4bb4d7aa72d8d696ab98f5db1629f684595d40e..10d5232e59f745a0fd9b8c6739edc4b0ac61d5f1 100644 (file)
@@ -1,8 +1,8 @@
 /** @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
@@ -37,7 +37,7 @@ EFI_PEI_PPI_DESCRIPTOR mUsbIoPpiList = {
 \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
@@ -56,7 +56,7 @@ PeiUsbEnumeration (
 \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
@@ -77,7 +77,7 @@ PeiConfigureUsbDevice (
 \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
@@ -94,7 +94,7 @@ PeiUsbGetAllConfiguration (
 \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
@@ -116,7 +116,7 @@ GetExpectedDescriptor (
 \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
@@ -142,7 +142,7 @@ PeimInitializeUsb (
   }\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
@@ -176,18 +176,18 @@ PeimInitializeUsb (
                  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
@@ -198,7 +198,7 @@ PeimInitializeUsb (
 /**\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
@@ -289,13 +289,13 @@ PeiHubEnumeration (
         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
@@ -406,7 +406,7 @@ PeiHubEnumeration (
 \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
@@ -440,7 +440,7 @@ PeiUsbEnumeration (
                 PeiServices,\r
                 Usb2HcPpi,\r
                 (UINT8 *) &NumOfRootPort\r
-                );    \r
+                );\r
   } else if (UsbHcPpi != NULL) {\r
     UsbHcPpi->GetRootHubPortNumber (\r
                 PeiServices,\r
@@ -464,7 +464,7 @@ PeiUsbEnumeration (
                   Usb2HcPpi,\r
                   (UINT8) Index,\r
                   &PortStatus\r
-                  );      \r
+                  );\r
     } else {\r
       UsbHcPpi->GetRootHubPortStatus (\r
                   PeiServices,\r
@@ -515,10 +515,10 @@ PeiUsbEnumeration (
         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
@@ -550,7 +550,7 @@ PeiUsbEnumeration (
                         Usb2HcPpi,\r
                         (UINT8) Index,\r
                         EfiUsbPortResetChange\r
-                        );        \r
+                        );\r
           } else {\r
             UsbHcPpi->ClearRootHubPortFeature (\r
                         PeiServices,\r
@@ -650,7 +650,7 @@ PeiUsbEnumeration (
 \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
@@ -767,7 +767,7 @@ PeiConfigureUsbDevice (
 \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
@@ -920,7 +920,7 @@ PeiUsbGetAllConfiguration (
 \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
@@ -998,7 +998,7 @@ GetExpectedDescriptor (
 \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
@@ -1022,7 +1022,7 @@ ResetRootPort (
 \r
   if (Usb2HcPpi != NULL) {\r
     MicroSecondDelay (200 * 1000);\r
-    \r
+\r
     //\r
     // reset root port\r
     //\r
@@ -1032,12 +1032,12 @@ ResetRootPort (
                          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
@@ -1053,7 +1053,7 @@ ResetRootPort (
                          PortNum,\r
                          EfiUsbPortReset\r
                          );\r
-    \r
+\r
     if (EFI_ERROR (Status)) {\r
       DEBUG ((EFI_D_ERROR, "ClearRootHubPortFeature EfiUsbPortReset Failed\n"));\r
       return;\r
@@ -1073,7 +1073,7 @@ ResetRootPort (
                             Usb2HcPpi,\r
                             PortNum,\r
                             &PortStatus\r
-                            ); \r
+                            );\r
       if (EFI_ERROR (Status)) {\r
         return;\r
       }\r
@@ -1103,7 +1103,7 @@ ResetRootPort (
                 PortNum,\r
                 EfiUsbPortConnectChange\r
                 );\r
-    \r
+\r
     //\r
     // Set port enable\r
     //\r
@@ -1113,18 +1113,18 @@ ResetRootPort (
                 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
@@ -1134,18 +1134,18 @@ ResetRootPort (
                          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
@@ -1155,12 +1155,12 @@ ResetRootPort (
                          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
@@ -1175,7 +1175,7 @@ ResetRootPort (
                            UsbHcPpi,\r
                            PortNum,\r
                            &PortStatus\r
-                           ); \r
+                           );\r
       if (EFI_ERROR (Status)) {\r
         return;\r
       }\r
@@ -1205,7 +1205,7 @@ ResetRootPort (
                 PortNum,\r
                 EfiUsbPortConnectChange\r
                 );\r
-    \r
+\r
     //\r
     // Set port enable\r
     //\r
@@ -1215,14 +1215,14 @@ ResetRootPort (
                 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