diff options
author | Chen A Chen <chen.a.chen@intel.com> | 2019-01-16 14:59:57 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2019-01-31 11:10:55 +0800 |
commit | 0d18f5db32267450b44f5d4b2fdc8627e30de007 (patch) | |
tree | 000543e31d3016a058544fafd1bdd1de1b3781a6 /FatPkg/FatPei/Part.c | |
parent | 0d47abeff63b40727abeba79d547d9542e04864f (diff) | |
download | edk2-0d18f5db32267450b44f5d4b2fdc8627e30de007.tar.gz edk2-0d18f5db32267450b44f5d4b2fdc8627e30de007.tar.bz2 edk2-0d18f5db32267450b44f5d4b2fdc8627e30de007.zip |
FatPkg: Add GPT check in FatPei to support Capsule-on-Disk feature.
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1470
This feature is used for finding GPT partition.
Follow the following step to check.
1) Check Protective MBR.
2) Check GPT primary/backup header.
3) Check GPT primary/backup entry array.
Cc: Ruiyu Ni <ray.ni@intel.com>
Cc: Zhang Chao B <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Hao Wu <hao.a.wu@intel.com>
Diffstat (limited to 'FatPkg/FatPei/Part.c')
-rw-r--r-- | FatPkg/FatPei/Part.c | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/FatPkg/FatPei/Part.c b/FatPkg/FatPei/Part.c index 8a54e56f5a..9b49eccf4e 100644 --- a/FatPkg/FatPei/Part.c +++ b/FatPkg/FatPei/Part.c @@ -53,6 +53,25 @@ FatFindMbrPartitions ( );
/**
+ This function is used for finding GPT partition on block device.
+ As follow UEFI spec we should check protective MBR first and then
+ try to check both primary/backup GPT structures.
+
+ @param[in] PrivateData The global memory map
+ @param[in] ParentBlockDevNo The parent block device
+
+ @retval TRUE New partitions are detected and logical block devices
+ are added to block device array
+ @retval FALSE No new partitions are added
+
+**/
+BOOLEAN
+FatFindGptPartitions (
+ IN PEI_FAT_PRIVATE_DATA *PrivateData,
+ IN UINTN ParentBlockDevNo
+ );
+
+/**
This function finds partitions (logical devices) in physical block devices.
@param PrivateData Global memory map for accessing global variables.
@@ -71,12 +90,21 @@ FatFindPartitions ( for (Index = 0; Index < PrivateData->BlockDeviceCount; Index++) {
if (!PrivateData->BlockDevice[Index].PartitionChecked) {
- Found = FatFindMbrPartitions (PrivateData, Index);
- if (!Found) {
- Found = FatFindEltoritoPartitions (PrivateData, Index);
+ if (FatFindGptPartitions (PrivateData, Index)) {
+ Found = TRUE;
+ continue;
+ }
+
+ if (FatFindMbrPartitions (PrivateData, Index)) {
+ Found = TRUE;
+ continue;
+ }
+
+ if (FatFindEltoritoPartitions (PrivateData, Index)) {
+ Found = TRUE;
+ continue;
}
}
}
} while (Found && PrivateData->BlockDeviceCount <= PEI_FAT_MAX_BLOCK_DEVICE);
}
-
|