public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/2] Add SmiHandlerProfile on Quark.
@ 2017-03-16 14:04 Jiewen Yao
  2017-03-16 14:04 ` [PATCH 1/2] QuarkSocPkg/SmmChildDispatch: Add SmiHandlerProfile support Jiewen Yao
  2017-03-16 14:04 ` [PATCH 2/2] QuarkPlatformPkg: enable SmiHandlerProfile Jiewen Yao
  0 siblings, 2 replies; 3+ messages in thread
From: Jiewen Yao @ 2017-03-16 14:04 UTC (permalink / raw)
  To: edk2-devel; +Cc: Michael D Kinney, Kelly Steele

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Kelly Steele <kelly.steele@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>

Jiewen Yao (2):
  QuarkSocPkg/SmmChildDispatch: Add SmiHandlerProfile support.
  QuarkPlatformPkg: enable SmiHandlerProfile.

 QuarkPlatformPkg/Quark.dsc                                                     | 14 +++++++
 QuarkPlatformPkg/Quark.fdf                                                     |  3 +-
 QuarkPlatformPkg/QuarkMin.dsc                                                  |  3 ++
 QuarkPlatformPkg/Readme.md                                                     | 29 ++++++++------
 QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c         | 41 +++++++++++++++++++-
 QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmDispatcher.inf |  3 +-
 6 files changed, 78 insertions(+), 15 deletions(-)

-- 
2.7.4.windows.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH 1/2] QuarkSocPkg/SmmChildDispatch: Add SmiHandlerProfile support.
  2017-03-16 14:04 [PATCH 0/2] Add SmiHandlerProfile on Quark Jiewen Yao
@ 2017-03-16 14:04 ` Jiewen Yao
  2017-03-16 14:04 ` [PATCH 2/2] QuarkPlatformPkg: enable SmiHandlerProfile Jiewen Yao
  1 sibling, 0 replies; 3+ messages in thread
From: Jiewen Yao @ 2017-03-16 14:04 UTC (permalink / raw)
  To: edk2-devel; +Cc: Michael D Kinney, Kelly Steele

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Kelly Steele <kelly.steele@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
---
 QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c         | 41 +++++++++++++++++++-
 QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmDispatcher.inf |  3 +-
 2 files changed, 41 insertions(+), 3 deletions(-)

diff --git a/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c b/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c
index c2f75f8..0a8239c 100644
--- a/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c
+++ b/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c
@@ -2,7 +2,7 @@
 This driver is responsible for the registration of child drivers
 and the abstraction of the QNC SMI sources.
 
-Copyright (c) 2013-2016 Intel Corporation.
+Copyright (c) 2013-2017 Intel Corporation.
 
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD License
@@ -23,6 +23,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "QNCSmm.h"
 #include "QNCSmmHelpers.h"
 
+#include <Library/SmiHandlerProfileLib.h>
+
 //
 // /////////////////////////////////////////////////////////////////////////////
 // MODULE / GLOBAL DATA
@@ -331,6 +333,7 @@ Returns:
   DATABASE_RECORD             *Record;
   QNC_SMM_QUALIFIED_PROTOCOL  *Qualified;
   INTN                        Index;
+  UINTN                       ContextSize;
 
   //
   // Check for invalid parameter
@@ -363,6 +366,7 @@ Returns:
   // Perform linked list housekeeping
   //
   Record->Signature = DATABASE_RECORD_SIGNATURE;
+  ContextSize = 0;
 
   switch (Qualified->Type) {
   //
@@ -383,6 +387,7 @@ Returns:
 
     InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link);
     CopyMem (&Record->SrcDesc, &SX_SOURCE_DESC, sizeof (Record->SrcDesc));
+    ContextSize = sizeof(Record->ChildContext.Sx);
     //
     // use default clear source function
     //
@@ -425,6 +430,7 @@ Returns:
     InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link);
     CopyMem (&Record->SrcDesc, &SW_SOURCE_DESC, sizeof (Record->SrcDesc));
     Record->BufferSize = sizeof (EFI_SMM_SW_REGISTER_CONTEXT);
+    ContextSize = sizeof(Record->ChildContext.Sw);
     //
     // use default clear source function
     //
@@ -434,6 +440,7 @@ Returns:
 
     InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link);
     CopyMem (&Record->SrcDesc, &GPI_SOURCE_DESC, sizeof (Record->SrcDesc));
+    ContextSize = sizeof(Record->ChildContext.Gpi);
     //
     // use default clear source function
     //
