]> git.proxmox.com Git - mirror_edk2.git/blobdiff - OvmfPkg/Csm/LegacyBiosDxe/LegacyIde.c
OvmfPkg: Apply uncrustify changes
[mirror_edk2.git] / OvmfPkg / Csm / LegacyBiosDxe / LegacyIde.c
index 789f48370eb1b93447f0f10b50453727f61047e7..323f76c97054d900c80f45fc8014a6808b5b401f 100644 (file)
@@ -9,7 +9,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 \r
 #include "LegacyBiosInterface.h"\r
 \r
-BOOLEAN mIdeDataBuiltFlag = FALSE;\r
+BOOLEAN  mIdeDataBuiltFlag = FALSE;\r
 \r
 /**\r
   Collect IDE Inquiry data from the IDE disks\r
@@ -23,9 +23,9 @@ BOOLEAN mIdeDataBuiltFlag = FALSE;
 **/\r
 EFI_STATUS\r
 LegacyBiosBuildIdeData (\r
-  IN  LEGACY_BIOS_INSTANCE      *Private,\r
-  IN  HDD_INFO                  **HddInfo,\r
-  IN  UINT16                    Flag\r
+  IN  LEGACY_BIOS_INSTANCE  *Private,\r
+  IN  HDD_INFO              **HddInfo,\r
+  IN  UINT16                Flag\r
   )\r
 {\r
   EFI_STATUS                Status;\r
@@ -60,14 +60,14 @@ LegacyBiosBuildIdeData (
   //\r
   PciDevicePath = NULL;\r
   LocalHddInfo  = *HddInfo;\r
-  Status = Private->LegacyBiosPlatform->GetPlatformHandle (\r
-                                          Private->LegacyBiosPlatform,\r
-                                          EfiGetPlatformIdeHandle,\r
-                                          0,\r
-                                          &HandleBuffer,\r
-                                          &HandleCount,\r
-                                          (VOID *) &LocalHddInfo\r
-                                          );\r
+  Status        = Private->LegacyBiosPlatform->GetPlatformHandle (\r
+                                                 Private->LegacyBiosPlatform,\r
+                                                 EfiGetPlatformIdeHandle,\r
+                                                 0,\r
+                                                 &HandleBuffer,\r
+                                                 &HandleCount,\r
+                                                 (VOID *)&LocalHddInfo\r
+                                                 );\r
   if (!EFI_ERROR (Status)) {\r
     IdeController = HandleBuffer[0];\r
     //\r
@@ -75,10 +75,10 @@ LegacyBiosBuildIdeData (
     //\r
     if (Flag != 0) {\r
       gBS->DisconnectController (\r
-            IdeController,\r
-            NULL,\r
-            NULL\r
-            );\r
+             IdeController,\r
+             NULL,\r
+             NULL\r
+             );\r
     }\r
 \r
     gBS->ConnectController (IdeController, NULL, NULL, FALSE);\r
@@ -88,13 +88,13 @@ LegacyBiosBuildIdeData (
     // And GetIdeHandle will switch to Legacy mode, if required.\r
     //\r
     Private->LegacyBiosPlatform->GetPlatformHandle (\r
-                                  Private->LegacyBiosPlatform,\r
-                                  EfiGetPlatformIdeHandle,\r
-                                  0,\r
-                                  &HandleBuffer,\r
-                                  &HandleCount,\r
-                                  (VOID *) &LocalHddInfo\r
-                                  );\r
+                                   Private->LegacyBiosPlatform,\r
+                                   EfiGetPlatformIdeHandle,\r
+                                   0,\r
+                                   &HandleBuffer,\r
+                                   &HandleCount,\r
+                                   (VOID *)&LocalHddInfo\r
+                                   );\r
   }\r
 \r
   mIdeDataBuiltFlag = TRUE;\r
@@ -103,19 +103,19 @@ LegacyBiosBuildIdeData (
   // Get Identity command from all drives\r
   //\r
   gBS->LocateHandleBuffer (\r
-        ByProtocol,\r
-        &gEfiDiskInfoProtocolGuid,\r
-        NULL,\r
-        &HandleCount,\r
-        &HandleBuffer\r
-        );\r
-\r
-  Private->IdeDriveCount = (UINT8) HandleCount;\r
+         ByProtocol,\r
+         &gEfiDiskInfoProtocolGuid,\r
+         NULL,\r
+         &HandleCount,\r
+         &HandleBuffer\r
+         );\r
+\r
+  Private->IdeDriveCount = (UINT8)HandleCount;\r
   for (Index = 0; Index < HandleCount; Index++) {\r
     Status = gBS->HandleProtocol (\r
                     HandleBuffer[Index],\r
                     &gEfiDiskInfoProtocolGuid,\r
-                    (VOID **) &DiskInfo\r
+                    (VOID **)&DiskInfo\r
                     );\r
     ASSERT_EFI_ERROR (Status);\r
 \r
@@ -126,7 +126,7 @@ LegacyBiosBuildIdeData (
       Status = gBS->HandleProtocol (\r
                       HandleBuffer[Index],\r
                       &gEfiDevicePathProtocolGuid,\r
-                      (VOID *) &DevicePath\r
+                      (VOID *)&DevicePath\r
                       );\r
       ASSERT_EFI_ERROR (Status);\r
 \r
@@ -134,12 +134,14 @@ LegacyBiosBuildIdeData (
       while (!IsDevicePathEnd (DevicePathNode)) {\r
         TempDevicePathNode = NextDevicePathNode (DevicePathNode);\r
         if ((DevicePathType (DevicePathNode) == HARDWARE_DEVICE_PATH) &&\r
-              ( DevicePathSubType (DevicePathNode) == HW_PCI_DP) &&\r
-              ( DevicePathType(TempDevicePathNode) == MESSAGING_DEVICE_PATH) &&\r
-              ( DevicePathSubType(TempDevicePathNode) == MSG_ATAPI_DP) ) {\r
-          PciDevicePath = (PCI_DEVICE_PATH *) DevicePathNode;\r
+            (DevicePathSubType (DevicePathNode) == HW_PCI_DP) &&\r
+            (DevicePathType (TempDevicePathNode) == MESSAGING_DEVICE_PATH) &&\r
+            (DevicePathSubType (TempDevicePathNode) == MSG_ATAPI_DP))\r
+        {\r
+          PciDevicePath = (PCI_DEVICE_PATH *)DevicePathNode;\r
           break;\r
         }\r
+\r
         DevicePathNode = NextDevicePathNode (DevicePathNode);\r
       }\r
 \r
@@ -161,7 +163,8 @@ LegacyBiosBuildIdeData (
       for (PciIndex = 0; PciIndex < 8; PciIndex++) {\r
         if ((PciDevicePath->Device == LocalHddInfo[PciIndex].Device) &&\r
             (PciDevicePath->Function == LocalHddInfo[PciIndex].Function)\r
-            ) {\r
+            )\r
+        {\r
           break;\r
         }\r
       }\r
@@ -186,15 +189,15 @@ LegacyBiosBuildIdeData (
 \r
         InquiryData     = NULL;\r
         InquiryDataSize = 0;\r
-        Status = DiskInfo->Inquiry (\r
-                             DiskInfo,\r
-                             NULL,\r
-                             &InquiryDataSize\r
-                             );\r
+        Status          = DiskInfo->Inquiry (\r
+                                      DiskInfo,\r
+                                      NULL,\r
+                                      &InquiryDataSize\r
+                                      );\r
         if (Status == EFI_BUFFER_TOO_SMALL) {\r
-          InquiryData = (UINT8 *) AllocatePool (\r
-                                  InquiryDataSize\r
-                                  );\r
+          InquiryData = (UINT8 *)AllocatePool (\r
+                                   InquiryDataSize\r
+                                   );\r
           if (InquiryData != NULL) {\r
             Status = DiskInfo->Inquiry (\r
                                  DiskInfo,\r
@@ -227,6 +230,7 @@ LegacyBiosBuildIdeData (
               LocalHddInfo[PciIndex + IdeChannel].Status |= HDD_SLAVE_ATAPI_ZIPDISK;\r
             }\r
           }\r
+\r
           FreePool (InquiryData);\r
         } else {\r
           if (IdeDevice == 0) {\r
@@ -246,7 +250,6 @@ LegacyBiosBuildIdeData (
   return EFI_SUCCESS;\r
 }\r
 \r
-\r
 /**\r
   If the IDE channel is in compatibility (legacy) mode, remove all\r
   PCI I/O BAR addresses from the controller.\r
@@ -257,13 +260,13 @@ LegacyBiosBuildIdeData (
 **/\r
 VOID\r
 InitLegacyIdeController (\r
-  IN EFI_HANDLE                        IdeController\r
+  IN EFI_HANDLE  IdeController\r
   )\r
 {\r
-  EFI_PCI_IO_PROTOCOL               *PciIo;\r
-  UINT32                            IOBarClear;\r
-  EFI_STATUS                        Status;\r
-  PCI_TYPE00                        PciData;\r
+  EFI_PCI_IO_PROTOCOL  *PciIo;\r
+  UINT32               IOBarClear;\r
+  EFI_STATUS           Status;\r
+  PCI_TYPE00           PciData;\r
 \r
   //\r
   // If the IDE channel is in compatibility (legacy) mode, remove all\r
@@ -277,20 +280,21 @@ InitLegacyIdeController (
                   (VOID **)&PciIo\r
                   );\r
   if (EFI_ERROR (Status)) {\r
-    return ;\r
+    return;\r
   }\r
 \r
   Status = PciIo->Pci.Read (PciIo, EfiPciIoWidthUint8, 0, sizeof (PciData), &PciData);\r
   if (EFI_ERROR (Status)) {\r
-    return ;\r
+    return;\r
   }\r
 \r
   //\r
   // Check whether this is IDE\r
   //\r
   if ((PciData.Hdr.ClassCode[2] != PCI_CLASS_MASS_STORAGE) ||\r
-      (PciData.Hdr.ClassCode[1] != PCI_CLASS_MASS_STORAGE_IDE)) {\r
-    return ;\r
+      (PciData.Hdr.ClassCode[1] != PCI_CLASS_MASS_STORAGE_IDE))\r
+  {\r
+    return;\r
   }\r
 \r
   //\r
@@ -301,10 +305,11 @@ InitLegacyIdeController (
     PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x10, 1, &IOBarClear);\r
     PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x14, 1, &IOBarClear);\r
   }\r
+\r
   if ((PciData.Hdr.ClassCode[0] & IDE_PI_REGISTER_SNE) == 0) {\r
     PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x18, 1, &IOBarClear);\r
     PciIo->Pci.Write (PciIo, EfiPciIoWidthUint32, 0x1C, 1, &IOBarClear);\r
   }\r
 \r
-  return ;\r
+  return;\r
 }\r