public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ruiyu" <ruiyu.ni@intel.com>
To: "Gao, Liming" <liming.gao@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [Patch] SourceLevelDebugPkg: Update SmmDebugAgentLib to restore APIC timer
Date: Wed, 11 Oct 2017 09:47:54 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BA92C9D@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <1507629852-9700-1-git-send-email-liming.gao@intel.com>

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Thanks/Ray

> -----Original Message-----
> From: Gao, Liming
> Sent: Tuesday, October 10, 2017 6:04 PM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
> Subject: [Patch] SourceLevelDebugPkg: Update SmmDebugAgentLib to
> restore APIC timer
> 
> 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 <liming.gao@intel.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> ---
>  .../DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c     | 21
> ++++++++++++++++-----
>  1 file changed, 16 insertions(+), 5 deletions(-)
> 
> diff --git
> a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebug
> AgentLib.c
> b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebu
> gAgentLib.c
> index 11afd32..6be8c54 100644
> ---
> a/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebug
> AgentLib.c
> +++
> b/SourceLevelDebugPkg/Library/DebugAgent/SmmDebugAgent/SmmDebu
> gAgent
> +++ Lib.c
> @@ -20,6 +20,11 @@ UINTN                       mSavedDebugRegisters[6];
>  IA32_IDT_GATE_DESCRIPTOR    mIdtEntryTable[33];
>  BOOLEAN                     mSkipBreakpoint = FALSE;
>  BOOLEAN                     mSmmDebugIdtInitFlag = FALSE;
> +BOOLEAN                     mApicTimerRestore = FALSE;
> +BOOLEAN                     mPeriodicMode;
> +UINT32                      mTimerCycle;
> +UINTN                       mApicTimerDivisor;
> +UINT8                       mVector;
> 
>  CHAR8 mWarningMsgIgnoreSmmEntryBreak[] = "Ignore smmentrybreak
> setting for SMI issued during DXE debugging!\r\n";
> 
> @@ -191,8 +196,6 @@ InitializeDebugAgent (
>    DEBUG_AGENT_MAILBOX           *Mailbox;
>    UINT64                        *MailboxLocation;
>    UINT32                        DebugTimerFrequency;
> -  BOOLEAN                       PeriodicMode;
> -  UINTN                         TimerCycle;
> 
>    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 = GetApicTimerInitCount ();
> -    if (!PeriodicMode || TimerCycle == 0) {
> +    GetApicTimerState (&mApicTimerDivisor, &mPeriodicMode, &mVector);
> +    mTimerCycle = GetApicTimerInitCount ();
> +    if (!mPeriodicMode || mTimerCycle == 0) {
> +      mApicTimerRestore = TRUE;
>        InitializeDebugTimer (NULL, FALSE);
>      }
>      Mailbox = GetMailboxPointer ();
> @@ -327,6 +331,13 @@ InitializeDebugAgent (
>      //
>      mSkipBreakpoint = FALSE;
>      RestoreDebugRegister ();
> +    //
> +    // Restore APIC Timer
> +    //
> +    if (mApicTimerRestore) {
> +      InitializeApicTimer (mApicTimerDivisor, mTimerCycle, mPeriodicMode,
> mVector);
> +      mApicTimerRestore = FALSE;
> +    }
>      break;
> 
>    case DEBUG_AGENT_INIT_THUNK_PEI_IA32TOX64:
> --
> 2.8.0.windows.1



      reply	other threads:[~2017-10-11  9:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10 10:04 [Patch] SourceLevelDebugPkg: Update SmmDebugAgentLib to restore APIC timer Liming Gao
2017-10-11  9:47 ` Ni, Ruiyu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=734D49CCEBEEF84792F5B80ED585239D5BA92C9D@SHSMSX104.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox