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 <shifeix.a...@intel.com>
---
 Vlv2DeviceRefCodePkg/AcpiTablesPCAT/AcpiTables.inf |  3 +-
 Vlv2DeviceRefCodePkg/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 9c00651..e9a7d80 100644
--- a/Vlv2DeviceRefCodePkg/AcpiTablesPCAT/AcpiTables.inf
+++ b/Vlv2DeviceRefCodePkg/AcpiTablesPCAT/AcpiTables.inf
@@ -3,11 +3,11 @@
 #
 # Build acpi table data required by system boot.
 #  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.
 # The full text of the license may be found at
 # http://opensource.org/licenses/bsd-license.php.
@@ -35,10 +35,11 @@
   Facp/Facp.aslc
   Madt/Madt30.aslc
   Mcfg/Mcfg.aslc
   Hpet/Hpet.aslc
   Lpit/Lpit.aslc
+  Wsmt/Wsmt.aslc
 
 
 [Packages]
   MdePkg/MdePkg.dec
   Vlv2TbltDevicePkg/PlatformPkg.dec
diff --git a/Vlv2DeviceRefCodePkg/AcpiTablesPCAT/Wsmt/Wsmt.aslc 
b/Vlv2DeviceRefCodePkg/AcpiTablesPCAT/Wsmt/Wsmt.aslc
new file mode 100644
index 0000000..4142201
--- /dev/null
+++ b/Vlv2DeviceRefCodePkg/AcpiTablesPCAT/Wsmt/Wsmt.aslc
@@ -0,0 +1,60 @@
+/*++
+  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
+
+  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 <IndustryStandard/WindowsSmmSecurityMitigationTable.h>
+
+//
+// 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 db1b5a5..8a883f2 100644
--- a/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c
+++ b/Vlv2TbltDevicePkg/AcpiPlatform/AcpiPlatform.c
@@ -56,10 +56,11 @@ Abstract:
 #include <Guid/AcpiTableStorage.h>
 #include <Guid/EfiVpdData.h>
 #include <PchAccess.h>
 #include <Guid/Vlv2Variable.h>
 #include <Guid/PlatformCpuInfo.h>
+#include <IndustryStandard/WindowsSmmSecurityMitigationTable.h>
 
 
 CHAR16    EfiPlatformCpuInfoVariable[] = L"PlatformCpuInfo";
 CHAR16    gACPIOSFRModelStringVariableName[] = 
ACPI_OSFR_MODEL_STRING_VARIABLE_NAME;
 CHAR16    gACPIOSFRRefDataBlockVariableName[] = 
ACPI_OSFR_REF_DATA_BLOCK_VARIABLE_NAME;
@@ -236,10 +237,11 @@ PlatformUpdateTables (
   UINTN                                                       LocalApicCounter;
   EFI_PROCESSOR_INFORMATION                                   
ProcessorInfoBuffer;
   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;
   ApicPtr                 = NULL;
   LocalApicCounter        = 0;
@@ -597,10 +599,21 @@ PlatformUpdateTables (
       }
       gBS->FreePool (OcurMfgStringBuffer);
       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.6.2.windows.1


_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to