1 /** @file
2   EFI SMM Configuration Protocol as defined in the PI 1.2 specification.
3 
4   This protocol is used to:
5   1) report the portions of SMRAM regions which cannot be used for the SMRAM heap.
6   2) register the SMM Foundation entry point with the processor code. The entry
7      point will be invoked by the SMM processor entry code.
8 
9   Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
10   SPDX-License-Identifier: BSD-2-Clause-Patent
11 
12 **/
13 
14 #ifndef _SMM_CONFIGURATION_H_
15 #define _SMM_CONFIGURATION_H_
16 
17 #include <Protocol/MmConfiguration.h>
18 #include <Pi/PiSmmCis.h>
19 
20 #define EFI_SMM_CONFIGURATION_PROTOCOL_GUID EFI_MM_CONFIGURATION_PROTOCOL_GUID
21 
22 ///
23 /// Structure describing a SMRAM region which cannot be used for the SMRAM heap.
24 ///
25 typedef struct _EFI_SMM_RESERVED_SMRAM_REGION {
26   ///
27   /// Starting address of the reserved SMRAM area, as it appears while SMRAM is open.
28   /// Ignored if SmramReservedSize is 0.
29   ///
30   EFI_PHYSICAL_ADDRESS    SmramReservedStart;
31   ///
32   /// Number of bytes occupied by the reserved SMRAM area. A size of zero indicates the
33   /// last SMRAM area.
34   ///
35   UINT64                  SmramReservedSize;
36 } EFI_SMM_RESERVED_SMRAM_REGION;
37 
38 typedef struct _EFI_SMM_CONFIGURATION_PROTOCOL  EFI_SMM_CONFIGURATION_PROTOCOL;
39 
40 /**
41   Register the SMM Foundation entry point.
42 
43   This function registers the SMM Foundation entry point with the processor code. This entry point
44   will be invoked by the SMM Processor entry code.
45 
46   @param[in] This                The EFI_SMM_CONFIGURATION_PROTOCOL instance.
47   @param[in] SmmEntryPoint       SMM Foundation entry point.
48 
49   @retval EFI_SUCCESS            Success to register SMM Entry Point.
50   @retval EFI_INVALID_PARAMETER  SmmEntryPoint is NULL.
51 **/
52 typedef
53 EFI_STATUS
54 (EFIAPI *EFI_SMM_REGISTER_SMM_ENTRY)(
55   IN CONST EFI_SMM_CONFIGURATION_PROTOCOL  *This,
56   IN EFI_SMM_ENTRY_POINT                   SmmEntryPoint
57   );
58 
59 ///
60 /// The EFI SMM Configuration Protocol is a mandatory protocol published by a DXE CPU driver to
61 /// indicate which areas within SMRAM are reserved for use by the CPU for any purpose,
62 /// such as stack, save state or SMM entry point.
63 ///
64 /// The RegisterSmmEntry() function allows the SMM IPL DXE driver to register the SMM
65 /// Foundation entry point with the SMM entry vector code.
66 ///
67 struct _EFI_SMM_CONFIGURATION_PROTOCOL {
68   ///
69   /// A pointer to an array SMRAM ranges used by the initial SMM entry code.
70   ///
71   EFI_SMM_RESERVED_SMRAM_REGION  *SmramReservedRegions;
72   EFI_SMM_REGISTER_SMM_ENTRY     RegisterSmmEntry;
73 };
74 
75 extern EFI_GUID gEfiSmmConfigurationProtocolGuid;
76 
77 #endif
78 
79