From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (NAM10-MW2-obe.outbound.protection.outlook.com [40.92.42.19]) by mx.groups.io with SMTP id smtpd.web09.4371.1610421999524265134 for ; Mon, 11 Jan 2021 19:26:39 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@outlook.com header.s=selector1 header.b=atthWIwB; spf=pass (domain: outlook.com, ip: 40.92.42.19, mailfrom: kun.q@outlook.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XBK4tu6UHoUMPoT3sPPoOM7+6yD4+pmf1sSuOPsKXfT4VylekF2gn4iHy6pg2OMvG/YFmPiDiSVrwkBtA6LSqEVQvaW8GYazjrfCHfRHcZJi9ImQ5Daa7UvuxFyJ0kGtrkk04DnCBA46EyCqEEWuwDtqL8OjBhueBrb9jvlMnf7QXZ9UXwY1M1Rgvv5BZiRxMsijyik9vGo/IgANNS2muAbYhEDIYrNyBlkJOioGl5FX0HsfppYZAhGfQwjW6DWo4XQzvk0zNSRHlSDoMV3FTInwP+8WZLmXtldJ4RpG1LonjjdRZpJ1Y6Y6lwZZYnYW2iJvzoZ3kc9yUcrijR+4/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nKCRZmapYxSjpixLI7FuLzeIRGQPuAl7YhsAG3C8+kk=; b=HX1XU6My8/xVicmapUwy/guG5ekqxG8eKbomoj8w268/gCJJ6omx/27+uGk4T1bmlnZ3f9R6N5OfWuIruNjESEKbVix4TqE6xnkznL9oUuzKhfSkkEJdm/Gt42vMYxVthH0R1wYfksAjKgMCrKduNZlgp67Joxhhz/w9i3xUEsFM8R8xXuM1VPefEONFBtBwU/YXR4Re1BS/6zH2GnrcRBpoEc4JPcftNgeSnW8uzLUz6Flzs7eulN/dAMRP11uif0X5wVoZOnu2zHnn4Sc1nU8f6XLaZ9J29egnprqHYOWB6GaYo6JVvt6JaegjfrL+/3On4ouIxs1g7eI0/vrp8A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nKCRZmapYxSjpixLI7FuLzeIRGQPuAl7YhsAG3C8+kk=; b=atthWIwBNJ+cpsfnes5w87DlCcw8tXpeZ7n1Aw43cdUJt7f92VrCCNBW2O5Cm3WiNHlIRvgjVmoaCeSDNyN4UesPFNCrfok4/0zSMS7GJxF2z50/EzH4knqN5fr78tO7kbkaiR6BlRPU57t8i4W0LFB8ciCtJmYQmybY7WuU/rmO9Is6aVlM6LRUemYCxhKvPgmVwNjxOrNdZvPnWxHIQbdstbnqmxaNDugf7LZNrOZXfz7hdkGizkYXd9pnB4LzupV83QCitNQ6b5nMyYzcwT4EZbUzmPPEKQZ09nRovgAL5TyItqjnT0x7vtYF9RP3hPOltX7B4SsiwGxTB/UowA== Received: from BN7NAM10FT004.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e8f::4c) by BN7NAM10HT022.eop-nam10.prod.protection.outlook.com (2a01:111:e400:7e8f::418) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.9; Tue, 12 Jan 2021 03:26:38 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com (2a01:111:e400:7e8f::47) by BN7NAM10FT004.mail.protection.outlook.com (2a01:111:e400:7e8f::414) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3742.9 via Frontend Transport; Tue, 12 Jan 2021 03:26:38 +0000 Received: from MWHPR06MB3102.namprd06.prod.outlook.com ([fe80::acb3:ab69:563d:b0d6]) by MWHPR06MB3102.namprd06.prod.outlook.com ([fe80::acb3:ab69:563d:b0d6%5]) with mapi id 15.20.3742.012; Tue, 12 Jan 2021 03:26:38 +0000 From: "Kun Qin" To: "devel@edk2.groups.io" , Michael D Kinney , 'Liming Gao' , Zhiguang Liu Subject: Re: [edk2-devel] [PATCH v2 10/16] MdePkg: UefiDevicePathLib: Support UefiDevicePathLib under StandaloneMm Thread-Topic: [edk2-devel] [PATCH v2 10/16] MdePkg: UefiDevicePathLib: Support UefiDevicePathLib under StandaloneMm Thread-Index: AQHW45T6TLjFBErIgU2t/CvRnx721qojXbUP Date: Tue, 12 Jan 2021 03:26:37 +0000 Message-ID: References: <20210105185935.3769-1-kun.q@outlook.com>,<16576B256B69BE5C.24224@groups.io> In-Reply-To: <16576B256B69BE5C.24224@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-incomingtopheadermarker: OriginalChecksum:807CD2577C9D56FE32E072B7DC899060241C17DF3958CB771B58E078A44D4E00;UpperCasedChecksum:D4EFB31EEE58FD306BF73A2077AED698038B585768C3FDFBCF270730950FBA1E;SizeAsReceived:7032;Count:43 x-tmn: [5RkgWXGeJx8sHEsCrn003cp6oRyWmu2U] x-ms-publictraffictype: Email x-incomingheadercount: 43 x-eopattributedmessage: 0 x-ms-office365-filtering-correlation-id: 6d5dd881-9742-4f3c-afea-08d8b6a9df17 x-ms-traffictypediagnostic: BN7NAM10HT022: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: prkYmncYdp4LAJb1JQPHSv0upLQzM0rEWyObvC2s2Dh8PriYmsakEumrQWQRiwwrLpNk0PhrODxo2zqzmYg9gjF6czsE5ik8etrWF8c96YBRpJkwXh8a7xMjUJ/XFBAsUncgpm1rsgKhBWzSL3phwlyp4RZoN58Jul4qu2K+OcJuVuVaa5U1klNFq7mcRgswBtTwb4GPT8paAiWOKSk8riRbeePv1n0llzBQLAUEGcLBR7YtgQrcJux7mkghr4calHLBN6IbdFYxlT0KCSDg/kBiRho8L+ysGc8HTCqemVQ= x-ms-exchange-antispam-messagedata: AdyxMe6tGYKXxbkQXd/2r8zOQwfmgSUhzh2JNep0zVfTE76PoPF+uNVBqUSUy4lxNBYjf4XcVTIadnYpq5uMSpVE5ldjQdTnLlAAf62j82M+MqmLqMYnLs21M90FNfkMxn+oE4jW2KdO3X2wTS6kYw== x-ms-exchange-transport-forked: True MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-AuthSource: BN7NAM10FT004.eop-nam10.prod.protection.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: 6d5dd881-9742-4f3c-afea-08d8b6a9df17 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Jan 2021 03:26:37.8116 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN7NAM10HT022 Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_MWHPR06MB310206FC395325A9F1AD0FD3F3AA0MWHPR06MB3102namp_" --_000_MWHPR06MB310206FC395325A9F1AD0FD3F3AA0MWHPR06MB3102namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Michael/Liming/Zhiguang, Do you have any suggestions/feedback on this specific patch? It would be h= elpful if I can coalesce the changes before sending out v3 patch. Thanks in advance. Regards, Kun From: Kun Qin Sent: Tuesday, January 5, 2021 11:00 To: devel@edk2.groups.io Cc: Michael D Kinney; Liming Gao; Zhiguang Liu Subject: [edk2-devel] [PATCH v2 10/16] MdePkg: UefiDevicePathLib: Support = UefiDevicePathLib under StandaloneMm This change added an instance of UefiDevicePathLib for StandaloneMm. It abstracts DevicePathFromHandle function into different files for Standalone MM and other instances to avoid linking gBS into MM_STANDALONE drivers. Cc: Michael D Kinney Cc: Liming Gao Cc: Zhiguang Liu Signed-off-by: Kun Qin --- Notes: v2: - No review, no change. MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c = | 33 ------------- MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c = | 51 ++++++++++++++++++++ MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c = | 40 +++++++++++++++ MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf = | 1 + MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathProto= col.inf | 1 + MdePkg/Library/UefiDevicePathLib/{UefiDevicePathLib.inf =3D> UefiDevicePa= thLibStandaloneMm.inf} | 11 +++-- MdePkg/MdePkg.dsc = | 1 + 7 files changed, 100 insertions(+), 38 deletions(-) diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c b/MdeP= kg/Library/UefiDevicePathLib/DevicePathUtilities.c index 9274ef8dda98..7d5fb18d2516 100644 --- a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c @@ -806,39 +806,6 @@ UefiDevicePathLibIsDevicePathMultiInstance ( } -/** - Retrieves the device path protocol from a handle. - - This function returns the device path protocol from the handle specifie= d by Handle. - If Handle is NULL or Handle does not contain a device path protocol, th= en NULL - is returned. - - @param Handle The handle from which to retrieve th= e device - path protocol. - - @return The device path protocol from the handle specified by Handle. - -**/ -EFI_DEVICE_PATH_PROTOCOL * -EFIAPI -DevicePathFromHandle ( - IN EFI_HANDLE Handle - ) -{ - EFI_DEVICE_PATH_PROTOCOL *DevicePath; - EFI_STATUS Status; - - Status =3D gBS->HandleProtocol ( - Handle, - &gEfiDevicePathProtocolGuid, - (VOID *) &DevicePath - ); - if (EFI_ERROR (Status)) { - DevicePath =3D NULL; - } - return DevicePath; -} - /** Allocates a device path for a file and appends it to an existing device= path. diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c = b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c new file mode 100644 index 000000000000..7f3b6076ef34 --- /dev/null +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c @@ -0,0 +1,51 @@ +/** @file + Device Path services. The thing to remember is device paths are built o= ut 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 place= d + on a Handle. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "UefiDevicePathLib.h" + + +/** + Retrieves the device path protocol from a handle. + + This function returns the device path protocol from the handle specifie= d by Handle. + If Handle is NULL or Handle does not contain a device path protocol, th= en NULL + is returned. + + @param Handle The handle from which to retrieve th= e device + path protocol. + + @return The device path protocol from the handle specified by Handle. + +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +DevicePathFromHandle ( + IN EFI_HANDLE Handle + ) +{ + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + EFI_STATUS Status; + + Status =3D gBS->HandleProtocol ( + Handle, + &gEfiDevicePathProtocolGuid, + (VOID *) &DevicePath + ); + if (EFI_ERROR (Status)) { + DevicePath =3D NULL; + } + return DevicePath; +} diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandalon= eMm.c b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c new file mode 100644 index 000000000000..930e778d373a --- /dev/null +++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c @@ -0,0 +1,40 @@ +/** @file + Device Path services. The thing to remember is device paths are built o= ut 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 place= d + on a Handle. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ Copyright (c) Microsoft Corporation. + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include "UefiDevicePathLib.h" + + +/** + Retrieves the device path protocol from a handle. + + This function returns the device path protocol from the handle specifie= d by Handle. + If Handle is NULL or Handle does not contain a device path protocol, th= en NULL + is returned. + + @param Handle The handle from which to retrieve th= e device + path protocol. + + @return The device path protocol from the handle specified by Handle. + +**/ +EFI_DEVICE_PATH_PROTOCOL * +EFIAPI +DevicePathFromHandle ( + IN EFI_HANDLE Handle + ) +{ + return NULL; +} diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf b/MdeP= kg/Library/UefiDevicePathLib/UefiDevicePathLib.inf index 3c41c0695a72..eb85a54a74c3 100644 --- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf +++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf @@ -26,6 +26,7 @@ [Defines] [Sources] DevicePathUtilities.c + DevicePathUtilitiesDxeSmm.c DevicePathToText.c DevicePathFromText.c UefiDevicePathLib.c diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDev= icePathProtocol.inf b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOpt= ionalDevicePathProtocol.inf index e812e3e1d41e..81323bc70061 100644 --- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePath= Protocol.inf +++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePath= Protocol.inf @@ -29,6 +29,7 @@ [Defines] [Sources] DevicePathUtilities.c + DevicePathUtilitiesDxeSmm.c DevicePathToText.c DevicePathFromText.c UefiDevicePathLibOptionalDevicePathProtocol.c diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf b/MdeP= kg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf similarity index 79% copy from MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf copy to MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf index 3c41c0695a72..23fedf38b7eb 100644 --- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf +++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf @@ -4,6 +4,7 @@ # Device Path Library that layers on top of the Memory Allocation Library= . # # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
+# Copyright (c) Microsoft Corporation. # # SPDX-License-Identifier: BSD-2-Clause-Patent # @@ -14,10 +15,11 @@ [Defines] INF_VERSION =3D 0x00010005 BASE_NAME =3D UefiDevicePathLib MODULE_UNI_FILE =3D UefiDevicePathLib.uni - FILE_GUID =3D 91c1677a-e57f-4191-8b8e-eb7711a716e0 - MODULE_TYPE =3D UEFI_DRIVER + FILE_GUID =3D D8E58437-44D3-4154-B7A7-EB794923EF12 + MODULE_TYPE =3D MM_STANDALONE + PI_SPECIFICATION_VERSION =3D 0x00010032 VERSION_STRING =3D 1.0 - LIBRARY_CLASS =3D DevicePathLib|DXE_CORE DXE_DRIVER DX= E_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER SMM_CORE MM_ST= ANDALONE + LIBRARY_CLASS =3D DevicePathLib | MM_STANDALONE MM_COR= E_STANDALONE # @@ -26,6 +28,7 @@ [Defines] [Sources] DevicePathUtilities.c + DevicePathUtilitiesStandaloneMm.c DevicePathToText.c DevicePathFromText.c UefiDevicePathLib.c @@ -34,7 +37,6 @@ [Sources] [Packages] MdePkg/MdePkg.dec - [LibraryClasses] BaseLib MemoryAllocationLib @@ -71,4 +73,3 @@ [Protocols] [Pcd] gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount ## SOMETIMES_= CONSUMES - diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc index 8d1a5b20c9cd..ce009086815f 100644 --- a/MdePkg/MdePkg.dsc +++ b/MdePkg/MdePkg.dsc @@ -109,6 +109,7 @@ [Components] MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebugPortProto= col.inf MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePathPro= tocol.inf MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevicePathLibDev= icePathProtocol.inf MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf -- 2.30.0.windows.1 --_000_MWHPR06MB310206FC395325A9F1AD0FD3F3AA0MWHPR06MB3102namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

