]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/DevicePathDxe/DevicePath.c
fc92fc986fdfae7ff7a3a9471c67bf6640ce0b6b
[mirror_edk2.git] / MdeModulePkg / Universal / DevicePathDxe / DevicePath.c
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 DevicePathDriver.c
15
16 Abstract:
17
18 Device Path Driver to produce DevPathUtilities Protocol, DevPathFromText Protocol
19 and DevPathToText Protocol.
20
21 --*/
22
23 //
24 // Include common header file for this module.
25 //
26 #include "CommonHeader.h"
27
28 #include "DevicePath.h"
29
30 EFI_HANDLE mDevicePathHandle = NULL;
31
32 GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilities = {
33 GetDevicePathSizeProtocolInterface,
34 DuplicateDevicePathProtocolInterface,
35 AppendDevicePathProtocolInterface,
36 AppendDeviceNodeProtocolInterface,
37 AppendDevicePathInstanceProtocolInterface,
38 GetNextDevicePathInstanceProtocolInterface,
39 IsDevicePathMultiInstanceProtocolInterface,
40 CreateDeviceNodeProtocolInterface
41 };
42
43 GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToText = {
44 ConvertDeviceNodeToText,
45 ConvertDevicePathToText
46 };
47
48 GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromText = {
49 ConvertTextToDeviceNode,
50 ConvertTextToDevicePath
51 };
52
53 GLOBAL_REMOVE_IF_UNREFERENCED const EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid = DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL;
54 GLOBAL_REMOVE_IF_UNREFERENCED const EFI_GUID mEfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS;
55
56 EFI_STATUS
57 EFIAPI
58 DevicePathEntryPoint (
59 IN EFI_HANDLE ImageHandle,
60 IN EFI_SYSTEM_TABLE *SystemTable
61 )
62 /*++
63
64 Routine Description:
65 Entry point for EFI drivers.
66
67 Arguments:
68 ImageHandle - EFI_HANDLE
69 SystemTable - EFI_SYSTEM_TABLE
70
71 Returns:
72 EFI_SUCCESS
73 others
74
75 --*/
76 {
77 EFI_STATUS Status;
78
79 Status = EFI_UNSUPPORTED;
80 if (FeaturePcdGet (PcdDevicePathSupportDevicePathToText)) {
81 if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {
82 Status = gBS->InstallMultipleProtocolInterfaces (
83 &mDevicePathHandle,
84 &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
85 &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
86 &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
87 NULL
88 );
89 } else {
90 Status = gBS->InstallMultipleProtocolInterfaces (
91 &mDevicePathHandle,
92 &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
93 &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
94 NULL
95 );
96 }
97 } else {
98 if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {
99 Status = gBS->InstallMultipleProtocolInterfaces (
100 &mDevicePathHandle,
101 &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
102 &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
103 NULL
104 );
105 } else {
106 Status = gBS->InstallMultipleProtocolInterfaces (
107 &mDevicePathHandle,
108 &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
109 NULL
110 );
111 }
112 }
113 return Status;
114 }