]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c
MdePkg: UefiDevicePathLib: Support UefiDevicePathLib under StandaloneMm
[mirror_edk2.git] / MdePkg / Library / UefiDevicePathLib / DevicePathUtilitiesDxeSmm.c
CommitLineData
14a746bb
KQ
1/** @file\r
2 Device Path services. The thing to remember is device paths are built out of\r
3 nodes. The device path is terminated by an end node that is length\r
4 sizeof(EFI_DEVICE_PATH_PROTOCOL). That would be why there is sizeof(EFI_DEVICE_PATH_PROTOCOL)\r
5 all over this file.\r
6\r
7 The only place where multi-instance device paths are supported is in\r
8 environment varibles. Multi-instance device paths should never be placed\r
9 on a Handle.\r
10\r
11 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
12 Copyright (c) Microsoft Corporation.\r
13 SPDX-License-Identifier: BSD-2-Clause-Patent\r
14\r
15**/\r
16\r
17#include "UefiDevicePathLib.h"\r
18\r
19\r
20/**\r
21 Retrieves the device path protocol from a handle.\r
22\r
23 This function returns the device path protocol from the handle specified by Handle.\r
24 If Handle is NULL or Handle does not contain a device path protocol, then NULL\r
25 is returned.\r
26\r
27 @param Handle The handle from which to retrieve the device\r
28 path protocol.\r
29\r
30 @return The device path protocol from the handle specified by Handle.\r
31\r
32**/\r
33EFI_DEVICE_PATH_PROTOCOL *\r
34EFIAPI\r
35DevicePathFromHandle (\r
36 IN EFI_HANDLE Handle\r
37 )\r
38{\r
39 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
40 EFI_STATUS Status;\r
41\r
42 Status = gBS->HandleProtocol (\r
43 Handle,\r
44 &gEfiDevicePathProtocolGuid,\r
45 (VOID *) &DevicePath\r
46 );\r
47 if (EFI_ERROR (Status)) {\r
48 DevicePath = NULL;\r
49 }\r
50 return DevicePath;\r
51}\r