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