]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Library/UefiBootManagerLib/BmBootDescription.c
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Library / UefiBootManagerLib / BmBootDescription.c
index aa891feb174ff950847b130663f6b79cd2db10ed..fac33b9ee9155a2da274b8b0c433bdfd088202f3 100644 (file)
@@ -9,15 +9,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 \r
 #include "InternalBm.h"\r
 \r
-#define VENDOR_IDENTIFICATION_OFFSET     3\r
-#define VENDOR_IDENTIFICATION_LENGTH     8\r
-#define PRODUCT_IDENTIFICATION_OFFSET    11\r
-#define PRODUCT_IDENTIFICATION_LENGTH    16\r
+#define VENDOR_IDENTIFICATION_OFFSET   3\r
+#define VENDOR_IDENTIFICATION_LENGTH   8\r
+#define PRODUCT_IDENTIFICATION_OFFSET  11\r
+#define PRODUCT_IDENTIFICATION_LENGTH  16\r
 \r
-CONST UINT16 mBmUsbLangId    = 0x0409; // English\r
-CHAR16       mBmUefiPrefix[] = L"UEFI ";\r
+CONST UINT16  mBmUsbLangId    = 0x0409; // English\r
+CHAR16        mBmUefiPrefix[] = L"UEFI ";\r
 \r
