3 This library provides basic platform driver override functions.
5 Copyright (c) 2007 - 2008, 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 _PLAT_DRI_OVER_LIB_H_
17 #define _PLAT_DRI_OVER_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
37 Read the NV environment variable(s) that contain the override mappings from Controller Device Path to
38 a set of Driver Device Paths, and create the mapping database in memory to contain these variable info.
40 @param MappingDataBase Mapping database list entry pointer
42 @retval EFI_INVALID_PARAMETER MappingDataBase pointer is null
43 @retval EFI_NOT_FOUND Cannot find the 'PlatDriOver' NV variable
44 @retval EFI_VOLUME_CORRUPTED The found NV variable is corrupted
45 @retval EFI_SUCCESS Create the mapping database in memory successfully
50 InitOverridesMapping (
51 OUT LIST_ENTRY
*MappingDataBase
55 Save the memory mapping database into NV environment variable(s).
56 If MappingDataBase list is empty, then delete all platform override NV variables.
58 @param MappingDataBase Mapping database list entry pointer
60 @retval EFI_INVALID_PARAMETER MappingDataBase pointer is null
61 @retval EFI_SUCCESS Save memory mapping database successfully
66 SaveOverridesMapping (
67 IN LIST_ENTRY
*MappingDataBase
71 Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database.
73 @param ControllerHandle The device handle of the controller to check if
74 a driver override exists.
75 @param DriverImageHandle On output, a pointer to the next driver handle.
76 Passing in a pointer to NULL, will return the
77 first driver handle for ControllerHandle.
78 @param MappingDataBase MappingDataBase - Mapping database list entry
80 @param CallerImageHandle The caller driver's image handle, for
81 UpdateFvFileDevicePath use.
83 @retval EFI_INVALID_PARAMETER The handle specified by ControllerHandle is not
84 a valid handle. Or DriverImagePath is not a
85 device path that was returned on a previous call
87 @retval EFI_NOT_FOUND A driver override for ControllerHandle was not
89 @retval EFI_UNSUPPORTED The operation is not supported.
90 @retval EFI_SUCCESS The driver override for ControllerHandle was
91 returned in DriverImagePath.
96 GetDriverFromMapping (
97 IN EFI_HANDLE ControllerHandle
,
98 IN OUT EFI_HANDLE
*DriverImageHandle
,
99 IN LIST_ENTRY
*MappingDataBase
,
100 IN EFI_HANDLE CallerImageHandle
104 Check mapping database whether already has the mapping info which
105 records the input Controller to input DriverImage.
107 @param ControllerDevicePath The controller device path is to be check.
108 @param DriverImageDevicePath The driver image device path is to be check.
109 @param MappingDataBase Mapping database list entry pointer
110 @param DriverInfoNum the controller's total override driver number
111 @param DriverImageNO The driver order number for the input DriverImage.
112 If the DriverImageDevicePath is NULL, DriverImageNO is not set.
114 @retval EFI_INVALID_PARAMETER ControllerDevicePath or MappingDataBase is NULL.
115 @retval EFI_NOT_FOUND ControllerDevicePath is not found in MappingDataBase or
116 DriverImageDevicePath is not found in the found DriverImage Info list.
117 @retval EFI_SUCCESS The controller's total override driver number and
118 input DriverImage's order number is correctly return.
123 IN EFI_DEVICE_PATH_PROTOCOL
*ControllerDevicePath
,
124 IN EFI_DEVICE_PATH_PROTOCOL
*DriverImageDevicePath OPTIONAL
,
125 IN LIST_ENTRY
*MappingDataBase
,
126 OUT UINT32
*DriverInfoNum OPTIONAL
,
127 OUT UINT32
*DriverImageNO OPTIONAL
131 Insert a driver image as a controller's override driver into the mapping database.
132 The driver image's order number is indicated by DriverImageNO.
134 @param ControllerDevicePath The controller device path need to add a
135 override driver image item
136 @param DriverImageDevicePath The driver image device path need to be insert
137 @param MappingDataBase Mapping database list entry pointer
138 @param DriverImageNO The inserted order number. If this number is taken,
139 the larger available number will be used.
141 @retval EFI_INVALID_PARAMETER ControllerDevicePath is NULL, or DriverImageDevicePath is NULL
142 or MappingDataBase is NULL
143 @retval EFI_ALREADY_STARTED The input Controller to input DriverImage has been
144 recorded into the mapping database.
145 @retval EFI_SUCCESS The Controller and DriverImage are inserted into
146 the mapping database successfully.
152 IN EFI_DEVICE_PATH_PROTOCOL
*ControllerDevicePath
,
153 IN EFI_DEVICE_PATH_PROTOCOL
*DriverImageDevicePath
,
154 IN LIST_ENTRY
*MappingDataBase
,
155 IN UINT32 DriverImageNO
159 Delete a controller's override driver from the mapping database.
161 @param ControllerDevicePath The controller device path will be deleted
162 when all drivers images on it are removed.
163 @param DriverImageDevicePath The driver image device path will be delete.
164 If NULL, all driver image will be delete.
165 @param MappingDataBase Mapping database list entry pointer
167 @retval EFI_INVALID_PARAMETER ControllerDevicePath is NULL, or MappingDataBase is NULL
168 @retval EFI_NOT_FOUND ControllerDevicePath is not found in MappingDataBase or
169 DriverImageDevicePath is not found in the found DriverImage Info list.
170 @retval EFI_SUCCESS Delete the specified driver successfully.
176 IN EFI_DEVICE_PATH_PROTOCOL
*ControllerDevicePath
,
177 IN EFI_DEVICE_PATH_PROTOCOL
*DriverImageDevicePath
,
178 IN LIST_ENTRY
*MappingDataBase