]> git.proxmox.com Git - mirror_edk2.git/blob - Vlv2TbltDevicePkg/Library/PchSmmLib/PchSmmLib.c
Upload BSD-licensed Vlv2TbltDevicePkg and Vlv2DeviceRefCodePkg to
[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 This program and the accompanying materials are licensed and made available under
7 the terms and conditions of the BSD License that accompanies this distribution.
8 The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php.
10
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
13
14
15 **/
16
17
18 #include "CommonHeader.h"
19
20
21 /**
22 Triggers a run time or boot time SMI.
23
24 This function triggers a software SMM interrupt and set the APMC status with an 8-bit Data.
25
26 @param Data The value to set the APMC status.
27
28 **/
29 VOID
30 InternalTriggerSmi (
31 IN UINT8 Data
32 )
33 {
34 ASSERT(FALSE);
35 }
36
37
38 /**
39 Triggers an SMI at boot time.
40
41 This function triggers a software SMM interrupt at boot time.
42
43 **/
44 VOID
45 EFIAPI
46 TriggerBootServiceSoftwareSmi (
47 VOID
48 )
49 {
50 ASSERT(FALSE);
51 }
52
53
54 /**
55 Triggers an SMI at run time.
56
57 This function triggers a software SMM interrupt at run time.
58
59 **/
60 VOID
61 EFIAPI
62 TriggerRuntimeSoftwareSmi (
63 VOID
64 )
65 {
66 ASSERT(FALSE);
67 }
68
69
70 /**
71 Gets the software SMI data.
72
73 This function tests if a software SMM interrupt happens. If a software SMI happens,
74 it retrieves the SMM data and returns it as a non-negative value; otherwise a negative
75 value is returned.
76
77 @return Data The data retrieved from SMM data port in case of a software SMI;
78 otherwise a negative value.
79
80 **/
81 INTN
82 InternalGetSwSmiData (
83 VOID
84 )
85 {
86 ASSERT(FALSE);
87 return -1;
88 }
89
90
91 /**
92 Test if a boot time software SMI happened.
93
94 This function tests if a software SMM interrupt happened. If a software SMM interrupt happened and
95 it was triggered at boot time, it returns TRUE. Otherwise, it returns FALSE.
96
97 @retval TRUE A software SMI triggered at boot time happened.
98 @retval FLASE No software SMI happened or the software SMI was triggered at run time.
99
100 **/
101 BOOLEAN
102 EFIAPI
103 IsBootServiceSoftwareSmi (
104 VOID
105 )
106 {
107 ASSERT(FALSE);
108 return FALSE;
109 }
110
111
112 /**
113 Test if a run time software SMI happened.
114
115 This function tests if a software SMM interrupt happened. If a software SMM interrupt happened and
116 it was triggered at run time, it returns TRUE. Otherwise, it returns FALSE.
117
118 @retval TRUE A software SMI triggered at run time happened.
119 @retval FLASE No software SMI happened or the software SMI was triggered at boot time.
120
121 **/
122 BOOLEAN
123 EFIAPI
124 IsRuntimeSoftwareSmi (
125 VOID
126 )
127 {
128 ASSERT(FALSE);
129 return FALSE;
130 }
131
132
133 /**
134
135 Clear APM SMI Status Bit; Set the EOS bit.
136
137 **/
138 VOID
139 EFIAPI
140 ClearSmi (
141 VOID
142 )
143 {
144
145 UINT16 PmBase;
146
147 //
148 // Get PMBase
149 //
150 PmBase = PcdGet16 (PcdPchAcpiIoPortBaseAddress);
151
152 //
153 // Clear the APM SMI Status Bit
154 //
155 IoWrite16 (PmBase + R_PCH_ACPI_SMI_STS, B_PCH_ACPI_APM_STS);
156
157 //
158 // Set the EOS Bit
159 //
160 IoOr32 (PmBase + R_PCH_ACPI_SMI_EN, B_PCH_ACPI_EOS);
161 }
162