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