]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FatPkg/FatPei/Part.c
FatPkg: Add GPT check in FatPei to support Capsule-on-Disk feature.
[mirror_edk2.git] / FatPkg / FatPei / Part.c
index 8a54e56f5ae6c452003fea6e6de9f0cc741a44a8..9b49eccf4e3b09aedbc202339b4f5d4f3a1325a2 100644 (file)
@@ -52,6 +52,25 @@ FatFindMbrPartitions (
   IN  UINTN                ParentBlockDevNo\r
   );\r
 \r
+/**\r
+  This function is used for finding GPT partition on block device.\r
+  As follow UEFI spec we should check protective MBR first and then\r
+  try to check both primary/backup GPT structures.\r
+\r
+  @param[in]  PrivateData       The global memory map\r
+  @param[in]  ParentBlockDevNo  The parent block device\r
+\r
+  @retval TRUE              New partitions are detected and logical block devices\r
+                            are added to block device array\r
+  @retval FALSE             No new partitions are added\r
+\r
+**/\r
+BOOLEAN\r
+FatFindGptPartitions (\r
+  IN  PEI_FAT_PRIVATE_DATA *PrivateData,\r
+  IN  UINTN                ParentBlockDevNo\r
+  );\r
+\r
 /**\r
   This function finds partitions (logical devices) in physical block devices.\r
 \r
@@ -71,12 +90,21 @@ FatFindPartitions (
 \r
     for (Index = 0; Index < PrivateData->BlockDeviceCount; Index++) {\r
       if (!PrivateData->BlockDevice[Index].PartitionChecked) {\r
-        Found = FatFindMbrPartitions (PrivateData, Index);\r
-        if (!Found) {\r
-          Found = FatFindEltoritoPartitions (PrivateData, Index);\r
+        if (FatFindGptPartitions (PrivateData, Index)) {\r
+          Found = TRUE;\r
+          continue;\r
+        }\r
+\r
+        if (FatFindMbrPartitions (PrivateData, Index)) {\r
+          Found = TRUE;\r
+          continue;\r
+        }\r
+\r
+        if (FatFindEltoritoPartitions (PrivateData, Index)) {\r
+          Found = TRUE;\r
+          continue;\r
         }\r
       }\r
     }\r
   } while (Found && PrivateData->BlockDeviceCount <= PEI_FAT_MAX_BLOCK_DEVICE);\r
 }\r
-\r