From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=yunhuax.feng@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0FEE22117CE82 for ; Fri, 26 Oct 2018 01:38:41 -0700 (PDT) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 26 Oct 2018 01:38:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,427,1534834800"; d="dat'59?scan'59,208,59";a="100864804" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga004.fm.intel.com with ESMTP; 26 Oct 2018 01:38:41 -0700 Received: from fmsmsx157.amr.corp.intel.com (10.18.116.73) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 26 Oct 2018 01:37:17 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by FMSMSX157.amr.corp.intel.com (10.18.116.73) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 26 Oct 2018 01:37:16 -0700 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.84]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.102]) with mapi id 14.03.0415.000; Fri, 26 Oct 2018 16:37:15 +0800 From: "Feng, YunhuaX" To: "edk2-devel@lists.01.org" CC: "Zhu, Yonghong" , "Gao, Liming" Thread-Topic: [PATCH 1/1] BaseTools: Sync MdePkg/Library/UefiDevicePathLib/DevicePathToText.c code Thread-Index: AdRtBxg9Jx8KFntERhm30dCk286A0w== Date: Fri, 26 Oct 2018 08:37:14 +0000 Message-ID: <47C64442C08CCD4089DC43B6B5E46BC49088A1@shsmsx102.ccr.corp.intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: <47C64442C08CCD4089DC43B6B5E46BC49088A1@shsmsx102.ccr.corp.intel.com> x-originating-ip: [10.239.127.40] MIME-Version: 1.0 X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: [PATCH 1/1] BaseTools: Sync MdePkg/Library/UefiDevicePathLib/DevicePathToText.c code X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Oct 2018 08:38:42 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Sync MdePkg/Library/UefiDevicePathLib/DevicePathToText.c code Cc: Liming Gao Cc: Yonghong Zhu Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yunhua Feng --- 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, EITH= ER EXPRESS OR IMPLIED. // Utility version information // #define UTILITY_MAJOR_VERSION 0 #define UTILITY_MINOR_VERSION 1 =20 -EFI_GUID gEfiDebugPortDevicePathGuid =3D DEVICE_PATH_MESSAGING_DEBUGPORT; +EFI_GUID gEfiDebugPortProtocolGuid =3D DEVICE_PATH_MESSAGING_DEBUGPORT; EFI_GUID gEfiPcAnsiGuid =3D EFI_PC_ANSI_GUID; EFI_GUID gEfiVT100Guid =3D EFI_VT_100_GUID; EFI_GUID gEfiVT100PlusGuid =3D EFI_VT_100_PLUS_GUID; EFI_GUID gEfiVTUTF8Guid =3D EFI_VT_UTF8_GUID; EFI_GUID gEfiUartDevicePathGuid =3D 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 ); =20 AcpiEx->HID =3D EisaIdFromText (HIDStr); - AcpiEx->CID =3D EisaIdFromText (CIDStr); + // + // According to UEFI spec, the CID parametr is optional and has a defaul= t value of 0. + // So when the CID parametr is not specified or specified as 0 in the te= xt device node. + // Set the CID to 0 in the ACPI extension device path structure. + // + if (*CIDStr =3D=3D L'\0' || *CIDStr =3D=3D L'0') { + AcpiEx->CID =3D 0; + } else { + AcpiEx->CID =3D EisaIdFromText (CIDStr); + } AcpiEx->UID =3D 0; =20 AsciiStr =3D (CHAR8 *) ((UINT8 *)AcpiEx + sizeof (ACPI_EXTENDED_HID_DEVI= CE_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; =20 - Vend =3D (VENDOR_DEFINED_MESSAGING_DEVICE_PATH *) CreateDeviceNode ( + Vend =3D (VENDOR_DEVICE_PATH *) CreateDeviceNode ( MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, - (UINT16) sizeof (VENDO= R_DEFINED_MESSAGING_DEVICE_PATH) + (UINT16) sizeof (VENDO= R_DEVICE_PATH) ); =20 - CopyGuid (&Vend->Guid, &gEfiDebugPortDevicePathGuid); + CopyGuid (&Vend->Guid, &gEfiDebugPortProtocolGuid); =20 return (EFI_DEVICE_PATH_PROTOCOL *) Vend; } =20 /** @@ -1904,26 +1913,46 @@ ConvertFromTextUsbClass ( =20 VIDStr =3D GetNextParamStr (&TextDeviceNode); PIDStr =3D GetNextParamStr (&TextDeviceNode); if (UsbClassText->ClassExist) { ClassStr =3D GetNextParamStr (&TextDeviceNode); - UsbClass->DeviceClass =3D (UINT8) Strtoi (ClassStr); + if (*ClassStr =3D=3D L'\0') { + UsbClass->DeviceClass =3D 0xFF; + } else { + UsbClass->DeviceClass =3D (UINT8) Strtoi (ClassStr); + } } else { UsbClass->DeviceClass =3D UsbClassText->Class; } if (UsbClassText->SubClassExist) { SubClassStr =3D GetNextParamStr (&TextDeviceNode); - UsbClass->DeviceSubClass =3D (UINT8) Strtoi (SubClassStr); + if (*SubClassStr =3D=3D L'\0') { + UsbClass->DeviceSubClass =3D 0xFF; + } else { + UsbClass->DeviceSubClass =3D (UINT8) Strtoi (SubClassStr); + } } else { UsbClass->DeviceSubClass =3D UsbClassText->SubClass; } =20 ProtocolStr =3D GetNextParamStr (&TextDeviceNode); =20 - UsbClass->VendorId =3D (UINT16) Strtoi (VIDStr); - UsbClass->ProductId =3D (UINT16) Strtoi (PIDStr); - UsbClass->DeviceProtocol =3D (UINT8) Strtoi (ProtocolStr); + if (*VIDStr =3D=3D L'\0') { + UsbClass->VendorId =3D 0xFFFF; + } else { + UsbClass->VendorId =3D (UINT16) Strtoi (VIDStr); + } + if (*PIDStr =3D=3D L'\0') { + UsbClass->ProductId =3D 0xFFFF; + } else { + UsbClass->ProductId =3D (UINT16) Strtoi (PIDStr); + } + if (*ProtocolStr =3D=3D L'\0') { + UsbClass->DeviceProtocol =3D 0xFF; + } else { + UsbClass->DeviceProtocol =3D (UINT8) Strtoi (ProtocolStr); + } =20 return (EFI_DEVICE_PATH_PROTOCOL *) UsbClass; } =20 =20 @@ -3259,11 +3288,19 @@ DevPathFromTextSata ( MESSAGING_DEVICE_PATH, MSG_SATA_DP, (UINT16) sizeof (SATA_DEVICE_PATH) ); Sata->HBAPortNumber =3D (UINT16) Strtoi (Param1); - Sata->PortMultiplierPortNumber =3D (UINT16) Strtoi (Param2); + + // + // According to UEFI spec, if PMPN is not provided, the default is 0xFFF= F + // + if (*Param2 =3D=3D L'\0' ) { + Sata->PortMultiplierPortNumber =3D 0xFFFF; + } else { + Sata->PortMultiplierPortNumber =3D (UINT16) Strtoi (Param2); + } Sata->Lun =3D (UINT16) Strtoi (Param3); =20 return (EFI_DEVICE_PATH_PROTOCOL *) Sata; } =20 diff --git a/BaseTools/Source/C/Include/Protocol/DevicePath.h b/BaseTools/S= ource/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; =20 // // DebugPort device path definitions... // #define DEVICE_PATH_MESSAGING_DEBUGPORT EFI_DEBUGPORT_PROTOCOL_GUID -extern EFI_GUID gEfiDebugPortDevicePathGuid; +extern EFI_GUID gEfiDebugPortProtocolGuid; =20 typedef struct { EFI_DEVICE_PATH_PROTOCOL Header; EFI_GUID Guid; } DEBUGPORT_DEVICE_PATH; --=20 2.12.2.windows.2