]>
Commit | Line | Data |
---|---|---|
1 | /** @file\r | |
2 | Device Path Driver to produce DevPathUtilities Protocol, DevPathFromText Protocol\r | |
3 | and DevPathToText Protocol.\r | |
4 | \r | |
5 | Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r | |
6 | This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #include <Uefi.h>\r | |
17 | #include <Protocol/DevicePathUtilities.h>\r | |
18 | #include <Protocol/DevicePathToText.h>\r | |
19 | #include <Protocol/DevicePathFromText.h>\r | |
20 | #include <Library/UefiDriverEntryPoint.h>\r | |
21 | #include <Library/UefiBootServicesTableLib.h>\r | |
22 | #include <Library/DevicePathLib.h>\r | |
23 | #include <Library/PcdLib.h>\r | |
24 | \r | |
25 | GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilities = {\r | |
26 | GetDevicePathSize,\r | |
27 | DuplicateDevicePath,\r | |
28 | AppendDevicePath,\r | |
29 | AppendDevicePathNode,\r | |
30 | AppendDevicePathInstance,\r | |
31 | GetNextDevicePathInstance,\r | |
32 | IsDevicePathMultiInstance,\r | |
33 | CreateDeviceNode\r | |
34 | };\r | |
35 | \r | |
36 | GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToText = {\r | |
37 | ConvertDeviceNodeToText,\r | |
38 | ConvertDevicePathToText\r | |
39 | };\r | |
40 | \r | |
41 | GLOBAL_REMOVE_IF_UNREFERENCED CONST EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromText = {\r | |
42 | ConvertTextToDeviceNode,\r | |
43 | ConvertTextToDevicePath\r | |
44 | };\r | |
45 | \r | |
46 | /**\r | |
47 | The user Entry Point for DevicePath module.\r | |
48 | \r | |
49 | This is the entry point for DevicePath module. It installs the UEFI Device Path Utility Protocol and\r | |
50 | optionally the Device Path to Text and Device Path from Text protocols based on feature flags.\r | |
51 | \r | |
52 | @param[in] ImageHandle The firmware allocated handle for the EFI image.\r | |
53 | @param[in] SystemTable A pointer to the EFI System Table.\r | |
54 | \r | |
55 | @retval EFI_SUCCESS The entry point is executed successfully.\r | |
56 | @retval Others Some error occurs when executing this entry point.\r | |
57 | \r | |
58 | **/\r | |
59 | EFI_STATUS\r | |
60 | EFIAPI\r | |
61 | DevicePathEntryPoint (\r | |
62 | IN EFI_HANDLE ImageHandle,\r | |
63 | IN EFI_SYSTEM_TABLE *SystemTable\r | |
64 | )\r | |
65 | {\r | |
66 | EFI_STATUS Status;\r | |
67 | EFI_HANDLE Handle;\r | |
68 | \r | |
69 | Handle = NULL;\r | |
70 | Status = EFI_UNSUPPORTED;\r | |
71 | if (FeaturePcdGet (PcdDevicePathSupportDevicePathToText)) {\r | |
72 | if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {\r | |
73 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
74 | &Handle,\r | |
75 | &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,\r | |
76 | &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,\r | |
77 | &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,\r | |
78 | NULL\r | |
79 | );\r | |
80 | } else {\r | |
81 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
82 | &Handle,\r | |
83 | &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,\r | |
84 | &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,\r | |
85 | NULL\r | |
86 | );\r | |
87 | }\r | |
88 | } else {\r | |
89 | if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {\r | |
90 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
91 | &Handle,\r | |
92 | &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,\r | |
93 | &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,\r | |
94 | NULL\r | |
95 | );\r | |
96 | } else {\r | |
97 | Status = gBS->InstallMultipleProtocolInterfaces (\r | |
98 | &Handle,\r | |
99 | &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,\r | |
100 | NULL\r | |
101 | );\r | |
102 | }\r | |
103 | }\r | |
104 | return Status;\r | |
105 | }\r |