@@ -450,6 +457,7 @@ Returns:
     InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link);
     CopyMem (&Record->SrcDesc, &QNCN_SOURCE_DESCS[Record->ChildContext.QNCn.Type], sizeof (Record->SrcDesc));
     Record->ClearSource = QNCSmmQNCnClearSource;
+    ContextSize = sizeof(Record->ChildContext.QNCn);
     break;
 
   case PeriodicTimerType:
@@ -462,6 +470,7 @@ Returns:
     InsertTailList (&mPrivateData.CallbackDataBase, &Record->Link);
     Record->BufferSize = sizeof (EFI_SMM_PERIODIC_TIMER_CONTEXT);
     Record->ClearSource = QNCSmmPeriodicTimerClearSource;
+    ContextSize = sizeof(Record->ChildContext.PeriodicTimer);
     break;
 
   default:
@@ -488,6 +497,8 @@ Returns:
   //
   *DispatchHandle = (EFI_HANDLE) (&Record->Link);
 
+  SmiHandlerProfileRegisterHandler (Qualified->Guid, DispatchFunction, (UINTN)RETURN_ADDRESS (0), RegisterContext, ContextSize);
+
   return EFI_SUCCESS;
 
 Error:
@@ -522,6 +533,8 @@ Returns:
   DATABASE_RECORD *RecordToDelete;
   DATABASE_RECORD *RecordInDb;
   LIST_ENTRY      *LinkInDb;
+  QNC_SMM_QUALIFIED_PROTOCOL  *Qualified;
+  UINTN                       ContextSize;
 
   if (DispatchHandle == NULL) {
     return EFI_INVALID_PARAMETER;
@@ -552,7 +565,31 @@ Returns:
   }
   if (SafeToDisable) {
     QNCSmmDisableSource( &RecordToDelete->SrcDesc );
-}
+  }
+
+  Qualified = QUALIFIED_PROTOCOL_FROM_GENERIC (This);
+  switch (Qualified->Type) {
+  case SxType:
+    ContextSize = sizeof(RecordToDelete->ChildContext.Sx);
+    break;
+  case SwType:
+    ContextSize = sizeof(RecordToDelete->ChildContext.Sw);
+    break;
+  case GpiType:
+    ContextSize = sizeof(RecordToDelete->ChildContext.Gpi);
+    break;
+  case QNCnType:
+    ContextSize = sizeof(RecordToDelete->ChildContext.QNCn);
+    break;
+  case PeriodicTimerType:
+    ContextSize = sizeof(RecordToDelete->ChildContext.PeriodicTimer);
+    break;
+  default:
+    ASSERT(FALSE);
+    ContextSize = 0;
+    break;
+  }
+  SmiHandlerProfileUnregisterHandler (Qualified->Guid, RecordToDelete->Callback, RecordToDelete->CallbackContext, ContextSize);
 
   FreePool (RecordToDelete);
 
diff --git a/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmDispatcher.inf b/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmDispatcher.inf
index ed94825..23b806a 100644
--- a/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmDispatcher.inf
+++ b/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmDispatcher.inf
@@ -3,7 +3,7 @@
 #
 # This driver is responsible for the registration of child drivers
 #  and the abstraction of the ICH SMI sources.
-# Copyright (c) 2013-2015 Intel Corporation.
+# Copyright (c) 2013-2017 Intel Corporation.
 #
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
@@ -66,6 +66,7 @@
   DevicePathLib
   S3IoLib
   QNCAccessLib
+  SmiHandlerProfileLib
 
 [Protocols]
   gEfiSmmCpuProtocolGuid                        # PROTOCOL ALWAYS_CONSUMED
-- 
2.7.4.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH 2/2] QuarkPlatformPkg: enable SmiHandlerProfile.
  2017-03-16 14:04 [PATCH 0/2] Add SmiHandlerProfile on Quark Jiewen Yao
  2017-03-16 14:04 ` [PATCH 1/2] QuarkSocPkg/SmmChildDispatch: Add SmiHandlerProfile support Jiewen Yao
@ 2017-03-16 14:04 ` Jiewen Yao
  1 sibling, 0 replies; 3+ messages in thread
From: Jiewen Yao @ 2017-03-16 14:04 UTC (permalink / raw)
  To: edk2-devel; +Cc: Michael D Kinney, Kelly Steele

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Kelly Steele <kelly.steele@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
---
 QuarkPlatformPkg/Quark.dsc    | 14 ++++++++++
 QuarkPlatformPkg/Quark.fdf    |  3 +-
 QuarkPlatformPkg/QuarkMin.dsc |  3 ++
 QuarkPlatformPkg/Readme.md    | 29 ++++++++++++--------
 4 files changed, 37 insertions(+), 12 deletions(-)

