From nobody Fri Apr 26 09:23:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51425+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51425+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1574907343; cv=none; d=zohomail.com; s=zohoarc; b=CjuR2I27UmqLae4wkkkk8dHl9aFy9MbJgpqbd41ZBMkdg8q8H7aWECY83ELypKl8FbOvFvZ5iBBU/4DcVbpJlzXYExK+Bnk8DQBmS71iznzXDbUOI5Vrgtpn1cNpx8mE7eIk4l55N0NEsRKV2fLxGpyWktRW7w9amgKakN2AIUY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574907343; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=7OTKYCuwFWN8zATXOoqBnMnLaVtP6MQRv5AtffkrNLo=; b=Bp7Qu58u1s8s3rLsdhuzD3Rbak7JSMJiltdBQJcJjqAYXS8VX2WOjLgJ0cGn6RIGA0qJ6+rMct5WkXLZLnZ/S7kIxs4sqWBhJ3RZ6PffC+O8DDtgLAxRQRoYouNfJGsnjoX68098QoltzIZpMrxQ9AfxtxSlb1pK/P42svNjhJg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51425+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574907343388195.60171128979687; Wed, 27 Nov 2019 18:15:43 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0s7GYY1788612x0op7to6K8L; Wed, 27 Nov 2019 18:15:42 -0800 X-Received: from mga09.intel.com (mga09.intel.com []) by mx.groups.io with SMTP id smtpd.web11.1538.1574907341255349227 for ; Wed, 27 Nov 2019 18:15:42 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Nov 2019 18:15:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,251,1571727600"; d="scan'208";a="240551879" X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga002.fm.intel.com with ESMTP; 27 Nov 2019 18:15:40 -0800 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Vitaly Cheptsov Subject: [edk2-devel] [PATCH 1/2] MdePkg/UefiDevicePathLib: Separate the device path lib Date: Thu, 28 Nov 2019 10:15:28 +0800 Message-Id: <20191128021530.11564-2-zhichao.gao@intel.com> In-Reply-To: <20191128021530.11564-1-zhichao.gao@intel.com> References: <20191128021530.11564-1-zhichao.gao@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhichao.gao@intel.com X-Gm-Message-State: WoyDZBQYZVIOlPjMJSOPK62qx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1574907342; bh=bMYP5Hxi63su/VIqz52JjO+qaRX4IrIpAzBCOyVkRA4=; h=Cc:Date:From:Reply-To:Subject:To; b=iC8kAuVKfMvfK9N+oFStv/kXAyasw644zjuFUBYtD7z17lSGAKShxJslscFfTkhfab2 14GQ9tsUvVMOpT8Ldp2kl8+kuC7lZrSPM7tokX0ulfRV9uQp5iHWvraG3gSjL0D+1Duk/ wqFYz68i76gLXT8eq5qH9wKSFDRNb29ordo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2298 UefiDevicePathLibOptionalDevicePathProtocol's implementation isn't fit its description. It should be implement as blow: Try to find the DevicePathProtocol, if found then use it to implement the interface. Else, use the local interface. It should not have the depex and ASSERT of gEfiDevicePathUtilitiesProtocolGuid when not find the DevicePathProtocol. Add a mandatory one to force using the DevicePathUtilities, DevicePathToText and DevicePathFromText protocol. Cc: Michael D Kinney Cc: Liming Gao Cc: Vitaly Cheptsov Signed-off-by: Zhichao Gao --- ...DevicePathLibMandatoryDevicePathProtocol.c | 469 ++++++++++++++++++ ...vicePathLibMandatoryDevicePathProtocol.inf | 86 ++++ ...vicePathLibMandatoryDevicePathProtocol.uni | 18 + ...iDevicePathLibOptionalDevicePathProtocol.c | 7 +- ...evicePathLibOptionalDevicePathProtocol.inf | 5 +- 5 files changed, 576 insertions(+), 9 deletions(-) create mode 100644 MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibManda= toryDevicePathProtocol.c create mode 100644 MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibManda= toryDevicePathProtocol.inf create mode 100644 MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibManda= toryDevicePathProtocol.uni diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibMandatoryDev= icePathProtocol.c b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibManda= toryDevicePathProtocol.c new file mode 100644 index 0000000000..fa27110fd4 --- /dev/null +++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibMandatoryDevicePath= Protocol.c @@ -0,0 +1,469 @@ +/** @file + Device Path services. The thing to remember is device paths are built ou= t of + nodes. The device path is terminated by an end node that is length + sizeof(EFI_DEVICE_PATH_PROTOCOL). That would be why there is sizeof(EFI_= DEVICE_PATH_PROTOCOL) + all over this file. + + The only place where multi-instance device paths are supported is in + environment varibles. Multi-instance device paths should never be placed + on a Handle. + + Copyright (c) 2019, Intel Corporation. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + + +#include "UefiDevicePathLib.h" + +GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_UTILITIES_PROTOCOL *mDeviceP= athLibDevicePathUtilities =3D NULL; +GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *mDeviceP= athLibDevicePathToText =3D NULL; +GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDeviceP= athLibDevicePathFromText =3D NULL; + +/** + The constructor function caches the pointer to DevicePathUtilites protoc= ol, + DevicePathToText protocol and DevicePathFromText protocol. + + The constructor function locates these three protocols from protocol dat= abase. + It will caches the pointer to local protocol instance if that operation = fails + and it will always return EFI_SUCCESS. + + @param ImageHandle The firmware allocated handle for the EFI image. + @param SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The constructor always returns EFI_SUCCESS. + +**/ +EFI_STATUS +EFIAPI +UefiDevicePathLibMandatoryDevicePathProtocolConstructor ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + Status =3D gBS->LocateProtocol ( + &gEfiDevicePathUtilitiesProtocolGuid, + NULL, + (VOID**) &mDevicePathLibDevicePathUtilities + ); + ASSERT_EFI_ERROR (Status); + ASSERT (mDevicePathLibDevicePathUtilities !=3D NULL); + + Status =3D gBS->LocateProtocol ( + &gEfiDevicePathToTextProtocolGuid, + NULL, + (VOID**) &mDevicePathLibDevicePathToText + ); + ASSERT_EFI_ERROR (Status); + ASSERT (mDevicePathLibDevicePathToText !=3D NULL); + + Status =3D gBS->LocateProtocol ( + &gEfiDevicePathFromTextProtocolGuid, + NULL, + (VOID**) &mDevicePathLibDevicePathFromText + ); + ASSERT_EFI_ERROR (Status); + ASSERT (mDevicePathLibDevicePathFromText !=3D NULL); + + return Status; +} + +/** + Returns the size of a device path in bytes. + + This function returns the size, in bytes, of the device path data struct= ure + specified by DevicePath including the end of device path node. + If DevicePath is NULL or invalid, then 0 is returned. + + @param DevicePath A pointer to a device path data structure. + + @retval 0 If DevicePath is NULL or invalid. + @retval Others The size of a device path in bytes. + +**/ +UINTN +EFIAPI +GetDevicePathSize ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath + ) +{ + if (mDevicePathLibDevicePathUtilities !=3D NULL) { + return mDevicePathLibDevicePathUtilities->GetDevicePathSize (DevicePat= h); + } + + ASSERT (FALSE); + return 0; +} + +/** + Creates a new copy of an existing device path. + + This function allocates space for a new copy of the device path specifie= d by DevicePath. + If DevicePath is NULL, then NULL is returned. If the memory is successf= ully + allocated, then the contents of DevicePath are copied to the newly alloc= ated + buffer, and a pointer to that buffer is returned. Otherwise, NULL is re= turned. + The memory for the new device path is allocated from EFI boot services m= emory. + It is the responsibility of the caller to free the memory allocated. + + @param DevicePath A pointer to a device path data structure. + + @retval NULL DevicePath is NULL or invalid. + @retval Others A pointer to the duplicated device path. + +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +DuplicateDevicePath ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath + ) +{ + if (mDevicePathLibDevicePathUtilities !=3D NULL) { + return mDevicePathLibDevicePathUtilities->DuplicateDevicePath (DeviceP= ath); + } + + ASSERT (FALSE); + return NULL; +} + +/** + Creates a new device path by appending a second device path to a first d= evice path. + + This function creates a new device path by appending a copy of SecondDev= icePath + to a copy of FirstDevicePath in a newly allocated buffer. Only the end-= of-device-path + device node from SecondDevicePath is retained. The newly created device = path is + returned. If FirstDevicePath is NULL, then it is ignored, and a duplicat= e of + SecondDevicePath is returned. If SecondDevicePath is NULL, then it is i= gnored, + and a duplicate of FirstDevicePath is returned. If both FirstDevicePath = and + SecondDevicePath are NULL, then a copy of an end-of-device-path is retur= ned. + + If there is not enough memory for the newly allocated buffer, then NULL = is returned. + The memory for the new device path is allocated from EFI boot services m= emory. + It is the responsibility of the caller to free the memory allocated. + + @param FirstDevicePath A pointer to a device path data struc= ture. + @param SecondDevicePath A pointer to a device path data struc= ture. + + @retval NULL If there is not enough memory for the newly allocated = buffer. + @retval NULL If FirstDevicePath or SecondDevicePath is invalid. + @retval Others A pointer to the new device path if success. + Or a copy an end-of-device-path if both FirstDevicePat= h and SecondDevicePath are NULL. + +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +AppendDevicePath ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *FirstDevicePath, OPTIONAL + IN CONST EFI_DEVICE_PATH_PROTOCOL *SecondDevicePath OPTIONAL + ) +{ + if (mDevicePathLibDevicePathUtilities !=3D NULL) { + return mDevicePathLibDevicePathUtilities->AppendDevicePath (FirstDevic= ePath, SecondDevicePath); + } + + ASSERT (FALSE); + return NULL; +} + +/** + Creates a new path by appending the device node to the device path. + + This function creates a new device path by appending a copy of the devic= e node + specified by DevicePathNode to a copy of the device path specified by De= vicePath + in an allocated buffer. The end-of-device-path device node is moved afte= r the + end of the appended device node. + If DevicePathNode is NULL then a copy of DevicePath is returned. + If DevicePath is NULL then a copy of DevicePathNode, followed by an end-= of-device + path device node is returned. + If both DevicePathNode and DevicePath are NULL then a copy of an end-of-= device-path + device node is returned. + If there is not enough memory to allocate space for the new device path,= then + NULL is returned. + The memory is allocated from EFI boot services memory. It is the respons= ibility + of the caller to free the memory allocated. + + @param DevicePath A pointer to a device path data struc= ture. + @param DevicePathNode A pointer to a single device path nod= e. + + @retval NULL If there is not enough memory for the new device path. + @retval Others A pointer to the new device path if success. + A copy of DevicePathNode followed by an end-of-device-= path node + if both FirstDevicePath and SecondDevicePath are NULL. + A copy of an end-of-device-path node if both FirstDevi= cePath + and SecondDevicePath are NULL. + +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +AppendDevicePathNode ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL + ) +{ + if (mDevicePathLibDevicePathUtilities !=3D NULL) { + return mDevicePathLibDevicePathUtilities->AppendDeviceNode (DevicePath= , DevicePathNode); + } + + ASSERT (FALSE); + return NULL; +} + +/** + Creates a new device path by appending the specified device path instanc= e to the specified device + path. + + This function creates a new device path by appending a copy of the devic= e path + instance specified by DevicePathInstance to a copy of the device path sp= ecified + by DevicePath in a allocated buffer. + The end-of-device-path device node is moved after the end of the appende= d device + path instance and a new end-of-device-path-instance node is inserted bet= ween. + If DevicePath is NULL, then a copy if DevicePathInstance is returned. + If DevicePathInstance is NULL, then NULL is returned. + If DevicePath or DevicePathInstance is invalid, then NULL is returned. + If there is not enough memory to allocate space for the new device path,= then + NULL is returned. + The memory is allocated from EFI boot services memory. It is the respons= ibility + of the caller to free the memory allocated. + + @param DevicePath A pointer to a device path data struc= ture. + @param DevicePathInstance A pointer to a device path instance. + + @return A pointer to the new device path. + +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +AppendDevicePathInstance ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, OPTIONAL + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathInstance OPTIONAL + ) +{ + if (mDevicePathLibDevicePathUtilities !=3D NULL) { + return mDevicePathLibDevicePathUtilities->AppendDevicePathInstance (De= vicePath, DevicePathInstance); + } + + ASSERT (FALSE); + return NULL; +} + +/** + Creates a copy of the current device path instance and returns a pointer= to the next device path + instance. + + This function creates a copy of the current device path instance. It als= o updates + DevicePath to point to the next device path instance in the device path = (or NULL + if no more) and updates Size to hold the size of the device path instanc= e copy. + If DevicePath is NULL, then NULL is returned. + If DevicePath points to a invalid device path, then NULL is returned. + If there is not enough memory to allocate space for the new device path,= then + NULL is returned. + The memory is allocated from EFI boot services memory. It is the respons= ibility + of the caller to free the memory allocated. + If Size is NULL, then ASSERT(). + + @param DevicePath On input, this holds the pointer to t= he current + device path instance. On output, this= holds + the pointer to the next device path i= nstance + or NULL if there are no more device p= ath + instances in the device path pointer = to a + device path data structure. + @param Size On output, this holds the size of the= device + path instance, in bytes or zero, if D= evicePath + is NULL. + + @return A pointer to the current device path instance. + +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +GetNextDevicePathInstance ( + IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath, + OUT UINTN *Size + ) +{ + if (mDevicePathLibDevicePathUtilities !=3D NULL) { + return mDevicePathLibDevicePathUtilities->GetNextDevicePathInstance (D= evicePath, Size); + } + + ASSERT (FALSE); + return NULL; +} + +/** + Creates a device node. + + This function creates a new device node in a newly allocated buffer of s= ize + NodeLength and initializes the device path node header with NodeType and= NodeSubType. + The new device path node is returned. + If NodeLength is smaller than a device path header, then NULL is returne= d. + If there is not enough memory to allocate space for the new device path,= then + NULL is returned. + The memory is allocated from EFI boot services memory. It is the respons= ibility + of the caller to free the memory allocated. + + @param NodeType The device node type for the new devi= ce node. + @param NodeSubType The device node sub-type for the new = device node. + @param NodeLength The length of the new device node. + + @return The new device path. + +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +CreateDeviceNode ( + IN UINT8 NodeType, + IN UINT8 NodeSubType, + IN UINT16 NodeLength + ) +{ + if (mDevicePathLibDevicePathUtilities !=3D NULL) { + return mDevicePathLibDevicePathUtilities->CreateDeviceNode (NodeType, = NodeSubType, NodeLength); + } + + ASSERT (FALSE); + return NULL; +} + +/** + Determines if a device path is single or multi-instance. + + This function returns TRUE if the device path specified by DevicePath is + multi-instance. + Otherwise, FALSE is returned. + If DevicePath is NULL or invalid, then FALSE is returned. + + @param DevicePath A pointer to a device path data struc= ture. + + @retval TRUE DevicePath is multi-instance. + @retval FALSE DevicePath is not multi-instance, or = DevicePath + is NULL or invalid. + +**/ +BOOLEAN +EFIAPI +IsDevicePathMultiInstance ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath + ) +{ + if (mDevicePathLibDevicePathUtilities !=3D NULL) { + return mDevicePathLibDevicePathUtilities->IsDevicePathMultiInstance (D= evicePath); + } + + ASSERT (FALSE); + return FALSE; +} + +/** + Converts a device node to its string representation. + + @param DeviceNode A Pointer to the device node to be converted. + @param DisplayOnly If DisplayOnly is TRUE, then the shorter text r= epresentation + of the display node is used, where applicable. = If DisplayOnly + is FALSE, then the longer text representation o= f the display node + is used. + @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut fo= rms of text + representation for a device node can be used, w= here applicable. + + @return A pointer to the allocated text representation of the device nod= e or NULL if DeviceNode + is NULL or there was insufficient memory. + +**/ +CHAR16 * +EFIAPI +ConvertDeviceNodeToText ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DeviceNode, + IN BOOLEAN DisplayOnly, + IN BOOLEAN AllowShortcuts + ) +{ + if (mDevicePathLibDevicePathToText !=3D NULL) { + return mDevicePathLibDevicePathToText->ConvertDeviceNodeToText (Device= Node, DisplayOnly, AllowShortcuts); + } + + ASSERT (FALSE); + return NULL; +} + +/** + Converts a device path to its text representation. + + @param DevicePath A Pointer to the device to be converted. + @param DisplayOnly If DisplayOnly is TRUE, then the shorter text rep= resentation + of the display node is used, where applicable. If= DisplayOnly + is FALSE, then the longer text representation of = the display node + is used. + @param AllowShortcuts If AllowShortcuts is TRUE, then the shortcut form= s of text + representation for a device node can be used, whe= re applicable. + + @return A pointer to the allocated text representation of the device pat= h or + NULL if DeviceNode is NULL or there was insufficient memory. + +**/ +CHAR16 * +EFIAPI +ConvertDevicePathToText ( + IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, + IN BOOLEAN DisplayOnly, + IN BOOLEAN AllowShortcuts + ) +{ + if (mDevicePathLibDevicePathToText !=3D NULL) { + return mDevicePathLibDevicePathToText->ConvertDevicePathToText (Device= Path, DisplayOnly, AllowShortcuts); + } + + ASSERT (FALSE); + return NULL; +} + +/** + Convert text to the binary representation of a device node. + + @param TextDeviceNode TextDeviceNode points to the text representation = of a device + node. Conversion starts with the first character = and continues + until the first non-device node character. + + @return A pointer to the EFI device node or NULL if TextDeviceNode is NU= LL or there was + insufficient memory or text unsupported. + +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +ConvertTextToDeviceNode ( + IN CONST CHAR16 *TextDeviceNode + ) +{ + if (mDevicePathLibDevicePathFromText !=3D NULL) { + return mDevicePathLibDevicePathFromText->ConvertTextToDeviceNode (Text= DeviceNode); + } + + ASSERT (FALSE); + return NULL; +} + +/** + Convert text to the binary representation of a device path. + + + @param TextDevicePath TextDevicePath points to the text representation = of a device + path. Conversion starts with the first character = and continues + until the first non-device node character. + + @return A pointer to the allocated device path or NULL if TextDeviceNode= is NULL or + there was insufficient memory. + +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +ConvertTextToDevicePath ( + IN CONST CHAR16 *TextDevicePath + ) +{ + if (mDevicePathLibDevicePathFromText !=3D NULL) { + return mDevicePathLibDevicePathFromText->ConvertTextToDevicePath (Text= DevicePath); + } + + ASSERT (FALSE); + return NULL; +} + diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibMandatoryDev= icePathProtocol.inf b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibMan= datoryDevicePathProtocol.inf new file mode 100644 index 0000000000..eb545d4601 --- /dev/null +++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibMandatoryDevicePath= Protocol.inf @@ -0,0 +1,86 @@ +## @file +# Instance of Device Path Library based on Device Path Protocol. +# +# Device Path Library that layers on top of the UEFI 2.0 Device Path Prot= ocol. +# If the DevicePathFromText/DevicePathToText protocol doesn't exist, the = library +# uses its internal conversion logic. +# +# Copyright (c) 2019, Intel Corporation. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D UefiDevicePathLibMandatoryDevicePathP= rotocol + MODULE_UNI_FILE =3D UefiDevicePathLibMandatoryDevicePathP= rotocol.uni + FILE_GUID =3D 5A8389AF-DAE4-407E-8FD5-D026948BC579 + MODULE_TYPE =3D UEFI_DRIVER + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D DevicePathLib|DXE_DRIVER DXE_RUNTIME_= DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE + + CONSTRUCTOR =3D UefiDevicePathLibMandatoryDevicePathP= rotocolConstructor + +# +# VALID_ARCHITECTURES =3D IA32 X64 EBC +# + +[Sources] + DevicePathUtilities.c + DevicePathToText.c + DevicePathFromText.c + UefiDevicePathLibMandatoryDevicePathProtocol.c + UefiDevicePathLib.h + +[Packages] + MdePkg/MdePkg.dec + + +[LibraryClasses] + BaseLib + UefiBootServicesTableLib + MemoryAllocationLib + DebugLib + BaseMemoryLib + PcdLib + PrintLib + +[Guids] + ## SOMETIMES_CONSUMES ## GUID + gEfiVTUTF8Guid + ## SOMETIMES_CONSUMES ## GUID + gEfiVT100Guid + ## SOMETIMES_CONSUMES ## GUID + gEfiVT100PlusGuid + ## SOMETIMES_CONSUMES ## GUID + gEfiPcAnsiGuid + ## SOMETIMES_CONSUMES ## GUID + gEfiUartDevicePathGuid + ## SOMETIMES_CONSUMES ## GUID + gEfiSasDevicePathGuid + ## SOMETIMES_CONSUMES ## GUID + gEfiVirtualDiskGuid + ## SOMETIMES_CONSUMES ## GUID + gEfiVirtualCdGuid + ## SOMETIMES_CONSUMES ## GUID + gEfiPersistentVirtualDiskGuid + ## SOMETIMES_CONSUMES ## GUID + gEfiPersistentVirtualCdGuid + +[Protocols] + gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMES + gEfiDevicePathUtilitiesProtocolGuid ## CONSUMES + gEfiDevicePathToTextProtocolGuid ## SOMETIMES_CONSUMES + gEfiDevicePathFromTextProtocolGuid ## SOMETIMES_CONSUMES + gEfiDebugPortProtocolGuid ## UNDEFINED + +[Pcd] + gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount ## SOMETIMES_CONS= UMES + +[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DX= E_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER] + gEfiDevicePathUtilitiesProtocolGuid AND + gEfiDevicePathToTextProtocolGuid AND + gEfiDevicePathFromTextProtocolGuid + diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibMandatoryDev= icePathProtocol.uni b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibMan= datoryDevicePathProtocol.uni new file mode 100644 index 0000000000..070f0add9f --- /dev/null +++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibMandatoryDevicePath= Protocol.uni @@ -0,0 +1,18 @@ +// /** @file +// Instance of Device Path Library based on Device Path Protocol. +// +// Device Path Library that layers on top of the UEFI 2.0 Device Path Prot= ocol. +// If the DevicePathFromText/DevicePathToText protocol doesn't exist, the = library +// uses its internal conversion logic. +// +// Copyright (c) 2013 - 2014, Intel Corporation. All rights reserved.
+// +// SPDX-License-Identifier: BSD-2-Clause-Patent +// +// **/ + + +#string STR_MODULE_ABSTRACT #language en-US "Instance of Devic= e Path Library based on Device Path Protocol." + +#string STR_MODULE_DESCRIPTION #language en-US "Instance of Devic= e Path Library based on Device Path Protocol." + diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevi= cePathProtocol.c b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOption= alDevicePathProtocol.c index 106ff245cc..68b4abfa2d 100644 --- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathP= rotocol.c +++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathP= rotocol.c @@ -8,7 +8,7 @@ environment varibles. Multi-instance device paths should never be placed on a Handle. =20 - Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent =20 **/ @@ -21,8 +21,7 @@ GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_TO_TEXT_PRO= TOCOL *mDevicePathLib GLOBAL_REMOVE_IF_UNREFERENCED EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *mDeviceP= athLibDevicePathFromText =3D NULL; =20 /** - The constructor function caches the pointer to DevicePathUtilites protoc= ol, - DevicePathToText protocol and DevicePathFromText protocol. + The constructor function caches the pointer to DevicePathUtilites protoc= ol. =20 The constructor function locates these three protocols from protocol dat= abase. It will caches the pointer to local protocol instance if that operation = fails @@ -48,8 +47,6 @@ UefiDevicePathLibOptionalDevicePathProtocolConstructor ( NULL, (VOID**) &mDevicePathLibDevicePathUtilities ); - ASSERT_EFI_ERROR (Status); - ASSERT (mDevicePathLibDevicePathUtilities !=3D NULL); return Status; } =20 diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevi= cePathProtocol.inf b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOpti= onalDevicePathProtocol.inf index e812e3e1d4..d194300bde 100644 --- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathP= rotocol.inf +++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathP= rotocol.inf @@ -5,7 +5,7 @@ # If the DevicePathFromText/DevicePathToText protocol doesn't exist, the = library # uses its internal conversion logic. # -# Copyright (c) 2013 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2013 - 2019, Intel Corporation. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -79,6 +79,3 @@ [Pcd] gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount ## SOMETIMES_CONS= UMES =20 -[Depex.common.DXE_DRIVER, Depex.common.DXE_RUNTIME_DRIVER, Depex.common.DX= E_SAL_DRIVER, Depex.common.DXE_SMM_DRIVER] - gEfiDevicePathUtilitiesProtocolGuid - --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#51425): https://edk2.groups.io/g/devel/message/51425 Mute This Topic: https://groups.io/mt/63579361/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- From nobody Fri Apr 26 09:23:17 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+51426+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51426+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1574907344; cv=none; d=zohomail.com; s=zohoarc; b=KtO1xYhG26yqUYg8QDl8ZsysbqYTAM6/bBE7k9WVoddLepLqfElwAejfRGgENnbDvNxrVcGX2zTcwKRb7nZbNAJdWml0FsObpy4NIPwE1tBedRp/fMHoTQ/zgqdyo8TZrFQR4vNao2heYK6mHg8r0Z80kLeBbv/u5p28fTkU8hw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1574907344; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=mYDjglDEmvuQESEDjC9RwX89139zLt/30jowagfAQdE=; b=CM/sKewPLlA+8sHz0D7+5eyyiZrsdMROycgznu79kZXGoXXbKgt5bebP+WPOi9s+l7EsHLzqmCzXLL/g0bScgdv79wqjV0Z03wgarAKGMrB+X631zyXK3bcEokNVn/wNAJxfkkdrOmp34bfmUptGK6k0dnxSgQngb+Ks2VGsA7s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+51426+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1574907344373318.6757907997031; Wed, 27 Nov 2019 18:15:44 -0800 (PST) Return-Path: X-Received: by 127.0.0.2 with SMTP id xEoMYY1788612xVNq1nUhqso; Wed, 27 Nov 2019 18:15:43 -0800 X-Received: from mga09.intel.com (mga09.intel.com []) by mx.groups.io with SMTP id smtpd.web11.1538.1574907341255349227 for ; Wed, 27 Nov 2019 18:15:43 -0800 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Nov 2019 18:15:43 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.69,251,1571727600"; d="scan'208";a="240551891" X-Received: from fieedk001.ccr.corp.intel.com ([10.239.33.119]) by fmsmga002.fm.intel.com with ESMTP; 27 Nov 2019 18:15:42 -0800 From: "Gao, Zhichao" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao , Vitaly Cheptsov Subject: [edk2-devel] [PATCH 2/2] MdePkg/dsc: Add UefiDevicePathLibMandatoryDevicePathProtocol for build Date: Thu, 28 Nov 2019 10:15:29 +0800 Message-Id: <20191128021530.11564-3-zhichao.gao@intel.com> In-Reply-To: <20191128021530.11564-1-zhichao.gao@intel.com> References: <20191128021530.11564-1-zhichao.gao@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhichao.gao@intel.com X-Gm-Message-State: 7OUzJ54UtiZfQ8L2RKbUlT3jx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1574907343; bh=vihFxUnj4CwhJaz7FV55j8/C7cblPpNCGSAYrgqameg=; h=Cc:Date:From:Reply-To:Subject:To; b=CeT9AfIakZg/GMbzUVL8byS6MULPi9p6nQRz3XevZAOw0JzJev7wrx+v8DPGo6iH+RB qkX+2zFfdpw6WHRqubZggdD/QB2HJUB1lokygzNoJ65AUriM3CziE0PJS4td6tdrikDSj nFNeRLzbSc+yPX0MxdJH7XnuPb3BmWUQeKo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2298 Add the new instance lib for build. Cc: Michael D Kinney Cc: Liming Gao Cc: Vitaly Cheptsov Signed-off-by: Zhichao Gao --- MdePkg/MdePkg.dsc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc index 0aeafaaacc..9e9813dd27 100644 --- a/MdePkg/MdePkg.dsc +++ b/MdePkg/MdePkg.dsc @@ -1,7 +1,7 @@ ## @file # EFI/PI MdePkg Package # -# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
# # SPDX-License-Identifier: BSD-2-Clause-Patent @@ -99,6 +99,7 @@ MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProt= ocol.inf + MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibMandatoryDevicePathPro= tocol.inf MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDevi= cePathProtocol.inf MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf MdePkg/Library/UefiLib/UefiLib.inf --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#51426): https://edk2.groups.io/g/devel/message/51426 Mute This Topic: https://groups.io/mt/63579380/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-