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 /Chipset/SB/PchWrap/PchSpiWrap | |
download | zprj-b7c51c9cf4864df6aabb99a1ae843becd577237c.tar.xz |
Diffstat (limited to 'Chipset/SB/PchWrap/PchSpiWrap')
-rw-r--r-- | Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.c | 174 | ||||
-rw-r--r-- | Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.cif | 11 | ||||
-rw-r--r-- | Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.dxs | 59 | ||||
-rw-r--r-- | Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.mak | 58 | ||||
-rw-r--r-- | Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.sdl | 75 |
5 files changed, 377 insertions, 0 deletions
diff --git a/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.c b/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.c new file mode 100644 index 0000000..237366a --- /dev/null +++ b/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.c @@ -0,0 +1,174 @@ +//************************************************************************* +//************************************************************************* +//** ** +//** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/PchWrap/PchSpiWrap/PchSpiWrap.c 2 11/17/14 7:31a Mirayang $ +// +// $Revision: 2 $ +// +// $Date: 11/17/14 7:31a $ +//************************************************************************* +// Revision History +// ---------------- +// $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/PchWrap/PchSpiWrap/PchSpiWrap.c $ +// +// 2 11/17/14 7:31a Mirayang +// [TAG] EIP191661 +// [Category] Improvement +// [Description] SUT can't generate UEFI SCT2.3.1 report completely. +// +// 1 2/08/12 8:33a Yurenlai +// Intel Lynx Point/SB eChipset initially releases. +// +//************************************************************************* +//---------------------------------------------------------------------- +// Includes +#include <AmiDxeLib.h> +#include <Protocol\LoadPe32Image.h> +#include "token.h" + + +static EFI_GUID gDxeSvcTblGuid = DXE_SERVICES_TABLE_GUID; +EFI_GUID gPchSpiRuntimeFFsGuid = \ + {0xC194C6EA,0xB68C,0x4981,0xB6,0x4B,0x9B,0xD2,0x71,0x47,0x4B,0x20}; + +EFI_STATUS +FFsLoaderToRuntime( + IN EFI_HANDLE ImageHandle +); + +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// +// Procedure: PchSpiWrapEntry +// +// Description: This function load PchSpi and execute it. +// +// Input: ImageHandle Image handle of this driver. +// SystemTable Global system service table. +// +// Output: EFI_SUCCESS Load and execute complete. +// EFI_UNSUPPORTED Image type is unsupported by this driver. +// EFI_OUT_OF_RESOURCES Do not have enough resources to initialize the driver. +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +EFI_STATUS +PchSpiWrapEntry( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + InitAmiLib(ImageHandle, SystemTable); + + Status = FFsLoaderToRuntime( ImageHandle); + ASSERT_EFI_ERROR (Status); + + return Status; +} + + +//<AMI_PHDR_START> +//---------------------------------------------------------------------------- +// +// Procedure: FFsLoaderToRuntime +// +// Description: Load FFs to Runtime. +// +// Input: ImageHandle Image handle of this driver. +// +// Output: EFI_SUCCESS FFs Load to Runtime complete. +// +//---------------------------------------------------------------------------- +//<AMI_PHDR_END> +EFI_STATUS +FFsLoaderToRuntime( + IN EFI_HANDLE ImageHandle +){ + EFI_STATUS Status; + EFI_PHYSICAL_ADDRESS Dst; + EFI_PHYSICAL_ADDRESS EntryPoint; + EFI_PE32_IMAGE_PROTOCOL *LoadPeImageEx; + VOID *Buffer; + UINTN BufferSize; + UINT32 AuthenticationStatus; + UINTN Pages; + EFI_HANDLE FFsImageHandle; + EFI_DEVICE_PATH_PROTOCOL EndOfDp = { 0x7F, 0xFF, 0x4 , 0x0 }; + + Buffer = 0; + + Status = FvReadPe32Image ( + &gPchSpiRuntimeFFsGuid, + &Buffer, + &BufferSize, + &AuthenticationStatus + ); + + if (EFI_ERROR (Status)) { + return Status; + } + + Pages = EFI_SIZE_TO_PAGES (BufferSize) + 2; + Status = pBS->AllocatePages ( + AllocateAnyPages, + EfiRuntimeServicesCode, + Pages, + &Dst + ); + + Status = pBS->LocateProtocol (&gEfiLoadPeImageGuid, NULL, &LoadPeImageEx); + if (EFI_ERROR (Status)) { + pBS->FreePool (&Dst); + return Status; + } + + Status = LoadPeImageEx->LoadPeImage( + LoadPeImageEx, + ImageHandle, +// NULL, + &EndOfDp, + Buffer, + BufferSize, + Dst, + &Pages, + &FFsImageHandle, + &EntryPoint, + EFI_LOAD_PE_IMAGE_ATTRIBUTE_NONE + ); + if (EFI_ERROR (Status)) { + pBS->FreePool (&Dst); + return Status; + } + + Status = pBS->StartImage(FFsImageHandle, NULL, NULL); + pBS->FreePool(Buffer); + + return Status; +} +//************************************************************************* +//************************************************************************* +//** ** +//** (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/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.cif b/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.cif new file mode 100644 index 0000000..7d6847b --- /dev/null +++ b/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.cif @@ -0,0 +1,11 @@ +<component> + name = "PchSpiWrap" + category = ModulePart + LocalRoot = "Chipset\SB\PchWrap\PchSpiWrap\" + RefName = "PchSpiWrap" +[files] +"PchSpiWrap.sdl" +"PchSpiWrap.mak" +"PchSpiWrap.c" +"PchSpiWrap.dxs" +<endComponent> diff --git a/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.dxs b/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.dxs new file mode 100644 index 0000000..432fc02 --- /dev/null +++ b/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.dxs @@ -0,0 +1,59 @@ +//************************************************************************* +//************************************************************************* +//** ** +//** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/PchWrap/PchSpiWrap/PchSpiWrap.dxs 1 2/08/12 8:33a Yurenlai $ +// +// $Revision: 1 $ +// +// $Date: 2/08/12 8:33a $ +//************************************************************************* +// Revision History +// ---------------- +// $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/PchWrap/PchSpiWrap/PchSpiWrap.dxs $ +// +// 1 2/08/12 8:33a Yurenlai +// Intel Lynx Point/SB eChipset initially releases. +// +//************************************************************************* +//<AMI_FHDR_START> +// +// Name: PchSpiWrap.dxs +// +// Description: This file is the dependency file for the Pch Spi Wrap driver. +// +//<AMI_FHDR_END> +//************************************************************************* + +#include <Protocol\Runtime.h> +#include <Protocol\PchPlatformPolicy\PchPlatformPolicy.h> + +DEPENDENCY_START + EFI_RUNTIME_ARCH_PROTOCOL_GUID AND + DXE_PCH_PLATFORM_POLICY_PROTOCOL_GUID +DEPENDENCY_END + +//************************************************************************* +//************************************************************************* +//** ** +//** (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/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.mak b/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.mak new file mode 100644 index 0000000..c22d22d --- /dev/null +++ b/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/PchWrap/PchSpiWrap/PchSpiWrap.mak 1 2/08/12 8:33a Yurenlai $ +# +# $Revision: 1 $ +# +# $Date: 2/08/12 8:33a $ +#************************************************************************* +# Revision History +# ---------------- +# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/PchWrap/PchSpiWrap/PchSpiWrap.mak $ +# +# 1 2/08/12 8:33a Yurenlai +# Intel Lynx Point/SB eChipset initially releases. +# +#************************************************************************* +all : PchSpiWrap + +PchSpiWrap : $(BUILD_DIR)\PchSpiWrap.mak PchSpiWrapBin + +$(BUILD_DIR)\PchSpiWrap.mak : $(PchSpiWrap_DIR)\$(@B).cif $(PchSpiWrap_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(PchSpiWrap_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + +PchSpiWrapBin : $(AMICSPLib) $(AMIDXELIB) + $(MAKE) /$(MAKEFLAGS) $(BUILD_DEFAULTS)\ + /f $(BUILD_DIR)\PchSpiWrap.mak all\ + GUID=B716A6F8-F3A1-4b8e-8582-5A303F1CDD64\ + "MY_INCLUDES=$(INTEL_PCH_INCLUDES)"\ + ENTRY_POINT=PchSpiWrapEntry\ + TYPE=RT_DRIVER \ + DEPEX1=$(PchSpiWrap_DIR)\PchSpiWrap.DXS DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \ + COMPRESS=1 +#************************************************************************* +#************************************************************************* +#** ** +#** (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/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.sdl b/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.sdl new file mode 100644 index 0000000..950af3e --- /dev/null +++ b/Chipset/SB/PchWrap/PchSpiWrap/PchSpiWrap.sdl @@ -0,0 +1,75 @@ +#************************************************************************* +#************************************************************************* +#** ** +#** (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/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/PchWrap/PchSpiWrap/PchSpiWrap.sdl 1 2/08/12 8:32a Yurenlai $ +# +# $Revision: 1 $ +# +# $Date: 2/08/12 8:32a $ +#************************************************************************* +# Revision History +# ---------------- +# $Log: /Alaska/BIN/Chipset/Intel/SouthBridge/LynxPoint/Intel Pch SB Chipset/PchWrap/PchSpiWrap/PchSpiWrap.sdl $ +# +# 1 2/08/12 8:32a Yurenlai +# Intel Lynx Point/SB eChipset initially releases. +# +#************************************************************************* +TOKEN + Name = PchSpiWrap_SUPPORT + Value = "1" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + Master = Yes + Help = "Main switch to enable PchSpiWrap support in Project" +End + +MODULE + Help = "Includes PchSpiWrap.mak to Project" + File = "PchSpiWrap.mak" +End + +PATH + Name = "PchSpiWrap_DIR" +End + +TOKEN + Name = "PchSpiRuntime_GUID" + Value = "C194C6EA-B68C-4981-B64B-9BD271474B20" + Help = "GUID of AP initialization file." + TokenType = Expression + TargetMAK = Yes + TargetH = Yes +End + +ELINK + Name = "$(BUILD_DIR)\PchSpiWrap.ffs" + Parent = "FV_MAIN" + InvokeOrder = AfterParent +End +#************************************************************************* +#************************************************************************* +#** ** +#** (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 |