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