]>
Commit | Line | Data |
---|---|---|
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 | |
14a746bb KQ |
19 | /**\r |
20 | Retrieves the device path protocol from a handle.\r | |
21 | \r | |
22 | This function returns the device path protocol from the handle specified by Handle.\r | |
23 | If Handle is NULL or Handle does not contain a device path protocol, then NULL\r | |
24 | is returned.\r | |
25 | \r | |
26 | @param Handle The handle from which to retrieve the device\r | |
27 | path protocol.\r | |
28 | \r | |
29 | @return The device path protocol from the handle specified by Handle.\r | |
30 | \r | |
31 | **/\r | |
32 | EFI_DEVICE_PATH_PROTOCOL *\r | |
33 | EFIAPI\r | |
34 | DevicePathFromHandle (\r | |
2f88bd3a | 35 | IN EFI_HANDLE Handle\r |
14a746bb KQ |
36 | )\r |
37 | {\r | |
38 | EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r | |
39 | EFI_STATUS Status;\r | |
40 | \r | |
41 | Status = gBS->HandleProtocol (\r | |
42 | Handle,\r | |
43 | &gEfiDevicePathProtocolGuid,\r | |
2f88bd3a | 44 | (VOID *)&DevicePath\r |
14a746bb KQ |
45 | );\r |
46 | if (EFI_ERROR (Status)) {\r | |
47 | DevicePath = NULL;\r | |
48 | }\r | |
2f88bd3a | 49 | \r |
14a746bb KQ |
50 | return DevicePath;\r |
51 | }\r |