]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Universal/DevicePathDxe/DevicePath.c
1. Sync the latest network stack. Add NetLibCreateIPv4DPathNode () in netlib library.
[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 #include "DevicePath.h"
24
25 EFI_HANDLE mDevicePathHandle = NULL;
26
27 GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilities = {
28 GetDevicePathSizeProtocolInterface,
29 DuplicateDevicePathProtocolInterface,
30 AppendDevicePathProtocolInterface,
31 AppendDeviceNodeProtocolInterface,
32 AppendDevicePathInstanceProtocolInterface,
33 GetNextDevicePathInstanceProtocolInterface,
34 IsDevicePathMultiInstanceProtocolInterface,
35 CreateDeviceNodeProtocolInterface
36 };
37
38 GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToText = {
39 ConvertDeviceNodeToText,
40 ConvertDevicePathToText
41 };
42
43 GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromText = {
44 ConvertTextToDeviceNode,
45 ConvertTextToDevicePath
46 };
47
48 GLOBAL_REMOVE_IF_UNREFERENCED const EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid = DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL;
49 GLOBAL_REMOVE_IF_UNREFERENCED const EFI_GUID mEfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS;
50
51 EFI_STATUS
52 EFIAPI
53 DevicePathEntryPoint (
54 IN EFI_HANDLE ImageHandle,
55 IN EFI_SYSTEM_TABLE *SystemTable
56 )
57 /*++
58
59 Routine Description:
60 Entry point for EFI drivers.
61
62 Arguments:
63 ImageHandle - EFI_HANDLE
64 SystemTable - EFI_SYSTEM_TABLE
65
66 Returns:
67 EFI_SUCCESS
68 others
69
70 --*/
71 {
72 EFI_STATUS Status;
73
74 Status = EFI_UNSUPPORTED;
75 if (FeaturePcdGet (PcdDevicePathSupportDevicePathToText)) {
76 if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {
77 Status = gBS->InstallMultipleProtocolInterfaces (
78 &mDevicePathHandle,
79 &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
80 &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
81 &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
82 NULL
83 );
84 } else {
85 Status = gBS->InstallMultipleProtocolInterfaces (
86 &mDevicePathHandle,
87 &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
88 &gEfiDevicePathToTextProtocolGuid, &mDevicePathToText,
89 NULL
90 );
91 }
92 } else {
93 if (FeaturePcdGet (PcdDevicePathSupportDevicePathFromText)) {
94 Status = gBS->InstallMultipleProtocolInterfaces (
95 &mDevicePathHandle,
96 &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
97 &gEfiDevicePathFromTextProtocolGuid, &mDevicePathFromText,
98 NULL
99 );
100 } else {
101 Status = gBS->InstallMultipleProtocolInterfaces (
102 &mDevicePathHandle,
103 &gEfiDevicePathUtilitiesProtocolGuid, &mDevicePathUtilities,
104 NULL
105 );
106 }
107 }
108 return Status;
109 }