]> git.proxmox.com Git - mirror_edk2.git/blob - MdeModulePkg/Include/Library/PlatDriOverLib.h
Add () after function name so that Doxygen can create reference in doc.
[mirror_edk2.git] / MdeModulePkg / Include / Library / PlatDriOverLib.h
1 /** @file
2
3 This library provides basic platform driver override functions.
4
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
10
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.
13
14 **/
15
16 #ifndef _PLAT_DRI_OVER_LIB_H_
17 #define _PLAT_DRI_OVER_LIB_H_
18
19 #include <Protocol/DevicePath.h>
20
21 /**
22 Free all the mapping database memory resource and initialize the mapping list entry.
23
24 @param MappingDataBase Mapping database list entry pointer
25
26 @retval EFI_INVALID_PARAMETER mapping database list entry is NULL
27 @retval EFI_SUCCESS Free success
28
29 **/
30 EFI_STATUS
31 EFIAPI
32 FreeMappingDatabase (
33 IN OUT LIST_ENTRY *MappingDataBase
34 );
35
36 /**
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.
39
40 @param MappingDataBase Mapping database list entry pointer
41
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
46
47 **/
48 EFI_STATUS
49 EFIAPI
50 InitOverridesMapping (
51 OUT LIST_ENTRY *MappingDataBase
52 );
53
54 /**
55 Save the memory mapping database into NV environment variable(s).
56 If MappingDataBase list is empty, then delete all platform override NV variables.
57
58 @param MappingDataBase Mapping database list entry pointer
59
60 @retval EFI_INVALID_PARAMETER MappingDataBase pointer is null
61 @retval EFI_SUCCESS Save memory mapping database successfully
62
63 **/
64 EFI_STATUS
65 EFIAPI
66 SaveOverridesMapping (
67 IN LIST_ENTRY *MappingDataBase
68 );
69
70 /**
71 Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database.
72
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
79 pointer
80 @param CallerImageHandle The caller driver's image handle, for
81 UpdateFvFileDevicePath use.
82
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
86 to GetDriverPath().
87 @retval EFI_NOT_FOUND A driver override for ControllerHandle was not
88 found.
89 @retval EFI_UNSUPPORTED The operation is not supported.
90 @retval EFI_SUCCESS The driver override for ControllerHandle was
91 returned in DriverImagePath.
92
93 **/
94 EFI_STATUS
95 EFIAPI
96 GetDriverFromMapping (
97 IN EFI_HANDLE ControllerHandle,
98 IN OUT EFI_HANDLE *DriverImageHandle,
99 IN LIST_ENTRY *MappingDataBase,
100 IN EFI_HANDLE CallerImageHandle
101 );
102
103 /**
104 Check mapping database whether already has the mapping info which
105 records the input Controller to input DriverImage.
106
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.
113
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.
119 **/
120 EFI_STATUS
121 EFIAPI
122 CheckMapping (
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
128 );
129
130 /**
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.
133
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.
140
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.
147
148 **/
149 EFI_STATUS
150 EFIAPI
151 InsertDriverImage (
152 IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath,
153 IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath,
154 IN LIST_ENTRY *MappingDataBase,
155 IN UINT32 DriverImageNO
156 );
157
158 /**
159 Delete a controller's override driver from the mapping database.
160
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
166
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.
171
172 **/
173 EFI_STATUS
174 EFIAPI
175 DeleteDriverImage (
176 IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath,
177 IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath,
178 IN LIST_ENTRY *MappingDataBase
179 );
180
181 #endif