37 if (Mbr->Signature != MBR_SIGNATURE) {
45 for (Index1 = 0; Index1 < MAX_MBR_PARTITIONS; Index1++) {
46 if ((Mbr->Partition[Index1].OSIndicator == 0x00) || (UNPACK_UINT32 (Mbr->Partition[Index1].SizeInLBA) == 0)) {
51 StartingLBA = UNPACK_UINT32 (Mbr->Partition[Index1].StartingLBA);
52 EndingLBA = StartingLBA + UNPACK_UINT32 (Mbr->Partition[Index1].SizeInLBA) - 1;
53 if (EndingLBA > LastLba) {
68 for (Index2 = Index1 + 1; Index2 < MAX_MBR_PARTITIONS; Index2++) {
69 if ((Mbr->Partition[Index2].OSIndicator == 0x00) || (UNPACK_INT32 (Mbr->Partition[Index2].SizeInLBA) == 0)) {
73 NewEndingLBA = UNPACK_UINT32 (Mbr->Partition[Index2].StartingLBA) + UNPACK_UINT32 (Mbr->Partition[Index2].SizeInLBA) - 1;
74 if ((NewEndingLBA >= StartingLBA) && (UNPACK_UINT32 (Mbr->Partition[Index2].StartingLBA) <= EndingLBA)) {
114 if (ParentBlockDevNo > PEI_FAT_MAX_BLOCK_DEVICE - 1) {
118 ParentBlockDev = &(PrivateData->BlockDevice[ParentBlockDevNo]);
120 if (ParentBlockDev->BlockSize > PEI_FAT_MAX_BLOCK_SIZE) {
121 DEBUG ((DEBUG_ERROR,
"Device BlockSize %x exceeds FAT_MAX_BLOCK_SIZE\n", ParentBlockDev->BlockSize));
132 ParentBlockDev->BlockSize,
143 for (Index = 0; Index < MAX_MBR_PARTITIONS; Index++) {
144 if ((Mbr->Partition[Index].OSIndicator == 0x00) || (UNPACK_INT32 (Mbr->Partition[Index].SizeInLBA) == 0)) {
154 if (PrivateData->BlockDeviceCount < PEI_FAT_MAX_BLOCK_DEVICE) {
157 BlockDev = &(PrivateData->BlockDevice[PrivateData->BlockDeviceCount]);
159 BlockDev->BlockSize = MBR_SIZE;
160 BlockDev->LastBlock = UNPACK_INT32 (Mbr->Partition[Index].SizeInLBA) - 1;
161 BlockDev->IoAlign = ParentBlockDev->IoAlign;
162 BlockDev->Logical =
TRUE;
163 BlockDev->PartitionChecked =
FALSE;
165 UNPACK_INT32 (Mbr->Partition[Index].StartingLBA),
166 ParentBlockDev->BlockSize
168 BlockDev->ParentDevNo = ParentBlockDevNo;
170 PrivateData->BlockDeviceCount++;
176 ParentBlockDev->PartitionChecked =
TRUE;
UINT64 EFIAPI MultU64x32(IN UINT64 Multiplicand, IN UINT32 Multiplier)
EFI_STATUS FatReadBlock(IN PEI_FAT_PRIVATE_DATA *PrivateData, IN UINTN BlockDeviceNo, IN EFI_PEI_LBA Lba, IN UINTN BufferSize, OUT VOID *Buffer)
BOOLEAN PartitionValidMbr(IN MASTER_BOOT_RECORD *Mbr, IN EFI_PEI_LBA LastLba)
BOOLEAN FatFindMbrPartitions(IN PEI_FAT_PRIVATE_DATA *PrivateData, IN UINTN ParentBlockDevNo)
#define DEBUG(Expression)