diff options
author | Dandan Bi <dandan.bi@intel.com> | 2018-10-12 10:18:26 +0800 |
---|---|---|
committer | Liming Gao <liming.gao@intel.com> | 2018-10-24 22:15:56 +0800 |
commit | 6d9b9bbb6148831de2ca545994f31e27b3d4c675 (patch) | |
tree | efbf2594329187324076622457f110edb2c2bd05 /MdePkg | |
parent | ea1486c28127057b7f3059b8c3c74afe7912460f (diff) | |
download | edk2-6d9b9bbb6148831de2ca545994f31e27b3d4c675.tar.gz edk2-6d9b9bbb6148831de2ca545994f31e27b3d4c675.tar.bz2 edk2-6d9b9bbb6148831de2ca545994f31e27b3d4c675.zip |
MdePkg: Handle Sata device path when optional para is not specified
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1243
Sata device path format:Sata(HPN, PMPN, LUN)
According to UEFI Spec, the PMPN is an integer between
0 and 65535 and is optional. If not provided, the default is 0xFFFF.
This commit is to do the enhancement for Sata device path
when optional para is not specified.
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Diffstat (limited to 'MdePkg')
-rw-r--r-- | MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c index 49da8268eb..ca912b4eb0 100644 --- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c @@ -3416,7 +3416,15 @@ DevPathFromTextSata ( (UINT16) sizeof (SATA_DEVICE_PATH)
);
Sata->HBAPortNumber = (UINT16) Strtoi (Param1);
- Sata->PortMultiplierPortNumber = (UINT16) Strtoi (Param2);
+
+ //
+ // According to UEFI spec, if PMPN is not provided, the default is 0xFFFF
+ //
+ if (*Param2 == L'\0' ) {
+ Sata->PortMultiplierPortNumber = 0xFFFF;
+ } else {
+ Sata->PortMultiplierPortNumber = (UINT16) Strtoi (Param2);
+ }
Sata->Lun = (UINT16) Strtoi (Param3);
return (EFI_DEVICE_PATH_PROTOCOL *) Sata;
|