diff options
author | Hao Wu <hao.a.wu@intel.com> | 2016-03-11 15:55:36 +0800 |
---|---|---|
committer | Hao Wu <hao.a.wu@intel.com> | 2016-03-29 13:35:30 +0800 |
commit | 744c71687bc1cdff4ab20efdfba78f3b3525f747 (patch) | |
tree | aa60c22c7d136f6b5d8ce51947bf7089b435317a /MdeModulePkg | |
parent | ef952129633bb961ca91e0848c6e119ef6b9216f (diff) | |
download | edk2-platforms-744c71687bc1cdff4ab20efdfba78f3b3525f747.tar.xz |
MdeModulePkg PartitionDxe: Some ISO images cannot be recognized properly
Some ISO images cannot be recognized properly when they are on media whose
block size is not 2048 bytes.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Diffstat (limited to 'MdeModulePkg')
-rw-r--r-- | MdeModulePkg/Universal/Disk/PartitionDxe/ElTorito.c | 14 |
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
);
|