]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.h
UefiCpuPkg/PiSmmCpuDxeSmm: Add EFIAPI to CheckFeatureSupported()
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / SmmProfile.h
1 /** @file
2 SMM profile header file.
3
4 Copyright (c) 2012 - 2016, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef _SMM_PROFILE_H_
16 #define _SMM_PROFILE_H_
17
18 #include "SmmProfileInternal.h"
19
20 ///
21 /// MSR Register Index
22 ///
23 #define MSR_IA32_MISC_ENABLE 0x1A0
24
25 //
26 // External functions
27 //
28
29 /**
30 Initialize processor environment for SMM profile.
31
32 @param CpuIndex The index of the processor.
33
34 **/
35 VOID
36 ActivateSmmProfile (
37 IN UINTN CpuIndex
38 );
39
40 /**
41 Initialize SMM profile in SMM CPU entry point.
42
43 @param[in] Cr3 The base address of the page tables to use in SMM.
44
45 **/
46 VOID
47 InitSmmProfile (
48 UINT32 Cr3
49 );
50
51 /**
52 Increase SMI number in each SMI entry.
53
54 **/
55 VOID
56 SmmProfileRecordSmiNum (
57 VOID
58 );
59
60 /**
61 The Page fault handler to save SMM profile data.
62
63 @param Rip The RIP when exception happens.
64 @param ErrorCode The Error code of exception.
65
66 **/
67 VOID
68 SmmProfilePFHandler (
69 UINTN Rip,
70 UINTN ErrorCode
71 );
72
73 /**
74 Updates page table to make some memory ranges (like system memory) absent
75 and make some memory ranges (like MMIO) present and execute disable. It also
76 update 2MB-page to 4KB-page for some memory ranges.
77
78 **/
79 VOID
80 SmmProfileStart (
81 VOID
82 );
83
84 /**
85 Page fault IDT handler for SMM Profile.
86
87 **/
88 VOID
89 EFIAPI
90 PageFaultIdtHandlerSmmProfile (
91 VOID
92 );
93
94
95 /**
96 Check if XD feature is supported by a processor.
97
98 @param[in,out] Buffer The pointer to private data buffer.
99
100 **/
101 VOID
102 EFIAPI
103 CheckFeatureSupported (
104 IN OUT VOID *Buffer
105 );
106
107 /**
108 Enable XD feature.
109
110 **/
111 VOID
112 ActivateXd (
113 VOID
114 );
115
116 /**
117 Update page table according to protected memory ranges and the 4KB-page mapped memory ranges.
118
119 **/
120 VOID
121 InitPaging (
122 VOID
123 );
124
125 /**
126 Check if XD and BTS features are supported by all processors.
127
128 **/
129 VOID
130 CheckProcessorFeature (
131 VOID
132 );
133
134 extern BOOLEAN mXdSupported;
135 extern BOOLEAN mXdEnabled;
136
137 #endif // _SMM_PROFILE_H_