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>
CHAR16 *ProtocolStr;\r
CHAR8 *AsciiStr;\r
ISCSI_DEVICE_PATH_WITH_NAME *ISCSIDevPath;\r
+ UINT64 Lun;\r
\r
NameStr = GetNextParamStr (&TextDeviceNode);\r
PortalGroupStr = GetNextParamStr (&TextDeviceNode);\r
StrToAscii (NameStr, &AsciiStr);\r
\r
ISCSIDevPath->TargetPortalGroupTag = (UINT16) Strtoi (PortalGroupStr);\r
- Strtoi64 (LunStr, &ISCSIDevPath->Lun);\r
+ Strtoi64 (LunStr, &Lun);\r
+ WriteUnaligned64 ((UINT64 *) &ISCSIDevPath->Lun, SwapBytes64 (Lun));\r
\r
Options = 0x0000;\r
if (StrCmp (HeaderDigestStr, L"CRC32C") == 0) {\r