]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Bhyve/AcpiPlatformDxe/PciDecoding.c
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / Bhyve / AcpiPlatformDxe / PciDecoding.c
index 73894106c9ec4a4feb91223df6542b194a5d4e2e..d31fd653936374be3c1f635e7cbad2595bfdc183 100644 (file)
@@ -11,7 +11,6 @@
 \r
 #include "AcpiPlatform.h"\r
 \r
-\r
 /**\r
   Collect all PciIo protocol instances in the system. Save their original\r
   attributes, and enable IO and MMIO decoding for each.\r
 **/\r
 VOID\r
 EnablePciDecoding (\r
-  OUT ORIGINAL_ATTRIBUTES **OriginalAttributes,\r
-  OUT UINTN               *Count\r
+  OUT ORIGINAL_ATTRIBUTES  **OriginalAttributes,\r
+  OUT UINTN                *Count\r
   )\r
 {\r
-  EFI_STATUS          Status;\r
-  UINTN               NoHandles;\r
-  EFI_HANDLE          *Handles;\r
-  ORIGINAL_ATTRIBUTES *OrigAttrs;\r
-  UINTN               Idx;\r
+  EFI_STATUS           Status;\r
+  UINTN                NoHandles;\r
+  EFI_HANDLE           *Handles;\r
+  ORIGINAL_ATTRIBUTES  *OrigAttrs;\r
+  UINTN                Idx;\r
 \r
   *OriginalAttributes = NULL;\r
   *Count              = 0;\r
@@ -59,8 +58,13 @@ EnablePciDecoding (
     return;\r
   }\r
 \r
-  Status = gBS->LocateHandleBuffer (ByProtocol, &gEfiPciIoProtocolGuid,\r
-                  NULL /* SearchKey */, &NoHandles, &Handles);\r
+  Status = gBS->LocateHandleBuffer (\r
+                  ByProtocol,\r
+                  &gEfiPciIoProtocolGuid,\r
+                  NULL /* SearchKey */,\r
+                  &NoHandles,\r
+                  &Handles\r
+                  );\r
   if (Status == EFI_NOT_FOUND) {\r
     //\r
     // No PCI devices were found on either of the root bridges. We're done.\r
@@ -69,49 +73,75 @@ EnablePciDecoding (
   }\r
 \r
   if (EFI_ERROR (Status)) {\r
-    DEBUG ((DEBUG_WARN, "%a: LocateHandleBuffer(): %r\n", __FUNCTION__,\r
-      Status));\r
+    DEBUG ((\r
+      DEBUG_WARN,\r
+      "%a: LocateHandleBuffer(): %r\n",\r
+      __FUNCTION__,\r
+      Status\r
+      ));\r
     return;\r
   }\r
 \r
   OrigAttrs = AllocatePool (NoHandles * sizeof *OrigAttrs);\r
   if (OrigAttrs == NULL) {\r
-    DEBUG ((DEBUG_WARN, "%a: AllocatePool(): out of resources\n",\r
-      __FUNCTION__));\r
+    DEBUG ((\r
+      DEBUG_WARN,\r
+      "%a: AllocatePool(): out of resources\n",\r
+      __FUNCTION__\r
+      ));\r
     goto FreeHandles;\r
   }\r
 \r
   for (Idx = 0; Idx < NoHandles; ++Idx) {\r
-    EFI_PCI_IO_PROTOCOL *PciIo;\r
-    UINT64              Attributes;\r
+    EFI_PCI_IO_PROTOCOL  *PciIo;\r
+    UINT64               Attributes;\r
 \r
     //\r
     // Look up PciIo on the handle and stash it\r
     //\r
-    Status = gBS->HandleProtocol (Handles[Idx], &gEfiPciIoProtocolGuid,\r
-                    (VOID**)&PciIo);\r
+    Status = gBS->HandleProtocol (\r
+                    Handles[Idx],\r
+                    &gEfiPciIoProtocolGuid,\r
+                    (VOID **)&PciIo\r
+                    );\r
     ASSERT_EFI_ERROR (Status);\r
     OrigAttrs[Idx].PciIo = PciIo;\r
 \r
     //\r
     // Stash the current attributes\r
     //\r
-    Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationGet, 0,\r
-                      &OrigAttrs[Idx].PciAttributes);\r
+    Status = PciIo->Attributes (\r
+                      PciIo,\r
+                      EfiPciIoAttributeOperationGet,\r
+                      0,\r
+                      &OrigAttrs[Idx].PciAttributes\r
+                      );\r
     if (EFI_ERROR (Status)) {\r
-      DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationGet: %r\n",\r
-        __FUNCTION__, Status));\r
+      DEBUG ((\r
+        DEBUG_WARN,\r
+        "%a: EfiPciIoAttributeOperationGet: %r\n",\r
+        __FUNCTION__,\r
+        Status\r
+        ));\r
       goto RestoreAttributes;\r
     }\r
 \r
     //\r
     // Retrieve supported attributes\r
     //\r
