]> git.proxmox.com Git - mirror_edk2.git/blob - UefiCpuPkg/Include/Library/SmmCpuPlatformHookLib.h
UefiCpuPkg: Add SmmCpuPlatformHookLib
[mirror_edk2.git] / UefiCpuPkg / Include / Library / SmmCpuPlatformHookLib.h
1 /** @file
2 Public include file for the SMM CPU Platform Hook Library.
3
4 Copyright (c) 2010 - 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_CPU_PLATFORM_HOOK_LIB_H__
16 #define __SMM_CPU_PLATFORM_HOOK_LIB_H__
17
18 ///
19 /// SMM Page Size Type
20 ///
21 typedef enum {
22 SmmPageSize4K,
23 SmmPageSize2M,
24 SmmPageSize1G,
25 MaxSmmPageSizeType
26 } SMM_PAGE_SIZE_TYPE;
27
28 /**
29 Checks if platform produces a valid SMI.
30
31 This function checks if platform produces a valid SMI. This function is
32 called at SMM entry to detect if this is a spurious SMI. This function
33 must be implemented in an MP safe way because it is called by multiple CPU
34 threads.
35
36 @retval TRUE There is a valid SMI
37 @retval FALSE There is no valid SMI
38
39 **/
40 BOOLEAN
41 EFIAPI
42 PlatformValidSmi (
43 VOID
44 );
45
46 /**
47 Clears platform top level SMI status bit.
48
49 This function clears platform top level SMI status bit.
50
51 @retval TRUE The platform top level SMI status is cleared.
52 @retval FALSE The platform top level SMI status cannot be cleared.
53
54 **/
55 BOOLEAN
56 EFIAPI
57 ClearTopLevelSmiStatus (
58 VOID
59 );
60
61 /**
62 Performs platform specific way of SMM BSP election.
63
64 This function performs platform specific way of SMM BSP election.
65
66 @param IsBsp Output parameter. TRUE: the CPU this function executes
67 on is elected to be the SMM BSP. FALSE: the CPU this
68 function executes on is to be SMM AP.
69
70 @retval EFI_SUCCESS The function executes successfully.
71 @retval EFI_NOT_READY The function does not determine whether this CPU should be
72 BSP or AP. This may occur if hardware init sequence to
73 enable the determination is yet to be done, or the function
74 chooses not to do BSP election and will let SMM CPU driver to
75 use its default BSP election process.
76 @retval EFI_DEVICE_ERROR The function cannot determine whether this CPU should be
77 BSP or AP due to hardware error.
78
79 **/
80 EFI_STATUS
81 EFIAPI
82 PlatformSmmBspElection (
83 OUT BOOLEAN *IsBsp
84 );
85
86 /**
87 Get platform page table attribute .
88
89 This function gets page table attribute of platform.
90
91 @param Address Input parameter. Obtain the page table entries attribute on this address.
92 @param PageSize Output parameter. The size of the page.
93 @param NumOfPages Output parameter. Number of page.
94 @param PageAttribute Output parameter. Paging Attributes (WB, UC, etc).
95
96 @retval EFI_SUCCESS The platform page table attribute from the address is determined.
97 @retval EFI_UNSUPPORTED The platform does not support getting page table attribute for the address.
98
99 **/
100 EFI_STATUS
101 EFIAPI
102 GetPlatformPageTableAttribute (
103 IN UINT64 Address,
104 OUT SMM_PAGE_SIZE_TYPE *PageSize,
105 OUT UINTN *NumOfPages,
106 OUT UINTN *PageAttribute
107 );
108
109 #endif