]> git.proxmox.com Git - mirror_edk2.git/blame - SecurityPkg/Tcg/Tcg2Smm/Tcg2TraditionalMm.c
SecurityPkg: Apply uncrustify changes
[mirror_edk2.git] / SecurityPkg / Tcg / Tcg2Smm / Tcg2TraditionalMm.c
CommitLineData
3c2dc30d
KQ
1/** @file\r
2 TCG2 SMM driver that updates TPM2 items in ACPI table and registers\r
3 SMI2 callback functions for Tcg2 physical presence, ClearMemory, and\r
4 sample for dTPM StartMethod.\r
5\r
6 Caution: This module requires additional review when modified.\r
7 This driver will have external input - variable and ACPINvs data in SMM mode.\r
8 This external input must be validated carefully to avoid security issue.\r
9\r
10 PhysicalPresenceCallback() and MemoryClearCallback() will receive untrusted input and do some check.\r
11\r
12Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>\r
13Copyright (c) Microsoft Corporation.\r
14SPDX-License-Identifier: BSD-2-Clause-Patent\r
15\r
16**/\r
17\r
18#include "Tcg2Smm.h"\r
19#include <Library/UefiBootServicesTableLib.h>\r
20#include <Library/SmmMemLib.h>\r
21\r
22/**\r
23 Notify the system that the SMM variable driver is ready.\r
24**/\r
25VOID\r
26Tcg2NotifyMmReady (\r
27 VOID\r
28 )\r
29{\r
c411b485
MK
30 EFI_STATUS Status;\r
31 EFI_HANDLE Handle;\r
3c2dc30d
KQ
32\r
33 Handle = NULL;\r
34 Status = gBS->InstallProtocolInterface (\r
35 &Handle,\r
36 &gTcg2MmSwSmiRegisteredGuid,\r
37 EFI_NATIVE_INTERFACE,\r
38 NULL\r
39 );\r
40 ASSERT_EFI_ERROR (Status);\r
41}\r
42\r
43/**\r
44 This function is an abstraction layer for implementation specific Mm buffer validation routine.\r
45\r
46 @param Buffer The buffer start address to be checked.\r
47 @param Length The buffer length to be checked.\r
48\r
49 @retval TRUE This buffer is valid per processor architecture and not overlap with SMRAM.\r
50 @retval FALSE This buffer is not valid per processor architecture or overlap with SMRAM.\r
51**/\r
52BOOLEAN\r
53IsBufferOutsideMmValid (\r
54 IN EFI_PHYSICAL_ADDRESS Buffer,\r
55 IN UINT64 Length\r
56 )\r
57{\r
58 return SmmIsBufferOutsideSmmValid (Buffer, Length);\r
59}\r
60\r
61/**\r
62 The driver's entry point.\r
63\r
64 It install callbacks for TPM physical presence and MemoryClear, and locate\r
65 SMM variable to be used in the callback function.\r
66\r
67 @param[in] ImageHandle The firmware allocated handle for the EFI image.\r
68 @param[in] SystemTable A pointer to the EFI System Table.\r
69\r
70 @retval EFI_SUCCESS The entry point is executed successfully.\r
71 @retval Others Some error occurs when executing this entry point.\r
72\r
73**/\r
74EFI_STATUS\r
75EFIAPI\r
76InitializeTcgSmm (\r
c411b485
MK
77 IN EFI_HANDLE ImageHandle,\r
78 IN EFI_SYSTEM_TABLE *SystemTable\r
3c2dc30d
KQ
79 )\r
80{\r
81 return InitializeTcgCommon ();\r
82}\r