Merge application PlatOverMngr and library DxePlatDriOverLib into driver PlatDriOverrideDxe.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@8169 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -0,0 +1,218 @@
|
||||
/** @file
|
||||
Ihe internal heder file includes the required Protocol/Guid/Library
|
||||
and the shared function APIs.
|
||||
|
||||
Copyright (c) 2007 - 2009, 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.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _INTERNAL_PLATFORM_DRIVER_OVERRIDE_H_
|
||||
#define _INTERNAL_PLATFORM_DRIVER_OVERRIDE_H_
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <Protocol/HiiConfigAccess.h>
|
||||
#include <Protocol/HiiConfigRouting.h>
|
||||
#include <Protocol/HiiDatabase.h>
|
||||
#include <Protocol/FormBrowser2.h>
|
||||
#include <Protocol/LoadedImage.h>
|
||||
#include <Protocol/FirmwareVolume2.h>
|
||||
#include <Protocol/PciIo.h>
|
||||
#include <Protocol/BusSpecificDriverOverride.h>
|
||||
#include <Protocol/ComponentName2.h>
|
||||
#include <Protocol/ComponentName.h>
|
||||
#include <Protocol/DriverBinding.h>
|
||||
#include <Protocol/DevicePathToText.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/PlatformDriverOverride.h>
|
||||
#include <Guid/MdeModuleHii.h>
|
||||
#include <Guid/VariableFormat.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/DxeServicesTableLib.h>
|
||||
#include <Library/HiiLib.h>
|
||||
|
||||
/**
|
||||
Free all the mapping database memory resource and initialize the mapping list entry.
|
||||
|
||||
@param MappingDataBase Mapping database list entry pointer
|
||||
|
||||
@retval EFI_INVALID_PARAMETER mapping database list entry is NULL
|
||||
@retval EFI_SUCCESS Free success
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FreeMappingDatabase (
|
||||
IN OUT LIST_ENTRY *MappingDataBase
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Read the NV environment variable(s) that contain the override mappings from Controller Device Path to
|
||||
a set of Driver Device Paths, and create the mapping database in memory to contain these variable info.
|
||||
|
||||
@param MappingDataBase Mapping database list entry pointer
|
||||
|
||||
@retval EFI_INVALID_PARAMETER MappingDataBase pointer is null
|
||||
@retval EFI_NOT_FOUND Cannot find the 'PlatDriOver' NV variable
|
||||
@retval EFI_VOLUME_CORRUPTED The found NV variable is corrupted
|
||||
@retval EFI_SUCCESS Create the mapping database in memory successfully
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InitOverridesMapping (
|
||||
OUT LIST_ENTRY *MappingDataBase
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Save the memory mapping database into NV environment variable(s).
|
||||
If MappingDataBase list is empty, then delete all platform override NV variables.
|
||||
|
||||
@param MappingDataBase Mapping database list entry pointer
|
||||
|
||||
@retval EFI_INVALID_PARAMETER MappingDataBase pointer is null
|
||||
@retval EFI_SUCCESS Save memory mapping database successfully
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SaveOverridesMapping (
|
||||
IN LIST_ENTRY *MappingDataBase
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Retrieves the image handle of the platform override driver for a controller in the system from the memory mapping database.
|
||||
|
||||
@param ControllerHandle The device handle of the controller to check if
|
||||
a driver override exists.
|
||||
@param DriverImageHandle On output, a pointer to the next driver handle.
|
||||
Passing in a pointer to NULL, will return the
|
||||
first driver handle for ControllerHandle.
|
||||
@param MappingDataBase MappingDataBase - Mapping database list entry
|
||||
pointer
|
||||
@param CallerImageHandle The caller driver's image handle, for
|
||||
UpdateFvFileDevicePath use.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER The handle specified by ControllerHandle is not
|
||||
a valid handle. Or DriverImagePath is not a
|
||||
device path that was returned on a previous call
|
||||
to GetDriverPath().
|
||||
@retval EFI_NOT_FOUND A driver override for ControllerHandle was not
|
||||
found.
|
||||
@retval EFI_UNSUPPORTED The operation is not supported.
|
||||
@retval EFI_SUCCESS The driver override for ControllerHandle was
|
||||
returned in DriverImagePath.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GetDriverFromMapping (
|
||||
IN EFI_HANDLE ControllerHandle,
|
||||
IN OUT EFI_HANDLE *DriverImageHandle,
|
||||
IN LIST_ENTRY *MappingDataBase,
|
||||
IN EFI_HANDLE CallerImageHandle
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Check mapping database whether already has the mapping info which
|
||||
records the input Controller to input DriverImage.
|
||||
|
||||
@param ControllerDevicePath The controller device path is to be check.
|
||||
@param DriverImageDevicePath The driver image device path is to be check.
|
||||
@param MappingDataBase Mapping database list entry pointer
|
||||
@param DriverInfoNum the controller's total override driver number
|
||||
@param DriverImageNO The driver order number for the input DriverImage.
|
||||
If the DriverImageDevicePath is NULL, DriverImageNO is not set.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerDevicePath or MappingDataBase is NULL.
|
||||
@retval EFI_NOT_FOUND ControllerDevicePath is not found in MappingDataBase or
|
||||
DriverImageDevicePath is not found in the found DriverImage Info list.
|
||||
@retval EFI_SUCCESS The controller's total override driver number and
|
||||
input DriverImage's order number is correctly return.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
CheckMapping (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath OPTIONAL,
|
||||
IN LIST_ENTRY *MappingDataBase,
|
||||
OUT UINT32 *DriverInfoNum OPTIONAL,
|
||||
OUT UINT32 *DriverImageNO OPTIONAL
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Insert a driver image as a controller's override driver into the mapping database.
|
||||
The driver image's order number is indicated by DriverImageNO.
|
||||
|
||||
@param ControllerDevicePath The controller device path need to add a
|
||||
override driver image item
|
||||
@param DriverImageDevicePath The driver image device path need to be insert
|
||||
@param MappingDataBase Mapping database list entry pointer
|
||||
@param DriverImageNO The inserted order number. If this number is taken,
|
||||
the larger available number will be used.
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerDevicePath is NULL, or DriverImageDevicePath is NULL
|
||||
or MappingDataBase is NULL
|
||||
@retval EFI_ALREADY_STARTED The input Controller to input DriverImage has been
|
||||
recorded into the mapping database.
|
||||
@retval EFI_SUCCESS The Controller and DriverImage are inserted into
|
||||
the mapping database successfully.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InsertDriverImage (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath,
|
||||
IN LIST_ENTRY *MappingDataBase,
|
||||
IN UINT32 DriverImageNO
|
||||
)
|
||||
;
|
||||
|
||||
/**
|
||||
Delete a controller's override driver from the mapping database.
|
||||
|
||||
@param ControllerDevicePath The controller device path will be deleted
|
||||
when all drivers images on it are removed.
|
||||
@param DriverImageDevicePath The driver image device path will be delete.
|
||||
If NULL, all driver image will be delete.
|
||||
@param MappingDataBase Mapping database list entry pointer
|
||||
|
||||
@retval EFI_INVALID_PARAMETER ControllerDevicePath is NULL, or MappingDataBase is NULL
|
||||
@retval EFI_NOT_FOUND ControllerDevicePath is not found in MappingDataBase or
|
||||
DriverImageDevicePath is not found in the found DriverImage Info list.
|
||||
@retval EFI_SUCCESS Delete the specified driver successfully.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
DeleteDriverImage (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath,
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DriverImageDevicePath,
|
||||
IN LIST_ENTRY *MappingDataBase
|
||||
)
|
||||
;
|
||||
|
||||
#endif
|
1667
MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c
Normal file
1667
MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideDxe.c
Normal file
File diff suppressed because it is too large
Load Diff
1898
MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideLib.c
Normal file
1898
MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatDriOverrideLib.c
Normal file
File diff suppressed because it is too large
Load Diff
73
MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatOverMngr.h
Normal file
73
MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatOverMngr.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/** @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
|
||||
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.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _PLAT_OVER_MNGR_H_
|
||||
#define _PLAT_OVER_MNGR_H_
|
||||
|
||||
#define PLAT_OVER_MNGR_GUID \
|
||||
{ \
|
||||
0x8614567d, 0x35be, 0x4415, {0x8d, 0x88, 0xbd, 0x7d, 0xc, 0x9c, 0x70, 0xc0} \
|
||||
}
|
||||
|
||||
//
|
||||
// The max number of the supported driver list.
|
||||
//
|
||||
#define MAX_CHOICE_NUM 0x00ff
|
||||
#define UPDATE_DATA_SIZE 0x1000
|
||||
|
||||
#define FORM_ID_DEVICE 0x1100
|
||||
#define FORM_ID_DRIVER 0x1200
|
||||
#define FORM_ID_ORDER 0x1500
|
||||
|
||||
#define KEY_VALUE_DEVICE_OFFSET 0x0100
|
||||
#define KEY_VALUE_DEVICE_MAX (KEY_VALUE_DEVICE_OFFSET + MAX_CHOICE_NUM)
|
||||
|
||||
#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 LABEL_END 0xffff
|
||||
|
||||
typedef struct {
|
||||
UINT8 DriSelection[MAX_CHOICE_NUM];
|
||||
UINT8 DriOrder[MAX_CHOICE_NUM];
|
||||
UINT8 PciDeviceFilter;
|
||||
} PLAT_OVER_MNGR_DATA;
|
||||
|
||||
//
|
||||
// Field offset of structure PLAT_OVER_MNGR_DATA
|
||||
//
|
||||
#define VAR_OFFSET(Field) ((UINTN) &(((PLAT_OVER_MNGR_DATA *) 0)->Field))
|
||||
#define DRIVER_SELECTION_VAR_OFFSET (VAR_OFFSET (DriSelection))
|
||||
#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_ORDER_QUESTION_ID (VAR_OFFSET (DriOrder) + QUESTION_ID_OFFSET)
|
||||
|
||||
#endif
|
@@ -1,212 +0,0 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2007 - 2009, 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.
|
||||
|
||||
**/
|
||||
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiDriverEntryPoint.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/PlatformDriverOverrideLib.h>
|
||||
#include <Protocol/PlatformDriverOverride.h>
|
||||
|
||||
LIST_ENTRY mMappingDataBase = INITIALIZE_LIST_HEAD_VARIABLE (mMappingDataBase);
|
||||
BOOLEAN mEnvironmentVariableRead = FALSE;
|
||||
EFI_HANDLE mCallerImageHandle = NULL;
|
||||
|
||||
/**
|
||||
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
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
|
||||
//
|
||||
// Check that ControllerHandle is a valid handle
|
||||
//
|
||||
if (ControllerHandle == NULL) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Read the environment variable(s) that contain the override mappings from Controller Device Path to
|
||||
// a set of Driver Device Paths, and initialize in memory database of the overrides that map Controller
|
||||
// Device Paths to an ordered set of Driver Device Paths and Driver Handles. This action is only performed
|
||||
// once and finished in first call.
|
||||
//
|
||||
if (!mEnvironmentVariableRead) {
|
||||
mEnvironmentVariableRead = TRUE;
|
||||
|
||||
Status = InitOverridesMapping (&mMappingDataBase);
|
||||
if (EFI_ERROR (Status)){
|
||||
DEBUG ((DEBUG_ERROR, "The status to Get Platform Driver Override Variable is %r\n", Status));
|
||||
InitializeListHead (&mMappingDataBase);
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// if the environment variable does not exist, just return not found
|
||||
//
|
||||
if (IsListEmpty (&mMappingDataBase)) {
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
return GetDriverFromMapping (
|
||||
ControllerHandle,
|
||||
DriverImageHandle,
|
||||
&mMappingDataBase,
|
||||
mCallerImageHandle
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
Retrieves the device path of the platform override driver for a controller in the system.
|
||||
This driver doesn't support this API.
|
||||
|
||||
@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 On input, a pointer to the previous driver device path returned by
|
||||
GetDriverPath(). On output, a pointer to the next driver
|
||||
device path. Passing in a pointer to NULL, will return the first
|
||||
driver device path for ControllerHandle.
|
||||
|
||||
@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
|
||||
)
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Used to associate a driver image handle with a device path that was returned on a prior call to the
|
||||
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 EFI_PLATFORM_DRIVER_OVERRIDE_
|
||||
PROTOCOL instance.
|
||||
@param ControllerHandle The device handle of the controller.
|
||||
@param DriverImagePath A pointer to the driver device path that was returned in a prior
|
||||
call to GetDriverPath().
|
||||
@param DriverImageHandle The driver image handle that was returned by LoadImage()
|
||||
when the driver specified by DriverImagePath was loaded
|
||||
into memory.
|
||||
|
||||
@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
|
||||
)
|
||||
{
|
||||
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,9 +1,21 @@
|
||||
#/** @file
|
||||
# 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.
|
||||
# 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.
|
||||
#
|
||||
# This driver also offers an UI interface in device manager to let user configure
|
||||
# platform override protocol to override the default algorithm for matching
|
||||
# drivers to controllers.
|
||||
#
|
||||
# The main flow:
|
||||
# 1. It dynamicly locate all controller device path.
|
||||
# 2. It dynamicly locate all drivers which support binding protocol.
|
||||
# 3. It export and dynamicly update two menu to let user select the
|
||||
# mapping between drivers to controllers.
|
||||
# 4. It save all the mapping info in NV variables for the following boot,
|
||||
# which will be consumed by GetDriver API of the produced the platform override protocol.
|
||||
#
|
||||
# Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.
|
||||
#
|
||||
# All rights reserved. This program and the accompanying materials
|
||||
@@ -18,11 +30,12 @@
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = PlatformDriOverrideDxe
|
||||
BASE_NAME = PlatDriOverrideDxe
|
||||
FILE_GUID = 35034CE2-A6E5-4fb4-BABE-A0156E9B2549
|
||||
MODULE_TYPE = UEFI_DRIVER
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
ENTRY_POINT = PlatformDriverOverrideEntry
|
||||
ENTRY_POINT = PlatDriOverrideDxeInit
|
||||
UNLOAD_IMAGE = PlatDriOverrideDxeUnload
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
@@ -31,7 +44,12 @@
|
||||
#
|
||||
|
||||
[Sources.common]
|
||||
PlatformDriOverride.c
|
||||
VfrStrings.uni
|
||||
Vfr.vfr
|
||||
PlatDriOverrideDxe.c
|
||||
PlatOverMngr.h
|
||||
PlatDriOverrideLib.c
|
||||
InternalPlatDriOverrideDxe.h
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
@@ -39,11 +57,43 @@
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
UefiDriverEntryPoint
|
||||
DebugLib
|
||||
PlatformDriverOverrideLib
|
||||
UefiLib
|
||||
UefiDriverEntryPoint
|
||||
UefiBootServicesTableLib
|
||||
HiiLib
|
||||
BaseMemoryLib
|
||||
MemoryAllocationLib
|
||||
DevicePathLib
|
||||
DxeServicesTableLib
|
||||
UefiRuntimeServicesTableLib
|
||||
PrintLib
|
||||
|
||||
[Guids]
|
||||
## This GUID C Name is not required for build since it is from UefiLib and not directly used by this module source.
|
||||
## gEfiGlobalVariableGuid ## SOMETIMES_CONSUMED ## Variable:L"PlatformLang" this variable specifies the platform supported language string (RFC 4646 format)
|
||||
## gEfiGlobalVariableGuid ## SOMETIMES_CONSUMED ## Variable:L"Lang" this variable specifies the platform supported language string (ISO 639-2 format)
|
||||
##
|
||||
# There could be more than one variables, from PlatDriOver, PlatDriOver1, PlatDriOver2,...
|
||||
#
|
||||
# gEfiCallerIdGuid ## Private ## Variable:L"PlatDriOver"
|
||||
gEfiIfrTianoGuid ## CONSUMES ## Guid
|
||||
|
||||
[Protocols]
|
||||
gEfiPlatformDriverOverrideProtocolGuid ## PRODUCED
|
||||
|
||||
gEfiComponentName2ProtocolGuid ## SOMETIMES_CONSUMED (Get Driver Name if ComponentName2Protocol exists)
|
||||
gEfiComponentNameProtocolGuid ## SOMETIMES_CONSUMED (Get Driver Name if ComponentNameProtocol exists and ComponentName2Protocol doesn't exist)
|
||||
gEfiFirmwareVolume2ProtocolGuid ## SOMETIMES_CONSUMED (Get Driver Name from EFI UI section if ComponentName2Protocol and ComponentNameProtocol don't exist)
|
||||
gEfiPciIoProtocolGuid ## SOMETIMES_CONSUMED (Find the PCI device if PciIo protocol is installed)
|
||||
gEfiBusSpecificDriverOverrideProtocolGuid ## SOMETIMES_CONSUMED (Check whether the PCI device contains one or more efi drivers in its option rom by this protocol)
|
||||
|
||||
gEfiDriverBindingProtocolGuid ## SOMETIMES_CONSUMED
|
||||
gEfiLoadedImageProtocolGuid ## SOMETIMES_CONSUMED
|
||||
gEfiLoadedImageDevicePathProtocolGuid ## SOMETIMES_CONSUMED (Show the drivers in the second page that support DriverBindingProtocol, LoadedImageProtocol and LoadedImageDevicePathProtocol)
|
||||
gEfiDevicePathProtocolGuid ## SOMETIMES_CONSUMED (Show the controller device in the first page that support DevicePathProtocol)
|
||||
|
||||
gEfiHiiDatabaseProtocolGuid ## CONSUMED
|
||||
gEfiFormBrowser2ProtocolGuid ## CONSUMED
|
||||
gEfiHiiConfigRoutingProtocolGuid ## CONSUMED
|
||||
gEfiHiiConfigAccessProtocolGuid ## PRODUCED
|
||||
gEfiDevicePathToTextProtocolGuid ## CONSUMED
|
||||
gEfiPlatformDriverOverrideProtocolGuid ## PRODUCED
|
||||
|
109
MdeModulePkg/Universal/PlatformDriOverrideDxe/Vfr.vfr
Normal file
109
MdeModulePkg/Universal/PlatformDriOverrideDxe/Vfr.vfr
Normal file
@@ -0,0 +1,109 @@
|
||||
// *++
|
||||
//
|
||||
// Copyright (c) 2009, 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:
|
||||
//
|
||||
// Vfr.vfr
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Platform driver Override manager formset
|
||||
//
|
||||
//
|
||||
// --*/
|
||||
|
||||
#include "PlatOverMngr.h"
|
||||
|
||||
#define EFI_DISK_DEVICE_CLASS 0x01
|
||||
|
||||
formset
|
||||
guid = PLAT_OVER_MNGR_GUID,
|
||||
title = STRING_TOKEN(STR_ENTRY_TITLE),
|
||||
help = STRING_TOKEN(STR_TITLE_HELP),
|
||||
class = EFI_DISK_DEVICE_CLASS,
|
||||
subclass = 0xff,
|
||||
|
||||
varstore PLAT_OVER_MNGR_DATA,
|
||||
varid = VARSTORE_ID_PLAT_OVER_MNGR,
|
||||
name = Data,
|
||||
guid = PLAT_OVER_MNGR_GUID;
|
||||
|
||||
form formid = FORM_ID_DEVICE,
|
||||
title = STRING_TOKEN(STR_TITLE);
|
||||
|
||||
text
|
||||
help = STRING_TOKEN(STR_FIRST_REFRESH_HELP),
|
||||
text = STRING_TOKEN(STR_FIRST_REFRESH),
|
||||
text = STRING_TOKEN(STR_NULL_STRING),
|
||||
flags = INTERACTIVE,
|
||||
key = KEY_VALUE_DEVICE_REFRESH;
|
||||
|
||||
checkbox varid = Data.PciDeviceFilter,
|
||||
prompt = STRING_TOKEN(STR_PCI_DEVICE_FILTER_PROMPT),
|
||||
help = STRING_TOKEN(STR_PCI_DEVICE_FILTER_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = KEY_VALUE_DEVICE_FILTER,
|
||||
endcheckbox;
|
||||
|
||||
label FORM_ID_DEVICE;
|
||||
label LABEL_END;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_NULL_STRING);
|
||||
|
||||
goto FORM_ID_DEVICE,
|
||||
prompt = STRING_TOKEN(STR_CLEAR_ALL),
|
||||
help = STRING_TOKEN(STR_CLEAR_ALL_HELP),
|
||||
flags = INTERACTIVE | RESET_REQUIRED,
|
||||
key = KEY_VALUE_DEVICE_CLEAR;
|
||||
endform;
|
||||
|
||||
form formid = FORM_ID_DRIVER,
|
||||
title = STRING_TOKEN(STR_TITLE);
|
||||
|
||||
goto FORM_ID_DEVICE,
|
||||
prompt = STRING_TOKEN(STR_GOTO_PREVIOUS),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
flags = INTERACTIVE,
|
||||
key = KEY_VALUE_DRIVER_GOTO_PREVIOUS;
|
||||
|
||||
goto FORM_ID_ORDER,
|
||||
prompt = STRING_TOKEN(STR_TITLE_ORDER),
|
||||
help = STRING_TOKEN(STR_TITLE_ORDER_HELP),
|
||||
flags = INTERACTIVE,
|
||||
key = KEY_VALUE_DRIVER_GOTO_ORDER;
|
||||
|
||||
label FORM_ID_DRIVER;
|
||||
label LABEL_END;
|
||||
|
||||
endform;
|
||||
|
||||
form formid = FORM_ID_ORDER,
|
||||
title = STRING_TOKEN(STR_TITLE);
|
||||
|
||||
goto FORM_ID_DRIVER,
|
||||
prompt = STRING_TOKEN(STR_GOTO_PREVIOUS),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
flags = INTERACTIVE,
|
||||
key = KEY_VALUE_ORDER_GOTO_PREVIOUS;
|
||||
|
||||
label FORM_ID_ORDER;
|
||||
label LABEL_END;
|
||||
|
||||
subtitle text = STRING_TOKEN(STR_NULL_STRING);
|
||||
|
||||
goto FORM_ID_ORDER,
|
||||
prompt = STRING_TOKEN(STR_SAVE_AND_EXIT),
|
||||
help = STRING_TOKEN(STR_NULL_STRING),
|
||||
flags = INTERACTIVE | RESET_REQUIRED,
|
||||
key = KEY_VALUE_ORDER_SAVE_AND_EXIT;
|
||||
endform;
|
||||
|
||||
endformset;
|
BIN
MdeModulePkg/Universal/PlatformDriOverrideDxe/VfrStrings.uni
Normal file
BIN
MdeModulePkg/Universal/PlatformDriOverrideDxe/VfrStrings.uni
Normal file
Binary file not shown.
Reference in New Issue
Block a user