summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Universal/Disk/Partition
diff options
context:
space:
mode:
authormikewuping <mikewuping@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-16 02:48:19 +0000
committermikewuping <mikewuping@6f19259b-4bc3-4df7-8a09-765794883524>2006-10-16 02:48:19 +0000
commit3114b33496b816233063ad193d194e9ac0531ad0 (patch)
tree5346c73a35060adc8dea757c0b5af48b05631470 /EdkModulePkg/Universal/Disk/Partition
parentfc773f6aa7dccfb271e452d8b2e94d18be86dc94 (diff)
downloadedk2-platforms-3114b33496b816233063ad193d194e9ac0531ad0.tar.xz
I fixed following bugs.
1. In dependency.c, DXE Dispatcher doesn't check the dependency expression boundary correctly. 2. In page.c, a misspelling code in DXE core memory service code, duplicate code. 3. In gcd.c, according to DXE CIS 0-91 spec, When GcdAllocateType is EfiGcdAllocateMaxAddressSearchBottomUp or EfiGcdAllocateMaxAddressSearchTopDown, then the GCD memory space map is searched from the lowest address up to BaseAddress (or from BaseAddress down to the lowest address) looking for unallocated memory ranges of Length bytes. Here, BaseAddress itself is inclusive, that is, any range in [0, BaseAddress] is allowable. But current code BaseAddress to be exclusive. 4. In Ebcinit.c, EbcDebugRegisterPeriodicCallback() not check whether it is already registered. 5. In Ebcinit.c, EbcDebugRegisterExceptionCallback() not check whether it is already registered. 6. In Ebcinit.c, EbcDebugSignalException() does not assign value to EbcContext.ControlFlags. 7. In Ebcinit.c, EBC: StatusCodeValue should use EFI_SOFTWARE_EBC_EXCEPTION. 8. In Ebcinit.c, EbcDebugRegisterExceptionCallback() does not check ExceptionType 9. In ElTorito.c, BlockIo and DiskIo failed in SCT when there is CD in CD-ROM. 10. In Mbr.c, MBR code can't handle some situations. That is when there are 3 partitions in HD, if delete the first partition, it will not be able to recognize the other two partitions, and if delete the second partition, it will not be able to recognize the third partition. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1749 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'EdkModulePkg/Universal/Disk/Partition')
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c11
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/Gpt.c2
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c11
-rw-r--r--EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.h3
4 files changed, 20 insertions, 7 deletions
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c b/EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c
index 27beba171b..88d0c7223d 100644
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c
+++ b/EdkModulePkg/Universal/Disk/Partition/Dxe/ElTorito.c
@@ -133,7 +133,7 @@ Returns:
// the 32-bit numerical values is stored in Both-byte orders
//
if (VolDescriptor->Type == CDVOL_TYPE_CODED) {
- VolSpaceSize = VolDescriptor->VolSpaceSize[1];
+ VolSpaceSize = VolDescriptor->VolSpaceSize[0];
}
//
// Is it an El Torito volume descriptor?
@@ -242,7 +242,14 @@ Returns:
BootEntry++;
CdDev.PartitionStart = Catalog->Boot.Lba;
if (SectorCount < 2) {
- CdDev.PartitionSize = VolSpaceSize;
+ //
+ // When the SectorCount < 2, set the Partition as the whole CD.
+ //
+ if (VolSpaceSize > (Media->LastBlock + 1)) {
+ CdDev.PartitionSize = (UINT32)(Media->LastBlock - Catalog->Boot.Lba + 1);
+ } else {
+ CdDev.PartitionSize = (UINT32)(VolSpaceSize - Catalog->Boot.Lba);
+ }
} else {
CdDev.PartitionSize = DivU64x32 (
MultU64x32 (
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/Gpt.c b/EdkModulePkg/Universal/Disk/Partition/Dxe/Gpt.c
index 9077ac63c2..6404c753ae 100644
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/Gpt.c
+++ b/EdkModulePkg/Universal/Disk/Partition/Dxe/Gpt.c
@@ -154,7 +154,7 @@ Returns:
// Verify that the Protective MBR is valid
//
if (ProtectiveMbr->Partition[0].BootIndicator != 0x00 ||
- ProtectiveMbr->Partition[0].OSIndicator != 0xEE ||
+ ProtectiveMbr->Partition[0].OSIndicator != PMBR_GPT_PARTITION ||
UNPACK_UINT32 (ProtectiveMbr->Partition[0].StartingLBA) != 1
) {
goto Done;
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c b/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c
index 07e3cbe459..0930292a9c 100644
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c
+++ b/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.c
@@ -209,7 +209,7 @@ Returns:
continue;
}
- if (Mbr->Partition[Index].OSIndicator == 0xEE) {
+ if (Mbr->Partition[Index].OSIndicator == PMBR_GPT_PARTITION) {
//
// This is the guard MBR for the GPT. If you ever see a GPT disk with zero partitions you can get here.
// We can not produce an MBR BlockIo for this device as the MBR spans the GPT headers. So formating
@@ -265,6 +265,11 @@ Returns:
break;
}
+ if ((Mbr->Partition[0].OSIndicator == EXTENDED_DOS_PARTITION) ||
+ (Mbr->Partition[0].OSIndicator == EXTENDED_WINDOWS_PARTITION)) {
+ ExtMbrStartingLba = UNPACK_UINT32 (Mbr->Partition[0].StartingLBA);
+ continue;
+ }
HdDev.PartitionNumber = PartitionNumber ++;
HdDev.PartitionStart = UNPACK_UINT32 (Mbr->Partition[0].StartingLBA) + ExtMbrStartingLba + ParentHdDev.PartitionStart;
HdDev.PartitionSize = UNPACK_UINT32 (Mbr->Partition[0].SizeInLBA);
@@ -294,8 +299,8 @@ Returns:
Found = TRUE;
}
- if (Mbr->Partition[1].OSIndicator != EXTENDED_DOS_PARTITION &&
- Mbr->Partition[1].OSIndicator != EXTENDED_WINDOWS_PARTITION
+ if ((Mbr->Partition[1].OSIndicator != EXTENDED_DOS_PARTITION) &&
+ (Mbr->Partition[1].OSIndicator != EXTENDED_WINDOWS_PARTITION)
) {
break;
}
diff --git a/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.h b/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.h
index c0022c88ad..ac692dbdd9 100644
--- a/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.h
+++ b/EdkModulePkg/Universal/Disk/Partition/Dxe/Mbr.h
@@ -33,7 +33,8 @@ Revision History
#define EXTENDED_WINDOWS_PARTITION 0x0F
#define MAX_MBR_PARTITIONS 4
-#define EFI_PARTITION 0xef
+#define PMBR_GPT_PARTITION 0xEE
+#define EFI_PARTITION 0xEF
#define MBR_SIZE 512
//