/* The function is used to check GPT structure, include GPT header and GPT entry array. */
BOOLEAN PartitionCheckGptStructure(IN PEI_FAT_PRIVATE_DATA *PrivateData, IN UINTN ParentBlockDevNo, IN BOOLEAN IsPrimary)
/* The function is used to check GPT structure, include GPT header and GPT entry array. */
BOOLEAN PartitionCheckGptStructure(IN PEI_FAT_PRIVATE_DATA *PrivateData, IN UINTN ParentBlockDevNo, IN BOOLEAN IsPrimary)
{
  EFI_STATUS                  Status;
  PEI_FAT_BLOCK_DEVICE        *ParentBlockDev;
  EFI_PARTITION_TABLE_HEADER  *PartHdr;
  EFI_PEI_LBA                 GptHeaderLBA;
  ParentBlockDev = &(PrivateData->BlockDevice[ParentBlockDevNo]);
  PartHdr        = (EFI_PARTITION_TABLE_HEADER *)PrivateData->BlockData;
  if (IsPrimary) {
    GptHeaderLBA = PRIMARY_PART_HEADER_LBA;
  } else {
    GptHeaderLBA = ParentBlockDev->LastBlock;
  }
  Status = FatReadBlock (
             PrivateData,
             ParentBlockDevNo,
             GptHeaderLBA,
             ParentBlockDev->BlockSize,
             PartHdr
             );
  if (EFI_ERROR (Status)) {
    return FALSE;
  }
  if (!PartitionCheckGptHeader (PrivateData, ParentBlockDevNo, IsPrimary, PartHdr)) {
    return FALSE;
  }
  if (!PartitionCheckGptEntryArray (PrivateData, ParentBlockDevNo, PartHdr)) {
    return FALSE;
  }
  return TRUE;
}