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