]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Universal/PlatformDriOverrideDxe/InternalPlatDriOverrideDxe.h
MdeModulePkg Variable: Abstract GetHobVariableStore function
[mirror_edk2.git] / MdeModulePkg / Universal / PlatformDriOverrideDxe / InternalPlatDriOverrideDxe.h
... / ...
CommitLineData
1/** @file\r
2 Ihe internal heder file includes the required Protocol/Guid/Library\r
3 and the shared function APIs.\r
4\r
5Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
6This program and the accompanying materials\r
7are licensed and made available under the terms and conditions of the BSD License\r
8which accompanies this distribution. The full text of the license may be found at\r
9http://opensource.org/licenses/bsd-license.php\r
10\r
11THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13\r
14**/\r
15\r
16#ifndef _INTERNAL_PLATFORM_DRIVER_OVERRIDE_H_\r
17#define _INTERNAL_PLATFORM_DRIVER_OVERRIDE_H_\r
18\r
19#include <PiDxe.h>\r
20\r
21#include <Protocol/HiiConfigAccess.h>\r
22#include <Protocol/HiiConfigRouting.h>\r
23#include <Protocol/HiiDatabase.h>\r
24#include <Protocol/FormBrowser2.h>\r
25#include <Protocol/LoadedImage.h>\r
26#include <Protocol/FirmwareVolume2.h>\r
27#include <Protocol/PciIo.h>\r
28#include <Protocol/BusSpecificDriverOverride.h>\r
29#include <Protocol/ComponentName2.h>\r
30#include <Protocol/ComponentName.h>\r
31#include <Protocol/DriverBinding.h>\r
32#include <Protocol/DevicePath.h>\r
33#include <Protocol/PlatformDriverOverride.h>\r
34#include <Guid/MdeModuleHii.h>\r
35#include <Guid/VariableFormat.h>\r
36\r
37#include <Library/BaseLib.h>\r
38#include <Library/DebugLib.h>\r
39#include <Library/UefiLib.h>\r
40#include <Library/PrintLib.h>\r
41#include <Library/UefiDriverEntryPoint.h>\r
42#include <Library/UefiBootServicesTableLib.h>\r
43#include <Library/UefiRuntimeServicesTableLib.h>\r
44#include <Library/BaseMemoryLib.h>\r
45#include <Library/MemoryAllocationLib.h>\r
46#include <Library/DevicePathLib.h>\r
47#include <Library/DxeServicesTableLib.h>\r
48#include <Library/HiiLib.h>\r
49\r
50/**\r
51 Free all the mapping database memory resource and initialize the mapping list entry.\r
52\r
53 @param MappingDataBase Mapping database list entry pointer\r
54\r
55 @retval EFI_INVALID_PARAMETER mapping database list entry is NULL\r
56 @retval EFI_SUCCESS Free success\r
57\r
58**/\r
59EFI_STATUS\r
60EFIAPI\r
61FreeMappingDatabase (\r
62 IN OUT LIST_ENTRY *MappingDataBase\r
63 )\r
64;\r
65\r
66/**\r
67 Read the NV environment variable(s) that contain the override mappings from Controller Device Path to\r
68 a set of Driver Device Paths, and create the mapping database in memory to contain these variable info.\r
69\r
70 @param MappingDataBase Mapping database list entry pointer\r
71\r
72 @retval EFI_INVALID_PARAMETER MappingDataBase pointer is null\r
73 @retval EFI_NOT_FOUND Cannot find the 'PlatDriOver' NV variable\r
74 @retval EFI_VOLUME_CORRUPTED The found NV variable is corrupted\r
75 @retval EFI_SUCCESS Create the mapping database in memory successfully\r
76\r
77**/\r
78EFI_STATUS\r
79EFIAPI\r
80InitOverridesMapping (\r
81 OUT LIST_ENTRY *MappingDataBase\r
82 )\r
83;\r
84\r
85/**\r
86 Save the memory mapping database into NV environment variable(s).\r
87 If MappingDataBase list is empty, then delete all platform override NV variables.\r
88\r
89 @param MappingDataBase Mapping database list entry pointer\r
90\r
91 @retval EFI_INVALID_PARAMETER MappingDataBase pointer is null\r
92 @retval EFI_SUCCESS Save memory mapping database successfully\r
93\r
94**/\r
95EFI_STATUS\r
96EFIAPI\r
97SaveOverridesMapping (\r
98 IN LIST_ENTRY *MappingDataBase\r
99 )\r
100;\r
101\r
102/**\r
103 Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database.\r
104\r
105 @param ControllerHandle The device handle of the controller to check if\r
106 a driver override exists.\r
107 @param DriverImageHandle On output, a pointer to the next driver handle.\r
108 Passing in a pointer to NULL, will return the\r
109 first driver handle for ControllerHandle.\r
110 @param MappingDataBase MappingDataBase - Mapping database list entry\r
111 pointer\r
112 @param CallerImageHandle The caller driver's image handle, for\r
113 UpdateFvFileDevicePath use.\r
114\r
115 @retval EFI_INVALID_PARAMETER The handle specified by ControllerHandle is not\r
116 a valid handle. Or DriverImagePath is not a\r
117 device path that was returned on a previous call\r
118 to GetDriverPath().\r
119 @retval EFI_NOT_FOUND A driver override for ControllerHandle was not\r
120 found.\r
121 @retval EFI_UNSUPPORTED The operation is not supported.\r
122 @retval EFI_SUCCESS The driver override for ControllerHandle was\r
123 returned in DriverImagePath.\r
124\r
125**/\r
126EFI_STATUS\r
127EFIAPI\r
128GetDriverFromMapping (\r
129 IN EFI_HANDLE ControllerHandle,\r
130 IN OUT EFI_HANDLE *DriverImageHandle,\r
131 IN LIST_ENTRY *MappingDataBase,\r
132 IN EFI_HANDLE CallerImageHandle\r
133 )\r
134;\r
135\r
136/**\r
137 Check mapping database whether already has the mapping info which\r
138 records the input Controller to input DriverImage.\r
139\r
140 @param ControllerDevicePath The controller device path is to be check.\r
141 @param DriverImageDevicePath The driver image device path is to be check.\r
142 @param MappingDataBase Mapping database list entry pointer\r
143 @param DriverInfoNum the controller's total override driver number\r
144 @param DriverImageNO The driver order number for the input DriverImage.\r
145 If the DriverImageDevicePath is NULL, DriverImageNO is not set.\r
146\r
147 @retval EFI_INVALID_PARAMETER ControllerDevicePath or MappingDataBase is NULL.\r
148 @retval EFI_NOT_FOUND ControllerDevicePath is not found in MappingDataBase or\r
149 DriverImageDevicePath is not found in the found DriverImage Info list.\r
150 @retval EFI_SUCCESS The controller's total override driver number and\r
151 input DriverImage's order number is correctly return.\r
152**/\r
153EFI_STATUS\r
154EFIAPI\r
155CheckMapping (\r
156 IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath,\r
157 IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath OPTIONAL,\r
158 IN LIST_ENTRY *MappingDataBase,\r
159 OUT UINT32 *DriverInfoNum OPTIONAL,\r
160 OUT UINT32 *DriverImageNO OPTIONAL\r
161 )\r
162;\r
163\r
164/**\r
165 Insert a driver image as a controller's override driver into the mapping database.\r
166 The driver image's order number is indicated by DriverImageNO.\r
167\r
168 @param ControllerDevicePath The controller device path need to add a\r
169 override driver image item\r
170 @param DriverImageDevicePath The driver image device path need to be insert\r
171 @param MappingDataBase Mapping database list entry pointer\r
172 @param DriverImageNO The inserted order number. If this number is taken,\r
173 the larger available number will be used.\r
174\r
175 @retval EFI_INVALID_PARAMETER ControllerDevicePath is NULL, or DriverImageDevicePath is NULL\r
176 or MappingDataBase is NULL\r
177 @retval EFI_ALREADY_STARTED The input Controller to input DriverImage has been\r
178 recorded into the mapping database.\r
179 @retval EFI_SUCCESS The Controller and DriverImage are inserted into\r
180 the mapping database successfully.\r
181\r
182**/\r
183EFI_STATUS\r
184EFIAPI\r
185InsertDriverImage (\r
186 IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath,\r
187 IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath,\r
188 IN LIST_ENTRY *MappingDataBase,\r
189 IN UINT32 DriverImageNO\r
190 )\r
191;\r
192\r
193/**\r
194 Delete a controller's override driver from the mapping database.\r
195\r
196 @param ControllerDevicePath The controller device path will be deleted\r
197 when all drivers images on it are removed.\r
198 @param DriverImageDevicePath The driver image device path will be delete.\r
199 If NULL, all driver image will be delete.\r
200 @param MappingDataBase Mapping database list entry pointer\r
201\r
202 @retval EFI_INVALID_PARAMETER ControllerDevicePath is NULL, or MappingDataBase is NULL\r
203 @retval EFI_NOT_FOUND ControllerDevicePath is not found in MappingDataBase or\r
204 DriverImageDevicePath is not found in the found DriverImage Info list.\r
205 @retval EFI_SUCCESS Delete the specified driver successfully.\r
206\r
207**/\r
208EFI_STATUS\r
209EFIAPI\r
210DeleteDriverImage (\r
211 IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath,\r
212 IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath,\r
213 IN LIST_ENTRY *MappingDataBase\r
214 )\r
215;\r
216\r
217#endif\r