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