summaryrefslogtreecommitdiff
path: root/EdkModulePkg/Universal/Disk
diff options
context:
space:
mode:
Diffstat (limited to 'EdkModulePkg/Universal/Disk')
-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
//