Hi Michael/Liming/Zhiguang,

 

Do you have any suggestions/feedback on this specif= ic patch? It would be helpful if I can coalesce the changes before sending = out v3 patch.

 

Thanks in advance.

 

Regards,

Kun

 

From: Kun Qin
Sent: Tuesday, January 5, 2021 11:00
To: devel@edk2.groups.io
Cc:
Michael D Kinney<= /a>; Liming Gao; Zhiguang Liu=
Subject: [edk2-devel] [PATCH v2 10/16] MdePkg: UefiDevicePathLib: S= upport UefiDevicePathLib under StandaloneMm

 

This change added an= instance of UefiDevicePathLib for StandaloneMm. It
abstracts DevicePathFromHandle function into different files for
Standalone MM and other instances to avoid linking gBS into MM_STANDALONE<= br> drivers.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>

Signed-off-by: Kun Qin <kun.q@outlook.com>
---

Notes:
    v2:
    - No review, no change.

 MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c  &n= bsp;            = ;            &n= bsp;            | 33= -------------
 MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c &n= bsp;            = ;            &n= bsp;       | 51 ++++++++++++++++++++
 MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c&n= bsp;            = ;            &n= bsp;  | 40 +++++++++++++++
 MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf  &n= bsp;            = ;            &n= bsp;            |&nb= sp; 1 +
 MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePath= Protocol.inf          &nb= sp;   |  1 +
 MdePkg/Library/UefiDevicePathLib/{UefiDevicePathLib.inf =3D> Uefi= DevicePathLibStandaloneMm.inf} | 11 +++--
 MdePkg/MdePkg.dsc        &nb= sp;            =             &nb= sp;            =             &nb= sp;            =       |  1 +
 7 files changed, 100 insertions(+), 38 deletions(-)

diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c b/MdeP= kg/Library/UefiDevicePathLib/DevicePathUtilities.c
index 9274ef8dda98..7d5fb18d2516 100644
--- a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilities.c
@@ -806,39 +806,6 @@ UefiDevicePathLibIsDevicePathMultiInstance (
 }
 
 
-/**
-  Retrieves the device path protocol from a handle.
-
-  This function returns the device path protocol from the handle spe= cified by Handle.
-  If Handle is NULL or Handle does not contain a device path protoco= l, then NULL
-  is returned.
-
-  @param  Handle        = ;             T= he handle from which to retrieve the device
-            &= nbsp;           &nbs= p;            path p= rotocol.
-
-  @return The device path protocol from the handle specified by Hand= le.
-
-**/
-EFI_DEVICE_PATH_PROTOCOL *
-EFIAPI
-DevicePathFromHandle (
-  IN EFI_HANDLE         = ;             H= andle
-  )
-{
-  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
-  EFI_STATUS         &n= bsp;      Status;
-
-  Status =3D gBS->HandleProtocol (
-            &= nbsp;     Handle,
-            &= nbsp;     &gEfiDevicePathProtocolGuid,
-            &= nbsp;     (VOID *) &DevicePath
-            &= nbsp;     );
-  if (EFI_ERROR (Status)) {
-    DevicePath =3D NULL;
-  }
-  return DevicePath;
-}
-
 /**
   Allocates a device path for a file and appends it to an exist= ing device path.
 
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c = b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c
new file mode 100644
index 000000000000..7f3b6076ef34
--- /dev/null
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c
@@ -0,0 +1,51 @@
+/** @file
+  Device Path services. The thing to remember is device paths are bu= ilt out 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 sizeo= f(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) 2006 - 2018, Intel Corporation. All rights reserved.= <BR>
+  Copyright (c) Microsoft Corporation.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UefiDevicePathLib.h"
+
+
+/**
+  Retrieves the device path protocol from a handle.
+
+  This function returns the device path protocol from the handle spe= cified by Handle.
+  If Handle is NULL or Handle does not contain a device path protoco= l, then NULL
+  is returned.
+
+  @param  Handle        = ;             T= he handle from which to retrieve the device
+            &= nbsp;           &nbs= p;            path p= rotocol.
+
+  @return The device path protocol from the handle specified by Hand= le.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+EFIAPI
+DevicePathFromHandle (
+  IN EFI_HANDLE         = ;             H= andle
+  )
+{
+  EFI_DEVICE_PATH_PROTOCOL  *DevicePath;
+  EFI_STATUS         &n= bsp;      Status;
+
+  Status =3D gBS->HandleProtocol (
+            &= nbsp;     Handle,
+            &= nbsp;     &gEfiDevicePathProtocolGuid,
+            &= nbsp;     (VOID *) &DevicePath
+            &= nbsp;     );
+  if (EFI_ERROR (Status)) {
+    DevicePath =3D NULL;
+  }
+  return DevicePath;
+}
diff --git a/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandalon= eMm.c b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c<= br> new file mode 100644
index 000000000000..930e778d373a
--- /dev/null
+++ b/MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesStandaloneMm.c @@ -0,0 +1,40 @@
+/** @file
+  Device Path services. The thing to remember is device paths are bu= ilt out 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 sizeo= f(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) 2006 - 2018, Intel Corporation. All rights reserved.= <BR>
+  Copyright (c) Microsoft Corporation.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include "UefiDevicePathLib.h"
+
+
+/**
+  Retrieves the device path protocol from a handle.
+
+  This function returns the device path protocol from the handle spe= cified by Handle.
+  If Handle is NULL or Handle does not contain a device path protoco= l, then NULL
+  is returned.
+
+  @param  Handle        = ;             T= he handle from which to retrieve the device
+            &= nbsp;           &nbs= p;            path p= rotocol.
+
+  @return The device path protocol from the handle specified by Hand= le.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+EFIAPI
+DevicePathFromHandle (
+  IN EFI_HANDLE         = ;             H= andle
+  )
+{
+  return NULL;
+}
diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf b/MdeP= kg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
index 3c41c0695a72..eb85a54a74c3 100644
--- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
@@ -26,6 +26,7 @@ [Defines]
 
 [Sources]
   DevicePathUtilities.c
+  DevicePathUtilitiesDxeSmm.c
   DevicePathToText.c
   DevicePathFromText.c
   UefiDevicePathLib.c
diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDev= icePathProtocol.inf b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOpt= ionalDevicePathProtocol.inf
index e812e3e1d41e..81323bc70061 100644
--- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePath= Protocol.inf
+++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDevicePath= Protocol.inf
@@ -29,6 +29,7 @@ [Defines]
 
 [Sources]
   DevicePathUtilities.c
+  DevicePathUtilitiesDxeSmm.c
   DevicePathToText.c
   DevicePathFromText.c
   UefiDevicePathLibOptionalDevicePathProtocol.c
diff --git a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf b/MdeP= kg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf
similarity index 79%
copy from MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
copy to MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf=
index 3c41c0695a72..23fedf38b7eb 100644
--- a/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+++ b/MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf @@ -4,6 +4,7 @@
 # Device Path Library that layers on top of the Memory Allocation Li= brary.
 #
 # Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.= <BR>
+# Copyright (c) Microsoft Corporation.
 #
 #  SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -14,10 +15,11 @@ [Defines]
   INF_VERSION        &n= bsp;           =3D 0x0001= 0005
   BASE_NAME        &nbs= p;             = = =3D UefiDevicePathLib
   MODULE_UNI_FILE       &nbs= p;        =3D UefiDevicePathLib.uni
-  FILE_GUID         &nb= sp;            =3D 9= 1c1677a-e57f-4191-8b8e-eb7711a716e0
-  MODULE_TYPE         &= nbsp;          =3D UEFI_DRIVER=
+  FILE_GUID         &nb= sp;            =3D D= 8E58437-44D3-4154-B7A7-EB794923EF12
+  MODULE_TYPE         &= nbsp;          =3D MM_STANDALO= NE
+  PI_SPECIFICATION_VERSION       =3D 0= x00010032
   VERSION_STRING        = ;         =3D 1.0
-  LIBRARY_CLASS         = ;         =3D DevicePathLib|DXE_COR= E DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_DRIVER UEFI_APPLICATION UEFI_DRIVER= SMM_CORE MM_STANDALONE
+  LIBRARY_CLASS         = ;         =3D DevicePathLib | MM_ST= ANDALONE MM_CORE_STANDALONE
 
 
 #
@@ -26,6 +28,7 @@ [Defines]
 
 [Sources]
   DevicePathUtilities.c
+  DevicePathUtilitiesStandaloneMm.c
   DevicePathToText.c
   DevicePathFromText.c
   UefiDevicePathLib.c
@@ -34,7 +37,6 @@ [Sources]
 [Packages]
   MdePkg/MdePkg.dec
 
-
 [LibraryClasses]
   BaseLib
   MemoryAllocationLib
@@ -71,4 +73,3 @@ [Protocols]
 
 [Pcd]
   gEfiMdePkgTokenSpaceGuid.PcdMaximumDevicePathNodeCount &= nbsp;  ## SOMETIMES_CONSUMES
-
diff --git a/MdePkg/MdePkg.dsc b/MdePkg/MdePkg.dsc
index 8d1a5b20c9cd..ce009086815f 100644
--- a/MdePkg/MdePkg.dsc
+++ b/MdePkg/MdePkg.dsc
@@ -109,6 +109,7 @@ [Components]
   MdePkg/Library/UefiDebugLibDebugPortProtocol/UefiDebugLibDebu= gPortProtocol.inf
   MdePkg/Library/UefiDebugLibStdErr/UefiDebugLibStdErr.inf
   MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
+  MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibStandaloneMm.inf=
   MdePkg/Library/UefiDevicePathLib/UefiDevicePathLibOptionalDev= icePathProtocol.inf
   MdePkg/Library/UefiDevicePathLibDevicePathProtocol/UefiDevice= PathLibDevicePathProtocol.inf
   MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf<= br> --
2.30.0.windows.1





 

--_000_MWHPR06MB310206FC395325A9F1AD0FD3F3AA0MWHPR06MB3102namp_--