mirror of https://github.com/acidanthera/audk.git
QuarkSocPkg/QncSmmDispatcher: Fix context passed to SMI handlers
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>
This commit is contained in:
parent
f9c3b1b534
commit
29f169d17a
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
File to contain all the hardware specific stuff for the Periodical Timer dispatch protocol.
|
File to contain all the hardware specific stuff for the Periodical Timer dispatch protocol.
|
||||||
|
|
||||||
Copyright (c) 2013-2015 Intel Corporation.
|
Copyright (c) 2013-2016 Intel Corporation.
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -177,7 +177,7 @@ PeriodicTimerGetContext (
|
||||||
// Update the elapsed time w/ the data from our tables
|
// Update the elapsed time w/ the data from our tables
|
||||||
//
|
//
|
||||||
Record->CommBuffer.PeriodicTimer.ElapsedTime += TimerInterval->Interval;
|
Record->CommBuffer.PeriodicTimer.ElapsedTime += TimerInterval->Interval;
|
||||||
*HwContext = Record->ChildContext;
|
CopyMem (HwContext, &Record->ChildContext, sizeof (QNC_SMM_CONTEXT));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Prototypes and defines for the QNC SMM Dispatcher.
|
Prototypes and defines for the QNC SMM Dispatcher.
|
||||||
|
|
||||||
Copyright (c) 2013-2015 Intel Corporation.
|
Copyright (c) 2013-2016 Intel Corporation.
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -396,8 +396,9 @@ struct _DATABASE_RECORD {
|
||||||
// Callback function
|
// Callback function
|
||||||
//
|
//
|
||||||
EFI_SMM_HANDLER_ENTRY_POINT2 Callback;
|
EFI_SMM_HANDLER_ENTRY_POINT2 Callback;
|
||||||
QNC_SMM_CONTEXT ChildContext;
|
QNC_SMM_CONTEXT ChildContext;
|
||||||
QNC_SMM_BUFFER CommBuffer;
|
VOID *CallbackContext;
|
||||||
|
QNC_SMM_BUFFER CommBuffer;
|
||||||
UINTN BufferSize;
|
UINTN BufferSize;
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
This driver is responsible for the registration of child drivers
|
This driver is responsible for the registration of child drivers
|
||||||
and the abstraction of the QNC SMI sources.
|
and the abstraction of the QNC SMI sources.
|
||||||
|
|
||||||
Copyright (c) 2013-2015 Intel Corporation.
|
Copyright (c) 2013-2016 Intel Corporation.
|
||||||
|
|
||||||
This program and the accompanying materials
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
are licensed and made available under the terms and conditions of the BSD License
|
||||||
|
@ -351,7 +351,8 @@ Returns:
|
||||||
// Gather information about the registration request
|
// Gather information about the registration request
|
||||||
//
|
//
|
||||||
Record->Callback = DispatchFunction;
|
Record->Callback = DispatchFunction;
|
||||||
Record->ChildContext = *RegisterContext;
|
Record->CallbackContext = RegisterContext;
|
||||||
|
CopyMem (&Record->ChildContext, RegisterContext, sizeof (QNC_SMM_CONTEXT));
|
||||||
|
|
||||||
Qualified = QUALIFIED_PROTOCOL_FROM_GENERIC (This);
|
Qualified = QUALIFIED_PROTOCOL_FROM_GENERIC (This);
|
||||||
|
|
||||||
|
@ -407,7 +408,7 @@ Returns:
|
||||||
//
|
//
|
||||||
// Update ChildContext again as SwSmiInputValue has been changed
|
// Update ChildContext again as SwSmiInputValue has been changed
|
||||||
//
|
//
|
||||||
Record->ChildContext = *RegisterContext;
|
CopyMem (&Record->ChildContext, RegisterContext, sizeof (QNC_SMM_CONTEXT));
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -688,7 +689,6 @@ QNCSmmCoreDispatcher (
|
||||||
// it supplied in registration. Simply pass back what it gave us.
|
// it supplied in registration. Simply pass back what it gave us.
|
||||||
//
|
//
|
||||||
ASSERT (RecordToExhaust->Callback != NULL);
|
ASSERT (RecordToExhaust->Callback != NULL);
|
||||||
Context = RecordToExhaust->ChildContext;
|
|
||||||
ContextsMatch = TRUE;
|
ContextsMatch = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -710,7 +710,7 @@ QNCSmmCoreDispatcher (
|
||||||
|
|
||||||
RecordToExhaust->Callback (
|
RecordToExhaust->Callback (
|
||||||
(EFI_HANDLE) & RecordToExhaust->Link,
|
(EFI_HANDLE) & RecordToExhaust->Link,
|
||||||
&Context,
|
RecordToExhaust->CallbackContext,
|
||||||
CommunicationBuffer,
|
CommunicationBuffer,
|
||||||
&BufferSize
|
&BufferSize
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in New Issue