]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FatPkg/FatPei/Part.c
Maintainers.txt: update mailing list information
[mirror_edk2.git] / FatPkg / FatPei / Part.c
index 8a54e56f5ae6c452003fea6e6de9f0cc741a44a8..3e2ded31ccb179a34a8080ada0dd977c47f69968 100644 (file)
@@ -4,13 +4,7 @@
 \r
 Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
 \r
-This program and the accompanying materials are licensed and made available\r
-under the terms and conditions of the BSD License which accompanies this\r
-distribution. The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
-\r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 **/\r
 \r
@@ -52,6 +46,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 +84,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