mirror of https://github.com/acidanthera/audk.git
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:
parent
59f1d89250
commit
6d8ced29b1
|
@ -1,86 +0,0 @@
|
|||
#/** @file
|
||||
#
|
||||
# A UI application to offer 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. 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 - 2009, Intel Corporation. All rights reserved.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = PlatOverMngr
|
||||
FILE_GUID = 56D95BFE-F991-4898-B3BE-B8F37C927F48
|
||||
MODULE_TYPE = UEFI_APPLICATION
|
||||
VERSION_STRING = 1.0
|
||||
ENTRY_POINT = PlatOverMngrInit
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources.common]
|
||||
VfrStrings.uni
|
||||
Vfr.vfr
|
||||
PlatOverMngr.c
|
||||
PlatOverMngr.h
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
BaseLib
|
||||
DebugLib
|
||||
UefiLib
|
||||
UefiApplicationEntryPoint
|
||||
UefiBootServicesTableLib
|
||||
PlatformDriverOverrideLib
|
||||
HiiLib
|
||||
BaseMemoryLib
|
||||
MemoryAllocationLib
|
||||
DevicePathLib
|
||||
|
||||
[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)
|
||||
gEfiIfrTianoGuid ## CONSUMES ## Guid
|
||||
|
||||
[Protocols]
|
||||
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
|
|
@ -1,58 +0,0 @@
|
|||
/** @file
|
||||
This file defines the platform driver override variable name and variable guid.
|
||||
The variable(s) contain the override mappings from Controller Device Path to a set of Driver Device Paths.
|
||||
|
||||
VariableLayout {
|
||||
//
|
||||
// NotEnd indicate whether the variable is the last one, and has no subsequent variable need to load.
|
||||
// Each variable has MaximumVariableSize limitation, so multiple variables are required to store
|
||||
// large mapping infos.
|
||||
// The variable(s) name rule is PlatDriOver, PlatDriOver1, PlatDriOver2, ....
|
||||
//
|
||||
UINT32 NotEnd; //Zero is the last one.
|
||||
//
|
||||
// The entry which contains the mapping that Controller Device Path to a set of Driver Device Paths
|
||||
// There are often multi mapping entries in a variable.
|
||||
//
|
||||
UINT32 SIGNATURE; //SIGNATURE_32('p','d','o','i')
|
||||
UINT32 DriverNum;
|
||||
EFI_DEVICE_PATH_PROTOCOL ControllerDevicePath[];
|
||||
EFI_DEVICE_PATH_PROTOCOL DriverDevicePath[];
|
||||
EFI_DEVICE_PATH_PROTOCOL DriverDevicePath[];
|
||||
EFI_DEVICE_PATH_PROTOCOL DriverDevicePath[];
|
||||
......
|
||||
UINT32 NotEnd; //Zero is the last one.
|
||||
UINT32 SIGNATURE;
|
||||
UINT32 DriverNum;
|
||||
EFI_DEVICE_PATH_PROTOCOL ControllerDevicePath[];
|
||||
EFI_DEVICE_PATH_PROTOCOL DriverDevicePath[];
|
||||
EFI_DEVICE_PATH_PROTOCOL DriverDevicePath[];
|
||||
EFI_DEVICE_PATH_PROTOCOL DriverDevicePath[];
|
||||
......
|
||||
}
|
||||
|
||||
Copyright (c) 2008 - 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 __EFI_OVERRIDE_VARIABLE_GUID_H__
|
||||
#define __EFI_OVERRIDE_VARIABLE_GUID_H__
|
||||
|
||||
///
|
||||
/// This guid is used for a platform driver override variable
|
||||
///
|
||||
#define EFI_OVERRIDE_VARIABLE_GUID \
|
||||
{ 0x8e3d4ad5, 0xf762, 0x438a, { 0xa1, 0xc1, 0x5b, 0x9f, 0xe6, 0x8c, 0x6b, 0x15 }}
|
||||
|
||||
#define EFI_PLATFORM_OVERRIDE_VARIABLE_NAME L"PlatDriOver"
|
||||
|
||||
extern EFI_GUID gEfiOverrideVariableGuid;
|
||||
|
||||
#endif // #ifndef __EFI_OVERRIDE_VARIABLE_GUID_H__
|
|
@ -1,67 +0,0 @@
|
|||
#/** @file
|
||||
# Instance of Platform Driver Override Library to manage driver overriding relationship.
|
||||
#
|
||||
# This library instance provides functions to manage the database of overriding relationship
|
||||
# between controllers and drivers. Each entry of the database contains the mapping that Controller
|
||||
# Device Path to a set of Driver Device Paths. The database is stored in non-volatile variables.
|
||||
#
|
||||
# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
#**/
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = PlatDriOverLib
|
||||
FILE_GUID = 8bd8d711-2736-46d7-8c81-5de68e0a9e88
|
||||
MODULE_TYPE = DXE_DRIVER
|
||||
VERSION_STRING = 1.0
|
||||
LIBRARY_CLASS = PlatformDriverOverrideLib|DXE_DRIVER UEFI_DRIVER UEFI_APPLICATION
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources.common]
|
||||
PlatDriOver.h
|
||||
PlatDriOverLib.c
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DxeServicesTableLib
|
||||
MemoryAllocationLib
|
||||
DevicePathLib
|
||||
BaseLib
|
||||
UefiLib
|
||||
UefiBootServicesTableLib
|
||||
UefiRuntimeServicesTableLib
|
||||
BaseMemoryLib
|
||||
DebugLib
|
||||
PrintLib
|
||||
|
||||
[Guids]
|
||||
##
|
||||
# There could be more than one variables, from PlatDriOver, PlatDriOver1, PlatDriOver2,...
|
||||
#
|
||||
gEfiOverrideVariableGuid ## CONSUMES ## Variable:L"PlatDriOver"
|
||||
|
||||
[Protocols]
|
||||
gEfiFirmwareVolume2ProtocolGuid ## CONSUMES
|
||||
gEfiLoadedImageProtocolGuid ## CONSUMES
|
||||
gEfiBusSpecificDriverOverrideProtocolGuid ## CONSUMES
|
||||
gEfiDriverBindingProtocolGuid ## CONSUMES
|
||||
gEfiDevicePathProtocolGuid ## CONSUMES
|
||||
gEfiLoadedImageDevicePathProtocolGuid ## CONSUMES
|
|
@ -1,195 +0,0 @@
|
|||
/** @file
|
||||
Internal include file for Platform Driver Override Library implementation.
|
||||
|
||||
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_DRI_OVER_H_
|
||||
#define _PLAT_DRI_OVER_H_
|
||||
|
||||
#include <PiDxe.h>
|
||||
|
||||
#include <Protocol/FirmwareVolume2.h>
|
||||
#include <Protocol/LoadedImage.h>
|
||||
#include <Protocol/DevicePath.h>
|
||||
#include <Protocol/BusSpecificDriverOverride.h>
|
||||
#include <Protocol/DriverBinding.h>
|
||||
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/UefiRuntimeServicesTableLib.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/DxeServicesTableLib.h>
|
||||
#include <Library/PlatformDriverOverrideLib.h>
|
||||
|
||||
#include <Guid/OverrideVariable.h>
|
||||
#include <Guid/VariableFormat.h>
|
||||
|
||||
|
||||
#define PLATFORM_OVERRIDE_ITEM_SIGNATURE SIGNATURE_32('p','d','o','i')
|
||||
typedef struct _PLATFORM_OVERRIDE_ITEM {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
UINT32 DriverInfoNum;
|
||||
EFI_DEVICE_PATH_PROTOCOL *ControllerDevicePath;
|
||||
///
|
||||
/// List of DRIVER_IMAGE_INFO
|
||||
///
|
||||
LIST_ENTRY DriverInfoList;
|
||||
EFI_HANDLE LastReturnedImageHandle;
|
||||
} PLATFORM_OVERRIDE_ITEM;
|
||||
|
||||
#define DRIVER_IMAGE_INFO_SIGNATURE SIGNATURE_32('p','d','i','i')
|
||||
typedef struct _DRIVER_IMAGE_INFO {
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
EFI_HANDLE ImageHandle;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DriverImagePath;
|
||||
BOOLEAN UnLoadable;
|
||||
BOOLEAN UnStartable;
|
||||
} DRIVER_IMAGE_INFO;
|
||||
|
||||
#define DEVICE_PATH_STACK_ITEM_SIGNATURE SIGNATURE_32('d','p','s','i')
|
||||
typedef struct _DEVICE_PATH_STACK_ITEM{
|
||||
UINTN Signature;
|
||||
LIST_ENTRY Link;
|
||||
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
|
||||
} DEVICE_PATH_STACK_ITEM;
|
||||
|
||||
/**
|
||||
Push a controller device path into a globle device path list.
|
||||
|
||||
@param DevicePath The controller device path to push into stack
|
||||
|
||||
@retval EFI_SUCCESS Device path successfully pushed into the stack.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PushDevPathStack (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
Pop a controller device path from a globle device path list
|
||||
|
||||
@param DevicePath The controller device path popped from stack
|
||||
|
||||
@retval EFI_SUCCESS Controller device path successfully popped.
|
||||
@retval EFI_NOT_FOUND Stack is empty.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PopDevPathStack (
|
||||
OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
Check whether a controller device path is in a globle device path list
|
||||
|
||||
@param DevicePath The controller device path to check
|
||||
|
||||
@retval TRUE DevicePath exists in the stack.
|
||||
@retval FALSE DevicePath does not exist in the stack.
|
||||
|
||||
**/
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
CheckExistInStack (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePath
|
||||
);
|
||||
|
||||
/**
|
||||
Update the FV file device path if it is not valid.
|
||||
|
||||
According to a file GUID, check a Fv file device path is valid. If it is invalid,
|
||||
try to return the valid device path.
|
||||
FV address maybe changes for memory layout adjust from time to time, use this funciton
|
||||
could promise the Fv file device path is right.
|
||||
|
||||
@param DevicePath On input, the FV file device path to check
|
||||
On output, the updated valid FV file device path
|
||||
@param FileGuid The FV file GUID
|
||||
@param CallerImageHandle Image handle of the caller
|
||||
|
||||
@retval EFI_INVALID_PARAMETER the input DevicePath or FileGuid is invalid
|
||||
parameter
|
||||
@retval EFI_UNSUPPORTED the input DevicePath does not contain FV file
|
||||
GUID at all
|
||||
@retval EFI_ALREADY_STARTED the input DevicePath has pointed to FV file, it
|
||||
is valid
|
||||
@retval EFI_SUCCESS Successfully updated the invalid DevicePath,
|
||||
and return the updated device path in DevicePath
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
UpdateFvFileDevicePath (
|
||||
IN OUT EFI_DEVICE_PATH_PROTOCOL **DevicePath,
|
||||
IN EFI_GUID *FileGuid,
|
||||
IN EFI_HANDLE CallerImageHandle
|
||||
);
|
||||
|
||||
/**
|
||||
Gets the data and size of a variable.
|
||||
|
||||
Read the EFI variable (VendorGuid/Name) and return a dynamically allocated
|
||||
buffer, and the size of the buffer. If failure return NULL.
|
||||
|
||||
@param Name String part of EFI variable name
|
||||
@param VendorGuid GUID part of EFI variable name
|
||||
@param VariableSize Returns the size of the EFI variable that was
|
||||
read
|
||||
|
||||
@return Dynamically allocated memory that contains a copy of the EFI variable.
|
||||
Caller is responsible freeing the buffer.
|
||||
@retval NULL Variable was not read
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
GetVariableAndSize (
|
||||
IN CHAR16 *Name,
|
||||
IN EFI_GUID *VendorGuid,
|
||||
OUT UINTN *VariableSize
|
||||
);
|
||||
|
||||
/**
|
||||
Connect to the handle to a device on the device path.
|
||||
|
||||
This function will create all handles associate with every device
|
||||
path node. If the handle associate with one device path node can not
|
||||
be created success, then still give one chance to do the dispatch,
|
||||
which load the missing drivers if possible.
|
||||
|
||||
@param DevicePathToConnect The device path which will be connected, it can
|
||||
be a multi-instance device path
|
||||
|
||||
@retval EFI_SUCCESS All handles associate with every device path
|
||||
node have been created
|
||||
@retval EFI_OUT_OF_RESOURCES There is no resource to create new handles
|
||||
@retval EFI_NOT_FOUND Create the handle associate with one device
|
||||
path node failed
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
ConnectDevicePath (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevicePathToConnect
|
||||
);
|
||||
|
||||
#endif
|
|
@ -50,10 +50,6 @@
|
|||
## @libraryclass Defines a set of methods related recovery mode.
|
||||
RecoveryLib|Include/Library/RecoveryLib.h
|
||||
|
||||
## @libraryclass Basic platform driver override functions.
|
||||
# This library is only intended to be used by Platform Driver Override Dxe Driver and Application.
|
||||
PlatformDriverOverrideLib|Include/Library/PlatformDriverOverrideLib.h
|
||||
|
||||
## @libraryclass Provides HII related functions.
|
||||
HiiLib|Include/Library/HiiLib.h
|
||||
|
||||
|
@ -121,10 +117,6 @@
|
|||
## Include/Guid/VariableFormat.h
|
||||
gEfiVariableGuid = { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d }}
|
||||
|
||||
## Platform Override Variable guid
|
||||
## Include/Guid/OverrideVariable.h
|
||||
gEfiOverrideVariableGuid = { 0x8e3d4ad5, 0xf762, 0x438a, { 0xa1, 0xc1, 0x5b, 0x9f, 0xe6, 0x8c, 0x6b, 0x15 }}
|
||||
|
||||
## Performance protocol guid that also acts as the performance HOB guid and performance variable GUID
|
||||
## Include/Guid/Performance.h
|
||||
gPerformanceProtocolGuid = { 0x76B6BDFA, 0x2ACD, 0x4462, { 0x9E, 0x3F, 0xCB, 0x58, 0xC9, 0x69, 0xD9, 0x37 }}
|
||||
|
|
|
@ -71,7 +71,6 @@
|
|||
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
|
||||
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
|
||||
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
|
||||
PlatformDriverOverrideLib|MdeModulePkg/Library/DxePlatDriOverLib/DxePlatDriOverLib.inf
|
||||
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
|
||||
ReportStatusCodeLib|MdePkg/Library/BaseReportStatusCodeLibNull/BaseReportStatusCodeLibNull.inf
|
||||
MemoryTestLib|MdeModulePkg/Library/BaseMemoryTestLibNull/BaseMemoryTestLibNull.inf
|
||||
|
@ -271,7 +270,6 @@
|
|||
MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
|
||||
MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
|
||||
MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.inf
|
||||
MdeModulePkg/Library/DxePlatDriOverLib/DxePlatDriOverLib.inf
|
||||
MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
|
||||
MdeModulePkg/Library/DxePrintLibPrint2Protocol/DxePrintLibPrint2Protocol.inf
|
||||
MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.inf
|
||||
|
@ -315,7 +313,6 @@
|
|||
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
||||
MdeModulePkg/Universal/PCD/Pei/Pcd.inf
|
||||
MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf
|
||||
MdeModulePkg/Application/PlatOverMngr/PlatOverMngr.inf
|
||||
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
||||
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
|
||||
MdeModulePkg/Application/VariableInfo/VariableInfo.inf
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/** @file
|
||||
Ihis library is only intended to be used by Platform Driver Override Dxe Driver and Application.
|
||||
It provides basic platform driver override functions.
|
||||
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
|
||||
|
@ -13,10 +13,40 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
**/
|
||||
|
||||
#ifndef _PLATFORM_DRIVER_OVERRIDE_LIB_H_
|
||||
#define _PLATFORM_DRIVER_OVERRIDE_LIB_H_
|
||||
#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.
|
|
@ -1,18 +1,19 @@
|
|||
/** @file
|
||||
|
||||
A UI application to offer a UI interface in device manager to let user configure
|
||||
This file also installs UEFI PLATFORM_DRIVER_OVERRIDE_PROTOCOL.
|
||||
|
||||
The main code offers a 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. 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
|
||||
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. The UI application save all the mapping info in NV variables which will be consumed
|
||||
4. It save all the mapping info in NV variables which will be consumed
|
||||
by platform override protocol driver to publish the platform override protocol.
|
||||
|
||||
Copyright (c) 2007 - 2008, Intel Corporation
|
||||
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
|
||||
|
@ -23,35 +24,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||
|
||||
**/
|
||||
|
||||
#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 <Guid/MdeModuleHii.h>
|
||||
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/UefiLib.h>
|
||||
#include <Library/UefiApplicationEntryPoint.h>
|
||||
#include <Library/UefiBootServicesTableLib.h>
|
||||
#include <Library/PlatformDriverOverrideLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/DevicePathLib.h>
|
||||
#include <Library/HiiLib.h>
|
||||
|
||||
#include "InternalPlatDriOverrideDxe.h"
|
||||
#include "PlatOverMngr.h"
|
||||
|
||||
#define EFI_CALLBACK_INFO_SIGNATURE SIGNATURE_32 ('C', 'l', 'b', 'k')
|
||||
|
@ -64,6 +37,7 @@ typedef struct {
|
|||
PLAT_OVER_MNGR_DATA FakeNvData;
|
||||
EFI_HII_CONFIG_ROUTING_PROTOCOL *HiiConfigRouting;
|
||||
EFI_HII_CONFIG_ACCESS_PROTOCOL ConfigAccess;
|
||||
EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL PlatformDriverOverride;
|
||||
} EFI_CALLBACK_INFO;
|
||||
|
||||
#pragma pack(1)
|
||||
|
@ -82,7 +56,7 @@ typedef struct {
|
|||
// uni string and Vfr Binary data.
|
||||
//
|
||||
extern UINT8 VfrBin[];
|
||||
extern UINT8 PlatOverMngrStrings[];
|
||||
extern UINT8 PlatDriOverrideDxeStrings[];
|
||||
|
||||
//
|
||||
// module global data
|
||||
|
@ -90,6 +64,8 @@ extern UINT8 PlatOverMngrStrings[];
|
|||
EFI_GUID mPlatformOverridesManagerGuid = PLAT_OVER_MNGR_GUID;
|
||||
CHAR16 mVariableName[] = L"Data";
|
||||
LIST_ENTRY mMappingDataBase = INITIALIZE_LIST_HEAD_VARIABLE (mMappingDataBase);
|
||||
BOOLEAN mEnvironmentVariableRead = FALSE;
|
||||
EFI_HANDLE mCallerImageHandle = NULL;
|
||||
|
||||
EFI_HANDLE *mDevicePathHandleBuffer;
|
||||
EFI_HANDLE *mDriverImageHandleBuffer;
|
||||
|
@ -142,7 +118,33 @@ HII_VENDOR_DEVICE_PATH mHiiVendorDevicePath = {
|
|||
CHAR16 *
|
||||
DevicePathToStr (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
||||
);
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText;
|
||||
CHAR16 *ToText;
|
||||
|
||||
if (DevPath == NULL) {
|
||||
return L"";
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiDevicePathToTextProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &DevPathToText
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ToText = DevPathToText->ConvertDevicePathToText (
|
||||
DevPath,
|
||||
FALSE,
|
||||
TRUE
|
||||
);
|
||||
ASSERT (ToText != NULL);
|
||||
return ToText;
|
||||
}
|
||||
|
||||
return L"?";
|
||||
}
|
||||
|
||||
/**
|
||||
Worker function to get the driver name by ComponentName or ComponentName2 protocol
|
||||
|
@ -1354,6 +1356,133 @@ PlatOverMngrCallback (
|
|||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
The driver Entry Point. The funciton will export a disk device class formset and
|
||||
its callback function to hii database.
|
||||
|
@ -1367,13 +1496,14 @@ PlatOverMngrCallback (
|
|||
**/
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PlatOverMngrInit (
|
||||
PlatDriOverrideDxeInit (
|
||||
IN EFI_HANDLE ImageHandle,
|
||||
IN EFI_SYSTEM_TABLE *SystemTable
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_FORM_BROWSER2_PROTOCOL *FormBrowser2;
|
||||
VOID *Instance;
|
||||
|
||||
//
|
||||
// There should only be one Form Configuration protocol
|
||||
|
@ -1387,6 +1517,24 @@ PlatOverMngrInit (
|
|||
return Status;
|
||||
}
|
||||
|
||||
//
|
||||
// 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;
|
||||
}
|
||||
|
||||
mCallerImageHandle = ImageHandle;
|
||||
mCallbackInfo = AllocateZeroPool (sizeof (EFI_CALLBACK_INFO));
|
||||
if (mCallbackInfo == NULL) {
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
|
@ -1396,9 +1544,12 @@ PlatOverMngrInit (
|
|||
mCallbackInfo->ConfigAccess.ExtractConfig = PlatOverMngrExtractConfig;
|
||||
mCallbackInfo->ConfigAccess.RouteConfig = PlatOverMngrRouteConfig;
|
||||
mCallbackInfo->ConfigAccess.Callback = PlatOverMngrCallback;
|
||||
|
||||
mCallbackInfo->PlatformDriverOverride.GetDriver = GetDriver;
|
||||
mCallbackInfo->PlatformDriverOverride.GetDriverPath = GetDriverPath;
|
||||
mCallbackInfo->PlatformDriverOverride.DriverLoaded = DriverLoaded;
|
||||
//
|
||||
// Install Device Path Protocol and Config Access protocol to driver handle
|
||||
// Install Platform Driver Override Protocol to driver handle
|
||||
//
|
||||
Status = gBS->InstallMultipleProtocolInterfaces (
|
||||
&mCallbackInfo->DriverHandle,
|
||||
|
@ -1406,6 +1557,8 @@ PlatOverMngrInit (
|
|||
&mHiiVendorDevicePath,
|
||||
&gEfiHiiConfigAccessProtocolGuid,
|
||||
&mCallbackInfo->ConfigAccess,
|
||||
&gEfiPlatformDriverOverrideProtocolGuid,
|
||||
&mCallbackInfo->PlatformDriverOverride,
|
||||
NULL
|
||||
);
|
||||
if (EFI_ERROR (Status)) {
|
||||
|
@ -1419,7 +1572,7 @@ PlatOverMngrInit (
|
|||
&mPlatformOverridesManagerGuid,
|
||||
mCallbackInfo->DriverHandle,
|
||||
VfrBin,
|
||||
PlatOverMngrStrings,
|
||||
PlatDriOverrideDxeStrings,
|
||||
NULL
|
||||
);
|
||||
if (mCallbackInfo->RegisteredHandle == NULL) {
|
||||
|
@ -1448,22 +1601,8 @@ PlatOverMngrInit (
|
|||
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,
|
||||
&mCallbackInfo->RegisteredHandle,
|
||||
1,
|
||||
NULL,
|
||||
0,
|
||||
NULL,
|
||||
NULL
|
||||
);
|
||||
|
||||
HiiRemovePackages (mCallbackInfo->RegisteredHandle);
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
|
||||
Finish:
|
||||
if (mCallbackInfo->DriverHandle != NULL) {
|
||||
|
@ -1473,9 +1612,15 @@ Finish:
|
|||
&mHiiVendorDevicePath,
|
||||
&gEfiHiiConfigAccessProtocolGuid,
|
||||
&mCallbackInfo->ConfigAccess,
|
||||
&gEfiPlatformDriverOverrideProtocolGuid,
|
||||
&mCallbackInfo->PlatformDriverOverride,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
if (mCallbackInfo->RegisteredHandle != NULL) {
|
||||
HiiRemovePackages (mCallbackInfo->RegisteredHandle);
|
||||
}
|
||||
|
||||
if (mCallbackInfo != NULL) {
|
||||
FreePool (mCallbackInfo);
|
||||
|
@ -1485,43 +1630,38 @@ Finish:
|
|||
}
|
||||
|
||||
/**
|
||||
Converting a given device to an unicode string.
|
||||
|
||||
This function will dependent on gEfiDevicePathToTextProtocolGuid, if protocol
|
||||
does not installed, then return unknown device path L"?" directly.
|
||||
|
||||
@param DevPath Given device path instance
|
||||
|
||||
@return Converted string from given device path.
|
||||
@retval L"?" Can not locate gEfiDevicePathToTextProtocolGuid protocol for converting.
|
||||
Unload its installed protocol.
|
||||
|
||||
@param[in] ImageHandle Handle that identifies the image to be unloaded.
|
||||
|
||||
@retval EFI_SUCCESS The image has been unloaded.
|
||||
**/
|
||||
CHAR16 *
|
||||
DevicePathToStr (
|
||||
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
PlatDriOverrideDxeUnload (
|
||||
IN EFI_HANDLE ImageHandle
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevPathToText;
|
||||
CHAR16 *ToText;
|
||||
|
||||
if (DevPath == NULL) {
|
||||
return L"";
|
||||
}
|
||||
|
||||
Status = gBS->LocateProtocol (
|
||||
&gEfiDevicePathToTextProtocolGuid,
|
||||
NULL,
|
||||
(VOID **) &DevPathToText
|
||||
);
|
||||
if (!EFI_ERROR (Status)) {
|
||||
ToText = DevPathToText->ConvertDevicePathToText (
|
||||
DevPath,
|
||||
FALSE,
|
||||
TRUE
|
||||
);
|
||||
ASSERT (ToText != NULL);
|
||||
return ToText;
|
||||
if (mCallbackInfo->DriverHandle != NULL) {
|
||||
gBS->UninstallMultipleProtocolInterfaces (
|
||||
mCallbackInfo->DriverHandle,
|
||||
&gEfiDevicePathProtocolGuid,
|
||||
&mHiiVendorDevicePath,
|
||||
&gEfiHiiConfigAccessProtocolGuid,
|
||||
&mCallbackInfo->ConfigAccess,
|
||||
&gEfiPlatformDriverOverrideProtocolGuid,
|
||||
&mCallbackInfo->PlatformDriverOverride,
|
||||
NULL
|
||||
);
|
||||
}
|
||||
|
||||
return L"?";
|
||||
if (mCallbackInfo->RegisteredHandle != NULL) {
|
||||
HiiRemovePackages (mCallbackInfo->RegisteredHandle);
|
||||
}
|
||||
|
||||
if (mCallbackInfo != NULL) {
|
||||
FreePool (mCallbackInfo);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
// *++
|
||||
//
|
||||
// Copyright (c) 2007 - 2008, Intel Corporation
|
||||
// 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
|
Binary file not shown.
|
@ -74,7 +74,6 @@
|
|||
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
|
||||
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
|
||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||
PlatformDriverOverrideLib|MdeModulePkg/Library/DxePlatDriOverLib/DxePlatDriOverLib.inf
|
||||
|
||||
[LibraryClasses.common.USER_DEFINED]
|
||||
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
|
||||
|
@ -483,7 +482,6 @@
|
|||
MdeModulePkg/Application/VariableInfo/VariableInfo.inf
|
||||
|
||||
MdeModulePkg/Universal/PlatformDriOverrideDxe/PlatformDriOverrideDxe.inf
|
||||
MdeModulePkg/Application/PlatOverMngr/PlatOverMngr.inf
|
||||
|
||||
[BuildOptions]
|
||||
DEBUG_*_IA32_DLINK_FLAGS = /EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /ALIGN:4096 /SUBSYSTEM:CONSOLE
|
||||
|
|
Loading…
Reference in New Issue