**/\r
BOOLEAN\r
PartitionValidMbr (\r
- IN MASTER_BOOT_RECORD *Mbr,\r
- IN EFI_PEI_LBA LastLba\r
+ IN MASTER_BOOT_RECORD *Mbr,\r
+ IN EFI_PEI_LBA LastLba\r
)\r
{\r
- UINT32 StartingLBA;\r
- UINT32 EndingLBA;\r
- UINT32 NewEndingLBA;\r
- INTN Index1;\r
- INTN Index2;\r
- BOOLEAN MbrValid;\r
+ UINT32 StartingLBA;\r
+ UINT32 EndingLBA;\r
+ UINT32 NewEndingLBA;\r
+ INTN Index1;\r
+ INTN Index2;\r
+ BOOLEAN MbrValid;\r
\r
if (Mbr->Signature != MBR_SIGNATURE) {\r
return FALSE;\r
}\r
+\r
//\r
// The BPB also has this signature, so it can not be used alone.\r
//\r
MbrValid = FALSE;\r
for (Index1 = 0; Index1 < MAX_MBR_PARTITIONS; Index1++) {\r
- if (Mbr->Partition[Index1].OSIndicator == 0x00 || UNPACK_UINT32 (Mbr->Partition[Index1].SizeInLBA) == 0) {\r
+ if ((Mbr->Partition[Index1].OSIndicator == 0x00) || (UNPACK_UINT32 (Mbr->Partition[Index1].SizeInLBA) == 0)) {\r
continue;\r
}\r
\r
}\r
\r
for (Index2 = Index1 + 1; Index2 < MAX_MBR_PARTITIONS; Index2++) {\r
- if (Mbr->Partition[Index2].OSIndicator == 0x00 || UNPACK_INT32 (Mbr->Partition[Index2].SizeInLBA) == 0) {\r
+ if ((Mbr->Partition[Index2].OSIndicator == 0x00) || (UNPACK_INT32 (Mbr->Partition[Index2].SizeInLBA) == 0)) {\r
continue;\r
}\r
\r
NewEndingLBA = UNPACK_UINT32 (Mbr->Partition[Index2].StartingLBA) + UNPACK_UINT32 (Mbr->Partition[Index2].SizeInLBA) - 1;\r
- if (NewEndingLBA >= StartingLBA && UNPACK_UINT32 (Mbr->Partition[Index2].StartingLBA) <= EndingLBA) {\r
+ if ((NewEndingLBA >= StartingLBA) && (UNPACK_UINT32 (Mbr->Partition[Index2].StartingLBA) <= EndingLBA)) {\r
//\r
// This region overlaps with the Index1'th region\r
//\r
}\r
}\r
}\r
+\r
//\r
// Non of the regions overlapped so MBR is O.K.\r
//\r
**/\r
BOOLEAN\r
FatFindMbrPartitions (\r
- IN PEI_FAT_PRIVATE_DATA *PrivateData,\r
- IN UINTN ParentBlockDevNo\r
+ IN PEI_FAT_PRIVATE_DATA *PrivateData,\r
+ IN UINTN ParentBlockDevNo\r
)\r
{\r
EFI_STATUS Status;\r
return FALSE;\r
}\r
\r
- ParentBlockDev = &(PrivateData->BlockDevice[ParentBlockDevNo]);\r
+ ParentBlockDev = &(PrivateData->BlockDevice[ParentBlockDevNo]);\r
\r
if (ParentBlockDev->BlockSize > PEI_FAT_MAX_BLOCK_SIZE) {\r
- DEBUG((DEBUG_ERROR, "Device BlockSize %x exceeds FAT_MAX_BLOCK_SIZE\n", ParentBlockDev->BlockSize));\r
+ DEBUG ((DEBUG_ERROR, "Device BlockSize %x exceeds FAT_MAX_BLOCK_SIZE\n", ParentBlockDev->BlockSize));\r
return FALSE;\r
}\r
\r
- Found = FALSE;\r
- Mbr = (MASTER_BOOT_RECORD *) PrivateData->BlockData;\r
+ Found = FALSE;\r
+ Mbr = (MASTER_BOOT_RECORD *)PrivateData->BlockData;\r
\r
Status = FatReadBlock (\r
- PrivateData,\r
- ParentBlockDevNo,\r
- 0,\r
- ParentBlockDev->BlockSize,\r
- Mbr\r
- );\r
+ PrivateData,\r
+ ParentBlockDevNo,\r
+ 0,\r
+ ParentBlockDev->BlockSize,\r
+ Mbr\r
+ );\r
\r
if (EFI_ERROR (Status) || !PartitionValidMbr (Mbr, ParentBlockDev->LastBlock)) {\r
goto Done;\r
}\r
+\r
//\r
// We have a valid mbr - add each partition\r
//\r
for (Index = 0; Index < MAX_MBR_PARTITIONS; Index++) {\r
- if (Mbr->Partition[Index].OSIndicator == 0x00 || UNPACK_INT32 (Mbr->Partition[Index].SizeInLBA) == 0) {\r
+ if ((Mbr->Partition[Index].OSIndicator == 0x00) || (UNPACK_INT32 (Mbr->Partition[Index].SizeInLBA) == 0)) {\r
//\r
// Don't use null MBR entries\r
//\r
continue;\r
}\r
+\r
//\r
// Register this partition\r
//\r
if (PrivateData->BlockDeviceCount < PEI_FAT_MAX_BLOCK_DEVICE) {\r
-\r
- Found = TRUE;\r
-\r
- BlockDev = &(PrivateData->BlockDevice[PrivateData->BlockDeviceCount]);\r
-\r
- BlockDev->BlockSize = MBR_SIZE;\r
- BlockDev->LastBlock = UNPACK_INT32 (Mbr->Partition[Index].SizeInLBA) - 1;\r
- BlockDev->IoAlign = ParentBlockDev->IoAlign;\r
- BlockDev->Logical = TRUE;\r
- BlockDev->PartitionChecked = FALSE;\r
- BlockDev->StartingPos = MultU64x32 (\r
- UNPACK_INT32 (Mbr->Partition[Index].StartingLBA),\r
- ParentBlockDev->BlockSize\r
- );\r
+ Found = TRUE;\r
+\r
+ BlockDev = &(PrivateData->BlockDevice[PrivateData->BlockDeviceCount]);\r
+\r
+ BlockDev->BlockSize = MBR_SIZE;\r
+ BlockDev->LastBlock = UNPACK_INT32 (Mbr->Partition[Index].SizeInLBA) - 1;\r
+ BlockDev->IoAlign = ParentBlockDev->IoAlign;\r
+ BlockDev->Logical = TRUE;\r
+ BlockDev->PartitionChecked = FALSE;\r
+ BlockDev->StartingPos = MultU64x32 (\r
+ UNPACK_INT32 (Mbr->Partition[Index].StartingLBA),\r
+ ParentBlockDev->BlockSize\r
+ );\r
BlockDev->ParentDevNo = ParentBlockDevNo;\r
\r
PrivateData->BlockDeviceCount++;\r