]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Library/PlatformBootManagerLibBhyve/BdsPlatform.c
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / Library / PlatformBootManagerLibBhyve / BdsPlatform.c
index 32b70a46d007620a2a2c1d91b89dbbbdb7c76ee5..119f24b33016837aa42f0bd32d6aa9c638260ca8 100644 (file)
 // Global data\r
 //\r
 \r
-VOID          *mEfiDevPathNotifyReg;\r
-EFI_EVENT     mEfiDevPathEvent;\r
-VOID          *mEmuVariableEventReg;\r
-EFI_EVENT     mEmuVariableEvent;\r
-UINT16        mHostBridgeDevId;\r
+VOID       *mEfiDevPathNotifyReg;\r
+EFI_EVENT  mEfiDevPathEvent;\r
+VOID       *mEmuVariableEventReg;\r
+EFI_EVENT  mEmuVariableEvent;\r
+UINT16     mHostBridgeDevId;\r
 \r
 //\r
 // Table of host IRQs matching PCI IRQs A-D\r
 // (for configuring PCI Interrupt Line register)\r
 //\r
-CONST UINT8 PciHostIrqs[] = {\r
+CONST UINT8  PciHostIrqs[] = {\r
   0x0a, 0x0a, 0x0b, 0x0b\r
 };\r
 \r
@@ -58,7 +58,6 @@ EFI_STATUS
   IN PCI_TYPE00           *Pci\r
   );\r
 \r
-\r
 //\r
 // Function prototypes\r
 //\r