-    Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationSupported, 0,\r
-                      &Attributes);\r
+    Status = PciIo->Attributes (\r
+                      PciIo,\r
+                      EfiPciIoAttributeOperationSupported,\r
+                      0,\r
+                      &Attributes\r
+                      );\r
     if (EFI_ERROR (Status)) {\r
-      DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationSupported: %r\n",\r
-        __FUNCTION__, Status));\r
+      DEBUG ((\r
+        DEBUG_WARN,\r
+        "%a: EfiPciIoAttributeOperationSupported: %r\n",\r
+        __FUNCTION__,\r
+        Status\r
+        ));\r
       goto RestoreAttributes;\r
     }\r
 \r
@@ -119,11 +149,19 @@ EnablePciDecoding (
     // Enable IO and MMIO decoding\r
     //\r
     Attributes &= EFI_PCI_IO_ATTRIBUTE_IO | EFI_PCI_IO_ATTRIBUTE_MEMORY;\r
-    Status = PciIo->Attributes (PciIo, EfiPciIoAttributeOperationEnable,\r
-                      Attributes, NULL);\r
+    Status      = PciIo->Attributes (\r
+                           PciIo,\r
+                           EfiPciIoAttributeOperationEnable,\r
+                           Attributes,\r
+                           NULL\r
+                           );\r
     if (EFI_ERROR (Status)) {\r
-      DEBUG ((DEBUG_WARN, "%a: EfiPciIoAttributeOperationEnable: %r\n",\r
-        __FUNCTION__, Status));\r
+      DEBUG ((\r
+        DEBUG_WARN,\r
+        "%a: EfiPciIoAttributeOperationEnable: %r\n",\r
+        __FUNCTION__,\r
+        Status\r
+        ));\r
       goto RestoreAttributes;\r
     }\r
   }\r
@@ -139,19 +177,20 @@ EnablePciDecoding (
 RestoreAttributes:\r
   while (Idx > 0) {\r
     --Idx;\r
-    OrigAttrs[Idx].PciIo->Attributes (OrigAttrs[Idx].PciIo,\r
+    OrigAttrs[Idx].PciIo->Attributes (\r
+                            OrigAttrs[Idx].PciIo,\r
                             EfiPciIoAttributeOperationSet,\r
                             OrigAttrs[Idx].PciAttributes,\r
                             NULL\r
                             );\r
   }\r
+\r
   FreePool (OrigAttrs);\r
 \r
 FreeHandles:\r
   FreePool (Handles);\r
 }\r
 \r
-\r
 /**\r
   Restore the original PCI attributes saved with EnablePciDecoding().\r
 \r
@@ -169,11 +208,11 @@ FreeHandles:
 **/\r
 VOID\r
 RestorePciDecoding (\r
-  IN ORIGINAL_ATTRIBUTES *OriginalAttributes,\r
-  IN UINTN               Count\r
+  IN ORIGINAL_ATTRIBUTES  *OriginalAttributes,\r
+  IN UINTN                Count\r
   )\r
 {\r
-  UINTN Idx;\r
+  UINTN  Idx;\r
 \r
   ASSERT ((OriginalAttributes == NULL) == (Count == 0));\r
   if (OriginalAttributes == NULL) {\r
@@ -188,5 +227,6 @@ RestorePciDecoding (
                                      NULL\r
                                      );\r
   }\r
+\r
   FreePool (OriginalAttributes);\r
 }\r