MinnowBoard-org / bugs-and-help

Ask QUESTIONS here. MinnowBoard.org issue and get help submission. See README for use.
14 stars 2 forks source link

BootMode in MinnowBoard EDKII signed Capsule solution #134

Open neolee66x opened 5 years ago

neolee66x commented 5 years ago

Our team is working on a Capsule update code and refer to MinnowBoard Max/Turbot 1.00 solution. And I have a question about Capsule update boot mode. Per my understanding, the capsule update reset should be a warm reset. But from the code, seems the system is waken up from S3 for capsule update.

edk2-platforms\Vlv2TbltDevicePkg\PlatformInitPei\BootMode.c

switch (SleepType) {
    case **V_PCH_ACPI_PM1_CNT_S3**:
      BootMode = BOOT_ON_S3_RESUME;
      //
      // Determine if we're in capsule update mode
      //
      Status = (*PeiServices)->LocatePpi (
                                 PeiServices,
                                 &gPeiCapsulePpiGuid,
                                 0,
                                 NULL,
                                 (void **)&Capsule
                                 );

      if (Status == EFI_SUCCESS) {
        if (Capsule->CheckCapsuleUpdate ((EFI_PEI_SERVICES**)PeiServices) == EFI_SUCCESS) {
          BootMode = **BOOT_ON_FLASH_UPDATE;**
        }
      }

      break;

(gPeiCapsulePpiGuid should be gEfiPeiCapsulePpiGuid?)

For capsule with CAPSULE_FLAGS_PERSIST_ACROSS_RESET + CAPSULE_FLAGS_INITIATE_RESET, a system reset should triggered by gRT->UpdateCapsule().

Because MinnowBoard is not full open source, I can't get the details how to implement gRT->UpdateCapsule() in MinnowBoard.

Could you help to clarify the capsule update reset mechanism? Thanks.

Below is MinnowBoard Max tree I using: Checkout MinnowBoard Max Branch from GitHub with the following command. i) Run "git clone https://github.com/tianocore/edk2-platforms.git -b devel-MinnowBoardMax-UDK2017" ii) Enter folder edk2-platforms iii) Run the command "git checkout 2a5f80b862e46de213a3f3635c43394deacdfb05" iv) Enter folder "C:\MyWorkspace"

mangguo321 commented 5 years ago

After call gRT->UpdateCapsule(), reset mechanism will check if there are pending capsules to process. If yes, put system into S3

neolee66x commented 5 years ago

@mangguo321 , do you mean that MinnowBoard implemented EnterS3WithImmediateWake() routine to put system into S3 and enable RTC wake event to wake up system automatically?

The capsule reset flow like:

  1. After UpdateCapsule() has finished, EfiResetSystem() is called with EfiResetWarm parameter
  2. ResetSystem() checks capsule variable and calls EnterS3WithImmediateWake ()
  3. System does a S3 reset and auto wake up. Is the flow correct? Thanks.
neolee66x commented 5 years ago

edk2-platforms\Vlv2TbltDevicePkg\PlatformPkgX64.dsc: ResetSystemLib|$(PLATFORM_PACKAGE)/Library/ResetSystemLib/ResetSystemLib.inf

EnterS3WithImmediateWake() function in ResetSystemLib library is empty. Is this non-open source code?