Skip to content

Commit

Permalink
MdePkg: Handle Sata device path when optional para is not specified
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dandanbi authored and lgao4 committed Oct 24, 2018
1 parent ea1486c commit 6d9b9bb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 6d9b9bb

Please sign in to comment.