summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c b/MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c
index 22384499c5..2af38429dd 100644
--- a/MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c
+++ b/MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c
@@ -1,7 +1,7 @@
/** @file
Decode an El Torito formatted CD-ROM
-Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -183,7 +183,7 @@ PartitionInstallElToritoChildHandles (
}
SubBlockSize = 512;
- SectorCount = Catalog->Boot.SectorCount * (SIZE_2KB / Media->BlockSize);
+ SectorCount = Catalog->Boot.SectorCount;
switch (Catalog->Boot.MediaType) {
@@ -233,15 +233,15 @@ PartitionInstallElToritoChildHandles (
//
// 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);
+ if (VolSpaceSize * (SIZE_2KB / Media->BlockSize) > (Media->LastBlock + 1)) {
+ CdDev.PartitionSize = (UINT32)(Media->LastBlock - Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize) + 1);
} else {
- CdDev.PartitionSize = (UINT32)(VolSpaceSize - Catalog->Boot.Lba);
+ CdDev.PartitionSize = (UINT32)(VolSpaceSize - Catalog->Boot.Lba) * (SIZE_2KB / Media->BlockSize);
}
} else {
CdDev.PartitionSize = DivU64x32 (
MultU64x32 (
- SectorCount,
+ SectorCount * (SIZE_2KB / Media->BlockSize),
SubBlockSize
) + Media->BlockSize - 1,
Media->BlockSize
@@ -258,7 +258,7 @@ PartitionInstallElToritoChildHandles (
DevicePath,
(EFI_DEVICE_PATH_PROTOCOL *) &CdDev,
Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize),
- MultU64x32 (Catalog->Boot.Lba + CdDev.PartitionSize - 1, SIZE_2KB / Media->BlockSize),
+ Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize) + CdDev.PartitionSize - 1,
SubBlockSize,
FALSE
);