From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0703.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe48::703]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A601181993 for ; Thu, 5 Jan 2017 02:10:37 -0800 (PST) Received: from CS1PR84MB0295.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.26) by CS1PR84MB0293.NAMPRD84.PROD.OUTLOOK.COM (10.162.190.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.817.10; Thu, 5 Jan 2017 10:10:36 +0000 Received: from CS1PR84MB0295.NAMPRD84.PROD.OUTLOOK.COM ([10.162.190.26]) by CS1PR84MB0295.NAMPRD84.PROD.OUTLOOK.COM ([10.162.190.26]) with mapi id 15.01.0817.013; Thu, 5 Jan 2017 10:10:36 +0000 From: "Wang, Sunny (HPS SW)" To: Ruiyu Ni , "edk2-devel@lists.01.org" CC: Jiewen Yao , "Wang, Sunny (HPS SW)" Thread-Topic: [edk2] [PATCH] MdeModulePkg/Bds: Fix a bug that may causes S4 fails to resume Thread-Index: AQHSZwJrXtkqzq4jl06Jtdtqd5EP16EpqTNQ Date: Thu, 5 Jan 2017 10:10:36 +0000 Message-ID: References: <20170105031812.500244-1-ruiyu.ni@intel.com> In-Reply-To: <20170105031812.500244-1-ruiyu.ni@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=sunnywang@hpe.com; x-originating-ip: [15.211.131.5] x-microsoft-exchange-diagnostics: 1; CS1PR84MB0293; 7:mn1uIo0wHc8FqVyRmAEMfMb/DDKY7KRwQC2NR75eGAsZn3o2dTn8/SgU+jyJCTduk/rXWv7Lnunuyji51AT2ljWA21P5ylUyXjJzsk4joC40uQ56Kbg6fNuyzqa398o3lVzh1fwXOdPI1QOySbxcQmUZbj9vZWjd04eG+wOEqIYeg1mwuoytNeXUHRcMqz8mBSVi3D1tYMFJWsCpqUpYMvFdDgQbnecEfl3S0nGm4IfURMUt76knykcHPJJk0pynm2T2viSdgdceQQiwTwyAuPG5Rj+Xzsu944ArRsbbpCNvnfE8/jqyqBk1Cne9p03HvjMTNt/GnAnB8Ac0eC7+llhHkdCZ7lqTCIRySqbRaMIey2EdNTIWhD9sz8KraxT7WV7ZPTRIOAgDZVv+EvEjDU3ZxeYSdNvJgU+Ww57UFBynqF3CvJg4ClNful4NT7MWR/PjEBOMo/zUinJBtWIGTQ== x-forefront-antispam-report: SFV:SKI; SCL:-1SFV:NSPM; SFS:(10019020)(6009001)(7916002)(39840400002)(39860400002)(39450400003)(39410400002)(39850400002)(377454003)(13464003)(189002)(199003)(3660700001)(9686002)(2900100001)(229853002)(38730400001)(92566002)(68736007)(102836003)(2501003)(6116002)(6306002)(189998001)(7736002)(122556002)(33656002)(3846002)(55016002)(54906002)(97736004)(8676002)(2906002)(5660300001)(105586002)(50986999)(76176999)(54356999)(4326007)(77096006)(66066001)(6436002)(86362001)(305945005)(5001770100001)(101416001)(2950100002)(8936002)(74316002)(3280700002)(106356001)(81166006)(6506006)(81156014)(7696004)(106116001); DIR:OUT; SFP:1102; SCL:1; SRVR:CS1PR84MB0293; H:CS1PR84MB0295.NAMPRD84.PROD.OUTLOOK.COM; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; x-ms-office365-filtering-correlation-id: b93d4f0a-ca8c-4e61-0031-08d4355317b2 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CS1PR84MB0293; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(227479698468861)(162533806227266)(228905959029699); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123564025)(20161123562025)(20161123555025)(20161123560025)(6072148); SRVR:CS1PR84MB0293; BCL:0; PCL:0; RULEID:; SRVR:CS1PR84MB0293; x-forefront-prvs: 0178184651 received-spf: None (protection.outlook.com: hpe.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: hpe.com X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2017 10:10:36.1260 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR84MB0293 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 10:10:37 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Looks good to me.=20 Reviewed-by: Sunny Wang -----Original Message----- From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Ruiy= u Ni Sent: Thursday, January 05, 2017 11:18 AM To: edk2-devel@lists.01.org Cc: Jiewen Yao Subject: [edk2] [PATCH] MdeModulePkg/Bds: Fix a bug that may causes S4 fail= s to resume When firmware boots to UiApp, the memory type information settings are save= d 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 w= hen 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, e= xpected 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 Cc: Jiewen Yao --- MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/MdeModulePkg/Library/UefiBootManagerLib/BmMisc.c b/MdeModulePk= g/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 pro= gram and the accompanying materials are licensed and made available under = the terms and conditions of the BSD License @@ -205,8 +205,11 @@ BmSetMemor= yTypeInformationVariable ( // 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,=20 + GET_GUID_HOB_DATA (GuidHob)); if (PreviousMemoryTypeInformation =3D=3D N= ULL) { + return; + } =20 // // Use a heuristic to adjust the Memory Type Information for the next bo= ot @@ -278,14 +281,18 @@ BmSetMemoryTypeInformationVariable ( // then reset the platform so the new Memory Type Information settin= g will be used to guarantee that an S4 // entry/resume cycle will not fail. // - if (MemoryTypeInformationModified && Boot && PcdGetBool (PcdResetOnM= emoryTypeInformationChange)) { - 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 sav= ed. OS S4 may fail!\n")); } } + FreePool (PreviousMemoryTypeInformation); } =20 /** -- 2.9.0.windows.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel