public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sun, Zailiang" <zailiang.sun@intel.com>
To: "Kinney, Michael D" <michael.d.kinney@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Qian, Yi" <yi.qian@intel.com>, Gary Lin <glin@suse.com>
Subject: Re: [edk2-platforms Patch V3 01/12] Vlv2TbltDevicePkg/PlatformPei: Add boot mode detection
Date: Tue, 23 Jul 2019 01:29:38 +0000	[thread overview]
Message-ID: <7CB7EF03E15B5D48981329A508747A9850C9900E@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20190722225859.24724-2-michael.d.kinney@intel.com>

Reviewed-by: Zailiang Sun <zailiang.sun@intel.com>

> -----Original Message-----
> From: Kinney, Michael D
> Sent: Tuesday, July 23, 2019 6:59 AM
> To: devel@edk2.groups.io
> Cc: Sun, Zailiang <zailiang.sun@intel.com>; Qian, Yi <yi.qian@intel.com>;
> Gary Lin <glin@suse.com>
> Subject: [edk2-platforms Patch V3 01/12] Vlv2TbltDevicePkg/PlatformPei:
> Add boot mode detection
> 
> Add boot mode detection back into PlatformPei that was inadvertently
> removed in the following commit:
> 
> https://github.com/tianocore/edk2-
> platforms/commit/d6211390793fbd0a89b14001c43e0ef942c85425
> 
> 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 <zailiang.sun@intel.com>
> Cc: Yi Qian <yi.qian@intel.com>
> Cc: Gary Lin <glin@suse.com>
> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
> Reviewed-by: Zailiang Sun <zailiang.sun@intel.com>
> ---
>  .../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/Platform/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 == EFI_SUCCESS) {
>        if (Capsule->CheckCapsuleUpdate ((EFI_PEI_SERVICES**)PeiServices) ==
> EFI_SUCCESS) {
>          BootMode = 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 = (*PeiServices)->SetBootMode((const EFI_PEI_SERVICES
> **)PeiServices, BootMode);
>          ASSERT_EFI_ERROR (Status);
>        }
> @@ -92,6 +92,96 @@ CapsulePpiNotifyCallback (
>    return Status;
>  }
> 
> +EFI_STATUS
> +UpdateBootMode (
> +  IN CONST EFI_PEI_SERVICES     **PeiServices
> +  )
> +{
> +  EFI_STATUS      Status;
> +  EFI_BOOT_MODE   BootMode;
> +  UINT16          SleepType;
> +  CHAR16          *strBootMode;
> +
> +  Status = (*PeiServices)->GetBootMode(PeiServices, &BootMode);
> + ASSERT_EFI_ERROR (Status);  if (BootMode  ==
> BOOT_IN_RECOVERY_MODE){
> +    return Status;
> +  }
> +
> +  //
> +  // Let's assume things are OK if not told otherwise  //  BootMode =
> + BOOT_WITH_FULL_CONFIGURATION;
> +
> +  if (GetSleepTypeAfterWakeup (PeiServices, &SleepType)) {
> +    switch (SleepType) {
> +      case V_PCH_ACPI_PM1_CNT_S3:
> +        BootMode = BOOT_ON_S3_RESUME;
> +        Status = (*PeiServices)->NotifyPpi (PeiServices,
> &mCapsuleNotifyList[0]);
> +        ASSERT_EFI_ERROR (Status);
> +        break;
> +
> +      case V_PCH_ACPI_PM1_CNT_S4:
> +        BootMode = BOOT_ON_S4_RESUME;
> +        break;
> +
> +      case V_PCH_ACPI_PM1_CNT_S5:
> +        BootMode = BOOT_ON_S5_RESUME;
> +        break;
> +    } // switch (SleepType)
> +  }
> +
> +  if (IsFastBootEnabled (PeiServices)) {
> +    DEBUG ((DEBUG_INFO, "Prioritizing Boot mode to
> BOOT_WITH_MINIMAL_CONFIGURATION\n"));
> +    PrioritizeBootMode (&BootMode,
> BOOT_WITH_MINIMAL_CONFIGURATION);  }
> +
> +  switch (BootMode) {
> +    case BOOT_WITH_FULL_CONFIGURATION:
> +      strBootMode = L"BOOT_WITH_FULL_CONFIGURATION";
> +      break;
> +    case BOOT_WITH_MINIMAL_CONFIGURATION:
> +      strBootMode = L"BOOT_WITH_MINIMAL_CONFIGURATION";
> +      break;
> +    case BOOT_ASSUMING_NO_CONFIGURATION_CHANGES:
> +      strBootMode = L"BOOT_ASSUMING_NO_CONFIGURATION_CHANGES";
> +      break;
> +    case BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS:
> +      strBootMode =
> L"BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS";
> +      break;
> +    case BOOT_WITH_DEFAULT_SETTINGS:
> +      strBootMode = L"BOOT_WITH_DEFAULT_SETTINGS";
> +      break;
> +    case BOOT_ON_S4_RESUME:
> +      strBootMode = L"BOOT_ON_S4_RESUME";
> +      break;
> +    case BOOT_ON_S5_RESUME:
> +      strBootMode = L"BOOT_ON_S5_RESUME";
> +      break;
> +    case BOOT_ON_S2_RESUME:
> +      strBootMode = L"BOOT_ON_S2_RESUME";
> +      break;
> +    case BOOT_ON_S3_RESUME:
> +      strBootMode = L"BOOT_ON_S3_RESUME";
> +
> +      break;
> +    case BOOT_ON_FLASH_UPDATE:
> +      strBootMode = L"BOOT_ON_FLASH_UPDATE";
> +      break;
> +    case BOOT_IN_RECOVERY_MODE:
> +      strBootMode = L"BOOT_IN_RECOVERY_MODE";
> +      break;
> +    default:
> +      strBootMode = L"Unknown boot mode";  } // switch (BootMode)
> +
> +  DEBUG ((DEBUG_ERROR, "Setting BootMode to %s\n", strBootMode));
> + Status = (*PeiServices)->SetBootMode(PeiServices, BootMode);
> + ASSERT_EFI_ERROR (Status);
> +
> +  return Status;
> +}
> +
>  /**
>    Get sleep type after wakeup
> 
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.c
> b/Platform/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)
>      );
> 
> +  //
> +  // Set the new boot mode for MRC
> +  //
> +  Status = UpdateBootMode (PeiServices);  ASSERT_EFI_ERROR (Status);
> +
>    DEBUG((EFI_D_INFO, "Setup MMIO size ... \n\n"));
> 
>    //
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPei/Platform.h
> b/Platform/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 {
> 
>  #define STALL_PEIM_FROM_THIS(a) CR (a,
> STALL_CALLBACK_STATE_INFORMATION, StallNotify,
> STALL_PEIM_SIGNATURE)
> 
> +/**
> +  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
> +config
> +  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 devices,
> and
>    reboots the system.
> --
> 2.21.0.windows.1


  reply	other threads:[~2019-07-23  1:29 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22 22:58 [edk2-platforms Patch V3 00/12] Vlv2Tbl2DevicePkg: Remove Linux/Windows differences Michael D Kinney
2019-07-22 22:58 ` [edk2-platforms Patch V3 01/12] Vlv2TbltDevicePkg/PlatformPei: Add boot mode detection Michael D Kinney
2019-07-23  1:29   ` Sun, Zailiang [this message]
2019-07-22 22:58 ` [edk2-platforms Patch V3 02/12] Vlv2TbltDevicePkg: Convert use of FCE tool to Structured PCD Michael D Kinney
2019-07-23  1:30   ` Sun, Zailiang
2019-07-22 22:58 ` [edk2-platforms Patch V3 03/12] Vlv2TbltDevicePkg: Remove Linux/GCC specific DSC/FDF files Michael D Kinney
2019-07-23  1:30   ` Sun, Zailiang
2019-07-23  8:28   ` Gary Lin
2019-07-22 22:58 ` [edk2-platforms Patch V3 04/12] Vlv2TbltDevicePkg: Convert BAT/sh Capsule scripts to Python Michael D Kinney
2019-07-23  1:30   ` [edk2-devel] " Sun, Zailiang
2019-07-23  8:43   ` Gary Lin
2019-07-22 22:58 ` [edk2-platforms Patch V3 05/12] Vlv2Tbl2DevicePkg: Convert BAT/sh Build " Michael D Kinney
2019-07-23  1:30   ` Sun, Zailiang
2019-07-23  8:27   ` Gary Lin
2019-07-22 22:58 ` [edk2-platforms Patch V3 06/12] Vlv2TbltDevicePkg: Remove non ASCII characters from source files Michael D Kinney
2019-07-23  1:31   ` Sun, Zailiang
2019-07-23  8:46   ` Gary Lin
2019-07-22 22:58 ` [edk2-platforms Patch V3 07/12] Vlv2Tbl2DevicePkg/EfiRegTableLib: Use S3_BOOT_SCRIPT_LIB_WIDTH Michael D Kinney
2019-07-23  1:31   ` Sun, Zailiang
2019-07-23  8:52   ` Gary Lin
2019-07-22 22:58 ` [edk2-platforms Patch V3 08/12] Vlv2TbltDevicePkg/PlatformDxe: Add missing #if Michael D Kinney
2019-07-23  1:31   ` Sun, Zailiang
2019-07-22 22:58 ` [edk2-platforms Patch V3 09/12] Vlv2TbltDevicePkg: Add XCODE5 4K alignment DLINK_FLAGS Michael D Kinney
2019-07-23  1:31   ` Sun, Zailiang
2019-07-22 22:58 ` [edk2-platforms Patch V3 10/12] Vlv2TbltDevicePkg: Fix XCODE5 build errors Michael D Kinney
2019-07-23  1:31   ` Sun, Zailiang
2019-07-22 22:58 ` [edk2-platforms Patch V3 11/12] Vlv2TbltDevicePkg: Remove __GNUC__ specific #ifdefs Michael D Kinney
2019-07-23  1:31   ` [edk2-devel] " Sun, Zailiang
2019-07-22 22:58 ` [edk2-platforms Patch V3 12/12] Vlv2TbltDevicePkg/PlatformDxe: Use S3BootScriptWidth enums Michael D Kinney
2019-07-23  1:31   ` Sun, Zailiang
2019-07-23  8:54   ` Gary Lin
2019-07-23  1:29 ` [edk2-platforms Patch V3 00/12] Vlv2Tbl2DevicePkg: Remove Linux/Windows differences Sun, Zailiang
2019-07-23  8:57 ` Gary Lin

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=7CB7EF03E15B5D48981329A508747A9850C9900E@SHSMSX104.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