From nobody Fri May 3 18:12:08 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1507629877343381.24958985086676; Tue, 10 Oct 2017 03:04:37 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C29822095B069; Tue, 10 Oct 2017 03:01:07 -0700 (PDT) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) (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 45B4D208F7903 for ; Tue, 10 Oct 2017 03:01:06 -0700 (PDT) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga104.jf.intel.com with ESMTP; 10 Oct 2017 03:04:34 -0700 Received: from shwde7172.ccr.corp.intel.com ([10.239.9.14]) by orsmga003.jf.intel.com with ESMTP; 10 Oct 2017 03:04:33 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.31; helo=mga06.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,504,1500966000"; d="scan'208";a="1023596498" From: Liming Gao To: edk2-devel@lists.01.org Date: Tue, 10 Oct 2017 18:04:12 +0800 Message-Id: <1507629852-9700-1-git-send-email-liming.gao@intel.com> X-Mailer: git-send-email 2.8.0.windows.1 Subject: [edk2] [Patch] SourceLevelDebugPkg: Update SmmDebugAgentLib to restore APIC timer X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ruiyu Ni MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In enter SMI, APIC timer may be initialized. After exit SMI, APIC timer will be restore. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao Cc: Ruiyu Ni Reviewed-by: Ruiyu Ni --- .../DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c | 21 ++++++++++++++++-= ---- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugA= gentLib.c b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAg= entLib.c index 11afd32..6be8c54 100644 --- a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib= .c +++ b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib= .c @@ -20,6 +20,11 @@ UINTN mSavedDebugRegisters[6]; IA32_IDT_GATE_DESCRIPTOR mIdtEntryTable[33]; BOOLEAN mSkipBreakpoint =3D FALSE; BOOLEAN mSmmDebugIdtInitFlag =3D FALSE; +BOOLEAN mApicTimerRestore =3D FALSE; +BOOLEAN mPeriodicMode; +UINT32 mTimerCycle; +UINTN mApicTimerDivisor; +UINT8 mVector; =20 CHAR8 mWarningMsgIgnoreSmmEntryBreak[] =3D "Ignore smmentrybreak setting f= or SMI issued during DXE debugging!\r\n"; =20 @@ -191,8 +196,6 @@ InitializeDebugAgent ( DEBUG_AGENT_MAILBOX *Mailbox; UINT64 *MailboxLocation; UINT32 DebugTimerFrequency; - BOOLEAN PeriodicMode; - UINTN TimerCycle; =20 switch (InitFlag) { case DEBUG_AGENT_INIT_SMM: @@ -289,9 +292,10 @@ InitializeDebugAgent ( // Check if CPU APIC Timer is working, otherwise initialize it. // InitializeLocalApicSoftwareEnable (TRUE); - GetApicTimerState (NULL, &PeriodicMode, NULL); - TimerCycle =3D GetApicTimerInitCount (); - if (!PeriodicMode || TimerCycle =3D=3D 0) { + GetApicTimerState (&mApicTimerDivisor, &mPeriodicMode, &mVector); + mTimerCycle =3D GetApicTimerInitCount (); + if (!mPeriodicMode || mTimerCycle =3D=3D 0) { + mApicTimerRestore =3D TRUE; InitializeDebugTimer (NULL, FALSE); } Mailbox =3D GetMailboxPointer (); @@ -327,6 +331,13 @@ InitializeDebugAgent ( // mSkipBreakpoint =3D FALSE; RestoreDebugRegister (); + // + // Restore APIC Timer + // + if (mApicTimerRestore) { + InitializeApicTimer (mApicTimerDivisor, mTimerCycle, mPeriodicMode, = mVector); + mApicTimerRestore =3D FALSE; + } break; =20 case DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64: --=20 2.8.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel