From: "Zhu, Yonghong" <yonghong.zhu@intel.com>
To: "Feng, YunhuaX" <yunhuax.feng@intel.com>,
"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Gao, Liming" <liming.gao@intel.com>,
"Zhu, Yonghong" <yonghong.zhu@intel.com>
Subject: Re: [PATCH 1/1] BaseTools: Sync MdePkg/Library/UefiDevicePathLib/DevicePathToText.c code
Date: Sat, 27 Oct 2018 11:40:18 +0000 [thread overview]
Message-ID: <B9726D6DCCFB8B4CA276A9169B02216D52164A71@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <47C64442C08CCD4089DC43B6B5E46BC49088A1@shsmsx102.ccr.corp.intel.com>
The code was synced from DevicePathFromText.c, not from DevicePathToText.c
So please update the title. Maybe: Sync the DevicePath Function update from MdePkg, and in the description to add detail function updates.
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Best Regards,
Zhu Yonghong
-----Original Message-----
From: Feng, YunhuaX
Sent: Friday, October 26, 2018 4:37 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong.zhu@intel.com>; Gao, Liming <liming.gao@intel.com>
Subject: [PATCH 1/1] BaseTools: Sync MdePkg/Library/UefiDevicePathLib/DevicePathToText.c code
Sync MdePkg/Library/UefiDevicePathLib/DevicePathToText.c code
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng <yunhuax.feng@intel.com>
---
BaseTools/Source/C/DevicePath/DevicePath.c | 2 +-
BaseTools/Source/C/DevicePath/DevicePathFromText.c | 59 ++++++++++++++++++----
BaseTools/Source/C/Include/Protocol/DevicePath.h | 2 +-
3 files changed, 50 insertions(+), 13 deletions(-)
diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c b/BaseTools/Source/C/DevicePath/DevicePath.c
index 956bbffb5f..356f5f7e24 100644
--- a/BaseTools/Source/C/DevicePath/DevicePath.c
+++ b/BaseTools/Source/C/DevicePath/DevicePath.c
@@ -23,11 +23,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// Utility version information
//
#define UTILITY_MAJOR_VERSION 0
#define UTILITY_MINOR_VERSION 1
-EFI_GUID gEfiDebugPortDevicePathGuid = DEVICE_PATH_MESSAGING_DEBUGPORT;
+EFI_GUID gEfiDebugPortProtocolGuid = DEVICE_PATH_MESSAGING_DEBUGPORT;
EFI_GUID gEfiPcAnsiGuid = EFI_PC_ANSI_GUID; EFI_GUID gEfiVT100Guid = EFI_VT_100_GUID; EFI_GUID gEfiVT100PlusGuid = EFI_VT_100_PLUS_GUID; EFI_GUID gEfiVTUTF8Guid = EFI_VT_UTF8_GUID; EFI_GUID gEfiUartDevicePathGuid = EFI_UART_DEVICE_PATH_GUID; diff --git a/BaseTools/Source/C/DevicePath/DevicePathFromText.c b/BaseTools/Source/C/DevicePath/DevicePathFromText.c
index bb74e2e170..555efa1acd 100644
--- a/BaseTools/Source/C/DevicePath/DevicePathFromText.c
+++ b/BaseTools/Source/C/DevicePath/DevicePathFromText.c
@@ -762,11 +762,20 @@ DevPathFromTextAcpiExp (
ACPI_EXTENDED_DP,
Length
);
AcpiEx->HID = EisaIdFromText (HIDStr);
- AcpiEx->CID = EisaIdFromText (CIDStr);
+ //
+ // According to UEFI spec, the CID parametr is optional and has a default value of 0.
+ // So when the CID parametr is not specified or specified as 0 in the text device node.
+ // Set the CID to 0 in the ACPI extension device path structure.
+ //
+ if (*CIDStr == L'\0' || *CIDStr == L'0') {
+ AcpiEx->CID = 0;
+ } else {
+ AcpiEx->CID = EisaIdFromText (CIDStr); }
AcpiEx->UID = 0;
AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVICE_PATH));
//
// HID string is NULL
@@ -1601,19 +1610,19 @@ DevPathFromTextEmmc (
EFI_DEVICE_PATH_PROTOCOL *
DevPathFromTextDebugPort (
CHAR16 *TextDeviceNode
)
{
- VENDOR_DEFINED_MESSAGING_DEVICE_PATH *Vend;
+ VENDOR_DEVICE_PATH *Vend;
- Vend = (VENDOR_DEFINED_MESSAGING_DEVICE_PATH *) CreateDeviceNode (
+ Vend = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
MESSAGING_DEVICE_PATH,
MSG_VENDOR_DP,
- (UINT16) sizeof (VENDOR_DEFINED_MESSAGING_DEVICE_PATH)
+ (UINT16) sizeof (VENDOR_DEVICE_PATH)
);
- CopyGuid (&Vend->Guid, &gEfiDebugPortDevicePathGuid);
+ CopyGuid (&Vend->Guid, &gEfiDebugPortProtocolGuid);
return (EFI_DEVICE_PATH_PROTOCOL *) Vend;
}
/**
@@ -1904,26 +1913,46 @@ ConvertFromTextUsbClass (
VIDStr = GetNextParamStr (&TextDeviceNode);
PIDStr = GetNextParamStr (&TextDeviceNode);
if (UsbClassText->ClassExist) {
ClassStr = GetNextParamStr (&TextDeviceNode);
- UsbClass->DeviceClass = (UINT8) Strtoi (ClassStr);
+ if (*ClassStr == L'\0') {
+ UsbClass->DeviceClass = 0xFF;
+ } else {
+ UsbClass->DeviceClass = (UINT8) Strtoi (ClassStr);
+ }
} else {
UsbClass->DeviceClass = UsbClassText->Class;
}
if (UsbClassText->SubClassExist) {
SubClassStr = GetNextParamStr (&TextDeviceNode);
- UsbClass->DeviceSubClass = (UINT8) Strtoi (SubClassStr);
+ if (*SubClassStr == L'\0') {
+ UsbClass->DeviceSubClass = 0xFF;
+ } else {
+ UsbClass->DeviceSubClass = (UINT8) Strtoi (SubClassStr);
+ }
} else {
UsbClass->DeviceSubClass = UsbClassText->SubClass;
}
ProtocolStr = GetNextParamStr (&TextDeviceNode);
- UsbClass->VendorId = (UINT16) Strtoi (VIDStr);
- UsbClass->ProductId = (UINT16) Strtoi (PIDStr);
- UsbClass->DeviceProtocol = (UINT8) Strtoi (ProtocolStr);
+ if (*VIDStr == L'\0') {
+ UsbClass->VendorId = 0xFFFF;
+ } else {
+ UsbClass->VendorId = (UINT16) Strtoi (VIDStr);
+ }
+ if (*PIDStr == L'\0') {
+ UsbClass->ProductId = 0xFFFF;
+ } else {
+ UsbClass->ProductId = (UINT16) Strtoi (PIDStr);
+ }
+ if (*ProtocolStr == L'\0') {
+ UsbClass->DeviceProtocol = 0xFF;
+ } else {
+ UsbClass->DeviceProtocol = (UINT8) Strtoi (ProtocolStr);
+ }
return (EFI_DEVICE_PATH_PROTOCOL *) UsbClass;
}
@@ -3259,11 +3288,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;
}
diff --git a/BaseTools/Source/C/Include/Protocol/DevicePath.h b/BaseTools/Source/C/Include/Protocol/DevicePath.h
index 68bb37e479..0295582cbd 100644
--- a/BaseTools/Source/C/Include/Protocol/DevicePath.h
+++ b/BaseTools/Source/C/Include/Protocol/DevicePath.h
@@ -1378,11 +1378,11 @@ extern EFI_GUID gEfiDebugPortVariableGuid;
//
// DebugPort device path definitions...
//
#define DEVICE_PATH_MESSAGING_DEBUGPORT EFI_DEBUGPORT_PROTOCOL_GUID
-extern EFI_GUID gEfiDebugPortDevicePathGuid;
+extern EFI_GUID gEfiDebugPortProtocolGuid;
typedef struct {
EFI_DEVICE_PATH_PROTOCOL Header;
EFI_GUID Guid;
} DEBUGPORT_DEVICE_PATH;
--
2.12.2.windows.2
prev parent reply other threads:[~2018-10-27 11:40 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-26 8:37 [PATCH 1/1] BaseTools: Sync MdePkg/Library/UefiDevicePathLib/DevicePathToText.c code Feng, YunhuaX
2018-10-27 11:40 ` Zhu, Yonghong [this message]
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=B9726D6DCCFB8B4CA276A9169B02216D52164A71@SHSMSX103.ccr.corp.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