diff --git a/QuarkPlatformPkg/Quark.dsc b/QuarkPlatformPkg/Quark.dsc
index 025653e..13c6538 100644
--- a/QuarkPlatformPkg/Quark.dsc
+++ b/QuarkPlatformPkg/Quark.dsc
@@ -41,6 +41,7 @@
   DEFINE LOGGING              = FALSE
   DEFINE CAPSULE_ENABLE       = FALSE
   DEFINE RECOVERY_ENABLE      = FALSE
+  DEFINE SMI_HANDLER_PROFILE_ENABLE = FALSE
 
   #
   # Galileo board.  Options are [GEN1, GEN2]
@@ -163,6 +164,12 @@
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
 !endif
 
+!if $(SMI_HANDLER_PROFILE_ENABLE)
+  SmiHandlerProfileLib|MdeModulePkg/Library/SmmSmiHandlerProfileLib/SmmSmiHandlerProfileLib.inf
+!else
+  SmiHandlerProfileLib|MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.inf
+!endif
+
   OpensslLib|CryptoPkg/Library/OpensslLib/OpensslLib.inf
   IntrinsicLib|CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
@@ -382,6 +389,10 @@
   # waiting for RTC to be busy.
   gEfiMdeModulePkgTokenSpaceGuid.PcdRealTimeClockUpdateTimeout|500000
 
+!if $(SMI_HANDLER_PROFILE_ENABLE)
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSmiHandlerProfilePropertyMask|1
+!endif
+
 !if $(SECURE_BOOT_ENABLE)
   # override the default values from SecurityPkg to ensure images from all sources are verified in secure boot
   gEfiSecurityPkgTokenSpaceGuid.PcdOptionRomImageVerificationPolicy|0x04
@@ -796,6 +807,7 @@
       #
       gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x801000C7
   }
+  MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferDxe.inf
 
   UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
   QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmControlDxe/SmmControlDxe.inf
@@ -939,6 +951,8 @@
   }
 !endif
 
+  MdeModulePkg/Application/SmiHandlerProfileInfo/SmiHandlerProfileInfo.inf
+
 [BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER]
   MSFT:*_*_*_DLINK_FLAGS = /ALIGN:4096
 
diff --git a/QuarkPlatformPkg/Quark.fdf b/QuarkPlatformPkg/Quark.fdf
index 19533b2..34f09af 100644
--- a/QuarkPlatformPkg/Quark.fdf
+++ b/QuarkPlatformPkg/Quark.fdf
@@ -2,7 +2,7 @@
 # FDF file of Clanton Peak CRB platform with 32-bit DXE
 #
 # This package provides QuarkNcSocId platform specific modules.
-# Copyright (c) 2013 - 2016 Intel Corporation.
+# Copyright (c) 2013 - 2017 Intel Corporation.
 #
 # This program and the accompanying materials
 # are licensed and made available under the terms and conditions of the BSD License
@@ -511,6 +511,7 @@ INF  RuleOverride = ACPITABLE QuarkPlatformPkg/Acpi/AcpiTables/AcpiTables.inf
 INF  MdeModulePkg/Core/PiSmmCore/PiSmmIpl.inf
 INF  MdeModulePkg/Core/PiSmmCore/PiSmmCore.inf
 INF  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf
+INF  MdeModulePkg/Universal/SmmCommunicationBufferDxe/SmmCommunicationBufferDxe.inf
 INF  UefiCpuPkg/CpuIo2Smm/CpuIo2Smm.inf
 INF  QuarkSocPkg/QuarkNorthCluster/Smm/Dxe/SmmControlDxe/SmmControlDxe.inf
 INF  QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmDispatcher.inf
diff --git a/QuarkPlatformPkg/QuarkMin.dsc b/QuarkPlatformPkg/QuarkMin.dsc
index 084f2f4..876e5df 100644
--- a/QuarkPlatformPkg/QuarkMin.dsc
+++ b/QuarkPlatformPkg/QuarkMin.dsc
@@ -150,6 +150,9 @@
 !else
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
 !endif
+
+  SmiHandlerProfileLib|MdePkg/Library/SmiHandlerProfileLibNull/SmiHandlerProfileLibNull.inf
+
 !if $(SECURE_BOOT_ENABLE)
   BaseCryptLib|CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
   PlatformSecureLib|QuarkPlatformPkg/Library/PlatformSecureLib/PlatformSecureLib.inf
