diff options
author | raywu <raywu0301@gmail.com> | 2018-06-15 00:00:50 +0800 |
---|---|---|
committer | raywu <raywu0301@gmail.com> | 2018-06-15 00:00:50 +0800 |
commit | b7c51c9cf4864df6aabb99a1ae843becd577237c (patch) | |
tree | eebe9b0d0ca03062955223097e57da84dd618b9a /Core/EM/PlatformToDriver | |
download | zprj-master.tar.xz |
Diffstat (limited to 'Core/EM/PlatformToDriver')
-rw-r--r-- | Core/EM/PlatformToDriver/PlatformToDriver.c | 199 | ||||
-rw-r--r-- | Core/EM/PlatformToDriver/PlatformToDriver.cif | 10 | ||||
-rw-r--r-- | Core/EM/PlatformToDriver/PlatformToDriver.mak | 58 | ||||
-rw-r--r-- | Core/EM/PlatformToDriver/PlatformToDriver.sdl | 31 |
4 files changed, 298 insertions, 0 deletions
diff --git a/Core/EM/PlatformToDriver/PlatformToDriver.c b/Core/EM/PlatformToDriver/PlatformToDriver.c new file mode 100644 index 0000000..4077656 --- /dev/null +++ b/Core/EM/PlatformToDriver/PlatformToDriver.c @@ -0,0 +1,199 @@ +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2011, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//********************************************************************** + +//********************************************************************** +// $Header: /Alaska/BIN/Core/Modules/PlatformToDriverConfiguration/PlatformToDriver.c 1 5/02/11 5:30p Artems $ +// +// $Revision: 1 $ +// +// $Date: 5/02/11 5:30p $ +//********************************************************************** +// Revision History +// ---------------- +// $Log: /Alaska/BIN/Core/Modules/PlatformToDriverConfiguration/PlatformToDriver.c $ +// +// 1 5/02/11 5:30p Artems +// Platform-to-Driver confuguration protocol supporting infrastructure +// +//********************************************************************** +//<AMI_FHDR_START> +// +// Name: PlatformToDriver.c +// +// Description: +// +//<AMI_FHDR_END> +//********************************************************************** +#include <Token.h> +#include <AmiDxeLib.h> +#include <Protocol\PlatformToDriverConfiguration.h> + +typedef EFI_STATUS (PLATFORM_TO_DRIVER_AGENT_SUPPORTED) ( + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL +); + +typedef EFI_STATUS (PLATFORM_TO_DRIVER_AGENT_QUERY) ( + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN UINTN *Instance, + OUT EFI_GUID **ParameterTypeGuid, + OUT VOID **ParameterBlock, + OUT UINTN *ParameterBlockSize +); + +typedef EFI_STATUS (PLATFORM_TO_DRIVER_AGENT_RESPONSE) ( + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN UINTN *Instance, + IN EFI_GUID *ParameterTypeGuid, + IN VOID *ParameterBlock, + IN UINTN ParameterBlockSize, + IN EFI_PLATFORM_CONFIGURATION_ACTION ConfigurationAction +); + +typedef struct{ + PLATFORM_TO_DRIVER_AGENT_SUPPORTED *Supported; + PLATFORM_TO_DRIVER_AGENT_QUERY *Query; + PLATFORM_TO_DRIVER_AGENT_RESPONSE *Response; +} PLATFORM_TO_DRIVER_AGENT; + + +#define OEM_PLATFORM_TO_DRIVER_AGENT(Supported, Query, Response) Supported +extern PLATFORM_TO_DRIVER_AGENT_SUPPORTED PlatformToDriverAgentList EndOfList1; +#undef OEM_PLATFORM_TO_DRIVER_AGENT + +#define OEM_PLATFORM_TO_DRIVER_AGENT(Supported, Query, Response) Query +extern PLATFORM_TO_DRIVER_AGENT_QUERY PlatformToDriverAgentList EndOfList2; +#undef OEM_PLATFORM_TO_DRIVER_AGENT + +#define OEM_PLATFORM_TO_DRIVER_AGENT(Supported, Query, Response) Response +extern PLATFORM_TO_DRIVER_AGENT_RESPONSE PlatformToDriverAgentList EndOfList3; +#undef OEM_PLATFORM_TO_DRIVER_AGENT + +#define OEM_PLATFORM_TO_DRIVER_AGENT(Supported, Query, Response) { Supported, Query, Response } +PLATFORM_TO_DRIVER_AGENT AgentList[] = { + PlatformToDriverAgentList + { NULL, NULL, NULL } +}; + +EFI_HANDLE CurrentControllerHandle = NULL; +UINT32 CurrentAgentIndex; + +EFI_STATUS PlatformToDriverConfigurationQuery ( + IN EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN UINTN *Instance, + OUT EFI_GUID **ParameterTypeGuid, + OUT VOID **ParameterBlock, + OUT UINTN *ParameterBlockSize +) +{ + EFI_STATUS Status; + + if(ControllerHandle == NULL || Instance == NULL) + return EFI_INVALID_PARAMETER; + + if(ControllerHandle != CurrentControllerHandle) { + CurrentAgentIndex = 0; + Status = EFI_UNSUPPORTED; + while(AgentList[CurrentAgentIndex].Supported != NULL) { + Status = AgentList[CurrentAgentIndex].Supported(ControllerHandle, ChildHandle); + if(!EFI_ERROR(Status)) + break; + CurrentAgentIndex++; + } + if(EFI_ERROR(Status)) { + CurrentControllerHandle = NULL; + return EFI_NOT_FOUND; + } + + CurrentControllerHandle = ControllerHandle; + } + + return AgentList[CurrentAgentIndex].Query(ControllerHandle, + ChildHandle, + Instance, + ParameterTypeGuid, + ParameterBlock, + ParameterBlockSize); +} + +EFI_STATUS PlatformToDriverConfigurationResponse ( + IN EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL *This, + IN EFI_HANDLE ControllerHandle, + IN EFI_HANDLE ChildHandle OPTIONAL, + IN UINTN *Instance, + IN EFI_GUID *ParameterTypeGuid, + IN VOID *ParameterBlock, + IN UINTN ParameterBlockSize, + IN EFI_PLATFORM_CONFIGURATION_ACTION ConfigurationAction +) +{ + if(ControllerHandle == NULL || Instance == NULL) + return EFI_INVALID_PARAMETER; + + if(ControllerHandle != CurrentControllerHandle) + return EFI_NOT_FOUND; + + return AgentList[CurrentAgentIndex].Response(ControllerHandle, + ChildHandle, + Instance, + ParameterTypeGuid, + ParameterBlock, + ParameterBlockSize, + ConfigurationAction); +} + +EFI_PLATFORM_TO_DRIVER_CONFIGURATION_PROTOCOL EfiPlatformToDriverConfigurationProtocol = { + PlatformToDriverConfigurationQuery, + PlatformToDriverConfigurationResponse +}; + +EFI_STATUS PlatformToDriverEntryPoint( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable +) +{ + EFI_STATUS Status; + EFI_HANDLE Handle = NULL; + + InitAmiLib(ImageHandle,SystemTable); + + Status = pBS->InstallMultipleProtocolInterfaces( + &Handle, + &gEfiPlatformToDriverConfigurationProtocolGuid, + &EfiPlatformToDriverConfigurationProtocol, + NULL); + + + return Status; +} + + + +//********************************************************************** +//********************************************************************** +//** ** +//** (C)Copyright 1985-2011, American Megatrends, Inc. ** +//** ** +//** All Rights Reserved. ** +//** ** +//** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +//** ** +//** Phone: (770)-246-8600 ** +//** ** +//********************************************************************** +//**********************************************************************
\ No newline at end of file diff --git a/Core/EM/PlatformToDriver/PlatformToDriver.cif b/Core/EM/PlatformToDriver/PlatformToDriver.cif new file mode 100644 index 0000000..a3d95de --- /dev/null +++ b/Core/EM/PlatformToDriver/PlatformToDriver.cif @@ -0,0 +1,10 @@ +<component> + name = "PlatformToDriver" + category = ModulePart + LocalRoot = "Core\EM\PlatformToDriver" + RefName = "PlatformToDriver" +[files] +"PlatformToDriver.sdl" +"PlatformToDriver.mak" +"PlatformToDriver.c" +<endComponent> diff --git a/Core/EM/PlatformToDriver/PlatformToDriver.mak b/Core/EM/PlatformToDriver/PlatformToDriver.mak new file mode 100644 index 0000000..36f1142 --- /dev/null +++ b/Core/EM/PlatformToDriver/PlatformToDriver.mak @@ -0,0 +1,58 @@ +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2011, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** + +#********************************************************************** +# $Header: /Alaska/BIN/Core/Modules/PlatformToDriverConfiguration/PlatformToDriver.mak 1 5/02/11 5:30p Artems $ +# +# $Revision: 1 $ +# +# $Date: 5/02/11 5:30p $ +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/BIN/Core/Modules/PlatformToDriverConfiguration/PlatformToDriver.mak $ +# +# 1 5/02/11 5:30p Artems +# Platform-to-Driver confuguration protocol supporting infrastructure +# +#********************************************************************** +#<AMI_FHDR_START> +# +# Name: PlatformToDriver.mak +# +# Description: Make file to create PlatformToDriver configuration Driver +# +#<AMI_FHDR_END> +#********************************************************************** + +CORE_DXEBin : $(BUILD_DIR)\PlatformToDriver.obj + +$(BUILD_DIR)\PlatformToDriver.obj : $(PlatformToDriver_DIR)\PlatformToDriver.c + +{$(PlatformToDriver_DIR)}.c{$(BUILD_DIR)}.obj:: + $(CC) $(CFLAGS) /D \"PlatformToDriverAgentList=$(PlatformToDriverAgents)\" /Fo$(BUILD_DIR)\ $< + +#********************************************************************** +#********************************************************************** +#** ** +#** (C)Copyright 1985-2011, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#********************************************************************** +#********************************************************************** diff --git a/Core/EM/PlatformToDriver/PlatformToDriver.sdl b/Core/EM/PlatformToDriver/PlatformToDriver.sdl new file mode 100644 index 0000000..71ae95f --- /dev/null +++ b/Core/EM/PlatformToDriver/PlatformToDriver.sdl @@ -0,0 +1,31 @@ +TOKEN + Name = "PlatformToDriver_SUPPORT" + Value = "1" + Help = "Main switch to enable Platform-to-driver configuration support in Project" + TokenType = Boolean + TargetMAK = Yes + TargetH = Yes + Master = Yes +End + +PATH + Name = "PlatformToDriver_DIR" + Help = "Path to PlatformToDriver Module in Project" +End + +MODULE + Help = "Includes PlatformToDriver.mak to Project" + File = "PlatformToDriver.mak" +End + +ELINK + Name = "PlatformToDriverEntryPoint," + Parent = "BdsEntryInitialize" + InvokeOrder = AfterParent +End + +ELINK + Name = "PlatformToDriverAgents" + InvokeOrder = ReplaceParent +End + |