mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-28 16:14:04 +02:00
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>
This commit is contained in:
parent
ef95212963
commit
744c71687b
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Decode an El Torito formatted CD-ROM
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -183,7 +183,7 @@ PartitionInstallElToritoChildHandles (
|
|||||||
}
|
}
|
||||||
|
|
||||||
SubBlockSize = 512;
|
SubBlockSize = 512;
|
||||||
SectorCount = Catalog->Boot.SectorCount * (SIZE_2KB / Media->BlockSize);
|
SectorCount = Catalog->Boot.SectorCount;
|
||||||
|
|
||||||
switch (Catalog->Boot.MediaType) {
|
switch (Catalog->Boot.MediaType) {
|
||||||
|
|
||||||
@ -233,15 +233,15 @@ PartitionInstallElToritoChildHandles (
|
|||||||
//
|
//
|
||||||
// When the SectorCount < 2, set the Partition as the whole CD.
|
// When the SectorCount < 2, set the Partition as the whole CD.
|
||||||
//
|
//
|
||||||
if (VolSpaceSize > (Media->LastBlock + 1)) {
|
if (VolSpaceSize * (SIZE_2KB / Media->BlockSize) > (Media->LastBlock + 1)) {
|
||||||
CdDev.PartitionSize = (UINT32)(Media->LastBlock - Catalog->Boot.Lba + 1);
|
CdDev.PartitionSize = (UINT32)(Media->LastBlock - Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize) + 1);
|
||||||
} else {
|
} else {
|
||||||
CdDev.PartitionSize = (UINT32)(VolSpaceSize - Catalog->Boot.Lba);
|
CdDev.PartitionSize = (UINT32)(VolSpaceSize - Catalog->Boot.Lba) * (SIZE_2KB / Media->BlockSize);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
CdDev.PartitionSize = DivU64x32 (
|
CdDev.PartitionSize = DivU64x32 (
|
||||||
MultU64x32 (
|
MultU64x32 (
|
||||||
SectorCount,
|
SectorCount * (SIZE_2KB / Media->BlockSize),
|
||||||
SubBlockSize
|
SubBlockSize
|
||||||
) + Media->BlockSize - 1,
|
) + Media->BlockSize - 1,
|
||||||
Media->BlockSize
|
Media->BlockSize
|
||||||
@ -258,7 +258,7 @@ PartitionInstallElToritoChildHandles (
|
|||||||
DevicePath,
|
DevicePath,
|
||||||
(EFI_DEVICE_PATH_PROTOCOL *) &CdDev,
|
(EFI_DEVICE_PATH_PROTOCOL *) &CdDev,
|
||||||
Catalog->Boot.Lba * (SIZE_2KB / Media->BlockSize),
|
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,
|
SubBlockSize,
|
||||||
FALSE
|
FALSE
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user