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