]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/Library/PchSmmLib/PchSmmLib.c
Vlv2TbltDevicePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / Vlv2TbltDevicePkg / Library / PchSmmLib / PchSmmLib.c
1 /** @file
2 PCH Smm Library Services that implements both S/W SMI generation and detection.
3
4 Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
5
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8
9
10 **/
11
12
13 #include "CommonHeader.h"
14
15
16 /**
17 Triggers a run time or boot time SMI.
18
19 This function triggers a software SMM interrupt and set the APMC status with an 8-bit Data.
20
21 @param Data The value to set the APMC status.
22
23 **/
24 VOID
25 InternalTriggerSmi (
26 IN UINT8 Data
27 )
28 {
29 ASSERT(FALSE);
30 }
31
32
33 /**
34 Triggers an SMI at boot time.
35
36 This function triggers a software SMM interrupt at boot time.
37
38 **/
39 VOID
40 EFIAPI
41 TriggerBootServiceSoftwareSmi (
42 VOID
43 )
44 {
45 ASSERT(FALSE);
46 }
47
48
49 /**
50 Triggers an SMI at run time.
51
52 This function triggers a software SMM interrupt at run time.
53
54 **/
55 VOID
56 EFIAPI
57 TriggerRuntimeSoftwareSmi (
58 VOID
59 )
60 {
61 ASSERT(FALSE);
62 }
63
64
65 /**
66 Gets the software SMI data.
67
68 This function tests if a software SMM interrupt happens. If a software SMI happens,
69 it retrieves the SMM data and returns it as a non-negative value; otherwise a negative
70 value is returned.
71
72 @return Data The data retrieved from SMM data port in case of a software SMI;
73 otherwise a negative value.
74
75 **/
76 INTN
77 InternalGetSwSmiData (
78 VOID
79 )
80 {
81 ASSERT(FALSE);
82 return -1;
83 }
84
85
86 /**
87 Test if a boot time software SMI happened.
88
89 This function tests if a software SMM interrupt happened. If a software SMM interrupt happened and
90 it was triggered at boot time, it returns TRUE. Otherwise, it returns FALSE.
91
92 @retval TRUE A software SMI triggered at boot time happened.
93 @retval FLASE No software SMI happened or the software SMI was triggered at run time.
94
95 **/
96 BOOLEAN
97 EFIAPI
98 IsBootServiceSoftwareSmi (
99 VOID
100 )
101 {
102 ASSERT(FALSE);
103 return FALSE;
104 }
105
106
107 /**
108 Test if a run time software SMI happened.
109
110 This function tests if a software SMM interrupt happened. If a software SMM interrupt happened and
111 it was triggered at run time, it returns TRUE. Otherwise, it returns FALSE.
112
113 @retval TRUE A software SMI triggered at run time happened.
114 @retval FLASE No software SMI happened or the software SMI was triggered at boot time.
115
116 **/
117 BOOLEAN
118 EFIAPI
119 IsRuntimeSoftwareSmi (
120 VOID
121 )
122 {
123 ASSERT(FALSE);
124 return FALSE;
125 }
126
127
128 /**
129
130 Clear APM SMI Status Bit; Set the EOS bit.
131
132 **/
133 VOID
134 EFIAPI
135 ClearSmi (
136 VOID
137 )
138 {
139
140 UINT16 PmBase;
141
142 //
143 // Get PMBase
144 //
145 PmBase = PcdGet16 (PcdPchAcpiIoPortBaseAddress);
146
147 //
148 // Clear the APM SMI Status Bit
149 //
150 IoWrite16 (PmBase + R_PCH_ACPI_SMI_STS, B_PCH_ACPI_APM_STS);
151
152 //
153 // Set the EOS Bit
154 //
155 IoOr32 (PmBase + R_PCH_ACPI_SMI_EN, B_PCH_ACPI_EOS);
156 }
157