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