From 2c855d3aaf36da80f8c4f0ae12d31900a628b0a9 Mon Sep 17 00:00:00 2001 From: "Lu, ShifeiX A" Date: Thu, 28 Jul 2016 16:21:28 +0800 Subject: [PATCH] Vlv2DeviceRefCodePkg&Vlv2DevicePkg:Add sample WSMT table. This is an sample WSMT table, which we only update BIT0 and BIT1 of Protections flags fields. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: lushifex Reviewed-by: David Wei --- .../AcpiTablesPCAT/AcpiTables.inf | 3 +- .../AcpiTablesPCAT/Wsmt/Wsmt.aslc | 60 +++++++++++++++++++ Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c | 13 ++++ 3 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 Vlv2DeviceRefCodePkg/AcpiTablesPCAT/Wsmt/Wsmt.aslc diff --git a/Vlv2DeviceRefCodePkg/AcpiTablesPCAT/AcpiTables.inf b/Vlv2DeviceRefCodePkg/AcpiTablesPCAT/AcpiTables.inf index 9c006517c4..e9a7d803d7 100644 --- a/Vlv2DeviceRefCodePkg/AcpiTablesPCAT/AcpiTables.inf +++ b/Vlv2DeviceRefCodePkg/AcpiTablesPCAT/AcpiTables.inf @@ -5,7 +5,7 @@ # All .asi files tagged with "ToolCode="DUMMY"" in following file list are device description and are included # by top level ASL file which will be dealed with by asl.exe application. # -# Copyright (c) 1999 - 2015, Intel Corporation. All rights reserved +# Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved # # This program and the accompanying materials are licensed and made available under # the terms and conditions of the BSD License that accompanies this distribution. @@ -37,6 +37,7 @@ Mcfg/Mcfg.aslc Hpet/Hpet.aslc Lpit/Lpit.aslc + Wsmt/Wsmt.aslc [Packages] diff --git a/Vlv2DeviceRefCodePkg/AcpiTablesPCAT/Wsmt/Wsmt.aslc b/Vlv2DeviceRefCodePkg/AcpiTablesPCAT/Wsmt/Wsmt.aslc new file mode 100644 index 0000000000..4142201ffd --- /dev/null +++ b/Vlv2DeviceRefCodePkg/AcpiTablesPCAT/Wsmt/Wsmt.aslc @@ -0,0 +1,60 @@ +/*++ + Copyright (c) 2016, Intel Corporation. All rights reserved.
+ + This program and the accompanying materials are licensed and made available under + the terms and conditions of the BSD License that accompanies this distribution. + The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php. + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + + +Module Name: + + Wsmt.c + +Abstract: + + This file contains a structure definition for the Windows SMM Security + Mitigations Table (WSMT). + +++*/ + +// +// Statements that include other files +// +#include "AcpiTablePlatform.h" +#include + +// +// WSMT Table definition +// +EFI_ACPI_WSMT_TABLE WSMT = { + EFI_ACPI_WINDOWS_SMM_SECURITY_MITIGATION_TABLE_SIGNATURE, + sizeof (EFI_ACPI_WSMT_TABLE), + EFI_WSMT_TABLE_REVISION, + // + // Checksum will be updated at runtime + // + 0, + EFI_ACPI_OEM_ID, // OEMID is a 6 bytes long field + EFI_ACPI_OEM_TABLE_ID, // OEM table identification(8 bytes long) + EFI_ACPI_OEM_REVISION, // OEM revision + EFI_ACPI_CREATOR_ID, // ASL compiler vendor ID + EFI_ACPI_CREATOR_REVISION, // ASL compiler revision number + 0x00000000, // Protection flag +}; + +VOID* +ReferenceAcpiTable ( + VOID + ) +{ + // + // Reference the table being generated to prevent the optimizer from + // removing the data structure from the executable + // + return (VOID*)&WSMT; +} diff --git a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c index db1b5a5eeb..8a883f2a09 100644 --- a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c +++ b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c @@ -58,6 +58,7 @@ Abstract: #include #include #include +#include CHAR16 EfiPlatformCpuInfoVariable[] = L"PlatformCpuInfo"; @@ -238,6 +239,7 @@ PlatformUpdateTables ( UINT8 TempVal; EFI_ACPI_3_0_IO_APIC_STRUCTURE *IOApicType; EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_HEADER *APICTableHeader; + EFI_ACPI_WSMT_TABLE *WsmtTable; CurrPtr = NULL; EndPtr = NULL; @@ -599,6 +601,17 @@ PlatformUpdateTables ( gBS->FreePool (OcurModelStringBuffer); gBS->FreePool (OcurRefDataBlockBuffer); break; + + + case EFI_ACPI_WINDOWS_SMM_SECURITY_MITIGATION_TABLE_SIGNATURE: + WsmtTable = (EFI_ACPI_WSMT_TABLE *) Table; + // + // Update Microsoft WSMT table Protections flags. + // + WsmtTable->ProtectionFlags = ((WsmtTable->ProtectionFlags) | (EFI_WSMT_PROTECTION_FLAGS_FIXED_COMM_BUFFERS | EFI_WSMT_PROTECTION_FLAGS_COMM_BUFFER_NESTED_PTR_PROTECTION )); + break; + + default: break; } -- 2.39.2