From nobody Mon Feb 9 01:20:51 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+44006+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44006+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1563516172; cv=none; d=zoho.com; s=zohoarc; b=BGwHXgjLea9NDI+uBw9G7yR1snVf7TyIOhMx34Fo7UZDBtgWzxNDQrpgSBtPg1pxgSEAPdVYtXZuMGmhA//PIxHtx9T89ZeRBP9ShZhbLs1K51UvfMYc9VALGl0mhLvBILKi8G1S/qvCdvZpQ8LboNhln5+BJ+5B0EEzJIiZdOE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1563516172; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To:ARC-Authentication-Results; bh=Ua3WyOYl8Cwo7v9y2YH9mltKoULTY3xzQWiOKOwPKdE=; b=eXuoab3NYV2ipFasoq8U4aRZ6wac+sVhWgPnJMe+21bbh7tREC9zwxGYDvpjF0aNrhnVFu/PFmKYuwR0bu2cyWUM1gxjJ4Sf3vUw2GabmYfh39uZd/1jl6SXEEvtyUuFO11FxsnSKJdPwDeqOxiQUx4ALaF9RrVgS4VBqdtQDaU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+44006+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1563516172414149.4882146406735; Thu, 18 Jul 2019 23:02:52 -0700 (PDT) Return-Path: X-Received: from mga14.intel.com (mga14.intel.com []) by groups.io with SMTP; Thu, 18 Jul 2019 23:02:51 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 18 Jul 2019 23:02:50 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,281,1559545200"; d="scan'208";a="343599871" X-Received: from mdkinney-mobl2.amr.corp.intel.com ([10.254.83.213]) by orsmga005.jf.intel.com with ESMTP; 18 Jul 2019 23:02:50 -0700 From: "Michael D Kinney" To: devel@edk2.groups.io Cc: Zailiang Sun , Yi Qian , Gary Lin Subject: [edk2-devel] [edk2-platforms Patch V2 1/5] Vlv2TbltDevicePkg/PlatformPei: Add boot mode detection Date: Thu, 18 Jul 2019 23:02:43 -0700 Message-Id: <20190719060247.10132-2-michael.d.kinney@intel.com> In-Reply-To: <20190719060247.10132-1-michael.d.kinney@intel.com> References: <20190719060247.10132-1-michael.d.kinney@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1563516171; bh=m95nH+dcHOr3Ub1JuvF/AZXX65ADiP9TXm4sCP1YGWU=; h=Cc:Date:From:Reply-To:Subject:To; b=HATUZySGy7D7KPOwfE3dkcv0Nk6eJt4dIxz3VBVYTj8k+HidIX0CxAFuJuenI62SrFg JuM10KTeAriMnb/UsG5OPYEyCltf8qCTldD1Y2ykxxsdddzNkEbwsI/rfaxiFmvCTMUjx RCPhpOPhHtncuHB//sDBH5cSobOGrNV98Hs= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" Add boot mode detection back into PlatformPei that was inadvertently removed in the following commit: https://github.com/tianocore/edk2-platforms/commit/d6211390793fbd0a89b14001= c43e0ef942c85425 Boot mode detection at this point is required to detect the boot mode of BOOT_ON_FLASH_UPDATE that is required to detect, coalesce, and process UEFI Capsules. Cc: Zailiang Sun Cc: Yi Qian Cc: Gary Lin Signed-off-by: Michael D Kinney Reviewed-by: Zailiang Sun --- .../Vlv2TbltDevicePkg/PlatformPei/BootMode.c | 92 ++++++++++++++++++- .../Vlv2TbltDevicePkg/PlatformPei/Platform.c | 6 ++ .../Vlv2TbltDevicePkg/PlatformPei/Platform.h | 17 ++++ 3 files changed, 114 insertions(+), 1 deletion(-) diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/BootMode.c b/Plat= form/Intel/Vlv2TbltDevicePkg/PlatformPei/BootMode.c index 5269b1ed39..4c0e660b7f 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/BootMode.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/BootMode.c @@ -82,7 +82,7 @@ CapsulePpiNotifyCallback ( if (Status =3D=3D EFI_SUCCESS) { if (Capsule->CheckCapsuleUpdate ((EFI_PEI_SERVICES**)PeiServices) = =3D=3D EFI_SUCCESS) { BootMode =3D BOOT_ON_FLASH_UPDATE; - DEBUG ((EFI_D_ERROR, "Setting BootMode to BOOT_ON_FLASH_UPDATE\n")= ); + DEBUG ((DEBUG_ERROR, "Setting BootMode to BOOT_ON_FLASH_UPDATE\n")= ); Status =3D (*PeiServices)->SetBootMode((const EFI_PEI_SERVICES **)= PeiServices, BootMode); ASSERT_EFI_ERROR (Status); } @@ -92,6 +92,96 @@ CapsulePpiNotifyCallback ( return Status; } =20 +EFI_STATUS +UpdateBootMode ( + IN CONST EFI_PEI_SERVICES **PeiServices + ) +{ + EFI_STATUS Status; + EFI_BOOT_MODE BootMode; + UINT16 SleepType; + CHAR16 *strBootMode; + + Status =3D (*PeiServices)->GetBootMode(PeiServices, &BootMode); + ASSERT_EFI_ERROR (Status); + if (BootMode =3D=3D BOOT_IN_RECOVERY_MODE){ + return Status; + } + + // + // Let's assume things are OK if not told otherwise + // + BootMode =3D BOOT_WITH_FULL_CONFIGURATION; + + if (GetSleepTypeAfterWakeup (PeiServices, &SleepType)) { + switch (SleepType) { + case V_PCH_ACPI_PM1_CNT_S3: + BootMode =3D BOOT_ON_S3_RESUME; + Status =3D (*PeiServices)->NotifyPpi (PeiServices, &mCapsuleNotify= List[0]); + ASSERT_EFI_ERROR (Status); + break; + + case V_PCH_ACPI_PM1_CNT_S4: + BootMode =3D BOOT_ON_S4_RESUME; + break; + + case V_PCH_ACPI_PM1_CNT_S5: + BootMode =3D BOOT_ON_S5_RESUME; + break; + } // switch (SleepType) + } + + if (IsFastBootEnabled (PeiServices)) { + DEBUG ((DEBUG_INFO, "Prioritizing Boot mode to BOOT_WITH_MINIMAL_CONFI= GURATION\n")); + PrioritizeBootMode (&BootMode, BOOT_WITH_MINIMAL_CONFIGURATION); + } + + switch (BootMode) { + case BOOT_WITH_FULL_CONFIGURATION: + strBootMode =3D L"BOOT_WITH_FULL_CONFIGURATION"; + break; + case BOOT_WITH_MINIMAL_CONFIGURATION: + strBootMode =3D L"BOOT_WITH_MINIMAL_CONFIGURATION"; + break; + case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES: + strBootMode =3D L"BOOT_ASSUMING_NO_CONFIGURATION_CHANGES"; + break; + case BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS: + strBootMode =3D L"BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS"; + break; + case BOOT_WITH_DEFAULT_SETTINGS: + strBootMode =3D L"BOOT_WITH_DEFAULT_SETTINGS"; + break; + case BOOT_ON_S4_RESUME: + strBootMode =3D L"BOOT_ON_S4_RESUME"; + break; + case BOOT_ON_S5_RESUME: + strBootMode =3D L"BOOT_ON_S5_RESUME"; + break; + case BOOT_ON_S2_RESUME: + strBootMode =3D L"BOOT_ON_S2_RESUME"; + break; + case BOOT_ON_S3_RESUME: + strBootMode =3D L"BOOT_ON_S3_RESUME"; + + break; + case BOOT_ON_FLASH_UPDATE: + strBootMode =3D L"BOOT_ON_FLASH_UPDATE"; + break; + case BOOT_IN_RECOVERY_MODE: + strBootMode =3D L"BOOT_IN_RECOVERY_MODE"; + break; + default: + strBootMode =3D L"Unknown boot mode"; + } // switch (BootMode) + + DEBUG ((DEBUG_ERROR, "Setting BootMode to %s\n", strBootMode)); + Status =3D (*PeiServices)->SetBootMode(PeiServices, BootMode); + ASSERT_EFI_ERROR (Status); + + return Status; +} + /** Get sleep type after wakeup =20 diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.c b/Plat= form/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.c index 90998871dc..1b23bc9740 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.c +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.c @@ -813,6 +813,12 @@ PeiInitPlatform ( sizeof (EFI_PLATFORM_INFO_HOB) ); =20 + // + // Set the new boot mode for MRC + // + Status =3D UpdateBootMode (PeiServices); + ASSERT_EFI_ERROR (Status); + DEBUG((EFI_D_INFO, "Setup MMIO size ... \n\n")); =20 // diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.h b/Plat= form/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.h index 4f71e519e0..e2e07dc446 100644 --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.h +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.h @@ -21,6 +21,23 @@ typedef struct { =20 #define STALL_PEIM_FROM_THIS(a) CR (a, STALL_CALLBACK_STATE_INFORMATION, S= tallNotify, STALL_PEIM_SIGNATURE) =20 +/** + Peform the boot mode determination logic + If the box is closed, then + 1. If it's first time to boot, it's boot with full config . + 2. If the ChassisIntrution is selected, force to be a boot with full con= fig + 3. Otherwise it's boot with no change. + + @param PeiServices General purpose services available to every PEIM. + @param BootMode The detected boot mode. + + @retval EFI_SUCCESS if the boot mode could be set +**/ +EFI_STATUS +UpdateBootMode ( + IN CONST EFI_PEI_SERVICES **PeiServices + ); + /** This function reset the entire platform, including all processor and dev= ices, and reboots the system. --=20 2.21.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#44006): https://edk2.groups.io/g/devel/message/44006 Mute This Topic: https://groups.io/mt/32523931/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-