MdePkg/DevicePathFromText: Fix byte orders of iSCSI.Lun

Per UEFI spec, iSCSI.Lun is a 8-byte array with byte #0 in the left.
It means "0102030405060708" should be converted to:
    UINT8[8] = {01, 02, 03, 04, 05, 06, 07, 08}
or  UINT64 = {0807060504030201}

Today's implementation wrongly uses the reversed order.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Jie Lin <jie.lin@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
Ruiyu Ni 2018-03-02 19:50:30 +08:00
parent e6c80aea71
commit d0196be1e3
1 changed files with 3 additions and 1 deletions

View File

@ -2542,6 +2542,7 @@ DevPathFromTextiSCSI (
CHAR16 *ProtocolStr;
CHAR8 *AsciiStr;
ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;
UINT64 Lun;
NameStr = GetNextParamStr (&TextDeviceNode);
PortalGroupStr = GetNextParamStr (&TextDeviceNode);
@ -2560,7 +2561,8 @@ DevPathFromTextiSCSI (
StrToAscii (NameStr, &AsciiStr);
ISCSIDevPath->TargetPortalGroupTag = (UINT16) Strtoi (PortalGroupStr);
Strtoi64 (LunStr, &ISCSIDevPath->Lun);
Strtoi64 (LunStr, &Lun);
WriteUnaligned64 ((UINT64 *) &ISCSIDevPath->Lun, SwapBytes64 (Lun));
Options = 0x0000;
if (StrCmp (HeaderDigestStr, L"CRC32C") == 0) {