@@ -72,7 +71,7 @@ VisitAllInstancesOfProtocol (
 \r
 EFI_STATUS\r
 VisitAllPciInstancesOfProtocol (\r
-  IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction\r
+  IN VISIT_PCI_INSTANCE_CALLBACK  CallBackFunction\r
   );\r
 \r
 VOID\r
@@ -82,24 +81,24 @@ InstallDevicePathCallback (
 \r
 VOID\r
 PlatformRegisterFvBootOption (\r
-  EFI_GUID                         *FileGuid,\r
-  CHAR16                           *Description,\r
-  UINT32                           Attributes\r
+  EFI_GUID  *FileGuid,\r
+  CHAR16    *Description,\r
+  UINT32    Attributes\r
   )\r
 {\r
-  EFI_STATUS                        Status;\r
-  INTN                              OptionIndex;\r
-  EFI_BOOT_MANAGER_LOAD_OPTION      NewOption;\r
-  EFI_BOOT_MANAGER_LOAD_OPTION      *BootOptions;\r
-  UINTN                             BootOptionCount;\r
-  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;\r
-  EFI_LOADED_IMAGE_PROTOCOL         *LoadedImage;\r
-  EFI_DEVICE_PATH_PROTOCOL          *DevicePath;\r
+  EFI_STATUS                         Status;\r
+  INTN                               OptionIndex;\r
+  EFI_BOOT_MANAGER_LOAD_OPTION       NewOption;\r
+  EFI_BOOT_MANAGER_LOAD_OPTION       *BootOptions;\r
+  UINTN                              BootOptionCount;\r
+  MEDIA_FW_VOL_FILEPATH_DEVICE_PATH  FileNode;\r
+  EFI_LOADED_IMAGE_PROTOCOL          *LoadedImage;\r
+  EFI_DEVICE_PATH_PROTOCOL           *DevicePath;\r
 \r
   Status = gBS->HandleProtocol (\r
                   gImageHandle,\r
                   &gEfiLoadedImageProtocolGuid,\r
-                  (VOID **) &LoadedImage\r
+                  (VOID **)&LoadedImage\r
                   );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
@@ -108,7 +107,7 @@ PlatformRegisterFvBootOption (
   ASSERT (DevicePath != NULL);\r
   DevicePath = AppendDevicePathNode (\r
                  DevicePath,\r
-                 (EFI_DEVICE_PATH_PROTOCOL *) &FileNode\r
+                 (EFI_DEVICE_PATH_PROTOCOL *)&FileNode\r
                  );\r
   ASSERT (DevicePath != NULL);\r
 \r
@@ -126,17 +125,21 @@ PlatformRegisterFvBootOption (
   FreePool (DevicePath);\r
 \r
   BootOptions = EfiBootManagerGetLoadOptions (\r
-                  &BootOptionCount, LoadOptionTypeBoot\r
+                  &BootOptionCount,\r
+                  LoadOptionTypeBoot\r
                   );\r
 \r
   OptionIndex = EfiBootManagerFindLoadOption (\r
-                  &NewOption, BootOptions, BootOptionCount\r
+                  &NewOption,\r
+                  BootOptions,\r
+                  BootOptionCount\r
                   );\r
 \r
   if (OptionIndex == -1) {\r
     Status = EfiBootManagerAddLoadOptionVariable (&NewOption, MAX_UINTN);\r
     ASSERT_EFI_ERROR (Status);\r
   }\r
+\r
   EfiBootManagerFreeLoadOption (&NewOption);\r
   EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);\r
 }\r
@@ -160,27 +163,30 @@ RemoveStaleFvFileOptions (
   VOID\r
   )\r
 {\r
-  EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;\r
-  UINTN                        BootOptionCount;\r
-  UINTN                        Index;\r
+  EFI_BOOT_MANAGER_LOAD_OPTION  *BootOptions;\r
+  UINTN                         BootOptionCount;\r
+  UINTN                         Index;\r
 \r
-  BootOptions = EfiBootManagerGetLoadOptions (&BootOptionCount,\r
-                  LoadOptionTypeBoot);\r
+  BootOptions = EfiBootManagerGetLoadOptions (\r
+                  &BootOptionCount,\r
+                  LoadOptionTypeBoot\r
+                  );\r
 \r
   for (Index = 0; Index < BootOptionCount; ++Index) {\r
-    EFI_DEVICE_PATH_PROTOCOL *Node1, *Node2, *SearchNode;\r
-    EFI_STATUS               Status;\r
-    EFI_HANDLE               FvHandle;\r
+    EFI_DEVICE_PATH_PROTOCOL  *Node1, *Node2, *SearchNode;\r
+    EFI_STATUS                Status;\r
+    EFI_HANDLE                FvHandle;\r
 \r
     //\r
     // If the device path starts with neither MemoryMapped(...) nor Fv(...),\r
     // then keep the boot option.\r
     //\r
     Node1 = BootOptions[Index].FilePath;\r
-    if (!(DevicePathType (Node1) == HARDWARE_DEVICE_PATH &&\r
-          DevicePathSubType (Node1) == HW_MEMMAP_DP) &&\r
-        !(DevicePathType (Node1) == MEDIA_DEVICE_PATH &&\r
-          DevicePathSubType (Node1) == MEDIA_PIWG_FW_VOL_DP)) {\r
+    if (!((DevicePathType (Node1) == HARDWARE_DEVICE_PATH) &&\r
+          (DevicePathSubType (Node1) == HW_MEMMAP_DP)) &&\r
+        !((DevicePathType (Node1) == MEDIA_DEVICE_PATH) &&\r
+          (DevicePathSubType (Node1) == MEDIA_PIWG_FW_VOL_DP)))\r
+    {\r
       continue;\r
     }\r
 \r
@@ -189,8 +195,9 @@ RemoveStaleFvFileOptions (
     // option.\r
     //\r
     Node2 = NextDevicePathNode (Node1);\r
-    if (DevicePathType (Node2) != MEDIA_DEVICE_PATH ||\r
-        DevicePathSubType (Node2) != MEDIA_PIWG_FW_FILE_DP) {\r
+    if ((DevicePathType (Node2) != MEDIA_DEVICE_PATH) ||\r
+        (DevicePathSubType (Node2) != MEDIA_PIWG_FW_FILE_DP))\r
+    {\r
       continue;\r
     }\r
 \r
@@ -201,23 +208,29 @@ RemoveStaleFvFileOptions (
     // boot option.\r
     //\r
     SearchNode = Node1;\r
-    Status = gBS->LocateDevicePath (&gEfiFirmwareVolume2ProtocolGuid,\r
-                    &SearchNode, &FvHandle);\r
+    Status     = gBS->LocateDevicePath (\r
+                        &gEfiFirmwareVolume2ProtocolGuid,\r
+                        &SearchNode,\r
+                        &FvHandle\r
+                        );\r
 \r
     if (!EFI_ERROR (Status)) {\r
       //\r
       // The firmware volume was found; now let's see if it contains the FvFile\r
       // identified by GUID.\r
       //\r
-      EFI_FIRMWARE_VOLUME2_PROTOCOL     *FvProtocol;\r
-      MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *FvFileNode;\r
-      UINTN                             BufferSize;\r
-      EFI_FV_FILETYPE                   FoundType;\r
-      EFI_FV_FILE_ATTRIBUTES            FileAttributes;\r
-      UINT32                            AuthenticationStatus;\r
-\r
-      Status = gBS->HandleProtocol (FvHandle, &gEfiFirmwareVolume2ProtocolGuid,\r
-                      (VOID **)&FvProtocol);\r
+      EFI_FIRMWARE_VOLUME2_PROTOCOL      *FvProtocol;\r
+      MEDIA_FW_VOL_FILEPATH_DEVICE_PATH  *FvFileNode;\r
+      UINTN                              BufferSize;\r
+      EFI_FV_FILETYPE                    FoundType;\r
+      EFI_FV_FILE_ATTRIBUTES             FileAttributes;\r
+      UINT32                             AuthenticationStatus;\r
+\r
+      Status = gBS->HandleProtocol (\r
+                      FvHandle,\r
+                      &gEfiFirmwareVolume2ProtocolGuid,\r
+                      (VOID **)&FvProtocol\r
+                      );\r
       ASSERT_EFI_ERROR (Status);\r
 \r
       FvFileNode = (MEDIA_FW_VOL_FILEPATH_DEVICE_PATH *)Node2;\r
@@ -246,23 +259,29 @@ RemoveStaleFvFileOptions (
     // Delete the boot option.\r
     //\r
     Status = EfiBootManagerDeleteLoadOptionVariable (\r
-               BootOptions[Index].OptionNumber, LoadOptionTypeBoot);\r
+               BootOptions[Index].OptionNumber,\r
+               LoadOptionTypeBoot\r
+               );\r
     DEBUG_CODE_BEGIN ();\r
-      CHAR16 *DevicePathString;\r
+    CHAR16  *DevicePathString;\r
+\r
+    DevicePathString = ConvertDevicePathToText (\r
+                         BootOptions[Index].FilePath,\r
+                         FALSE,\r
+                         FALSE\r
+                         );\r
+    DEBUG ((\r
+      EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_VERBOSE,\r
+      "%a: removing stale Boot#%04x %s: %r\n",\r
+      __FUNCTION__,\r
+      (UINT32)BootOptions[Index].OptionNumber,\r
+      DevicePathString == NULL ? L"<unavailable>" : DevicePathString,\r
+      Status\r
+      ));\r
+    if (DevicePathString != NULL) {\r
+      FreePool (DevicePathString);\r
+    }\r
 \r
-      DevicePathString = ConvertDevicePathToText(BootOptions[Index].FilePath,\r
-                           FALSE, FALSE);\r
-      DEBUG ((\r
-        EFI_ERROR (Status) ? DEBUG_WARN : DEBUG_VERBOSE,\r
-        "%a: removing stale Boot#%04x %s: %r\n",\r
-        __FUNCTION__,\r
-        (UINT32)BootOptions[Index].OptionNumber,\r
-        DevicePathString == NULL ? L"<unavailable>" : DevicePathString,\r
-        Status\r
-        ));\r
-      if (DevicePathString != NULL) {\r
-        FreePool (DevicePathString);\r
-      }\r
     DEBUG_CODE_END ();\r
   }\r
 \r
@@ -274,18 +293,18 @@ PlatformRegisterOptionsAndKeys (
   VOID\r
   )\r
 {\r
-  EFI_STATUS                   Status;\r
-  EFI_INPUT_KEY                Enter;\r
-  EFI_INPUT_KEY                F2;\r
-  EFI_INPUT_KEY                Esc;\r
-  EFI_BOOT_MANAGER_LOAD_OPTION BootOption;\r
+  EFI_STATUS                    Status;\r
+  EFI_INPUT_KEY                 Enter;\r
+  EFI_INPUT_KEY                 F2;\r
+  EFI_INPUT_KEY                 Esc;\r
+  EFI_BOOT_MANAGER_LOAD_OPTION  BootOption;\r
 \r
   //\r
   // Register ENTER as CONTINUE key\r
   //\r
   Enter.ScanCode    = SCAN_NULL;\r
   Enter.UnicodeChar = CHAR_CARRIAGE_RETURN;\r
-  Status = EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);\r
+  Status            = EfiBootManagerRegisterContinueKeyOption (0, &Enter, NULL);\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
@@ -295,14 +314,22 @@ PlatformRegisterOptionsAndKeys (
   F2.UnicodeChar  = CHAR_NULL;\r
   Esc.ScanCode    = SCAN_ESC;\r
   Esc.UnicodeChar = CHAR_NULL;\r
-  Status = EfiBootManagerGetBootManagerMenu (&BootOption);\r
+  Status          = EfiBootManagerGetBootManagerMenu (&BootOption);\r
   ASSERT_EFI_ERROR (Status);\r
   Status = EfiBootManagerAddKeyOptionVariable (\r
-             NULL, (UINT16) BootOption.OptionNumber, 0, &F2, NULL\r
+             NULL,\r
+             (UINT16)BootOption.OptionNumber,\r
+             0,\r
+             &F2,\r
+             NULL\r
              );\r
   ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);\r
   Status = EfiBootManagerAddKeyOptionVariable (\r
-             NULL, (UINT16) BootOption.OptionNumber, 0, &Esc, NULL\r
+             NULL,\r
+             (UINT16)BootOption.OptionNumber,\r
+             0,\r
+             &Esc,\r
+             NULL\r
              );\r
   ASSERT (Status == EFI_SUCCESS || Status == EFI_ALREADY_STARTED);\r
 }\r
@@ -319,9 +346,9 @@ STATIC
 EFI_STATUS\r
 EFIAPI\r
 ConnectVirtioPciRng (\r
-  IN EFI_HANDLE Handle,\r
-  IN VOID       *Instance,\r
-  IN VOID       *Context\r
+  IN EFI_HANDLE  Handle,\r
+  IN VOID        *Instance,\r
+  IN VOID        *Context\r
   );\r
 \r
 STATIC\r
@@ -333,6 +360,7 @@ SaveS3BootScript (
 //\r
 // BDS Platform Functions\r
 //\r
+\r
 /**\r
   Do the platform init, can be customized by OEM/IBV\r
 \r
@@ -352,14 +380,17 @@ PlatformBootManagerBeforeConsole (
   VOID\r
   )\r
 {\r
-  EFI_HANDLE    Handle;\r
-  EFI_STATUS    Status;\r
+  EFI_HANDLE  Handle;\r
+  EFI_STATUS  Status;\r
 \r
   DEBUG ((DEBUG_INFO, "PlatformBootManagerBeforeConsole\n"));\r
   InstallDevicePathCallback ();\r
 \r
-  VisitAllInstancesOfProtocol (&gEfiPciRootBridgeIoProtocolGuid,\r
-    ConnectRootBridge, NULL);\r
+  VisitAllInstancesOfProtocol (\r
+    &gEfiPciRootBridgeIoProtocolGuid,\r
+    ConnectRootBridge,\r
+    NULL\r
+    );\r
 \r
   //\r
   // Signal the ACPI platform driver that it can download QEMU ACPI tables.\r
@@ -389,9 +420,12 @@ PlatformBootManagerBeforeConsole (
   // Any TPM 2 Physical Presence Interface opcode must be handled before.\r
   //\r
   Handle = NULL;\r
-  Status = gBS->InstallProtocolInterface (&Handle,\r
-                  &gEfiDxeSmmReadyToLockProtocolGuid, EFI_NATIVE_INTERFACE,\r
-                  NULL);\r
+  Status = gBS->InstallProtocolInterface (\r
+                  &Handle,\r
+                  &gEfiDxeSmmReadyToLockProtocolGuid,\r
+                  EFI_NATIVE_INTERFACE,\r
+                  NULL\r
+                  );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
@@ -406,11 +440,13 @@ PlatformBootManagerBeforeConsole (
   // Install both VIRTIO_DEVICE_PROTOCOL and (dependent) EFI_RNG_PROTOCOL\r
   // instances on Virtio PCI RNG devices.\r
   //\r
-  VisitAllInstancesOfProtocol (&gEfiPciIoProtocolGuid, ConnectVirtioPciRng,\r
-    NULL);\r
+  VisitAllInstancesOfProtocol (\r
+    &gEfiPciIoProtocolGuid,\r
+    ConnectVirtioPciRng,\r
+    NULL\r
+    );\r
 }\r
 \r
-\r
 EFI_STATUS\r
 EFIAPI\r
 ConnectRootBridge (\r
@@ -419,7 +455,7 @@ ConnectRootBridge (
   IN VOID        *Context\r
   )\r
 {\r
-  EFI_STATUS Status;\r
+  EFI_STATUS  Status;\r
 \r
   //\r
   // Make the PCI bus driver connect the root bridge, non-recursively. This\r
@@ -435,34 +471,39 @@ ConnectRootBridge (
   return Status;\r
 }\r
 \r
-\r
 STATIC\r
 EFI_STATUS\r
 EFIAPI\r
 ConnectVirtioPciRng (\r
-  IN EFI_HANDLE Handle,\r
-  IN VOID       *Instance,\r
-  IN VOID       *Context\r
+  IN EFI_HANDLE  Handle,\r
+  IN VOID        *Instance,\r
+  IN VOID        *Context\r
   )\r
 {\r
-  EFI_PCI_IO_PROTOCOL *PciIo;\r
-  EFI_STATUS          Status;\r
-  UINT16              VendorId;\r
-  UINT16              DeviceId;\r
-  UINT8               RevisionId;\r
-  BOOLEAN             Virtio10;\r
-  UINT16              SubsystemId;\r
+  EFI_PCI_IO_PROTOCOL  *PciIo;\r
+  EFI_STATUS           Status;\r
+  UINT16               VendorId;\r
+  UINT16               DeviceId;\r
+  UINT8                RevisionId;\r
+  BOOLEAN              Virtio10;\r
+  UINT16               SubsystemId;\r
 \r
   PciIo = Instance;\r
 \r
   //\r
   // Read and check VendorId.\r
   //\r
-  Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, PCI_VENDOR_ID_OFFSET,\r
-                        1, &VendorId);\r
+  Status = PciIo->Pci.Read (\r
+                        PciIo,\r
+                        EfiPciIoWidthUint16,\r
+                        PCI_VENDOR_ID_OFFSET,\r
+                        1,\r
+                        &VendorId\r
+                        );\r
   if (EFI_ERROR (Status)) {\r
     goto Error;\r
   }\r
+\r
   if (VendorId != VIRTIO_VENDOR_ID) {\r
     return EFI_SUCCESS;\r
   }\r
@@ -470,13 +511,24 @@ ConnectVirtioPciRng (
   //\r
   // Read DeviceId and RevisionId.\r
   //\r
-  Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16, PCI_DEVICE_ID_OFFSET,\r
-                        1, &DeviceId);\r
+  Status = PciIo->Pci.Read (\r
+                        PciIo,\r
+                        EfiPciIoWidthUint16,\r
+                        PCI_DEVICE_ID_OFFSET,\r
+                        1,\r
+                        &DeviceId\r
+                        );\r
   if (EFI_ERROR (Status)) {\r
     goto Error;\r
   }\r
-  Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, PCI_REVISION_ID_OFFSET,\r
-                        1, &RevisionId);\r
+\r
+  Status = PciIo->Pci.Read (\r
+                        PciIo,\r
+                        EfiPciIoWidthUint8,\r
+                        PCI_REVISION_ID_OFFSET,\r
+                        1,\r
+                        &RevisionId\r
+                        );\r
   if (EFI_ERROR (Status)) {\r
     goto Error;\r
   }\r
@@ -488,10 +540,11 @@ ConnectVirtioPciRng (
   // SubsystemId will only play a sanity-check role. Otherwise, DeviceId can\r
   // only be sanity-checked, and SubsystemId will decide.\r
   //\r
-  if (DeviceId == 0x1040 + VIRTIO_SUBSYSTEM_ENTROPY_SOURCE &&\r
-      RevisionId >= 0x01) {\r
+  if ((DeviceId == 0x1040 + VIRTIO_SUBSYSTEM_ENTROPY_SOURCE) &&\r
+      (RevisionId >= 0x01))\r
+  {\r
     Virtio10 = TRUE;\r
-  } else if (DeviceId >= 0x1000 && DeviceId <= 0x103F && RevisionId == 0x00) {\r
+  } else if ((DeviceId >= 0x1000) && (DeviceId <= 0x103F) && (RevisionId == 0x00)) {\r
     Virtio10 = FALSE;\r
   } else {\r
     return EFI_SUCCESS;\r
@@ -500,13 +553,20 @@ ConnectVirtioPciRng (
   //\r
   // Read and check SubsystemId as dictated by Virtio10.\r
   //\r
-  Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint16,\r
-                        PCI_SUBSYSTEM_ID_OFFSET, 1, &SubsystemId);\r
+  Status = PciIo->Pci.Read (\r
+                        PciIo,\r
+                        EfiPciIoWidthUint16,\r
+                        PCI_SUBSYSTEM_ID_OFFSET,\r
+                        1,\r
+                        &SubsystemId\r
+                        );\r
   if (EFI_ERROR (Status)) {\r
     goto Error;\r
   }\r
-  if ((Virtio10 && SubsystemId >= 0x40) ||\r
-      (!Virtio10 && SubsystemId == VIRTIO_SUBSYSTEM_ENTROPY_SOURCE)) {\r
+\r
+  if ((Virtio10 && (SubsystemId >= 0x40)) ||\r
+      (!Virtio10 && (SubsystemId == VIRTIO_SUBSYSTEM_ENTROPY_SOURCE)))\r
+  {\r
     Status = gBS->ConnectController (\r
                     Handle, // ControllerHandle\r
                     NULL,   // DriverImageHandle -- connect all drivers\r
@@ -517,6 +577,7 @@ ConnectVirtioPciRng (
       goto Error;\r
     }\r
   }\r
+\r
   return EFI_SUCCESS;\r
 \r
 Error:\r
@@ -524,7 +585,6 @@ Error:
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Add IsaKeyboard to ConIn; add IsaSerial to ConOut, ConIn, ErrOut.\r
 \r
@@ -538,7 +598,7 @@ Error:
 **/\r
 EFI_STATUS\r
 PrepareLpcBridgeDevicePath (\r
-  IN EFI_HANDLE                DeviceHandle\r
+  IN EFI_HANDLE  DeviceHandle\r
   )\r
 {\r
   EFI_STATUS                Status;\r
@@ -547,50 +607,59 @@ PrepareLpcBridgeDevicePath (
   CHAR16                    *DevPathStr;\r
 \r
   DevicePath = NULL;\r
-  Status = gBS->HandleProtocol (\r
-                  DeviceHandle,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  (VOID*)&DevicePath\r
-                  );\r
+  Status     = gBS->HandleProtocol (\r
+                      DeviceHandle,\r
+                      &gEfiDevicePathProtocolGuid,\r
+                      (VOID *)&DevicePath\r
+                      );\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
+\r
   TempDevicePath = DevicePath;\r
 \r
   //\r
   // Register Keyboard\r
   //\r
-  DevicePath = AppendDevicePathNode (DevicePath,\r
-                 (EFI_DEVICE_PATH_PROTOCOL *)&gPnpPs2KeyboardDeviceNode);\r
+  DevicePath = AppendDevicePathNode (\r
+                 DevicePath,\r
+                 (EFI_DEVICE_PATH_PROTOCOL *)&gPnpPs2KeyboardDeviceNode\r
+                 );\r
 \r
   EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);\r
 \r
   //\r
   // Register COM1\r
   //\r
-  DevicePath = TempDevicePath;\r
+  DevicePath                     = TempDevicePath;\r
   gPnp16550ComPortDeviceNode.UID = 0;\r
 \r
-  DevicePath = AppendDevicePathNode (DevicePath,\r
-                 (EFI_DEVICE_PATH_PROTOCOL *)&gPnp16550ComPortDeviceNode);\r
-  DevicePath = AppendDevicePathNode (DevicePath,\r
-                 (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);\r
-  DevicePath = AppendDevicePathNode (DevicePath,\r
-                 (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);\r
+  DevicePath = AppendDevicePathNode (\r
+                 DevicePath,\r
+                 (EFI_DEVICE_PATH_PROTOCOL *)&gPnp16550ComPortDeviceNode\r
+                 );\r
+  DevicePath = AppendDevicePathNode (\r
+                 DevicePath,\r
+                 (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode\r
+                 );\r
+  DevicePath = AppendDevicePathNode (\r
+                 DevicePath,\r
+                 (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode\r
+                 );\r
 \r
   //\r
   // Print Device Path\r
   //\r
   DevPathStr = ConvertDevicePathToText (DevicePath, FALSE, FALSE);\r
   if (DevPathStr != NULL) {\r
-    DEBUG((\r
+    DEBUG ((\r
       DEBUG_INFO,\r
       "BdsPlatform.c+%d: COM%d DevPath: %s\n",\r
       DEBUG_LINE_NUMBER,\r
       gPnp16550ComPortDeviceNode.UID + 1,\r
       DevPathStr\r
       ));\r
-    FreePool(DevPathStr);\r
+    FreePool (DevPathStr);\r
   }\r
 \r
   EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);\r
@@ -604,19 +673,19 @@ PrepareLpcBridgeDevicePath (
 \r
 EFI_STATUS\r
 GetGopDevicePath (\r
-   IN  EFI_DEVICE_PATH_PROTOCOL *PciDevicePath,\r
-   OUT EFI_DEVICE_PATH_PROTOCOL **GopDevicePath\r
-   )\r
+  IN  EFI_DEVICE_PATH_PROTOCOL  *PciDevicePath,\r
+  OUT EFI_DEVICE_PATH_PROTOCOL  **GopDevicePath\r
+  )\r
 {\r
-  UINTN                           Index;\r
-  EFI_STATUS                      Status;\r
-  EFI_HANDLE                      PciDeviceHandle;\r
-  EFI_DEVICE_PATH_PROTOCOL        *TempDevicePath;\r
-  EFI_DEVICE_PATH_PROTOCOL        *TempPciDevicePath;\r
-  UINTN                           GopHandleCount;\r
-  EFI_HANDLE                      *GopHandleBuffer;\r
-\r
-  if (PciDevicePath == NULL || GopDevicePath == NULL) {\r
+  UINTN                     Index;\r
+  EFI_STATUS                Status;\r
+  EFI_HANDLE                PciDeviceHandle;\r
+  EFI_DEVICE_PATH_PROTOCOL  *TempDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL  *TempPciDevicePath;\r
+  UINTN                     GopHandleCount;\r
+  EFI_HANDLE                *GopHandleBuffer;\r
+\r
+  if ((PciDevicePath == NULL) || (GopDevicePath == NULL)) {\r
     return EFI_INVALID_PARAMETER;\r
   }\r
 \r
@@ -655,16 +724,21 @@ GetGopDevicePath (
     // Add all the child handles as possible Console Device\r
     //\r
     for (Index = 0; Index < GopHandleCount; Index++) {\r
-      Status = gBS->HandleProtocol (GopHandleBuffer[Index],\r
-                      &gEfiDevicePathProtocolGuid, (VOID*)&TempDevicePath);\r
+      Status = gBS->HandleProtocol (\r
+                      GopHandleBuffer[Index],\r
+                      &gEfiDevicePathProtocolGuid,\r
+                      (VOID *)&TempDevicePath\r
+                      );\r
       if (EFI_ERROR (Status)) {\r
         continue;\r
       }\r
+\r
       if (CompareMem (\r
             PciDevicePath,\r
             TempDevicePath,\r
             GetDevicePathSize (PciDevicePath) - END_DEVICE_PATH_LENGTH\r
-            ) == 0) {\r
+            ) == 0)\r
+      {\r
         //\r
         // In current implementation, we only enable one of the child handles\r
         // as console device, i.e. sotre one of the child handle's device\r
@@ -682,6 +756,7 @@ GetGopDevicePath (
         EfiBootManagerUpdateConsoleVariable (ConOutDev, TempDevicePath, NULL);\r
       }\r
     }\r
+\r
     gBS->FreePool (GopHandleBuffer);\r
   }\r
 \r
@@ -700,7 +775,7 @@ GetGopDevicePath (
 **/\r
 EFI_STATUS\r
 PreparePciDisplayDevicePath (\r
-  IN EFI_HANDLE                DeviceHandle\r
+  IN EFI_HANDLE  DeviceHandle\r
   )\r
 {\r
   EFI_STATUS                Status;\r
@@ -709,11 +784,11 @@ PreparePciDisplayDevicePath (
 \r
   DevicePath    = NULL;\r
   GopDevicePath = NULL;\r
-  Status = gBS->HandleProtocol (\r
-                  DeviceHandle,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  (VOID*)&DevicePath\r
-                  );\r
+  Status        = gBS->HandleProtocol (\r
+                         DeviceHandle,\r
+                         &gEfiDevicePathProtocolGuid,\r
+                         (VOID *)&DevicePath\r
+                         );\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
@@ -739,26 +814,30 @@ PreparePciDisplayDevicePath (
 **/\r
 EFI_STATUS\r
 PreparePciSerialDevicePath (\r
-  IN EFI_HANDLE                DeviceHandle\r
+  IN EFI_HANDLE  DeviceHandle\r
   )\r
 {\r
   EFI_STATUS                Status;\r
   EFI_DEVICE_PATH_PROTOCOL  *DevicePath;\r
 \r
   DevicePath = NULL;\r
-  Status = gBS->HandleProtocol (\r
-                  DeviceHandle,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  (VOID*)&DevicePath\r
-                  );\r
+  Status     = gBS->HandleProtocol (\r
+                      DeviceHandle,\r
+                      &gEfiDevicePathProtocolGuid,\r
+                      (VOID *)&DevicePath\r
+                      );\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
-  DevicePath = AppendDevicePathNode (DevicePath,\r
-                 (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode);\r
-  DevicePath = AppendDevicePathNode (DevicePath,\r
-                 (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode);\r
+  DevicePath = AppendDevicePathNode (\r
+                 DevicePath,\r
+                 (EFI_DEVICE_PATH_PROTOCOL *)&gUartDeviceNode\r
+                 );\r
+  DevicePath = AppendDevicePathNode (\r
+                 DevicePath,\r
+                 (EFI_DEVICE_PATH_PROTOCOL *)&gTerminalTypeDeviceNode\r
+                 );\r
 \r
   EfiBootManagerUpdateConsoleVariable (ConOut, DevicePath, NULL);\r
   EfiBootManagerUpdateConsoleVariable (ConIn, DevicePath, NULL);\r
@@ -774,24 +853,24 @@ VisitAllInstancesOfProtocol (
   IN VOID                        *Context\r
   )\r
 {\r
-  EFI_STATUS                Status;\r
-  UINTN                     HandleCount;\r
-  EFI_HANDLE                *HandleBuffer;\r
-  UINTN                     Index;\r
-  VOID                      *Instance;\r
+  EFI_STATUS  Status;\r
+  UINTN       HandleCount;\r
+  EFI_HANDLE  *HandleBuffer;\r
+  UINTN       Index;\r
+  VOID        *Instance;\r
 \r
   //\r
   // Start to check all the PciIo to find all possible device\r
   //\r
-  HandleCount = 0;\r
+  HandleCount  = 0;\r
   HandleBuffer = NULL;\r
-  Status = gBS->LocateHandleBuffer (\r
-                  ByProtocol,\r
-                  Id,\r
-                  NULL,\r
-                  &HandleCount,\r
-                  &HandleBuffer\r
-                  );\r
+  Status       = gBS->LocateHandleBuffer (\r
+                        ByProtocol,\r
+                        Id,\r
+                        NULL,\r
+                        &HandleCount,\r
+                        &HandleBuffer\r
+                        );\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
@@ -802,11 +881,11 @@ VisitAllInstancesOfProtocol (
       continue;\r
     }\r
 \r
-    Status = (*CallBackFunction) (\r
-               HandleBuffer[Index],\r
-               Instance,\r
-               Context\r
-               );\r
+    Status = (*CallBackFunction)(\r
+  HandleBuffer[Index],\r
+  Instance,\r
+  Context\r
+  );\r
   }\r
 \r
   gBS->FreePool (HandleBuffer);\r
@@ -814,7 +893,6 @@ VisitAllInstancesOfProtocol (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 EFI_STATUS\r
 EFIAPI\r
 VisitingAPciInstance (\r
@@ -823,49 +901,45 @@ VisitingAPciInstance (
   IN VOID        *Context\r
   )\r
 {\r
-  EFI_STATUS                Status;\r
-  EFI_PCI_IO_PROTOCOL       *PciIo;\r
-  PCI_TYPE00                Pci;\r
+  EFI_STATUS           Status;\r
+  EFI_PCI_IO_PROTOCOL  *PciIo;\r
+  PCI_TYPE00           Pci;\r
 \r
-  PciIo = (EFI_PCI_IO_PROTOCOL*) Instance;\r
+  PciIo = (EFI_PCI_IO_PROTOCOL *)Instance;\r
 \r
   //\r
   // Check for all PCI device\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
     return Status;\r
   }\r
 \r
-  return (*(VISIT_PCI_INSTANCE_CALLBACK)(UINTN) Context) (\r
-           Handle,\r
-           PciIo,\r
-           &Pci\r
-           );\r
-\r
+  return (*(VISIT_PCI_INSTANCE_CALLBACK)(UINTN)Context)(\r
+  Handle,\r
+  PciIo,\r
+  &Pci\r
+  );\r
 }\r
 \r
-\r
-\r
 EFI_STATUS\r
 VisitAllPciInstances (\r
-  IN VISIT_PCI_INSTANCE_CALLBACK CallBackFunction\r
+  IN VISIT_PCI_INSTANCE_CALLBACK  CallBackFunction\r
   )\r
 {\r
   return VisitAllInstancesOfProtocol (\r
            &gEfiPciIoProtocolGuid,\r
            VisitingAPciInstance,\r
-           (VOID*)(UINTN) CallBackFunction\r
+           (VOID *)(UINTN)CallBackFunction\r
            );\r
 }\r
 \r
-\r
 /**\r
   Do platform specific PCI Device check and add them to\r
   ConOut, ConIn, ErrOut.\r
@@ -887,14 +961,14 @@ DetectAndPreparePlatformPciDevicePath (
   IN PCI_TYPE00           *Pci\r
   )\r
 {\r
-  EFI_STATUS                Status;\r
+  EFI_STATUS  Status;\r
 \r
   Status = PciIo->Attributes (\r
-    PciIo,\r
-    EfiPciIoAttributeOperationEnable,\r
-    EFI_PCI_DEVICE_ENABLE,\r
-    NULL\r
-    );\r
+                    PciIo,\r
+                    EfiPciIoAttributeOperationEnable,\r
+                    EFI_PCI_DEVICE_ENABLE,\r
+                    NULL\r
+                    );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
@@ -905,7 +979,8 @@ DetectAndPreparePlatformPciDevicePath (
        (Pci->Hdr.VendorId == 0x8086) &&\r
        (Pci->Hdr.DeviceId == 0x7000)\r
       )\r
-     ) {\r
+      )\r
+  {\r
     //\r
     // Add IsaKeyboard to ConIn,\r
     // add IsaSerial to ConOut, ConIn, ErrOut\r
@@ -914,6 +989,7 @@ DetectAndPreparePlatformPciDevicePath (
     PrepareLpcBridgeDevicePath (Handle);\r
     return EFI_SUCCESS;\r
   }\r
+\r
   //\r
   // Here we decide which Serial device to enable in PCI bus\r
   //\r
@@ -941,7 +1017,6 @@ DetectAndPreparePlatformPciDevicePath (
   return Status;\r
 }\r
 \r
-\r
 /**\r
   Connect the predefined platform default console device.\r
 \r
@@ -951,10 +1026,10 @@ DetectAndPreparePlatformPciDevicePath (
 **/\r
 VOID\r
 PlatformInitializeConsole (\r
-  IN PLATFORM_CONSOLE_CONNECT_ENTRY   *PlatformConsole\r
+  IN PLATFORM_CONSOLE_CONNECT_ENTRY  *PlatformConsole\r
   )\r
 {\r
-  UINTN                              Index;\r
+  UINTN  Index;\r
 \r
   //\r
   // Do platform specific PCI Device check and add them to ConOut, ConIn,\r
@@ -972,21 +1047,31 @@ PlatformInitializeConsole (
     // Update the console variable with the connect type\r
     //\r
     if ((PlatformConsole[Index].ConnectType & CONSOLE_IN) == CONSOLE_IN) {\r
-      EfiBootManagerUpdateConsoleVariable (ConIn,\r
-        PlatformConsole[Index].DevicePath, NULL);\r
+      EfiBootManagerUpdateConsoleVariable (\r
+        ConIn,\r
+        PlatformConsole[Index].DevicePath,\r
+        NULL\r
+        );\r
     }\r
+\r
     if ((PlatformConsole[Index].ConnectType & CONSOLE_OUT) == CONSOLE_OUT) {\r
-      EfiBootManagerUpdateConsoleVariable (ConOut,\r
-        PlatformConsole[Index].DevicePath, NULL);\r
+      EfiBootManagerUpdateConsoleVariable (\r
+        ConOut,\r
+        PlatformConsole[Index].DevicePath,\r
+        NULL\r
+        );\r
     }\r
+\r
     if ((PlatformConsole[Index].ConnectType & STD_ERROR) == STD_ERROR) {\r
-      EfiBootManagerUpdateConsoleVariable (ErrOut,\r
-        PlatformConsole[Index].DevicePath, NULL);\r
+      EfiBootManagerUpdateConsoleVariable (\r
+        ErrOut,\r
+        PlatformConsole[Index].DevicePath,\r
+        NULL\r
+        );\r
     }\r
   }\r
 }\r
 \r
-\r
 /**\r
   Configure PCI Interrupt Line register for applicable devices\r
   Ported from SeaBIOS, src/fw/pciinit.c, *_pci_slot_get_irq()\r
@@ -1017,15 +1102,15 @@ SetPciIntLine (
   Status = EFI_SUCCESS;\r
 \r
   if (PciHdr->Device.InterruptPin != 0) {\r
-\r
     DevPathNode = DevicePathFromHandle (Handle);\r
     ASSERT (DevPathNode != NULL);\r
     DevPath = DevPathNode;\r
 \r
     RootBusNumber = 0;\r
-    if (DevicePathType (DevPathNode) == ACPI_DEVICE_PATH &&\r
-        DevicePathSubType (DevPathNode) == ACPI_DP &&\r
-        ((ACPI_HID_DEVICE_PATH *)DevPathNode)->HID == EISA_PNP_ID(0x0A03)) {\r
+    if ((DevicePathType (DevPathNode) == ACPI_DEVICE_PATH) &&\r
+        (DevicePathSubType (DevPathNode) == ACPI_DP) &&\r
+        (((ACPI_HID_DEVICE_PATH *)DevPathNode)->HID == EISA_PNP_ID (0x0A03)))\r
+    {\r
       RootBusNumber = ((ACPI_HID_DEVICE_PATH *)DevPathNode)->UID;\r
     }\r
 \r
@@ -1033,13 +1118,13 @@ SetPciIntLine (
     // Compute index into PciHostIrqs[] table by walking\r
     // the device path and adding up all device numbers\r
     //\r
-    Status = EFI_NOT_FOUND;\r
+    Status   = EFI_NOT_FOUND;\r
     RootSlot = 0;\r
-    Idx = PciHdr->Device.InterruptPin - 1;\r
+    Idx      = PciHdr->Device.InterruptPin - 1;\r
     while (!IsDevicePathEnd (DevPathNode)) {\r
-      if (DevicePathType (DevPathNode) == HARDWARE_DEVICE_PATH &&\r
-          DevicePathSubType (DevPathNode) == HW_PCI_DP) {\r
-\r
+      if ((DevicePathType (DevPathNode) == HARDWARE_DEVICE_PATH) &&\r
+          (DevicePathSubType (DevPathNode) == HW_PCI_DP))\r
+      {\r
         Idx += ((PCI_DEVICE_PATH *)DevPathNode)->Device;\r
 \r
         //\r
@@ -1050,18 +1135,20 @@ SetPciIntLine (
         // Q35 cases with more than 24 slots on the root bus.\r
         //\r
         if (Status != EFI_SUCCESS) {\r
-          Status = EFI_SUCCESS;\r
+          Status   = EFI_SUCCESS;\r
           RootSlot = ((PCI_DEVICE_PATH *)DevPathNode)->Device;\r
         }\r
       }\r
 \r
       DevPathNode = NextDevicePathNode (DevPathNode);\r
     }\r
+\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
-    if (RootBusNumber == 0 && RootSlot == 0) {\r
-      DEBUG((\r
+\r
+    if ((RootBusNumber == 0) && (RootSlot == 0)) {\r
+      DEBUG ((\r
         DEBUG_ERROR,\r
         "%a: PCI host bridge (00:00.0) should have no interrupts!\n",\r
         __FUNCTION__\r
@@ -1095,29 +1182,39 @@ SetPciIntLine (
           //\r
           Idx -= RootSlot;\r
         }\r
+\r
         break;\r
       default:\r
         ASSERT (FALSE); // should never get here\r
     }\r
-    Idx %= ARRAY_SIZE (PciHostIrqs);\r
+\r
+    Idx    %= ARRAY_SIZE (PciHostIrqs);\r
     IrqLine = PciHostIrqs[Idx];\r
 \r
     DEBUG_CODE_BEGIN ();\r
     {\r
-      CHAR16        *DevPathString;\r
-      STATIC CHAR16 Fallback[] = L"<failed to convert>";\r
-      UINTN         Segment, Bus, Device, Function;\r
+      CHAR16         *DevPathString;\r
+      STATIC CHAR16  Fallback[] = L"<failed to convert>";\r
+      UINTN          Segment, Bus, Device, Function;\r
 \r
       DevPathString = ConvertDevicePathToText (DevPath, FALSE, FALSE);\r
       if (DevPathString == NULL) {\r
         DevPathString = Fallback;\r
       }\r
+\r
       Status = PciIo->GetLocation (PciIo, &Segment, &Bus, &Device, &Function);\r
       ASSERT_EFI_ERROR (Status);\r
 \r
-      DEBUG ((DEBUG_VERBOSE, "%a: [%02x:%02x.%x] %s -> 0x%02x\n", __FUNCTION__,\r
-        (UINT32)Bus, (UINT32)Device, (UINT32)Function, DevPathString,\r
-        IrqLine));\r
+      DEBUG ((\r
+        DEBUG_VERBOSE,\r
+        "%a: [%02x:%02x.%x] %s -> 0x%02x\n",\r
+        __FUNCTION__,\r
+        (UINT32)Bus,\r
+        (UINT32)Device,\r
+        (UINT32)Function,\r
+        DevPathString,\r
+        IrqLine\r
+        ));\r
 \r
       if (DevPathString != Fallback) {\r
         FreePool (DevPathString);\r
@@ -1129,18 +1226,17 @@ SetPciIntLine (
     // Set PCI Interrupt Line register for this device to PciHostIrqs[Idx]\r
     //\r
     Status = PciIo->Pci.Write (\r
-               PciIo,\r
-               EfiPciIoWidthUint8,\r
-               PCI_INT_LINE_OFFSET,\r
-               1,\r
-               &IrqLine\r
-               );\r
+                          PciIo,\r
+                          EfiPciIoWidthUint8,\r
+                          PCI_INT_LINE_OFFSET,\r
+                          1,\r
+                          &IrqLine\r
+                          );\r
   }\r
 \r
   return Status;\r
 }\r
 \r
-\r
 VOID\r
 PciAcpiInitialization (\r
   )\r
@@ -1179,8 +1275,12 @@ PciAcpiInitialization (
       PciWrite8 (PCI_LIB_ADDRESS (0, 0x1f, 0, 0x6b), 0x0b); // H\r
       break;\r
     default:\r
-      DEBUG ((DEBUG_ERROR, "%a: Unknown Host Bridge Device ID: 0x%04x\n",\r
-        __FUNCTION__, mHostBridgeDevId));\r
+      DEBUG ((\r
+        DEBUG_ERROR,\r
+        "%a: Unknown Host Bridge Device ID: 0x%04x\n",\r
+        __FUNCTION__,\r
+        mHostBridgeDevId\r
+        ));\r
       ASSERT (FALSE);\r
       return;\r
   }\r
@@ -1213,11 +1313,11 @@ ConnectRecursivelyIfPciMassStorage (
   //\r
   if (IS_CLASS1 (PciHeader, PCI_CLASS_MASS_STORAGE)) {\r
     DevicePath = NULL;\r
-    Status = gBS->HandleProtocol (\r
-                    Handle,\r
-                    &gEfiDevicePathProtocolGuid,\r
-                    (VOID*)&DevicePath\r
-                    );\r
+    Status     = gBS->HandleProtocol (\r
+                        Handle,\r
+                        &gEfiDevicePathProtocolGuid,\r
+                        (VOID *)&DevicePath\r
+                        );\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
@@ -1227,29 +1327,27 @@ ConnectRecursivelyIfPciMassStorage (
     //\r
     DevPathStr = ConvertDevicePathToText (DevicePath, FALSE, FALSE);\r
     if (DevPathStr != NULL) {\r
-      DEBUG((\r
+      DEBUG ((\r
         DEBUG_INFO,\r
         "Found %s device: %s\n",\r
         (IS_CLASS1 (PciHeader, PCI_CLASS_MASS_STORAGE) ?\r
          L"Mass Storage" :\r
          L"Xen"\r
-         ),\r
+        ),\r
         DevPathStr\r
         ));\r
-      FreePool(DevPathStr);\r
+      FreePool (DevPathStr);\r
     }\r
 \r
     Status = gBS->ConnectController (Handle, NULL, NULL, TRUE);\r
     if (EFI_ERROR (Status)) {\r
       return Status;\r
     }\r
-\r
   }\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
   This notification function is invoked when the\r
   EMU Variable FVB has been changed.\r
@@ -1261,15 +1359,14 @@ ConnectRecursivelyIfPciMassStorage (
 VOID\r
 EFIAPI\r
 EmuVariablesUpdatedCallback (\r
-  IN  EFI_EVENT Event,\r
-  IN  VOID      *Context\r
+  IN  EFI_EVENT  Event,\r
+  IN  VOID       *Context\r
   )\r
 {\r
   DEBUG ((DEBUG_INFO, "EmuVariablesUpdatedCallback\n"));\r
   UpdateNvVarsOnFileSystem ();\r
 }\r
 \r
-\r
 EFI_STATUS\r
 EFIAPI\r
 VisitingFileSystemInstance (\r
@@ -1292,7 +1389,7 @@ VisitingFileSystemInstance (
   }\r
 \r
   ConnectedToFileSystem = TRUE;\r
-  mEmuVariableEvent =\r
+  mEmuVariableEvent     =\r
     EfiCreateProtocolNotifyEvent (\r
       &gEfiDevicePathProtocolGuid,\r
       TPL_CALLBACK,\r
@@ -1300,14 +1397,15 @@ VisitingFileSystemInstance (
       NULL,\r
       &mEmuVariableEventReg\r
       );\r
-  PcdStatus = PcdSet64S (PcdEmuVariableEvent,\r
-                (UINT64)(UINTN) mEmuVariableEvent);\r
+  PcdStatus = PcdSet64S (\r
+                PcdEmuVariableEvent,\r
+                (UINT64)(UINTN)mEmuVariableEvent\r
+                );\r
   ASSERT_RETURN_ERROR (PcdStatus);\r
 \r
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 VOID\r
 PlatformBdsRestoreNvVarsFromHardDisk (\r
   )\r
@@ -1318,7 +1416,6 @@ PlatformBdsRestoreNvVarsFromHardDisk (
     VisitingFileSystemInstance,\r
     NULL\r
     );\r
-\r
 }\r
 \r
 /**\r
@@ -1331,7 +1428,7 @@ PlatformBdsConnectSequence (
   VOID\r
   )\r
 {\r
-  UINTN         Index;\r
+  UINTN  Index;\r
 \r
   DEBUG ((DEBUG_INFO, "PlatformBdsConnectSequence\n"));\r
 \r
@@ -1363,8 +1460,8 @@ PlatformBdsConnectSequence (
   Note that DxeSmmReadyToLock must be signaled after this function returns;\r
   otherwise the script wouldn't be saved actually.\r
 **/\r
-#if defined(__GNUC__)\r
-__attribute__((unused))\r
+#if defined (__GNUC__)\r
+__attribute__ ((unused))\r
 #endif\r
 STATIC\r
 VOID\r
@@ -1372,12 +1469,15 @@ SaveS3BootScript (
   VOID\r
   )\r
 {\r
-  EFI_STATUS                 Status;\r
-  EFI_S3_SAVE_STATE_PROTOCOL *BootScript;\r
-  STATIC CONST UINT8         Info[] = { 0xDE, 0xAD, 0xBE, 0xEF };\r
+  EFI_STATUS                  Status;\r
+  EFI_S3_SAVE_STATE_PROTOCOL  *BootScript;\r
+  STATIC CONST UINT8          Info[] = { 0xDE, 0xAD, 0xBE, 0xEF };\r
 \r
-  Status = gBS->LocateProtocol (&gEfiS3SaveStateProtocolGuid, NULL,\r
-                  (VOID **) &BootScript);\r
+  Status = gBS->LocateProtocol (\r
+                  &gEfiS3SaveStateProtocolGuid,\r
+                  NULL,\r
+                  (VOID **)&BootScript\r
+                  );\r
   ASSERT_EFI_ERROR (Status);\r
 \r
   //\r
@@ -1385,13 +1485,15 @@ SaveS3BootScript (
   // implementation embeds a deep copy of the info in the boot script, rather\r
   // than storing just a pointer to runtime or NVS storage.\r
   //\r
-  Status = BootScript->Write(BootScript, EFI_BOOT_SCRIPT_INFORMATION_OPCODE,\r
-                         (UINT32) sizeof Info,\r
-                         (EFI_PHYSICAL_ADDRESS)(UINTN) &Info);\r
+  Status = BootScript->Write (\r
+                         BootScript,\r
+                         EFI_BOOT_SCRIPT_INFORMATION_OPCODE,\r
+                         (UINT32)sizeof Info,\r
+                         (EFI_PHYSICAL_ADDRESS)(UINTN)&Info\r
+                         );\r
   ASSERT_EFI_ERROR (Status);\r
 }\r
 \r
-\r
 /**\r
   Do the platform specific action after the console is ready\r
 \r
@@ -1411,18 +1513,22 @@ PlatformBootManagerAfterConsole (
   VOID\r
   )\r
 {\r
-  EFI_BOOT_MODE                      BootMode;\r
+  EFI_BOOT_MODE  BootMode;\r
 \r
   DEBUG ((DEBUG_INFO, "PlatformBootManagerAfterConsole\n"));\r
 \r
   if (PcdGetBool (PcdOvmfFlashVariablesEnable)) {\r
-    DEBUG ((DEBUG_INFO, "PlatformBdsPolicyBehavior: not restoring NvVars "\r
-      "from disk since flash variables appear to be supported.\n"));\r
+    DEBUG ((\r
+      DEBUG_INFO,\r
+      "PlatformBdsPolicyBehavior: not restoring NvVars "\r
+      "from disk since flash variables appear to be supported.\n"\r
+      ));\r
   } else {\r
     //\r
     // Try to restore variables from the hard disk early so\r
     // they can be used for the other BDS connect operations.\r
     //\r
+\r
     /* XXX Calling this causes Keyboard to be removed from ConIn which\r
        results in unresponsive guest boot loaders in the GUI. Restore it\r
        when we figure out what is needed to get NvVars storage done\r
@@ -1464,7 +1570,9 @@ PlatformBootManagerAfterConsole (
   // Register UEFI Shell\r
   //\r
   PlatformRegisterFvBootOption (\r
-    &gUefiShellFileGuid, L"EFI Internal Shell", LOAD_OPTION_ACTIVE\r
+    &gUefiShellFileGuid,\r
+    L"EFI Internal Shell",\r
+    LOAD_OPTION_ACTIVE\r
     );\r
 \r
   RemoveStaleFvFileOptions ();\r
@@ -1483,31 +1591,31 @@ PlatformBootManagerAfterConsole (
 VOID\r
 EFIAPI\r
 NotifyDevPath (\r
-  IN  EFI_EVENT Event,\r
-  IN  VOID      *Context\r
+  IN  EFI_EVENT  Event,\r
+  IN  VOID       *Context\r
   )\r
 {\r
-  EFI_HANDLE                            Handle;\r
-  EFI_STATUS                            Status;\r
-  UINTN                                 BufferSize;\r
-  EFI_DEVICE_PATH_PROTOCOL             *DevPathNode;\r
-  ATAPI_DEVICE_PATH                    *Atapi;\r
+  EFI_HANDLE                Handle;\r
+  EFI_STATUS                Status;\r
+  UINTN                     BufferSize;\r
+  EFI_DEVICE_PATH_PROTOCOL  *DevPathNode;\r
+  ATAPI_DEVICE_PATH         *Atapi;\r
 \r
   //\r
   // Examine all new handles\r
   //\r
-  for (;;) {\r
+  for ( ; ;) {\r
     //\r
     // Get the next handle\r
     //\r
     BufferSize = sizeof (Handle);\r
-    Status = gBS->LocateHandle (\r
-              ByRegisterNotify,\r
-              NULL,\r
-              mEfiDevPathNotifyReg,\r
-              &BufferSize,\r
-              &Handle\r
-              );\r
+    Status     = gBS->LocateHandle (\r
+                        ByRegisterNotify,\r
+                        NULL,\r
+                        mEfiDevPathNotifyReg,\r
+                        &BufferSize,\r
+                        &Handle\r
+                        );\r
 \r
     //\r
     // If not found, we're done\r
@@ -1523,8 +1631,11 @@ NotifyDevPath (
     //\r
     // Get the DevicePath protocol on that handle\r
     //\r
-    Status = gBS->HandleProtocol (Handle, &gEfiDevicePathProtocolGuid,\r
-                    (VOID **)&DevPathNode);\r
+    Status = gBS->HandleProtocol (\r
+                    Handle,\r
+                    &gEfiDevicePathProtocolGuid,\r
+                    (VOID **)&DevPathNode\r
+                    );\r
     ASSERT_EFI_ERROR (Status);\r
 \r
     while (!IsDevicePathEnd (DevPathNode)) {\r
@@ -1532,16 +1643,17 @@ NotifyDevPath (
       // Find the handler to dump this device path node\r
       //\r
       if (\r
-           (DevicePathType(DevPathNode) == MESSAGING_DEVICE_PATH) &&\r
-           (DevicePathSubType(DevPathNode) == MSG_ATAPI_DP)\r
-         ) {\r
-        Atapi = (ATAPI_DEVICE_PATH*) DevPathNode;\r
+          (DevicePathType (DevPathNode) == MESSAGING_DEVICE_PATH) &&\r
+          (DevicePathSubType (DevPathNode) == MSG_ATAPI_DP)\r
+          )\r
+      {\r
+        Atapi = (ATAPI_DEVICE_PATH *)DevPathNode;\r
         PciOr16 (\r
           PCI_LIB_ADDRESS (\r
             0,\r
             1,\r
             1,\r
-            (Atapi->PrimarySecondary == 1) ? 0x42: 0x40\r
+            (Atapi->PrimarySecondary == 1) ? 0x42 : 0x40\r
             ),\r
           BIT15\r
           );\r
@@ -1557,7 +1669,6 @@ NotifyDevPath (
   return;\r
 }\r
 \r
-\r
 VOID\r
 InstallDevicePathCallback (\r
   VOID\r
@@ -1565,12 +1676,12 @@ InstallDevicePathCallback (
 {\r
   DEBUG ((DEBUG_INFO, "Registered NotifyDevPath Event\n"));\r
   mEfiDevPathEvent = EfiCreateProtocolNotifyEvent (\r
-                          &gEfiDevicePathProtocolGuid,\r
-                          TPL_CALLBACK,\r
-                          NotifyDevPath,\r
-                          NULL,\r
-                          &mEfiDevPathNotifyReg\r
-                          );\r
+                       &gEfiDevicePathProtocolGuid,\r
+                       TPL_CALLBACK,\r
+                       NotifyDevPath,\r
+                       NULL,\r
+                       &mEfiDevPathNotifyReg\r
+                       );\r
 }\r
 \r
 /**\r
@@ -1582,12 +1693,12 @@ InstallDevicePathCallback (
 VOID\r
 EFIAPI\r
 PlatformBootManagerWaitCallback (\r
-  UINT16          TimeoutRemain\r
+  UINT16  TimeoutRemain\r
   )\r
 {\r
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black;\r
-  EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White;\r
-  UINT16                              Timeout;\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION  Black;\r
+  EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION  White;\r
+  UINT16                               Timeout;\r
 \r
   Timeout = PcdGet16 (PcdPlatformBootTimeOut);\r
 \r
@@ -1617,10 +1728,10 @@ PlatformBootManagerUnableToBoot (
   VOID\r
   )\r
 {\r
-  EFI_STATUS                   Status;\r
-  EFI_INPUT_KEY                Key;\r
-  EFI_BOOT_MANAGER_LOAD_OPTION BootManagerMenu;\r
-  UINTN                        Index;\r
+  EFI_STATUS                    Status;\r
+  EFI_INPUT_KEY                 Key;\r
+  EFI_BOOT_MANAGER_LOAD_OPTION  BootManagerMenu;\r
+  UINTN                         Index;\r
 \r
   //\r
   // BootManagerMenu doesn't contain the correct information when return status\r
@@ -1630,6 +1741,7 @@ PlatformBootManagerUnableToBoot (
   if (EFI_ERROR (Status)) {\r
     return;\r
   }\r
+\r
   //\r
   // Normally BdsDxe does not print anything to the system console, but this is\r
   // a last resort -- the end-user will likely not see any DEBUG messages\r
@@ -1659,7 +1771,7 @@ PlatformBootManagerUnableToBoot (
     }\r
   }\r
 \r
-  for (;;) {\r
+  for ( ; ;) {\r
     EfiBootManagerBoot (&BootManagerMenu);\r
   }\r
 }\r