From b7c51c9cf4864df6aabb99a1ae843becd577237c Mon Sep 17 00:00:00 2001 From: raywu Date: Fri, 15 Jun 2018 00:00:50 +0800 Subject: init. 1AQQW051 --- .../MdesStatusCode/Dxe/MdesStatusCodeDxe.c | 122 ++++++++++++++++++ .../MdesStatusCode/Dxe/MdesStatusCodeDxe.cif | 13 ++ .../MdesStatusCode/Dxe/MdesStatusCodeDxe.dxs | 39 ++++++ .../MdesStatusCode/Dxe/MdesStatusCodeDxe.h | 59 +++++++++ .../MdesStatusCode/Dxe/MdesStatusCodeDxe.inf | 82 ++++++++++++ .../MdesStatusCode/Dxe/MdesStatusCodeDxe.mak | 142 +++++++++++++++++++++ .../MdesStatusCode/Dxe/MdesStatusCodeDxe.sdl | 25 ++++ 7 files changed, 482 insertions(+) create mode 100644 ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.c create mode 100644 ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.cif create mode 100644 ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.dxs create mode 100644 ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.h create mode 100644 ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.inf create mode 100644 ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.mak create mode 100644 ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.sdl (limited to 'ReferenceCode/ME/SampleCode/MdesStatusCode') diff --git a/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.c b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.c new file mode 100644 index 0000000..3b78726 --- /dev/null +++ b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.c @@ -0,0 +1,122 @@ +/** @file + Provides an interface to call function to send HECI message. + +@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 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 +**/ +#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000) +#include "EdkIIGlueDxe.h" +#endif +#include "MdesStatusCodeDxe.h" +#include "MeLib.h" +#include "MePlatformPolicy\MePlatformPolicy.h" + + +EFI_GUID gMdesStatusCodeProtocolGuid = MDES_STATUS_CODE_PROTOCOL_GUID; + +/** + This function is called in case of status code appears. + Provides an interface to call function to send HECI message. + + @param[in] Type Indicates the type of status code being reported. + @param[in] Value Describes the current status of a hardware or software entity. + This included information about the class and subclass that is + used to classify the entity as well as an operation. + @param[in] Instance The enumeration of a hardware or software entity within + the system. Valid instance numbers start with 1. + @param[in] CallerId This optional parameter may be used to identify the caller. + This parameter allows the status code driver to apply different + rules to different callers. + @param[in] Data This optional parameter may be used to pass additional data. + + @retval EFI_STATUS HECI sent with success. +**/ +EFI_STATUS +EFIAPI +MdesReportStatusCodeHandler ( + IN EFI_STATUS_CODE_TYPE Type, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN EFI_GUID *CallerId OPTIONAL, + IN EFI_STATUS_CODE_DATA *Data OPTIONAL + ) +{ + EFI_STATUS Status; + + Status = HeciSendMdesStatusCode (Type, Value, Instance, CallerId, Data); + + return Status; +} + +MDES_STATUS_CODE_PROTOCOL MdesStatusCodeProtocolInstance = {MdesReportStatusCodeHandler}; + + +/** + Installs MdesStatusCodeProtocolInstance protocol. + + @param[in] ImageHandle Image handle of this driver. + @param[in] SystemTable Global system service table. + + @retval EFI_STATUS Driver instaled with siccess. +**/ +EFI_STATUS +EFIAPI +MdesStatusCodeDrvEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + MDES_BIOS_FLAGS Flags; + UINT32 BiosEventFilters; + DXE_ME_POLICY_PROTOCOL *MePlatformPolicy; + + /// + /// Get the ME platform policy. + /// + Status = gBS->LocateProtocol (&gDxePlatformMePolicyGuid, NULL, (VOID **) &MePlatformPolicy); + if (EFI_ERROR (Status)) { + return Status; + } + + if(MePlatformPolicy->MeConfig.MdesForBiosState == TRUE) { + /// + /// Check if Mdes is enabled in FW + /// + Status = HeciGetMdesConfig(&Flags, &BiosEventFilters); + if (EFI_ERROR (Status)) { + return EFI_SUCCESS; + } + if (1) { + /// + /// Install Mdes protocol to be consumed by platform library for ReportStatusCode core driver. + /// + Status = gBS->InstallProtocolInterface ( + &ImageHandle, + &gMdesStatusCodeProtocolGuid, + EFI_NATIVE_INTERFACE, + &MdesStatusCodeProtocolInstance + ); + } + { + PLATFORM_DEBUG_CAP Data; + UINT8 Result; + + Data.Data = 3; + Status = HeciPlatformDebugCapabilityMsg(Data, &Result); + } + } + return Status; +} diff --git a/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.cif b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.cif new file mode 100644 index 0000000..2647905 --- /dev/null +++ b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.cif @@ -0,0 +1,13 @@ + + name = "MdesStatusCodeDxe" + category = ModulePart + LocalRoot = "ReferenceCode\ME\SampleCode\MdesStatusCode\Dxe" + RefName = "MdesStatusCodeDxe" +[files] +"MdesStatusCodeDxe.sdl" +"MdesStatusCodeDxe.mak" +"MdesStatusCodeDxe.c" +"MdesStatusCodeDxe.dxs" +"MdesStatusCodeDxe.h" +"MdesStatusCodeDxe.inf" + diff --git a/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.dxs b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.dxs new file mode 100644 index 0000000..ab85bb6 --- /dev/null +++ b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.dxs @@ -0,0 +1,39 @@ +/** + +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. + +Module Name: + + +Abstract: + + +**/ +// +// Common for R8 and R9 codebase +// +#include "AutoGen.h" +#include "DxeDepex.h" + +// +// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are both "defined" in R8 codebase; +// BUILD_WITH_EDKII_GLUE_LIB is defined in Edk-Dev-Snapshot-20070228 and later version +// BUILD_WITH_GLUELIB and BUILD_WITH_EDKII_GLUE_LIB are "not defined" in R9 codebase. +// +#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB) +#include "EfiDepex.h" +#include EFI_PROTOCOL_DEFINITION (Heci) +#include EFI_PROTOCOL_DEFINITION (MePlatformPolicy) +#endif + +DEPENDENCY_START + EFI_HECI_PROTOCOL_GUID AND + DXE_PLATFORM_ME_POLICY_GUID +DEPENDENCY_END diff --git a/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.h b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.h new file mode 100644 index 0000000..74bfc0a --- /dev/null +++ b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.h @@ -0,0 +1,59 @@ +/** @file + Header file to provides an interface to call function to send HECI message. + +@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 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 + +--*/ +#ifndef _MDES_STATUS_CODE_DXE_H_ +#define _MDES_STATUS_CODE_DXE_H_ + +#define MDES_STATUS_CODE_PROTOCOL_GUID \ + { \ + 0xe5d0875a, 0xf647, 0x4e16, 0xbe, 0x4d, 0x95, 0x02, 0x40, 0x29, 0xcc, 0x44 \ + } + +/** + This function is called in case of status code appears. + Provides an interface to call function to send HECI message. + + @param[in] Type Indicates the type of status code being reported. + @param[in] Value Describes the current status of a hardware or software entity. + This included information about the class and subclass that is + used to classify the entity as well as an operation. + @param[in] Instance The enumeration of a hardware or software entity within + the system. Valid instance numbers start with 1. + @param[in] CallerId This optional parameter may be used to identify the caller. + This parameter allows the status code driver to apply different + rules to different callers. + @param[in] Data This optional parameter may be used to pass additional data. + + @retval EFI_STATUS HECI sent with success. +**/ +typedef +EFI_STATUS +(EFIAPI *SEND_STATUS_CODE) ( + IN EFI_STATUS_CODE_TYPE Type, + IN EFI_STATUS_CODE_VALUE Value, + IN UINT32 Instance, + IN EFI_GUID *CallerId OPTIONAL, + IN EFI_STATUS_CODE_DATA *Data OPTIONAL + ); + +typedef struct _MDES_STATUS_CODE_PROTOCOL { + SEND_STATUS_CODE SendMdesStatusCode; +} MDES_STATUS_CODE_PROTOCOL; + +#endif diff --git a/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.inf b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.inf new file mode 100644 index 0000000..1a77fa5 --- /dev/null +++ b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.inf @@ -0,0 +1,82 @@ +## @file +# Component description file for the MdesStatusCodeDrv DXE driver. +# +#@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 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 = MdesStatusCodeDxe +FILE_GUID = df5cd25a-8e55-46ba-8cda-bc7db7bf9c64 +COMPONENT_TYPE = BS_DRIVER + +[sources.common] + MdesStatusCodeDxe.c + MdesStatusCodeDxe.h +# +# Edk II Glue Driver Entry Point +# + EdkIIGlueDxeDriverEntryPoint.c + +[includes.common] + $(EFI_SOURCE)/$(PROJECT_ME_ROOT) + $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Heci/Include + $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Dxe + $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Library/MeKernel/Include + $(EFI_SOURCE)/$(PROJECT_ME_ROOT)/Protocol/MePlatformPolicy + $(EFI_SOURCE)/$(PROJECT_PCH_ROOT)/Include + +# +# EDK II Glue Library utilizes some standard headers from EDK +# + $(EDK_SOURCE)/Foundation + $(EDK_SOURCE)/Foundation/Core/Dxe + $(EDK_SOURCE)/Foundation/Efi + $(EDK_SOURCE)/Foundation/Efi/Include + $(EDK_SOURCE)/Foundation/Framework + $(EDK_SOURCE)/Foundation/Framework/Include + $(EDK_SOURCE)/Foundation/Include + $(EDK_SOURCE)/Foundation/Include/IndustryStandard + $(EDK_SOURCE)/Foundation/Library/Dxe/Include + $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include + +[libraries.common] + MeProtocolLib + MeLib + MeGuidLib + MeChipsetLib + EdkProtocolLib + EdkFrameworkProtocolLib + EdkIIGlueBaseLib + EdkIIGlueBaseIoLibIntrinsic + EdkIIGlueDxeDebugLibReportStatusCode + EdkIIGlueDxeReportStatusCodeLib + EdkIIGlueUefiBootServicesTableLib + EdkIIGlueDxeServicesTableLib + EdkIIGlueEdkDxeRuntimeDriverLib + EdkIIGlueBasePciLibPciExpress + +[nmake.common] + IMAGE_ENTRY_POINT= _ModuleEntryPoint + DPX_SOURCE=MdesStatusCodeDxe.dxs + C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=MdesStatusCodeDrvEntryPoint \ + -D __EDKII_GLUE_BASE_MEMORY_LIB__ \ + -D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \ + -D __EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB__ \ + -D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \ + -D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\ + -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \ + -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ diff --git a/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.mak b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.mak new file mode 100644 index 0000000..6e49bcc --- /dev/null +++ b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.mak @@ -0,0 +1,142 @@ +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2010, American Megatrends, Inc. ** +#** ** +#** All Rights Reserved. ** +#** ** +#** 5555 Oakbrook Parkway, Suite 200, Norcross, GA 30093 ** +#** ** +#** Phone: (770)-246-8600 ** +#** ** +#************************************************************************* +#************************************************************************* +#********************************************************************** +# +# $Header: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeSampleCode/MdesStatusCodeDxe/MdesStatusCodeDxe.mak 1 4/06/12 8:57a Klzhan $ +# +# $Revision: 1 $ +# +# $Date: 4/06/12 8:57a $ +# +#********************************************************************** +# Revision History +# ---------------- +# $Log: /Alaska/SOURCE/Modules/SharkBayRefCodes/ME/MeSampleCode/MdesStatusCodeDxe/MdesStatusCodeDxe.mak $ +# +# 1 4/06/12 8:57a Klzhan +# +# 4 3/27/12 5:17a Klzhan +# Correct TYPE of this modulepart. +# +# 3 10/19/11 9:19a Calvinchen +# [TAG] EIP65695 +# [Category] Bug Fix +# [Severity] Normal +# [Symptom] Support HECI protocol in SMM for ME 8.0 +# [Solution] Removed "EDKII_GLUE_EDK_DXE_RUNTIME_DRIVER_LIB" from Make +# file. +# +# 2 9/27/11 5:03a Klzhan +# Fix build error +# +# 1 9/27/11 4:46a Klzhan +# +# +# +#********************************************************************** +# +# +#---------------------------------------------------------------------------- +# +# Name: MdesStatusCodeDrv.mak +# +# Description: Mdes Status Code driver +# +#---------------------------------------------------------------------------- +# +all : MdesStatusCodeDrv + +MdesStatusCodeDrv : $(BUILD_DIR)\MdesStatusCodeDxe.mak MdesStatusCodeDrvBin + +$(BUILD_DIR)\MdesStatusCodeDxe.mak : $(MdesStatusCodeDrv_DIR)\$(@B).cif $(MdesStatusCodeDrv_DIR)\$(@B).mak $(BUILD_RULES) + $(CIF2MAK) $(MdesStatusCodeDrv_DIR)\$(@B).cif $(CIF2MAK_DEFAULTS) + + +MdesStatusCodeDrv_INCLUDES=\ + $(EDK_INCLUDES)\ + $(ME_INCLUDES)\ + $(EdkIIGlueLib_INCLUDES)\ + $(EdkIIGlueInclude)\ + $(IndustryStandard_INCLUDES)\ + -I$(MeProtocolLib_DIR)\ + -I$(INTEL_COUGAR_POINT_INCLUDE_DIR) + +MdesStatusCodeDrv_DEFINES = $(MY_DEFINES)\ + /D"__EDKII_GLUE_MODULE_ENTRY_POINT__=MdesStatusCodeDrvEntryPoint"\ + /D __EDKII_GLUE_BASE_MEMORY_LIB__ \ + /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \ + /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \ + /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\ + /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \ + /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ + + +MdesStatusCodeDrv_LIB_LINKS =\ + $(EDKFRAMEWORKPROTOCOLLIB)\ + $(INTEL_PCH_PROTOCOL_LIB)\ + $(EdkIIGlueBasePrintLib_LIB) \ + $(EdkIIGlueUefiLib_LIB)\ + $(TdtProtocolLib_LIB)\ + $(ProtocolLib_LIB)\ + $(EFISCRIPTLIB)\ + $(AmtLibDxe_LIB)\ + $(MeLibDxe_LIB)\ + $(EdkIIGlueBaseLib_LIB)\ + $(AmtGuidLib_LIB)\ + $(EFIGUIDLIB)\ + $(EDKPROTOCOLLIB)\ +!IF "$(x64_BUILD)"=="1" + $(EdkIIGlueBaseLibX64_LIB)\ +!ELSE + $(EdkIIGlueBaseLibIA32_LIB)\ +!ENDIF + $(EdkIIGlueBaseMemoryLib_LIB)\ + $(EdkIIGlueDxeReportStatusCodeLib_LIB)\ + $(EdkIIGlueEdkDxeRuntimeDriverLib_LIB)\ + $(EdkIIGluePeiDxeDebugLibReportStatusCode_LIB)\ + $(EdkIIGlueUefiBootServicesTableLib_LIB)\ + $(EdkIIGlueDxeMemoryAllocationLib_LIB)\ + $(EdkIIGlueBasePciLibPciExpress_LIB)\ + $(EFIDRIVERLIB)\ + $(EdkIIGlueDxeServicesTableLib_LIB)\ + $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\ + $(MeProtocolLib_LIB) +# MAK file for the eModule:TdtDxe + +MdesStatusCodeDrvBin : $(MdesStatusCodeDrv_LIB_LINKS) + $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\ + /f $(BUILD_DIR)\MdesStatusCodeDxe.mak all\ + "MY_INCLUDES=$(MdesStatusCodeDrv_INCLUDES)"\ + "MY_DEFINES=$(MdesStatusCodeDrv_DEFINES)"\ + GUID=df5cd25a-8e55-46ba-8cda-bc7db7bf9c64 \ + ENTRY_POINT=_ModuleEntryPoint \ + TYPE=BS_DRIVER \ + EDKIIModule=DXEDRIVER\ + DEPEX1=$(MdesStatusCodeDrv_DIR)\MdesStatusCodeDxe.dxs \ + DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX \ + COMPRESS=1\ + +#************************************************************************* +#************************************************************************* +#** ** +#** (C)Copyright 1985-2010, 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/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.sdl b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.sdl new file mode 100644 index 0000000..f61edd3 --- /dev/null +++ b/ReferenceCode/ME/SampleCode/MdesStatusCode/Dxe/MdesStatusCodeDxe.sdl @@ -0,0 +1,25 @@ +TOKEN + Name = "MDES_STATUSCODE_DRV_SUPPORT" + Value = "1" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + TargetH = Yes + Master = Yes + Help = "Main switch to enable IccOverClocking support in Project" +End + +MODULE + Help = "Includes MebxSetupBrowser.mak to Project" + File = "MdesStatusCodeDxe.mak" +End + +PATH + Name = "MdesStatusCodeDrv_DIR" +End + +ELINK + Name = "$(BUILD_DIR)\MdesStatusCodeDxe.ffs" + Parent = "FV_MAIN" + InvokeOrder = AfterParent +End \ No newline at end of file -- cgit v1.2.3