MdePkg/UefiDevicePathLib: Fix RAM Disk Device Path To Text Issue

Perform Left Shift 32 bits of a 32-bit StartAddr[1] and EndingAddr[1]
instead of Right Shift when displaying 64-bit Start and End Address Value.

StartAddr[1] and EndingAddr[1] are already a 32-bit value and it should
perform left shift 32-bit to generate a complete 64-bit value along with
StartAddr[0] and EndingAddr[0] respectively.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hp.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>

git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18144 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Tapan Shah 2015-08-04 01:09:49 +00:00 committed by erictian
parent a0973dcb77
commit a3bc432af6

View File

@ -1,6 +1,7 @@
/** @file /** @file
DevicePathToText protocol as defined in the UEFI 2.0 specification. DevicePathToText protocol as defined in the UEFI 2.0 specification.
(C) Copyright 2015 Hewlett-Packard Development Company, L.P.<BR>
Copyright (c) 2013 - 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 2013 - 2015, 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
@ -1918,40 +1919,40 @@ DevPathToTextRamDisk (
UefiDevicePathLibCatPrint ( UefiDevicePathLibCatPrint (
Str, Str,
L"VirtualDisk(0x%lx,0x%lx,%d)", L"VirtualDisk(0x%lx,0x%lx,%d)",
RShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],
RShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],
RamDisk->Instance RamDisk->Instance
); );
} else if (CompareGuid (&RamDisk->TypeGuid, &gEfiVirtualCdGuid)) { } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiVirtualCdGuid)) {
UefiDevicePathLibCatPrint ( UefiDevicePathLibCatPrint (
Str, Str,
L"VirtualCD(0x%lx,0x%lx,%d)", L"VirtualCD(0x%lx,0x%lx,%d)",
RShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],
RShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],
RamDisk->Instance RamDisk->Instance
); );
} else if (CompareGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualDiskGuid)) { } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualDiskGuid)) {
UefiDevicePathLibCatPrint ( UefiDevicePathLibCatPrint (
Str, Str,
L"PersistentVirtualDisk(0x%lx,0x%lx,%d)", L"PersistentVirtualDisk(0x%lx,0x%lx,%d)",
RShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],
RShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],
RamDisk->Instance RamDisk->Instance
); );
} else if (CompareGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualCdGuid)) { } else if (CompareGuid (&RamDisk->TypeGuid, &gEfiPersistentVirtualCdGuid)) {
UefiDevicePathLibCatPrint ( UefiDevicePathLibCatPrint (
Str, Str,
L"PersistentVirtualCD(0x%lx,0x%lx,%d)", L"PersistentVirtualCD(0x%lx,0x%lx,%d)",
RShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],
RShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],
RamDisk->Instance RamDisk->Instance
); );
} else { } else {
UefiDevicePathLibCatPrint ( UefiDevicePathLibCatPrint (
Str, Str,
L"RamDisk(0x%lx,0x%lx,%d,%g)", L"RamDisk(0x%lx,0x%lx,%d,%g)",
RShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0], LShiftU64 ((UINT64)RamDisk->StartingAddr[1], 32) | RamDisk->StartingAddr[0],
RShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0], LShiftU64 ((UINT64)RamDisk->EndingAddr[1], 32) | RamDisk->EndingAddr[0],
RamDisk->Instance, RamDisk->Instance,
&RamDisk->TypeGuid &RamDisk->TypeGuid
); );