summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Core/PiSmmCore/Smi.c
diff options
context:
space:
mode:
authorJiewen Yao <jiewen.yao@intel.com>2017-01-20 06:14:40 -0800
committerJiewen Yao <jiewen.yao@intel.com>2017-02-22 15:28:18 +0800
commitca41f3f43f7477d6746e4bf59e9b346685924cee (patch)
tree899d71c807c2f6703249b55c9c219e83b857c94c /MdeModulePkg/Core/PiSmmCore/Smi.c
parente08bfc7d6f82a3077125c4b6fb9b906c3e018e47 (diff)
downloadedk2-ca41f3f43f7477d6746e4bf59e9b346685924cee.tar.gz
edk2-ca41f3f43f7477d6746e4bf59e9b346685924cee.tar.bz2
edk2-ca41f3f43f7477d6746e4bf59e9b346685924cee.zip
MdeModulePkg/PiSmmCore: Add SmiHandlerProfile support.
1) SmmCore maintains the root SMI handler and NULL SMI handler database. 2) SmmCore consumes PcdSmiHandlerProfilePropertyMask to decide if SmmCore need support SMI handler profile. If SMI handler profile is supported, the SmmCore installs SMI handler profile protocol and SMI handler profile communication handler. 3) SMI handler profile protocol will record the hardware SMI handler profile registered by SmmChildDispatcher. 4) SMI handler profile communication handler will return all SMI handler profile info (NULL SMI handler, GUID SMI handler, and hardware SMI handler) Cc: Feng Tian <feng.tian@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Laszlo Ersek <lersek@redhat.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao <jiewen.yao@intel.com> Reviewed-by: Star Zeng <star.zeng@intel.com>
Diffstat (limited to 'MdeModulePkg/Core/PiSmmCore/Smi.c')
-rw-r--r--MdeModulePkg/Core/PiSmmCore/Smi.c46
1 files changed, 13 insertions, 33 deletions
diff --git a/MdeModulePkg/Core/PiSmmCore/Smi.c b/MdeModulePkg/Core/PiSmmCore/Smi.c
index 816d0f5193..ad483a1877 100644
--- a/MdeModulePkg/Core/PiSmmCore/Smi.c
+++ b/MdeModulePkg/Core/PiSmmCore/Smi.c
@@ -1,7 +1,7 @@
/** @file
SMI management.
- Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2017, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
@@ -14,32 +14,15 @@
#include "PiSmmCore.h"
-//
-// SMM_HANDLER - used for each SMM handler
-//
-
-#define SMI_ENTRY_SIGNATURE SIGNATURE_32('s','m','i','e')
-
- typedef struct {
- UINTN Signature;
- LIST_ENTRY AllEntries; // All entries
-
- EFI_GUID HandlerType; // Type of interrupt
- LIST_ENTRY SmiHandlers; // All handlers
-} SMI_ENTRY;
-
-#define SMI_HANDLER_SIGNATURE SIGNATURE_32('s','m','i','h')
-
- typedef struct {
- UINTN Signature;
- LIST_ENTRY Link; // Link on SMI_ENTRY.SmiHandlers
- EFI_SMM_HANDLER_ENTRY_POINT2 Handler; // The smm handler's entry point
- SMI_ENTRY *SmiEntry;
-} SMI_HANDLER;
-
-LIST_ENTRY mRootSmiHandlerList = INITIALIZE_LIST_HEAD_VARIABLE (mRootSmiHandlerList);
LIST_ENTRY mSmiEntryList = INITIALIZE_LIST_HEAD_VARIABLE (mSmiEntryList);
+SMI_ENTRY mRootSmiEntry = {
+ SMI_ENTRY_SIGNATURE,
+ INITIALIZE_LIST_HEAD_VARIABLE (mRootSmiEntry.AllEntries),
+ {0},
+ INITIALIZE_LIST_HEAD_VARIABLE (mRootSmiEntry.SmiHandlers),
+};
+
/**
Finds the SMI entry for the requested handler type.
@@ -137,8 +120,7 @@ SmiManage (
//
// Root SMI handler
//
-
- Head = &mRootSmiHandlerList;
+ SmiEntry = &mRootSmiEntry;
} else {
//
// Non-root SMI handler
@@ -150,9 +132,8 @@ SmiManage (
//
return Status;
}
-
- Head = &SmiEntry->SmiHandlers;
}
+ Head = &SmiEntry->SmiHandlers;
for (Link = Head->ForwardLink; Link != Head; Link = Link->ForwardLink) {
SmiHandler = CR (Link, SMI_HANDLER, Link, SMI_HANDLER_SIGNATURE);
@@ -252,13 +233,13 @@ SmiHandlerRegister (
SmiHandler->Signature = SMI_HANDLER_SIGNATURE;
SmiHandler->Handler = Handler;
+ SmiHandler->CallerAddr = (UINTN)RETURN_ADDRESS (0);
if (HandlerType == NULL) {
//
// This is root SMI handler
//
- SmiEntry = NULL;
- List = &mRootSmiHandlerList;
+ SmiEntry = &mRootSmiEntry;
} else {
//
// None root SMI handler
@@ -267,9 +248,8 @@ SmiHandlerRegister (
if (SmiEntry == NULL) {
return EFI_OUT_OF_RESOURCES;
}
-
- List = &SmiEntry->SmiHandlers;
}
+ List = &SmiEntry->SmiHandlers;
SmiHandler->SmiEntry = SmiEntry;
InsertTailList (List, &SmiHandler->Link);