Code Clean for Driver PlatformDriOverrideDxe and PlatOverMngr application. And Clean PlatDriOver library class.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@7121 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -1,7 +1,8 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
This file defines the Alternate Firmware Volume Block Guid, which is
|
This file defines the Alternate Firmware Volume Block Guid, which is
|
||||||
used to specify that the additional FVB protocol is installed into FVB handle.
|
used to specify that the full funcationality FVB protocol is installed
|
||||||
|
that support read, write and erase capability for block devices.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation
|
Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This file defines the platform override variable name and variable guid.
|
This file defines the platform driver override variable name and variable guid.
|
||||||
|
|
||||||
Copyright (c) 2008, Intel Corporation
|
Copyright (c) 2008, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
@ -25,5 +25,4 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
|
|
||||||
extern EFI_GUID gEfiOverrideVariableGuid;
|
extern EFI_GUID gEfiOverrideVariableGuid;
|
||||||
|
|
||||||
|
|
||||||
#endif // #ifndef __EFI_OVERRIDE_VARIABLE_GUID_H__
|
#endif // #ifndef __EFI_OVERRIDE_VARIABLE_GUID_H__
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
/** @file
|
/** @file
|
||||||
This file defines NvDataHob GUIDs for System Non Volatile HOB entries
|
This file defines NvData Hob GUIDs for System Non Volatile HOB entries and the corresponding hob data structure.
|
||||||
in the HOB list and NV system hob entry structure.
|
NvData Hob is used to report the region of the system non volatile data
|
||||||
|
for the specific purpose, such as FTW region, Error log region.
|
||||||
|
|
||||||
It also defines NvDataFv GUID used as the signature of FTW working block header.
|
It also defines NvDataFv GUID used as the signature of FTW working block header.
|
||||||
|
|
||||||
Copyright (c) 2006 - 2008, Intel Corporation
|
Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
@ -27,13 +29,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
/// Hob entry for NV data region
|
/// Hob entry for NV data region
|
||||||
///
|
///
|
||||||
typedef struct {
|
typedef struct {
|
||||||
EFI_GUID SystemNvDataHobGuid; /// EFI_SYSTEM_NV_DATA_HOB_GUID
|
EFI_GUID SystemNvDataHobGuid; ///> EFI_SYSTEM_NV_DATA_HOB_GUID
|
||||||
EFI_GUID SystemNvDataFvGuid; /// Guid specifies the NvData Fv for the specific purpose, such as FTW, Error Log.
|
EFI_GUID SystemNvDataFvGuid; ///> Guid specifies the NvData Fv for the specific purpose, such as FTW, Error Log.
|
||||||
EFI_LBA StartLba; /// The starting logical block index.
|
EFI_LBA StartLba; ///> The starting logical block index.
|
||||||
UINTN StartLbaOffset; /// Offset into the starting block at which to the start of NvData region.
|
UINTN StartLbaOffset; ///> Offset into the starting block at which to the start of NvData region.
|
||||||
EFI_LBA EndLba; /// The last logical block index.
|
EFI_LBA EndLba; ///> The last logical block index.
|
||||||
UINTN EndLbaOffset; /// Offset into the last block at which to the end of Nvdata region.
|
UINTN EndLbaOffset; ///> Offset into the last block at which to the end of Nvdata region.
|
||||||
UINT32 DataTypeSignature; /// NvData type in the specified NV range.
|
UINT32 DataTypeSignature; ///> NvData type in the specified NV range.
|
||||||
} NV_SYSTEM_DATA_GUID_TYPE;
|
} NV_SYSTEM_DATA_GUID_TYPE;
|
||||||
|
|
||||||
extern EFI_GUID gEfiSystemNvDataHobGuid;
|
extern EFI_GUID gEfiSystemNvDataHobGuid;
|
||||||
|
@ -16,30 +16,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#ifndef _PLAT_DRI_OVER_LIB_H_
|
#ifndef _PLAT_DRI_OVER_LIB_H_
|
||||||
#define _PLAT_DRI_OVER_LIB_H_
|
#define _PLAT_DRI_OVER_LIB_H_
|
||||||
|
|
||||||
#include <Protocol/PlatformDriverOverride.h>
|
|
||||||
#include <Protocol/DevicePath.h>
|
#include <Protocol/DevicePath.h>
|
||||||
#include <Protocol/DriverBinding.h>
|
|
||||||
#include <Library/BaseLib.h>
|
|
||||||
|
|
||||||
#include <VariableFormat.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
Install the Platform Driver Override Protocol, and ensure there is only one Platform Driver Override Protocol
|
|
||||||
in the system.
|
|
||||||
|
|
||||||
@param gPlatformDriverOverride PlatformDriverOverride protocol interface which
|
|
||||||
needs to be installed
|
|
||||||
|
|
||||||
@retval EFI_ALREADY_STARTED There has been a Platform Driver Override
|
|
||||||
Protocol in the system, cannot install it again.
|
|
||||||
@retval EFI_SUCCESS The protocol is installed successfully.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
InstallPlatformDriverOverrideProtocol (
|
|
||||||
EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *gPlatformDriverOverride
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free all the mapping database memory resource and initialize the mapping list entry.
|
Free all the mapping database memory resource and initialize the mapping list entry.
|
||||||
@ -57,8 +34,8 @@ FreeMappingDatabase (
|
|||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Read the environment variable(s) that contain the override mappings from Controller Device Path to
|
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 with those variable info.
|
a set of Driver Device Paths, and create the mapping database in memory to contain these variable info.
|
||||||
|
|
||||||
@param MappingDataBase Mapping database list entry pointer
|
@param MappingDataBase Mapping database list entry pointer
|
||||||
|
|
||||||
@ -76,6 +53,7 @@ InitOverridesMapping (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Save the memory mapping database into NV environment variable(s).
|
Save the memory mapping database into NV environment variable(s).
|
||||||
|
If MappingDataBase list is empty, then delete all platform override NV variables.
|
||||||
|
|
||||||
@param MappingDataBase Mapping database list entry pointer
|
@param MappingDataBase Mapping database list entry pointer
|
||||||
|
|
||||||
@ -92,7 +70,6 @@ SaveOverridesMapping (
|
|||||||
/**
|
/**
|
||||||
Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database.
|
Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database.
|
||||||
|
|
||||||
@param This A pointer to the EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL instance.
|
|
||||||
@param ControllerHandle The device handle of the controller to check if
|
@param ControllerHandle The device handle of the controller to check if
|
||||||
a driver override exists.
|
a driver override exists.
|
||||||
@param DriverImageHandle On output, a pointer to the next driver handle.
|
@param DriverImageHandle On output, a pointer to the next driver handle.
|
||||||
@ -117,25 +94,12 @@ SaveOverridesMapping (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GetDriverFromMapping (
|
GetDriverFromMapping (
|
||||||
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL * This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
IN EFI_HANDLE ControllerHandle,
|
||||||
IN OUT EFI_HANDLE * DriverImageHandle,
|
IN OUT EFI_HANDLE *DriverImageHandle,
|
||||||
IN LIST_ENTRY * MappingDataBase,
|
IN LIST_ENTRY *MappingDataBase,
|
||||||
IN EFI_HANDLE CallerImageHandle
|
IN EFI_HANDLE CallerImageHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
Deletes all environment variable(s) that contain the override mappings from Controller Device Path to
|
|
||||||
a set of Driver Device Paths.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Delete all variable(s) successfully.
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
DeleteOverridesVariables (
|
|
||||||
VOID
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Check mapping database whether already has the mapping info which
|
Check mapping database whether already has the mapping info which
|
||||||
records the input Controller to input DriverImage.
|
records the input Controller to input DriverImage.
|
||||||
@ -214,22 +178,4 @@ DeleteDriverImage (
|
|||||||
IN LIST_ENTRY *MappingDataBase
|
IN LIST_ENTRY *MappingDataBase
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
|
||||||
Get the first Binding protocol which has the specific image handle
|
|
||||||
|
|
||||||
@param ImageHandle The Image handle
|
|
||||||
@param BindingHandle The BindingHandle of the found Driver Binding protocol.
|
|
||||||
If Binding protocol is not found, it is set to NULL.
|
|
||||||
|
|
||||||
@return Pointer into the Binding Protocol interface
|
|
||||||
@retval NULL The parameter is not valid or the binding protocol is not found.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_DRIVER_BINDING_PROTOCOL *
|
|
||||||
EFIAPI
|
|
||||||
GetBindingProtocolFromImageHandle (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
OUT EFI_HANDLE *BindingHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -43,7 +43,8 @@ typedef struct _EFI_FTW_LITE_PROTOCOL EFI_FTW_LITE_PROTOCOL;
|
|||||||
|
|
||||||
@retval EFI_SUCCESS The function completed successfully
|
@retval EFI_SUCCESS The function completed successfully
|
||||||
@retval EFI_ABORTED The function could not complete successfully.
|
@retval EFI_ABORTED The function could not complete successfully.
|
||||||
@retval EFI_BAD_BUFFER_SIZE The input data can't fit within the target block.
|
@retval EFI_BAD_BUFFER_SIZE The input data can't fit within the FTW range.
|
||||||
|
The write buffer is too large to be supported.
|
||||||
@retval EFI_ACCESS_DENIED No writes have been allocated.
|
@retval EFI_ACCESS_DENIED No writes have been allocated.
|
||||||
@retval EFI_OUT_OF_RESOURCES Cannot allocate enough memory resource.
|
@retval EFI_OUT_OF_RESOURCES Cannot allocate enough memory resource.
|
||||||
@retval EFI_NOT_FOUND Cannot find FVB protocol by handle.
|
@retval EFI_NOT_FOUND Cannot find FVB protocol by handle.
|
||||||
|
@ -94,10 +94,10 @@ typedef struct {
|
|||||||
///
|
///
|
||||||
/// Variable State flags
|
/// Variable State flags
|
||||||
///
|
///
|
||||||
#define VAR_IN_DELETED_TRANSITION 0xfe /// Variable is in obsolete transistion
|
#define VAR_IN_DELETED_TRANSITION 0xfe ///< Variable is in obsolete transistion
|
||||||
#define VAR_DELETED 0xfd /// Variable is obsolete
|
#define VAR_DELETED 0xfd ///< Variable is obsolete
|
||||||
#define VAR_HEADER_VALID_ONLY 0x7f /// Variable header has been valid
|
#define VAR_HEADER_VALID_ONLY 0x7f ///< Variable header has been valid
|
||||||
#define VAR_ADDED 0x3f /// Variable has been completely added
|
#define VAR_ADDED 0x3f ///< Variable has been completely added
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Removed
|
/// Removed
|
||||||
|
@ -54,7 +54,6 @@
|
|||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
gEfiLoadedImageProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiLoadedImageProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
gEfiPlatformDriverOverrideProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
|
||||||
gEfiBusSpecificDriverOverrideProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiBusSpecificDriverOverrideProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
gEfiDriverBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiDriverBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
@ -19,9 +19,7 @@
|
|||||||
|
|
||||||
#include <Protocol/FirmwareVolume2.h>
|
#include <Protocol/FirmwareVolume2.h>
|
||||||
#include <Protocol/LoadedImage.h>
|
#include <Protocol/LoadedImage.h>
|
||||||
#include <Protocol/PlatformDriverOverride.h>
|
|
||||||
#include <Protocol/DevicePath.h>
|
#include <Protocol/DevicePath.h>
|
||||||
#include <Protocol/DriverBinding.h>
|
|
||||||
#include <Protocol/BusSpecificDriverOverride.h>
|
#include <Protocol/BusSpecificDriverOverride.h>
|
||||||
|
|
||||||
#include <Library/BaseLib.h>
|
#include <Library/BaseLib.h>
|
||||||
@ -37,6 +35,7 @@
|
|||||||
#include <Library/PlatDriOverLib.h>
|
#include <Library/PlatDriOverLib.h>
|
||||||
|
|
||||||
#include <Guid/OverrideVariable.h>
|
#include <Guid/OverrideVariable.h>
|
||||||
|
#include <VariableFormat.h>
|
||||||
|
|
||||||
|
|
||||||
#define PLATFORM_OVERRIDE_ITEM_SIGNATURE SIGNATURE_32('p','d','o','i')
|
#define PLATFORM_OVERRIDE_ITEM_SIGNATURE SIGNATURE_32('p','d','o','i')
|
||||||
|
@ -16,69 +16,6 @@
|
|||||||
|
|
||||||
LIST_ENTRY mDevicePathStack = INITIALIZE_LIST_HEAD_VARIABLE (mDevicePathStack);
|
LIST_ENTRY mDevicePathStack = INITIALIZE_LIST_HEAD_VARIABLE (mDevicePathStack);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Installs the Platform Driver Override Protocol.
|
|
||||||
|
|
||||||
This function installs the Platform Driver Override Protocol, and ensure there is only one
|
|
||||||
Platform Driver Override Protocol in the system.
|
|
||||||
|
|
||||||
@param gPlatformDriverOverride PlatformDriverOverride protocol interface which
|
|
||||||
needs to be installed
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The protocol is installed successfully.
|
|
||||||
@retval EFI_ALREADY_STARTED There has been a Platform Driver Override
|
|
||||||
Protocol in the system, cannot install it again.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
InstallPlatformDriverOverrideProtocol (
|
|
||||||
EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *gPlatformDriverOverride
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_HANDLE Handle;
|
|
||||||
EFI_STATUS Status;
|
|
||||||
UINTN HandleCount;
|
|
||||||
EFI_HANDLE *HandleBuffer;
|
|
||||||
|
|
||||||
//
|
|
||||||
// According to UEFI spec, there can be at most a single instance
|
|
||||||
// in the system of the EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL.
|
|
||||||
// So here we check the existence.
|
|
||||||
//
|
|
||||||
Status = gBS->LocateHandleBuffer (
|
|
||||||
ByProtocol,
|
|
||||||
&gEfiPlatformDriverOverrideProtocolGuid,
|
|
||||||
NULL,
|
|
||||||
&HandleCount,
|
|
||||||
&HandleBuffer
|
|
||||||
);
|
|
||||||
//
|
|
||||||
// If there was no error, assume there is an installation and return error
|
|
||||||
//
|
|
||||||
if (!EFI_ERROR (Status)) {
|
|
||||||
if (HandleBuffer != NULL) {
|
|
||||||
FreePool (HandleBuffer);
|
|
||||||
}
|
|
||||||
return EFI_ALREADY_STARTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Install platform driver override protocol
|
|
||||||
//
|
|
||||||
Handle = NULL;
|
|
||||||
Status = gBS->InstallProtocolInterface (
|
|
||||||
&Handle,
|
|
||||||
&gEfiPlatformDriverOverrideProtocolGuid,
|
|
||||||
EFI_NATIVE_INTERFACE,
|
|
||||||
gPlatformDriverOverride
|
|
||||||
);
|
|
||||||
ASSERT_EFI_ERROR (Status);
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Free all the mapping database memory resource and initialize the mapping list entry.
|
Free all the mapping database memory resource and initialize the mapping list entry.
|
||||||
|
|
||||||
@ -154,7 +91,7 @@ FreeMappingDatabase (
|
|||||||
// large mapping infos.
|
// large mapping infos.
|
||||||
// The variable(s) name rule is PlatDriOver, PlatDriOver1, PlatDriOver2, ....
|
// The variable(s) name rule is PlatDriOver, PlatDriOver1, PlatDriOver2, ....
|
||||||
//
|
//
|
||||||
UINT32 NotEnd;
|
UINT32 NotEnd; //Zero is the last one.
|
||||||
//
|
//
|
||||||
// The entry which contains the mapping that Controller Device Path to a set of Driver Device Paths
|
// 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.
|
// There are often multi mapping entries in a variable.
|
||||||
@ -166,6 +103,7 @@ FreeMappingDatabase (
|
|||||||
EFI_DEVICE_PATH_PROTOCOL DriverDevicePath[];
|
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 SIGNATURE;
|
||||||
UINT32 DriverNum;
|
UINT32 DriverNum;
|
||||||
EFI_DEVICE_PATH_PROTOCOL ControllerDevicePath[];
|
EFI_DEVICE_PATH_PROTOCOL ControllerDevicePath[];
|
||||||
@ -224,6 +162,9 @@ InitOverridesMapping (
|
|||||||
Corrupted = FALSE;
|
Corrupted = FALSE;
|
||||||
do {
|
do {
|
||||||
VariableIndex = VariableBuffer;
|
VariableIndex = VariableBuffer;
|
||||||
|
//
|
||||||
|
// End flag
|
||||||
|
//
|
||||||
NotEnd = *(UINT32*) VariableIndex;
|
NotEnd = *(UINT32*) VariableIndex;
|
||||||
//
|
//
|
||||||
// Traverse the entries containing the mapping that Controller Device Path
|
// Traverse the entries containing the mapping that Controller Device Path
|
||||||
@ -363,6 +304,69 @@ GetOneItemNeededSize (
|
|||||||
return NeededSize;
|
return NeededSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Deletes all environment variable(s) that contain the override mappings from Controller Device Path to
|
||||||
|
a set of Driver Device Paths.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS Delete all variable(s) successfully.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
DeleteOverridesVariables (
|
||||||
|
VOID
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
VOID *VariableBuffer;
|
||||||
|
UINTN VariableNum;
|
||||||
|
UINTN BufferSize;
|
||||||
|
UINTN Index;
|
||||||
|
CHAR16 OverrideVariableName[40];
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get environment variable(s) number
|
||||||
|
//
|
||||||
|
VariableNum = 0;
|
||||||
|
VariableBuffer = GetVariableAndSize (L"PlatDriOver", &gEfiOverrideVariableGuid, &BufferSize);
|
||||||
|
VariableNum++;
|
||||||
|
if (VariableBuffer == NULL) {
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Check NotEnd to get all PlatDriOverX variable(s)
|
||||||
|
//
|
||||||
|
while ((*(UINT32*)VariableBuffer) != 0) {
|
||||||
|
UnicodeSPrint (OverrideVariableName, sizeof (OverrideVariableName), L"PlatDriOver%d", VariableNum);
|
||||||
|
VariableBuffer = GetVariableAndSize (OverrideVariableName, &gEfiOverrideVariableGuid, &BufferSize);
|
||||||
|
VariableNum++;
|
||||||
|
ASSERT (VariableBuffer != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Delete PlatDriOver and all additional variables, if exist.
|
||||||
|
//
|
||||||
|
Status = gRT->SetVariable (
|
||||||
|
L"PlatDriOver",
|
||||||
|
&gEfiOverrideVariableGuid,
|
||||||
|
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||||
|
0,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
ASSERT (!EFI_ERROR (Status));
|
||||||
|
for (Index = 1; Index < VariableNum; Index++) {
|
||||||
|
UnicodeSPrint (OverrideVariableName, sizeof (OverrideVariableName), L"PlatDriOver%d", Index);
|
||||||
|
Status = gRT->SetVariable (
|
||||||
|
OverrideVariableName,
|
||||||
|
&gEfiOverrideVariableGuid,
|
||||||
|
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
||||||
|
0,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
ASSERT (!EFI_ERROR (Status));
|
||||||
|
}
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -627,8 +631,6 @@ GetCurrentTpl (
|
|||||||
Retrieves the image handle of the platform override driver for a controller in
|
Retrieves the image handle of the platform override driver for a controller in
|
||||||
the system from the memory mapping database.
|
the system from the memory mapping database.
|
||||||
|
|
||||||
@param This A pointer to the
|
|
||||||
EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL instance.
|
|
||||||
@param ControllerHandle The device handle of the controller to check if
|
@param ControllerHandle The device handle of the controller to check if
|
||||||
a driver override exists.
|
a driver override exists.
|
||||||
@param DriverImageHandle On input, the previously returnd driver image handle.
|
@param DriverImageHandle On input, the previously returnd driver image handle.
|
||||||
@ -653,7 +655,6 @@ GetCurrentTpl (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GetDriverFromMapping (
|
GetDriverFromMapping (
|
||||||
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
IN EFI_HANDLE ControllerHandle,
|
||||||
IN OUT EFI_HANDLE *DriverImageHandle,
|
IN OUT EFI_HANDLE *DriverImageHandle,
|
||||||
IN LIST_ENTRY *MappingDataBase,
|
IN LIST_ENTRY *MappingDataBase,
|
||||||
@ -1365,72 +1366,6 @@ DeleteDriverImage (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
Deletes all environment variable(s) that contain the override mappings from Controller Device Path to
|
|
||||||
a set of Driver Device Paths.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Delete all variable(s) successfully.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
DeleteOverridesVariables (
|
|
||||||
VOID
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
VOID *VariableBuffer;
|
|
||||||
UINTN VariableNum;
|
|
||||||
UINTN BufferSize;
|
|
||||||
UINTN Index;
|
|
||||||
CHAR16 OverrideVariableName[40];
|
|
||||||
|
|
||||||
//
|
|
||||||
// Get environment variable(s) number
|
|
||||||
//
|
|
||||||
VariableNum = 0;
|
|
||||||
VariableBuffer = GetVariableAndSize (L"PlatDriOver", &gEfiOverrideVariableGuid, &BufferSize);
|
|
||||||
VariableNum++;
|
|
||||||
if (VariableBuffer == NULL) {
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
|
||||||
//
|
|
||||||
// Check NotEnd to get all PlatDriOverX variable(s)
|
|
||||||
//
|
|
||||||
while ((*(UINT32*)VariableBuffer) != 0) {
|
|
||||||
UnicodeSPrint (OverrideVariableName, sizeof (OverrideVariableName), L"PlatDriOver%d", VariableNum);
|
|
||||||
VariableBuffer = GetVariableAndSize (OverrideVariableName, &gEfiOverrideVariableGuid, &BufferSize);
|
|
||||||
VariableNum++;
|
|
||||||
ASSERT (VariableBuffer != NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Delete PlatDriOver and all additional variables, if exist.
|
|
||||||
//
|
|
||||||
Status = gRT->SetVariable (
|
|
||||||
L"PlatDriOver",
|
|
||||||
&gEfiOverrideVariableGuid,
|
|
||||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
|
||||||
0,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
ASSERT (!EFI_ERROR (Status));
|
|
||||||
for (Index = 1; Index < VariableNum; Index++) {
|
|
||||||
UnicodeSPrint (OverrideVariableName, sizeof (OverrideVariableName), L"PlatDriOver%d", Index);
|
|
||||||
Status = gRT->SetVariable (
|
|
||||||
OverrideVariableName,
|
|
||||||
&gEfiOverrideVariableGuid,
|
|
||||||
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE,
|
|
||||||
0,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
ASSERT (!EFI_ERROR (Status));
|
|
||||||
}
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Push a controller device path into a globle device path list.
|
Push a controller device path into a globle device path list.
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
FILE_GUID = e405ec31-ccaa-4dd4-83e8-0aec01703f7e
|
FILE_GUID = e405ec31-ccaa-4dd4-83e8-0aec01703f7e
|
||||||
MODULE_TYPE = DXE_DRIVER
|
MODULE_TYPE = DXE_DRIVER
|
||||||
VERSION_STRING = 1.0
|
VERSION_STRING = 1.0
|
||||||
LIBRARY_CLASS = GenericBdsLib|DXE_DRIVER
|
LIBRARY_CLASS = GenericBdsLib|DXE_DRIVER UEFI_APPLICATION
|
||||||
|
|
||||||
#
|
#
|
||||||
# The following information is for reference only and not required by the build tools.
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
#/** @file
|
#/** @file
|
||||||
# PCD PEIM produces PCD database to manage all dynamic PCD in PEI phase and install Pcd Ppi.
|
# PCD PEIM produces PCD database to manage all dynamic PCD in PEI phase and install Pcd Ppi service.
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006 - 2008, Intel Corporation
|
# Copyright (c) 2006 - 2008, Intel Corporation
|
||||||
#
|
#
|
||||||
|
@ -15,24 +15,73 @@ Module Name:
|
|||||||
|
|
||||||
Abstract:
|
Abstract:
|
||||||
|
|
||||||
A UI driver to offer a UI interface in device manager to let user configue
|
A UI application to offer a UI interface in device manager to let user configue
|
||||||
platform override protocol to override the default algorithm for matching
|
platform override protocol to override the default algorithm for matching
|
||||||
drivers to controllers.
|
drivers to controllers.
|
||||||
|
|
||||||
The main flow:
|
The main flow:
|
||||||
1. The UI driver dynamicly locate all controller device path.
|
1. The UI application dynamicly locate all controller device path.
|
||||||
2. The UI driver dynamicly locate all drivers which support binding protocol.
|
2. The UI application dynamicly locate all drivers which support binding protocol.
|
||||||
3. The UI driver export and dynamicly update two menu to let user select the
|
3. The UI application export and dynamicly update two menu to let user select the
|
||||||
mapping between drivers to controllers.
|
mapping between drivers to controllers.
|
||||||
4. The UI driver save all the mapping info in NV variables which will be consumed
|
4. The UI application save all the mapping info in NV variables which will be consumed
|
||||||
by platform override protocol driver to publish the platform override protocol.
|
by platform override protocol driver to publish the platform override protocol.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
#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 <Library/BaseLib.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/UefiLib.h>
|
||||||
|
#include <Library/UefiApplicationEntryPoint.h>
|
||||||
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
|
#include <Library/PlatDriOverLib.h>
|
||||||
|
#include <Library/HiiLib.h>
|
||||||
|
#include <Library/IfrSupportLib.h>
|
||||||
|
#include <Library/ExtendedHiiLib.h>
|
||||||
|
#include <Library/ExtendedIfrSupportLib.h>
|
||||||
|
#include <Library/BaseMemoryLib.h>
|
||||||
|
#include <Library/MemoryAllocationLib.h>
|
||||||
|
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||||
|
#include <Library/DevicePathLib.h>
|
||||||
|
#include <Library/GenericBdsLib.h>
|
||||||
#include "PlatOverMngr.h"
|
#include "PlatOverMngr.h"
|
||||||
|
|
||||||
EFI_GUID mPlatformOverridesManagerGuid = PLAT_OVER_MNGR_GUID;
|
#define EFI_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('C', 'l', 'b', 'k')
|
||||||
|
#define EFI_CALLBACK_INFO_FROM_THIS(a) CR (a, EFI_CALLBACK_INFO, ConfigAccess, EFI_CALLBACK_INFO_SIGNATURE)
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINTN Signature;
|
||||||
|
EFI_HANDLE DriverHandle;
|
||||||
|
EFI_HII_HANDLE RegisteredHandle;
|
||||||
|
PLAT_OVER_MNGR_DATA FakeNvData;
|
||||||
|
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
|
||||||
|
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
|
||||||
|
} EFI_CALLBACK_INFO;
|
||||||
|
|
||||||
|
//
|
||||||
|
// uni string and Vfr Binary data.
|
||||||
|
//
|
||||||
|
extern UINT8 VfrBin[];
|
||||||
|
extern UINT8 PlatOverMngrStrings[];
|
||||||
|
|
||||||
|
//
|
||||||
|
// module global data
|
||||||
|
//
|
||||||
|
EFI_GUID mPlatformOverridesManagerGuid = PLAT_OVER_MNGR_GUID;
|
||||||
LIST_ENTRY mMappingDataBase = INITIALIZE_LIST_HEAD_VARIABLE (mMappingDataBase);
|
LIST_ENTRY mMappingDataBase = INITIALIZE_LIST_HEAD_VARIABLE (mMappingDataBase);
|
||||||
|
|
||||||
EFI_HANDLE *mDevicePathHandleBuffer;
|
EFI_HANDLE *mDevicePathHandleBuffer;
|
||||||
@ -40,7 +89,6 @@ EFI_HANDLE *mDriverImageHandleBuffer;
|
|||||||
|
|
||||||
UINTN mSelectedCtrIndex;
|
UINTN mSelectedCtrIndex;
|
||||||
EFI_STRING_ID mControllerToken[MAX_CHOICE_NUM];
|
EFI_STRING_ID mControllerToken[MAX_CHOICE_NUM];
|
||||||
|
|
||||||
UINTN mDriverImageHandleCount;
|
UINTN mDriverImageHandleCount;
|
||||||
EFI_STRING_ID mDriverImageToken[MAX_CHOICE_NUM];
|
EFI_STRING_ID mDriverImageToken[MAX_CHOICE_NUM];
|
||||||
EFI_STRING_ID mDriverImageFilePathToken[MAX_CHOICE_NUM];
|
EFI_STRING_ID mDriverImageFilePathToken[MAX_CHOICE_NUM];
|
||||||
@ -52,212 +100,55 @@ CHAR8 mLanguage[RFC_3066_ENTRY_SIZE];
|
|||||||
UINT16 mCurrentPage;
|
UINT16 mCurrentPage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
The driver Entry Point. The funciton will export a disk device class formset and
|
Do string convertion for the ComponentName supported language. It do
|
||||||
its callback function to hii database.
|
the convertion just for english language code from RFC 3066 to ISO 639-2.
|
||||||
|
Then it will check whether the converted language is in the supported language list.
|
||||||
|
If not supported, NULL is returned.
|
||||||
|
If Language is not english, NULL is returned.
|
||||||
|
|
||||||
@param ImageHandle The firmware allocated handle for the EFI image.
|
@param SupportedLanguages Pointer to ComponentName supported language string list. ISO 639-2 language
|
||||||
@param SystemTable A pointer to the EFI System Table.
|
@param Language The language string. RFC 3066 language
|
||||||
|
|
||||||
@retval EFI_SUCCESS The entry point is executed successfully.
|
@return English language string (ISO 639-2)
|
||||||
@retval other Some error occurs when executing this entry point.
|
@return NULL if the conertion is not successful.
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
PlatOverMngrInit (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
)
|
|
||||||
{
|
|
||||||
EFI_STATUS Status;
|
|
||||||
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
|
||||||
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
|
||||||
EFI_CALLBACK_INFO *CallbackInfo;
|
|
||||||
EFI_HANDLE DriverHandle;
|
|
||||||
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
|
|
||||||
|
|
||||||
//
|
|
||||||
// There should only be one HII protocol
|
|
||||||
//
|
|
||||||
Status = gBS->LocateProtocol (
|
|
||||||
&gEfiHiiDatabaseProtocolGuid,
|
|
||||||
NULL,
|
|
||||||
(VOID **) &HiiDatabase
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//
|
|
||||||
// There should only be one Form Configuration protocol
|
|
||||||
//
|
|
||||||
Status = gBS->LocateProtocol (
|
|
||||||
&gEfiFormBrowser2ProtocolGuid,
|
|
||||||
NULL,
|
|
||||||
(VOID **) &FormBrowser2
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CallbackInfo = AllocateZeroPool (sizeof (EFI_CALLBACK_INFO));
|
|
||||||
if (CallbackInfo == NULL) {
|
|
||||||
return EFI_BAD_BUFFER_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
CallbackInfo->Signature = EFI_CALLBACK_INFO_SIGNATURE;
|
|
||||||
CallbackInfo->ConfigAccess.ExtractConfig = PlatOverMngrExtractConfig;
|
|
||||||
CallbackInfo->ConfigAccess.RouteConfig = PlatOverMngrRouteConfig;
|
|
||||||
CallbackInfo->ConfigAccess.Callback = PlatOverMngrCallback;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Create driver handle used by HII database
|
|
||||||
//
|
|
||||||
Status = HiiLibCreateHiiDriverHandle (&DriverHandle);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
CallbackInfo->DriverHandle = DriverHandle;
|
|
||||||
|
|
||||||
//
|
|
||||||
// Install Config Access protocol to driver handle
|
|
||||||
//
|
|
||||||
Status = gBS->InstallProtocolInterface (
|
|
||||||
&DriverHandle,
|
|
||||||
&gEfiHiiConfigAccessProtocolGuid,
|
|
||||||
EFI_NATIVE_INTERFACE,
|
|
||||||
&CallbackInfo->ConfigAccess
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Publish our HII data
|
|
||||||
//
|
|
||||||
PackageList = HiiLibPreparePackageList (
|
|
||||||
2,
|
|
||||||
&mPlatformOverridesManagerGuid,
|
|
||||||
VfrBin,
|
|
||||||
PlatOverMngrStrings
|
|
||||||
);
|
|
||||||
ASSERT (PackageList != NULL);
|
|
||||||
|
|
||||||
Status = HiiDatabase->NewPackageList (
|
|
||||||
HiiDatabase,
|
|
||||||
PackageList,
|
|
||||||
DriverHandle,
|
|
||||||
&CallbackInfo->RegisteredHandle
|
|
||||||
);
|
|
||||||
gBS->FreePool (PackageList);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Locate ConfigRouting protocol
|
|
||||||
//
|
|
||||||
Status = gBS->LocateProtocol (
|
|
||||||
&gEfiHiiConfigRoutingProtocolGuid,
|
|
||||||
NULL,
|
|
||||||
(VOID **) &CallbackInfo->HiiConfigRouting
|
|
||||||
);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Clear all the globle variable
|
|
||||||
//
|
|
||||||
mDriverImageHandleCount = 0;
|
|
||||||
mCurrentPage = 0;
|
|
||||||
ZeroMem (mDriverImageToken, MAX_CHOICE_NUM * sizeof (EFI_STRING_ID));
|
|
||||||
ZeroMem (mDriverImageFilePathToken, MAX_CHOICE_NUM * sizeof (EFI_STRING_ID));
|
|
||||||
ZeroMem (mControllerToken, MAX_CHOICE_NUM * sizeof (EFI_STRING_ID));
|
|
||||||
ZeroMem (mDriverImageProtocol, MAX_CHOICE_NUM * sizeof (EFI_LOADED_IMAGE_PROTOCOL *));
|
|
||||||
|
|
||||||
//
|
|
||||||
// Show the page
|
|
||||||
//
|
|
||||||
Status = FormBrowser2->SendForm (
|
|
||||||
FormBrowser2,
|
|
||||||
&CallbackInfo->RegisteredHandle,
|
|
||||||
1,
|
|
||||||
NULL,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
Status = HiiDatabase->RemovePackageList (HiiDatabase, CallbackInfo->RegisteredHandle);
|
|
||||||
if (EFI_ERROR (Status)) {
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
return EFI_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
Do some convertion for the ComponentName2 supported language. It do
|
|
||||||
the convertion just for english language code currently.
|
|
||||||
|
|
||||||
@param ComponentName Pointer to the ComponentName2 protocl pointer.
|
|
||||||
@param Language The language string.
|
|
||||||
|
|
||||||
@return Return the duplication of Language if it is not english otherwise return
|
|
||||||
the supported english language code.
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
CHAR8 *
|
CHAR8 *
|
||||||
ConvertComponentName2SupportLanguage (
|
ConvertComponentNameSupportLanguage (
|
||||||
IN EFI_COMPONENT_NAME2_PROTOCOL *ComponentName,
|
IN CHAR8 *SupportedLanguages,
|
||||||
IN CHAR8 *Language
|
IN CHAR8 *Language
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
CHAR8 *SupportedLanguages;
|
|
||||||
CHAR8 *LangCode;
|
CHAR8 *LangCode;
|
||||||
UINTN Index;
|
|
||||||
|
|
||||||
LangCode = NULL;
|
LangCode = NULL;
|
||||||
SupportedLanguages = NULL;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// treat all the english language code (en-xx or eng) equally
|
// check the input language is English
|
||||||
//
|
//
|
||||||
if ((AsciiStrnCmp (Language, "en-", 3) == 0) || (AsciiStrCmp (Language, "eng") == 0)) {
|
if (AsciiStrnCmp (Language, "en-", 3) != 0) {
|
||||||
SupportedLanguages = AsciiStrStr (ComponentName->SupportedLanguages, "en");
|
return NULL;
|
||||||
if (SupportedLanguages == NULL) {
|
|
||||||
SupportedLanguages = AsciiStrStr (ComponentName->SupportedLanguages, "eng");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// duplicate the Language if it is not english
|
// Convert Language string from RFC 3066 to ISO 639-2
|
||||||
//
|
//
|
||||||
if (SupportedLanguages == NULL) {
|
|
||||||
SupportedLanguages = Language;
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// duplicate the returned language code.
|
|
||||||
//
|
|
||||||
if (AsciiStrStr (SupportedLanguages, "-") != NULL) {
|
|
||||||
LangCode = AllocateZeroPool(32);
|
|
||||||
for(Index = 0; (Index < 31) && (SupportedLanguages[Index] != '\0') && (SupportedLanguages[Index] != ';'); Index++) {
|
|
||||||
LangCode[Index] = SupportedLanguages[Index];
|
|
||||||
}
|
|
||||||
LangCode[Index] = '\0';
|
|
||||||
} else {
|
|
||||||
LangCode = AllocateZeroPool(4);
|
LangCode = AllocateZeroPool(4);
|
||||||
for(Index = 0; (Index < 3) && (SupportedLanguages[Index] != '\0'); Index++) {
|
AsciiStrCpy (LangCode, "eng");
|
||||||
LangCode[Index] = SupportedLanguages[Index];
|
|
||||||
}
|
//
|
||||||
LangCode[Index] = '\0';
|
// Check whether the converted language is supported in the SupportedLanguages list.
|
||||||
|
//
|
||||||
|
if (AsciiStrStr (SupportedLanguages, LangCode) == NULL) {
|
||||||
|
FreePool (LangCode);
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return LangCode;
|
return LangCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the ComponentName or ComponentName2 protocol according to the driver binding handle
|
Get the driver name by ComponentName or ComponentName2 protocol
|
||||||
|
according to the driver binding handle
|
||||||
|
|
||||||
@param DriverBindingHandle The Handle of DriverBinding.
|
@param DriverBindingHandle The Handle of DriverBinding.
|
||||||
|
|
||||||
@ -301,23 +192,24 @@ GetComponentName (
|
|||||||
DriverName = NULL;
|
DriverName = NULL;
|
||||||
if (ComponentName != NULL) {
|
if (ComponentName != NULL) {
|
||||||
if (ComponentName->GetDriverName != NULL) {
|
if (ComponentName->GetDriverName != NULL) {
|
||||||
|
SupportedLanguage = ConvertComponentNameSupportLanguage (ComponentName->SupportedLanguages, mLanguage);
|
||||||
Status = ComponentName->GetDriverName (
|
Status = ComponentName->GetDriverName (
|
||||||
ComponentName,
|
ComponentName,
|
||||||
|
SupportedLanguage,
|
||||||
|
&DriverName
|
||||||
|
);
|
||||||
|
FreePool (SupportedLanguage);
|
||||||
|
}
|
||||||
|
} else if (ComponentName2 != NULL) {
|
||||||
|
if (ComponentName2->GetDriverName != NULL) {
|
||||||
|
Status = ComponentName2->GetDriverName (
|
||||||
|
ComponentName2,
|
||||||
mLanguage,
|
mLanguage,
|
||||||
&DriverName
|
&DriverName
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if (ComponentName2 != NULL) {
|
|
||||||
if (ComponentName2->GetDriverName != NULL) {
|
|
||||||
SupportedLanguage = ConvertComponentName2SupportLanguage (ComponentName2, mLanguage);
|
|
||||||
Status = ComponentName2->GetDriverName (
|
|
||||||
ComponentName2,
|
|
||||||
SupportedLanguage,
|
|
||||||
&DriverName
|
|
||||||
);
|
|
||||||
gBS->FreePool (SupportedLanguage);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -326,12 +218,13 @@ GetComponentName (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the image name
|
Get the image name from EFI UI section.
|
||||||
|
Get FV protocol by its loaded image protoocl to abastract EFI UI section.
|
||||||
|
|
||||||
@param Image Image to search.
|
@param Image Pointer to the loaded image protocol
|
||||||
|
|
||||||
@retval !NULL Pointer into the image name if the image name is found,
|
@retval !NULL Pointer to the image name if the image name is found,
|
||||||
@retval NULL Pointer to NULL if the image name is not found.
|
@retval NULL NULL if the image name is not found.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
CHAR16 *
|
CHAR16 *
|
||||||
@ -356,13 +249,8 @@ GetImageName (
|
|||||||
if (Image->FilePath == NULL) {
|
if (Image->FilePath == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
DevPathNode = Image->FilePath;
|
DevPathNode = Image->FilePath;
|
||||||
|
|
||||||
if (DevPathNode == NULL) {
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!IsDevicePathEnd (DevPathNode)) {
|
while (!IsDevicePathEnd (DevPathNode)) {
|
||||||
//
|
//
|
||||||
// Make sure device path node is aligned when accessing it's FV Name Guid field.
|
// Make sure device path node is aligned when accessing it's FV Name Guid field.
|
||||||
@ -380,6 +268,9 @@ GetImageName (
|
|||||||
&gEfiFirmwareVolume2ProtocolGuid,
|
&gEfiFirmwareVolume2ProtocolGuid,
|
||||||
(VOID **) &Fv2
|
(VOID **) &Fv2
|
||||||
);
|
);
|
||||||
|
//
|
||||||
|
// Locate Image EFI UI section to get the image name.
|
||||||
|
//
|
||||||
if (!EFI_ERROR (Status)) {
|
if (!EFI_ERROR (Status)) {
|
||||||
Status = Fv2->ReadSection (
|
Status = Fv2->ReadSection (
|
||||||
Fv2,
|
Fv2,
|
||||||
@ -411,7 +302,9 @@ GetImageName (
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
Prepare the first page to let user select the device controller which need to
|
Prepare the first page to let user select the device controller which need to
|
||||||
add mapping drivers.
|
add mapping drivers if user select 'Refresh' in first page.
|
||||||
|
During first page, user will see all currnet controller device path in system,
|
||||||
|
select any device path will go to second page to select its overrides drivers.
|
||||||
|
|
||||||
@param Private Pointer to EFI_CALLBACK_INFO.
|
@param Private Pointer to EFI_CALLBACK_INFO.
|
||||||
@param KeyValue The callback key value of device controller item in first page.
|
@param KeyValue The callback key value of device controller item in first page.
|
||||||
@ -440,13 +333,14 @@ UpdateDeviceSelectPage (
|
|||||||
EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride;
|
EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride;
|
||||||
UINTN Len;
|
UINTN Len;
|
||||||
|
|
||||||
|
//
|
||||||
|
// set current page form ID.
|
||||||
|
//
|
||||||
mCurrentPage = FORM_ID_DEVICE;
|
mCurrentPage = FORM_ID_DEVICE;
|
||||||
//
|
|
||||||
// Following code will be run if user select 'Refresh' in first page
|
|
||||||
// During first page, user will see all currnet controller device path in system,
|
|
||||||
// select any device path will go to second page to select its overrides drivers
|
|
||||||
//
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Get Platform supported Language (RFC_3066 format)
|
||||||
|
//
|
||||||
LangSize = RFC_3066_ENTRY_SIZE;
|
LangSize = RFC_3066_ENTRY_SIZE;
|
||||||
Status = gRT->GetVariable (
|
Status = gRT->GetVariable (
|
||||||
L"PlatformLang",
|
L"PlatformLang",
|
||||||
@ -491,14 +385,15 @@ UpdateDeviceSelectPage (
|
|||||||
ASSERT (NewString != NULL);
|
ASSERT (NewString != NULL);
|
||||||
Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);
|
Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
gBS->FreePool (NewString);
|
FreePool (NewString);
|
||||||
|
|
||||||
NewStringToken = STRING_TOKEN (STR_FIRST_REFRESH_HELP);
|
NewStringToken = STRING_TOKEN (STR_FIRST_REFRESH_HELP);
|
||||||
HiiLibGetStringFromHandle (Private->RegisteredHandle, STRING_TOKEN (STR_REFRESH_HELP), &NewString);
|
HiiLibGetStringFromHandle (Private->RegisteredHandle, STRING_TOKEN (STR_REFRESH_HELP), &NewString);
|
||||||
ASSERT (NewString != NULL);
|
ASSERT (NewString != NULL);
|
||||||
Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);
|
Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
gBS->FreePool (NewString);
|
FreePool (NewString);
|
||||||
|
|
||||||
//
|
//
|
||||||
// created needed controller device item in first page
|
// created needed controller device item in first page
|
||||||
//
|
//
|
||||||
@ -587,7 +482,7 @@ UpdateDeviceSelectPage (
|
|||||||
Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);
|
Status = HiiLibSetString (Private->RegisteredHandle, NewStringToken, NewString);
|
||||||
}
|
}
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
gBS->FreePool (NewString);
|
FreePool (NewString);
|
||||||
//
|
//
|
||||||
// Save the device path string toke for next access use
|
// Save the device path string toke for next access use
|
||||||
//
|
//
|
||||||
@ -615,10 +510,78 @@ UpdateDeviceSelectPage (
|
|||||||
&UpdateData
|
&UpdateData
|
||||||
);
|
);
|
||||||
|
|
||||||
gBS->FreePool (UpdateData.Data);
|
FreePool (UpdateData.Data);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Get the first Driver Binding handle which has the specific image handle.
|
||||||
|
|
||||||
|
@param ImageHandle The Image handle
|
||||||
|
|
||||||
|
@return Handle to Driver binding
|
||||||
|
@retval NULL The paramter is not valid or the driver binding handle is not found.
|
||||||
|
|
||||||
|
**/
|
||||||
|
EFI_HANDLE
|
||||||
|
GetDriverBindingHandleFromImageHandle (
|
||||||
|
IN EFI_HANDLE ImageHandle
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
|
UINTN Index;
|
||||||
|
UINTN DriverBindingHandleCount;
|
||||||
|
EFI_HANDLE *DriverBindingHandleBuffer;
|
||||||
|
EFI_DRIVER_BINDING_PROTOCOL *DriverBindingInterface;
|
||||||
|
EFI_HANDLE DriverBindingHandle;
|
||||||
|
|
||||||
|
DriverBindingHandle = NULL;
|
||||||
|
|
||||||
|
if (ImageHandle == NULL) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
//
|
||||||
|
// Get all drivers which support driver binding protocol
|
||||||
|
//
|
||||||
|
DriverBindingHandleCount = 0;
|
||||||
|
Status = gBS->LocateHandleBuffer (
|
||||||
|
ByProtocol,
|
||||||
|
&gEfiDriverBindingProtocolGuid,
|
||||||
|
NULL,
|
||||||
|
&DriverBindingHandleCount,
|
||||||
|
&DriverBindingHandleBuffer
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status) || (DriverBindingHandleCount == 0)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (Index = 0; Index < DriverBindingHandleCount; Index++) {
|
||||||
|
DriverBindingInterface = NULL;
|
||||||
|
Status = gBS->OpenProtocol (
|
||||||
|
DriverBindingHandleBuffer[Index],
|
||||||
|
&gEfiDriverBindingProtocolGuid,
|
||||||
|
(VOID **) &DriverBindingInterface,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
EFI_OPEN_PROTOCOL_GET_PROTOCOL
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (DriverBindingInterface->ImageHandle == ImageHandle) {
|
||||||
|
DriverBindingHandle = DriverBindingHandleBuffer[Index];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// If no Driver Binding Protocol instance is found
|
||||||
|
//
|
||||||
|
FreePool (DriverBindingHandleBuffer);
|
||||||
|
return DriverBindingHandle;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Prepare to let user select the drivers which need mapping with the device controller
|
Prepare to let user select the drivers which need mapping with the device controller
|
||||||
selected in first page.
|
selected in first page.
|
||||||
@ -640,20 +603,17 @@ UpdateBindingDriverSelectPage (
|
|||||||
EFI_HII_UPDATE_DATA UpdateData;
|
EFI_HII_UPDATE_DATA UpdateData;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
CHAR16 *NewString;
|
CHAR16 *NewString;
|
||||||
EFI_STRING_ID NewStringToken;
|
EFI_STRING_ID NewStringToken;
|
||||||
EFI_STRING_ID NewStringHelpToken;
|
EFI_STRING_ID NewStringHelpToken;
|
||||||
UINTN DriverImageHandleCount;
|
UINTN DriverImageHandleCount;
|
||||||
|
|
||||||
EFI_DRIVER_BINDING_PROTOCOL *DriverBindingInterface;
|
|
||||||
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;
|
||||||
CHAR16 *DriverName;
|
CHAR16 *DriverName;
|
||||||
BOOLEAN FreeDriverName;
|
BOOLEAN FreeDriverName;
|
||||||
|
|
||||||
EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath;
|
||||||
EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride;
|
EFI_BUS_SPECIFIC_DRIVER_OVERRIDE_PROTOCOL *BusSpecificDriverOverride;
|
||||||
EFI_HANDLE DriverBindingHandle;
|
EFI_HANDLE DriverBindingHandle;
|
||||||
|
|
||||||
//
|
//
|
||||||
// If user select a controller item in the first page the following code will be run.
|
// If user select a controller item in the first page the following code will be run.
|
||||||
// During second page, user will see all currnet driver bind protocol driver, the driver name and its device path will be shown
|
// During second page, user will see all currnet driver bind protocol driver, the driver name and its device path will be shown
|
||||||
@ -667,7 +627,7 @@ UpdateBindingDriverSelectPage (
|
|||||||
//
|
//
|
||||||
// Switch the item callback key value to its NO. in mDevicePathHandleBuffer
|
// Switch the item callback key value to its NO. in mDevicePathHandleBuffer
|
||||||
//
|
//
|
||||||
mSelectedCtrIndex = KeyValue - 0x100;
|
mSelectedCtrIndex = KeyValue - KEY_VALUE_DEVICE_OFFSET;
|
||||||
ASSERT (mSelectedCtrIndex < MAX_CHOICE_NUM);
|
ASSERT (mSelectedCtrIndex < MAX_CHOICE_NUM);
|
||||||
mLastSavedDriverImageNum = 0;
|
mLastSavedDriverImageNum = 0;
|
||||||
//
|
//
|
||||||
@ -731,13 +691,8 @@ UpdateBindingDriverSelectPage (
|
|||||||
//
|
//
|
||||||
// Find its related driver binding protocol
|
// Find its related driver binding protocol
|
||||||
//
|
//
|
||||||
DriverBindingInterface = NULL;
|
DriverBindingHandle = GetDriverBindingHandleFromImageHandle (mDriverImageHandleBuffer[Index]);
|
||||||
DriverBindingHandle = NULL;
|
if (DriverBindingHandle == NULL) {
|
||||||
DriverBindingInterface = GetBindingProtocolFromImageHandle (
|
|
||||||
mDriverImageHandleBuffer[Index],
|
|
||||||
&DriverBindingHandle
|
|
||||||
);
|
|
||||||
if (DriverBindingInterface == NULL) {
|
|
||||||
FakeNvData->DriSelection[Index] = 0x00;
|
FakeNvData->DriSelection[Index] = 0x00;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -822,9 +777,9 @@ UpdateBindingDriverSelectPage (
|
|||||||
}
|
}
|
||||||
mDriverImageToken[Index] = NewStringToken;
|
mDriverImageToken[Index] = NewStringToken;
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
gBS->FreePool (NewString);
|
FreePool (NewString);
|
||||||
if (FreeDriverName) {
|
if (FreeDriverName) {
|
||||||
gBS->FreePool (DriverName);
|
FreePool (DriverName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
@ -842,8 +797,8 @@ UpdateBindingDriverSelectPage (
|
|||||||
}
|
}
|
||||||
mDriverImageFilePathToken[Index] = NewStringHelpToken;
|
mDriverImageFilePathToken[Index] = NewStringHelpToken;
|
||||||
ASSERT_EFI_ERROR (Status);
|
ASSERT_EFI_ERROR (Status);
|
||||||
gBS->FreePool (NewString);
|
FreePool (NewString);
|
||||||
gBS->FreePool (DriverName);
|
FreePool (DriverName);
|
||||||
|
|
||||||
CreateCheckBoxOpCode (
|
CreateCheckBoxOpCode (
|
||||||
(UINT16) (DRIVER_SELECTION_QUESTION_ID + Index),
|
(UINT16) (DRIVER_SELECTION_QUESTION_ID + Index),
|
||||||
@ -869,7 +824,7 @@ UpdateBindingDriverSelectPage (
|
|||||||
&UpdateData
|
&UpdateData
|
||||||
);
|
);
|
||||||
|
|
||||||
gBS->FreePool (UpdateData.Data);
|
FreePool (UpdateData.Data);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -893,9 +848,7 @@ UpdatePrioritySelectPage (
|
|||||||
{
|
{
|
||||||
EFI_HII_UPDATE_DATA UpdateData;
|
EFI_HII_UPDATE_DATA UpdateData;
|
||||||
UINTN Index;
|
UINTN Index;
|
||||||
|
|
||||||
EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath;
|
EFI_DEVICE_PATH_PROTOCOL *LoadedImageDevicePath;
|
||||||
|
|
||||||
IFR_OPTION *IfrOptionList;
|
IFR_OPTION *IfrOptionList;
|
||||||
UINTN SelectedDriverImageNum;
|
UINTN SelectedDriverImageNum;
|
||||||
UINT32 DriverImageNO;
|
UINT32 DriverImageNO;
|
||||||
@ -940,7 +893,7 @@ UpdatePrioritySelectPage (
|
|||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
IfrOptionList = AllocateZeroPool (0x200);
|
IfrOptionList = AllocateZeroPool (sizeof (IFR_OPTION) * mSelectedDriverImageNum);
|
||||||
ASSERT_EFI_ERROR (IfrOptionList != NULL);
|
ASSERT_EFI_ERROR (IfrOptionList != NULL);
|
||||||
//
|
//
|
||||||
// Create order list for those selected drivers
|
// Create order list for those selected drivers
|
||||||
@ -990,7 +943,7 @@ UpdatePrioritySelectPage (
|
|||||||
//
|
//
|
||||||
// NvRamMap Must be clear firstly
|
// NvRamMap Must be clear firstly
|
||||||
//
|
//
|
||||||
ZeroMem (FakeNvData->DriOrder, 100);
|
ZeroMem (FakeNvData->DriOrder, sizeof (FakeNvData->DriOrder));
|
||||||
|
|
||||||
//
|
//
|
||||||
// Order the selected drivers according to the info already in mapping database
|
// Order the selected drivers according to the info already in mapping database
|
||||||
@ -1010,7 +963,7 @@ UpdatePrioritySelectPage (
|
|||||||
// the IfrOptionList[MinNO].Value = the driver NO. in driver binding buffer
|
// the IfrOptionList[MinNO].Value = the driver NO. in driver binding buffer
|
||||||
//
|
//
|
||||||
FakeNvData->DriOrder[Index] =IfrOptionList[MinNO].Value.u8;
|
FakeNvData->DriOrder[Index] =IfrOptionList[MinNO].Value.u8;
|
||||||
TempNO[MinNO] = 101;
|
TempNO[MinNO] = MAX_CHOICE_NUM + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreateOrderedListOpCode (
|
CreateOrderedListOpCode (
|
||||||
@ -1022,7 +975,7 @@ UpdatePrioritySelectPage (
|
|||||||
EFI_IFR_FLAG_RESET_REQUIRED,
|
EFI_IFR_FLAG_RESET_REQUIRED,
|
||||||
0,
|
0,
|
||||||
EFI_IFR_NUMERIC_SIZE_1,
|
EFI_IFR_NUMERIC_SIZE_1,
|
||||||
100,
|
MAX_CHOICE_NUM,
|
||||||
IfrOptionList,
|
IfrOptionList,
|
||||||
SelectedDriverImageNum,
|
SelectedDriverImageNum,
|
||||||
&UpdateData
|
&UpdateData
|
||||||
@ -1040,8 +993,8 @@ UpdatePrioritySelectPage (
|
|||||||
&UpdateData
|
&UpdateData
|
||||||
);
|
);
|
||||||
|
|
||||||
gBS->FreePool (IfrOptionList);
|
FreePool (IfrOptionList);
|
||||||
gBS->FreePool (UpdateData.Data);
|
FreePool (UpdateData.Data);
|
||||||
return EFI_SUCCESS;
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1275,7 +1228,7 @@ PlatOverMngrCallback (
|
|||||||
|
|
||||||
if (((KEY_VALUE_DEVICE_OFFSET <= KeyValue) && (KeyValue < KEY_VALUE_DEVICE_MAX)) || (KeyValue == KEY_VALUE_ORDER_GOTO_PREVIOUS)) {
|
if (((KEY_VALUE_DEVICE_OFFSET <= KeyValue) && (KeyValue < KEY_VALUE_DEVICE_MAX)) || (KeyValue == KEY_VALUE_ORDER_GOTO_PREVIOUS)) {
|
||||||
if (KeyValue == KEY_VALUE_ORDER_GOTO_PREVIOUS) {
|
if (KeyValue == KEY_VALUE_ORDER_GOTO_PREVIOUS) {
|
||||||
KeyValue = (EFI_QUESTION_ID) (mSelectedCtrIndex + 0x100);
|
KeyValue = (EFI_QUESTION_ID) (mSelectedCtrIndex + KEY_VALUE_DEVICE_OFFSET);
|
||||||
}
|
}
|
||||||
UpdateBindingDriverSelectPage (Private, KeyValue, FakeNvData);
|
UpdateBindingDriverSelectPage (Private, KeyValue, FakeNvData);
|
||||||
//
|
//
|
||||||
@ -1323,41 +1276,144 @@ PlatOverMngrCallback (
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Get the description string by device path.
|
The driver Entry Point. The funciton will export a disk device class formset and
|
||||||
|
its callback function to hii database.
|
||||||
|
|
||||||
@param DevPath The input device path.
|
@param ImageHandle The firmware allocated handle for the EFI image.
|
||||||
|
@param SystemTable A pointer to the EFI System Table.
|
||||||
|
|
||||||
@retval !NULL The description string retured.
|
@retval EFI_SUCCESS The entry point is executed successfully.
|
||||||
@retval NULL The description string cannot be found.
|
@retval other Some error occurs when executing this entry point.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
CHAR16 *
|
EFI_STATUS
|
||||||
DevicePathToStr (
|
EFIAPI
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
PlatOverMngrInit (
|
||||||
|
IN EFI_HANDLE ImageHandle,
|
||||||
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
CHAR16 *ToText;
|
EFI_HII_DATABASE_PROTOCOL *HiiDatabase;
|
||||||
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText;
|
EFI_HII_PACKAGE_LIST_HEADER *PackageList;
|
||||||
|
EFI_CALLBACK_INFO *CallbackInfo;
|
||||||
if (DevPath == NULL) {
|
EFI_HANDLE DriverHandle;
|
||||||
return NULL;
|
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
|
||||||
}
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// There should only be one HII protocol
|
||||||
|
//
|
||||||
Status = gBS->LocateProtocol (
|
Status = gBS->LocateProtocol (
|
||||||
&gEfiDevicePathToTextProtocolGuid,
|
&gEfiHiiDatabaseProtocolGuid,
|
||||||
NULL,
|
NULL,
|
||||||
(VOID **) &DevPathToText
|
(VOID **) &HiiDatabase
|
||||||
);
|
);
|
||||||
if (!EFI_ERROR (Status)) {
|
if (EFI_ERROR (Status)) {
|
||||||
ToText = DevPathToText->ConvertDevicePathToText (
|
return Status;
|
||||||
DevPath,
|
|
||||||
FALSE,
|
|
||||||
TRUE
|
|
||||||
);
|
|
||||||
ASSERT (ToText != NULL);
|
|
||||||
return ToText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
//
|
||||||
|
// There should only be one Form Configuration protocol
|
||||||
|
//
|
||||||
|
Status = gBS->LocateProtocol (
|
||||||
|
&gEfiFormBrowser2ProtocolGuid,
|
||||||
|
NULL,
|
||||||
|
(VOID **) &FormBrowser2
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
CallbackInfo = AllocateZeroPool (sizeof (EFI_CALLBACK_INFO));
|
||||||
|
if (CallbackInfo == NULL) {
|
||||||
|
return EFI_BAD_BUFFER_SIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
CallbackInfo->Signature = EFI_CALLBACK_INFO_SIGNATURE;
|
||||||
|
CallbackInfo->ConfigAccess.ExtractConfig = PlatOverMngrExtractConfig;
|
||||||
|
CallbackInfo->ConfigAccess.RouteConfig = PlatOverMngrRouteConfig;
|
||||||
|
CallbackInfo->ConfigAccess.Callback = PlatOverMngrCallback;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Create driver handle used by HII database
|
||||||
|
//
|
||||||
|
Status = HiiLibCreateHiiDriverHandle (&DriverHandle);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
CallbackInfo->DriverHandle = DriverHandle;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Install Config Access protocol to driver handle
|
||||||
|
//
|
||||||
|
Status = gBS->InstallProtocolInterface (
|
||||||
|
&DriverHandle,
|
||||||
|
&gEfiHiiConfigAccessProtocolGuid,
|
||||||
|
EFI_NATIVE_INTERFACE,
|
||||||
|
&CallbackInfo->ConfigAccess
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Publish our HII data
|
||||||
|
//
|
||||||
|
PackageList = HiiLibPreparePackageList (
|
||||||
|
2,
|
||||||
|
&mPlatformOverridesManagerGuid,
|
||||||
|
VfrBin,
|
||||||
|
PlatOverMngrStrings
|
||||||
|
);
|
||||||
|
ASSERT (PackageList != NULL);
|
||||||
|
|
||||||
|
Status = HiiDatabase->NewPackageList (
|
||||||
|
HiiDatabase,
|
||||||
|
PackageList,
|
||||||
|
DriverHandle,
|
||||||
|
&CallbackInfo->RegisteredHandle
|
||||||
|
);
|
||||||
|
FreePool (PackageList);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Locate ConfigRouting protocol
|
||||||
|
//
|
||||||
|
Status = gBS->LocateProtocol (
|
||||||
|
&gEfiHiiConfigRoutingProtocolGuid,
|
||||||
|
NULL,
|
||||||
|
(VOID **) &CallbackInfo->HiiConfigRouting
|
||||||
|
);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Clear all the globle variable
|
||||||
|
//
|
||||||
|
mDriverImageHandleCount = 0;
|
||||||
|
mCurrentPage = 0;
|
||||||
|
ZeroMem (mDriverImageToken, MAX_CHOICE_NUM * sizeof (EFI_STRING_ID));
|
||||||
|
ZeroMem (mDriverImageFilePathToken, MAX_CHOICE_NUM * sizeof (EFI_STRING_ID));
|
||||||
|
ZeroMem (mControllerToken, MAX_CHOICE_NUM * sizeof (EFI_STRING_ID));
|
||||||
|
ZeroMem (mDriverImageProtocol, MAX_CHOICE_NUM * sizeof (EFI_LOADED_IMAGE_PROTOCOL *));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Show the page
|
||||||
|
//
|
||||||
|
Status = FormBrowser2->SendForm (
|
||||||
|
FormBrowser2,
|
||||||
|
&CallbackInfo->RegisteredHandle,
|
||||||
|
1,
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
Status = HiiDatabase->RemovePackageList (HiiDatabase, CallbackInfo->RegisteredHandle);
|
||||||
|
if (EFI_ERROR (Status)) {
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
|
||||||
|
return EFI_SUCCESS;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
|
The defintions are required both by Source code and Vfr file.
|
||||||
|
The PLAT_OVER_MNGR_DATA structure, form guid and Ifr question ID are defined.
|
||||||
|
|
||||||
Copyright (c) 2007 - 2008, Intel Corporation
|
Copyright (c) 2007 - 2008, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -9,84 +12,29 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
PlatOverMngr.h
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
Function prototype for platform driver override manager driver
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef _PLAT_OVER_MNGR_H_
|
#ifndef _PLAT_OVER_MNGR_H_
|
||||||
#define _PLAT_OVER_MNGR_H_
|
#define _PLAT_OVER_MNGR_H_
|
||||||
|
|
||||||
#include <PiDxe.h>
|
|
||||||
|
|
||||||
#include <Protocol/HiiConfigAccess.h>
|
|
||||||
#include <Protocol/HiiConfigRouting.h>
|
|
||||||
#include <Protocol/HiiDatabase.h>
|
|
||||||
#include <Protocol/LoadedImage.h>
|
|
||||||
#include <Protocol/FirmwareVolumeBlock.h>
|
|
||||||
#include <Protocol/FirmwareVolume2.h>
|
|
||||||
#include <Protocol/PciIo.h>
|
|
||||||
#include <Protocol/BusSpecificDriverOverride.h>
|
|
||||||
#include <Protocol/ComponentName2.h>
|
|
||||||
#include <Protocol/ComponentName.h>
|
|
||||||
#include <Protocol/DevicePathToText.h>
|
|
||||||
|
|
||||||
#include <Library/BaseLib.h>
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/UefiLib.h>
|
|
||||||
#include <Library/UefiApplicationEntryPoint.h>
|
|
||||||
#include <Library/UefiBootServicesTableLib.h>
|
|
||||||
#include <Library/PlatDriOverLib.h>
|
|
||||||
#include <Library/IfrSupportLib.h>
|
|
||||||
#include <Library/ExtendedIfrSupportLib.h>
|
|
||||||
#include <Library/BaseMemoryLib.h>
|
|
||||||
#include <Library/MemoryAllocationLib.h>
|
|
||||||
#include <Library/HiiLib.h>
|
|
||||||
#include <Library/ExtendedHiiLib.h>
|
|
||||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
|
||||||
#include <Library/DevicePathLib.h>
|
|
||||||
|
|
||||||
#define MIN_ALIGNMENT_SIZE 4
|
|
||||||
#define ALIGN_SIZE(a) ((a % MIN_ALIGNMENT_SIZE) ? MIN_ALIGNMENT_SIZE - (a % MIN_ALIGNMENT_SIZE) : 0)
|
|
||||||
|
|
||||||
|
|
||||||
#define EFI_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('C', 'l', 'b', 'k')
|
|
||||||
#define EFI_CALLBACK_INFO_FROM_THIS(a) CR (a, EFI_CALLBACK_INFO, ConfigAccess, EFI_CALLBACK_INFO_SIGNATURE)
|
|
||||||
#define MAX_CHOICE_NUM 0x100
|
|
||||||
#define UPDATE_DATA_SIZE 0x1000
|
|
||||||
|
|
||||||
|
|
||||||
extern UINT8 VfrBin[];
|
|
||||||
|
|
||||||
extern UINT8 PlatOverMngrStrings[];
|
|
||||||
|
|
||||||
//
|
|
||||||
// Following definition is the same as in vfr file
|
|
||||||
//
|
|
||||||
#define PLAT_OVER_MNGR_GUID \
|
#define PLAT_OVER_MNGR_GUID \
|
||||||
{ \
|
{ \
|
||||||
0x8614567d, 0x35be, 0x4415, {0x8d, 0x88, 0xbd, 0x7d, 0xc, 0x9c, 0x70, 0xc0} \
|
0x8614567d, 0x35be, 0x4415, {0x8d, 0x88, 0xbd, 0x7d, 0xc, 0x9c, 0x70, 0xc0} \
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct {
|
//
|
||||||
UINT8 DriSelection[100];
|
// The max number of the supported driver list.
|
||||||
UINT8 DriOrder[100];
|
//
|
||||||
UINT8 PciDeviceFilter;
|
//
|
||||||
} PLAT_OVER_MNGR_DATA;
|
#define MAX_CHOICE_NUM 0x0100
|
||||||
|
#define UPDATE_DATA_SIZE 0x1000
|
||||||
|
|
||||||
#define FORM_ID_DEVICE 0x1234
|
#define FORM_ID_DEVICE 0x1100
|
||||||
#define FORM_ID_DRIVER 0x1200
|
#define FORM_ID_DRIVER 0x1200
|
||||||
#define FORM_ID_ORDER 0x1500
|
#define FORM_ID_ORDER 0x1500
|
||||||
|
|
||||||
#define KEY_VALUE_DEVICE_OFFSET 0x0100
|
#define KEY_VALUE_DEVICE_OFFSET 0x0100
|
||||||
#define KEY_VALUE_DEVICE_MAX 0x04ff
|
#define KEY_VALUE_DEVICE_MAX (KEY_VALUE_DEVICE_OFFSET + MAX_CHOICE_NUM)
|
||||||
|
|
||||||
#define QUESTION_ID_OFFSET 0x0500
|
|
||||||
|
|
||||||
#define KEY_VALUE_DEVICE_REFRESH 0x1234
|
#define KEY_VALUE_DEVICE_REFRESH 0x1234
|
||||||
#define KEY_VALUE_DEVICE_FILTER 0x1235
|
#define KEY_VALUE_DEVICE_FILTER 0x1235
|
||||||
@ -100,151 +48,25 @@ typedef struct {
|
|||||||
|
|
||||||
#define VARSTORE_ID_PLAT_OVER_MNGR 0x1000
|
#define VARSTORE_ID_PLAT_OVER_MNGR 0x1000
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
UINT8 DriSelection[MAX_CHOICE_NUM];
|
||||||
|
UINT8 DriOrder[MAX_CHOICE_NUM];
|
||||||
|
UINT8 PciDeviceFilter;
|
||||||
|
} PLAT_OVER_MNGR_DATA;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Question Id start from 1, so define an offset for it
|
// Field offset of structure PLAT_OVER_MNGR_DATA
|
||||||
//
|
//
|
||||||
#define VAR_OFFSET(Field) ((UINTN) &(((PLAT_OVER_MNGR_DATA *) 0)->Field))
|
#define VAR_OFFSET(Field) ((UINTN) &(((PLAT_OVER_MNGR_DATA *) 0)->Field))
|
||||||
|
|
||||||
#define DRIVER_SELECTION_VAR_OFFSET (VAR_OFFSET (DriSelection))
|
#define DRIVER_SELECTION_VAR_OFFSET (VAR_OFFSET (DriSelection))
|
||||||
#define DRIVER_ORDER_VAR_OFFSET (VAR_OFFSET (DriOrder))
|
#define DRIVER_ORDER_VAR_OFFSET (VAR_OFFSET (DriOrder))
|
||||||
|
|
||||||
|
//
|
||||||
|
// Tool automatic generated Question Id start from 1
|
||||||
|
// In order to avoid to conflict them, the Driver Selection and Order QuestionID offset is defined from 0x0500.
|
||||||
|
//
|
||||||
|
#define QUESTION_ID_OFFSET 0x0500
|
||||||
#define DRIVER_SELECTION_QUESTION_ID (VAR_OFFSET (DriSelection) + QUESTION_ID_OFFSET)
|
#define DRIVER_SELECTION_QUESTION_ID (VAR_OFFSET (DriSelection) + QUESTION_ID_OFFSET)
|
||||||
#define DRIVER_ORDER_QUESTION_ID (VAR_OFFSET (DriOrder) + QUESTION_ID_OFFSET)
|
#define DRIVER_ORDER_QUESTION_ID (VAR_OFFSET (DriOrder) + QUESTION_ID_OFFSET)
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINTN Signature;
|
|
||||||
|
|
||||||
EFI_HANDLE DriverHandle;
|
|
||||||
EFI_HII_HANDLE RegisteredHandle;
|
|
||||||
PLAT_OVER_MNGR_DATA FakeNvData;
|
|
||||||
|
|
||||||
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
|
|
||||||
|
|
||||||
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
|
|
||||||
} EFI_CALLBACK_INFO;
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
EFI_DRIVER_CONFIGURATION_PROTOCOL *DriverConfiguration;
|
|
||||||
EFI_HANDLE DriverImageHandle;
|
|
||||||
EFI_HANDLE ControllerHandle;
|
|
||||||
EFI_HANDLE ChildControllerHandle;
|
|
||||||
//
|
|
||||||
// To avoid created string leak in Hii database, use this token to reuse every token created by the driver
|
|
||||||
//
|
|
||||||
EFI_STRING_ID DescriptionToken;
|
|
||||||
} CFG_PROTOCOL_INVOKER_CHOICE;
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function allows a caller to extract the current configuration for one
|
|
||||||
or more named elements from the target driver.
|
|
||||||
|
|
||||||
@param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
|
||||||
@param Request A null-terminated Unicode string in <ConfigRequest> format.
|
|
||||||
@param Progress On return, points to a character in the Request string.
|
|
||||||
Points to the string's null terminator if request was successful.
|
|
||||||
Points to the most recent '&' before the first failing name/value
|
|
||||||
pair (or the beginning of the string if the failure is in the
|
|
||||||
first name/value pair) if the request was not successful.
|
|
||||||
@param Results A null-terminated Unicode string in <ConfigAltResp> format which
|
|
||||||
has all values filled in for the names in the Request string.
|
|
||||||
String to be allocated by the called function.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The Results is filled with the requested values.
|
|
||||||
@retval EFI_OUT_OF_RESOURCES Not enough memory to store the results.
|
|
||||||
@retval EFI_INVALID_PARAMETER Request is NULL, illegal syntax, or unknown name.
|
|
||||||
@retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
PlatOverMngrExtractConfig (
|
|
||||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
|
||||||
IN CONST EFI_STRING Request,
|
|
||||||
OUT EFI_STRING *Progress,
|
|
||||||
OUT EFI_STRING *Results
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
This function processes the results of changes in configuration.
|
|
||||||
|
|
||||||
@param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
|
||||||
@param Configuration A null-terminated Unicode string in <ConfigRequest> format.
|
|
||||||
@param Progress A pointer to a string filled in with the offset of the most
|
|
||||||
recent '&' before the first failing name/value pair (or the
|
|
||||||
beginning of the string if the failure is in the first
|
|
||||||
name/value pair) or the terminating NULL if all was successful.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The Results is processed successfully.
|
|
||||||
@retval EFI_INVALID_PARAMETER Configuration is NULL.
|
|
||||||
@retval EFI_NOT_FOUND Routing data doesn't match any storage in this driver.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
PlatOverMngrRouteConfig (
|
|
||||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
|
||||||
IN CONST EFI_STRING Configuration,
|
|
||||||
OUT EFI_STRING *Progress
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
This is the function that is called to provide results data to the driver. This data
|
|
||||||
consists of a unique key which is used to identify what data is either being passed back
|
|
||||||
or being asked for.
|
|
||||||
|
|
||||||
@param This Points to the EFI_HII_CONFIG_ACCESS_PROTOCOL.
|
|
||||||
@param Action A null-terminated Unicode string in <ConfigRequest> format.
|
|
||||||
@param KeyValue A unique Goto OpCode callback value which record user's selection.
|
|
||||||
0x100 <= KeyValue <0x500 : user select a controller item in the first page;
|
|
||||||
KeyValue == 0x1234 : user select 'Refresh' in first page, or user select 'Go to Previous Menu' in second page
|
|
||||||
KeyValue == 0x1235 : user select 'Pci device filter' in first page
|
|
||||||
KeyValue == 0x1500 : user select 'order ... priority' item in second page
|
|
||||||
KeyValue == 0x1800 : user select 'commint changes' in third page
|
|
||||||
KeyValue == 0x2000 : user select 'Go to Previous Menu' in third page
|
|
||||||
@param Type The type of value for the question.
|
|
||||||
@param Value A pointer to the data being sent to the original exporting driver.
|
|
||||||
@param ActionRequest On return, points to the action requested by the callback function.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS Always returned.
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
PlatOverMngrCallback (
|
|
||||||
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
|
||||||
IN EFI_BROWSER_ACTION Action,
|
|
||||||
IN EFI_QUESTION_ID KeyValue,
|
|
||||||
IN UINT8 Type,
|
|
||||||
IN EFI_IFR_TYPE_VALUE *Value,
|
|
||||||
OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Get the image name
|
|
||||||
|
|
||||||
@param Image Image to search.
|
|
||||||
|
|
||||||
@retval !NULL Pointer into the image name if the image name is found,
|
|
||||||
@retval NULL Pointer to NULL if the image name is not found.
|
|
||||||
|
|
||||||
**/
|
|
||||||
CHAR16 *
|
|
||||||
GetImageName (
|
|
||||||
IN EFI_LOADED_IMAGE_PROTOCOL *Image
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
Get the description string by device path.
|
|
||||||
|
|
||||||
@param DevPath The input device path.
|
|
||||||
|
|
||||||
@retval !NULL The description string retured.
|
|
||||||
@retval NULL The description string cannot be found.
|
|
||||||
|
|
||||||
**/
|
|
||||||
CHAR16 *
|
|
||||||
DevicePathToStr (
|
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
|
||||||
);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,7 +1,17 @@
|
|||||||
#/** @file
|
#/** @file
|
||||||
# Component description file for PlatOverMngr driver
|
|
||||||
#
|
#
|
||||||
# FIX ME!
|
# A UI application to offer a UI interface in device manager to let user configue
|
||||||
|
# platform override protocol to override the default algorithm for matching
|
||||||
|
# drivers to controllers.
|
||||||
|
#
|
||||||
|
# The main flow:
|
||||||
|
# 1. The UI application dynamicly locate all controller device path.
|
||||||
|
# 2. The UI application dynamicly locate all drivers which support binding protocol.
|
||||||
|
# 3. The UI application export and dynamicly update two menu to let user select the
|
||||||
|
# mapping between drivers to controllers.
|
||||||
|
# 4. The UI application save all the mapping info in NV variables for the following boot,
|
||||||
|
# which will be consumed by platform override protocol driver to publish the platform override protocol.
|
||||||
|
#
|
||||||
# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.
|
# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.
|
||||||
#
|
#
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
@ -35,33 +45,43 @@
|
|||||||
PlatOverMngr.c
|
PlatOverMngr.c
|
||||||
PlatOverMngr.h
|
PlatOverMngr.h
|
||||||
|
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
MdeModulePkg/MdeModulePkg.dec
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
|
|
||||||
|
|
||||||
[LibraryClasses]
|
[LibraryClasses]
|
||||||
BaseLib
|
BaseLib
|
||||||
UefiBootServicesTableLib
|
|
||||||
UefiApplicationEntryPoint
|
|
||||||
UefiLib
|
|
||||||
DebugLib
|
DebugLib
|
||||||
|
UefiLib
|
||||||
|
UefiApplicationEntryPoint
|
||||||
|
UefiBootServicesTableLib
|
||||||
PlatDriOverLib
|
PlatDriOverLib
|
||||||
|
HiiLib
|
||||||
IfrSupportLib
|
IfrSupportLib
|
||||||
|
ExtendedHiiLib
|
||||||
ExtendedIfrSupportLib
|
ExtendedIfrSupportLib
|
||||||
BaseMemoryLib
|
BaseMemoryLib
|
||||||
MemoryAllocationLib
|
MemoryAllocationLib
|
||||||
HiiLib
|
|
||||||
ExtendedHiiLib
|
|
||||||
UefiRuntimeServicesTableLib
|
UefiRuntimeServicesTableLib
|
||||||
DevicePathLib
|
DevicePathLib
|
||||||
|
GenericBdsLib
|
||||||
|
|
||||||
|
[Guids]
|
||||||
|
gEfiGlobalVariableGuid # Get value of variable L"PlatformLang".
|
||||||
|
# this value specifies the platform supported language string (RFC 3066)
|
||||||
|
|
||||||
[Protocols]
|
[Protocols]
|
||||||
gEfiLoadedImageProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
|
||||||
gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
|
||||||
gEfiBusSpecificDriverOverrideProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
|
||||||
gEfiComponentName2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiComponentName2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
gEfiComponentNameProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiComponentNameProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
gEfiHiiConfigAccessProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiFirmwareVolume2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
gEfiDevicePathToTextProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
gEfiDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiBusSpecificDriverOverrideProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiDriverBindingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiLoadedImageProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiLoadedImageDevicePathProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiHiiDatabaseProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiFormBrowser2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiHiiConfigRoutingProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiHiiConfigAccessProtocolGuid # PROTOCOL ALWAYS_PRODUCED
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
// *++
|
// *++
|
||||||
//
|
//
|
||||||
// Copyright (c) 2007, Intel Corporation
|
// Copyright (c) 2007 - 2008, Intel Corporation
|
||||||
// All rights reserved. This program and the accompanying materials
|
// All rights reserved. This program and the accompanying materials
|
||||||
// are licensed and made available under the terms and conditions of the BSD License
|
// are licensed and made available under the terms and conditions of the BSD License
|
||||||
// which accompanies this distribution. The full text of the license may be found at
|
// which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -20,38 +20,7 @@
|
|||||||
//
|
//
|
||||||
// --*/
|
// --*/
|
||||||
|
|
||||||
#define PLAT_OVER_MNGR_GUID \
|
#include "PlatOverMngr.h"
|
||||||
{ \
|
|
||||||
0x8614567d, 0x35be, 0x4415, 0x8d, 0x88, 0xbd, 0x7d, 0xc, 0x9c, 0x70, 0xc0 \
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
UINT8 DriSelection[100];
|
|
||||||
UINT8 DriOrder[100];
|
|
||||||
UINT8 PciDeviceFilter;
|
|
||||||
} PLAT_OVER_MNGR_DATA;
|
|
||||||
|
|
||||||
#define FORM_ID_DEVICE 0x1234
|
|
||||||
#define FORM_ID_DRIVER 0x1200
|
|
||||||
#define FORM_ID_ORDER 0x1500
|
|
||||||
|
|
||||||
#define KEY_VALUE_DEVICE_OFFSET 0x0100
|
|
||||||
#define KEY_VALUE_DEVICE_MAX 0x04ff
|
|
||||||
|
|
||||||
#define QUESTION_ID_OFFSET 0x0500
|
|
||||||
|
|
||||||
#define KEY_VALUE_DEVICE_REFRESH 0x1234
|
|
||||||
#define KEY_VALUE_DEVICE_FILTER 0x1235
|
|
||||||
#define KEY_VALUE_DEVICE_CLEAR 0x1236
|
|
||||||
|
|
||||||
#define KEY_VALUE_DRIVER_GOTO_PREVIOUS 0x1300
|
|
||||||
#define KEY_VALUE_DRIVER_GOTO_ORDER 0x1301
|
|
||||||
|
|
||||||
#define KEY_VALUE_ORDER_GOTO_PREVIOUS 0x2000
|
|
||||||
#define KEY_VALUE_ORDER_SAVE_AND_EXIT 0x1800
|
|
||||||
|
|
||||||
#define VARSTORE_ID_PLAT_OVER_MNGR 0x1000
|
|
||||||
|
|
||||||
|
|
||||||
#define EFI_DISK_DEVICE_CLASS 0x01
|
#define EFI_DISK_DEVICE_CLASS 0x01
|
||||||
#define LABEL_END 0xffff
|
#define LABEL_END 0xffff
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/** @file
|
/** @file
|
||||||
|
|
||||||
Copyright (c) 2007, Intel Corporation
|
Copyright (c) 2007 - 2008, Intel Corporation
|
||||||
All rights reserved. This program and the accompanying materials
|
All rights reserved. This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
which accompanies this distribution. The full text of the license may be found at
|
||||||
@ -9,52 +9,20 @@ http://opensource.org/licenses/bsd-license.php
|
|||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
PlatformDriOverride.c
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
#include <Uefi.h>
|
||||||
|
|
||||||
#include "PlatformDriOverride.h"
|
#include <Library/BaseLib.h>
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL gPlatformDriverOverride = {
|
#include <Library/UefiDriverEntryPoint.h>
|
||||||
GetDriver,
|
#include <Library/UefiBootServicesTableLib.h>
|
||||||
GetDriverPath,
|
#include <Library/PlatDriOverLib.h>
|
||||||
DriverLoaded
|
#include <Protocol/PlatformDriverOverride.h>
|
||||||
};
|
|
||||||
|
|
||||||
LIST_ENTRY mMappingDataBase = INITIALIZE_LIST_HEAD_VARIABLE (mMappingDataBase);
|
LIST_ENTRY mMappingDataBase = INITIALIZE_LIST_HEAD_VARIABLE (mMappingDataBase);
|
||||||
BOOLEAN mEnvironmentVariableRead = FALSE;
|
BOOLEAN mEnvironmentVariableRead = FALSE;
|
||||||
EFI_HANDLE mCallerImageHandle;
|
EFI_HANDLE mCallerImageHandle = NULL;
|
||||||
|
|
||||||
/**
|
|
||||||
Platform Driver Override driver entry point, install the Platform Driver Override Protocol
|
|
||||||
|
|
||||||
@param ImageHandle ImageHandle of the loaded driver.
|
|
||||||
@param SystemTable Pointer to the EFI System Table.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The DXE Driver, DXE Runtime Driver, DXE SMM Driver,
|
|
||||||
or UEFI Driver exited normally.
|
|
||||||
@retval EFI_INCOMPATIBLE_VERSION _gUefiDriverRevision is greater than SystemTable->Hdr.Revision.
|
|
||||||
@retval Other Return value from ProcessModuleEntryPointList().
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
PlatformDriverOverrideEntry (
|
|
||||||
IN EFI_HANDLE ImageHandle,
|
|
||||||
IN EFI_SYSTEM_TABLE *SystemTable
|
|
||||||
)
|
|
||||||
{
|
|
||||||
mEnvironmentVariableRead = FALSE;
|
|
||||||
mCallerImageHandle = ImageHandle;
|
|
||||||
InitializeListHead (&mMappingDataBase);
|
|
||||||
return InstallPlatformDriverOverrideProtocol (&gPlatformDriverOverride);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Retrieves the image handle of the platform override driver for a controller in the system.
|
Retrieves the image handle of the platform override driver for a controller in the system.
|
||||||
@ -82,12 +50,13 @@ PlatformDriverOverrideEntry (
|
|||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GetDriver (
|
GetDriver (
|
||||||
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL * This,
|
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This,
|
||||||
IN EFI_HANDLE ControllerHandle,
|
IN EFI_HANDLE ControllerHandle,
|
||||||
IN OUT EFI_HANDLE * DriverImageHandle
|
IN OUT EFI_HANDLE *DriverImageHandle
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Check that ControllerHandle is a valid handle
|
// Check that ControllerHandle is a valid handle
|
||||||
//
|
//
|
||||||
@ -105,59 +74,46 @@ GetDriver (
|
|||||||
mEnvironmentVariableRead = TRUE;
|
mEnvironmentVariableRead = TRUE;
|
||||||
|
|
||||||
Status = InitOverridesMapping (&mMappingDataBase);
|
Status = InitOverridesMapping (&mMappingDataBase);
|
||||||
if (Status == EFI_NOT_FOUND) {
|
if (EFI_ERROR (Status)){
|
||||||
|
DEBUG ((DEBUG_ERROR, "The status to Get Platform Driver Override Variable is %r\n", Status));
|
||||||
InitializeListHead (&mMappingDataBase);
|
InitializeListHead (&mMappingDataBase);
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
} else if (Status == EFI_VOLUME_CORRUPTED){
|
}
|
||||||
DEBUG ((DEBUG_ERROR, "Platform Driver Override Variable is corrupt\n"));
|
}
|
||||||
//
|
|
||||||
// The environment variable(s) that contain the override mappings from Controller Device Path to
|
|
||||||
// a set of Driver Device Paths is corrupted, platform code can use LibDeleteOverridesVariables to
|
|
||||||
// delete all orverride variables as a policy. Here can be IBV/OEM customized.
|
|
||||||
//
|
|
||||||
|
|
||||||
//LibDeleteOverridesVariables();
|
|
||||||
InitializeListHead (&mMappingDataBase);
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
} else if (EFI_ERROR (Status)){
|
|
||||||
InitializeListHead (&mMappingDataBase);
|
|
||||||
return EFI_NOT_FOUND;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//
|
//
|
||||||
// if the environment variable does not exist or the variable appears to be corrupt, just return not found
|
// if the environment variable does not exist, just return not found
|
||||||
//
|
//
|
||||||
if (IsListEmpty (&mMappingDataBase)) {
|
if (IsListEmpty (&mMappingDataBase)) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
return GetDriverFromMapping (
|
return GetDriverFromMapping (
|
||||||
This,
|
|
||||||
ControllerHandle,
|
ControllerHandle,
|
||||||
DriverImageHandle,
|
DriverImageHandle,
|
||||||
&mMappingDataBase,
|
&mMappingDataBase,
|
||||||
mCallerImageHandle
|
mCallerImageHandle
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
For the use of the ControllerHandle parameter in the GetDriverPath()
|
Retrieves the device path of the platform override driver for a controller in the system.
|
||||||
But this API is very difficult to use, so not support.
|
This driver doesn't support this API.
|
||||||
|
|
||||||
@param This A pointer to the
|
@param This A pointer to the EFI_PLATFORM_DRIVER_OVERRIDE_
|
||||||
EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL instance.
|
PROTOCOL instance.
|
||||||
@param ControllerHandle The device handle of the controller to check if a
|
@param ControllerHandle The device handle of the controller to check if a driver override
|
||||||
driver override exists.
|
exists.
|
||||||
@param DriverImagePath The device path for this Image.
|
@param DriverImageHandle On input, a pointer to the previous driver image handle returned
|
||||||
|
by GetDriverPath(). On output, a pointer to the next driver
|
||||||
|
device path.
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED
|
@retval EFI_UNSUPPORTED
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
GetDriverPath (
|
GetDriverPath (
|
||||||
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL * This,
|
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This,
|
||||||
IN EFI_HANDLE ControllerHandle,
|
IN EFI_HANDLE ControllerHandle,
|
||||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DriverImagePath
|
IN OUT EFI_DEVICE_PATH_PROTOCOL **DriverImagePath
|
||||||
)
|
)
|
||||||
@ -167,30 +123,89 @@ GetDriverPath (
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
For the use of the ControllerHandle parameter in the DriverLoaded()
|
Used to associate a driver image handle with a device path that was returned on a prior call to the
|
||||||
But this API is very difficult to use, so not support.
|
GetDriverPath() service. This driver image handle will then be available through the
|
||||||
|
GetDriver() service. This driver doesn't support this API.
|
||||||
|
|
||||||
@param This A pointer to the
|
@param This A pointer to the EFI_PLATFORM_DRIVER_OVERRIDE_
|
||||||
EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL instance.
|
PROTOCOL instance.
|
||||||
@param ControllerHandle The device handle of the controller to check if a
|
@param ControllerHandle The device handle of the controller.
|
||||||
driver override exists.
|
@param DriverImagePath A pointer to the driver device path that was returned in a prior
|
||||||
@param DriverImagePath The device path for this Image.
|
call to GetDriverPath().
|
||||||
@param DriverImageHandle On input, a pointer to the previous driver image
|
@param DriverImageHandle The driver image handle that was returned by LoadImage()
|
||||||
handle returned by GetDriver(). On output, a
|
when the driver specified by DriverImagePath was loaded
|
||||||
pointer to the next driver image handle. Passing
|
into memory.
|
||||||
in a NULL, will return the first driver image
|
|
||||||
handle for ControllerHandle.
|
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED
|
@retval EFI_UNSUPPORTED
|
||||||
**/
|
**/
|
||||||
EFI_STATUS
|
EFI_STATUS
|
||||||
EFIAPI
|
EFIAPI
|
||||||
DriverLoaded (
|
DriverLoaded (
|
||||||
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL * This,
|
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL *This,
|
||||||
IN EFI_HANDLE ControllerHandle,
|
IN EFI_HANDLE ControllerHandle,
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL * DriverImagePath,
|
IN EFI_DEVICE_PATH_PROTOCOL *DriverImagePath,
|
||||||
IN EFI_HANDLE DriverImageHandle
|
IN EFI_HANDLE DriverImageHandle
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return EFI_UNSUPPORTED;
|
return EFI_UNSUPPORTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL mPlatformDriverOverride = {
|
||||||
|
GetDriver,
|
||||||
|
GetDriverPath,
|
||||||
|
DriverLoaded
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
Platform Driver Override driver entry point, install the Platform Driver Override Protocol
|
||||||
|
|
||||||
|
@param ImageHandle ImageHandle of the loaded driver.
|
||||||
|
@param SystemTable Pointer to the EFI System Table.
|
||||||
|
|
||||||
|
@retval EFI_SUCCESS The DXE Driver, DXE Runtime Driver, DXE SMM Driver,
|
||||||
|
or UEFI Driver exited normally.
|
||||||
|
@retval EFI_ALREADY_STARTED A protocol instance has been installed. Not need install again.
|
||||||
|
**/
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
PlatformDriverOverrideEntry (
|
||||||
|
IN EFI_HANDLE ImageHandle,
|
||||||
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
|
)
|
||||||
|
{
|
||||||
|
EFI_HANDLE Handle;
|
||||||
|
EFI_STATUS Status;
|
||||||
|
VOID *Instance;
|
||||||
|
|
||||||
|
mCallerImageHandle = ImageHandle;
|
||||||
|
|
||||||
|
//
|
||||||
|
// According to UEFI spec, there can be at most a single instance
|
||||||
|
// in the system of the EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL.
|
||||||
|
// So here we check the existence.
|
||||||
|
//
|
||||||
|
Status = gBS->LocateProtocol (
|
||||||
|
&gEfiPlatformDriverOverrideProtocolGuid,
|
||||||
|
NULL,
|
||||||
|
&Instance
|
||||||
|
);
|
||||||
|
//
|
||||||
|
// If there was no error, assume there is an installation and return error
|
||||||
|
//
|
||||||
|
if (!EFI_ERROR (Status)) {
|
||||||
|
return EFI_ALREADY_STARTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Install platform driver override protocol
|
||||||
|
//
|
||||||
|
Handle = NULL;
|
||||||
|
Status = gBS->InstallProtocolInterface (
|
||||||
|
&Handle,
|
||||||
|
&gEfiPlatformDriverOverrideProtocolGuid,
|
||||||
|
EFI_NATIVE_INTERFACE,
|
||||||
|
&mPlatformDriverOverride
|
||||||
|
);
|
||||||
|
ASSERT_EFI_ERROR (Status);
|
||||||
|
return EFI_SUCCESS;
|
||||||
|
}
|
||||||
|
@ -1,107 +0,0 @@
|
|||||||
/** @file
|
|
||||||
|
|
||||||
Copyright (c) 2007, Intel Corporation
|
|
||||||
All rights reserved. This program and the accompanying materials
|
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
|
||||||
which accompanies this distribution. The full text of the license may be found at
|
|
||||||
http://opensource.org/licenses/bsd-license.php
|
|
||||||
|
|
||||||
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
||||||
|
|
||||||
Module Name:
|
|
||||||
|
|
||||||
PlatformDriOverride.h
|
|
||||||
|
|
||||||
Abstract:
|
|
||||||
|
|
||||||
|
|
||||||
**/
|
|
||||||
|
|
||||||
#ifndef _PLATFORM_DRI_OVERRIDE_H_
|
|
||||||
#define _PLATFORM_DRI_OVERRIDE_H_
|
|
||||||
|
|
||||||
#include <Uefi.h>
|
|
||||||
|
|
||||||
#include <Library/DebugLib.h>
|
|
||||||
#include <Library/UefiDriverEntryPoint.h>
|
|
||||||
#include <Library/BaseLib.h>
|
|
||||||
#include <Library/PlatDriOverLib.h>
|
|
||||||
|
|
||||||
/**
|
|
||||||
Retrieves the image handle of the platform override driver for a controller in the system.
|
|
||||||
|
|
||||||
@param This A pointer to the
|
|
||||||
EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL instance.
|
|
||||||
@param ControllerHandle The device handle of the controller to check if a
|
|
||||||
driver override exists.
|
|
||||||
@param DriverImageHandle On input, a pointer to the previous driver image
|
|
||||||
handle returned by GetDriver(). On output, a
|
|
||||||
pointer to the next driver image handle. Passing
|
|
||||||
in a NULL, will return the first driver image
|
|
||||||
handle for ControllerHandle.
|
|
||||||
|
|
||||||
@retval EFI_SUCCESS The driver override for ControllerHandle was
|
|
||||||
returned in DriverImageHandle.
|
|
||||||
@retval EFI_NOT_FOUND A driver override for ControllerHandle was not
|
|
||||||
found.
|
|
||||||
@retval EFI_INVALID_PARAMETER The handle specified by ControllerHandle is not a
|
|
||||||
valid handle. DriverImageHandle is not a handle
|
|
||||||
that was returned on a previous call to
|
|
||||||
GetDriver().
|
|
||||||
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
GetDriver (
|
|
||||||
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL * This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
|
||||||
IN OUT EFI_HANDLE * DriverImageHandle
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
For the use of the ControllerHandle parameter in the GetDriverPath()
|
|
||||||
But this API is very difficult to use, so not support.
|
|
||||||
|
|
||||||
@param This A pointer to the
|
|
||||||
EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL instance.
|
|
||||||
@param ControllerHandle The device handle of the controller to check if a
|
|
||||||
driver override exists.
|
|
||||||
@param DriverImagePath The device path for this Image.
|
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
GetDriverPath (
|
|
||||||
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL * This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
|
||||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DriverImagePath
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
For the use of the ControllerHandle parameter in the DriverLoaded()
|
|
||||||
But this API is very difficult to use, so not support.
|
|
||||||
|
|
||||||
@param This A pointer to the
|
|
||||||
EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL instance.
|
|
||||||
@param ControllerHandle The device handle of the controller to check if a
|
|
||||||
driver override exists.
|
|
||||||
@param DriverImagePath The device path for this Image.
|
|
||||||
@param DriverImageHandle On input, a pointer to the previous driver image
|
|
||||||
handle returned by GetDriver(). On output, a
|
|
||||||
pointer to the next driver image handle. Passing
|
|
||||||
in a NULL, will return the first driver image
|
|
||||||
handle for ControllerHandle.
|
|
||||||
|
|
||||||
@retval EFI_UNSUPPORTED
|
|
||||||
**/
|
|
||||||
EFI_STATUS
|
|
||||||
EFIAPI
|
|
||||||
DriverLoaded (
|
|
||||||
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL * This,
|
|
||||||
IN EFI_HANDLE ControllerHandle,
|
|
||||||
IN EFI_DEVICE_PATH_PROTOCOL * DriverImagePath,
|
|
||||||
IN EFI_HANDLE DriverImageHandle
|
|
||||||
);
|
|
||||||
#endif
|
|
@ -1,8 +1,10 @@
|
|||||||
#/** @file
|
#/** @file
|
||||||
# Component name for module PlatformDriOverride
|
# This driver produces UEFI PLATFORM_DRIVER_OVERRIDE_PROTOCOL if this protocol doesn't exist.
|
||||||
|
# It doesn't install again if this protocol exists.
|
||||||
|
# It only implements one interface GetDriver of PLATFORM_DRIVER_OVERRIDE_PROTOCOL protocol
|
||||||
|
# and doesn't support other two interfaces GetDriverPath, DriverLoaded.
|
||||||
#
|
#
|
||||||
# FIX ME!
|
# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.
|
||||||
# Copyright (c) 2007, Intel Corporation. All rights reserved.
|
|
||||||
#
|
#
|
||||||
# All rights reserved. This program and the accompanying materials
|
# All rights reserved. This program and the accompanying materials
|
||||||
# are licensed and made available under the terms and conditions of the BSD License
|
# are licensed and made available under the terms and conditions of the BSD License
|
||||||
@ -12,14 +14,13 @@
|
|||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
#
|
|
||||||
#**/
|
#**/
|
||||||
|
|
||||||
[Defines]
|
[Defines]
|
||||||
INF_VERSION = 0x00010005
|
INF_VERSION = 0x00010005
|
||||||
BASE_NAME = PlatformDriOverrideDxe
|
BASE_NAME = PlatformDriOverrideDxe
|
||||||
FILE_GUID = 35034CE2-A6E5-4fb4-BABE-A0156E9B2549
|
FILE_GUID = 35034CE2-A6E5-4fb4-BABE-A0156E9B2549
|
||||||
MODULE_TYPE = DXE_DRIVER
|
MODULE_TYPE = UEFI_DRIVER
|
||||||
VERSION_STRING = 1.0
|
VERSION_STRING = 1.0
|
||||||
ENTRY_POINT = PlatformDriverOverrideEntry
|
ENTRY_POINT = PlatformDriverOverrideEntry
|
||||||
|
|
||||||
@ -31,7 +32,6 @@
|
|||||||
|
|
||||||
[Sources.common]
|
[Sources.common]
|
||||||
PlatformDriOverride.c
|
PlatformDriOverride.c
|
||||||
PlatformDriOverride.h
|
|
||||||
|
|
||||||
[Packages]
|
[Packages]
|
||||||
MdePkg/MdePkg.dec
|
MdePkg/MdePkg.dec
|
||||||
@ -42,4 +42,8 @@
|
|||||||
UefiDriverEntryPoint
|
UefiDriverEntryPoint
|
||||||
DebugLib
|
DebugLib
|
||||||
PlatDriOverLib
|
PlatDriOverLib
|
||||||
|
UefiBootServicesTableLib
|
||||||
|
|
||||||
|
[Protocols]
|
||||||
|
gEfiPlatformDriverOverrideProtocolGuid # ALWAYS_PRODUCED
|
||||||
|
|
Reference in New Issue
Block a user