public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Dandan Bi <dandan.bi@intel.com>
To: edk2-devel@lists.01.org
Cc: Ruiyu Ni <ruiyu.ni@intel.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Liming Gao <liming.gao@intel.com>
Subject: [patch 1/3] MdePkg: Handle Sata device path when optional para is not specified
Date: Fri, 12 Oct 2018 10:18:26 +0800	[thread overview]
Message-ID: <20181012021828.30432-2-dandan.bi@intel.com> (raw)
In-Reply-To: <20181012021828.30432-1-dandan.bi@intel.com>

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>
---
 MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
index c5f3764fc0..7e33160ee9 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathFromText.c
@@ -3414,11 +3414,19 @@ DevPathFromTextSata (
                                 MESSAGING_DEVICE_PATH,
                                 MSG_SATA_DP,
                                 (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;
 }
 
-- 
2.18.0.windows.1



  reply	other threads:[~2018-10-12  2:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-12  2:18 [patch 0/3] MdePkg/UefiDevicePathLib: Enahncement for Sata/Usbxx/AcpiExp device path Dandan Bi
2018-10-12  2:18 ` Dandan Bi [this message]
2018-10-12  2:18 ` [patch 2/3] MdePkg: Handle USBxxx device path when optional para is not specified Dandan Bi
2018-10-12  2:18 ` [patch 3/3] MdePkg: Handle AcpiExp " Dandan Bi
2018-10-24  3:51 ` [patch 0/3] MdePkg/UefiDevicePathLib: Enahncement for Sata/Usbxx/AcpiExp device path Ni, Ruiyu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181012021828.30432-2-dandan.bi@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox