diff options
Diffstat (limited to 'ReferenceCode/RapidStart/Ppi')
-rw-r--r-- | ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.c | 33 | ||||
-rw-r--r-- | ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.h | 89 | ||||
-rw-r--r-- | ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.c | 35 | ||||
-rw-r--r-- | ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.h | 190 | ||||
-rw-r--r-- | ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.cif | 14 | ||||
-rw-r--r-- | ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.inf | 51 | ||||
-rw-r--r-- | ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.mak | 60 | ||||
-rw-r--r-- | ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.sdl | 72 |
8 files changed, 544 insertions, 0 deletions
diff --git a/ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.c b/ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.c new file mode 100644 index 0000000..185f36c --- /dev/null +++ b/ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.c @@ -0,0 +1,33 @@ +/** @file + This file defines iFFS Gfx PPI + +@copyright + Copyright (c) 2012 Intel Corporation. All rights reserved + This software and associated documentation (if any) is furnished + under a license and may only be used or copied in accordance + with the terms of the license. Except as permitted by such + license, no part of this software or documentation may be + reproduced, stored in a retrieval system, or transmitted in any + form or by any means without the express written consent of + Intel Corporation. + + This file contains an 'Intel Peripheral Driver' and uniquely + identified as "Intel Mobile Silicon Support Module" and is + licensed for Intel Mobile CPUs and chipsets under the terms of your + license agreement with Intel or your vendor. This file may + be modified by the user, subject to additional terms of the + license agreement +**/ +#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000) +#include "EdkIIGluePeim.h" +#include "PeiGfxPpi.h" +#endif +// +// Protocol GUID definition +// +EFI_GUID gPeiGfxPpiGuid = PEI_GFX_PPI_GUID; + +// +// Protocol description +// +EFI_GUID_STRING(&gPeiGfxPpiGuid, "PeiGfxPpi", "RST Gfx PPI"); diff --git a/ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.h b/ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.h new file mode 100644 index 0000000..6636e8e --- /dev/null +++ b/ReferenceCode/RapidStart/Ppi/PeiGfxPpi/PeiGfxPpi.h @@ -0,0 +1,89 @@ +/** @file + Header file for RapidStart Gfx PPI + +@copyright + Copyright (c) 2012 Intel Corporation. All rights reserved + This software and associated documentation (if any) is furnished + under a license and may only be used or copied in accordance + with the terms of the license. Except as permitted by such + license, no part of this software or documentation may be + reproduced, stored in a retrieval system, or transmitted in any + form or by any means without the express written consent of + Intel Corporation. + + This file contains an 'Intel Peripheral Driver' and uniquely + identified as "Intel Mobile Silicon Support Module" and is + licensed for Intel Mobile CPUs and chipsets under the terms of your + license agreement with Intel or your vendor. This file may + be modified by the user, subject to additional terms of the + license agreement +**/ +#ifndef _PEI_GFX_PPI_H_ +#define _PEI_GFX_PPI_H_ + +#define PEI_GFX_PPI_GUID \ + { \ + 0xc4d6994a, 0xaa3d, 0x47c0, 0xae, 0xa, 0xb0, 0xbf, 0xad, 0xba, 0xa6, 0x13 \ + } + +extern EFI_GUID gPeiGfxPpiGuid; + +#define DSS_RANGE 0x01 //< Dss Range is 1 +#define GFX_RESTORE_RANGE 0x02 ///< Gfx Memory restore Range is 2 +#define FB_RESTORE_RANGE 250 ///< The Max FB Range is 16 +#define MAX_GFX_MEMORY_RANGES (DSS_RANGE + GFX_RESTORE_RANGE + FB_RESTORE_RANGE) + +#pragma pack(1) + +typedef struct { + UINT64 BaseAddress; + UINT64 Size; +} GFX_MEM_RANGE_ENTRY; + +typedef struct { + UINT16 NumOfEntry; + UINT8 Reserved[2]; + GFX_MEM_RANGE_ENTRY MemRangeEntry[MAX_GFX_MEMORY_RANGES]; +} GFX_RESTORE_MEM_TABLE; + +#pragma pack() + +typedef +EFI_STATUS +(EFIAPI * PEI_GFX_PPI_GET_DSS_ADDRESS_RANGE) ( + IN CONST EFI_PEI_SERVICES **PeiServices, + OUT GFX_RESTORE_MEM_TABLE **DssAddressRange +); + +typedef +EFI_STATUS +(EFIAPI * PEI_GFX_PPI_GET_RESTORE_MEM_TABLE) ( + IN CONST EFI_PEI_SERVICES **PeiServices, + OUT GFX_RESTORE_MEM_TABLE **GfxRestoreMemTable +); + +typedef +EFI_STATUS +(EFIAPI * PEI_GFX_PPI_GET_RESTORE_FB_RANGE) ( + IN CONST EFI_PEI_SERVICES **PeiServices, + OUT GFX_RESTORE_MEM_TABLE **FbRestoreMemTable +); + +typedef +EFI_STATUS +(EFIAPI * PEI_GFX_PPI_RESTORE_DISPLAY) ( + IN CONST EFI_PEI_SERVICES **PeiServices +); + +#pragma pack(1) + +typedef struct _PEI_GFX_PPI { + PEI_GFX_PPI_RESTORE_DISPLAY RestoreDisplay; + PEI_GFX_PPI_GET_DSS_ADDRESS_RANGE GetDssAddressRange; + PEI_GFX_PPI_GET_RESTORE_MEM_TABLE GetRestoreMemTable; + PEI_GFX_PPI_GET_RESTORE_FB_RANGE GetRestoreFbRange; +} PEI_GFX_PPI; + +#pragma pack() + +#endif diff --git a/ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.c b/ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.c new file mode 100644 index 0000000..d27cbf3 --- /dev/null +++ b/ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.c @@ -0,0 +1,35 @@ +/** @file + This file defines RapidStart PPI + +@copyright + Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved + This software and associated documentation (if any) is furnished + under a license and may only be used or copied in accordance + with the terms of the license. Except as permitted by such + license, no part of this software or documentation may be + reproduced, stored in a retrieval system, or transmitted in any + form or by any means without the express written consent of + Intel Corporation. + + This file contains an 'Intel Peripheral Driver' and uniquely + identified as "Intel Mobile Silicon Support Module" and is + licensed for Intel Mobile CPUs and chipsets under the terms of your + license agreement with Intel or your vendor. This file may + be modified by the user, subject to additional terms of the + license agreement +**/ + +#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000) +#include "EdkIIGluePeim.h" +#include "RapidStart.h" +#endif + +/// +/// Protocol GUID definition +/// +EFI_GUID gRapidStartPpiGuid = RAPID_START_PPI_GUID; + +/// +/// Protocol description +/// +EFI_GUID_STRING(&gRapidStartPpiGuid, "RapidStartPpi", "Rapid Start PPI"); diff --git a/ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.h b/ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.h new file mode 100644 index 0000000..48d4bfc --- /dev/null +++ b/ReferenceCode/RapidStart/Ppi/RapidStart/RapidStart.h @@ -0,0 +1,190 @@ +/** @file + Header file for RapidStart PPI + +@copyright + Copyright (c) 2011 - 2012 Intel Corporation. All rights reserved + This software and associated documentation (if any) is furnished + under a license and may only be used or copied in accordance + with the terms of the license. Except as permitted by such + license, no part of this software or documentation may be + reproduced, stored in a retrieval system, or transmitted in any + form or by any means without the express written consent of + Intel Corporation. + + This file contains an 'Intel Peripheral Driver' and uniquely + identified as "Intel Mobile Silicon Support Module" and is + licensed for Intel Mobile CPUs and chipsets under the terms of your + license agreement with Intel or your vendor. This file may + be modified by the user, subject to additional terms of the + license agreement + +**/ +#ifndef PPI_RAPID_START_H_ +#define PPI_RAPID_START_H_ + +#define RAPID_START_PPI_GUID \ + { \ + 0x3d0e663a, 0xdc72, 0x4489, 0x87, 0xc5, 0xe4, 0x9e, 0xe7, 0x73, 0xa4, 0x52 \ + } + +#define ATA_PASSWORD_LEN 32 + +extern EFI_GUID gRapidStartPpiGuid; + +typedef struct _RAPID_START_PPI RAPID_START_PPI; + +/// +/// PPI revision number +/// Any backwards compatible changes to this PPI will result in an update in the revision number +/// Major changes will require publication of a new PPI +/// +/// Revision 1: Original version +/// +#define RAPID_START_PPI_REVISION_1 1 + +typedef enum { + RapidStartNone, + RapidStartEntry, + RapidStartExit, + RapidStartTransitionMax +} RAPID_START_TRANSITION; + +/** + Detremines RapidStart transition. + + This PPI function will determine which Rapid Start transition state should be + performed. It will check current Rapid Start enable/disable by calling + RapidStartIsEnabled(), current boot mode, wakeup source and Rapid Start Entry + Flag. If Rapid Start enabled, current boot mode is S3 Resume and wakeup source + is one of the supported sources, the Rapid Start Entry will be performed. Once + Rapid Start Entry completed successfully the Rapid Start Entry Flag will be set + and next boot GetMode() will check this flag and perform Rapid Start Resume as + requested. + + GetMode () function will do the following check: + - Rapid Start function is enabled or not + - Current boot mode is S3 resume or not + - If it is S3 resume, check wakeup source is one of enabled Rapid Start Entry + conditions to perform Rapid Start Entry. + - If it is not S3 resume, the Rapid Start transition mode should already be + determined in the RapidStartPeiEntryPoint (). + + After Rapid Start Transition state determined TransitionEntryPoint () PPI + function will do the necessary Rapid Start transition. + + @param[in] This - A pointer to RAPID_START_PPI itself. + + @retval RAPID_START_TRANSITION - The RapidStart transition being performed +**/ +typedef +RAPID_START_TRANSITION +(EFIAPI *RAPID_START_GET_MODE) ( + IN RAPID_START_PPI *This + ); + +/** + Executes or schedules RapidStart transition if appropriate. + + This PPI function will perform or schedule an Rapid Start transition (by + registering either EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID or + PEI_RAPID_START_TRANSITION_START_PPI_GUID callback function). It includes Rapid + Start Entry or Rapid Start Exit transition basing on Transition mode. If + Transition mode is RapidStartTransitionMax which means unknown transition mode, + GetMode() will be called again to determine current Rapid Start transition mode. + In Rapid Start Entry transition, the memory content will be saved in "Rapid + Start Store" and Rapid Start Entry Flag will be set then system will be + switched to Rapid Start state. If error occurred during Rapid Start Entry + transition, it will switch system back to S3 state. In Rapid Start Exit + transition, Rapid Start Entry Flag will be cleared and the memory content will + be restored from "Rapid Start Store". If no error occurred, it will boot + from S3 resume path back to OS, otherwise it will reset system. + + TransitionEntryPoint () function will do the following check: + - Rapid Start function is enabled or not + - If current Rapid Start transition mode is not determined yet, call + GetMode () PPI function. + - If current Transition state is "RapidStartNone", do nothing and + return to caller. + - If transition state is "Rapid Start Entry", save memory content to + Rapid Start Store. If no error occurring, set Rapid Start Entry Flag and + put system to Rapid Start state, otherwise it will re-enter S3 state as + Rapid Start Entry failed. + - If transition state is "RapidStartExit", restore memory content from + Rapid Start Store and override boot mode to "S3 Resume" so that + system will perform S3 resume back to OS. If error occurred during Rapid + Start Exit transition it will reset system. + - When "RapidStartDoTransition ()" is executed in + EFI_PEI_PERMANENT_MEMORY_INSTALLED_PPI_GUID or + PEI_RAPID_START_TRANSITION_START_PPI_GUID callback function, platform + code should ensure the NEM mode has been disabled and cache + configuration basing on memory map has been completed prior to execute + RapidStartDoTransition (). + - SMRAM hashing algorithm in reference code uses SHA256 algorithm in + "Crypto library" from UDK2010 source code. Those SMRAM hashing + relevant functions are not included in this document since they are no + porting required. Refer to Crypto library and BaseCryptLib.h for detail + information regarding those functions. See section Porting + Recommendation" for more information. + + @param[in] This - Pointer to RapidStart PPI + @param[out] BootMode - Boot mode that may be overridden + + @retval EFI_SUCCESS - RapidStart transition performed/scheduled successfully + @retval EFI_ABORTED - RapidStart transition aborted +**/ +typedef +EFI_STATUS +(EFIAPI *RAPID_START_TRANSITION_ENTRY_POINT) ( + IN RAPID_START_PPI * This, + OUT EFI_BOOT_MODE * BootMode + ); + +/** + Check if RapidStart support is enabled. + + This PPI function will return current Rapid Start enable/disable state. + + IsEnabled () function will return current Rapid Start enable/disable state. + + @param[in] This - Pointer to RapidStart PPI + + @retval TRUE if RapidStart support is enabled FALSE otherwise +**/ +typedef +BOOLEAN +(EFIAPI *RAPID_START_IS_ENABLED) ( + IN RAPID_START_PPI * This + ); + +/** + This PPI provides main functions required for Rapid Start Entry and Exit flow. + + This PPI provides major functions required for Rapid Start transition. Both + GetMode() and TransitionEntryPoint() should be executed after memory is ready + for accessing since they will save, restore or check memory content. Besides, + SATA controller must be initialized to AHCI mode before executing + TransitionEntryPoint() PPI so Rapid Start Store can be accessed. +**/ +struct _RAPID_START_PPI { + /// + /// Indicate PPI structure revision. + /// + UINT8 Revision; + /// + /// GetMode function will base on current Rapid Start configurations and boot mode + /// to determine which Rapid Start transition flow should be performed. + /// + RAPID_START_GET_MODE GetMode; + /// + /// This function will perform or schedule Rapid Start transition if appropriate. + /// This includes Rapid Start Entry, Rapid Start Exit or does nothing basing on the + /// Rapid Start transition mode. + /// + RAPID_START_TRANSITION_ENTRY_POINT TransitionEntryPoint; + /// + /// This function returns Rapid Start feature current enable/disable state. + /// + RAPID_START_IS_ENABLED IsEnabled; +}; + +#endif diff --git a/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.cif b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.cif new file mode 100644 index 0000000..e5f533c --- /dev/null +++ b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.cif @@ -0,0 +1,14 @@ +<component> + name = "RapidStartPpiLib" + category = ModulePart + LocalRoot = "ReferenceCode\RapidStart\Ppi\" + RefName = "RapidStartPpiLib" +[files] +"RapidStartPpiLib.inf" +"RapidStartPpiLib.sdl" +"RapidStartPpiLib.mak" +"PeiGfxPpi\PeiGfxPpi.c" +"PeiGfxPpi\PeiGfxPpi.h" +"RapidStart\RapidStart.h" +"RapidStart\RapidStart.c" +<endComponent> diff --git a/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.inf b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.inf new file mode 100644 index 0000000..51111e8 --- /dev/null +++ b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.inf @@ -0,0 +1,51 @@ +## @file +# Component description file for the RapidStart Ppi library +# +#@copyright +# Copyright (c) 2004 - 2012 Intel Corporation. All rights reserved +# This software and associated documentation (if any) is furnished +# under a license and may only be used or copied in accordance +# with the terms of the license. Except as permitted by such +# license, no part of this software or documentation may be +# reproduced, stored in a retrieval system, or transmitted in any +# form or by any means without the express written consent of +# Intel Corporation. +# +# This file contains a 'Sample Driver' and is licensed as such +# under the terms of your license agreement with Intel or your +# vendor. This file may be modified by the user, subject to +# the additional terms of the license agreement +# + +[defines] +BASE_NAME = RapidStartPpiLib +COMPONENT_TYPE = LIBRARY + +[sources.common] + RapidStart/RapidStart.h + RapidStart/RapidStart.c + PeiGfxPpi/PeiGfxPpi.h + PeiGfxPpi/PeiGfxPpi.c + +[includes.common] + . + $(EDK_SOURCE)/Foundation/Library/Pei/Include + $(EDK_SOURCE)/Foundation/Efi + $(EDK_SOURCE)/Foundation/Include + $(EDK_SOURCE)/Foundation/Efi/Include + $(EDK_SOURCE)/Foundation/Framework/Include +# +# EDK II Glue Library utilizes some standard headers from EDK +# + $(EFI_SOURCE) + $(EDK_SOURCE)/Foundation + $(EDK_SOURCE)/Foundation/Framework + $(EDK_SOURCE)/Foundation/Include/IndustryStandard + $(EDK_SOURCE)/Foundation/Core/Dxe + $(EDK_SOURCE)/Foundation/Include/Pei + $(EDK_SOURCE)/Foundation/Library/Dxe/Include + $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include + +[nmake.common] +C_STD_INCLUDE= + diff --git a/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.mak b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.mak new file mode 100644 index 0000000..24cf02d --- /dev/null +++ b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.mak @@ -0,0 +1,60 @@ +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2011, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* + +#************************************************************************* +# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartPpiLib/RapidStartPpiLib.mak 1 4/19/12 8:10a Yurenlai $ +# +# $Revision: 1 $ +# +# $Date: 4/19/12 8:10a $ +#************************************************************************* +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartPpiLib/RapidStartPpiLib.mak $ +# +# 1 4/19/12 8:10a Yurenlai +# Initial check in. +# +#************************************************************************* + +all : RapidStartPpiLib + +$(RapidStartPpiLib_LIB) : RapidStartPpiLib + +RapidStartPpiLib : $(BUILD_DIR)\RapidStartPpiLib.mak RapidStartPpiLibBin + +$(BUILD_DIR)\RapidStartPpiLib.mak : $(RapidStartPpiLib_DIR)\$(@B).cif $(RapidStartPpiLib_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(RapidStartPpiLib_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + +RapidStartPpiLib_INCLUDES =\ + $(EDK_INCLUDES)\ + +RapidStartPpiLibBin : + $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\ + /f $(BUILD_DIR)\RapidStartPpiLib.mak all\ + "MY_INCLUDES=$(RapidStartPpiLib_INCLUDES)" \ + TYPE=PEI_LIBRARY +#************************************************************************* +#************************************************************************* +#** ** +#** (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/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.sdl b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.sdl new file mode 100644 index 0000000..f39c912 --- /dev/null +++ b/ReferenceCode/RapidStart/Ppi/RapidStartPpiLib.sdl @@ -0,0 +1,72 @@ +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2011, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* + +#************************************************************************* +# $Header: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartPpiLib/RapidStartPpiLib.sdl 1 4/19/12 8:10a Yurenlai $ +# +# $Revision: 1 $ +# +# $Date: 4/19/12 8:10a $ +#************************************************************************* +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/Intel Fast Flash Standby/iRST_SharkBay/RapidStartPpiLib/RapidStartPpiLib.sdl $ +# +# 1 4/19/12 8:10a Yurenlai +# Initial check in. +# +#************************************************************************* +TOKEN + Name = "RapidStartPpiLib_SUPPORT" + Value = "1" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + Master = Yes + Help = "Main switch to enable RapidStartPpiLib support in Project" +End + +PATH + Name = "RapidStartPpiLib_DIR" + Help = "RapidStartPpiLib file source directory" +End + +MODULE + File = "RapidStartPpiLib.mak" + Help = "Includes RapidStartPpiLib.mak to Project" +End + +ELINK + Name = "RapidStartPpiLib_LIB" + InvokeOrder = ReplaceParent +End + +ELINK + Name = "$(BUILD_DIR)\RapidStartPpiLib.lib" + Parent = "RapidStartPpiLib_LIB" + 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 ** +#** ** +#************************************************************************* +#************************************************************************* |