]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.c
EmbeddedPkg: Apply uncrustify changes
[mirror_edk2.git] / EmbeddedPkg / Drivers / DtPlatformDxe / DtPlatformDxe.c
index a6ac30c32a6fcfe0ef34f2eddd19f3cb7e654135..7f7e8c446c988257920e493f68286e7217afcfb7 100644 (file)
 \r
 #include "DtPlatformDxe.h"\r
 \r
-extern  UINT8                     DtPlatformHiiBin[];\r
-extern  UINT8                     DtPlatformDxeStrings[];\r
+extern  UINT8  DtPlatformHiiBin[];\r
+extern  UINT8  DtPlatformDxeStrings[];\r
 \r
 typedef struct {\r
-  VENDOR_DEVICE_PATH              VendorDevicePath;\r
-  EFI_DEVICE_PATH_PROTOCOL        End;\r
+  VENDOR_DEVICE_PATH          VendorDevicePath;\r
+  EFI_DEVICE_PATH_PROTOCOL    End;\r
 } HII_VENDOR_DEVICE_PATH;\r
 \r
-STATIC HII_VENDOR_DEVICE_PATH     mDtPlatformDxeVendorDevicePath = {\r
+STATIC HII_VENDOR_DEVICE_PATH  mDtPlatformDxeVendorDevicePath = {\r
   {\r
     {\r
       HARDWARE_DEVICE_PATH,\r
       HW_VENDOR_DP,\r
       {\r
-        (UINT8) (sizeof (VENDOR_DEVICE_PATH)),\r
-        (UINT8) ((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r
+        (UINT8)(sizeof (VENDOR_DEVICE_PATH)),\r
+        (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8)\r
       }\r
     },\r
     DT_PLATFORM_FORMSET_GUID\r
@@ -42,8 +42,8 @@ STATIC HII_VENDOR_DEVICE_PATH     mDtPlatformDxeVendorDevicePath = {
     END_DEVICE_PATH_TYPE,\r
     END_ENTIRE_DEVICE_PATH_SUBTYPE,\r
     {\r
-      (UINT8) (END_DEVICE_PATH_LENGTH),\r
-      (UINT8) ((END_DEVICE_PATH_LENGTH) >> 8)\r
+      (UINT8)(END_DEVICE_PATH_LENGTH),\r
+      (UINT8)((END_DEVICE_PATH_LENGTH) >> 8)\r
     }\r
   }\r
 };\r
@@ -54,32 +54,39 @@ InstallHiiPages (
   VOID\r
   )\r
 {\r
-  EFI_STATUS                      Status;\r
-  EFI_HII_HANDLE                  HiiHandle;\r
-  EFI_HANDLE                      DriverHandle;\r
+  EFI_STATUS      Status;\r
+  EFI_HII_HANDLE  HiiHandle;\r
+  EFI_HANDLE      DriverHandle;\r
 \r
   DriverHandle = NULL;\r
-  Status = gBS->InstallMultipleProtocolInterfaces (&DriverHandle,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  &mDtPlatformDxeVendorDevicePath,\r
-                  NULL);\r
+  Status       = gBS->InstallMultipleProtocolInterfaces (\r
+                        &DriverHandle,\r
+                        &gEfiDevicePathProtocolGuid,\r
+                        &mDtPlatformDxeVendorDevicePath,\r
+                        NULL\r
+                        );\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
 \r
-  HiiHandle = HiiAddPackages (&gDtPlatformFormSetGuid,\r
-                              DriverHandle,\r
-                              DtPlatformDxeStrings,\r
-                              DtPlatformHiiBin,\r
-                              NULL);\r
+  HiiHandle = HiiAddPackages (\r
+                &gDtPlatformFormSetGuid,\r
+                DriverHandle,\r
+                DtPlatformDxeStrings,\r
+                DtPlatformHiiBin,\r
+                NULL\r
+                );\r
 \r
   if (HiiHandle == NULL) {\r
-    gBS->UninstallMultipleProtocolInterfaces (DriverHandle,\r
-                  &gEfiDevicePathProtocolGuid,\r
-                  &mDtPlatformDxeVendorDevicePath,\r
-                  NULL);\r
+    gBS->UninstallMultipleProtocolInterfaces (\r
+           DriverHandle,\r
+           &gEfiDevicePathProtocolGuid,\r
+           &mDtPlatformDxeVendorDevicePath,\r
+           NULL\r
+           );\r
     return EFI_OUT_OF_RESOURCES;\r
   }\r
+\r
   return EFI_SUCCESS;\r
 }\r
 \r
@@ -99,44 +106,61 @@ InstallHiiPages (
 EFI_STATUS\r
 EFIAPI\r
 DtPlatformDxeEntryPoint (\r
-  IN EFI_HANDLE                   ImageHandle,\r
-  IN EFI_SYSTEM_TABLE             *SystemTable\r
+  IN EFI_HANDLE        ImageHandle,\r
+  IN EFI_SYSTEM_TABLE  *SystemTable\r
   )\r
 {\r
-  EFI_STATUS                      Status;\r
-  DT_ACPI_VARSTORE_DATA           DtAcpiPref;\r
-  UINTN                           BufferSize;\r
-  VOID                            *Dtb;\r
-  UINTN                           DtbSize;\r
+  EFI_STATUS             Status;\r
+  DT_ACPI_VARSTORE_DATA  DtAcpiPref;\r
+  UINTN                  BufferSize;\r
+  VOID                   *Dtb;\r
+  UINTN                  DtbSize;\r
 \r
-  Dtb = NULL;\r
+  Dtb    = NULL;\r
   Status = DtPlatformLoadDtb (&Dtb, &DtbSize);\r
   if (EFI_ERROR (Status)) {\r
-    DEBUG ((DEBUG_WARN,\r
+    DEBUG ((\r
+      DEBUG_WARN,\r
       "%a: no DTB blob could be loaded, defaulting to ACPI (Status == %r)\n",\r
-      __FUNCTION__, Status));\r
+      __FUNCTION__,\r
+      Status\r
+      ));\r
     DtAcpiPref.Pref = DT_ACPI_SELECT_ACPI;\r
   } else {\r
     //\r
     // Get the current DT/ACPI preference from the DtAcpiPref variable.\r
     //\r
     BufferSize = sizeof (DtAcpiPref);\r
-    Status = gRT->GetVariable(DT_ACPI_VARIABLE_NAME, &gDtPlatformFormSetGuid,\r
-                    NULL, &BufferSize, &DtAcpiPref);\r
+    Status     = gRT->GetVariable (\r
+                        DT_ACPI_VARIABLE_NAME,\r
+                        &gDtPlatformFormSetGuid,\r
+                        NULL,\r
+                        &BufferSize,\r
+                        &DtAcpiPref\r
+                        );\r
     if (EFI_ERROR (Status)) {\r
-      DEBUG ((DEBUG_WARN, "%a: no DT/ACPI preference found, defaulting to %a\n",\r
-        __FUNCTION__, PcdGetBool (PcdDefaultDtPref) ? "DT" : "ACPI"));\r
+      DEBUG ((\r
+        DEBUG_WARN,\r
+        "%a: no DT/ACPI preference found, defaulting to %a\n",\r
+        __FUNCTION__,\r
+        PcdGetBool (PcdDefaultDtPref) ? "DT" : "ACPI"\r
+        ));\r
       DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ? DT_ACPI_SELECT_DT\r
                                                       : DT_ACPI_SELECT_ACPI;\r
     }\r
   }\r
 \r
   if (!EFI_ERROR (Status) &&\r
-      DtAcpiPref.Pref != DT_ACPI_SELECT_ACPI &&\r
-      DtAcpiPref.Pref != DT_ACPI_SELECT_DT) {\r
-    DEBUG ((DEBUG_WARN, "%a: invalid value for %s, defaulting to %a\n",\r
-      __FUNCTION__, DT_ACPI_VARIABLE_NAME,\r
-      PcdGetBool (PcdDefaultDtPref) ? "DT" : "ACPI"));\r
+      (DtAcpiPref.Pref != DT_ACPI_SELECT_ACPI) &&\r
+      (DtAcpiPref.Pref != DT_ACPI_SELECT_DT))\r
+  {\r
+    DEBUG ((\r
+      DEBUG_WARN,\r
+      "%a: invalid value for %s, defaulting to %a\n",\r
+      __FUNCTION__,\r
+      DT_ACPI_VARIABLE_NAME,\r
+      PcdGetBool (PcdDefaultDtPref) ? "DT" : "ACPI"\r
+      ));\r
     DtAcpiPref.Pref = PcdGetBool (PcdDefaultDtPref) ? DT_ACPI_SELECT_DT\r
                                                     : DT_ACPI_SELECT_ACPI;\r
     Status = EFI_INVALID_PARAMETER; // trigger setvar below\r
@@ -146,9 +170,13 @@ DtPlatformDxeEntryPoint (
   // Write the newly selected default value back to the variable store.\r
   //\r
   if (EFI_ERROR (Status)) {\r
-    Status = gRT->SetVariable(DT_ACPI_VARIABLE_NAME, &gDtPlatformFormSetGuid,\r
+    Status = gRT->SetVariable (\r
+                    DT_ACPI_VARIABLE_NAME,\r
+                    &gDtPlatformFormSetGuid,\r
                     EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS,\r
-                    sizeof (DtAcpiPref), &DtAcpiPref);\r
+                    sizeof (DtAcpiPref),\r
+                    &DtAcpiPref\r
+                    );\r
     if (EFI_ERROR (Status)) {\r
       goto FreeDtb;\r
     }\r
@@ -159,12 +187,18 @@ DtPlatformDxeEntryPoint (
     // ACPI was selected: install the gEdkiiPlatformHasAcpiGuid GUID as a\r
     // NULL protocol to unlock dispatch of ACPI related drivers.\r
     //\r
-    Status = gBS->InstallMultipleProtocolInterfaces (&ImageHandle,\r
-                    &gEdkiiPlatformHasAcpiGuid, NULL, NULL);\r
+    Status = gBS->InstallMultipleProtocolInterfaces (\r
+                    &ImageHandle,\r
+                    &gEdkiiPlatformHasAcpiGuid,\r
+                    NULL,\r
+                    NULL\r
+                    );\r
     if (EFI_ERROR (Status)) {\r
-      DEBUG ((DEBUG_ERROR,\r
+      DEBUG ((\r
+        DEBUG_ERROR,\r
         "%a: failed to install gEdkiiPlatformHasAcpiGuid as a protocol\n",\r
-        __FUNCTION__));\r
+        __FUNCTION__\r
+        ));\r
       goto FreeDtb;\r
     }\r
   } else if (DtAcpiPref.Pref == DT_ACPI_SELECT_DT) {\r
@@ -174,8 +208,11 @@ DtPlatformDxeEntryPoint (
     //\r
     Status = gBS->InstallConfigurationTable (&gFdtTableGuid, Dtb);\r
     if (EFI_ERROR (Status)) {\r
-      DEBUG ((DEBUG_ERROR, "%a: failed to install FDT configuration table\n",\r
-        __FUNCTION__));\r
+      DEBUG ((\r
+        DEBUG_ERROR,\r
+        "%a: failed to install FDT configuration table\n",\r
+        __FUNCTION__\r
+        ));\r
       goto FreeDtb;\r
     }\r
   } else {\r