-LIST_ENTRY mPlatformBootDescriptionHandlers = INITIALIZE_LIST_HEAD_VARIABLE (mPlatformBootDescriptionHandlers);\r
+LIST_ENTRY  mPlatformBootDescriptionHandlers = INITIALIZE_LIST_HEAD_VARIABLE (mPlatformBootDescriptionHandlers);\r
 \r
 /**\r
   For a bootable Device path, return its boot type.\r
@@ -39,27 +39,28 @@ LIST_ENTRY mPlatformBootDescriptionHandlers = INITIALIZE_LIST_HEAD_VARIABLE (mPl
 **/\r
 BM_BOOT_TYPE\r
 BmDevicePathType (\r
-  IN  EFI_DEVICE_PATH_PROTOCOL     *DevicePath\r
+  IN  EFI_DEVICE_PATH_PROTOCOL  *DevicePath\r
   )\r
 {\r
-  EFI_DEVICE_PATH_PROTOCOL      *Node;\r
-  EFI_DEVICE_PATH_PROTOCOL      *NextNode;\r
+  EFI_DEVICE_PATH_PROTOCOL  *Node;\r
+  EFI_DEVICE_PATH_PROTOCOL  *NextNode;\r
 \r
   ASSERT (DevicePath != NULL);\r
 \r
   for (Node = DevicePath; !IsDevicePathEndType (Node); Node = NextDevicePathNode (Node)) {\r
     switch (DevicePathType (Node)) {\r
-\r
       case ACPI_DEVICE_PATH:\r
-        if (EISA_ID_TO_NUM (((ACPI_HID_DEVICE_PATH *) Node)->HID) == 0x0604) {\r
+        if (EISA_ID_TO_NUM (((ACPI_HID_DEVICE_PATH *)Node)->HID) == 0x0604) {\r
           return BmAcpiFloppyBoot;\r
         }\r
+\r
         break;\r
 \r
       case HARDWARE_DEVICE_PATH:\r
         if (DevicePathSubType (Node) == HW_CONTROLLER_DP) {\r
           return BmHardwareDeviceBoot;\r
         }\r
+\r
         break;\r
 \r
       case MESSAGING_DEVICE_PATH:\r
@@ -70,9 +71,9 @@ BmDevicePathType (
         do {\r
           NextNode = NextDevicePathNode (NextNode);\r
         } while (\r
-            (DevicePathType (NextNode) == MESSAGING_DEVICE_PATH) &&\r
-            (DevicePathSubType(NextNode) == MSG_DEVICE_LOGICAL_UNIT_DP)\r
-            );\r
+                 (DevicePathType (NextNode) == MESSAGING_DEVICE_PATH) &&\r
+                 (DevicePathSubType (NextNode) == MSG_DEVICE_LOGICAL_UNIT_DP)\r
+                 );\r
 \r
         //\r
         // If the device path not only point to driver device, it is not a messaging device path,\r
@@ -82,21 +83,21 @@ BmDevicePathType (
         }\r
 \r
         switch (DevicePathSubType (Node)) {\r
-        case MSG_ATAPI_DP:\r
-          return BmMessageAtapiBoot;\r
-          break;\r
+          case MSG_ATAPI_DP:\r
+            return BmMessageAtapiBoot;\r
+            break;\r
 \r
-        case MSG_SATA_DP:\r
-          return BmMessageSataBoot;\r
-          break;\r
+          case MSG_SATA_DP:\r
+            return BmMessageSataBoot;\r
+            break;\r
 \r
-        case MSG_USB_DP:\r
-          return BmMessageUsbBoot;\r
-          break;\r
+          case MSG_USB_DP:\r
+            return BmMessageUsbBoot;\r
+            break;\r
 \r
-        case MSG_SCSI_DP:\r
-          return BmMessageScsiBoot;\r
-          break;\r
+          case MSG_SCSI_DP:\r
+            return BmMessageScsiBoot;\r
+            break;\r
         }\r
     }\r
   }\r
@@ -111,17 +112,18 @@ BmDevicePathType (
 **/\r
 VOID\r
 BmEliminateExtraSpaces (\r
-  IN CHAR16                    *Str\r
+  IN CHAR16  *Str\r
   )\r
 {\r
-  UINTN                        Index;\r
-  UINTN                        ActualIndex;\r
+  UINTN  Index;\r
+  UINTN  ActualIndex;\r
 \r
   for (Index = 0, ActualIndex = 0; Str[Index] != L'\0'; Index++) {\r
     if ((Str[Index] != L' ') || ((ActualIndex > 0) && (Str[ActualIndex - 1] != L' '))) {\r
       Str[ActualIndex++] = Str[Index];\r
     }\r
   }\r
+\r
   Str[ActualIndex] = L'\0';\r
 }\r
 \r
@@ -134,70 +136,72 @@ BmEliminateExtraSpaces (
 **/\r
 CHAR16 *\r
 BmGetDescriptionFromDiskInfo (\r
-  IN EFI_HANDLE                Handle\r
+  IN EFI_HANDLE  Handle\r
   )\r
 {\r
-  UINTN                        Index;\r
-  EFI_STATUS                   Status;\r
-  EFI_DISK_INFO_PROTOCOL       *DiskInfo;\r
-  UINT32                       BufferSize;\r
-  EFI_ATAPI_IDENTIFY_DATA      IdentifyData;\r
-  EFI_SCSI_INQUIRY_DATA        InquiryData;\r
-  CHAR16                       *Description;\r
-  UINTN                        Length;\r
-  CONST UINTN                  ModelNameLength    = 40;\r
-  CONST UINTN                  SerialNumberLength = 20;\r
-  CHAR8                        *StrPtr;\r
-  UINT8                        Temp;\r
-  EFI_DEVICE_PATH_PROTOCOL     *DevicePath;\r
-\r
-  Description  = NULL;\r
+  UINTN                     Index;\r
+  EFI_STATUS                Status;\r
+  EFI_DISK_INFO_PROTOCOL    *DiskInfo;\r
+  UINT32                    BufferSize;\r
+  EFI_ATAPI_IDENTIFY_DATA   IdentifyData;\r
+  EFI_SCSI_INQUIRY_DATA     InquiryData;\r
+  CHAR16                    *Description;\r
+  UINTN                     Length;\r
+  CONST UINTN               ModelNameLength    = 40;\r
+  CONST UINTN               SerialNumberLength = 20;\r
+  CHAR8                     *StrPtr;\r
+  UINT8                     Temp;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+\r
+  Description = NULL;\r
 \r
   Status = gBS->HandleProtocol (\r
                   Handle,\r
                   &gEfiDiskInfoProtocolGuid,\r
-                  (VOID **) &DiskInfo\r
+                  (VOID **)&DiskInfo\r
                   );\r
   if (EFI_ERROR (Status)) {\r
     return NULL;\r
   }\r
 \r
   if (CompareGuid (&DiskInfo->Interface, &gEfiDiskInfoAhciInterfaceGuid) ||\r
-      CompareGuid (&DiskInfo->Interface, &gEfiDiskInfoIdeInterfaceGuid)) {\r
-    BufferSize   = sizeof (EFI_ATAPI_IDENTIFY_DATA);\r
-    Status = DiskInfo->Identify (\r
-                         DiskInfo,\r
-                         &IdentifyData,\r
-                         &BufferSize\r
-                         );\r
+      CompareGuid (&DiskInfo->Interface, &gEfiDiskInfoIdeInterfaceGuid))\r
+  {\r
+    BufferSize = sizeof (EFI_ATAPI_IDENTIFY_DATA);\r
+    Status     = DiskInfo->Identify (\r
+                             DiskInfo,\r
+                             &IdentifyData,\r
+                             &BufferSize\r
+                             );\r
     if (!EFI_ERROR (Status)) {\r
       Description = AllocateZeroPool ((ModelNameLength + SerialNumberLength + 2) * sizeof (CHAR16));\r
       ASSERT (Description != NULL);\r
       for (Index = 0; Index + 1 < ModelNameLength; Index += 2) {\r
-        Description[Index]     = (CHAR16) IdentifyData.ModelName[Index + 1];\r
-        Description[Index + 1] = (CHAR16) IdentifyData.ModelName[Index];\r
+        Description[Index]     = (CHAR16)IdentifyData.ModelName[Index + 1];\r
+        Description[Index + 1] = (CHAR16)IdentifyData.ModelName[Index];\r
       }\r
 \r
-      Length = Index;\r
+      Length                = Index;\r
       Description[Length++] = L' ';\r
 \r
       for (Index = 0; Index + 1 < SerialNumberLength; Index += 2) {\r
-        Description[Length + Index]     = (CHAR16) IdentifyData.SerialNo[Index + 1];\r
-        Description[Length + Index + 1] = (CHAR16) IdentifyData.SerialNo[Index];\r
+        Description[Length + Index]     = (CHAR16)IdentifyData.SerialNo[Index + 1];\r
+        Description[Length + Index + 1] = (CHAR16)IdentifyData.SerialNo[Index];\r
       }\r
-      Length += Index;\r
+\r
+      Length               += Index;\r
       Description[Length++] = L'\0';\r
       ASSERT (Length == ModelNameLength + SerialNumberLength + 2);\r
 \r
       BmEliminateExtraSpaces (Description);\r
     }\r
   } else if (CompareGuid (&DiskInfo->Interface, &gEfiDiskInfoScsiInterfaceGuid)) {\r
-    BufferSize   = sizeof (EFI_SCSI_INQUIRY_DATA);\r
-    Status = DiskInfo->Inquiry (\r
-                         DiskInfo,\r
-                         &InquiryData,\r
-                         &BufferSize\r
-                         );\r
+    BufferSize = sizeof (EFI_SCSI_INQUIRY_DATA);\r
+    Status     = DiskInfo->Inquiry (\r
+                             DiskInfo,\r
+                             &InquiryData,\r
+                             &BufferSize\r
+                             );\r
     if (!EFI_ERROR (Status)) {\r
       Description = AllocateZeroPool ((VENDOR_IDENTIFICATION_LENGTH + PRODUCT_IDENTIFICATION_LENGTH + 2) * sizeof (CHAR16));\r
       ASSERT (Description != NULL);\r
@@ -207,8 +211,8 @@ BmGetDescriptionFromDiskInfo (
       // EFI_SCSI_INQUIRY_DATA.Reserved_5_95[11 - 26] save the product identification,\r
       // Here combine the vendor identification and product identification to the description.\r
       //\r
-      StrPtr = (CHAR8 *) (&InquiryData.Reserved_5_95[VENDOR_IDENTIFICATION_OFFSET]);\r
-      Temp = StrPtr[VENDOR_IDENTIFICATION_LENGTH];\r
+      StrPtr                               = (CHAR8 *)(&InquiryData.Reserved_5_95[VENDOR_IDENTIFICATION_OFFSET]);\r
+      Temp                                 = StrPtr[VENDOR_IDENTIFICATION_LENGTH];\r
       StrPtr[VENDOR_IDENTIFICATION_LENGTH] = '\0';\r
       AsciiStrToUnicodeStrS (StrPtr, Description, VENDOR_IDENTIFICATION_LENGTH + 1);\r
       StrPtr[VENDOR_IDENTIFICATION_LENGTH] = Temp;\r
@@ -218,7 +222,7 @@ BmGetDescriptionFromDiskInfo (
       //\r
       Description[VENDOR_IDENTIFICATION_LENGTH] = L' ';\r
 \r
-      StrPtr = (CHAR8 *) (&InquiryData.Reserved_5_95[PRODUCT_IDENTIFICATION_OFFSET]);\r
+      StrPtr                                = (CHAR8 *)(&InquiryData.Reserved_5_95[PRODUCT_IDENTIFICATION_OFFSET]);\r
       StrPtr[PRODUCT_IDENTIFICATION_LENGTH] = '\0';\r
       AsciiStrToUnicodeStrS (StrPtr, Description + VENDOR_IDENTIFICATION_LENGTH + 1, PRODUCT_IDENTIFICATION_LENGTH + 1);\r
 \r
@@ -233,6 +237,7 @@ BmGetDescriptionFromDiskInfo (
     while (!IsDevicePathEnd (DevicePath) && (DevicePathType (DevicePath) != MESSAGING_DEVICE_PATH)) {\r
       DevicePath = NextDevicePathNode (DevicePath);\r
     }\r
+\r
     if (IsDevicePathEnd (DevicePath)) {\r
       return NULL;\r
     }\r
@@ -260,23 +265,23 @@ BmGetDescriptionFromDiskInfo (
 **/\r
 CHAR16 *\r
 BmGetUsbDescription (\r
-  IN EFI_HANDLE                Handle\r
+  IN EFI_HANDLE  Handle\r
   )\r
 {\r
-  EFI_STATUS                   Status;\r
-  EFI_USB_IO_PROTOCOL          *UsbIo;\r
-  CHAR16                       NullChar;\r
-  CHAR16                       *Manufacturer;\r
-  CHAR16                       *Product;\r
-  CHAR16                       *SerialNumber;\r
-  CHAR16                       *Description;\r
-  EFI_USB_DEVICE_DESCRIPTOR    DevDesc;\r
-  UINTN                        DescMaxSize;\r
+  EFI_STATUS                 Status;\r
+  EFI_USB_IO_PROTOCOL        *UsbIo;\r
+  CHAR16                     NullChar;\r
+  CHAR16                     *Manufacturer;\r
+  CHAR16                     *Product;\r
+  CHAR16                     *SerialNumber;\r
+  CHAR16                     *Description;\r
+  EFI_USB_DEVICE_DESCRIPTOR  DevDesc;\r
+  UINTN                      DescMaxSize;\r
 \r
   Status = gBS->HandleProtocol (\r
                   Handle,\r
                   &gEfiUsbIoProtocolGuid,\r
-                  (VOID **) &UsbIo\r
+                  (VOID **)&UsbIo\r
                   );\r
   if (EFI_ERROR (Status)) {\r
     return NULL;\r
@@ -322,27 +327,30 @@ BmGetUsbDescription (
   if ((Manufacturer == &NullChar) &&\r
       (Product == &NullChar) &&\r
       (SerialNumber == &NullChar)\r
-      ) {\r
+      )\r
+  {\r
     return NULL;\r
   }\r
 \r
   DescMaxSize = StrSize (Manufacturer) + StrSize (Product) + StrSize (SerialNumber);\r
   Description = AllocateZeroPool (DescMaxSize);\r
   ASSERT (Description != NULL);\r
-  StrCatS (Description, DescMaxSize/sizeof(CHAR16), Manufacturer);\r
-  StrCatS (Description, DescMaxSize/sizeof(CHAR16), L" ");\r
+  StrCatS (Description, DescMaxSize/sizeof (CHAR16), Manufacturer);\r
+  StrCatS (Description, DescMaxSize/sizeof (CHAR16), L" ");\r
 \r
-  StrCatS (Description, DescMaxSize/sizeof(CHAR16), Product);\r
-  StrCatS (Description, DescMaxSize/sizeof(CHAR16), L" ");\r
+  StrCatS (Description, DescMaxSize/sizeof (CHAR16), Product);\r
+  StrCatS (Description, DescMaxSize/sizeof (CHAR16), L" ");\r
 \r
-  StrCatS (Description, DescMaxSize/sizeof(CHAR16), SerialNumber);\r
+  StrCatS (Description, DescMaxSize/sizeof (CHAR16), SerialNumber);\r
 \r
   if (Manufacturer != &NullChar) {\r
     FreePool (Manufacturer);\r
   }\r
+\r
   if (Product != &NullChar) {\r
     FreePool (Product);\r
   }\r
+\r
   if (SerialNumber != &NullChar) {\r
     FreePool (SerialNumber);\r
   }\r
@@ -361,17 +369,17 @@ BmGetUsbDescription (
 **/\r
 CHAR16 *\r
 BmGetNetworkDescription (\r
-  IN EFI_HANDLE                  Handle\r
+  IN EFI_HANDLE  Handle\r
   )\r
 {\r
-  EFI_STATUS                     Status;\r
-  EFI_DEVICE_PATH_PROTOCOL       *DevicePath;\r
-  MAC_ADDR_DEVICE_PATH           *Mac;\r
-  VLAN_DEVICE_PATH               *Vlan;\r
-  EFI_DEVICE_PATH_PROTOCOL       *Ip;\r
-  EFI_DEVICE_PATH_PROTOCOL       *Uri;\r
-  CHAR16                         *Description;\r
-  UINTN                          DescriptionSize;\r
+  EFI_STATUS                Status;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
+  MAC_ADDR_DEVICE_PATH      *Mac;\r
+  VLAN_DEVICE_PATH          *Vlan;\r
+  EFI_DEVICE_PATH_PROTOCOL  *Ip;\r
+  EFI_DEVICE_PATH_PROTOCOL  *Uri;\r
+  CHAR16                    *Description;\r
+  UINTN                     DescriptionSize;\r
 \r
   Status = gBS->OpenProtocol (\r
                   Handle,\r
@@ -388,7 +396,7 @@ BmGetNetworkDescription (
   Status = gBS->OpenProtocol (\r
                   Handle,\r
                   &gEfiDevicePathProtocolGuid,\r
-                  (VOID **) &DevicePath,\r
+                  (VOID **)&DevicePath,\r
                   gImageHandle,\r
                   Handle,\r
                   EFI_OPEN_PROTOCOL_GET_PROTOCOL\r
@@ -410,7 +418,8 @@ BmGetNetworkDescription (
   while (!IsDevicePathEnd (DevicePath) &&\r
          ((DevicePathType (DevicePath) != MESSAGING_DEVICE_PATH) ||\r
           (DevicePathSubType (DevicePath) != MSG_MAC_ADDR_DP))\r
-         ) {\r
+         )\r
+  {\r
     DevicePath = NextDevicePathNode (DevicePath);\r
   }\r
 \r
@@ -418,7 +427,7 @@ BmGetNetworkDescription (
     return NULL;\r
   }\r
 \r
-  Mac = (MAC_ADDR_DEVICE_PATH *) DevicePath;\r
+  Mac        = (MAC_ADDR_DEVICE_PATH *)DevicePath;\r
   DevicePath = NextDevicePathNode (DevicePath);\r
 \r
   //\r
@@ -426,8 +435,9 @@ BmGetNetworkDescription (
   //\r
   if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&\r
       (DevicePathSubType (DevicePath) == MSG_VLAN_DP)\r
-      ) {\r
-    Vlan = (VLAN_DEVICE_PATH *) DevicePath;\r
+      )\r
+  {\r
+    Vlan       = (VLAN_DEVICE_PATH *)DevicePath;\r
     DevicePath = NextDevicePathNode (DevicePath);\r
   } else {\r
     Vlan = NULL;\r
@@ -438,7 +448,8 @@ BmGetNetworkDescription (
   //\r
   if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&\r
       (DevicePathSubType (DevicePath) == MSG_WIFI_DP)\r
-      ) {\r
+      )\r
+  {\r
     DevicePath = NextDevicePathNode (DevicePath);\r
   }\r
 \r
@@ -448,8 +459,9 @@ BmGetNetworkDescription (
   if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&\r
       ((DevicePathSubType (DevicePath) == MSG_IPv4_DP) ||\r
        (DevicePathSubType (DevicePath) == MSG_IPv6_DP))\r
-      ) {\r
-    Ip = DevicePath;\r
+      )\r
+  {\r
+    Ip         = DevicePath;\r
     DevicePath = NextDevicePathNode (DevicePath);\r
   } else {\r
     Ip = NULL;\r
@@ -460,7 +472,8 @@ BmGetNetworkDescription (
   //\r
   if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&\r
       (DevicePathSubType (DevicePath) == MSG_DNS_DP)\r
-      ) {\r
+      )\r
+  {\r
     DevicePath = NextDevicePathNode (DevicePath);\r
   }\r
 \r
@@ -469,8 +482,9 @@ BmGetNetworkDescription (
   //\r
   if ((DevicePathType (DevicePath) == MESSAGING_DEVICE_PATH) &&\r
       (DevicePathSubType (DevicePath) == MSG_URI_DP)\r
-      ) {\r
-    Uri = DevicePath;\r
+      )\r
+  {\r
+    Uri        = DevicePath;\r
     DevicePath = NextDevicePathNode (DevicePath);\r
   } else {\r
     Uri = NULL;\r
@@ -485,14 +499,19 @@ BmGetNetworkDescription (
   Description     = AllocatePool (DescriptionSize);\r
   ASSERT (Description != NULL);\r
   UnicodeSPrint (\r
-    Description, DescriptionSize,\r
+    Description,\r
+    DescriptionSize,\r
     (Vlan == NULL) ?\r
     L"%sv%d (MAC:%02x%02x%02x%02x%02x%02x)" :\r
     L"%sv%d (MAC:%02x%02x%02x%02x%02x%02x VLAN%d)",\r
     (Uri == NULL) ? L"PXE" : L"HTTP",\r
     ((Ip == NULL) || (DevicePathSubType (Ip) == MSG_IPv4_DP)) ? 4 : 6,\r
-    Mac->MacAddress.Addr[0], Mac->MacAddress.Addr[1], Mac->MacAddress.Addr[2],\r
-    Mac->MacAddress.Addr[3], Mac->MacAddress.Addr[4], Mac->MacAddress.Addr[5],\r
+    Mac->MacAddress.Addr[0],\r
+    Mac->MacAddress.Addr[1],\r
+    Mac->MacAddress.Addr[2],\r
+    Mac->MacAddress.Addr[3],\r
+    Mac->MacAddress.Addr[4],\r
+    Mac->MacAddress.Addr[5],\r
     (Vlan == NULL) ? 0 : Vlan->VlanId\r
     );\r
   return Description;\r
@@ -507,14 +526,14 @@ BmGetNetworkDescription (
 **/\r
 CHAR16 *\r
 BmGetLoadFileDescription (\r
-  IN EFI_HANDLE                  Handle\r
+  IN EFI_HANDLE  Handle\r
   )\r
 {\r
-  EFI_STATUS                            Status;\r
-  EFI_DEVICE_PATH_PROTOCOL              *FilePath;\r
-  EFI_DEVICE_PATH_PROTOCOL              *DevicePathNode;\r
-  CHAR16                                *Description;\r
-  EFI_LOAD_FILE_PROTOCOL                *LoadFile;\r
+  EFI_STATUS                Status;\r
+  EFI_DEVICE_PATH_PROTOCOL  *FilePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePathNode;\r
+  CHAR16                    *Description;\r
+  EFI_LOAD_FILE_PROTOCOL    *LoadFile;\r
 \r
   Status = gBS->HandleProtocol (Handle, &gEfiLoadFileProtocolGuid, (VOID **)&LoadFile);\r
   if (EFI_ERROR (Status)) {\r
@@ -525,14 +544,15 @@ BmGetLoadFileDescription (
   // Get the file name\r
   //\r
   Description = NULL;\r
-  Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **)&FilePath);\r
+  Status      = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **)&FilePath);\r
   if (!EFI_ERROR (Status)) {\r
     DevicePathNode = FilePath;\r
     while (!IsDevicePathEnd (DevicePathNode)) {\r
-      if (DevicePathNode->Type == MEDIA_DEVICE_PATH && DevicePathNode->SubType == MEDIA_FILEPATH_DP) {\r
+      if ((DevicePathNode->Type == MEDIA_DEVICE_PATH) && (DevicePathNode->SubType == MEDIA_FILEPATH_DP)) {\r
         Description = (CHAR16 *)(DevicePathNode + 1);\r
         break;\r
       }\r
+\r
       DevicePathNode = NextDevicePathNode (DevicePathNode);\r
     }\r
   }\r
@@ -553,21 +573,21 @@ BmGetLoadFileDescription (
 **/\r
 CHAR16 *\r
 BmGetNvmeDescription (\r
-  IN EFI_HANDLE                      Handle\r
+  IN EFI_HANDLE  Handle\r
   )\r
 {\r
-  EFI_STATUS                               Status;\r
-  EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL       *NvmePassthru;\r
-  EFI_DEV_PATH_PTR                         DevicePath;\r
-  EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET CommandPacket;\r
-  EFI_NVM_EXPRESS_COMMAND                  Command;\r
-  EFI_NVM_EXPRESS_COMPLETION               Completion;\r
-  NVME_ADMIN_CONTROLLER_DATA               ControllerData;\r
-  CHAR16                                   *Description;\r
-  CHAR16                                   *Char;\r
-  UINTN                                    Index;\r
-\r
-  Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **) &DevicePath.DevPath);\r
+  EFI_STATUS                                Status;\r
+  EFI_NVM_EXPRESS_PASS_THRU_PROTOCOL        *NvmePassthru;\r
+  EFI_DEV_PATH_PTR                          DevicePath;\r
+  EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET  CommandPacket;\r
+  EFI_NVM_EXPRESS_COMMAND                   Command;\r
+  EFI_NVM_EXPRESS_COMPLETION                Completion;\r
+  NVME_ADMIN_CONTROLLER_DATA                ControllerData;\r
+  CHAR16                                    *Description;\r
+  CHAR16                                    *Char;\r
+  UINTN                                     Index;\r
+\r
+  Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid, (VOID **)&DevicePath.DevPath);\r
   if (EFI_ERROR (Status)) {\r
     return NULL;\r
   }\r
@@ -575,7 +595,8 @@ BmGetNvmeDescription (
   Status = gBS->LocateDevicePath (&gEfiNvmExpressPassThruProtocolGuid, &DevicePath.DevPath, &Handle);\r
   if (EFI_ERROR (Status) ||\r
       (DevicePathType (DevicePath.DevPath) != MESSAGING_DEVICE_PATH) ||\r
-      (DevicePathSubType (DevicePath.DevPath) != MSG_NVME_NAMESPACE_DP)) {\r
+      (DevicePathSubType (DevicePath.DevPath) != MSG_NVME_NAMESPACE_DP))\r
+  {\r
     //\r
     // Do not return description when the Handle is not a child of NVME controller.\r
     //\r
@@ -585,19 +606,19 @@ BmGetNvmeDescription (
   //\r
   // Send ADMIN_IDENTIFY command to NVME controller to get the model and serial number.\r
   //\r
-  Status = gBS->HandleProtocol (Handle, &gEfiNvmExpressPassThruProtocolGuid, (VOID **) &NvmePassthru);\r
+  Status = gBS->HandleProtocol (Handle, &gEfiNvmExpressPassThruProtocolGuid, (VOID **)&NvmePassthru);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
-  ZeroMem (&CommandPacket, sizeof(EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET));\r
-  ZeroMem (&Command, sizeof(EFI_NVM_EXPRESS_COMMAND));\r
-  ZeroMem (&Completion, sizeof(EFI_NVM_EXPRESS_COMPLETION));\r
+  ZeroMem (&CommandPacket, sizeof (EFI_NVM_EXPRESS_PASS_THRU_COMMAND_PACKET));\r
+  ZeroMem (&Command, sizeof (EFI_NVM_EXPRESS_COMMAND));\r
+  ZeroMem (&Completion, sizeof (EFI_NVM_EXPRESS_COMPLETION));\r
 \r
   Command.Cdw0.Opcode = NVME_ADMIN_IDENTIFY_CMD;\r
   //\r
   // According to Nvm Express 1.1 spec Figure 38, When not used, the field shall be cleared to 0h.\r
   // For the Identify command, the Namespace Identifier is only used for the Namespace data structure.\r
   //\r
-  Command.Nsid        = 0;\r
+  Command.Nsid                 = 0;\r
   CommandPacket.NvmeCmd        = &Command;\r
   CommandPacket.NvmeCompletion = &Completion;\r
   CommandPacket.TransferBuffer = &ControllerData;\r
@@ -607,15 +628,15 @@ BmGetNvmeDescription (
   //\r
   // Set bit 0 (Cns bit) to 1 to identify a controller\r
   //\r
-  Command.Cdw10                = 1;\r
-  Command.Flags                = CDW10_VALID;\r
+  Command.Cdw10 = 1;\r
+  Command.Flags = CDW10_VALID;\r
 \r
   Status = NvmePassthru->PassThru (\r
-                               NvmePassthru,\r
-                               0,\r
-                               &CommandPacket,\r
-                               NULL\r
-                               );\r
+                           NvmePassthru,\r
+                           0,\r
+                           &CommandPacket,\r
+                           NULL\r
+                           );\r
   if (EFI_ERROR (Status)) {\r
     return NULL;\r
   }\r
@@ -624,20 +645,26 @@ BmGetNvmeDescription (
                   (ARRAY_SIZE (ControllerData.Mn) + 1\r
                    + ARRAY_SIZE (ControllerData.Sn) + 1\r
                    + MAXIMUM_VALUE_CHARACTERS + 1\r
-                   ) * sizeof (CHAR16));\r
+                  ) * sizeof (CHAR16)\r
+                  );\r
   if (Description != NULL) {\r
     Char = Description;\r
     for (Index = 0; Index < ARRAY_SIZE (ControllerData.Mn); Index++) {\r
-      *(Char++) = (CHAR16) ControllerData.Mn[Index];\r
+      *(Char++) = (CHAR16)ControllerData.Mn[Index];\r
     }\r
+\r
     *(Char++) = L' ';\r
     for (Index = 0; Index < ARRAY_SIZE (ControllerData.Sn); Index++) {\r
-      *(Char++) = (CHAR16) ControllerData.Sn[Index];\r
+      *(Char++) = (CHAR16)ControllerData.Sn[Index];\r
     }\r
+\r
     *(Char++) = L' ';\r
     UnicodeValueToStringS (\r
-      Char, sizeof (CHAR16) * (MAXIMUM_VALUE_CHARACTERS + 1),\r
-      0, DevicePath.NvmeNamespace->NamespaceId, 0\r
+      Char,\r
+      sizeof (CHAR16) * (MAXIMUM_VALUE_CHARACTERS + 1),\r
+      0,\r
+      DevicePath.NvmeNamespace->NamespaceId,\r
+      0\r
       );\r
     BmEliminateExtraSpaces (Description);\r
   }\r
@@ -654,54 +681,56 @@ BmGetNvmeDescription (
 **/\r
 CHAR16 *\r
 BmGetMiscDescription (\r
-  IN EFI_HANDLE                  Handle\r
+  IN EFI_HANDLE  Handle\r
   )\r
 {\r
-  EFI_STATUS                      Status;\r
-  CHAR16                          *Description;\r
-  EFI_BLOCK_IO_PROTOCOL           *BlockIo;\r
-  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *Fs;\r
+  EFI_STATUS                       Status;\r
+  CHAR16                           *Description;\r
+  EFI_BLOCK_IO_PROTOCOL            *BlockIo;\r
+  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL  *Fs;\r
 \r
   switch (BmDevicePathType (DevicePathFromHandle (Handle))) {\r
-  case BmAcpiFloppyBoot:\r
-    Description = L"Floppy";\r
-    break;\r
-\r
-  case BmMessageAtapiBoot:\r
-  case BmMessageSataBoot:\r
-    Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo);\r
-    ASSERT_EFI_ERROR (Status);\r
-    //\r
-    // Assume a removable SATA device should be the DVD/CD device\r
-    //\r
-    Description = BlockIo->Media->RemovableMedia ? L"DVD/CDROM" : L"Hard Drive";\r
-    break;\r
+    case BmAcpiFloppyBoot:\r
+      Description = L"Floppy";\r
+      break;\r
+\r
+    case BmMessageAtapiBoot:\r
+    case BmMessageSataBoot:\r
+      Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlockIo);\r
+      ASSERT_EFI_ERROR (Status);\r
+      //\r
+      // Assume a removable SATA device should be the DVD/CD device\r
+      //\r
+      Description = BlockIo->Media->RemovableMedia ? L"DVD/CDROM" : L"Hard Drive";\r
+      break;\r
 \r
-  case BmMessageUsbBoot:\r
-    Description = L"USB Device";\r
-    break;\r
+    case BmMessageUsbBoot:\r
+      Description = L"USB Device";\r
+      break;\r
 \r
-  case BmMessageScsiBoot:\r
-    Description = L"SCSI Device";\r
-    break;\r
+    case BmMessageScsiBoot:\r
+      Description = L"SCSI Device";\r
+      break;\r
 \r
-  case BmHardwareDeviceBoot:\r
-    Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **) &BlockIo);\r
-    if (!EFI_ERROR (Status)) {\r
-      Description = BlockIo->Media->RemovableMedia ? L"Removable Disk" : L"Hard Drive";\r
-    } else {\r
-      Description = L"Misc Device";\r
-    }\r
-    break;\r
+    case BmHardwareDeviceBoot:\r
+      Status = gBS->HandleProtocol (Handle, &gEfiBlockIoProtocolGuid, (VOID **)&BlockIo);\r
+      if (!EFI_ERROR (Status)) {\r
+        Description = BlockIo->Media->RemovableMedia ? L"Removable Disk" : L"Hard Drive";\r
+      } else {\r
+        Description = L"Misc Device";\r
+      }\r
 \r
-  default:\r
-    Status = gBS->HandleProtocol (Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **) &Fs);\r
-    if (!EFI_ERROR (Status)) {\r
-      Description = L"Non-Block Boot Device";\r
-    } else {\r
-      Description = L"Misc Device";\r
-    }\r
-    break;\r
+      break;\r
+\r
+    default:\r
+      Status = gBS->HandleProtocol (Handle, &gEfiSimpleFileSystemProtocolGuid, (VOID **)&Fs);\r
+      if (!EFI_ERROR (Status)) {\r
+        Description = L"Non-Block Boot Device";\r
+      } else {\r
+        Description = L"Misc Device";\r
+      }\r
+\r
+      break;\r
   }\r
 \r
   return AllocateCopyPool (StrSize (Description), Description);\r
@@ -722,13 +751,14 @@ EfiBootManagerRegisterBootDescriptionHandler (
   IN EFI_BOOT_MANAGER_BOOT_DESCRIPTION_HANDLER  Handler\r
   )\r
 {\r
-  LIST_ENTRY                                    *Link;\r
-  BM_BOOT_DESCRIPTION_ENTRY                    *Entry;\r
+  LIST_ENTRY                 *Link;\r
+  BM_BOOT_DESCRIPTION_ENTRY  *Entry;\r
 \r
   for ( Link = GetFirstNode (&mPlatformBootDescriptionHandlers)\r
-      ; !IsNull (&mPlatformBootDescriptionHandlers, Link)\r
-      ; Link = GetNextNode (&mPlatformBootDescriptionHandlers, Link)\r
-      ) {\r
+        ; !IsNull (&mPlatformBootDescriptionHandlers, Link)\r
+        ; Link = GetNextNode (&mPlatformBootDescriptionHandlers, Link)\r
+        )\r
+  {\r
     Entry = CR (Link, BM_BOOT_DESCRIPTION_ENTRY, Link, BM_BOOT_DESCRIPTION_ENTRY_SIGNATURE);\r
     if (Entry->Handler == Handler) {\r
       return EFI_ALREADY_STARTED;\r
@@ -746,7 +776,7 @@ EfiBootManagerRegisterBootDescriptionHandler (
   return EFI_SUCCESS;\r
 }\r
 \r
-BM_GET_BOOT_DESCRIPTION mBmBootDescriptionHandlers[] = {\r
+BM_GET_BOOT_DESCRIPTION  mBmBootDescriptionHandlers[] = {\r
   BmGetUsbDescription,\r
   BmGetDescriptionFromDiskInfo,\r
   BmGetNetworkDescription,\r
@@ -764,22 +794,22 @@ BM_GET_BOOT_DESCRIPTION mBmBootDescriptionHandlers[] = {
 **/\r
 CHAR16 *\r
 BmGetBootDescription (\r
-  IN EFI_HANDLE                  Handle\r
+  IN EFI_HANDLE  Handle\r
   )\r
 {\r
-  LIST_ENTRY                     *Link;\r
-  BM_BOOT_DESCRIPTION_ENTRY      *Entry;\r
-  CHAR16                         *Description;\r
-  CHAR16                         *DefaultDescription;\r
-  CHAR16                         *Temp;\r
-  UINTN                          Index;\r
+  LIST_ENTRY                 *Link;\r
+  BM_BOOT_DESCRIPTION_ENTRY  *Entry;\r
+  CHAR16                     *Description;\r
+  CHAR16                     *DefaultDescription;\r
+  CHAR16                     *Temp;\r
+  UINTN                      Index;\r
 \r
   //\r
   // Firstly get the default boot description\r
   //\r
   DefaultDescription = NULL;\r
   for (Index = 0; Index < ARRAY_SIZE (mBmBootDescriptionHandlers); Index++) {\r
-    DefaultDescription = mBmBootDescriptionHandlers[Index] (Handle);\r
+    DefaultDescription = mBmBootDescriptionHandlers[Index](Handle);\r
     if (DefaultDescription != NULL) {\r
       //\r
       // Avoid description confusion between UEFI & Legacy boot option by adding "UEFI " prefix\r
@@ -794,16 +824,18 @@ BmGetBootDescription (
       break;\r
     }\r
   }\r
+\r
   ASSERT (DefaultDescription != NULL);\r
 \r
   //\r
   // Secondly query platform for the better boot description\r
   //\r
   for ( Link = GetFirstNode (&mPlatformBootDescriptionHandlers)\r
-      ; !IsNull (&mPlatformBootDescriptionHandlers, Link)\r
-      ; Link = GetNextNode (&mPlatformBootDescriptionHandlers, Link)\r
-      ) {\r
-    Entry = CR (Link, BM_BOOT_DESCRIPTION_ENTRY, Link, BM_BOOT_DESCRIPTION_ENTRY_SIGNATURE);\r
+        ; !IsNull (&mPlatformBootDescriptionHandlers, Link)\r
+        ; Link = GetNextNode (&mPlatformBootDescriptionHandlers, Link)\r
+        )\r
+  {\r
+    Entry       = CR (Link, BM_BOOT_DESCRIPTION_ENTRY, Link, BM_BOOT_DESCRIPTION_ENTRY_SIGNATURE);\r
     Description = Entry->Handler (Handle, DefaultDescription);\r
     if (Description != NULL) {\r
       FreePool (DefaultDescription);\r
@@ -823,16 +855,16 @@ BmGetBootDescription (
 **/\r
 VOID\r
 BmMakeBootOptionDescriptionUnique (\r
-  EFI_BOOT_MANAGER_LOAD_OPTION         *BootOptions,\r
-  UINTN                                BootOptionCount\r
+  EFI_BOOT_MANAGER_LOAD_OPTION  *BootOptions,\r
+  UINTN                         BootOptionCount\r
   )\r
 {\r
-  UINTN                                Base;\r
-  UINTN                                Index;\r
-  UINTN                                DescriptionSize;\r
-  UINTN                                MaxSuffixSize;\r
-  BOOLEAN                              *Visited;\r
-  UINTN                                MatchCount;\r
+  UINTN    Base;\r
+  UINTN    Index;\r
+  UINTN    DescriptionSize;\r
+  UINTN    MaxSuffixSize;\r
+  BOOLEAN  *Visited;\r
+  UINTN    MatchCount;\r
 \r
   if (BootOptionCount == 0) {\r
     return;\r
@@ -856,15 +888,17 @@ BmMakeBootOptionDescriptionUnique (
       Visited[Base]   = TRUE;\r
       DescriptionSize = StrSize (BootOptions[Base].Description);\r
       for (Index = Base + 1; Index < BootOptionCount; Index++) {\r
-        if (!Visited[Index] && StrCmp (BootOptions[Base].Description, BootOptions[Index].Description) == 0) {\r
+        if (!Visited[Index] && (StrCmp (BootOptions[Base].Description, BootOptions[Index].Description) == 0)) {\r
           Visited[Index] = TRUE;\r
           MatchCount++;\r
           FreePool (BootOptions[Index].Description);\r
           BootOptions[Index].Description = AllocatePool (DescriptionSize + MaxSuffixSize);\r
           UnicodeSPrint (\r
-            BootOptions[Index].Description, DescriptionSize + MaxSuffixSize,\r
+            BootOptions[Index].Description,\r
+            DescriptionSize + MaxSuffixSize,\r
             L"%s %d",\r
-            BootOptions[Base].Description, MatchCount\r
+            BootOptions[Base].Description,\r
+            MatchCount\r
             );\r
         }\r
       }\r