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 /ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe | |
download | zprj-b7c51c9cf4864df6aabb99a1ae843becd577237c.tar.xz |
Diffstat (limited to 'ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe')
9 files changed, 575 insertions, 0 deletions
diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.c b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.c new file mode 100644 index 0000000..4894c8f --- /dev/null +++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.c @@ -0,0 +1,75 @@ +/** @file + This code makes the BIOS Data structure available via standard ACPI mechanisms. + +@copyright + Copyright (c) 1999 - 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 Reference Module" and is + licensed for Intel 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 +**/ + +#include "BdatAccessHandler.h" + +STATIC EFI_ACPI_TABLE_PROTOCOL *AcpiTable; + +/** + Entry point of the Bdat Access Handler. + + @param[in] ImageHandle EFI_HANDLE: A handle for the image that is initializing this driver + @param[in] SystemTable EFI_SYSTEM_TABLE: A pointer to the EFI system table + + @retval EFI_SUCCESS: Driver initialized successfully + @exception EFI_UNSUPPORTED: A needed driver was not located + @retval EFI_OUT_OF_RESOURCES: Could not allocate needed resources +**/ +EFI_STATUS +BdatAccessHandler ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + VOID *HobList; + DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy; + + /// + /// Check if the BDAT ACPI table support is enabled in Setup, if not then exit. + /// Get the platform setup policy. + /// + Status = gBS->LocateProtocol (&gDxePlatformSaPolicyGuid, NULL, (VOID **) &DxePlatformSaPolicy); + ASSERT_EFI_ERROR (Status); + + /// + /// Get the start of the HOBs. + /// + Status = EfiGetSystemConfigurationTable (&gEfiHobListGuid, &HobList); + ASSERT_EFI_ERROR (Status); + if (EFI_ERROR (Status)) { + return EFI_UNSUPPORTED; + } + /// + /// Locate ACPI table protocol + /// + Status = gBS->LocateProtocol (&gEfiAcpiTableProtocolGuid, NULL, (VOID **) &AcpiTable); + ASSERT_EFI_ERROR (Status); + ASSERT (AcpiTable != NULL); + if (EFI_ERROR (Status)) { + return EFI_OUT_OF_RESOURCES; + } + BdatRmtHandler (DxePlatformSaPolicy, HobList, AcpiTable); + /// + /// ASSERT_EFI_ERROR (Status); + /// + return Status; +} diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.cif b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.cif new file mode 100644 index 0000000..db14005 --- /dev/null +++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.cif @@ -0,0 +1,15 @@ +<component> + name = "BdatAccessHandler" + category = ModulePart + LocalRoot = "ReferenceCode\Chipset\SystemAgent\BdatAccessHandler\Dxe\" + RefName = "BdatAccessHandler" +[files] +"BdatAccessHandler.sdl" +"BdatAccessHandler.mak" +"BdatAccessHandler.c" +"BdatAccessHandler.h" +"BdatAccessHandler.dxs" +"BdatAccessHandler.inf" +"BdatRmtHandler.c" +"BdatRmtHandler.h" +<endComponent> diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.dxs b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.dxs new file mode 100644 index 0000000..44b88d0 --- /dev/null +++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.dxs @@ -0,0 +1,37 @@ +/** + +Copyright (c) 1999 - 2011 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: + + BdatAccessHandler.dxs + +Abstract: + + Dependency expression source file. + +**/ + +#include "AutoGen.h" +#include "DxeDepex.h" +#if defined (BUILD_WITH_GLUELIB) || defined (BUILD_WITH_EDKII_GLUE_LIB) +#include "EfiDepex.h" + +#include EFI_PROTOCOL_DEPENDENCY (SaPlatformPolicy) +#include EFI_PROTOCOL_DEPENDENCY (AcpiTable) +#include EFI_PROTOCOL_DEPENDENCY (SaInfo) +#endif + +DEPENDENCY_START + DXE_PLATFORM_SA_POLICY_GUID AND + EFI_ACPI_TABLE_PROTOCOL_GUID AND + EFI_SA_INFO_PROTOCOL_GUID +DEPENDENCY_END diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.h b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.h new file mode 100644 index 0000000..21e236f --- /dev/null +++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.h @@ -0,0 +1,80 @@ +/** @file + This code makes the BIOS Data structure available via standard ACPI mechanisms. + +@copyright + Copyright (c) 1999 - 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 Reference Module" and is + licensed for Intel 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 _BDAT_ACCESS_HANDLER_H_ +#define _BDAT_ACCESS_HANDLER_H_ +/// +/// External include files do NOT need to be explicitly specified in real EDKII environment. +/// +#if !defined(EDK_RELEASE_VERSION) || (EDK_RELEASE_VERSION < 0x00020000) +#include "EdkIIGlueDxe.h" +#include "Acpi3_0.h" +#include "Acpi.h" +#include "BdatRmtHandler.h" +#include EFI_GUID_DEFINITION (Hob) + +/// +/// Consumed protocols +/// +#include EFI_PROTOCOL_CONSUMER (AcpiTable) +#include EFI_PROTOCOL_PRODUCER (BdatAccess) +#include EFI_PROTOCOL_DEFINITION (SaPlatformPolicy) +#endif +/// +/// Ensure proper structure formats +/// +#pragma pack(push, 1) +/// +/// BIOS Data ACPI structure +/// +typedef struct { + EFI_ACPI_DESCRIPTION_HEADER Header; + EFI_ACPI_3_0_GENERIC_ADDRESS_STRUCTURE BdatGas; +} EFI_BDAT_ACPI_DESCRIPTION_TABLE; + + +/** + Entry point of the Bdat RMT Access Handler. + + @param[in] DxePlatformSaPolicy : A pointer to Dxe platform policy + @param[in] HobList : A pointer to the HOB list + @param[in] AcpiTable : A pointer to ACPI table + + @retval EFI_SUCCESS: Driver initialized successfully + @exception EFI_UNSUPPORTED: A needed driver was not located + @retval EFI_OUT_OF_RESOURCES: Could not allocate needed resources +**/ +EFI_STATUS +BdatRmtHandler ( + IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy, + IN VOID *HobList, + IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable + ) +; +/// +/// This is copied from Include\Acpi.h +/// +#define CREATOR_ID_INTEL 0x4C544E49 /// "LTNI""INTL"(Intel) +#define CREATOR_REV_INTEL 0x20090903 + +#pragma pack(pop) + +#endif /// _BDAT_ACCESS_HANDLER_H_ diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.inf b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.inf new file mode 100644 index 0000000..c83318a --- /dev/null +++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.inf @@ -0,0 +1,99 @@ +#/*++ +# +# Copyright (c) 1999 - 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: +# +# BdatAccessHandler.inf +# +# Abstract: +# +# Component description file for the BdatAccessHandler module. +# +#--*/ + +[defines] +BASE_NAME = BdatAccessHandler +FILE_GUID = 6DB9486F-6AF6-4090-984D-238482CE3EA4 +COMPONENT_TYPE = BS_DRIVER + +[sources.common] + BdatAccessHandler.c + BdatAccessHandler.h + BdatRmtHandler.c + BdatRmtHandler.h +# +# Edk II Glue Driver Entry Point +# + EdkIIGlueDxeDriverEntryPoint.c + +[includes.common] + . + $(EFI_SOURCE) + $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include + $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Library + $(EDK_SOURCE)/Foundation/Library/EdkIIGlueLib/Include/Common + $(EDK_SOURCE)/Foundation/Efi + $(EDK_SOURCE)/Foundation + $(EDK_SOURCE)/Foundation/Framework + $(EDK_SOURCE)/Foundation/Framework/Guid + $(EDK_SOURCE)/Foundation/Include + $(EDK_SOURCE)/Foundation/Efi/Include + $(EDK_SOURCE)/Foundation/Framework/Include + $(EDK_SOURCE)/Foundation/Include/IndustryStandard + $(EDK_SOURCE)/Foundation/Core/Dxe + $(EDK_SOURCE)/Foundation/Library/Dxe/Include + $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/Include + $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/SaInit/Pei + $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei + $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Api + $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Include + $(EFI_SOURCE)/$(PROJECT_SA_ROOT)/$(PROJECT_SA_MRC)/Pei/Source/Include/MrcRegisters + $(EFI_SOURCE)/$(PROJECT_SA_ROOT) + $(EDK_SOURCE)/Foundation/Cpu/Pentium/Include + $(EFI_SOURCE)/$(PROJECT_CPU_ROOT) + $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include + $(EFI_SOURCE)/$(PROJECT_CPU_ROOT)/Include/Library + +[libraries.common] + EdkFrameworkProtocolLib + EdkFrameworkGuidLib + EfiGuidLib + EdkProtocolLib + EdkIIGlueBaseLib + EdkIIGlueBaseIoLibIntrinsic + EdkIIGlueBaseMemoryLib + EdkIIGlueDxeReportStatusCodeLib + EdkIIGlueDxeDebugLibReportStatusCode + EdkIIGlueUefiBootServicesTableLib + EdkIIGlueUefiRuntimeServicesTableLib + EdkIIGlueDxeServicesTableLib + EdkIIGlueDxeHobLib + IntelSaProtocolLib + CpuPlatformLib + +[nmake.common] + IMAGE_ENTRY_POINT = _ModuleEntryPoint + DPX_SOURCE = BdatAccessHandler.dxs + +# +# Module Entry Point +# + C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_MODULE_ENTRY_POINT__=BdatAccessHandler + C_FLAGS = $(C_FLAGS) -D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \ + -D __EDKII_GLUE_BASE_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_UEFI_RUNTIME_SERVICES_TABLE_LIB__ \ + -D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \ + -D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ + diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.mak b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.mak new file mode 100644 index 0000000..c30f7a4 --- /dev/null +++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.mak @@ -0,0 +1,58 @@ +#--------------------------------------------------------------------------- +# Create PCI Host Bridge DXE Component +#--------------------------------------------------------------------------- +EDK : BdatAccessHandler + +BdatAccessHandler : $(BUILD_DIR)\BdatAccessHandler.mak BdatAccessHandlerBin + +$(BUILD_DIR)\BdatAccessHandler.mak : $(BdatAccessHandler_DIR)\BdatAccessHandler.cif $(BUILD_RULES) + $(CIF2MAK) $(BdatAccessHandler_DIR)\BdatAccessHandler.cif $(CIF2MAK_DEFAULTS) + +BdatAccessHandler_INCLUDES=\ + $(EdkIIGlueLib_INCLUDES)\ + $(EDK_INCLUDES)\ + $(INTEL_MCH_INCLUDES)\ + $(INTEL_PCH_INCLUDES) + +BdatAccessHandler_DEFINES =$(MY_DEFINES)\ + /D "__EDKII_GLUE_MODULE_ENTRY_POINT__=BdatAccessHandler" \ + /D __EDKII_GLUE_BASE_LIB__ \ + /D __EDKII_GLUE_BASE_IO_LIB_INTRINSIC__ \ + /D __EDKII_GLUE_DXE_REPORT_STATUS_CODE_LIB__ \ + /D __EDKII_GLUE_DXE_SERVICES_TABLE_LIB__ \ + /D __EDKII_GLUE_DXE_DEBUG_LIB_REPORT_STATUS_CODE__ \ + /D __EDKII_GLUE_UEFI_BOOT_SERVICES_TABLE_LIB__\ + /D __EDKII_GLUE_DXE_MEMORY_ALLOCATION_LIB__ \ + +BdatAccessHandler_LIB_LINKS =\ + $(EDKFRAMEWORKPROTOCOLLIB)\ + $(EdkIIGlueBaseLib_LIB)\ + $(EDKPROTOCOLLIB)\ +!IF "$(x64_BUILD)"=="1" + $(EdkIIGlueBaseLibX64_LIB)\ +!ELSE + $(EdkIIGlueBaseLibIA32_LIB)\ +!ENDIF + $(EdkIIGlueBaseIoLibIntrinsic_LIB)\ + $(EdkIIGlueBaseMemoryLib_LIB)\ + $(EdkIIGlueDxeReportStatusCodeLib_LIB)\ + $(EdkIIGlueDxeDebugLibReportStatusCode_LIB)\ + $(EdkIIGlueUefiBootServicesTableLib_LIB)\ + $(EdkIIGlueUefiRuntimeServicesTableLib_LIB)\ + $(EdkIIGlueDxeServicesTableLib_LIB)\ + $(EdkIIGlueDxeHobLib_LIB)\ + $(INTEL_SA_PROTOCOL_LIB)\ + $(CpuPlatformLib_LIB)\ + +BdatAccessHandlerBin : $(BdatAccessHandler_LIB_LINKS) + $(MAKE) /$(MAKEFLAGS) $(EDKIIGLUE_DEFAULTS)\ + /f $(BUILD_DIR)\BdatAccessHandler.mak all\ + GUID=6DB9486F-6AF6-4090-984D-238482CE3EA4 \ + ENTRY_POINT=_ModuleEntryPoint \ + "MY_DEFINES=$(BdatAccessHandler_DEFINES)"\ + "MY_INCLUDES=$(BdatAccessHandler_INCLUDES)"\ + TYPE=BS_DRIVER \ + EDKIIModule=DXEDRIVER\ + DEPEX1=$(BdatAccessHandler_DIR)\BdatAccessHandler.dxs\ + DEPEX1_TYPE=EFI_SECTION_DXE_DEPEX\ + COMPRESS=1
\ No newline at end of file diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.sdl b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.sdl new file mode 100644 index 0000000..4efce7e --- /dev/null +++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatAccessHandler.sdl @@ -0,0 +1,26 @@ +TOKEN + Name = "BdatAccessHandler_SUPPORT" + Value = "1" + TokenType = Boolean + TargetEQU = Yes + TargetMAK = Yes + TargetH = Yes + Master = Yes + Help = "Main switch to enable BdatAccessHandler support in Project" + Token = "MRC_BDAT_SUPPORT" "=" "1" +End + +MODULE + Help = "Includes BdatAccessHandler.mak to Project" + File = "BdatAccessHandler.mak" +End + +PATH + Name = "BdatAccessHandler_DIR" +End + +ELINK + Name = "$(BUILD_DIR)\BdatAccessHandler.ffs" + Parent = "FV_MAIN" + InvokeOrder = AfterParent +End diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatRmtHandler.c b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatRmtHandler.c new file mode 100644 index 0000000..8fbe3d2 --- /dev/null +++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatRmtHandler.c @@ -0,0 +1,152 @@ +/** @file + Copies the memory related timing and configuration information into the + Compatible BIOS data (BDAT) table. + +@copyright + Copyright (c) 2010 - 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 Reference Module" and is + licensed for Intel 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. +**/ + +#include "BdatAccessHandler.h" +#include "McMain.h" + +#ifdef BDAT_SUPPORT +/// +/// Data definitions & structures +/// +EFI_GUID gMemoryInitHobGuid = EFI_MEMORY_RESTORE_DATA_GUID; + +/// +/// Bdat Access Handler instance data structure +/// +STATIC EFI_BDAT_ACPI_DESCRIPTION_TABLE mRmtAcpiTable = { + EFI_BDAT_TABLE_SIGNATURE, ///< Signature + sizeof (EFI_BDAT_ACPI_DESCRIPTION_TABLE), ///< Length + 0x01, ///< Revision [01] + 0, ///< Checksum + ' ', ///< OEM ID + ' ', ///< . + ' ', ///< . + ' ', ///< . + ' ', ///< . + ' ', ///< . + 0, ///< OEM Table ID + 0, ///< OEM Revision [0x00000000] + 0, ///< Creator ID + 0, ///< Creator Revision + 0, ///< System Memory Address Space ID + 0, + 0, + 0, + EFI_BDAT_ACPI_POINTER, +}; +#endif + +/** + Entry point of the Bdat RMT Access Handler. + + @param[in] DxePlatformSaPolicy : A pointer to Dxe platform policy + @param[in] HobList : A pointer to the HOB list + @param[in] AcpiTable : A pointer to ACPI table + + @retval EFI_SUCCESS: Driver initialized successfully + @exception EFI_UNSUPPORTED: A needed driver was not located + @retval EFI_OUT_OF_RESOURCES: Could not allocate needed resources +**/ +EFI_STATUS +BdatRmtHandler ( + IN DXE_PLATFORM_SA_POLICY_PROTOCOL *DxePlatformSaPolicy, + IN VOID *HobList, + IN EFI_ACPI_TABLE_PROTOCOL *AcpiTable + ) +{ +#ifdef BDAT_SUPPORT + EFI_STATUS Status; + VOID *Buffer; + RmtData *rmtBdat; + HOB_SAVE_MEMORY_DATA *RmtHobData; + UINTN AcpiTableKey; + UINT64 TempBuffer; + UINT16 BufferSize; + UINT32 *ScratchPad; + + Buffer = NULL; + rmtBdat = NULL; + BufferSize = 0; + Status = EFI_SUCCESS; + if (!DxePlatformSaPolicy->MemoryConfig->RmtBdatEnable) { + return EFI_UNSUPPORTED; + } + /// + /// Get the Compatible BIOS structure PMT BDAT from the HOB. + /// + RmtHobData = GetNextGuidHob (&gMemoryInitHobGuid, HobList); + if (RmtHobData == NULL) { + return EFI_UNSUPPORTED; + } + /// + /// Allocate and clear memory, in 4kb pages + /// + BufferSize = sizeof (RmtData); + + Status = (gBS->AllocatePages) (AllocateAnyPages, EfiReservedMemoryType, EFI_SIZE_TO_PAGES (BufferSize), (EFI_PHYSICAL_ADDRESS *) &Buffer); + if (EFI_ERROR (Status)) { + return EFI_OUT_OF_RESOURCES; + } + + ZeroMem (Buffer, BufferSize); + /// + /// Copy BDAT structure to Reserved memory + /// + CopyMem (Buffer, &RmtHobData->MrcData.Rmt, BufferSize); + + TempBuffer = EFI_SIGNATURE_64 ('I', 'N', 'T', 'E', 'L', 0, 0, 0); + /// + /// RMT ACPI table + /// + DEBUG ((EFI_D_INFO, "In RMT ACPI table\n")); + CopyMem (&mRmtAcpiTable.Header.OemId, &TempBuffer, sizeof (mRmtAcpiTable.Header.OemId)); + mRmtAcpiTable.Header.OemTableId = EFI_SIGNATURE_64 ('H', 'S', 'W', '-', 'L', 'P', 'T', 0); + mRmtAcpiTable.Header.CreatorId = CREATOR_ID_INTEL; + mRmtAcpiTable.Header.CreatorRevision = CREATOR_REV_INTEL; + mRmtAcpiTable.Header.OemRevision = ACPI_BDAT_OEM_REV; + /// + /// Copy pointer to RMT ACPI BDAT structure and protocol. + /// + mRmtAcpiTable.BdatGas.Address = (EFI_PHYSICAL_ADDRESS) Buffer; + /// + /// Install RMT BDAT into RMT ACPI table + /// + AcpiTableKey = 0; + Status = AcpiTable->InstallAcpiTable ( + AcpiTable, + &mRmtAcpiTable, + sizeof (EFI_BDAT_ACPI_DESCRIPTION_TABLE), + &AcpiTableKey + ); + ASSERT_EFI_ERROR (Status); + + /// + /// Write scratchpad register in MCHBAR space with address of the RMT ACPI BDAT structure. + /// + ScratchPad = (UINT32 *) ((UINT64) (RmtHobData->MrcData.SysIn.Inputs.MchBarBaseAddress) + NCDECS_CR_SCRATCHPAD_NCU_2_REG); + *ScratchPad = (UINT32) ((UINT64) Buffer); + + return Status; +#else + return EFI_UNSUPPORTED; +#endif +} diff --git a/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatRmtHandler.h b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatRmtHandler.h new file mode 100644 index 0000000..ce24bff --- /dev/null +++ b/ReferenceCode/Chipset/SystemAgent/BdatAccessHandler/Dxe/BdatRmtHandler.h @@ -0,0 +1,33 @@ +/** @file + Copies the memory related timing and configuration information into the + Compatible BIOS data (BDAT) table. + +@copyright + Copyright (c) 2010 - 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 Reference Module" and is + licensed for Intel 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 _BdatRmtHandler_h_ +#define _BdatRmtHandler_h_ +#ifndef BDAT_SUPPORT +#define BDAT_SUPPORT +#endif +#include "MemInfoHob.h" + +#define EFI_BDAT_TABLE_SIGNATURE EFI_SIGNATURE_32 ('B', 'D', 'A', 'T') +#define ACPI_BDAT_OEM_REV 0x00001000 +#define EFI_BDAT_ACPI_POINTER 0x0 + +#endif /// _BdatRmtHandler_h_ |