public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [PATCH] MdeModulePkg/Bds: Fix a bug that may causes S4 fails to resume
Date: Thu, 5 Jan 2017 04:40:04 +0000	[thread overview]
Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503A8DB775@shsmsx102.ccr.corp.intel.com> (raw)
In-Reply-To: <20170105031812.500244-1-ruiyu.ni@intel.com>

Reviewed-by: Jiewen.yao@intel.com

> -----Original Message-----
> From: Ni, Ruiyu
> Sent: Thursday, January 5, 2017 11:18 AM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen <jiewen.yao@intel.com>
> Subject: [PATCH] MdeModulePkg/Bds: Fix a bug that may causes S4 fails to
> resume
> 
> When firmware boots to UiApp, the memory type information settings
> are saved to NV storage and the settings in HOB are changed as well.
> Because UiApp is an APPLICATION type of boot option, system doesn't
> reset when settings change.
> But when user selects OS to boot in UiApp, because the settings in HOB
> was updated when booting to UiApp, the BDS doesn't think the settings
> change, expected reset doesn't happen.
> 
> The patch fixes this issue to not update the settings in HOB.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> ---
>  MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c | 19
> +++++++++++++------
>  1 file changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
> b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
> index 09e4211..cf0455f 100644
> --- a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
> +++ b/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c
> @@ -1,7 +1,7 @@
>  /** @file
>    Misc library functions.
> 
> -Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
>  (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD
> License
> @@ -205,8 +205,11 @@ BmSetMemoryTypeInformationVariable (
>      //
>      return;
>    }
> -  PreviousMemoryTypeInformation = GET_GUID_HOB_DATA (GuidHob);
> -  VariableSize = GET_GUID_HOB_DATA_SIZE (GuidHob);
> +  VariableSize                  = GET_GUID_HOB_DATA_SIZE (GuidHob);
> +  PreviousMemoryTypeInformation = AllocateCopyPool (VariableSize,
> GET_GUID_HOB_DATA (GuidHob));
> +  if (PreviousMemoryTypeInformation == NULL) {
> +    return;
> +  }
> 
>    //
>    // Use a heuristic to adjust the Memory Type Information for the next boot
> @@ -278,14 +281,18 @@ BmSetMemoryTypeInformationVariable (
>        // then reset the platform so the new Memory Type Information setting
> will be used to guarantee that an S4
>        // entry/resume cycle will not fail.
>        //
> -      if (MemoryTypeInformationModified && Boot && PcdGetBool
> (PcdResetOnMemoryTypeInformationChange)) {
> -        DEBUG ((EFI_D_INFO, "Memory Type Information settings change.
> Warm Reset!!!\n"));
> -        gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
> +      if (MemoryTypeInformationModified) {
> +        DEBUG ((EFI_D_INFO, "Memory Type Information settings
> change.\n"));
> +        if (Boot && PcdGetBool
> (PcdResetOnMemoryTypeInformationChange)) {
> +          DEBUG ((EFI_D_INFO, "...Warm Reset!!!\n"));
> +          gRT->ResetSystem (EfiResetWarm, EFI_SUCCESS, 0, NULL);
> +        }
>        }
>      } else {
>        DEBUG ((EFI_D_ERROR, "Memory Type Information settings cannot be
> saved. OS S4 may fail!\n"));
>      }
>    }
> +  FreePool (PreviousMemoryTypeInformation);
>  }
> 
>  /**
> --
> 2.9.0.windows.1



  reply	other threads:[~2017-01-05  4:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-05  3:18 [PATCH] MdeModulePkg/Bds: Fix a bug that may causes S4 fails to resume Ruiyu Ni
2017-01-05  4:40 ` Yao, Jiewen [this message]
2017-01-05 10:10 ` Wang, Sunny (HPS SW)

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=74D8A39837DF1E4DA445A8C0B3885C503A8DB775@shsmsx102.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