https://bugzilla.tianocore.org/show_bug.cgi?id=136
1) Add CallbackContext field to the DATABASE_RECORD structure that
is set to the RegisterContent value passed to QNCSmmCoreRegister().
This is the content that must be passed to the SMI handler when
its source is triggered.
2) Update usage of ChildContext field in the DATABASE_RECOD to use
CopyMem() instead of structure assignments to avoid compiler
use of memcpy() intrinsics
This issue was reproduced using the unit test at:
https://github.com/mdkinney/edk2/tree/Bug51/Reproduce
An ASSERT() is generated the first time the periodic SMI
handler is triggered. After applying this patch, the
DEBUG() messages from the periodic SMI handler in this
unit test are generated.
Cc: Kelly Steele <kelly.steele@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Kelly Steele <kelly.steele@intel.com>
/** @file\r
File to contain all the hardware specific stuff for the Periodical Timer dispatch protocol.\r
\r
/** @file\r
File to contain all the hardware specific stuff for the Periodical Timer dispatch protocol.\r
\r
-Copyright (c) 2013-2015 Intel Corporation.\r
+Copyright (c) 2013-2016 Intel Corporation.\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
// Update the elapsed time w/ the data from our tables\r
//\r
Record->CommBuffer.PeriodicTimer.ElapsedTime += TimerInterval->Interval;\r
// Update the elapsed time w/ the data from our tables\r
//\r
Record->CommBuffer.PeriodicTimer.ElapsedTime += TimerInterval->Interval;\r
- *HwContext = Record->ChildContext;\r
+ CopyMem (HwContext, &Record->ChildContext, sizeof (QNC_SMM_CONTEXT));\r
/** @file\r
Prototypes and defines for the QNC SMM Dispatcher.\r
\r
/** @file\r
Prototypes and defines for the QNC SMM Dispatcher.\r
\r
-Copyright (c) 2013-2015 Intel Corporation.\r
+Copyright (c) 2013-2016 Intel Corporation.\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
// Callback function\r
//\r
EFI_SMM_HANDLER_ENTRY_POINT2 Callback;\r
// Callback function\r
//\r
EFI_SMM_HANDLER_ENTRY_POINT2 Callback;\r
- QNC_SMM_CONTEXT ChildContext;\r
- QNC_SMM_BUFFER CommBuffer;\r
+ QNC_SMM_CONTEXT ChildContext;\r
+ VOID *CallbackContext;\r
+ QNC_SMM_BUFFER CommBuffer;\r
UINTN BufferSize;\r
\r
//\r
UINTN BufferSize;\r
\r
//\r
This driver is responsible for the registration of child drivers\r
and the abstraction of the QNC SMI sources.\r
\r
This driver is responsible for the registration of child drivers\r
and the abstraction of the QNC SMI sources.\r
\r
-Copyright (c) 2013-2015 Intel Corporation.\r
+Copyright (c) 2013-2016 Intel Corporation.\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
// Gather information about the registration request\r
//\r
Record->Callback = DispatchFunction;\r
// Gather information about the registration request\r
//\r
Record->Callback = DispatchFunction;\r
- Record->ChildContext = *RegisterContext;\r
+ Record->CallbackContext = RegisterContext;\r
+ CopyMem (&Record->ChildContext, RegisterContext, sizeof (QNC_SMM_CONTEXT));\r
\r
Qualified = QUALIFIED_PROTOCOL_FROM_GENERIC (This);\r
\r
\r
Qualified = QUALIFIED_PROTOCOL_FROM_GENERIC (This);\r
\r
//\r
// Update ChildContext again as SwSmiInputValue has been changed\r
//\r
//\r
// Update ChildContext again as SwSmiInputValue has been changed\r
//\r
- Record->ChildContext = *RegisterContext;\r
+ CopyMem (&Record->ChildContext, RegisterContext, sizeof (QNC_SMM_CONTEXT));\r
// it supplied in registration. Simply pass back what it gave us.\r
//\r
ASSERT (RecordToExhaust->Callback != NULL);\r
// it supplied in registration. Simply pass back what it gave us.\r
//\r
ASSERT (RecordToExhaust->Callback != NULL);\r
- Context = RecordToExhaust->ChildContext;\r
ContextsMatch = TRUE;\r
}\r
\r
ContextsMatch = TRUE;\r
}\r
\r
\r
RecordToExhaust->Callback (\r
(EFI_HANDLE) & RecordToExhaust->Link,\r
\r
RecordToExhaust->Callback (\r
(EFI_HANDLE) & RecordToExhaust->Link,\r
+ RecordToExhaust->CallbackContext,\r
CommunicationBuffer,\r
&BufferSize\r
);\r
CommunicationBuffer,\r
&BufferSize\r
);\r