From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 77A8081948 for ; Wed, 4 Jan 2017 20:40:08 -0800 (PST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 04 Jan 2017 20:40:08 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,319,1477983600"; d="scan'208";a="26353824" Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga002.jf.intel.com with ESMTP; 04 Jan 2017 20:40:07 -0800 Received: from fmsmsx154.amr.corp.intel.com (10.18.116.70) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 4 Jan 2017 20:40:08 -0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by FMSMSX154.amr.corp.intel.com (10.18.116.70) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 4 Jan 2017 20:40:07 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.88]) by SHSMSX104.ccr.corp.intel.com ([10.239.4.70]) with mapi id 14.03.0248.002; Thu, 5 Jan 2017 12:40:05 +0800 From: "Yao, Jiewen" To: "Ni, Ruiyu" , "edk2-devel@lists.01.org" Thread-Topic: [PATCH] MdeModulePkg/Bds: Fix a bug that may causes S4 fails to resume Thread-Index: AQHSZwJfe3NPK9nKxUikVIsSNYhlGKEpTXZA Date: Thu, 5 Jan 2017 04:40:04 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503A8DB775@shsmsx102.ccr.corp.intel.com> References: <20170105031812.500244-1-ruiyu.ni@intel.com> In-Reply-To: <20170105031812.500244-1-ruiyu.ni@intel.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] MdeModulePkg/Bds: Fix a bug that may causes S4 fails to resume 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: Thu, 05 Jan 2017 04:40:08 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 > Subject: [PATCH] MdeModulePkg/Bds: Fix a bug that may causes S4 fails to > resume >=20 > 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. >=20 > The patch fixes this issue to not update the settings in HOB. >=20 > Contributed-under: TianoCore Contribution Agreement 1.0 > Signed-off-by: Ruiyu Ni > Cc: Jiewen Yao > --- > MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c | 19 > +++++++++++++------ > 1 file changed, 13 insertions(+), 6 deletions(-) >=20 > 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. >=20 > -Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
> +Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.
> (C) Copyright 2016 Hewlett Packard Enterprise Development LP
> This program and the accompanying materials > are licensed and made available under the terms and conditions of the BS= D > License > @@ -205,8 +205,11 @@ BmSetMemoryTypeInformationVariable ( > // > return; > } > - PreviousMemoryTypeInformation =3D GET_GUID_HOB_DATA (GuidHob); > - VariableSize =3D GET_GUID_HOB_DATA_SIZE (GuidHob); > + VariableSize =3D GET_GUID_HOB_DATA_SIZE (GuidHob); > + PreviousMemoryTypeInformation =3D AllocateCopyPool (VariableSize, > GET_GUID_HOB_DATA (GuidHob)); > + if (PreviousMemoryTypeInformation =3D=3D NULL) { > + return; > + } >=20 > // > // 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 sett= ing > 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); > } >=20 > /** > -- > 2.9.0.windows.1