1 /** @file
2   EFI SMM Control2 Protocol as defined in the PI 1.2 specification.
3 
4   This protocol is used initiate synchronous SMI activations. This protocol could be published by a
5   processor driver to abstract the SMI IPI or a driver which abstracts the ASIC that is supporting the
6   APM port. Because of the possibility of performing SMI IPI transactions, the ability to generate this
7   event from a platform chipset agent is an optional capability for both IA-32 and x64-based systems.
8 
9   The EFI_SMM_CONTROL2_PROTOCOL is produced by a runtime driver. It provides  an
10   abstraction of the platform hardware that generates an SMI.  There are often I/O ports that, when
11   accessed, will generate the SMI.  Also, the hardware optionally supports the periodic generation of
12   these signals.
13 
14   Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>
15   This program and the accompanying materials
16   are licensed and made available under the terms and conditions of the BSD License
17   which accompanies this distribution.  The full text of the license may be found at
18   http://opensource.org/licenses/bsd-license.php
19 
20   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
21   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
22 
23 **/
24 
25 #ifndef _SMM_CONTROL2_H_
26 #define _SMM_CONTROL2_H_
27 
28 #include <PiDxe.h>
29 
30 #define EFI_SMM_CONTROL2_PROTOCOL_GUID \
31   { \
32     0x843dc720, 0xab1e, 0x42cb, {0x93, 0x57, 0x8a, 0x0, 0x78, 0xf3, 0x56, 0x1b}  \
33   }
34 
35 typedef struct _EFI_SMM_CONTROL2_PROTOCOL  EFI_SMM_CONTROL2_PROTOCOL;
36 typedef UINTN  EFI_SMM_PERIOD;
37 
38 /**
39   Invokes SMI activation from either the preboot or runtime environment.
40 
41   This function generates an SMI.
42 
43   @param[in]     This                The EFI_SMM_CONTROL2_PROTOCOL instance.
44   @param[in,out] CommandPort         The value written to the command port.
45   @param[in,out] DataPort            The value written to the data port.
46   @param[in]     Periodic            Optional mechanism to engender a periodic stream.
47   @param[in]     ActivationInterval  Optional parameter to repeat at this period one
48                                      time or, if the Periodic Boolean is set, periodically.
49 
50   @retval EFI_SUCCESS            The SMI/PMI has been engendered.
51   @retval EFI_DEVICE_ERROR       The timing is unsupported.
52   @retval EFI_INVALID_PARAMETER  The activation period is unsupported.
53   @retval EFI_INVALID_PARAMETER  The last periodic activation has not been cleared.
54   @retval EFI_NOT_STARTED        The SMM base service has not been initialized.
55 **/
56 typedef
57 EFI_STATUS
58 (EFIAPI *EFI_SMM_ACTIVATE2)(
59   IN CONST EFI_SMM_CONTROL2_PROTOCOL  *This,
60   IN OUT UINT8                        *CommandPort       OPTIONAL,
61   IN OUT UINT8                        *DataPort          OPTIONAL,
62   IN BOOLEAN                          Periodic           OPTIONAL,
63   IN UINTN                            ActivationInterval OPTIONAL
64   );
65 
66 /**
67   Clears any system state that was created in response to the Trigger() call.
68 
69   This function acknowledges and causes the deassertion of the SMI activation source.
70 
71   @param[in] This                The EFI_SMM_CONTROL2_PROTOCOL instance.
72   @param[in] Periodic            Optional parameter to repeat at this period one time
73 
74   @retval EFI_SUCCESS            The SMI/PMI has been engendered.
75   @retval EFI_DEVICE_ERROR       The source could not be cleared.
76   @retval EFI_INVALID_PARAMETER  The service did not support the Periodic input argument.
77 **/
78 typedef
79 EFI_STATUS
80 (EFIAPI *EFI_SMM_DEACTIVATE2)(
81   IN CONST EFI_SMM_CONTROL2_PROTOCOL  *This,
82   IN BOOLEAN                          Periodic OPTIONAL
83   );
84 
85 ///
86 /// The EFI_SMM_CONTROL2_PROTOCOL is produced by a runtime driver. It provides  an
87 /// abstraction of the platform hardware that generates an SMI.  There are often I/O ports that, when
88 /// accessed, will generate the SMI.  Also, the hardware optionally supports the periodic generation of
89 /// these signals.
90 ///
91 struct _EFI_SMM_CONTROL2_PROTOCOL {
92   EFI_SMM_ACTIVATE2    Trigger;
93   EFI_SMM_DEACTIVATE2  Clear;
94   ///
95   /// Minimum interval at which the platform can set the period.  A maximum is not
96   /// specified in that the SMM infrastructure code can emulate a maximum interval that is
97   /// greater than the hardware capabilities by using software emulation in the SMM
98   /// infrastructure code.
99   ///
100   EFI_SMM_PERIOD      MinimumTriggerPeriod;
101 };
102 
103 extern EFI_GUID gEfiSmmControl2ProtocolGuid;
104 
105 #endif
106 
107