diff --git a/QuarkPlatformPkg/Readme.md b/QuarkPlatformPkg/Readme.md
index f925f9e..d15e50f 100644
--- a/QuarkPlatformPkg/Readme.md
+++ b/QuarkPlatformPkg/Readme.md
@@ -137,17 +137,18 @@ build -a IA32 -t GCC49 -p QuarkPlatformPkg/QuarkMin.dsc
 The table below contains a summary of the build flags to enable or disable
 features on the build command line using ```-D``` flags.
 
-| **Define Name**            | **Default Value** | **Supported Values** |
-| -------------------------- | ----------------- | -------------------- |
-| ```GALILEO```              |              GEN2 | GEN1, GEN2           |
-| ```LOGGING```              |              TRUE | TRUE, FALSE          |
-| ```SOURCE_DEBUG_ENABLE```  |             FALSE | TRUE, FALSE          |
-| ```PERFORMANCE_ENABLE```   |             FALSE | TRUE, FALSE          |
-| ```SECURE_BOOT_ENABLE```   |             FALSE | TRUE, FALSE          |
-| ```MEASURED_BOOT_ENABLE``` |             FALSE | TRUE, FALSE          |
-| ```TPM_12_HARDWARE```      |              NONE | NONE, LPC, ATMEL_I2C, INFINEON_I2C |
-| ```CAPSULE_ENABLE```       |             FALSE | TRUE, FALSE          |
-| ```RECOVERY_ENABLE```      |             FALSE | TRUE, FALSE          |
+| **Define Name**                  | **Default Value** | **Supported Values** |
+| --------------------------       | ----------------- | -------------------- |
+| ```GALILEO```                    |              GEN2 | GEN1, GEN2           |
+| ```LOGGING```                    |              TRUE | TRUE, FALSE          |
+| ```SOURCE_DEBUG_ENABLE```        |             FALSE | TRUE, FALSE          |
+| ```PERFORMANCE_ENABLE```         |             FALSE | TRUE, FALSE          |
+| ```SECURE_BOOT_ENABLE```         |             FALSE | TRUE, FALSE          |
+| ```MEASURED_BOOT_ENABLE```       |             FALSE | TRUE, FALSE          |
+| ```TPM_12_HARDWARE```            |              NONE | NONE, LPC, ATMEL_I2C, INFINEON_I2C |
+| ```CAPSULE_ENABLE```             |             FALSE | TRUE, FALSE          |
+| ```RECOVERY_ENABLE```            |             FALSE | TRUE, FALSE          |
+| ```SMI_HANDLER_PROFILE_ENABLE``` |             FALSE | TRUE, FALSE          |
 
 * ```GALILEO``` - Used to specify the type of Intel(R) Galileo board type.  The
   default is ```GEN2``` for the [Intel(R) Galileo Gen 2 Development Board](
@@ -218,6 +219,12 @@ features on the build command line using ```-D``` flags.
   In next boot, if a user runs ForceRecovery.efi in shell, or if a user presses the RESET button during power on, warm reset or REBOOT,
   or if the FvMain is corrupted in flash, the system will boot into recovery mode.
 
+* ```SMI_HANDLER_PROFILE_ENABLE``` - Used to enable/disable SMI handler profile features.
+  The default is FALSE for disabled.  Add ```-D SMI_HANDLER_PROFILE_ENABLE``` to the
+  build command line to enable SMI handler profile features.
+  A user may enter UEFI shell environment and run ```SmiHandlerProfileInfo >a SmiHandlerQuark.xml```
+  Then the user may enter OS environment and run ```BaseTools\Scripts\SmiHandlerProfileSymbolGen.py -i SmiHandlerQuark.xml -o SmiHandlerQuarkFinal.xml -g Build\<TARGET>_<TOOL_CHAIN_TAG>\FV\Guid.xref```. (NOTE: Please replace <TAGGET> with Build/Release, and <TOOL_CHAIN_TAG> with the real toolchain name.)
+
 ### **Example Build Commands**
 
 Default build with logging enabled:
-- 
2.7.4.windows.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-03-16 14:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-16 14:04 [PATCH 0/2] Add SmiHandlerProfile on Quark Jiewen Yao
2017-03-16 14:04 ` [PATCH 1/2] QuarkSocPkg/SmmChildDispatch: Add SmiHandlerProfile support Jiewen Yao
2017-03-16 14:04 ` [PATCH 2/2] QuarkPlatformPkg: enable SmiHandlerProfile Jiewen Yao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox