TianoCore EDK2 master
|
#include <PiDxe.h>
#include <Protocol/HiiConfigAccess.h>
#include <Protocol/HiiConfigRouting.h>
#include <Protocol/HiiDatabase.h>
#include <Protocol/FormBrowser2.h>
#include <Protocol/LoadedImage.h>
#include <Protocol/FirmwareVolume2.h>
#include <Protocol/PciIo.h>
#include <Protocol/BusSpecificDriverOverride.h>
#include <Protocol/ComponentName2.h>
#include <Protocol/ComponentName.h>
#include <Protocol/DriverBinding.h>
#include <Protocol/DevicePath.h>
#include <Protocol/PlatformDriverOverride.h>
#include <Guid/MdeModuleHii.h>
#include <Guid/VariableFormat.h>
#include <Library/BaseLib.h>
#include <Library/DebugLib.h>
#include <Library/UefiLib.h>
#include <Library/PrintLib.h>
#include <Library/UefiDriverEntryPoint.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/UefiRuntimeServicesTableLib.h>
#include <Library/BaseMemoryLib.h>
#include <Library/MemoryAllocationLib.h>
#include <Library/DevicePathLib.h>
#include <Library/DxeServicesTableLib.h>
#include <Library/HiiLib.h>
Go to the source code of this file.
Functions | |
EFI_STATUS EFIAPI | FreeMappingDatabase (IN OUT LIST_ENTRY *MappingDataBase) |
EFI_STATUS EFIAPI | InitOverridesMapping (OUT LIST_ENTRY *MappingDataBase) |
EFI_STATUS EFIAPI | SaveOverridesMapping (IN LIST_ENTRY *MappingDataBase) |
EFI_STATUS EFIAPI | GetDriverFromMapping (IN EFI_HANDLE ControllerHandle, IN OUT EFI_HANDLE *DriverImageHandle, IN LIST_ENTRY *MappingDataBase, IN EFI_HANDLE CallerImageHandle) |
EFI_STATUS EFIAPI | CheckMapping (IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath, IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath OPTIONAL, IN LIST_ENTRY *MappingDataBase, OUT UINT32 *DriverInfoNum OPTIONAL, OUT UINT32 *DriverImageNO OPTIONAL) |
EFI_STATUS EFIAPI | InsertDriverImage (IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath, IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath, IN LIST_ENTRY *MappingDataBase, IN UINT32 DriverImageNO) |
EFI_STATUS EFIAPI | DeleteDriverImage (IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath, IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath, IN LIST_ENTRY *MappingDataBase) |
Ihe internal heder file includes the required Protocol/Guid/Library and the shared function APIs.
Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent
Definition in file InternalPlatDriOverrideDxe.h.
EFI_STATUS EFIAPI CheckMapping | ( | IN EFI_DEVICE_PATH_PROTOCOL * | ControllerDevicePath, |
IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath | OPTIONAL, | ||
IN LIST_ENTRY * | MappingDataBase, | ||
OUT UINT32 *DriverInfoNum | OPTIONAL, | ||
OUT UINT32 *DriverImageNO | OPTIONAL | ||
) |
Check mapping database whether already has the mapping info which records the input Controller to input DriverImage.
ControllerDevicePath | The controller device path is to be check. |
DriverImageDevicePath | The driver image device path is to be check. |
MappingDataBase | Mapping database list entry pointer |
DriverInfoNum | the controller's total override driver number |
DriverImageNO | The driver order number for the input DriverImage. If the DriverImageDevicePath is NULL, DriverImageNO is not set. |
EFI_INVALID_PARAMETER | ControllerDevicePath or MappingDataBase is NULL. |
EFI_NOT_FOUND | ControllerDevicePath is not found in MappingDataBase or DriverImageDevicePath is not found in the found DriverImage Info list. |
EFI_SUCCESS | The controller's total override driver number and input DriverImage's order number is correctly return. |
Definition at line 1594 of file PlatDriOverrideLib.c.
EFI_STATUS EFIAPI DeleteDriverImage | ( | IN EFI_DEVICE_PATH_PROTOCOL * | ControllerDevicePath, |
IN EFI_DEVICE_PATH_PROTOCOL * | DriverImageDevicePath, | ||
IN LIST_ENTRY * | MappingDataBase | ||
) |
Delete a controller's override driver from the mapping database.
ControllerDevicePath | The controller device path will be deleted when all drivers images on it are removed. |
DriverImageDevicePath | The driver image device path will be delete. If NULL, all driver image will be delete. |
MappingDataBase | Mapping database list entry pointer |
EFI_INVALID_PARAMETER | ControllerDevicePath is NULL, or MappingDataBase is NULL |
EFI_NOT_FOUND | ControllerDevicePath is not found in MappingDataBase or DriverImageDevicePath is not found in the found DriverImage Info list. |
EFI_SUCCESS | Delete the specified driver successfully. |
Definition at line 1861 of file PlatDriOverrideLib.c.
EFI_STATUS EFIAPI FreeMappingDatabase | ( | IN OUT LIST_ENTRY * | MappingDataBase | ) |
Free all the mapping database memory resource and initialize the mapping list entry.
MappingDataBase | Mapping database list entry pointer |
EFI_INVALID_PARAMETER | mapping database list entry is NULL |
EFI_SUCCESS | Free success |
Free all the mapping database memory resource and initialize the mapping list entry.
MappingDataBase | Mapping database list entry pointer |
EFI_SUCCESS | Mapping database successfully freed |
EFI_INVALID_PARAMETER | MappingDataBase is NULL |
Definition at line 563 of file PlatDriOverrideLib.c.
EFI_STATUS EFIAPI GetDriverFromMapping | ( | IN EFI_HANDLE | ControllerHandle, |
IN OUT EFI_HANDLE * | DriverImageHandle, | ||
IN LIST_ENTRY * | MappingDataBase, | ||
IN EFI_HANDLE | CallerImageHandle | ||
) |
Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database.
ControllerHandle | The device handle of the controller to check if a driver override exists. |
DriverImageHandle | On output, a pointer to the next driver handle. Passing in a pointer to NULL, will return the first driver handle for ControllerHandle. |
MappingDataBase | MappingDataBase - Mapping database list entry pointer |
CallerImageHandle | The caller driver's image handle, for UpdateFvFileDevicePath use. |
EFI_INVALID_PARAMETER | The handle specified by ControllerHandle is not a valid handle. Or DriverImagePath is not a device path that was returned on a previous call to GetDriverPath(). |
EFI_NOT_FOUND | A driver override for ControllerHandle was not found. |
EFI_UNSUPPORTED | The operation is not supported. |
EFI_SUCCESS | The driver override for ControllerHandle was returned in DriverImagePath. |
Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database.
ControllerHandle | The device handle of the controller to check if a driver override exists. |
DriverImageHandle | On input, the previously returnd driver image handle. On output, a pointer to the next driver handle. Passing in a pointer to NULL, will return the first driver handle for ControllerHandle. |
MappingDataBase | Mapping database list entry pointer |
CallerImageHandle | The caller driver's image handle, for UpdateFvFileDevicePath use. |
EFI_INVALID_PARAMETER | The handle specified by ControllerHandle is not a valid handle. Or DriverImagePath is not a device path that was returned on a previous call to GetDriverPath(). |
EFI_NOT_FOUND | A driver override for ControllerHandle was not found. |
EFI_UNSUPPORTED | The operation is not supported. |
EFI_SUCCESS | The driver override for ControllerHandle was returned in DriverImagePath. |
Definition at line 1239 of file PlatDriOverrideLib.c.
EFI_STATUS EFIAPI InitOverridesMapping | ( | OUT LIST_ENTRY * | MappingDataBase | ) |
Read the NV environment variable(s) that contain the override mappings from Controller Device Path to a set of Driver Device Paths, and create the mapping database in memory to contain these variable info.
MappingDataBase | Mapping database list entry pointer |
EFI_INVALID_PARAMETER | MappingDataBase pointer is null |
EFI_NOT_FOUND | Cannot find the 'PlatDriOver' NV variable |
EFI_VOLUME_CORRUPTED | The found NV variable is corrupted |
EFI_SUCCESS | Create the mapping database in memory successfully |
Create the mapping database according to variable.
Read the environment variable(s) that contain the override mappings from Controller Device Path to a set of Driver Device Paths, and create the mapping database in memory with those variable info. VariableLayout{
NotEnd indicate whether the variable is the last one, and has no subsequent variable need to load. Each variable has MaximumVariableSize limitation, so we maybe need multiple variables to store large mapping infos. The variable(s) name rule is PlatDriOver, PlatDriOver1, PlatDriOver2, ....
UINT32 NotEnd; //Zero is the last one.
The entry which contains the mapping that Controller Device Path to a set of Driver Device Paths There are often multi mapping entries in a variable.
UINT32 SIGNATURE; //SIGNATURE_32('p','d','o','i') UINT32 DriverNum; EFI_DEVICE_PATH_PROTOCOL ControllerDevicePath[]; EFI_DEVICE_PATH_PROTOCOL DriverDevicePath[]; EFI_DEVICE_PATH_PROTOCOL DriverDevicePath[]; EFI_DEVICE_PATH_PROTOCOL DriverDevicePath[]; ...... UINT32 NotEnd; //Zero is the last one. UINT32 SIGNATURE; UINT32 DriverNum; EFI_DEVICE_PATH_PROTOCOL ControllerDevicePath[]; EFI_DEVICE_PATH_PROTOCOL DriverDevicePath[]; EFI_DEVICE_PATH_PROTOCOL DriverDevicePath[]; EFI_DEVICE_PATH_PROTOCOL DriverDevicePath[]; ...... }
MappingDataBase | Mapping database list entry pointer |
EFI_SUCCESS | Create the mapping database in memory successfully |
EFI_INVALID_PARAMETER | MappingDataBase pointer is null |
EFI_NOT_FOUND | Cannot find the 'PlatDriOver' NV variable |
EFI_VOLUME_CORRUPTED | The found NV variable is corrupted |
Definition at line 660 of file PlatDriOverrideLib.c.
EFI_STATUS EFIAPI InsertDriverImage | ( | IN EFI_DEVICE_PATH_PROTOCOL * | ControllerDevicePath, |
IN EFI_DEVICE_PATH_PROTOCOL * | DriverImageDevicePath, | ||
IN LIST_ENTRY * | MappingDataBase, | ||
IN UINT32 | DriverImageNO | ||
) |
Insert a driver image as a controller's override driver into the mapping database. The driver image's order number is indicated by DriverImageNO.
ControllerDevicePath | The controller device path need to add a override driver image item |
DriverImageDevicePath | The driver image device path need to be insert |
MappingDataBase | Mapping database list entry pointer |
DriverImageNO | The inserted order number. If this number is taken, the larger available number will be used. |
EFI_INVALID_PARAMETER | ControllerDevicePath is NULL, or DriverImageDevicePath is NULL or MappingDataBase is NULL |
EFI_ALREADY_STARTED | The input Controller to input DriverImage has been recorded into the mapping database. |
EFI_SUCCESS | The Controller and DriverImage are inserted into the mapping database successfully. |
Definition at line 1724 of file PlatDriOverrideLib.c.
EFI_STATUS EFIAPI SaveOverridesMapping | ( | IN LIST_ENTRY * | MappingDataBase | ) |
Save the memory mapping database into NV environment variable(s). If MappingDataBase list is empty, then delete all platform override NV variables.
MappingDataBase | Mapping database list entry pointer |
EFI_INVALID_PARAMETER | MappingDataBase pointer is null |
EFI_SUCCESS | Save memory mapping database successfully |
Save the memory mapping database into NV environment variable(s).
MappingDataBase | Mapping database list entry pointer |
EFI_SUCCESS | Save memory mapping database successfully |
EFI_INVALID_PARAMETER | MappingDataBase pointer is null |
Definition at line 955 of file PlatDriOverrideLib.c.