From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CEF32820D3 for ; Wed, 8 Feb 2017 08:31:30 -0800 (PST) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga101.fm.intel.com with ESMTP; 08 Feb 2017 08:31:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,348,1477983600"; d="scan'208";a="1123834385" Received: from jyao1-mobl.ccr.corp.intel.com ([10.254.185.79]) by fmsmga002.fm.intel.com with ESMTP; 08 Feb 2017 08:31:28 -0800 From: Jiewen Yao To: edk2-devel@lists.01.org Cc: Michael D Kinney , Kelly Steele , Laszlo Ersek Date: Wed, 8 Feb 2017 08:31:25 -0800 Message-Id: <1486571486-20420-2-git-send-email-jiewen.yao@intel.com> X-Mailer: git-send-email 2.7.4.windows.1 In-Reply-To: <1486571486-20420-1-git-send-email-jiewen.yao@intel.com> References: <1486571486-20420-1-git-send-email-jiewen.yao@intel.com> Subject: [PATCH 11/12] QuarkSocPkg/SmmChildDispatch: Add SmiHandlerProfile support. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Feb 2017 16:31:31 -0000 Cc: Michael D Kinney Cc: Kelly Steele Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jiewen Yao --- QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c | 19 +++++++++++++++++-- QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmDispatcher.inf | 3 ++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c b/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c index c2f75f8..ea8b53c 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 + // // ///////////////////////////////////////////////////////////////////////////// // 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,7 @@ Returns: DATABASE_RECORD *RecordToDelete; DATABASE_RECORD *RecordInDb; LIST_ENTRY *LinkInDb; + QNC_SMM_QUALIFIED_PROTOCOL *Qualified; if (DispatchHandle == NULL) { return EFI_INVALID_PARAMETER; @@ -552,7 +564,10 @@ Returns: } if (SafeToDisable) { QNCSmmDisableSource( &RecordToDelete->SrcDesc ); -} + } + + Qualified = QUALIFIED_PROTOCOL_FROM_GENERIC (This); + SmiHandlerProfileUnregisterHandler (Qualified->Guid, RecordToDelete->Callback); 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