]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.h
Revert "Add 2 APIs in SmmCpuFeaturesLib."
[mirror_edk2.git] / UefiCpuPkg / PiSmmCpuDxeSmm / SmmProfile.h
1 /** @file
2 SMM profile header file.
3
4 Copyright (c) 2012 - 2015, 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 **/
99 VOID
100 CheckFeatureSupported (
101 VOID
102 );
103
104 /**
105 Enable XD feature.
106
107 **/
108 VOID
109 ActivateXd (
110 VOID
111 );
112
113 /**
114 Update page table according to protected memory ranges and the 4KB-page mapped memory ranges.
115
116 **/
117 VOID
118 InitPaging (
119 VOID
120 );
121
122 /**
123 Check if XD and BTS features are supported by all processors.
124
125 **/
126 VOID
127 CheckProcessorFeature (
128 VOID
129 );
130
131 extern BOOLEAN mXdSupported;
132 extern BOOLEAN mXdEnabled;
133
134 #endif // _SMM_PROFILE_H_