]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Library/DxePlatDriOverLib/PlatDriOver.h
Code Scrub for DxePlatDriOverLib.
[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 EFI_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 EFI_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 EFI_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 According to a file GUID, check a Fv file device path is valid. If it is invalid,
118 try to return the valid device path.
119 FV address maybe changes for memory layout adjust from time to time, use this funciton
120 could promise the Fv file device path is right.
121
122 @param DevicePath On input, the FV file device path to check
123 On output, the updated valid FV file device path
124 @param FileGuid The FV file GUID
125 @param CallerImageHandle Image handle of the caller
126
127 @retval EFI_INVALID_PARAMETER the input DevicePath or FileGuid is invalid
128 parameter
129 @retval EFI_UNSUPPORTED the input DevicePath does not contain FV file
130 GUID at all
131 @retval EFI_ALREADY_STARTED the input DevicePath has pointed to FV file, it
132 is valid
133 @retval EFI_SUCCESS Successfully updated the invalid DevicePath,
134 and return the updated device path in DevicePath
135
136 **/
137 EFI_STATUS
138 EFIAPI
139 UpdateFvFileDevicePath (
140 IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
141 IN EFI_GUID *FileGuid,
142 IN EFI_HANDLE CallerImageHandle
143 );
144
145 /**
146 Read the EFI variable (VendorGuid/Name) and return a dynamically allocated
147 buffer, and the size of the buffer. If failure return NULL.
148
149 @param Name String part of EFI variable name
150 @param VendorGuid GUID part of EFI variable name
151 @param VariableSize Returns the size of the EFI variable that was
152 read
153
154 @return Dynamically allocated memory that contains a copy of the EFI variable.
155 Caller is responsible freeing the buffer.
156 @retval NULL Variable was not read
157
158 **/
159 VOID *
160 EFIAPI
161 GetVariableAndSize (
162 IN CHAR16 *Name,
163 IN EFI_GUID *VendorGuid,
164 OUT UINTN *VariableSize
165 );
166
167 /**
168 This function will create all handles associate with every device
169 path node. If the handle associate with one device path node can not
170 be created success, then still give one chance to do the dispatch,
171 which load the missing drivers if possible.
172
173 @param DevicePathToConnect The device path which will be connected, it can
174 be a multi-instance device path
175
176 @retval EFI_SUCCESS All handles associate with every device path
177 node have been created
178 @retval EFI_OUT_OF_RESOURCES There is no resource to create new handles
179 @retval EFI_NOT_FOUND Create the handle associate with one device
180 path node failed
181
182 **/
183 EFI_STATUS
184 EFIAPI
185 ConnectDevicePath (
186 IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
187 );
188
189 #endif