]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdeModulePkg/Library/DxePlatDriOverLib/PlatDriOver.h
Move library class GenericBdsLib and PlatformBdsLib to IntelFrameworkModulePkg
[mirror_edk2.git] / MdeModulePkg / Library / DxePlatDriOverLib / PlatDriOver.h
... / ...
CommitLineData
1/** @file\r
2 Internal include file for Platform Driver Override Library implementation.\r
3 \r
4 Copyright (c) 2007 - 2008, Intel Corporation\r
5 All rights reserved. This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _PLAT_DRI_OVER_H_\r
16#define _PLAT_DRI_OVER_H_\r
17\r
18#include <PiDxe.h>\r
19\r
20#include <Protocol/FirmwareVolume2.h>\r
21#include <Protocol/LoadedImage.h>\r
22#include <Protocol/DevicePath.h>\r
23#include <Protocol/BusSpecificDriverOverride.h>\r
24\r
25#include <Library/BaseLib.h>\r
26#include <Library/DebugLib.h>\r
27#include <Library/BaseMemoryLib.h>\r
28#include <Library/PrintLib.h>\r
29#include <Library/UefiRuntimeServicesTableLib.h>\r
30#include <Library/UefiBootServicesTableLib.h>\r
31#include <Library/UefiLib.h>\r
32#include <Library/DevicePathLib.h>\r
33#include <Library/MemoryAllocationLib.h>\r
34#include <Library/DxeServicesTableLib.h>\r
35#include <Library/PlatformDriverOverrideLib.h>\r
36\r
37#include <Guid/OverrideVariable.h>\r
38#include <VariableFormat.h>\r
39\r
40\r
41#define PLATFORM_OVERRIDE_ITEM_SIGNATURE SIGNATURE_32('p','d','o','i')\r
42 typedef struct _PLATFORM_OVERRIDE_ITEM {\r
43 UINTN Signature;\r
44 LIST_ENTRY Link;\r
45 UINT32 DriverInfoNum;\r
46 EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath;\r
47 ///\r
48 /// List of DRIVER_IMAGE_INFO\r
49 ///\r
50 LIST_ENTRY DriverInfoList;\r
51 EFI_HANDLE LastReturnedImageHandle;\r
52} PLATFORM_OVERRIDE_ITEM;\r
53\r
54#define DRIVER_IMAGE_INFO_SIGNATURE SIGNATURE_32('p','d','i','i')\r
55typedef struct _DRIVER_IMAGE_INFO {\r
56 UINTN Signature;\r
57 LIST_ENTRY Link;\r
58 EFI_HANDLE ImageHandle;\r
59 EFI_DEVICE_PATH_PROTOCOL *DriverImagePath;\r
60 BOOLEAN UnLoadable;\r
61 BOOLEAN UnStartable;\r
62} DRIVER_IMAGE_INFO;\r
63\r
64#define DEVICE_PATH_STACK_ITEM_SIGNATURE SIGNATURE_32('d','p','s','i')\r
65typedef struct _DEVICE_PATH_STACK_ITEM{\r
66 UINTN Signature;\r
67 LIST_ENTRY Link;\r
68 EFI_DEVICE_PATH_PROTOCOL *DevicePath;\r
69} DEVICE_PATH_STACK_ITEM;\r
70\r
71/**\r
72 Push a controller device path into a globle device path list.\r
73\r
74 @param DevicePath The controller device path to push into stack\r
75\r
76 @retval EFI_SUCCESS Device path successfully pushed into the stack.\r
77\r
78**/\r
79EFI_STATUS\r
80EFIAPI\r
81PushDevPathStack (\r
82 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
83 );\r
84\r
85/**\r
86 Pop a controller device path from a globle device path list\r
87\r
88 @param DevicePath The controller device path popped from stack\r
89\r
90 @retval EFI_SUCCESS Controller device path successfully popped.\r
91 @retval EFI_NOT_FOUND Stack is empty.\r
92\r
93**/\r
94EFI_STATUS\r
95EFIAPI\r
96PopDevPathStack (\r
97 OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r
98 );\r
99\r
100/**\r
101 Check whether a controller device path is in a globle device path list\r
102\r
103 @param DevicePath The controller device path to check\r
104\r
105 @retval TRUE DevicePath exists in the stack.\r
106 @retval FALSE DevicePath does not exist in the stack.\r
107\r
108**/\r
109BOOLEAN\r
110EFIAPI\r
111CheckExistInStack (\r
112 IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r
113 );\r
114\r
115/**\r
116 Update the FV file device path if it is not valid.\r
117\r
118 According to a file GUID, check a Fv file device path is valid. If it is invalid,\r
119 try to return the valid device path.\r
120 FV address maybe changes for memory layout adjust from time to time, use this funciton\r
121 could promise the Fv file device path is right.\r
122\r
123 @param DevicePath On input, the FV file device path to check\r
124 On output, the updated valid FV file device path\r
125 @param FileGuid The FV file GUID\r
126 @param CallerImageHandle Image handle of the caller\r
127\r
128 @retval EFI_INVALID_PARAMETER the input DevicePath or FileGuid is invalid\r
129 parameter\r
130 @retval EFI_UNSUPPORTED the input DevicePath does not contain FV file\r
131 GUID at all\r
132 @retval EFI_ALREADY_STARTED the input DevicePath has pointed to FV file, it\r
133 is valid\r
134 @retval EFI_SUCCESS Successfully updated the invalid DevicePath,\r
135 and return the updated device path in DevicePath\r
136\r
137**/\r
138EFI_STATUS\r
139EFIAPI\r
140UpdateFvFileDevicePath (\r
141 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r
142 IN EFI_GUID *FileGuid,\r
143 IN EFI_HANDLE CallerImageHandle\r
144 );\r
145\r
146/**\r
147 Gets the data and size of a variable.\r
148\r
149 Read the EFI variable (VendorGuid/Name) and return a dynamically allocated\r
150 buffer, and the size of the buffer. If failure return NULL.\r
151\r
152 @param Name String part of EFI variable name\r
153 @param VendorGuid GUID part of EFI variable name\r
154 @param VariableSize Returns the size of the EFI variable that was\r
155 read\r
156\r
157 @return Dynamically allocated memory that contains a copy of the EFI variable.\r
158 Caller is responsible freeing the buffer.\r
159 @retval NULL Variable was not read\r
160\r
161**/\r
162VOID *\r
163EFIAPI\r
164GetVariableAndSize (\r
165 IN CHAR16 *Name,\r
166 IN EFI_GUID *VendorGuid,\r
167 OUT UINTN *VariableSize\r
168 );\r
169\r
170/**\r
171 Connect to the handle to a device on the device path.\r
172\r
173 This function will create all handles associate with every device\r
174 path node. If the handle associate with one device path node can not\r
175 be created success, then still give one chance to do the dispatch,\r
176 which load the missing drivers if possible.\r
177\r
178 @param DevicePathToConnect The device path which will be connected, it can\r
179 be a multi-instance device path\r
180\r
181 @retval EFI_SUCCESS All handles associate with every device path\r
182 node have been created\r
183 @retval EFI_OUT_OF_RESOURCES There is no resource to create new handles\r
184 @retval EFI_NOT_FOUND Create the handle associate with one device\r
185 path node failed\r
186\r
187**/\r
188EFI_STATUS\r
189EFIAPI\r
190ConnectDevicePath (\r
191 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect\r
192 );\r
193\r
194#endif\r