]>
Commit | Line | Data |
---|---|---|
5f597758 LG |
1 | /** @file\r |
2 | \r | |
3 | This library provides basic platform driver override functions.\r | |
4 | \r | |
5 | Copyright (c) 2007 - 2008, Intel Corporation\r | |
6 | All rights reserved. This program and the accompanying materials\r | |
7 | are licensed and made available under the terms and conditions of the BSD License\r | |
8 | which accompanies this distribution. The full text of the license may be found at\r | |
9 | http://opensource.org/licenses/bsd-license.php\r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef _PLAT_DRI_OVER_LIB_H_\r | |
17 | #define _PLAT_DRI_OVER_LIB_H_\r | |
18 | \r | |
5f597758 | 19 | #include <Protocol/DevicePath.h>\r |
5f597758 | 20 | \r |
b290614d | 21 | /**\r |
5f597758 | 22 | Free all the mapping database memory resource and initialize the mapping list entry.\r |
b290614d | 23 | \r |
24 | @param MappingDataBase Mapping database list entry pointer\r | |
25 | \r | |
26 | @retval EFI_INVALID_PARAMETER mapping database list entry is NULL\r | |
27 | @retval EFI_SUCCESS Free success\r | |
28 | \r | |
5f597758 LG |
29 | **/\r |
30 | EFI_STATUS\r | |
31 | EFIAPI\r | |
32 | FreeMappingDatabase (\r | |
33 | IN OUT LIST_ENTRY *MappingDataBase\r | |
34 | );\r | |
35 | \r | |
b290614d | 36 | /**\r |
68dbca6c LG |
37 | Read the NV environment variable(s) that contain the override mappings from Controller Device Path to\r |
38 | a set of Driver Device Paths, and create the mapping database in memory to contain these variable info.\r | |
b290614d | 39 | \r |
40 | @param MappingDataBase Mapping database list entry pointer\r | |
41 | \r | |
42 | @retval EFI_INVALID_PARAMETER MappingDataBase pointer is null\r | |
43 | @retval EFI_NOT_FOUND Cannot find the 'PlatDriOver' NV variable\r | |
44 | @retval EFI_VOLUME_CORRUPTED The found NV variable is corrupted\r | |
5f597758 LG |
45 | @retval EFI_SUCCESS Create the mapping database in memory successfully\r |
46 | \r | |
47 | **/\r | |
48 | EFI_STATUS\r | |
49 | EFIAPI\r | |
50 | InitOverridesMapping (\r | |
51 | OUT LIST_ENTRY *MappingDataBase\r | |
52 | );\r | |
53 | \r | |
b290614d | 54 | /**\r |
5f597758 | 55 | Save the memory mapping database into NV environment variable(s).\r |
68dbca6c | 56 | If MappingDataBase list is empty, then delete all platform override NV variables.\r |
b290614d | 57 | \r |
58 | @param MappingDataBase Mapping database list entry pointer\r | |
59 | \r | |
60 | @retval EFI_INVALID_PARAMETER MappingDataBase pointer is null\r | |
61 | @retval EFI_SUCCESS Save memory mapping database successfully\r | |
62 | \r | |
5f597758 LG |
63 | **/\r |
64 | EFI_STATUS\r | |
65 | EFIAPI\r | |
66 | SaveOverridesMapping (\r | |
67 | IN LIST_ENTRY *MappingDataBase\r | |
68 | );\r | |
69 | \r | |
b290614d | 70 | /**\r |
71 | Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database.\r | |
72 | \r | |
b290614d | 73 | @param ControllerHandle The device handle of the controller to check if\r |
74 | a driver override exists.\r | |
75 | @param DriverImageHandle On output, a pointer to the next driver handle.\r | |
76 | Passing in a pointer to NULL, will return the\r | |
77 | first driver handle for ControllerHandle.\r | |
78 | @param MappingDataBase MappingDataBase - Mapping database list entry\r | |
79 | pointer\r | |
80 | @param CallerImageHandle The caller driver's image handle, for\r | |
81 | UpdateFvFileDevicePath use.\r | |
82 | \r | |
83 | @retval EFI_INVALID_PARAMETER The handle specified by ControllerHandle is not\r | |
84 | a valid handle. Or DriverImagePath is not a\r | |
85 | device path that was returned on a previous call\r | |
86 | to GetDriverPath().\r | |
87 | @retval EFI_NOT_FOUND A driver override for ControllerHandle was not\r | |
88 | found.\r | |
89 | @retval EFI_UNSUPPORTED The operation is not supported.\r | |
90 | @retval EFI_SUCCESS The driver override for ControllerHandle was\r | |
91 | returned in DriverImagePath.\r | |
92 | \r | |
5f597758 LG |
93 | **/\r |
94 | EFI_STATUS\r | |
95 | EFIAPI\r | |
96 | GetDriverFromMapping (\r | |
5f597758 | 97 | IN EFI_HANDLE ControllerHandle,\r |
68dbca6c LG |
98 | IN OUT EFI_HANDLE *DriverImageHandle,\r |
99 | IN LIST_ENTRY *MappingDataBase,\r | |
5f597758 LG |
100 | IN EFI_HANDLE CallerImageHandle\r |
101 | );\r | |
102 | \r | |
103 | /**\r | |
68dbca6c | 104 | Check mapping database whether already has the mapping info which\r |
b290614d | 105 | records the input Controller to input DriverImage.\r |
b290614d | 106 | \r |
5f597758 LG |
107 | @param ControllerDevicePath The controller device path is to be check.\r |
108 | @param DriverImageDevicePath The driver image device path is to be check.\r | |
b290614d | 109 | @param MappingDataBase Mapping database list entry pointer\r |
110 | @param DriverInfoNum the controller's total override driver number\r | |
5f597758 LG |
111 | @param DriverImageNO The driver order number for the input DriverImage.\r |
112 | If the DriverImageDevicePath is NULL, DriverImageNO is not set.\r | |
113 | \r | |
114 | @retval EFI_INVALID_PARAMETER ControllerDevicePath or MappingDataBase is NULL.\r | |
115 | @retval EFI_NOT_FOUND ControllerDevicePath is not found in MappingDataBase or\r | |
116 | DriverImageDevicePath is not found in the found DriverImage Info list. \r | |
117 | @retval EFI_SUCCESS The controller's total override driver number and \r | |
118 | input DriverImage's order number is correctly return.\r | |
119 | **/\r | |
120 | EFI_STATUS\r | |
121 | EFIAPI\r | |
122 | CheckMapping (\r | |
123 | IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath,\r | |
0bcd9130 | 124 | IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath OPTIONAL,\r |
125 | IN LIST_ENTRY *MappingDataBase,\r | |
126 | OUT UINT32 *DriverInfoNum OPTIONAL,\r | |
127 | OUT UINT32 *DriverImageNO OPTIONAL\r | |
5f597758 LG |
128 | );\r |
129 | \r | |
b290614d | 130 | /**\r |
131 | Insert a driver image as a controller's override driver into the mapping database.\r | |
132 | The driver image's order number is indicated by DriverImageNO.\r | |
133 | \r | |
134 | @param ControllerDevicePath The controller device path need to add a\r | |
135 | override driver image item\r | |
136 | @param DriverImageDevicePath The driver image device path need to be insert\r | |
137 | @param MappingDataBase Mapping database list entry pointer\r | |
5f597758 LG |
138 | @param DriverImageNO The inserted order number. If this number is taken, \r |
139 | the larger available number will be used.\r | |
140 | \r | |
141 | @retval EFI_INVALID_PARAMETER ControllerDevicePath is NULL, or DriverImageDevicePath is NULL\r | |
142 | or MappingDataBase is NULL\r | |
143 | @retval EFI_ALREADY_STARTED The input Controller to input DriverImage has been \r | |
144 | recorded into the mapping database.\r | |
145 | @retval EFI_SUCCESS The Controller and DriverImage are inserted into \r | |
146 | the mapping database successfully.\r | |
147 | \r | |
148 | **/\r | |
149 | EFI_STATUS\r | |
150 | EFIAPI\r | |
151 | InsertDriverImage (\r | |
152 | IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath,\r | |
153 | IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath,\r | |
154 | IN LIST_ENTRY *MappingDataBase,\r | |
155 | IN UINT32 DriverImageNO\r | |
156 | );\r | |
157 | \r | |
b290614d | 158 | /**\r |
159 | Delete a controller's override driver from the mapping database.\r | |
160 | \r | |
5f597758 LG |
161 | @param ControllerDevicePath The controller device path will be deleted \r |
162 | when all drivers images on it are removed.\r | |
163 | @param DriverImageDevicePath The driver image device path will be delete.\r | |
164 | If NULL, all driver image will be delete.\r | |
b290614d | 165 | @param MappingDataBase Mapping database list entry pointer\r |
5f597758 LG |
166 | \r |
167 | @retval EFI_INVALID_PARAMETER ControllerDevicePath is NULL, or MappingDataBase is NULL\r | |
168 | @retval EFI_NOT_FOUND ControllerDevicePath is not found in MappingDataBase or\r | |
169 | DriverImageDevicePath is not found in the found DriverImage Info list. \r | |
170 | @retval EFI_SUCCESS Delete the specified driver successfully.\r | |
171 | \r | |
172 | **/\r | |
173 | EFI_STATUS\r | |
174 | EFIAPI\r | |
175 | DeleteDriverImage (\r | |
176 | IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath,\r | |
177 | IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath,\r | |
178 | IN LIST_ENTRY *MappingDataBase\r | |
179 | );\r | |
180 | \r | |
5f597758 | 181 | #endif\r |