From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 55C7D22361E54 for ; Thu, 8 Feb 2018 18:55:54 -0800 (PST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Feb 2018 19:01:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,481,1511856000"; d="scan'208";a="16774646" Received: from ray-dev.ccr.corp.intel.com (HELO [10.239.9.37]) ([10.239.9.37]) by orsmga008.jf.intel.com with ESMTP; 08 Feb 2018 19:01:38 -0800 To: "Zeng, Star" , edk2-devel@lists.01.org Cc: Michael D Kinney , Liming Gao References: <20180202064530.407028-1-ruiyu.ni@intel.com> <20180202064530.407028-6-ruiyu.ni@intel.com> <2e85e7bf-fc59-a816-eed0-ad13e963fd82@intel.com> From: "Ni, Ruiyu" Message-ID: <1194f4ae-0478-b520-2374-6a5044771755@Intel.com> Date: Fri, 9 Feb 2018 11:01:38 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <2e85e7bf-fc59-a816-eed0-ad13e963fd82@intel.com> Subject: Re: [PATCH 05/10] MdeModulePkg/ResetSystemRuntimeDxe: Add more debug message X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Feb 2018 02:55:54 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit On 2/7/2018 8:04 PM, Zeng, Star wrote: > On 2018/2/2 14:45, Ruiyu Ni wrote: >> The patch adds more debug message in ResetSystem(). >> It also removes unnecessary check of mResetNotifyDepth. >> >> Cc: Liming Gao >> Cc: Michael D Kinney >> Cc: Star Zeng >> Contributed-under: TianoCore Contribution Agreement 1.1 >> Signed-off-by: Ruiyu Ni >> --- >>   .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 88 >> +++++++++++----------- >>   1 file changed, 44 insertions(+), 44 deletions(-) >> >> diff --git >> a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c >> b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c >> index 43400e1338..4b5af76999 100644 >> --- a/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c >> +++ b/MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystem.c >> @@ -15,6 +15,10 @@ >>   #include "ResetSystem.h" >> +GLOBAL_REMOVE_IF_UNREFERENCED CHAR16 *mResetTypeStr[] = { >> +  L"Cold", L"Warm", L"Shutdown", L"PlatformSpecific" >> +}; >> + >>   // >>   // The current ResetSystem() notification recursion depth >>   // >> @@ -251,16 +255,6 @@ ResetSystem ( >>     LIST_ENTRY          *Link; >>     RESET_NOTIFY_ENTRY  *Entry; >> -  // >> -  // Above the maximum recursion depth, so do the smallest amount of >> -  // work to perform a cold reset. >> -  // >> -  if (mResetNotifyDepth >= MAX_RESET_NOTIFY_DEPTH) { >> -    ResetCold (); >> -    ASSERT (FALSE); >> -    return; >> -  } >> - >>     // >>     // Only do REPORT_STATUS_CODE() on first call to ResetSystem() >>     // >> @@ -272,40 +266,47 @@ ResetSystem ( >>     } >>     mResetNotifyDepth++; >> -  if (!EfiAtRuntime () && mResetNotifyDepth < MAX_RESET_NOTIFY_DEPTH) { >> -    // >> -    // Call reset notification functions registered through the >> -    // EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PROTOCOL. >> -    // >> -    for ( Link = GetFirstNode >> (&mPlatformSpecificResetFilter.ResetNotifies) >> -        ; !IsNull (&mPlatformSpecificResetFilter.ResetNotifies, Link) >> -        ; Link = GetNextNode >> (&mPlatformSpecificResetFilter.ResetNotifies, Link) >> -        ) { >> -      Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link); >> -      Entry->ResetNotify (ResetType, ResetStatus, DataSize, ResetData); >> -    } >> -    // >> -    // Call reset notification functions registered through the >> -    // EFI_RESET_NOTIFICATION_PROTOCOL. >> -    // >> -    for ( Link = GetFirstNode (&mResetNotification.ResetNotifies) >> -        ; !IsNull (&mResetNotification.ResetNotifies, Link) >> -        ; Link = GetNextNode (&mResetNotification.ResetNotifies, Link) >> -        ) { >> -      Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link); >> -      Entry->ResetNotify (ResetType, ResetStatus, DataSize, ResetData); >> -    } >> -    // >> -    // call reset notification functions registered through the >> -    // EDKII_PLATFORM_SPECIFIC_RESET_NOTIFICATION_PROTOCOL. >> -    // >> -    for ( Link = GetFirstNode >> (&mPlatformSpecificResetHandler.ResetNotifies) >> -        ; !IsNull (&mPlatformSpecificResetHandler.ResetNotifies, Link) >> -        ; Link = GetNextNode >> (&mPlatformSpecificResetHandler.ResetNotifies, Link) >> -        ) { >> -      Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link); >> -      Entry->ResetNotify (ResetType, ResetStatus, DataSize, ResetData); >> +  DEBUG ((DEBUG_INFO, "DXE ResetSystem2: Reset call depth = %d.\n", >> mResetNotifyDepth)); >> + >> +  if (mResetNotifyDepth <= MAX_RESET_NOTIFY_DEPTH) { > > Should be mResetNotifyDepth < MAX_RESET_NOTIFY_DEPTH? No. The intention is the MAX_RESET_NOTIFY_DEPTH times of call is permitted. > > Thanks, > Star > >> +    if (!EfiAtRuntime ()) { >> +      // >> +      // Call reset notification functions registered through the >> +      // EDKII_PLATFORM_SPECIFIC_RESET_FILTER_PROTOCOL. >> +      // >> +      for ( Link = GetFirstNode >> (&mPlatformSpecificResetFilter.ResetNotifies) >> +          ; !IsNull (&mPlatformSpecificResetFilter.ResetNotifies, Link) >> +          ; Link = GetNextNode >> (&mPlatformSpecificResetFilter.ResetNotifies, Link) >> +          ) { >> +        Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link); >> +        Entry->ResetNotify (ResetType, ResetStatus, DataSize, >> ResetData); >> +      } >> +      // >> +      // Call reset notification functions registered through the >> +      // EFI_RESET_NOTIFICATION_PROTOCOL. >> +      // >> +      for ( Link = GetFirstNode (&mResetNotification.ResetNotifies) >> +          ; !IsNull (&mResetNotification.ResetNotifies, Link) >> +          ; Link = GetNextNode (&mResetNotification.ResetNotifies, Link) >> +          ) { >> +        Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link); >> +        Entry->ResetNotify (ResetType, ResetStatus, DataSize, >> ResetData); >> +      } >> +      // >> +      // call reset notification functions registered through the >> +      // EDKII_PLATFORM_SPECIFIC_RESET_NOTIFICATION_PROTOCOL. >> +      // >> +      for ( Link = GetFirstNode >> (&mPlatformSpecificResetHandler.ResetNotifies) >> +          ; !IsNull (&mPlatformSpecificResetHandler.ResetNotifies, Link) >> +          ; Link = GetNextNode >> (&mPlatformSpecificResetHandler.ResetNotifies, Link) >> +          ) { >> +        Entry = RESET_NOTIFY_ENTRY_FROM_LINK (Link); >> +        Entry->ResetNotify (ResetType, ResetStatus, DataSize, >> ResetData); >> +      } >>       } >> +  } else { >> +    ASSERT (ResetType < ARRAY_SIZE (mResetTypeStr)); >> +    DEBUG ((DEBUG_ERROR, "DXE ResetSystem2: Maximum reset call depth >> is met. Use the current reset type: %s!\n", mResetTypeStr[ResetType])); >>     } >>     switch (ResetType) { >> @@ -331,7 +332,6 @@ ResetSystem ( >>       } >>       ResetWarm (); >> - >>       break; >>    case EfiResetCold: >> > -- Thanks, Ray