]> git.proxmox.com Git - mirror_edk2.git/blob - EdkModulePkg/Universal/DevicePath/Dxe/DevicePath.c
79741a4615157a1a1093a1e626987e7537fb94c6
[mirror_edk2.git] / EdkModulePkg / Universal / DevicePath / Dxe / 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 <Uefi/UefiSpec.h>
24 #include <Protocol/DevicePath.h>
25 #include "DevicePath.h"
26
27 DEVICE_PATH_DRIVER_PRIVATE_DATA mPrivateData;
28
29 EFI_GUID mEfiDevicePathMessagingUartFlowControlGuid = DEVICE_PATH_MESSAGING_UART_FLOW_CONTROL;
30 EFI_GUID mEfiDevicePathMessagingSASGuid = DEVICE_PATH_MESSAGING_SAS;
31
32 STATIC EFI_DEVICE_PATH_UTILITIES_PROTOCOL mDevicePathUtilitiesProtocol = {
33 GetDevicePathSize,
34 DuplicateDevicePath,
35 AppendDevicePath,
36 AppendDeviceNode,
37 AppendDevicePathInstance,
38 GetNextDevicePathInstance,
39 IsDevicePathMultiInstance,
40 CreateDeviceNode
41 };
42
43 STATIC EFI_DEVICE_PATH_TO_TEXT_PROTOCOL mDevicePathToTextProtocol = {
44 ConvertDeviceNodeToText,
45 ConvertDevicePathToText
46 };
47
48 STATIC EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL mDevicePathFromTextProtocol = {
49 ConvertTextToDeviceNode,
50 ConvertTextToDevicePath
51 };
52
53 EFI_STATUS
54 EFIAPI
55 DevicePathEntryPoint (
56 IN EFI_HANDLE ImageHandle,
57 IN EFI_SYSTEM_TABLE *SystemTable
58 )
59 /*++
60
61 Routine Description:
62 Entry point for EFI drivers.
63
64 Arguments:
65 ImageHandle - EFI_HANDLE
66 SystemTable - EFI_SYSTEM_TABLE
67
68 Returns:
69 EFI_SUCCESS
70 others
71
72 --*/
73 {
74 EFI_STATUS Status;
75
76 mPrivateData.Signature = DEVICE_PATH_DRIVER_SIGNATURE;
77
78 mPrivateData.DevicePathUtilities.GetDevicePathSize = GetDevicePathSize;
79 mPrivateData.DevicePathUtilities.DuplicateDevicePath = DuplicateDevicePath;
80 mPrivateData.DevicePathUtilities.AppendDevicePath = AppendDevicePath;
81 mPrivateData.DevicePathUtilities.AppendDeviceNode = AppendDeviceNode;
82 mPrivateData.DevicePathUtilities.AppendDevicePathInstance = AppendDevicePathInstance;
83 mPrivateData.DevicePathUtilities.GetNextDevicePathInstance = GetNextDevicePathInstance;
84 mPrivateData.DevicePathUtilities.IsDevicePathMultiInstance = IsDevicePathMultiInstance;
85 mPrivateData.DevicePathUtilities.CreateDeviceNode = CreateDeviceNode;
86
87 mPrivateData.DevicePathToText.ConvertDeviceNodeToText = ConvertDeviceNodeToText;
88 mPrivateData.DevicePathToText.ConvertDevicePathToText = ConvertDevicePathToText;
89
90 mPrivateData.DevicePathFromText.ConvertTextToDeviceNode = ConvertTextToDeviceNode;
91 mPrivateData.DevicePathFromText.ConvertTextToDevicePath = ConvertTextToDevicePath;
92
93 mPrivateData.Handle = NULL;
94
95 Status = gBS->InstallMultipleProtocolInterfaces (
96 &mPrivateData.Handle,
97 &gEfiDevicePathUtilitiesProtocolGuid,
98 &mPrivateData.DevicePathUtilities,
99 &gEfiDevicePathToTextProtocolGuid,
100 &mPrivateData.DevicePathToText,
101 &gEfiDevicePathFromTextProtocolGuid,
102 &mPrivateData.DevicePathFromText,
103 NULL
104 );
105
106 return Status;
107 }