]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Csm/CsmSupportLib/LegacyPlatform.c
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / Csm / CsmSupportLib / LegacyPlatform.c
index dd75be00f676095c56246460b14d1412b47ec404..491897adbdf2a6c65b1fb0fe0ef246e4a5c17694 100644 (file)
@@ -3,27 +3,21 @@
 \r
   Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
 \r
-  This program and the accompanying materials are\r
-  licensed and made available under the terms and conditions of the BSD License\r
-  which accompanies this distribution.  The full text of the license may be found at\r
-  http://opensource.org/licenses/bsd-license.php\r
-\r
-  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
 #include "LegacyPlatform.h"\r
 \r
-EFI_SETUP_BBS_MAP mSetupBbsMap[] = {\r
-  { 1, 2,     1, 1 },     // ATA HardDrive\r
-  { 2, 3,     1, 1 },     // ATAPI CDROM\r
-  { 3, 0x80,  2, 0 },     // PXE\r
-  { 4, 1,     0, 6 },     // USB Floppy\r
-  { 4, 2,     0, 6 },     // USB HDD\r
-  { 4, 3,     0, 6 },     // USB CD\r
-  { 4, 1,     0, 0 },     // USB ZIP Bugbug since Class/SubClass code is uninitialized\r
-  { 4, 2,     0, 0 }      // USB ZIP Bugbug since Class/SubClass code is uninitialized\r
+EFI_SETUP_BBS_MAP  mSetupBbsMap[] = {\r
+  { 1, 2,    1, 1 },      // ATA HardDrive\r
+  { 2, 3,    1, 1 },      // ATAPI CDROM\r
+  { 3, 0x80, 2, 0 },      // PXE\r
+  { 4, 1,    0, 6 },      // USB Floppy\r
+  { 4, 2,    0, 6 },      // USB HDD\r
+  { 4, 3,    0, 6 },      // USB CD\r
+  { 4, 1,    0, 0 },      // USB ZIP Bugbug since Class/SubClass code is uninitialized\r
+  { 4, 2,    0, 0 }       // USB ZIP Bugbug since Class/SubClass code is uninitialized\r
 };\r
 \r
 //\r
@@ -35,23 +29,23 @@ EFI_SETUP_BBS_MAP mSetupBbsMap[] = {
 #define NULL_ROM_FILE_GUID \\r
 { 0x00000000, 0x0000, 0x0000, { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } }\r
 \r
-SYSTEM_ROM_TABLE mSystemRomTable[] = {\r
-  { SYSTEM_ROM_FILE_GUID,  1 },\r
-  { NULL_ROM_FILE_GUID,    0 }\r
+SYSTEM_ROM_TABLE  mSystemRomTable[] = {\r
+  { SYSTEM_ROM_FILE_GUID, 1 },\r
+  { NULL_ROM_FILE_GUID,   0 }\r
 };\r
 \r
 EFI_HANDLE  mVgaHandles[0x20];\r
 EFI_HANDLE  mDiskHandles[0x20];\r
 EFI_HANDLE  mIsaHandles[0x20];\r
 \r
-EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY IrqPriorityTable[MAX_IRQ_PRIORITY_ENTRIES] = {\r
-  {0x0B,0},\r
-  {0x09,0},\r
-  {0x0A,0},\r
-  {0x05,0},\r
-  {0x07,0},\r
-  {0x00,0},\r
-  {0x00,0}\r
+EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY  IrqPriorityTable[MAX_IRQ_PRIORITY_ENTRIES] = {\r
+  { 0x0B, 0 },\r
+  { 0x09, 0 },\r
+  { 0x0A, 0 },\r
+  { 0x05, 0 },\r
+  { 0x07, 0 },\r
+  { 0x00, 0 },\r
+  { 0x00, 0 }\r
 };\r
 \r
 //\r
@@ -60,18 +54,18 @@ EFI_LEGACY_IRQ_PRIORITY_TABLE_ENTRY IrqPriorityTable[MAX_IRQ_PRIORITY_ENTRIES] =
 //   to check to get bus number.  The Slot number - 1 is an index into a decode\r
 //   table to get the bridge information.\r
 //\r
-EFI_LEGACY_PIRQ_TABLE PirqTableHead = {\r
+EFI_LEGACY_PIRQ_TABLE  PirqTableHead = {\r
   {\r
     EFI_LEGACY_PIRQ_TABLE_SIGNATURE, // UINT32  Signature\r
-    0x00,             // UINT8   MinorVersion\r
-    0x01,             // UINT8   MajorVersion\r
-    0x0000,           // UINT16  TableSize\r
-    0x00,             // UINT8   Bus\r
-    0x08,             // UINT8   DevFun\r
-    0x0000,           // UINT16  PciOnlyIrq\r
-    0x8086,           // UINT16  CompatibleVid\r
-    0x122e,           // UINT16  CompatibleDid\r
-    0x00000000,       // UINT32  Miniport\r
+    0x00,                            // UINT8   MinorVersion\r
+    0x01,                            // UINT8   MajorVersion\r
+    0x0000,                          // UINT16  TableSize\r
+    0x00,                            // UINT8   Bus\r
+    0x08,                            // UINT8   DevFun\r
+    0x0000,                          // UINT16  PciOnlyIrq\r
+    0x8086,                          // UINT16  CompatibleVid\r
+    0x122e,                          // UINT16  CompatibleDid\r
+    0x00000000,                      // UINT32  Miniport\r
     {                 // UINT8   Reserved[11]\r
       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\r
       0x00, 0x00, 0x00\r
@@ -82,17 +76,29 @@ EFI_LEGACY_PIRQ_TABLE PirqTableHead = {
     //           -- Pin 1 --   -- Pin 2 --   -- Pin 3 --   -- Pin 4 --\r
     // Bus  Dev   Reg   Map     Reg   Map     Reg   Map     Reg   Map\r
     //\r
-    {0x00,0x08,{{0x60,0xDEB8},{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8}},0x00,0x00},\r
-    {0x00,0x10,{{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8},{0x60,0xDEB8}},0x01,0x00},\r
-    {0x00,0x18,{{0x62,0xDEB8},{0x63,0xDEB8},{0x60,0xDEB8},{0x61,0xDEB8}},0x02,0x00},\r
-    {0x00,0x20,{{0x63,0xDEB8},{0x60,0xDEB8},{0x61,0xDEB8},{0x62,0xDEB8}},0x03,0x00},\r
-    {0x00,0x28,{{0x60,0xDEB8},{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8}},0x04,0x00},\r
-    {0x00,0x30,{{0x61,0xDEB8},{0x62,0xDEB8},{0x63,0xDEB8},{0x60,0xDEB8}},0x05,0x00},\r
+    { 0x00, 0x08, {\r
+            { 0x60, 0xDEB8 }, { 0x61, 0xDEB8 }, { 0x62, 0xDEB8 }, { 0x63, 0xDEB8 }\r
+          }, 0x00, 0x00 },\r
+    { 0x00, 0x10, {\r
+            { 0x61, 0xDEB8 }, { 0x62, 0xDEB8 }, { 0x63, 0xDEB8 }, { 0x60, 0xDEB8 }\r
+          }, 0x01, 0x00 },\r
+    { 0x00, 0x18, {\r
+            { 0x62, 0xDEB8 }, { 0x63, 0xDEB8 }, { 0x60, 0xDEB8 }, { 0x61, 0xDEB8 }\r
+          }, 0x02, 0x00 },\r
+    { 0x00, 0x20, {\r
+            { 0x63, 0xDEB8 }, { 0x60, 0xDEB8 }, { 0x61, 0xDEB8 }, { 0x62, 0xDEB8 }\r
+          }, 0x03, 0x00 },\r
+    { 0x00, 0x28, {\r
+            { 0x60, 0xDEB8 }, { 0x61, 0xDEB8 }, { 0x62, 0xDEB8 }, { 0x63, 0xDEB8 }\r
+          }, 0x04, 0x00 },\r
+    { 0x00, 0x30, {\r
+            { 0x61, 0xDEB8 }, { 0x62, 0xDEB8 }, { 0x63, 0xDEB8 }, { 0x60, 0xDEB8 }\r
+          }, 0x05, 0x00 },\r
   }\r
 };\r
 \r
-LEGACY_BIOS_PLATFORM_INSTANCE       mPrivateData;\r
-EFI_HANDLE                          mImageHandle = NULL;\r
+LEGACY_BIOS_PLATFORM_INSTANCE  mPrivateData;\r
+EFI_HANDLE                     mImageHandle = NULL;\r
 \r
 /**\r
   Return the handles and assorted information for the specified PCI Class code\r
@@ -108,32 +114,32 @@ EFI_HANDLE                          mImageHandle = NULL;
 **/\r
 EFI_STATUS\r
 FindAllDeviceTypes (\r
-  IN       PCI_CLASS_RECORD      *PciClasses,\r
-  IN OUT   DEVICE_STRUCTURE      *DeviceTable,\r
-  IN OUT   UINT16                *DeviceIndex,\r
-  IN       BOOLEAN               DeviceFlags\r
+  IN       PCI_CLASS_RECORD  *PciClasses,\r
+  IN OUT   DEVICE_STRUCTURE  *DeviceTable,\r
+  IN OUT   UINT16            *DeviceIndex,\r
+  IN       BOOLEAN           DeviceFlags\r
   )\r
 {\r
-  UINTN                       HandleCount;\r
-  EFI_HANDLE                  *HandleBuffer;\r
-  UINTN                       Index;\r
-  UINTN                       StartIndex;\r
-  PCI_TYPE00                  PciConfigHeader;\r
-  EFI_PCI_IO_PROTOCOL         *PciIo;\r
-  EFI_LEGACY_BIOS_PROTOCOL    *LegacyBios;\r
-  UINTN                       Flags;\r
-  EFI_STATUS                  Status;\r
-  UINTN                       Index2;\r
+  UINTN                     HandleCount;\r
+  EFI_HANDLE                *HandleBuffer;\r
+  UINTN                     Index;\r
+  UINTN                     StartIndex;\r
+  PCI_TYPE00                PciConfigHeader;\r
+  EFI_PCI_IO_PROTOCOL       *PciIo;\r
+  EFI_LEGACY_BIOS_PROTOCOL  *LegacyBios;\r
+  UINTN                     Flags;\r
+  EFI_STATUS                Status;\r
+  UINTN                     Index2;\r
 \r
   //\r
   // Get legacy BIOS protocol as it is required to deal with Option ROMs.\r
   //\r
   StartIndex = *DeviceIndex;\r
-  Status = gBS->LocateProtocol (\r
-                  &gEfiLegacyBiosProtocolGuid,\r
-                  NULL,\r
-                  (VOID**)&LegacyBios\r
-                  );\r
+  Status     = gBS->LocateProtocol (\r
+                      &gEfiLegacyBiosProtocolGuid,\r
+                      NULL,\r
+                      (VOID **)&LegacyBios\r
+                      );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
@@ -150,7 +156,7 @@ FindAllDeviceTypes (
     gBS->HandleProtocol (\r
            HandleBuffer[Index],\r
            &gEfiPciIoProtocolGuid,\r
-           (VOID**)&PciIo\r
+           (VOID **)&PciIo\r
            );\r
     PciIo->Pci.Read (\r
                  PciIo,\r
@@ -160,8 +166,9 @@ FindAllDeviceTypes (
                  &PciConfigHeader\r
                  );\r
     for (Index2 = 0; PciClasses[Index2].Class != 0xff; Index2++) {\r
-        if ((PciConfigHeader.Hdr.ClassCode[2] == PciClasses[Index2].Class) &&\r
-            (PciConfigHeader.Hdr.ClassCode[1] == PciClasses[Index2].SubClass)) {\r
+      if ((PciConfigHeader.Hdr.ClassCode[2] == PciClasses[Index2].Class) &&\r
+          (PciConfigHeader.Hdr.ClassCode[1] == PciClasses[Index2].SubClass))\r
+      {\r
         LegacyBios->CheckPciRom (\r
                       LegacyBios,\r
                       HandleBuffer[Index],\r
@@ -179,13 +186,14 @@ FindAllDeviceTypes (
         if (\r
             ((DeviceFlags != 0) && (Flags == NO_ROM)) ||\r
             ((Flags & (ROM_FOUND | VALID_LEGACY_ROM)) == (ROM_FOUND | VALID_LEGACY_ROM))\r
-           ) {\r
+            )\r
+        {\r
           DeviceTable->Handle = HandleBuffer[Index];\r
           DeviceTable->Vid    = PciConfigHeader.Hdr.VendorId;\r
           DeviceTable->Did    = PciConfigHeader.Hdr.DeviceId;\r
           DeviceTable->SvId   = PciConfigHeader.Device.SubsystemVendorID;\r
           DeviceTable->SysId  = PciConfigHeader.Device.SubsystemID;\r
-          ++ *DeviceIndex;\r
+          ++*DeviceIndex;\r
           DeviceTable++;\r
         }\r
       }\r
@@ -217,8 +225,8 @@ FindAllDeviceTypes (
 EFI_STATUS\r
 EFIAPI\r
 SmmInit (\r
-  IN  EFI_LEGACY_BIOS_PLATFORM_PROTOCOL           *This,\r
-  IN  VOID                                        *EfiToLegacy16BootTable\r
+  IN  EFI_LEGACY_BIOS_PLATFORM_PROTOCOL  *This,\r
+  IN  VOID                               *EfiToLegacy16BootTable\r
   )\r
 {\r
   return EFI_SUCCESS;\r
@@ -232,23 +240,23 @@ SmmInit (
 **/\r
 VOID\r
 GetSelectedVgaDeviceInfo (\r
-  OUT EFI_HANDLE                *VgaHandle\r
+  OUT EFI_HANDLE  *VgaHandle\r
   )\r
 {\r
-  EFI_STATUS                Status;\r
-  UINTN                     HandleCount;\r
-  EFI_HANDLE                *HandleBuffer;\r
-  UINTN                     Index;\r
-  EFI_PCI_IO_PROTOCOL       *PciIo;\r
-  PCI_TYPE00                Pci;\r
-  UINT8                     MinBus;\r
-  UINT8                     MaxBus;\r
-  UINTN                     Segment;\r
-  UINTN                     Bus;\r
-  UINTN                     Device;\r
-  UINTN                     Function;\r
-  UINTN                     SelectedAddress;\r
-  UINTN                     CurrentAddress;\r
+  EFI_STATUS           Status;\r
+  UINTN                HandleCount;\r
+  EFI_HANDLE           *HandleBuffer;\r
+  UINTN                Index;\r
+  EFI_PCI_IO_PROTOCOL  *PciIo;\r
+  PCI_TYPE00           Pci;\r
+  UINT8                MinBus;\r
+  UINT8                MaxBus;\r
+  UINTN                Segment;\r
+  UINTN                Bus;\r
+  UINTN                Device;\r
+  UINTN                Function;\r
+  UINTN                SelectedAddress;\r
+  UINTN                CurrentAddress;\r
 \r
   //\r
   // Initialize return to 'not found' state\r
@@ -259,9 +267,9 @@ GetSelectedVgaDeviceInfo (
   // Initialize variable states.  This is important for selecting the VGA\r
   // device if multiple devices exist behind a single bridge.\r
   //\r
-  HandleCount = 0;\r
-  HandleBuffer = NULL;\r
-  SelectedAddress = PCI_LIB_ADDRESS(0xff, 0x1f, 0x7, 0);\r
+  HandleCount     = 0;\r
+  HandleBuffer    = NULL;\r
+  SelectedAddress = PCI_LIB_ADDRESS (0xff, 0x1f, 0x7, 0);\r
 \r
   //\r
   // The bus range to search for a VGA device in.\r
@@ -271,27 +279,27 @@ GetSelectedVgaDeviceInfo (
   //\r
   // Start to check all the pci io to find all possible VGA device\r
   //\r
-  HandleCount = 0;\r
+  HandleCount  = 0;\r
   HandleBuffer = NULL;\r
-  Status = gBS->LocateHandleBuffer (\r
-                  ByProtocol,\r
-                  &gEfiPciIoProtocolGuid,\r
-                  NULL,\r
-                  &HandleCount,\r
-                  &HandleBuffer\r
-                  );\r
+  Status       = gBS->LocateHandleBuffer (\r
+                        ByProtocol,\r
+                        &gEfiPciIoProtocolGuid,\r
+                        NULL,\r
+                        &HandleCount,\r
+                        &HandleBuffer\r
+                        );\r
   if (EFI_ERROR (Status)) {\r
     return;\r
   }\r
 \r
   for (Index = 0; Index < HandleCount; Index++) {\r
-    Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiPciIoProtocolGuid, (VOID**)&PciIo);\r
+    Status = gBS->HandleProtocol (HandleBuffer[Index], &gEfiPciIoProtocolGuid, (VOID **)&PciIo);\r
     if (!EFI_ERROR (Status)) {\r
       //\r
-      // Detemine if this is in the correct bus range.\r
+      // Determine if this is in the correct bus range.\r
       //\r
       Status = PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);\r
-      if (EFI_ERROR(Status) || (Bus < MinBus || Bus > MaxBus)) {\r
+      if (EFI_ERROR (Status) || ((Bus < MinBus) || (Bus > MaxBus))) {\r
         continue;\r
       }\r
 \r
@@ -299,12 +307,12 @@ GetSelectedVgaDeviceInfo (
       // Read device information.\r
       //\r
       Status = PciIo->Pci.Read (\r
-                        PciIo,\r
-                        EfiPciIoWidthUint32,\r
-                        0,\r
-                        sizeof (Pci) / sizeof (UINT32),\r
-                        &Pci\r
-                        );\r
+                            PciIo,\r
+                            EfiPciIoWidthUint32,\r
+                            0,\r
+                            sizeof (Pci) / sizeof (UINT32),\r
+                            &Pci\r
+                            );\r
       if (EFI_ERROR (Status)) {\r
         continue;\r
       }\r
@@ -315,7 +323,9 @@ GetSelectedVgaDeviceInfo (
       if (!IS_PCI_VGA (&Pci)) {\r
         continue;\r
       }\r
-      DEBUG ((EFI_D_INFO,\r
+\r
+      DEBUG ((\r
+        DEBUG_INFO,\r
         "PCI VGA: 0x%04x:0x%04x\n",\r
         Pci.Hdr.VendorId,\r
         Pci.Hdr.DeviceId\r
@@ -325,10 +335,10 @@ GetSelectedVgaDeviceInfo (
       // Currently we use the lowest numbered bus/device/function if multiple\r
       // devices are found in the target bus range.\r
       //\r
-      CurrentAddress = PCI_LIB_ADDRESS(Bus, Device, Function, 0);\r
+      CurrentAddress = PCI_LIB_ADDRESS (Bus, Device, Function, 0);\r
       if (CurrentAddress < SelectedAddress) {\r
         SelectedAddress = CurrentAddress;\r
-        *VgaHandle = HandleBuffer[Index];\r
+        *VgaHandle      = HandleBuffer[Index];\r
       }\r
     }\r
   }\r
@@ -336,7 +346,6 @@ GetSelectedVgaDeviceInfo (
   FreePool (HandleBuffer);\r
 }\r
 \r
-\r
 /**\r
   Returns a buffer of handles for the requested subfunction.\r
 \r
@@ -355,42 +364,42 @@ GetSelectedVgaDeviceInfo (
 EFI_STATUS\r
 EFIAPI\r
 GetPlatformHandle (\r
-  IN  EFI_LEGACY_BIOS_PLATFORM_PROTOCOL           *This,\r
-  IN  EFI_GET_PLATFORM_HANDLE_MODE                Mode,\r
-  IN  UINT16                                      Type,\r
-  OUT EFI_HANDLE                                  **HandleBuffer,\r
-  OUT UINTN                                       *HandleCount,\r
-  OUT VOID                                        **AdditionalData OPTIONAL\r
+  IN  EFI_LEGACY_BIOS_PLATFORM_PROTOCOL  *This,\r
+  IN  EFI_GET_PLATFORM_HANDLE_MODE       Mode,\r
+  IN  UINT16                             Type,\r
+  OUT EFI_HANDLE                         **HandleBuffer,\r
+  OUT UINTN                              *HandleCount,\r
+  OUT VOID                               **AdditionalData OPTIONAL\r
   )\r
 {\r
-  DEVICE_STRUCTURE    LocalDevice[0x40];\r
-  UINT32              LocalIndex;\r
-  UINT32              Index;\r
-  DEVICE_STRUCTURE    TempDevice;\r
-  EFI_STATUS          Status;\r
-  EFI_PCI_IO_PROTOCOL *PciIo;\r
-  UINTN               Segment;\r
-  UINTN               Bus;\r
-  UINTN               Device;\r
-  UINTN               Function;\r
-  HDD_INFO            *HddInfo;\r
-  PCI_TYPE00          PciConfigHeader;\r
-  UINT32              HddIndex;\r
-  EFI_HANDLE          IdeHandle;\r
+  DEVICE_STRUCTURE          LocalDevice[0x40];\r
+  UINT32                    LocalIndex;\r
+  UINT32                    Index;\r
+  DEVICE_STRUCTURE          TempDevice;\r
+  EFI_STATUS                Status;\r
+  EFI_PCI_IO_PROTOCOL       *PciIo;\r
+  UINTN                     Segment;\r
+  UINTN                     Bus;\r
+  UINTN                     Device;\r
+  UINTN                     Function;\r
+  HDD_INFO                  *HddInfo;\r
+  PCI_TYPE00                PciConfigHeader;\r
+  UINT32                    HddIndex;\r
+  EFI_HANDLE                IdeHandle;\r
   EFI_LEGACY_BIOS_PROTOCOL  *LegacyBios;\r
-  PCI_CLASS_RECORD    ClassLists[10];\r
-  UINTN               PriorityIndex;\r
+  PCI_CLASS_RECORD          ClassLists[10];\r
+  UINTN                     PriorityIndex;\r
 \r
-  static BOOLEAN      bConnected = FALSE;\r
+  static BOOLEAN  bConnected = FALSE;\r
 \r
-  LocalIndex  = 0x00;\r
-  HddInfo     = NULL;\r
-  HddIndex    = 0;\r
+  LocalIndex = 0x00;\r
+  HddInfo    = NULL;\r
+  HddIndex   = 0;\r
 \r
   Status = gBS->LocateProtocol (\r
                   &gEfiLegacyBiosProtocolGuid,\r
                   NULL,\r
-                  (VOID**)&LegacyBios\r
+                  (VOID **)&LegacyBios\r
                   );\r
 \r
   //\r
@@ -406,9 +415,9 @@ GetPlatformHandle (
       *HandleCount  = (mVgaHandles[0] != NULL) ? 1 : 0;\r
       return EFI_SUCCESS;\r
     case EfiGetPlatformIdeHandle:\r
-      IdeHandle  = NULL;\r
+      IdeHandle = NULL;\r
       if (AdditionalData != NULL) {\r
-        HddInfo = (HDD_INFO *) *AdditionalData;\r
+        HddInfo = (HDD_INFO *)*AdditionalData;\r
       }\r
 \r
       //\r
@@ -423,7 +432,7 @@ GetPlatformHandle (
       ClassLists[3].Class    = PCI_CLASS_MASS_STORAGE;\r
       ClassLists[3].SubClass = PCI_CLASS_MASS_STORAGE_SATADPA;\r
       ClassLists[4].Class    = 0xff;\r
-      FindAllDeviceTypes (ClassLists, LocalDevice, (UINT16 *) &LocalIndex, TRUE);\r
+      FindAllDeviceTypes (ClassLists, LocalDevice, (UINT16 *)&LocalIndex, TRUE);\r
       if (LocalIndex == 0) {\r
         return EFI_NOT_FOUND;\r
       }\r
@@ -455,10 +464,10 @@ GetPlatformHandle (
       //\r
       PriorityIndex = 0;\r
       for (Index = 0; Index < LocalIndex; Index++) {\r
-        if (LocalDevice[Index].Handle == IdeHandle && PriorityIndex == 0) {\r
-          TempDevice = LocalDevice[PriorityIndex];\r
+        if ((LocalDevice[Index].Handle == IdeHandle) && (PriorityIndex == 0)) {\r
+          TempDevice                 = LocalDevice[PriorityIndex];\r
           LocalDevice[PriorityIndex] = LocalDevice[Index];\r
-          LocalDevice[Index] = TempDevice;\r
+          LocalDevice[Index]         = TempDevice;\r
           PriorityIndex++;\r
           break;\r
         }\r
@@ -470,6 +479,7 @@ GetPlatformHandle (
       for (Index = 0; Index < LocalIndex; Index++) {\r
         mDiskHandles[Index] = LocalDevice[Index].Handle;\r
       }\r
+\r
       *HandleBuffer = &mDiskHandles[0];\r
       *HandleCount  = LocalIndex;\r
 \r
@@ -483,11 +493,12 @@ GetPlatformHandle (
       //\r
       for (Index = 0; (Index < LocalIndex) && (AdditionalData != NULL); Index++) {\r
         if ((LocalDevice[Index].Handle != NULL) &&\r
-            (LocalDevice[Index].Handle == IdeHandle)) {\r
+            (LocalDevice[Index].Handle == IdeHandle))\r
+        {\r
           Status = gBS->HandleProtocol (\r
                           LocalDevice[Index].Handle,\r
                           &gEfiPciIoProtocolGuid,\r
-                          (VOID **) &PciIo\r
+                          (VOID **)&PciIo\r
                           );\r
           PciIo->Pci.Read (\r
                        PciIo,\r
@@ -507,16 +518,16 @@ GetPlatformHandle (
 \r
             //\r
             // Be sure to only fill out correct information based on platform\r
-            // configureation.\r
+            // configuration.\r
             //\r
-            HddInfo[HddIndex].Status        |= HDD_PRIMARY;\r
-            HddInfo[HddIndex].Bus           = (UINT32)Bus;\r
-            HddInfo[HddIndex].Device        = (UINT32)Device;\r
-            HddInfo[HddIndex].Function      = (UINT32)Function;\r
-            HddInfo[HddIndex + 1].Status    |= HDD_SECONDARY;\r
-            HddInfo[HddIndex + 1].Bus       = (UINT32)Bus;\r
-            HddInfo[HddIndex + 1].Device    = (UINT32)Device;\r
-            HddInfo[HddIndex + 1].Function  = (UINT32)Function;\r
+            HddInfo[HddIndex].Status      |= HDD_PRIMARY;\r
+            HddInfo[HddIndex].Bus          = (UINT32)Bus;\r
+            HddInfo[HddIndex].Device       = (UINT32)Device;\r
+            HddInfo[HddIndex].Function     = (UINT32)Function;\r
+            HddInfo[HddIndex + 1].Status  |= HDD_SECONDARY;\r
+            HddInfo[HddIndex + 1].Bus      = (UINT32)Bus;\r
+            HddInfo[HddIndex + 1].Device   = (UINT32)Device;\r
+            HddInfo[HddIndex + 1].Function = (UINT32)Function;\r
 \r
             //\r
             // Primary controller data\r
@@ -530,11 +541,12 @@ GetPlatformHandle (
                 (UINT16)(PciConfigHeader.Device.Bar[4] & 0xfffc);\r
               HddInfo[HddIndex].HddIrq = PciConfigHeader.Device.InterruptLine;\r
             } else {\r
-              HddInfo[HddIndex].HddIrq = 14;\r
+              HddInfo[HddIndex].HddIrq             = 14;\r
               HddInfo[HddIndex].CommandBaseAddress = 0x1f0;\r
               HddInfo[HddIndex].ControlBaseAddress = 0x3f6;\r
-              HddInfo[HddIndex].BusMasterAddress = 0;\r
+              HddInfo[HddIndex].BusMasterAddress   = 0;\r
             }\r
+\r
             HddIndex++;\r
 \r
             //\r
@@ -549,27 +561,29 @@ GetPlatformHandle (
                 (UINT16)(HddInfo[HddIndex].BusMasterAddress + 8);\r
               HddInfo[HddIndex].HddIrq = PciConfigHeader.Device.InterruptLine;\r
             } else {\r
-              HddInfo[HddIndex].HddIrq = 15;\r
+              HddInfo[HddIndex].HddIrq             = 15;\r
               HddInfo[HddIndex].CommandBaseAddress = 0x170;\r
               HddInfo[HddIndex].ControlBaseAddress = 0x376;\r
-              HddInfo[HddIndex].BusMasterAddress = 0;\r
+              HddInfo[HddIndex].BusMasterAddress   = 0;\r
             }\r
+\r
             HddIndex++;\r
           }\r
         }\r
       }\r
+\r
       return EFI_SUCCESS;\r
     case EfiGetPlatformIsaBusHandle:\r
-      ClassLists[0].Class    = (UINT8) PCI_CLASS_BRIDGE;\r
-      ClassLists[0].SubClass = (UINT8) PCI_CLASS_BRIDGE_ISA_PDECODE;\r
-      ClassLists[1].Class    = (UINT8) PCI_CLASS_BRIDGE;\r
-      ClassLists[1].SubClass = (UINT8) PCI_CLASS_BRIDGE_ISA;\r
+      ClassLists[0].Class    = (UINT8)PCI_CLASS_BRIDGE;\r
+      ClassLists[0].SubClass = (UINT8)PCI_CLASS_BRIDGE_ISA_PDECODE;\r
+      ClassLists[1].Class    = (UINT8)PCI_CLASS_BRIDGE;\r
+      ClassLists[1].SubClass = (UINT8)PCI_CLASS_BRIDGE_ISA;\r
       ClassLists[2].Class    = 0xff;\r
 \r
       //\r
       // Locate all found block io devices\r
       //\r
-      FindAllDeviceTypes (ClassLists, LocalDevice, (UINT16 *) (&LocalIndex), TRUE);\r
+      FindAllDeviceTypes (ClassLists, LocalDevice, (UINT16 *)(&LocalIndex), TRUE);\r
       if (LocalIndex == 0) {\r
         return EFI_NOT_FOUND;\r
       }\r
@@ -579,9 +593,9 @@ GetPlatformHandle (
       //\r
       for (Index = 0; Index < LocalIndex; Index++) {\r
         if (LocalDevice[Index].Vid == V_INTEL_VENDOR_ID) {\r
-          TempDevice          = LocalDevice[0];\r
-          LocalDevice[0]      = LocalDevice[Index];\r
-          LocalDevice[Index]  = TempDevice;\r
+          TempDevice         = LocalDevice[0];\r
+          LocalDevice[0]     = LocalDevice[Index];\r
+          LocalDevice[Index] = TempDevice;\r
         }\r
       }\r
 \r
@@ -591,13 +605,14 @@ GetPlatformHandle (
       for (Index = 0; Index < LocalIndex; Index++) {\r
         mIsaHandles[Index] = LocalDevice[Index].Handle;\r
       }\r
+\r
       *HandleBuffer = &mIsaHandles[0];\r
       *HandleCount  = LocalIndex;\r
       return EFI_SUCCESS;\r
     case EfiGetPlatformUsbHandle:\r
     default:\r
       return EFI_UNSUPPORTED;\r
-  };\r
+  }\r
 }\r
 \r
 /**\r
@@ -619,13 +634,13 @@ GetPlatformHandle (
 EFI_STATUS\r
 EFIAPI\r
 PlatformHooks (\r
-  IN       EFI_LEGACY_BIOS_PLATFORM_PROTOCOL     *This,\r
-  IN       EFI_GET_PLATFORM_HOOK_MODE            Mode,\r
-  IN       UINT16                                Type,\r
-     OUT   EFI_HANDLE                            DeviceHandle, OPTIONAL\r
-  IN OUT   UINTN                                 *Shadowaddress, OPTIONAL\r
-  IN       EFI_COMPATIBILITY16_TABLE             *Compatibility16Table, OPTIONAL\r
-     OUT   VOID                                  **AdditionalData OPTIONAL\r
+  IN       EFI_LEGACY_BIOS_PLATFORM_PROTOCOL  *This,\r
+  IN       EFI_GET_PLATFORM_HOOK_MODE         Mode,\r
+  IN       UINT16                             Type,\r
+  OUT   EFI_HANDLE                            DeviceHandle  OPTIONAL,\r
+  IN OUT   UINTN                              *Shadowaddress  OPTIONAL,\r
+  IN       EFI_COMPATIBILITY16_TABLE          *Compatibility16Table  OPTIONAL,\r
+  OUT   VOID                                  **AdditionalData OPTIONAL\r
   )\r
 {\r
   EFI_IA32_REGISTER_SET     Regs;\r
@@ -637,7 +652,7 @@ PlatformHooks (
       Status = gBS->LocateProtocol (\r
                       &gEfiLegacyBiosProtocolGuid,\r
                       NULL,\r
-                      (VOID**)&LegacyBios\r
+                      (VOID **)&LegacyBios\r
                       );\r
 \r
       //\r
@@ -645,14 +660,14 @@ PlatformHooks (
       //\r
       Regs.H.AH = 0x00;\r
       Regs.H.AL = 0x03;\r
-      Status = LegacyBios->Int86 (LegacyBios, 0x10, &Regs);\r
+      Status    = LegacyBios->Int86 (LegacyBios, 0x10, &Regs);\r
       return Status;\r
     case EfiPlatformHookShadowServiceRoms:\r
       return EFI_SUCCESS;\r
     case EfiPlatformHookAfterRomInit:\r
     default:\r
       return EFI_UNSUPPORTED;\r
-  };\r
+  }\r
 }\r
 \r
 /**\r
@@ -677,24 +692,24 @@ PlatformHooks (
 EFI_STATUS\r
 EFIAPI\r
 GetRoutingTable (\r
-  IN  EFI_LEGACY_BIOS_PLATFORM_PROTOCOL           *This,\r
-  OUT VOID                                        **RoutingTable,\r
-  OUT UINTN                                       *RoutingTableEntries,\r
-  OUT VOID                                        **LocalPirqTable, OPTIONAL\r
-  OUT UINTN                                       *PirqTableSize, OPTIONAL\r
-  OUT VOID                                        **LocalIrqPriorityTable, OPTIONAL\r
-  OUT UINTN                                       *IrqPriorityTableEntries OPTIONAL\r
+  IN  EFI_LEGACY_BIOS_PLATFORM_PROTOCOL  *This,\r
+  OUT VOID                               **RoutingTable,\r
+  OUT UINTN                              *RoutingTableEntries,\r
+  OUT VOID                               **LocalPirqTable  OPTIONAL,\r
+  OUT UINTN                              *PirqTableSize  OPTIONAL,\r
+  OUT VOID                               **LocalIrqPriorityTable  OPTIONAL,\r
+  OUT UINTN                              *IrqPriorityTableEntries OPTIONAL\r
   )\r
 {\r
-  UINT16                        PTableSize;\r
-  UINT32                        Index;\r
-  UINT8                         Bus;\r
-  UINT8                         Device;\r
-  UINT8                         Function;\r
-  UINT8                         Checksum;\r
-  UINT8                         *Ptr;\r
-  EFI_STATUS                    Status;\r
-  EFI_LEGACY_INTERRUPT_PROTOCOL *LegacyInterrupt;\r
+  UINT16                         PTableSize;\r
+  UINT32                         Index;\r
+  UINT8                          Bus;\r
+  UINT8                          Device;\r
+  UINT8                          Function;\r
+  UINT8                          Checksum;\r
+  UINT8                          *Ptr;\r
+  EFI_STATUS                     Status;\r
+  EFI_LEGACY_INTERRUPT_PROTOCOL  *LegacyInterrupt;\r
 \r
   Checksum = 0;\r
 \r
@@ -705,7 +720,7 @@ GetRoutingTable (
     Status = gBS->LocateProtocol (\r
                     &gEfiLegacyInterruptProtocolGuid,\r
                     NULL,\r
-                    (VOID**)&LegacyInterrupt\r
+                    (VOID **)&LegacyInterrupt\r
                     );\r
     ASSERT_EFI_ERROR (Status);\r
     LegacyInterrupt->GetLocation (\r
@@ -720,34 +735,35 @@ GetRoutingTable (
     //\r
     PirqTableHead.PirqTable.TableSize = PTableSize;\r
     PirqTableHead.PirqTable.Bus       = Bus;\r
-    PirqTableHead.PirqTable.DevFun    = (UINT8) ((Device << 3) + Function);\r
-    Ptr = (UINT8 *) (&PirqTableHead);\r
+    PirqTableHead.PirqTable.DevFun    = (UINT8)((Device << 3) + Function);\r
+    Ptr                               = (UINT8 *)(&PirqTableHead);\r
 \r
     //\r
     // Calculate checksum.\r
     //\r
     for (Index = 0; Index < PTableSize; Index++) {\r
-      Checksum = (UINT8) (Checksum + (UINT8) *Ptr);\r
-      Ptr += 1;\r
+      Checksum = (UINT8)(Checksum + (UINT8)*Ptr);\r
+      Ptr     += 1;\r
     }\r
-    Checksum                          = (UINT8) (0x00 - Checksum);\r
-    PirqTableHead.PirqTable.Checksum  = Checksum;\r
+\r
+    Checksum                         = (UINT8)(0x00 - Checksum);\r
+    PirqTableHead.PirqTable.Checksum = Checksum;\r
 \r
     //\r
     // Update return values.\r
     //\r
-    *LocalPirqTable                   = (VOID *) (&PirqTableHead);\r
-    *PirqTableSize                    = PTableSize;\r
+    *LocalPirqTable = (VOID *)(&PirqTableHead);\r
+    *PirqTableSize  = PTableSize;\r
   }\r
 \r
   //\r
   // More items to return.\r
   //\r
-  *RoutingTable         = PirqTableHead.IrqRoutingEntry;\r
-  *RoutingTableEntries  = MAX_IRQ_ROUTING_ENTRIES;\r
+  *RoutingTable        = PirqTableHead.IrqRoutingEntry;\r
+  *RoutingTableEntries = MAX_IRQ_ROUTING_ENTRIES;\r
   if (LocalIrqPriorityTable != NULL) {\r
-    *LocalIrqPriorityTable    = IrqPriorityTable;\r
-    *IrqPriorityTableEntries  = MAX_IRQ_PRIORITY_ENTRIES;\r
+    *LocalIrqPriorityTable   = IrqPriorityTable;\r
+    *IrqPriorityTableEntries = MAX_IRQ_PRIORITY_ENTRIES;\r
   }\r
 \r
   return EFI_SUCCESS;\r
@@ -773,18 +789,18 @@ GetRoutingTable (
 EFI_STATUS\r
 EFIAPI\r
 GetPlatformInfo (\r
-  IN  EFI_LEGACY_BIOS_PLATFORM_PROTOCOL           *This,\r
-  IN  EFI_GET_PLATFORM_INFO_MODE                  Mode,\r
-  OUT VOID                                        **Table,\r
-  OUT UINTN                                       *TableSize,\r
-  OUT UINTN                                       *Location,\r
-  OUT UINTN                                       *Alignment,\r
-  IN  UINT16                                      LegacySegment,\r
-  IN  UINT16                                      LegacyOffset\r
+  IN  EFI_LEGACY_BIOS_PLATFORM_PROTOCOL  *This,\r
+  IN  EFI_GET_PLATFORM_INFO_MODE         Mode,\r
+  OUT VOID                               **Table,\r
+  OUT UINTN                              *TableSize,\r
+  OUT UINTN                              *Location,\r
+  OUT UINTN                              *Alignment,\r
+  IN  UINT16                             LegacySegment,\r
+  IN  UINT16                             LegacyOffset\r
   )\r
 {\r
-  EFI_STATUS                    Status;\r
-  UINTN                         Index;\r
+  EFI_STATUS  Status;\r
+  UINTN       Index;\r
 \r
   switch (Mode) {\r
     case EfiGetPlatformBinarySystemRom:\r
@@ -797,11 +813,12 @@ GetPlatformInfo (
                    EFI_SECTION_RAW,\r
                    0,\r
                    Table,\r
-                   (UINTN *) TableSize\r
+                   (UINTN *)TableSize\r
                    );\r
         if (EFI_ERROR (Status)) {\r
           continue;\r
         }\r
+\r
         return EFI_SUCCESS;\r
       }\r
 \r
@@ -814,7 +831,7 @@ GetPlatformInfo (
     case EfiGetPlatformPciExpressBase:\r
     default:\r
       return EFI_UNSUPPORTED;\r
-  };\r
+  }\r
 }\r
 \r
 /**\r
@@ -836,34 +853,35 @@ GetPlatformInfo (
 EFI_STATUS\r
 EFIAPI\r
 TranslatePirq (\r
-  IN        EFI_LEGACY_BIOS_PLATFORM_PROTOCOL           *This,\r
-  IN        UINTN                                       PciBus,\r
-  IN        UINTN                                       PciDevice,\r
-  IN        UINTN                                       PciFunction,\r
-  IN  OUT   UINT8                                       *Pirq,\r
-      OUT   UINT8                                       *PciIrq\r
+  IN        EFI_LEGACY_BIOS_PLATFORM_PROTOCOL  *This,\r
+  IN        UINTN                              PciBus,\r
+  IN        UINTN                              PciDevice,\r
+  IN        UINTN                              PciFunction,\r
+  IN  OUT   UINT8                              *Pirq,\r
+  OUT   UINT8                                  *PciIrq\r
   )\r
 {\r
-  EFI_LEGACY_INTERRUPT_PROTOCOL      *LegacyInterrupt;\r
-  EFI_STATUS                         Status;\r
-  UINTN                              Index;\r
-  UINTN                              Index1;\r
-  UINT8                              LocalPirq;\r
-  UINT8                              PirqData;\r
-  UINT8                              MatchData;\r
+  EFI_LEGACY_INTERRUPT_PROTOCOL  *LegacyInterrupt;\r
+  EFI_STATUS                     Status;\r
+  UINTN                          Index;\r
+  UINTN                          Index1;\r
+  UINT8                          LocalPirq;\r
+  UINT8                          PirqData;\r
+  UINT8                          MatchData;\r
 \r
   Status = gBS->LocateProtocol (\r
                   &gEfiLegacyInterruptProtocolGuid,\r
                   NULL,\r
-                  (VOID**)&LegacyInterrupt\r
+                  (VOID **)&LegacyInterrupt\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
-  LocalPirq = (UINT8) (*Pirq);\r
+  LocalPirq = (UINT8)(*Pirq);\r
 \r
   for (Index = 0; Index < MAX_IRQ_ROUTING_ENTRIES; Index++) {\r
     if ((PirqTableHead.IrqRoutingEntry[Index].Bus == PciBus) &&\r
-        (PirqTableHead.IrqRoutingEntry[Index].Device == PciDevice)) {\r
-      LocalPirq = (UINT8) (PirqTableHead.IrqRoutingEntry[Index].PirqEntry[LocalPirq].Pirq & 0x0f);\r
+        (PirqTableHead.IrqRoutingEntry[Index].Device == PciDevice))\r
+    {\r
+      LocalPirq = (UINT8)(PirqTableHead.IrqRoutingEntry[Index].PirqEntry[LocalPirq].Pirq & 0x0f);\r
       if (LocalPirq > 4) {\r
         LocalPirq -= 4;\r
       }\r
@@ -873,8 +891,9 @@ TranslatePirq (
       while (PirqData == 0) {\r
         for (Index1 = 0; Index1 < MAX_IRQ_PRIORITY_ENTRIES; Index1++) {\r
           if ((IrqPriorityTable[Index1].Used == MatchData) &&\r
-              (IrqPriorityTable[Index1].Irq != 0)) {\r
-            PirqData = IrqPriorityTable[Index1].Irq;\r
+              (IrqPriorityTable[Index1].Irq != 0))\r
+          {\r
+            PirqData                      = IrqPriorityTable[Index1].Irq;\r
             IrqPriorityTable[Index1].Used = 0xff;\r
             LegacyInterrupt->WritePirq (\r
                                LegacyInterrupt,\r
@@ -886,11 +905,10 @@ TranslatePirq (
         }\r
 \r
         if (PirqData == 0) {\r
-\r
           //\r
-          // No unused interrpts, so start reusing them.\r
+          // No unused interrupts, so start reusing them.\r
           //\r
-          MatchData = (UINT8) (~MatchData);\r
+          MatchData = (UINT8)(~MatchData);\r
         }\r
       }\r
 \r
@@ -902,7 +920,6 @@ TranslatePirq (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
   Attempt to legacy boot the BootOption. If the EFI contexted has been\r
   compromised this function will not return.\r
@@ -920,26 +937,26 @@ TranslatePirq (
 EFI_STATUS\r
 EFIAPI\r
 PrepareToBoot (\r
-  IN  EFI_LEGACY_BIOS_PLATFORM_PROTOCOL           *This,\r
-  IN  BBS_BBS_DEVICE_PATH                         *BbsDevicePath,\r
-  IN  VOID                                        *BbsTable,\r
-  IN  UINT32                                      LoadOptionsSize,\r
-  IN  VOID                                        *LoadOptions,\r
-  IN  VOID                                        *EfiToLegacy16BootTable\r
+  IN  EFI_LEGACY_BIOS_PLATFORM_PROTOCOL  *This,\r
+  IN  BBS_BBS_DEVICE_PATH                *BbsDevicePath,\r
+  IN  VOID                               *BbsTable,\r
+  IN  UINT32                             LoadOptionsSize,\r
+  IN  VOID                               *LoadOptions,\r
+  IN  VOID                               *EfiToLegacy16BootTable\r
   )\r
 {\r
-  BBS_TABLE                           *LocalBbsTable;\r
-  EFI_TO_COMPATIBILITY16_BOOT_TABLE   *Legacy16BootTable;\r
-  DEVICE_PRODUCER_DATA_HEADER         *SioPtr;\r
-  UINT16                              DevicePathType;\r
-  UINT16                              Index;\r
-  UINT16                              Priority;\r
+  BBS_TABLE                          *LocalBbsTable;\r
+  EFI_TO_COMPATIBILITY16_BOOT_TABLE  *Legacy16BootTable;\r
+  DEVICE_PRODUCER_DATA_HEADER        *SioPtr;\r
+  UINT16                             DevicePathType;\r
+  UINT16                             Index;\r
+  UINT16                             Priority;\r
 \r
   //\r
   // Initialize values\r
   //\r
-  Priority = 0;\r
-  Legacy16BootTable = (EFI_TO_COMPATIBILITY16_BOOT_TABLE*) EfiToLegacy16BootTable;\r
+  Priority          = 0;\r
+  Legacy16BootTable = (EFI_TO_COMPATIBILITY16_BOOT_TABLE *)EfiToLegacy16BootTable;\r
 \r
   //\r
   // Set how Gate A20 is gated by hardware\r
@@ -949,7 +966,7 @@ PrepareToBoot (
   SioPtr->Flags.A20Port90 = 1;\r
   SioPtr->MousePresent    = 1;\r
 \r
-  LocalBbsTable           = BbsTable;\r
+  LocalBbsTable = BbsTable;\r
 \r
   //\r
   // There are 2 cases that must be covered.\r
@@ -972,8 +989,9 @@ PrepareToBoot (
     if ((LocalBbsTable[Index].BootPriority != BBS_UNPRIORITIZED_ENTRY) &&\r
         (LocalBbsTable[Index].BootPriority != BBS_IGNORE_ENTRY) &&\r
         (LocalBbsTable[Index].BootPriority != BBS_LOWEST_PRIORITY) &&\r
-        (Priority <= LocalBbsTable[Index].BootPriority)) {\r
-      Priority = (UINT16) (LocalBbsTable[Index].BootPriority + 1);\r
+        (Priority <= LocalBbsTable[Index].BootPriority))\r
+    {\r
+      Priority = (UINT16)(LocalBbsTable[Index].BootPriority + 1);\r
     }\r
   }\r
 \r
@@ -984,28 +1002,32 @@ PrepareToBoot (
     case BBS_EMBED_NETWORK:\r
       for (Index = 0; Index < Legacy16BootTable->NumberBbsEntries; Index++) {\r
         if ((LocalBbsTable[Index].BootPriority == BBS_UNPRIORITIZED_ENTRY) &&\r
-            (LocalBbsTable[Index].DeviceType == DevicePathType)) {\r
+            (LocalBbsTable[Index].DeviceType == DevicePathType))\r
+        {\r
           LocalBbsTable[Index].BootPriority = Priority;\r
           ++Priority;\r
         }\r
       }\r
+\r
       break;\r
     case BBS_BEV_DEVICE:\r
       for (Index = 0; Index < Legacy16BootTable->NumberBbsEntries; Index++) {\r
         if ((LocalBbsTable[Index].BootPriority == BBS_UNPRIORITIZED_ENTRY) &&\r
             (LocalBbsTable[Index].Class == 01) &&\r
-            (LocalBbsTable[Index].SubClass == 01)) {\r
+            (LocalBbsTable[Index].SubClass == 01))\r
+        {\r
           LocalBbsTable[Index].BootPriority = Priority;\r
           ++Priority;\r
         }\r
       }\r
+\r
       break;\r
     case BBS_USB:\r
     case BBS_PCMCIA:\r
     case BBS_UNKNOWN:\r
     default:\r
       break;\r
-  };\r
+  }\r
 \r
   //\r
   // Set priority for rest of devices\r
@@ -1020,7 +1042,6 @@ PrepareToBoot (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
   Initialize Legacy Platform support\r
 \r
@@ -1032,16 +1053,16 @@ LegacyBiosPlatformInstall (
   VOID\r
   )\r
 {\r
-  EFI_STATUS                           Status;\r
-  LEGACY_BIOS_PLATFORM_INSTANCE        *Private;\r
+  EFI_STATUS                     Status;\r
+  LEGACY_BIOS_PLATFORM_INSTANCE  *Private;\r
 \r
   mImageHandle = gImageHandle;\r
-  Private = &mPrivateData;\r
+  Private      = &mPrivateData;\r
 \r
   //\r
   // Grab a copy of all the protocols we depend on.\r
   //\r
-  Private->Signature = LEGACY_BIOS_PLATFORM_INSTANCE_SIGNATURE;\r
+  Private->Signature                            = LEGACY_BIOS_PLATFORM_INSTANCE_SIGNATURE;\r
   Private->LegacyBiosPlatform.GetPlatformInfo   = GetPlatformInfo;\r
   Private->LegacyBiosPlatform.GetPlatformHandle = GetPlatformHandle;\r
   Private->LegacyBiosPlatform.SmmInit           = SmmInit;\r
@@ -1049,18 +1070,17 @@ LegacyBiosPlatformInstall (
   Private->LegacyBiosPlatform.GetRoutingTable   = GetRoutingTable;\r
   Private->LegacyBiosPlatform.TranslatePirq     = TranslatePirq;\r
   Private->LegacyBiosPlatform.PrepareToBoot     = PrepareToBoot;\r
-  Private->ImageHandle = gImageHandle;\r
+  Private->ImageHandle                          = gImageHandle;\r
 \r
   //\r
   // Make a new handle and install the protocol\r
   //\r
   Private->Handle = NULL;\r
-  Status = gBS->InstallProtocolInterface (\r
-                  &Private->Handle,\r
-                  &gEfiLegacyBiosPlatformProtocolGuid,\r
-                  EFI_NATIVE_INTERFACE,\r
-                  &Private->LegacyBiosPlatform\r
-                  );\r
+  Status          = gBS->InstallProtocolInterface (\r
+                           &Private->Handle,\r
+                           &gEfiLegacyBiosPlatformProtocolGuid,\r
+                           EFI_NATIVE_INTERFACE,\r
+                           &Private->LegacyBiosPlatform\r
+                           );\r
   return Status;\r
 }\r
-\r