2 Ihis library is only intended to be used by Platform Driver Override Dxe Driver and Application.
3 It provides basic platform driver override functions.
5 Copyright (c) 2007 - 2009, Intel Corporation
6 All rights reserved. This program and the accompanying materials
7 are licensed and made available under the terms and conditions of the BSD License
8 which accompanies this distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 #ifndef _PLATFORM_DRIVER_OVERRIDE_LIB_H_
17 #define _PLATFORM_DRIVER_OVERRIDE_LIB_H_
19 #include <Protocol/DevicePath.h>
22 Free all the mapping database memory resource and initialize the mapping list entry.
24 @param MappingDataBase Mapping database list entry pointer
26 @retval EFI_INVALID_PARAMETER mapping database list entry is NULL
27 @retval EFI_SUCCESS Free success
33 IN OUT LIST_ENTRY
*MappingDataBase
38 Read the NV environment variable(s) that contain the override mappings from Controller Device Path to
39 a set of Driver Device Paths, and create the mapping database in memory to contain these variable info.
41 @param MappingDataBase Mapping database list entry pointer
43 @retval EFI_INVALID_PARAMETER MappingDataBase pointer is null
44 @retval EFI_NOT_FOUND Cannot find the 'PlatDriOver' NV variable
45 @retval EFI_VOLUME_CORRUPTED The found NV variable is corrupted
46 @retval EFI_SUCCESS Create the mapping database in memory successfully
51 InitOverridesMapping (
52 OUT LIST_ENTRY
*MappingDataBase
57 Save the memory mapping database into NV environment variable(s).
58 If MappingDataBase list is empty, then delete all platform override NV variables.
60 @param MappingDataBase Mapping database list entry pointer
62 @retval EFI_INVALID_PARAMETER MappingDataBase pointer is null
63 @retval EFI_SUCCESS Save memory mapping database successfully
68 SaveOverridesMapping (
69 IN LIST_ENTRY
*MappingDataBase
74 Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database.
76 @param ControllerHandle The device handle of the controller to check if
77 a driver override exists.
78 @param DriverImageHandle On output, a pointer to the next driver handle.
79 Passing in a pointer to NULL, will return the
80 first driver handle for ControllerHandle.
81 @param MappingDataBase MappingDataBase - Mapping database list entry
83 @param CallerImageHandle The caller driver's image handle, for
84 UpdateFvFileDevicePath use.
86 @retval EFI_INVALID_PARAMETER The handle specified by ControllerHandle is not
87 a valid handle. Or DriverImagePath is not a
88 device path that was returned on a previous call
90 @retval EFI_NOT_FOUND A driver override for ControllerHandle was not
92 @retval EFI_UNSUPPORTED The operation is not supported.
93 @retval EFI_SUCCESS The driver override for ControllerHandle was
94 returned in DriverImagePath.
99 GetDriverFromMapping (
100 IN EFI_HANDLE ControllerHandle
,
101 IN OUT EFI_HANDLE
*DriverImageHandle
,
102 IN LIST_ENTRY
*MappingDataBase
,
103 IN EFI_HANDLE CallerImageHandle
108 Check mapping database whether already has the mapping info which
109 records the input Controller to input DriverImage.
111 @param ControllerDevicePath The controller device path is to be check.
112 @param DriverImageDevicePath The driver image device path is to be check.
113 @param MappingDataBase Mapping database list entry pointer
114 @param DriverInfoNum the controller's total override driver number
115 @param DriverImageNO The driver order number for the input DriverImage.
116 If the DriverImageDevicePath is NULL, DriverImageNO is not set.
118 @retval EFI_INVALID_PARAMETER ControllerDevicePath or MappingDataBase is NULL.
119 @retval EFI_NOT_FOUND ControllerDevicePath is not found in MappingDataBase or
120 DriverImageDevicePath is not found in the found DriverImage Info list.
121 @retval EFI_SUCCESS The controller's total override driver number and
122 input DriverImage's order number is correctly return.
127 IN EFI_DEVICE_PATH_PROTOCOL
*ControllerDevicePath
,
128 IN EFI_DEVICE_PATH_PROTOCOL
*DriverImageDevicePath OPTIONAL
,
129 IN LIST_ENTRY
*MappingDataBase
,
130 OUT UINT32
*DriverInfoNum OPTIONAL
,
131 OUT UINT32
*DriverImageNO OPTIONAL
136 Insert a driver image as a controller's override driver into the mapping database.
137 The driver image's order number is indicated by DriverImageNO.
139 @param ControllerDevicePath The controller device path need to add a
140 override driver image item
141 @param DriverImageDevicePath The driver image device path need to be insert
142 @param MappingDataBase Mapping database list entry pointer
143 @param DriverImageNO The inserted order number. If this number is taken,
144 the larger available number will be used.
146 @retval EFI_INVALID_PARAMETER ControllerDevicePath is NULL, or DriverImageDevicePath is NULL
147 or MappingDataBase is NULL
148 @retval EFI_ALREADY_STARTED The input Controller to input DriverImage has been
149 recorded into the mapping database.
150 @retval EFI_SUCCESS The Controller and DriverImage are inserted into
151 the mapping database successfully.
157 IN EFI_DEVICE_PATH_PROTOCOL
*ControllerDevicePath
,
158 IN EFI_DEVICE_PATH_PROTOCOL
*DriverImageDevicePath
,
159 IN LIST_ENTRY
*MappingDataBase
,
160 IN UINT32 DriverImageNO
165 Delete a controller's override driver from the mapping database.
167 @param ControllerDevicePath The controller device path will be deleted
168 when all drivers images on it are removed.
169 @param DriverImageDevicePath The driver image device path will be delete.
170 If NULL, all driver image will be delete.
171 @param MappingDataBase Mapping database list entry pointer
173 @retval EFI_INVALID_PARAMETER ControllerDevicePath is NULL, or MappingDataBase is NULL
174 @retval EFI_NOT_FOUND ControllerDevicePath is not found in MappingDataBase or
175 DriverImageDevicePath is not found in the found DriverImage Info list.
176 @retval EFI_SUCCESS Delete the specified driver successfully.
182 IN EFI_DEVICE_PATH_PROTOCOL
*ControllerDevicePath
,
183 IN EFI_DEVICE_PATH_PROTOCOL
*DriverImageDevicePath
,
184 IN LIST_ENTRY
*MappingDataBase