]>
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 |
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 | |
262a60a4 | 34 | #include <Library/DxeServicesTableLib.h>\r |
e4b99ad9 | 35 | #include <Library/PlatformDriverOverrideLib.h>\r |
262a60a4 | 36 | \r |
37 | #include <Guid/OverrideVariable.h>\r | |
68dbca6c | 38 | #include <VariableFormat.h>\r |
262a60a4 | 39 | \r |
40 | \r | |
f3f2e05d | 41 | #define PLATFORM_OVERRIDE_ITEM_SIGNATURE SIGNATURE_32('p','d','o','i')\r |
b7a985d4 | 42 | typedef struct _PLATFORM_OVERRIDE_ITEM {\r |
262a60a4 | 43 | UINTN Signature;\r |
44 | LIST_ENTRY Link;\r | |
45 | UINT32 DriverInfoNum;\r | |
46 | EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath;\r | |
b7a985d4 | 47 | ///\r |
48 | /// List of DRIVER_IMAGE_INFO\r | |
49 | ///\r | |
50 | LIST_ENTRY DriverInfoList;\r | |
262a60a4 | 51 | EFI_HANDLE LastReturnedImageHandle;\r |
52 | } PLATFORM_OVERRIDE_ITEM;\r | |
53 | \r | |
f3f2e05d | 54 | #define DRIVER_IMAGE_INFO_SIGNATURE SIGNATURE_32('p','d','i','i')\r |
b7a985d4 | 55 | typedef struct _DRIVER_IMAGE_INFO {\r |
262a60a4 | 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 | |
f3f2e05d | 64 | #define DEVICE_PATH_STACK_ITEM_SIGNATURE SIGNATURE_32('d','p','s','i')\r |
262a60a4 | 65 | typedef 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 | |
b7a985d4 | 71 | /**\r |
cebc8d48 | 72 | Push a controller device path into a globle device path list.\r |
b7a985d4 | 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 | |
262a60a4 | 79 | EFI_STATUS\r |
80 | EFIAPI\r | |
81 | PushDevPathStack (\r | |
82 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
83 | );\r | |
84 | \r | |
b7a985d4 | 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 | |
262a60a4 | 94 | EFI_STATUS\r |
95 | EFIAPI\r | |
96 | PopDevPathStack (\r | |
97 | OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath\r | |
98 | );\r | |
99 | \r | |
b7a985d4 | 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 | |
262a60a4 | 109 | BOOLEAN\r |
110 | EFIAPI\r | |
111 | CheckExistInStack (\r | |
112 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePath\r | |
113 | );\r | |
114 | \r | |
b7a985d4 | 115 | /**\r |
cebc8d48 LG |
116 | Update the FV file device path if it is not valid.\r |
117 | \r | |
b7a985d4 | 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 | |
262a60a4 | 138 | EFI_STATUS\r |
139 | EFIAPI\r | |
140 | UpdateFvFileDevicePath (\r | |
b7a985d4 | 141 | IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,\r |
262a60a4 | 142 | IN EFI_GUID *FileGuid,\r |
143 | IN EFI_HANDLE CallerImageHandle\r | |
144 | );\r | |
145 | \r | |
b7a985d4 | 146 | /**\r |
cebc8d48 LG |
147 | Gets the data and size of a variable.\r |
148 | \r | |
b7a985d4 | 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 | |
262a60a4 | 162 | VOID *\r |
b7a985d4 | 163 | EFIAPI\r |
262a60a4 | 164 | GetVariableAndSize (\r |
165 | IN CHAR16 *Name,\r | |
166 | IN EFI_GUID *VendorGuid,\r | |
167 | OUT UINTN *VariableSize\r | |
168 | );\r | |
169 | \r | |
b7a985d4 | 170 | /**\r |
cebc8d48 LG |
171 | Connect to the handle to a device on the device path.\r |
172 | \r | |
b7a985d4 | 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 | |
262a60a4 | 188 | EFI_STATUS\r |
b7a985d4 | 189 | EFIAPI\r |
262a60a4 | 190 | ConnectDevicePath (\r |
191 | IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect\r | |
192 | );\r | |
193 | \r | |
262a60a4 | 194 | #endif\r |