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