From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mx.groups.io with SMTP id smtpd.web08.2978.1663025531396646321 for ; Mon, 12 Sep 2022 16:32:11 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=FZewvpt/; spf=pass (domain: intel.com, ip: 134.134.136.20, mailfrom: isaac.w.oram@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663025531; x=1694561531; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=3TLgJQIv1SIWTGMiJZRw4pGTV3/pPxEGaycWWLlkDsA=; b=FZewvpt/oukwxv9Jp/chWj5r6ainQ9lV97ki/rWVh452FFZkdO4wEqfK ESDgS/DMbw9AoyBV1Ec2qem/Prf4T2NsXzYfQtH1FeQT40YhkdbxjdOoc sVosC+e8sZUNMFBW2aisSYw4TpipVvRq2KEF1RHQsFvjpsvy+isZ26Ski gvPlSUGBFWs+ODDG64MNC2VzK/3Rq+N+tMgx2AEB/su1E0LYg27f7n/5C loTTbXnfSv7E/ylN7HLGbEU5TWKmxzcRVe4P2XkwD9N3kVNeMTQb4EDyX dRdYu7F5E+rRGdI4wEiYo8qq/5Krq2bKoAobZNyg+OpC5y+8apikZnLlj w==; X-IronPort-AV: E=McAfee;i="6500,9779,10468"; a="285014644" X-IronPort-AV: E=Sophos;i="5.93,310,1654585200"; d="scan'208";a="285014644" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2022 16:32:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,310,1654585200"; d="scan'208";a="616245258" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by orsmga002.jf.intel.com with ESMTP; 12 Sep 2022 16:32:10 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 12 Sep 2022 16:32:10 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 12 Sep 2022 16:32:09 -0700 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31 via Frontend Transport; Mon, 12 Sep 2022 16:32:09 -0700 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (104.47.59.174) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2375.31; Mon, 12 Sep 2022 16:32:09 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SomjkCzvnYZNNncsnPYPpcdul4BQOaMXPif+sLzz8UfE3eh/qXItVGEzdbbajWLl4WChSglseUq2Owo6NUuWvui/UTepVQQKa5T3taplhUxtqS91VwlL/cxPTfcBrU6HGBnqEcyt14hepDu7rg+mKLeg8nG5Iz9OLyhFUDYV0z6hMJQYpDrPnBu8TNq4vi2NaOL8Q+oyj5n/R+ZPfRqI7zjOQDrdqbX74SXxFt20GJ9ihJxQ8ETFVhIRFYE9AbkUjYblMcKx+DGm7D4JpjDaV35nrgZZUrf3bVdaQaV+fT/JcavDjyIDmGCE48RDsX/K/w3Xon79vik9rMyBMGkucA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=DAR9LhIbE1sqyRI5MpfMu8mEpQf2GlBEevq8UNPmWmQ=; b=E5WJTLtev/9PtCDdz0GU1+pFLU6xxWDq2KortsCenXMHW1dabsleIETngiSKvpwIMX1sZSXUS+vkjoMbI/gFyt1bQ84vXgmWh2VT2N9VA1822U7daQ1dK+P1bKarZWuwHmnbwlA6i9a9yGINFXdZvzQmoz3GymphWlFSi3u8SJx2XRg3aglUv6o8UOxShEBi6toeKfYcskr0HHjNcMqyMLf/9aXwz7rPytRyUZENTZFpnnHyxiTJTHfMPspSNGG/+ppFu8kibLp+kLGp6SS9OBXPvOC6a7LC+tJQBSrTplytWBc0CDiE4Z+1bd4P2C/tmbwruVexv+7DyvNrqDCgug== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Received: from SA1PR11MB5801.namprd11.prod.outlook.com (2603:10b6:806:23d::13) by CY8PR11MB7134.namprd11.prod.outlook.com (2603:10b6:930:62::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5612.22; Mon, 12 Sep 2022 23:32:06 +0000 Received: from SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::4187:e0fb:4eeb:64f6]) by SA1PR11MB5801.namprd11.prod.outlook.com ([fe80::4187:e0fb:4eeb:64f6%4]) with mapi id 15.20.5612.022; Mon, 12 Sep 2022 23:32:06 +0000 From: "Isaac Oram" To: Benjamin Doron , "devel@edk2.groups.io" CC: "Desimone, Nathaniel L" , "Sinha, Ankit" , "Chiu, Chasel" , "Soller, Jeremy" , "Chaganty, Rangasai V" Subject: Re: [edk2-platforms][PATCH v3 4/4] KabylakeOpenBoardPkg: Example of board S3 Thread-Topic: [edk2-platforms][PATCH v3 4/4] KabylakeOpenBoardPkg: Example of board S3 Thread-Index: AQHYxssQMh5fusKHGEqnCjEwIe1Lta3cciGQ Date: Mon, 12 Sep 2022 23:32:06 +0000 Message-ID: References: <20220912171250.1515536-1-benjamin.doron00@gmail.com> <20220912171250.1515536-5-benjamin.doron00@gmail.com> In-Reply-To: <20220912171250.1515536-5-benjamin.doron00@gmail.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: SA1PR11MB5801:EE_|CY8PR11MB7134:EE_ x-ms-office365-filtering-correlation-id: 438105f8-767c-4693-842d-08da95170172 x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: qhTuXakZ/bUWVpnTO9PraoqTafjfQ+n/8KBjqDa8Hnn+WprEXNkSnDP2sJ6LwncFRq2SwTlsvh7TcE169UeMP0rzKq1YaAJ03+2/eoQjSgYD+zqHIhBwaQl8O4IneWLZGC3+LfxOW97o9c8FU+m32tX/aqMiFgC71TYaUSwPslBKfRi8gNv6dP7FcKB3p2iqHGvmf97Q6el8etc80wXsngh+Cp6kEkG0QHv2KG8gYeXx954QGJG5FkJl0HT3E4wSak+SCkbEEK3wGSc6irdFw5RqFUCUyxQXTMDdXoT8KwcelVVI0N7M6bauf+S7BzMcTX7AjUI7g5LdGpksDrzmIaHEXAszKseWC7HAX85yxNskkaZU6+rklQtR25S1wCewAcCEM095bunxV+VoAC/Cb7VsW6qtsBqVuNe9rIrCl2F24hLHJtyBOg3/QFwJCJDCqb4CUF4NDV9AAH5Tz4KKoFbsx/+21tHpA0dfdbc4d9DP5ClonGZbeF1lAsaRD99qZ+VbBDVh5XMZfIjF0szxENtemgc/2MTPrOeSgew6Y4Z7xTFzZcgBdMInlQFuU03qwsQPcxfDr2gBuUvL/6Nvu4Ls+FtXyNpK9o6c/dgLhErpPPH9+46nsnHAdF6N1ba4kz7bfSGXf6Aw9mFXyKbu5YDfktEup2nys+0i5nCSUbG/B0XFFX3v+Khot9BfEVXmoOZCj2M5je7X9BKeasirpgQC2h2Eqysg490yIU1Gd33ZniM1cWDYm0ugpQpCIHeKQzYVcZEzJW+HFjxtS/XgGQ== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SA1PR11MB5801.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(376002)(136003)(366004)(39860400002)(396003)(346002)(451199015)(76116006)(110136005)(41300700001)(8676002)(38100700002)(6506007)(30864003)(52536014)(9686003)(107886003)(82960400001)(122000001)(33656002)(71200400001)(5660300002)(55016003)(478600001)(19627235002)(86362001)(53546011)(186003)(54906003)(38070700005)(8936002)(83380400001)(2906002)(316002)(66946007)(66476007)(66556008)(26005)(64756008)(66446008)(4326008)(7696005)(579004)(559001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?b9j9cgf+C0ZMeeIIRtwmDUV7R+3+mw8+3p0ruq4hN+sK0Zc75FFNuPL53Jvu?= =?us-ascii?Q?5dCFmnLEm1OmB2pckmBOtLaW/PjyhvpvJribAozgWugtdkZ8vfRH8aSwX76s?= =?us-ascii?Q?bR2oAtrJfmamfbBG+PlUHCe7S/NmT3GI3pgSBLIoqRVRA7MffDdANmW4PClH?= =?us-ascii?Q?kpXAvcDVdzDDCrCn7VHPS/Or0b0MgB3+VKhRDIUhZRa1wfp2ZKt7q6zfZ/jh?= =?us-ascii?Q?V4srrFky03Qg7dfKHjKGmvG17VNXJUtSuZVZlYIDWdTULKI79baMic4nOsbo?= =?us-ascii?Q?lSJUZGKgk0m7mN24MebVxGQR8fbjEHs2yzDHed1r+M8ZmGuEnuVtUJgkrBZw?= =?us-ascii?Q?cWOtil6OFtJDaJS9IDIJRYBVpNjUTzl0K71Kq3sC2pt20PJlDTWpKwNledEw?= =?us-ascii?Q?LeBfUprLzd1pz0ySp782o7A04R/5FvnJ6lgqVRU+TsoLnTOtk0X0VyglJh/t?= =?us-ascii?Q?SiY0IaLRu4kG5XWkBLGk1StvO4oG5UZaNgyTIuVaJiF32+ZVccvJj147I08c?= =?us-ascii?Q?tUqsyUCjmKjuhRJtwNgANQdoefIZNP3cNqafaWhsA4aYjzaFWE5z3x4CcXNo?= =?us-ascii?Q?LahmsKpTOpX4D/AuwlA96svj4os9mQs8KZPApiNUu8eFvGbf4EJt5He0d3Qm?= =?us-ascii?Q?JQGZz0Ly4H5EA3LRVMbpSxG5sABWiajW1nYyAFfuvmPfS0zq40Jgkz+ECOwj?= =?us-ascii?Q?42n+XBqVb3yZXjzJsKjpGaDrEvmawSVKdYO5/2PFJhgV8UYCmGiW/+19f5N9?= =?us-ascii?Q?XiakfjQNiQOJzveHnilGSsdmvANyCB9RVjyTFtgZd8eruzwUsHI0gqi1Uiv8?= =?us-ascii?Q?d4hpH6dvH+ZX+uvKqcI5PU0EfEEZLrPYxWbKxwO9lSvJWOTo/ekSV+1xAegl?= =?us-ascii?Q?d6NdcFnau1m8kyKgUMzrV/bciNBoxG9LIanwzeeFKGr0nz++Ub8JmJg86KxE?= =?us-ascii?Q?hgeOK0I4pMWueAyDE7NZOFg/cZGIfnmc3cYyoBiXezk4iSpkyEg3qP31sAI5?= =?us-ascii?Q?YseS/vh1rsEVhvtm7L+2VQd7xx5RBrPvkFFtvU1uge/sAN2o20CcpWgH9+Hu?= =?us-ascii?Q?5RWEbGjI3YBYEZLg4bPH5/0lA35D6VRFpa4z9BerDN235A8vPeQN9zI93FqW?= =?us-ascii?Q?ugg6afk4SZ/Y1D3EmsI42ipR9Z4qAsnTb5gON8EcqRM19FIKnO1QZfgXyvjE?= =?us-ascii?Q?U0ij7d1lA5pzTwhS+v0qVZataAyuqByn70VKrK7xukgI2B3IrhjSLr+trobH?= =?us-ascii?Q?XL+qZ6PPiQ6al23OZxFJ6AoVYI0ALozWqlaCALjOkwZcVTwZPj+9MopZR6NQ?= =?us-ascii?Q?k2UjxK0/Om4bUql5IW/HNb8BXK6l0Efe5yYNqoB6pG3fqfaVF/MFHIp0AO5q?= =?us-ascii?Q?xOGo0aJKtujT6GiesxAmniFZUtcr4ga51x6nGR92ZdjpGiUWlYyvUma6Inj9?= =?us-ascii?Q?FaKtHx4tXkmsIzyIBfw5fPnq8hCADFihSnybu1WRmrND8IGf5uHt2IjKtEKA?= =?us-ascii?Q?drU8x5pIQQgeU2GfLT0RlCtUihAOYj9op+l03v+xTe3vXS0d64Z+RgChFx8Q?= =?us-ascii?Q?lJWMbUJ98GU2QMrT04KSRz6n3OXwJl0ErL8Da163?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: SA1PR11MB5801.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 438105f8-767c-4693-842d-08da95170172 X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Sep 2022 23:32:06.6946 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: eejAGLafJDbBAHiV8I04UVEIvnhYYR+6rkWSG0RJAHGgHp00c9qST7/DhtuLhhyWEwAytmAEupCOic2Adc7rSA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY8PR11MB7134 Return-Path: isaac.w.oram@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Isaac Oram -----Original Message----- From: Benjamin Doron =20 Sent: Monday, September 12, 2022 10:13 AM To: devel@edk2.groups.io Cc: Desimone, Nathaniel L ; Sinha, Ankit ; Chiu, Chasel ; Soller, Jeremy= ; Chaganty, Rangasai V ; Oram, Isaac W Subject: [edk2-platforms][PATCH v3 4/4] KabylakeOpenBoardPkg: Example of bo= ard S3 Use silicon code to detect S3 resume state. Apply some relevant policy modi= fications. PcdPeiMemSize must be in common scope, for a DXE module to allocate require= d memory. Libraries that produce required PPIs are defined. BootScriptExecutorDxe should only be linked against a functionally compatib= le debug stack. Cc: Nate DeSimone Cc: Ankit Sinha Cc: Chasel Chiu Cc: Jeremy Soller Cc: Sai Chaganty Cc: Isaac Oram Signed-off-by: Benjamin Doron --- .../PeiFspMiscUpdUpdateLib.c | 12 +++++- .../PeiSaPolicyUpdate.c | 12 +++++- .../PeiAspireVn7Dash572GInitPreMemLib.c | 38 +++++++++++-------- .../BoardInitLib/PeiBoardInitPreMemLib.inf | 3 ++ .../AspireVn7Dash572G/OpenBoardPkg.dsc | 21 ++++++++++ .../AspireVn7Dash572G/OpenBoardPkgPcd.dsc | 16 ++------ .../PeiSiliconPolicyUpdateLib.c | 11 +++++- .../PeiSiliconPolicyUpdateLib.inf | 1 + .../PeiFspMiscUpdUpdateLib.c | 11 +++++- .../PeiSaPolicyUpdate.c | 12 +++++- .../BoardInitLib/PeiBoardInitPreMemLib.inf | 1 + .../BoardInitLib/PeiGalagoPro3InitPreMemLib.c | 27 ++++++++++++- .../PeiMultiBoardInitPreMemLib.inf | 1 + .../GalagoPro3/OpenBoardPkg.dsc | 15 ++++++++ .../GalagoPro3/OpenBoardPkgPcd.dsc | 2 +- .../PeiFspMiscUpdUpdateLib.c | 12 +++++- .../PeiSaPolicyUpdate.c | 12 +++++- .../BoardInitLib/PeiBoardInitPreMemLib.inf | 1 + .../PeiKabylakeRvp3InitPreMemLib.c | 27 ++++++++++++- .../PeiMultiBoardInitPreMemLib.inf | 1 + .../KabylakeRvp3/OpenBoardPkg.dsc | 12 ++++++ .../KabylakeRvp3/OpenBoardPkgPcd.dsc | 2 +- .../PeiSiliconPolicyUpdateLib.c | 11 +++++- .../PeiSiliconPolicyUpdateLib.inf | 1 + 24 files changed, 222 insertions(+), 40 deletions(-) diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapp= er/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform= /Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/PeiSilicon= PolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c index a9b7e446c8d6..7e4194bf4fe6 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/L +++ ibrary/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c @@ -11,6 +11,8 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include += #include + #include #include #include @@ -32,11 +34,15 @@ PeiFspMiscUpdUpdatePreMem ( ) { EFI_STATUS Status;+ EFI_BOOT_MODE = BootMode; UINTN VariableSize; V= OID *FspNvsBufferPtr; UINT8 = MorControl; VOID *MorControlPtr;= + Status =3D PeiServicesGetBootMode (&BootMode);+ ASSERT_EFI_ERROR (Stat= us);+ // // Initialize S3 Data variable (S3DataPtr). It may be used for= warm and fast boot paths. //@@ -70,7 +76,11 @@ PeiFspMiscUpdUpdatePreMem= ( &VariableSize ); DEBUG ((DEBUG_INFO, "MorContr= ol - 0x%x (%r)\n", MorControl, Status));- if (MOR_CLEAR_MEMORY_VALUE (MorC= ontrol)) {+ //+ // Do not set CleanMemory on S3 resume+ // TODO: Handle = advanced features later - capsule update is in-memory list+ //+ if (MOR_C= LEAR_MEMORY_VALUE (MorControl) && BootMode !=3D BOOT_ON_S3_RESUME) { Fs= pmUpd->FspmConfig.CleanMemory =3D (BOOLEAN)(MorControl & MOR_CLEAR_MEMORY_B= IT_MASK); } diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Das= h572G/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.c b= /Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Library/P= eiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.c index 4621cbd3ca3a..98db86570368 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/Libr= ary/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/FspWrapper/L +++ ibrary/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.c @@ -11,6 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include /** P= erforms FSP SA PEI Policy initialization.@@ -27,12 +28,17 @@ PeiFspSaPolicy= Update ( IN OUT FSPS_UPD *FspsUpd ) {+ EFI_STATUS Stat= us;+ EFI_BOOT_MODE BootMode; VOID = *Buffer; VOID *MemBuffer; UINT32 = Size; DEBUG((DEBUG_INFO, "\nUpdating SA Policy in P= ost Mem\n")); + Status =3D PeiServicesGetBootMode (&BootMode);+ ASSERT_EF= I_ERROR (Status);+ FspsUpd->FspsConfig.PeiGraphicsPeimInit =3D 1; = Size =3D 0;@@ -40,7 +46,11 @@ PeiFspSaPolicyUpdate ( PeiGetSectionFromAnyFv (PcdGetPtr (PcdGraphicsVbtGuid), EFI_SECTION_RA= W, 0, &Buffer, &Size); if (Buffer =3D=3D NULL) { DEBUG((DEBUG_WAR= N, "Could not locate VBT\n"));- } else {+ //+ // Graphics initiali= zation is unnecessary,+ // OS has present framebuffer.+ //+ } else= if (BootMode !=3D BOOT_ON_S3_RESUME) { MemBuffer =3D (VOID *)Allocat= ePages (EFI_SIZE_TO_PAGES ((UINTN)Size)); if ((MemBuffer !=3D NULL) &= & (Buffer !=3D NULL)) { CopyMem (MemBuffer, (VOID *)Buffer, (UINTN)= Size);diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Li= brary/BoardInitLib/PeiAspireVn7Dash572GInitPreMemLib.c b/Platform/Intel/Kab= ylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiAspireVn7Dash57= 2GInitPreMemLib.c index 1c9a65399b54..3029354b96cd 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiAspireVn7Dash572GInitPreMemLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/Boar +++ dInitLib/PeiAspireVn7Dash572GInitPreMemLib.c @@ -11,7 +11,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include +#include #include #include #include @@ -267,25 +269,= 31 @@ AspireVn7Dash572GBoardBootModeDetect ( VOID ) {- UINT16 ABase;+ EFI_BOOT_MODE BootMode; UINT32 = SleepType; DEBUG ((DEBUG_INFO, "Performing boot mode detection\n"= )); - // TODO: Perform advanced detection (recovery/capsule)- // FIXME: T= his violates PI specification? But BOOT_WITH* would always take precedence-= // over BOOT_ON_S{4,5}...- PchAcpiBaseGet (&ABase);- SleepType = =3D IoRead32 (ABase + R_PCH_ACPI_PM1_CNT) & B_PCH_ACPI_PM1_CNT_SLP_TYP;+ /= / Known sane defaults; TODO: Consider "default"?+ BootMode =3D BOOT_WITH_F= ULL_CONFIGURATION; - switch (SleepType) {- case V_PCH_ACPI_PM1_CNT_S3:-= return BOOT_ON_S3_RESUME;- case V_PCH_ACPI_PM1_CNT_S4:- retur= n BOOT_ON_S4_RESUME;-// case V_PCH_ACPI_PM1_CNT_S5:-// return BOOT_= ON_S5_RESUME;- default:- return BOOT_WITH_FULL_CONFIGURATION;+ // = TODO: Perform advanced detection (capsule/recovery)+ // TODO: Perform "IsF= irstBoot" test with VariablePpi for "minimal"/"assume"+ if (GetSleepTypeAf= terWakeup (&SleepType)) {+ switch (SleepType) {+ case V_PCH_ACPI_PM= 1_CNT_S3:+ BootMode =3D BOOT_ON_S3_RESUME;+ break;+ case= V_PCH_ACPI_PM1_CNT_S4:+ BootMode =3D BOOT_ON_S4_RESUME;+ bre= ak;+ case V_PCH_ACPI_PM1_CNT_S5:+ BootMode =3D BOOT_ON_S5_RESUM= E;+ break;+ } }++ DEBUG ((DEBUG_INFO, "BootMode is 0x%x\n", Bo= otMode));++ return BootMode; }diff --git a/Platform/Intel/KabylakeOpenBoar= dPkg/AspireVn7Dash572G/Library/BoardInitLib/PeiBoardInitPreMemLib.inf b/Pla= tform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardInitLib/Pei= BoardInitPreMemLib.inf index cd9f979d313c..c53114e15450 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/BoardIn= itLib/PeiBoardInitPreMemLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Library/Boar +++ dInitLib/PeiBoardInitPreMemLib.inf @@ -25,11 +25,14 @@ TimerLib PchCycleDecodingLib PchResetLib+ PciLib IoLib EcLib = BoardEcLib GpioLib PeiLib+ PeiServicesLib+ PchPmcLib [Packages] Mi= nPlatformPkg/MinPlatformPkg.decdiff --git a/Platform/Intel/KabylakeOpenBoar= dPkg/AspireVn7Dash572G/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardP= kg/AspireVn7Dash572G/OpenBoardPkg.dsc index efe29c617a02..20c42a7c1c20 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg.ds= c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg +++ .dsc @@ -249,6 +249,7 @@ # Silicon Package ####################################### ReportCpuH= obLib|IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf+ SmmAcce= ssLib|IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLibSmramc/PeiSm= mAccessLib.inf ####################################### # Platform Pack= age@@ -712,6 +713,26 @@ !endif } +!if gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable =3D= =3D TRUE+ MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExec= utorDxe.inf {+ + # On S3 resume, RSC is in end-of-B= S state+ # - Moreover: Library cannot effectively use some end-of-BS e= vents+ DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSeri= alPort.inf+ SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSer= ialPortLibNull.inf+ # Reverse-ranked priority list+# TODO: Requires te= sting+# - Strongly suspect DebugLibSerialPort constructor presents PeiDxeSe= rialPortLibMem dependency on services as a bug+!if FALSE # $(USE_MEMORY_LO= GGING) =3D=3D TRUE+ SerialPortLib|MdeModulePkg/Library/PeiDxeSerialPor= tLibMem/DxeSerialPortLibMem.inf+!endif+ # Also, can debug CpuException= HandlerLib+!if $(USE_HDMI_DEBUG_PORT) =3D=3D TRUE+ SerialPortLib|$(PLA= TFORM_BOARD_PACKAGE)/Library/I2cHdmiDebugSerialPortLib/BootScriptExecutorDx= eI2cHdmiDebugSerialPortLib.inf+!endif+ }+!endif+ !endif ###############= ########################diff --git a/Platform/Intel/KabylakeOpenBoardPkg/As= pireVn7Dash572G/OpenBoardPkgPcd.dsc b/Platform/Intel/KabylakeOpenBoardPkg/A= spireVn7Dash572G/OpenBoardPkgPcd.dsc index 3ed7aa0a2b10..490c3ee6bf76 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkgPcd= .dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/OpenBoardPkg +++ Pcd.dsc @@ -127,10 +127,7 @@ # PcdIpmiFeatureEnable will not be enabled (no BMC) # TODO: Can be bui= ld-time (user) choice gNetworkFeaturePkgTokenSpaceGuid.PcdNetworkFeatureE= nable |FALSE- # TODO: Continue developing support. Broken a= t present.- # - PeiSmmAccessLib in IntelSiliconPkg seems like a stub- # = - May require a PeiSmmControlLib to SMM communicate- gS3FeaturePkgTokenSp= aceGuid.PcdS3FeatureEnable |FALSE+ gS3FeaturePkgT= okenSpaceGuid.PcdS3FeatureEnable |TRUE # TODO: D= efinitions (now added SmbiosDxe) gSmbiosFeaturePkgTokenSpaceGuid.PcdSmbio= sFeatureEnable |TRUE # Requires actual hook-up@@ -335,6 = +332,7 @@ gMinPlatformPkgTokenSpaceGuid.PcdMaxCpuCoreCount|4 gMinPlatformPkgToke= nSpaceGuid.PcdMaxCpuThreadCount|2 gMinPlatformPkgTokenSpaceGuid.PcdPciExp= ressRegionLength|0x10000000+ gIntelFsp2WrapperTokenSpaceGuid.PcdPeiMinMemS= ize|0x3800000 # # The PCDs are used to control the Windows SMM Securit= y Mitigations Table - Protection Flags@@ -360,13 +358,8 @@ # 0x7F, 0xFF, 0x04, 0x00}
gMinPlatformPkgTokenSpaceGuid.PcdTr= ustedConsoleInputDevicePath|{0x02, 0x01, 0x0C, 0x00, 0xd0, 0x41, 0x03, 0x0= A, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x06, 0x00, 0x00, 0x1F, 0x02, 0x01,= 0x0C, 0x00, 0xd0, 0x41, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0= x04, 0x00} -!if $(TARGET) =3D=3D RELEASE- gMinPlatformPkgTokenSpaceGuid.Pc= dPlatformEfiReservedMemorySize|0x800-!else- gMinPlatformPkgTokenSpaceGuid.= PcdPlatformEfiReservedMemorySize|0x188B # TODO-!endif- # TODO: Consider u= sing reserved space instead for debug log- gMinPlatformPkgTokenSpaceGuid.P= cdPlatformEfiRtDataMemorySize|0x200+ gMinPlatformPkgTokenSpaceGuid.PcdPlat= formEfiAcpiNvsMemorySize|0x4800+ gMinPlatformPkgTokenSpaceGuid.PcdPlatform= EfiRtDataMemorySize|0x100 !if $(TARGET) =3D=3D RELEASE gMinPlatformPkgTok= enSpaceGuid.PcdPlatformEfiRtCodeMemorySize|0x70 !else@@ -447,7 +440,6 @@ # Edk2 Configuration ###################################### gIntelFs= p2PkgTokenSpaceGuid.PcdGlobalDataPointerAddress|0xFED00148- gIntelFsp2Wrap= perTokenSpaceGuid.PcdPeiMinMemSize|0x3800000 ###########################= ########### # Platform Configurationdiff --git a/Platform/Intel/KabylakeO= penBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiS= iliconPolicyUpdateLib.c b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash= 572G/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c index 3764f7c3ac09..04cd2e741489 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/= PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Libra +++ ry/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c @@ -20,6 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include #include @@ -549,6 +550,7 @@ SiliconPolicyUpdatePostMem ( ) { EFI_STATUS Status;+ EFI_BOOT_MODE = BootMode; VOID *Buffer; VOID = *MemBuffer; UINT32 Size;@@ -= 557,6 +559,9 @@ SiliconPolicyUpdatePostMem ( DEBUG((DEBUG_INFO, "\nUpdating Policy in Post Mem\n")); + Status =3D P= eiServicesGetBootMode (&BootMode);+ ASSERT_EFI_ERROR (Status);+ GtConfig= =3D NULL; Status =3D GetConfigBlock ((VOID *) Policy, &gGraphicsPeiConfi= gGuid, (VOID *)&GtConfig); ASSERT_EFI_ERROR (Status);@@ -571,7 +576,11 @@= SiliconPolicyUpdatePostMem ( PeiGetSectionFromAnyFv (PcdGetPtr (PcdGraphicsVbtGuid), EFI_SECTION_RA= W, 0, &Buffer, &Size); if (Buffer =3D=3D NULL) { DEBUG((DEBUG_WAR= N, "Could not locate VBT\n"));- } else {+ //+ // Graphics initiali= zation is unnecessary,+ // OS has present framebuffer.+ //+ } else= if (BootMode !=3D BOOT_ON_S3_RESUME) { MemBuffer =3D (VOID *)Allocat= ePages (EFI_SIZE_TO_PAGES ((UINTN)Size)); if ((MemBuffer !=3D NULL) &= & (Buffer !=3D NULL)) { CopyMem (MemBuffer, (VOID *)Buffer, (UINTN)= Size);diff --git a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Po= licy/Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf b/Plat= form/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/PeiSilicon= PolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf index 1ce26fc3dcec..31a45292209d 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Library/= PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/AspireVn7Dash572G/Policy/Libra +++ ry/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf @@ -23,6 +23,7 @@ BaseMemoryLib MemoryAllocationLib PeiLib+ PeiServicesLib CpuPlatf= ormLib PchPcieRpLib PchInfoLibdiff --git a/Platform/Intel/KabylakeOpenB= oardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMi= scUpdUpdateLib.c b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrappe= r/Library/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c index dbc84631acaa..ce309bd378d2 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/Pei= SiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/ +++ PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c @@ -11,6 +11,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include <= FspmUpd.h>@@ -36,11 +37,15 @@ PeiFspMiscUpdUpdatePreMem ( ) { EFI_STATUS Status;+ EFI_BOOT_MODE = BootMode; UINTN VariableSize; V= OID *FspNvsBufferPtr; UINT8 = MorControl; VOID *MorControlPtr;= + Status =3D PeiServicesGetBootMode (&BootMode);+ ASSERT_EFI_ERROR (Stat= us);+ // // Initialize S3 Data variable (S3DataPtr). It may be used for= warm and fast boot paths. //@@ -75,7 +80,11 @@ PeiFspMiscUpdUpdatePreMem= ( &VariableSize ); DEBUG ((DEBUG_INFO, "MorContr= ol - 0x%x (%r)\n", MorControl, Status));- if (MOR_CLEAR_MEMORY_VALUE (MorC= ontrol)) {+ //+ // Do not set CleanMemory on S3 resume+ // TODO: Handle = advanced features later - capsule update is in-memory list+ //+ if (MOR_C= LEAR_MEMORY_VALUE (MorControl) && BootMode !=3D BOOT_ON_S3_RESUME) { Fs= pmUpd->FspmConfig.CleanMemory =3D (BOOLEAN)(MorControl & MOR_CLEAR_MEMORY_B= IT_MASK); } diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/F= spWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.c b/Platfo= rm/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/PeiSiliconPolic= yUpdateLibFsp/PeiSaPolicyUpdate.c index 133b8c963f65..6fd45cc79f61 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/Pei= SiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/FspWrapper/Library/ +++ PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.c @@ -17,6 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include /** P= erforms FSP SA PEI Policy initialization.@@ -33,12 +34,17 @@ PeiFspSaPolicy= Update ( IN OUT FSPS_UPD *FspsUpd ) {+ EFI_STATUS Stat= us;+ EFI_BOOT_MODE BootMode; VOID = *Buffer; VOID *MemBuffer; UINT32 = Size; DEBUG((DEBUG_INFO, "\nUpdating SA Policy in P= ost Mem\n")); + Status =3D PeiServicesGetBootMode (&BootMode);+ ASSERT_EF= I_ERROR (Status);+ FspsUpd->FspsConfig.PeiGraphicsPeimInit =3D 1; = Size =3D 0;@@ -46,7 +52,11 @@ PeiFspSaPolicyUpdate ( PeiGetSectionFromAnyFv (PcdGetPtr (PcdGraphicsVbtGuid), EFI_SECTION_RA= W, 0, &Buffer, &Size); if (Buffer =3D=3D NULL) { DEBUG((DEBUG_WAR= N, "Could not locate VBT\n"));- } else {+ //+ // Graphics initiali= zation is unnecessary,+ // OS has present framebuffer.+ //+ } else= if (BootMode !=3D BOOT_ON_S3_RESUME) { MemBuffer =3D (VOID *)Allocat= ePages (EFI_SIZE_TO_PAGES ((UINTN)Size)); if ((MemBuffer !=3D NULL) &= & (Buffer !=3D NULL)) { CopyMem (MemBuffer, (VOID *)Buffer, (UINTN)= Size);diff --git a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Library/B= oardInitLib/PeiBoardInitPreMemLib.inf b/Platform/Intel/KabylakeOpenBoardPkg= /GalagoPro3/Library/BoardInitLib/PeiBoardInitPreMemLib.inf index d6c91cd2b94b..5b3a6921d0ee 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Library/BoardInitLib/P= eiBoardInitPreMemLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Library/BoardInitLi +++ b/PeiBoardInitPreMemLib.inf @@ -23,6 +23,7 @@ PcdLib SiliconInitLib PchResetLib+ PchPmcLib [Packages] MinPlatf= ormPkg/MinPlatformPkg.decdiff --git a/Platform/Intel/KabylakeOpenBoardPkg/G= alagoPro3/Library/BoardInitLib/PeiGalagoPro3InitPreMemLib.c b/Platform/Inte= l/KabylakeOpenBoardPkg/GalagoPro3/Library/BoardInitLib/PeiGalagoPro3InitPre= MemLib.c index 051dac0b204d..1cd2baf4a4dd 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Library/BoardInitLib/P= eiGalagoPro3InitPreMemLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Library/BoardInitLi +++ b/PeiGalagoPro3InitPreMemLib.c @@ -14,6 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #incl= ude #include @@ -236,5 +237,29 = @@ GalagoPro3BoardBootModeDetect ( VOID ) {- return BOOT_WITH_FULL_CONFIGURATION;+ EFI_BOOT_MODE BootM= ode;+ UINT32 SleepType;++ DEBUG ((DEBUG_INFO, "Performing boot mo= de detection\n"));++ // Known sane defaults+ BootMode =3D BOOT_WITH_FULL_= CONFIGURATION;++ if (GetSleepTypeAfterWakeup (&SleepType)) {+ switch (S= leepType) {+ case V_PCH_ACPI_PM1_CNT_S3:+ BootMode =3D BOOT_ON_= S3_RESUME;+ break;+ case V_PCH_ACPI_PM1_CNT_S4:+ BootMod= e =3D BOOT_ON_S4_RESUME;+ break;+ case V_PCH_ACPI_PM1_CNT_S5:+ = BootMode =3D BOOT_ON_S5_RESUME;+ break;+ }+ }++ DEBUG ((= DEBUG_INFO, "BootMode is 0x%x\n", BootMode));++ return BootMode; }diff --g= it a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Library/BoardInitLib/Pe= iMultiBoardInitPreMemLib.inf b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPr= o3/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.inf index fe31f421356e..20ddac1d994d 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Library/BoardInitLib/P= eiMultiBoardInitPreMemLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Library/BoardInitLi +++ b/PeiMultiBoardInitPreMemLib.inf @@ -25,6 +25,7 @@ SiliconInitLib MultiBoardInitSupportLib PchResetLib+ PchPmcLib [Pa= ckages] MinPlatformPkg/MinPlatformPkg.decdiff --git a/Platform/Intel/Kaby= lakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenB= oardPkg/GalagoPro3/OpenBoardPkg.dsc index f0e9a21ccad9..219ef20e55f0 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc @@ -180,6 +180,7 @@ # Silicon Package ####################################### ReportCpuH= obLib|IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf+ SmmAcce= ssLib|IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLibSmramc/PeiSm= mAccessLib.inf ####################################### # Platform Pack= age@@ -494,6 +495,20 @@ !endif } +!if gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable =3D= =3D TRUE+ MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExec= utorDxe.inf {+ + # On S3 resume, RSC is in end-of-B= S state+ # - Moreover: Libraries cannot effectively use some end-of-BS= events+ DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSe= rialPort.inf+ SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseS= erialPortLibNull.inf+ # Reverse-ranked priority list+!if gKabylakeOpen= BoardPkgTokenSpaceGuid.PcdI2cHdmiDebugPortEnable =3D=3D TRUE+ SerialPo= rtLib|$(PLATFORM_BOARD_PACKAGE)/Library/I2cHdmiDebugSerialPortLib/BootScrip= tExecutorDxeI2cHdmiDebugSerialPortLib.inf+!endif+ }+!endif+ !endif ####= ###################################diff --git a/Platform/Intel/KabylakeOpen= BoardPkg/GalagoPro3/OpenBoardPkgPcd.dsc b/Platform/Intel/KabylakeOpenBoardP= kg/GalagoPro3/OpenBoardPkgPcd.dsc index 8180312f5ca5..7a73f5a831c6 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkgPcd.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkgPcd.dsc @@ -279,6 +279,7 @@ gMinPlatformPkgTokenSpaceGuid.PcdMaxCpuCoreCount|8 gMinPlatformPkgToke= nSpaceGuid.PcdMaxCpuThreadCount|2 gMinPlatformPkgTokenSpaceGuid.PcdPciExp= ressRegionLength|0x10000000+ gIntelFsp2WrapperTokenSpaceGuid.PcdPeiMinMemS= ize|0x3800000 # # The PCDs are used to control the Windows SMM Securit= y Mitigations Table - Protection Flags@@ -380,7 +381,6 @@ ###################################### gEfiMdeModulePkgTokenSpaceGuid.= PcdVpdBaseAddress|0x0 gIntelFsp2PkgTokenSpaceGuid.PcdGlobalDataPointerAdd= ress|0xFED00148- gIntelFsp2WrapperTokenSpaceGuid.PcdPeiMinMemSize|0x380000= 0 ###################################### # Platform Configurationdiff = --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library= /PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c b/Platform/Intel/Kab= ylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconPolicyUpdateLib= Fsp/PeiFspMiscUpdUpdateLib.c index 699f4297fad6..71b03f2da464 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/P= eiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Librar +++ y/PeiSiliconPolicyUpdateLibFsp/PeiFspMiscUpdUpdateLib.c @@ -11,11 +11,11 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include = #include #include +#include #include #include= #include - #include #include <= Library/DebugPrintErrorLevelLib.h> #include @@ -36,11 +36= ,15 @@ PeiFspMiscUpdUpdatePreMem ( ) { EFI_STATUS Status;+ EFI_BOOT_MODE = BootMode; UINTN VariableSize; V= OID *FspNvsBufferPtr; UINT8 = MorControl; VOID *MorControlPtr;= + Status =3D PeiServicesGetBootMode (&BootMode);+ ASSERT_EFI_ERROR (Stat= us);+ // // Initialize S3 Data variable (S3DataPtr). It may be used for= warm and fast boot paths. //@@ -73,7 +77,11 @@ PeiFspMiscUpdUpdatePreMem= ( &VariableSize ); DEBUG ((DEBUG_INFO, "MorContr= ol - 0x%x (%r)\n", MorControl, Status));- if (MOR_CLEAR_MEMORY_VALUE (MorC= ontrol)) {+ //+ // Do not set CleanMemory on S3 resume+ // TODO: Handle = advanced features later - capsule update is in-memory list+ //+ if (MOR_C= LEAR_MEMORY_VALUE (MorControl) && BootMode !=3D BOOT_ON_S3_RESUME) { Fs= pmUpd->FspmConfig.CleanMemory =3D (BOOLEAN)(MorControl & MOR_CLEAR_MEMORY_B= IT_MASK); } diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3= /FspWrapper/Library/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.c b/Plat= form/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/PeiSiliconP= olicyUpdateLibFsp/PeiSaPolicyUpdate.c index d6ec3e38dd7e..e855207af0d1 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Library/P= eiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/FspWrapper/Librar +++ y/PeiSiliconPolicyUpdateLibFsp/PeiSaPolicyUpdate.c @@ -17,6 +17,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include /** P= erforms FSP SA PEI Policy initialization.@@ -33,12 +34,17 @@ PeiFspSaPolicy= Update ( IN OUT FSPS_UPD *FspsUpd ) {+ EFI_STATUS Stat= us;+ EFI_BOOT_MODE BootMode; VOID = *Buffer; VOID *MemBuffer; UINT32 = Size; DEBUG((DEBUG_INFO, "\nUpdating SA Policy in P= ost Mem\n")); + Status =3D PeiServicesGetBootMode (&BootMode);+ ASSERT_EF= I_ERROR (Status);+ FspsUpd->FspsConfig.PeiGraphicsPeimInit =3D 1; = Size =3D 0;@@ -46,7 +52,11 @@ PeiFspSaPolicyUpdate ( PeiGetSectionFromAnyFv (PcdGetPtr (PcdGraphicsVbtGuid), EFI_SECTION_RA= W, 0, &Buffer, &Size); if (Buffer =3D=3D NULL) { DEBUG((DEBUG_WAR= N, "Could not locate VBT\n"));- } else {+ //+ // Graphics initiali= zation is unnecessary,+ // OS has present framebuffer.+ //+ } else= if (BootMode !=3D BOOT_ON_S3_RESUME) { MemBuffer =3D (VOID *)Allocat= ePages (EFI_SIZE_TO_PAGES ((UINTN)Size)); if ((MemBuffer !=3D NULL) &= & (Buffer !=3D NULL)) { CopyMem (MemBuffer, (VOID *)Buffer, (UINTN)= Size);diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library= /BoardInitLib/PeiBoardInitPreMemLib.inf b/Platform/Intel/KabylakeOpenBoardP= kg/KabylakeRvp3/Library/BoardInitLib/PeiBoardInitPreMemLib.inf index 850fc514188b..e0022e8d6118 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardInitLib= /PeiBoardInitPreMemLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardInit +++ Lib/PeiBoardInitPreMemLib.inf @@ -24,6 +24,7 @@ SiliconInitLib EcLib PchResetLib+ PchPmcLib [Packages] MinPlatfo= rmPkg/MinPlatformPkg.decdiff --git a/Platform/Intel/KabylakeOpenBoardPkg/Ka= bylakeRvp3/Library/BoardInitLib/PeiKabylakeRvp3InitPreMemLib.c b/Platform/I= ntel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardInitLib/PeiKabylakeRvp3= InitPreMemLib.c index 87ae3b531ed6..02cd37227e50 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardInitLib= /PeiKabylakeRvp3InitPreMemLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardInit +++ Lib/PeiKabylakeRvp3InitPreMemLib.c @@ -13,6 +13,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #incl= ude #include @@ -330,5 +331,29 = @@ KabylakeRvp3BoardBootModeDetect ( VOID ) {- return BOOT_WITH_FULL_CONFIGURATION;+ EFI_BOOT_MODE BootM= ode;+ UINT32 SleepType;++ DEBUG ((DEBUG_INFO, "Performing boot mo= de detection\n"));++ // Known sane defaults+ BootMode =3D BOOT_WITH_FULL_= CONFIGURATION;++ if (GetSleepTypeAfterWakeup (&SleepType)) {+ switch (S= leepType) {+ case V_PCH_ACPI_PM1_CNT_S3:+ BootMode =3D BOOT_ON_= S3_RESUME;+ break;+ case V_PCH_ACPI_PM1_CNT_S4:+ BootMod= e =3D BOOT_ON_S4_RESUME;+ break;+ case V_PCH_ACPI_PM1_CNT_S5:+ = BootMode =3D BOOT_ON_S5_RESUME;+ break;+ }+ }++ DEBUG ((= DEBUG_INFO, "BootMode is 0x%x\n", BootMode));++ return BootMode; }diff --g= it a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardInitLib/= PeiMultiBoardInitPreMemLib.inf b/Platform/Intel/KabylakeOpenBoardPkg/Kabyla= keRvp3/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.inf index 23fe6b6f03c5..0112bf84a193 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardInitLib= /PeiMultiBoardInitPreMemLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardInit +++ Lib/PeiMultiBoardInitPreMemLib.inf @@ -26,6 +26,7 @@ MultiBoardInitSupportLib EcLib PchResetLib+ PchPmcLib [Packages] = MinPlatformPkg/MinPlatformPkg.decdiff --git a/Platform/Intel/KabylakeOpenB= oardPkg/KabylakeRvp3/OpenBoardPkg.dsc b/Platform/Intel/KabylakeOpenBoardPkg= /KabylakeRvp3/OpenBoardPkg.dsc index 37837eeb04bf..1634d9b31f00 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc @@ -202,6 +202,7 @@ # Silicon Package ####################################### ReportCpuH= obLib|IntelSiliconPkg/Library/ReportCpuHobLib/ReportCpuHobLib.inf+ SmmAcce= ssLib|IntelSiliconPkg/Feature/SmmAccess/Library/PeiSmmAccessLibSmramc/PeiSm= mAccessLib.inf ####################################### # Platform Pack= age@@ -506,6 +507,17 @@ !endif } +!if gS3FeaturePkgTokenSpaceGuid.PcdS3FeatureEnable =3D= =3D TRUE+ MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/BootScriptExec= utorDxe.inf {+ + # On S3 resume, RSC is in end-of-B= S state+ # - Moreover: Libraries cannot effectively use some end-of-BS= events+ DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSe= rialPort.inf+ SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseS= erialPortLibNull.inf+ # TODO: Insert a reverse-ranked priority list of= compatible libraries here+ }+!endif+ !endif ##########################= #############diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/= OpenBoardPkgPcd.dsc b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Open= BoardPkgPcd.dsc index cfd032814850..87510748783f 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.dsc +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkgPcd.d +++ sc @@ -279,6 +279,7 @@ gMinPlatformPkgTokenSpaceGuid.PcdMaxCpuCoreCount|8 gMinPlatformPkgToke= nSpaceGuid.PcdMaxCpuThreadCount|2 gMinPlatformPkgTokenSpaceGuid.PcdPciExp= ressRegionLength|0x10000000+ gIntelFsp2WrapperTokenSpaceGuid.PcdPeiMinMemS= ize|0x3800000 # # The PCDs are used to control the Windows SMM Securit= y Mitigations Table - Protection Flags@@ -349,7 +350,6 @@ ###################################### gEfiMdeModulePkgTokenSpaceGuid.= PcdVpdBaseAddress|0x0 gIntelFsp2PkgTokenSpaceGuid.PcdGlobalDataPointerAdd= ress|0xFED00148- gIntelFsp2WrapperTokenSpaceGuid.PcdPeiMinMemSize|0x380000= 0 ###################################### # Platform Configurationdiff = --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/Pei= SiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c b/Platform/Intel/Kabylak= eOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpdateLib/PeiSili= conPolicyUpdateLib.c index 22aadc0221df..bd3da7f38416 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSi= liconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/Pe +++ iSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.c @@ -20,6 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include #include @@ -513,6 +514,7 @@ SiliconPolicyUpdatePostMem ( ) { EFI_STATUS Status;+ EFI_BOOT_MODE = BootMode; VOID *Buffer; VOID = *MemBuffer; UINT32 Size;@@ -= 521,6 +523,9 @@ SiliconPolicyUpdatePostMem ( DEBUG((DEBUG_INFO, "\nUpdating Policy in Post Mem\n")); + Status =3D P= eiServicesGetBootMode (&BootMode);+ ASSERT_EFI_ERROR (Status);+ GtConfig= =3D NULL; Status =3D GetConfigBlock ((VOID *) Policy, &gGraphicsPeiConfi= gGuid, (VOID *)&GtConfig); ASSERT_EFI_ERROR (Status);@@ -535,7 +540,11 @@= SiliconPolicyUpdatePostMem ( PeiGetSectionFromAnyFv (PcdGetPtr (PcdGraphicsVbtGuid), EFI_SECTION_RA= W, 0, &Buffer, &Size); if (Buffer =3D=3D NULL) { DEBUG((DEBUG_WAR= N, "Could not locate VBT\n"));- } else {+ //+ // Graphics initiali= zation is unnecessary,+ // OS has present framebuffer.+ //+ } else= if (BootMode !=3D BOOT_ON_S3_RESUME) { MemBuffer =3D (VOID *)Allocat= ePages (EFI_SIZE_TO_PAGES ((UINTN)Size)); if ((MemBuffer !=3D NULL) &= & (Buffer !=3D NULL)) { CopyMem (MemBuffer, (VOID *)Buffer, (UINTN)= Size);diff --git a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/= Library/PeiSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf b/Platform/= Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSiliconPolicyUpda= teLib/PeiSiliconPolicyUpdateLib.inf index 25eae88f5989..e9a23593e133 100644 --- a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/PeiSi= liconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf +++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Policy/Library/Pe +++ iSiliconPolicyUpdateLib/PeiSiliconPolicyUpdateLib.inf @@ -23,6 +23,7 @@ BaseMemoryLib MemoryAllocationLib PeiLib+ PeiServicesLib CpuPlatf= ormLib PchPcieRpLib PchInfoLib--=20 2.37.2