]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c
MdeModulePkg: Apply uncrustify changes
[mirror_edk2.git] / MdeModulePkg / Universal / Disk / PartitionDxe / ElTorito.c
index e2b028f733faba26371bb395220b4991d55d1705..977ded851edfb1fbd2d8e23aa2c08cbbca753e36 100644 (file)
@@ -7,10 +7,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 \r
 **/\r
 \r
-\r
 #include "Partition.h"\r
 \r
-\r
 /**\r
   Install child handles if the Handle supports El Torito format.\r
 \r
@@ -57,10 +55,10 @@ PartitionInstallElToritoChildHandles (
   UINT32                       VolSpaceSize;\r
   EFI_PARTITION_INFO_PROTOCOL  PartitionInfo;\r
 \r
-  Found         = EFI_NOT_FOUND;\r
-  Media         = BlockIo->Media;\r
+  Found = EFI_NOT_FOUND;\r
+  Media = BlockIo->Media;\r
 \r
-  VolSpaceSize  = 0;\r
+  VolSpaceSize = 0;\r
 \r
   //\r
   // CD_ROM has the fixed block size as 2048 bytes (SIZE_2KB)\r
@@ -79,7 +77,7 @@ PartitionInstallElToritoChildHandles (
     return EFI_NOT_FOUND;\r
   }\r
 \r
-  Catalog = (ELTORITO_CATALOG *) VolDescriptor;\r
+  Catalog = (ELTORITO_CATALOG *)VolDescriptor;\r
 \r
   //\r
   // Loop: handle one volume descriptor per time\r
@@ -87,7 +85,8 @@ PartitionInstallElToritoChildHandles (
   //\r
   for (VolDescriptorOffset = SIZE_32KB;\r
        VolDescriptorOffset <= MultU64x32 (Media->LastBlock, Media->BlockSize);\r
-       VolDescriptorOffset += SIZE_2KB) {\r
+       VolDescriptorOffset += SIZE_2KB)\r
+  {\r
     Status = DiskIo->ReadDisk (\r
                        DiskIo,\r
                        Media->MediaId,\r
@@ -99,17 +98,20 @@ PartitionInstallElToritoChildHandles (
       Found = Status;\r
       break;\r
     }\r
+\r
     //\r
     // Check for valid volume descriptor signature\r
     //\r
-    if (VolDescriptor->Unknown.Type == CDVOL_TYPE_END ||\r
-        CompareMem (VolDescriptor->Unknown.Id, CDVOL_ID, sizeof (VolDescriptor->Unknown.Id)) != 0\r
-        ) {\r
+    if ((VolDescriptor->Unknown.Type == CDVOL_TYPE_END) ||\r
+        (CompareMem (VolDescriptor->Unknown.Id, CDVOL_ID, sizeof (VolDescriptor->Unknown.Id)) != 0)\r
+        )\r
+    {\r
       //\r
       // end of Volume descriptor list\r
       //\r
       break;\r
     }\r
+\r
     //\r
     // Read the Volume Space Size from Primary Volume Descriptor 81-88 byte,\r
     // the 32-bit numerical values is stored in Both-byte orders\r
@@ -117,12 +119,14 @@ PartitionInstallElToritoChildHandles (
     if (VolDescriptor->PrimaryVolume.Type == CDVOL_TYPE_CODED) {\r
       VolSpaceSize = VolDescriptor->PrimaryVolume.VolSpaceSize[0];\r
     }\r
+\r
     //\r
     // Is it an El Torito volume descriptor?\r
     //\r
     if (CompareMem (VolDescriptor->BootRecordVolume.SystemId, CDVOL_ELTORITO_ID, sizeof (CDVOL_ELTORITO_ID) - 1) != 0) {\r
       continue;\r
     }\r
+\r
     //\r
     // Read in the boot El Torito boot catalog\r
     // The LBA unit used by El Torito boot catalog is 2KB unit\r
@@ -144,17 +148,18 @@ PartitionInstallElToritoChildHandles (
       DEBUG ((DEBUG_ERROR, "EltCheckDevice: error reading catalog %r\n", Status));\r
       continue;\r
     }\r
+\r
     //\r
     // We don't care too much about the Catalog header's contents, but we do want\r
     // to make sure it looks like a Catalog header\r
     //\r
-    if (Catalog->Catalog.Indicator != ELTORITO_ID_CATALOG || Catalog->Catalog.Id55AA != 0xAA55) {\r
+    if ((Catalog->Catalog.Indicator != ELTORITO_ID_CATALOG) || (Catalog->Catalog.Id55AA != 0xAA55)) {\r
       DEBUG ((DEBUG_ERROR, "EltCheckBootCatalog: El Torito boot catalog header IDs not correct\n"));\r
       continue;\r
     }\r
 \r
     Check       = 0;\r
-    CheckBuffer = (UINT16 *) Catalog;\r
+    CheckBuffer = (UINT16 *)Catalog;\r
     for (Index = 0; Index < sizeof (ELTORITO_CATALOG) / sizeof (UINT16); Index += 1) {\r
       Check += CheckBuffer[Index];\r
     }\r
@@ -174,45 +179,45 @@ PartitionInstallElToritoChildHandles (
       //\r
       // Check this entry\r
       //\r
-      if (Catalog->Boot.Indicator != ELTORITO_ID_SECTION_BOOTABLE || Catalog->Boot.Lba == 0) {\r
+      if ((Catalog->Boot.Indicator != ELTORITO_ID_SECTION_BOOTABLE) || (Catalog->Boot.Lba == 0)) {\r
         continue;\r
       }\r
 \r
-      SubBlockSize  = 512;\r
-      SectorCount   = Catalog->Boot.SectorCount;\r
+      SubBlockSize = 512;\r
+      SectorCount  = Catalog->Boot.SectorCount;\r
 \r
       switch (Catalog->Boot.MediaType) {\r
-\r
-      case ELTORITO_NO_EMULATION:\r
-        SubBlockSize = Media->BlockSize;\r
-        break;\r
-\r
-      case ELTORITO_HARD_DISK:\r
-        break;\r
-\r
-      case ELTORITO_12_DISKETTE:\r
-        SectorCount = 0x50 * 0x02 * 0x0F;\r
-        break;\r
-\r
-      case ELTORITO_14_DISKETTE:\r
-        SectorCount = 0x50 * 0x02 * 0x12;\r
-        break;\r
-\r
-      case ELTORITO_28_DISKETTE:\r
-        SectorCount = 0x50 * 0x02 * 0x24;\r
-        break;\r
-\r
-      default:\r
-        DEBUG ((DEBUG_INIT, "EltCheckDevice: unsupported El Torito boot media type %x\n", Catalog->Boot.MediaType));\r
-        SectorCount   = 0;\r
-        SubBlockSize  = Media->BlockSize;\r
-        break;\r
+        case ELTORITO_NO_EMULATION:\r
+          SubBlockSize = Media->BlockSize;\r
+          break;\r
+\r
+        case ELTORITO_HARD_DISK:\r
+          break;\r
+\r
+        case ELTORITO_12_DISKETTE:\r
+          SectorCount = 0x50 * 0x02 * 0x0F;\r
+          break;\r
+\r
+        case ELTORITO_14_DISKETTE:\r
+          SectorCount = 0x50 * 0x02 * 0x12;\r
+          break;\r
+\r
+        case ELTORITO_28_DISKETTE:\r
+          SectorCount = 0x50 * 0x02 * 0x24;\r
+          break;\r
+\r
+        default:\r
+          DEBUG ((DEBUG_INIT, "EltCheckDevice: unsupported El Torito boot media type %x\n", Catalog->Boot.MediaType));\r
+          SectorCount  = 0;\r
+          SubBlockSize = Media->BlockSize;\r
+          break;\r
       }\r
+\r
       //\r
       // Create child device handle\r
       //\r
-      CdDev.Header.Type     = MEDIA_DEVICE_PATH;\r
-      CdDev.Header.SubType  = MEDIA_CDROM_DP;\r
+      CdDev.Header.Type    = MEDIA_DEVICE_PATH;\r
+      CdDev.Header.SubType = MEDIA_CDROM_DP;\r
       SetDevicePathNodeLength (&CdDev.Header, sizeof (CdDev));\r
 \r
       if (Index == 1) {\r
@@ -222,7 +227,7 @@ PartitionInstallElToritoChildHandles (
         BootEntry = 0;\r
       }\r
 \r
-      CdDev.BootEntry = (UINT32) BootEntry;\r
+      CdDev.BootEntry = (UINT32)BootEntry;\r
       BootEntry++;\r
       CdDev.PartitionStart = Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize);\r
       if (SectorCount < 2) {\r
@@ -249,20 +254,20 @@ PartitionInstallElToritoChildHandles (
       PartitionInfo.Type     = PARTITION_TYPE_OTHER;\r
 \r
       Status = PartitionInstallChildHandle (\r
-                This,\r
-                Handle,\r
-                DiskIo,\r
-                DiskIo2,\r
-                BlockIo,\r
-                BlockIo2,\r
-                DevicePath,\r
-                (EFI_DEVICE_PATH_PROTOCOL *) &CdDev,\r
-                &PartitionInfo,\r
-                Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize),\r
-                Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize) + CdDev.PartitionSize - 1,\r
-                SubBlockSize,\r
-                NULL\r
-                );\r
+                 This,\r
+                 Handle,\r
+                 DiskIo,\r
+                 DiskIo2,\r
+                 BlockIo,\r
+                 BlockIo2,\r
+                 DevicePath,\r
+                 (EFI_DEVICE_PATH_PROTOCOL *)&CdDev,\r
+                 &PartitionInfo,\r
+                 Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize),\r
+                 Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize) + CdDev.PartitionSize - 1,\r
+                 SubBlockSize,\r
+                 NULL\r
+                 );\r
       if (!EFI_ERROR (Status)) {\r
         Found = EFI_SUCCESS;\r
       }\r