2 SMM Control2 Protocol on SMM Control Protocol Thunk driver.
4 Copyright (c) 2009 Intel Corporation
5 All rights reserved. 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
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.
15 #include "SmmControl2OnSmmControlThunk.h"
17 EFI_SMM_CONTROL2_PROTOCOL gSmmControl2
= {
23 EFI_SMM_CONTROL_PROTOCOL
*mSmmControl
;
27 Invokes SMI activation from either the preboot or runtime environment.
29 This function generates an SMI.
31 @param[in] This The EFI_SMM_CONTROL2_PROTOCOL instance.
32 @param[in,out] CommandPort The value written to the command port.
33 @param[in,out] DataPort The value written to the data port.
34 @param[in] Periodic Optional mechanism to engender a periodic stream.
35 @param[in] ActivationInterval Optional parameter to repeat at this period one
36 time or, if the Periodic Boolean is set, periodically.
38 @retval EFI_SUCCESS The SMI/PMI has been engendered.
39 @retval EFI_DEVICE_ERROR The timing is unsupported.
40 @retval EFI_INVALID_PARAMETER The activation period is unsupported.
41 @retval EFI_NOT_STARTED The SMM base service has not been initialized.
46 IN CONST EFI_SMM_CONTROL2_PROTOCOL
*This
,
47 IN OUT UINT8
*CommandPort OPTIONAL
,
48 IN OUT UINT8
*DataPort OPTIONAL
,
49 IN BOOLEAN Periodic OPTIONAL
,
50 IN UINTN ActivationInterval OPTIONAL
53 UINTN ArgumentBufferSize
= 0;
55 if (CommandPort
!= NULL
) {
56 ArgumentBufferSize
= 1;
58 if (DataPort
!= NULL
) {
59 IoWrite8 (mDataPort
, *DataPort
);
61 return mSmmControl
->Trigger (mSmmControl
, (INT8
*)CommandPort
, &ArgumentBufferSize
, Periodic
, ActivationInterval
);
65 Clears any system state that was created in response to the Trigger() call.
67 This function acknowledges and causes the deassertion of the SMI activation source.
69 @param[in] This The EFI_SMM_CONTROL2_PROTOCOL instance.
70 @param[in] Periodic Optional parameter to repeat at this period one time
72 @retval EFI_SUCCESS The SMI/PMI has been engendered.
73 @retval EFI_DEVICE_ERROR The source could not be cleared.
74 @retval EFI_INVALID_PARAMETER The service did not support the Periodic input argument.
79 IN CONST EFI_SMM_CONTROL2_PROTOCOL
*This
,
80 IN BOOLEAN Periodic OPTIONAL
83 return mSmmControl
->Clear (mSmmControl
, Periodic
);
87 Entry Point for this thunk driver.
89 @param[in] ImageHandle Image handle of this driver.
90 @param[in] SystemTable A Pointer to the EFI System Table.
92 @retval EFI_SUCCESS The entry point is executed successfully.
93 @retval other Some error occurred when executing this entry point.
97 SmmControl2ThunkMain (
98 IN EFI_HANDLE ImageHandle
,
99 IN EFI_SYSTEM_TABLE
*SystemTable
103 EFI_SMM_CONTROL_REGISTER RegisterInfo
;
106 /// Locate Framework SMM Control Protocol
108 Status
= gBS
->LocateProtocol (&gEfiSmmControlProtocolGuid
, NULL
, (VOID
**)&mSmmControl
);
109 ASSERT_EFI_ERROR (Status
);
111 gSmmControl2
.MinimumTriggerPeriod
= mSmmControl
->MinimumTriggerPeriod
;
113 Status
= mSmmControl
->GetRegisterInfo (mSmmControl
, &RegisterInfo
);
114 ASSERT_EFI_ERROR (Status
);
115 mDataPort
= RegisterInfo
.SmiDataRegister
;
118 /// Publish framework SMM Control Protocol
120 Status
= gBS
->InstallProtocolInterface (
122 &gEfiSmmControl2ProtocolGuid
,
123 EFI_NATIVE_INTERFACE
,