mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 07:34:06 +02:00
1. Create PlatformDriverOverride in Universal directory.
2. Move PlatformDriOverrideDxe and PlatOverMngr to this directory. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5011 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
f1df9cf4fa
commit
a6f164a7e6
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,184 @@
|
|||||||
|
/** @file
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
PlatOverMngr.h
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Function prototype for platform driver override manager driver
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
#ifndef _PLAT_OVER_MNGR_H_
|
||||||
|
#define _PLAT_OVER_MNGR_H_
|
||||||
|
|
||||||
|
#include <Uefi.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 EFI_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 \
|
||||||
|
{ \
|
||||||
|
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
|
||||||
|
|
||||||
|
//
|
||||||
|
// Question Id start from 1, so define an offset for it
|
||||||
|
//
|
||||||
|
#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))
|
||||||
|
|
||||||
|
#define DRIVER_SELECTION_QUESTION_ID (VAR_OFFSET (DriSelection) + 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;
|
||||||
|
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
PlatOverMngrRouteConfig (
|
||||||
|
IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This,
|
||||||
|
IN CONST EFI_STRING Configuration,
|
||||||
|
OUT EFI_STRING *Progress
|
||||||
|
);
|
||||||
|
|
||||||
|
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
|
||||||
|
);
|
||||||
|
|
||||||
|
CHAR16 *
|
||||||
|
GetImageName (
|
||||||
|
IN EFI_LOADED_IMAGE_PROTOCOL *Image
|
||||||
|
);
|
||||||
|
|
||||||
|
CHAR16 *
|
||||||
|
DevicePathToStr (
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *DevPath
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
EFI_DEVICE_PATH_PROTOCOL *
|
||||||
|
UnpackDevicePath (
|
||||||
|
IN EFI_DEVICE_PATH_PROTOCOL *DevPath
|
||||||
|
);
|
||||||
|
|
||||||
|
#endif
|
@ -0,0 +1,73 @@
|
|||||||
|
#/** @file
|
||||||
|
# Component description file for PlatOverMngr driver
|
||||||
|
#
|
||||||
|
# FIX ME!
|
||||||
|
# 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 = PlatOverMngr
|
||||||
|
FILE_GUID = 56D95BFE-F991-4898-B3BE-B8F37C927F48
|
||||||
|
MODULE_TYPE = UEFI_APPLICATION
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
EDK_RELEASE_VERSION = 0x00020000
|
||||||
|
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||||
|
|
||||||
|
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
|
||||||
|
UefiBootServicesTableLib
|
||||||
|
UefiApplicationEntryPoint
|
||||||
|
UefiLib
|
||||||
|
DebugLib
|
||||||
|
PlatDriOverLib
|
||||||
|
IfrSupportLib
|
||||||
|
ExtendedIfrSupportLib
|
||||||
|
BaseMemoryLib
|
||||||
|
MemoryAllocationLib
|
||||||
|
HiiLib
|
||||||
|
ExtendedHiiLib
|
||||||
|
UefiRuntimeServicesTableLib
|
||||||
|
DevicePathLib
|
||||||
|
|
||||||
|
[Protocols]
|
||||||
|
gEfiLoadedImageProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiPciIoProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiBusSpecificDriverOverrideProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiComponentName2ProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiComponentNameProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiHiiConfigAccessProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
gEfiDevicePathToTextProtocolGuid # PROTOCOL ALWAYS_CONSUMED
|
||||||
|
|
||||||
|
[Depex]
|
||||||
|
gEfiHiiDatabaseProtocolGuid
|
@ -0,0 +1,141 @@
|
|||||||
|
// *++
|
||||||
|
//
|
||||||
|
// 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:
|
||||||
|
//
|
||||||
|
// Vfr.vfr
|
||||||
|
//
|
||||||
|
// Abstract:
|
||||||
|
//
|
||||||
|
// Platform driver Override manager formset
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// --*/
|
||||||
|
|
||||||
|
#define PLAT_OVER_MNGR_GUID \
|
||||||
|
{ \
|
||||||
|
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 LABEL_END 0xffff
|
||||||
|
|
||||||
|
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;
|
Binary file not shown.
@ -0,0 +1,186 @@
|
|||||||
|
/** @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.c
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
|
||||||
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
#include "PlatformDriOverride.h"
|
||||||
|
|
||||||
|
EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL gPlatformDriverOverride = {
|
||||||
|
GetDriver,
|
||||||
|
GetDriverPath,
|
||||||
|
DriverLoaded
|
||||||
|
};
|
||||||
|
|
||||||
|
STATIC LIST_ENTRY mMappingDataBase = INITIALIZE_LIST_HEAD_VARIABLE (mMappingDataBase);
|
||||||
|
STATIC BOOLEAN mEnvironmentVariableRead = FALSE;
|
||||||
|
STATIC EFI_HANDLE mCallerImageHandle;
|
||||||
|
|
||||||
|
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
PlatformDriverOverrideEntry (
|
||||||
|
IN EFI_HANDLE ImageHandle,
|
||||||
|
IN EFI_SYSTEM_TABLE *SystemTable
|
||||||
|
)
|
||||||
|
/*++
|
||||||
|
|
||||||
|
Routine Description:
|
||||||
|
Platform Driver Override driver entry point, install the Platform Driver Override Protocol
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
(Standard EFI Image entry - EFI_IMAGE_ENTRY_POINT)
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
EFI_STATUS
|
||||||
|
|
||||||
|
--*/
|
||||||
|
{
|
||||||
|
mEnvironmentVariableRead = FALSE;
|
||||||
|
mCallerImageHandle = ImageHandle;
|
||||||
|
InitializeListHead (&mMappingDataBase);
|
||||||
|
return InstallPlatformDriverOverrideProtocol (&gPlatformDriverOverride);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
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().
|
||||||
|
|
||||||
|
**/
|
||||||
|
STATIC
|
||||||
|
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 (Status == EFI_NOT_FOUND) {
|
||||||
|
InitializeListHead (&mMappingDataBase);
|
||||||
|
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 (IsListEmpty (&mMappingDataBase)) {
|
||||||
|
return EFI_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetDriverFromMapping (
|
||||||
|
This,
|
||||||
|
ControllerHandle,
|
||||||
|
DriverImageHandle,
|
||||||
|
&mMappingDataBase,
|
||||||
|
mCallerImageHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
For the use of the ControllerHandle parameter in the GetDriverPath() and DriverLoaded() APIs
|
||||||
|
makes those APIs very difficult to use, so not support.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**/
|
||||||
|
STATIC
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
For the use of the ControllerHandle parameter in the GetDriverPath() and DriverLoaded() APIs
|
||||||
|
makes those APIs very difficult to use, so not support.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
**/
|
||||||
|
STATIC
|
||||||
|
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;
|
||||||
|
}
|
@ -0,0 +1,58 @@
|
|||||||
|
/** @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 <PiDxe.h>
|
||||||
|
|
||||||
|
#include <Library/DebugLib.h>
|
||||||
|
#include <Library/UefiDriverEntryPoint.h>
|
||||||
|
#include <Library/BaseLib.h>
|
||||||
|
#include <Library/PlatDriOverLib.h>
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
GetDriver (
|
||||||
|
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL * This,
|
||||||
|
IN EFI_HANDLE ControllerHandle,
|
||||||
|
IN OUT EFI_HANDLE * DriverImageHandle
|
||||||
|
);
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
EFI_STATUS
|
||||||
|
EFIAPI
|
||||||
|
GetDriverPath (
|
||||||
|
IN EFI_PLATFORM_DRIVER_OVERRIDE_PROTOCOL * This,
|
||||||
|
IN EFI_HANDLE ControllerHandle,
|
||||||
|
IN OUT EFI_DEVICE_PATH_PROTOCOL **DriverImagePath
|
||||||
|
);
|
||||||
|
|
||||||
|
STATIC
|
||||||
|
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
|
@ -0,0 +1,48 @@
|
|||||||
|
#/** @file
|
||||||
|
# Component name for module PlatformDriOverride
|
||||||
|
#
|
||||||
|
# FIX ME!
|
||||||
|
# Copyright (c) 2007, 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 = PlatformDriOverrideDxe
|
||||||
|
FILE_GUID = 35034CE2-A6E5-4fb4-BABE-A0156E9B2549
|
||||||
|
MODULE_TYPE = DXE_DRIVER
|
||||||
|
VERSION_STRING = 1.0
|
||||||
|
EDK_RELEASE_VERSION = 0x00020000
|
||||||
|
EFI_SPECIFICATION_VERSION = 0x00020000
|
||||||
|
|
||||||
|
ENTRY_POINT = PlatformDriverOverrideEntry
|
||||||
|
|
||||||
|
#
|
||||||
|
# The following information is for reference only and not required by the build tools.
|
||||||
|
#
|
||||||
|
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||||
|
#
|
||||||
|
|
||||||
|
[Sources.common]
|
||||||
|
PlatformDriOverride.c
|
||||||
|
PlatformDriOverride.h
|
||||||
|
|
||||||
|
[Packages]
|
||||||
|
MdePkg/MdePkg.dec
|
||||||
|
MdeModulePkg/MdeModulePkg.dec
|
||||||
|
|
||||||
|
[LibraryClasses]
|
||||||
|
BaseLib
|
||||||
|
UefiDriverEntryPoint
|
||||||
|
DebugLib
|
||||||
|
PlatDriOverLib
|
||||||
|
|
@ -0,0 +1,50 @@
|
|||||||
|
<ModuleSurfaceArea xmlns="http://www.TianoCore.org/2006/Edk2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||||
|
<MsaHeader>
|
||||||
|
<ModuleName>PlatformDriOverrideDxe</ModuleName>
|
||||||
|
<ModuleType>DXE_DRIVER</ModuleType>
|
||||||
|
<GuidValue>35034CE2-A6E5-4fb4-BABE-A0156E9B2549</GuidValue>
|
||||||
|
<Version>1.0</Version>
|
||||||
|
<Abstract>Component name for module PlatformDriOverride</Abstract>
|
||||||
|
<Description>FIX ME!</Description>
|
||||||
|
<Copyright>Copyright (c) 2007, Intel Corporation. All rights reserved.</Copyright>
|
||||||
|
<License>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.</License>
|
||||||
|
<Specification>FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052</Specification>
|
||||||
|
</MsaHeader>
|
||||||
|
<ModuleDefinitions>
|
||||||
|
<SupportedArchitectures>IA32 X64 IPF EBC</SupportedArchitectures>
|
||||||
|
<BinaryModule>false</BinaryModule>
|
||||||
|
<OutputFileBasename>PlatformDriOverrideDxe</OutputFileBasename>
|
||||||
|
</ModuleDefinitions>
|
||||||
|
<LibraryClassDefinitions>
|
||||||
|
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||||
|
<Keyword>DebugLib</Keyword>
|
||||||
|
</LibraryClass>
|
||||||
|
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||||
|
<Keyword>UefiDriverEntryPoint</Keyword>
|
||||||
|
</LibraryClass>
|
||||||
|
<LibraryClass Usage="ALWAYS_CONSUMED">
|
||||||
|
<Keyword>BaseLib</Keyword>
|
||||||
|
</LibraryClass>
|
||||||
|
</LibraryClassDefinitions>
|
||||||
|
<SourceFiles>
|
||||||
|
<Filename>PlatformDriOverride.h</Filename>
|
||||||
|
<Filename>PlatformDriOverride.c</Filename>
|
||||||
|
</SourceFiles>
|
||||||
|
<PackageDependencies>
|
||||||
|
<Package PackageGuid="5e0e9358-46b6-4ae2-8218-4ab8b9bbdcec"/>
|
||||||
|
<Package PackageGuid="68169ab0-d41b-4009-9060-292c253ac43d"/>
|
||||||
|
</PackageDependencies>
|
||||||
|
<Externs>
|
||||||
|
<Specification>EFI_SPECIFICATION_VERSION 0x00020000</Specification>
|
||||||
|
<Specification>EDK_RELEASE_VERSION 0x00020000</Specification>
|
||||||
|
<Extern>
|
||||||
|
<ModuleEntryPoint>PlatformDriverOverrideEntry</ModuleEntryPoint>
|
||||||
|
</Extern>
|
||||||
|
</Externs>
|
||||||
|
</ModuleSurfaceArea>
|
Loading…
x
Reference in New Issue
Block a user