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