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