From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::241; helo=mail-wr0-x241.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DEC1A2122C2F8 for ; Tue, 12 Jun 2018 05:25:29 -0700 (PDT) Received: by mail-wr0-x241.google.com with SMTP id l10-v6so23884883wrn.2 for ; Tue, 12 Jun 2018 05:25:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Rug4EpwXl+XieY2Zpa4FAVMfEyCnVdsyXUnyMNm5knQ=; b=WWEYusVPFz8IpbaFJ4ZUpgomtWfg/Tye99n62z0s9EXOZgkoYL15QhI9GXVeM+xdTB GCZdXsusSRhEfJ/q00I6rUlRmRPUTPAHMG2NobASGNWcRpO+Y3H22f8DL6DeJUmyJcL0 Mcn0tGkOqQSpSIU5+bXMaSyfGgGD+yq3+meUo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Rug4EpwXl+XieY2Zpa4FAVMfEyCnVdsyXUnyMNm5knQ=; b=UGW6L4GiryWJpigx0LOoKgVVwEEb0qVhVns5VJfCn4KU8kHECI2OX95V/MeFuPzj4e XwvJBbt6O6WTVDjsm7/+i+gu9+K5HFFCrL/hCt33MLD4AU+MvCk/K7BVfjyuM/jF9GaD 7MP9e/CtqE6ysQC0silc0qJi4HqaMZbONY3McvGApb2S0PMZlOsecp4PpLulFru+73oo syH3KJLOUTTsCsAF8t/3RqAfBB706RdOYjlXrn6QUJNoDrollQiyJkiGG02+UE8sygWu UxWEQL8/GIuGOo9NFBIuTa+Tmnid7JQpqRB8iV1FSj8QDKKNFwElxts5ddWOwwilr+xc MD0w== X-Gm-Message-State: APt69E3dknwYh3khKq9HX2WUmjlkPEhFMc+dQ6jNhZ3STIpYooAFxEcg nK0OV2HyhQHEHehX5dPifMg93A== X-Google-Smtp-Source: ADUXVKK9zM5BtInTfcczHvmASeH/2K690Yh2Tw2qRAiuVv8CnneLAC4QaeTTsH8uNpX5HOmMuQizTQ== X-Received: by 2002:adf:afe3:: with SMTP id y35-v6mr157627wrd.176.1528806328351; Tue, 12 Jun 2018 05:25:28 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id j131-v6sm600264wmg.24.2018.06.12.05.25.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Jun 2018 05:25:26 -0700 (PDT) Date: Tue, 12 Jun 2018 13:25:25 +0100 From: Leif Lindholm To: Ard Biesheuvel Cc: edk2-devel@lists.01.org, star.zeng@intel.com, jiewen.yao@intel.com, michael.d.kinney@intel.com Message-ID: <20180612122525.qys3u5rpnlpm2ttn@bivouac.eciton.net> References: <20180612112329.664-1-ard.biesheuvel@linaro.org> <20180612112329.664-4-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <20180612112329.664-4-ard.biesheuvel@linaro.org> User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH v3 3/4] ArmPkg/PlatformBootManagerLib: call ProcessCapsules() only once X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 12 Jun 2018 12:25:30 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, Jun 12, 2018 at 01:23:28PM +0200, Ard Biesheuvel wrote: > ARM platforms have no restriction on when a system firmware update > capsule can be applied, and so it is not necessary to call > ProcessCapsules() twice. So let's drop the first invocation that > occurs before EndOfDxe, and rewrite the second call so that all > capsule updates will be applied when the console is up and able to > provide progress feedback. > > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Ard Biesheuvel I thought I acked this one last time around? Perhaps you wanted it again after the discussion. Anyway: Reviewed-by: Leif Lindholm > --- > ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c | 87 ++++++++++++++------ > ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 1 + > 2 files changed, 61 insertions(+), 27 deletions(-) > > diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > index 3456a71fbb9c..7c21cce5960b 100644 > --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBm.c > @@ -24,6 +24,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -553,21 +554,6 @@ PlatformBootManagerBeforeConsole ( > VOID > ) > { > - EFI_STATUS Status; > - ESRT_MANAGEMENT_PROTOCOL *EsrtManagement; > - > - if (GetBootModeHob() == BOOT_ON_FLASH_UPDATE) { > - DEBUG ((DEBUG_INFO, "ProcessCapsules Before EndOfDxe ......\n")); > - Status = ProcessCapsules (); > - DEBUG ((DEBUG_INFO, "ProcessCapsules returned %r\n", Status)); > - } else { > - Status = gBS->LocateProtocol (&gEsrtManagementProtocolGuid, NULL, > - (VOID **)&EsrtManagement); > - if (!EFI_ERROR (Status)) { > - EsrtManagement->SyncEsrtFmp (); > - } > - } > - > // > // Signal EndOfDxe PI Event > // > @@ -618,6 +604,57 @@ PlatformBootManagerBeforeConsole ( > PlatformRegisterOptionsAndKeys (); > } > > +STATIC > +VOID > +HandleCapsules ( > + VOID > + ) > +{ > + ESRT_MANAGEMENT_PROTOCOL *EsrtManagement; > + EFI_PEI_HOB_POINTERS HobPointer; > + EFI_CAPSULE_HEADER *CapsuleHeader; > + BOOLEAN NeedReset; > + EFI_STATUS Status; > + > + DEBUG ((DEBUG_INFO, "%a: processing capsules ...\n", __FUNCTION__)); > + > + Status = gBS->LocateProtocol (&gEsrtManagementProtocolGuid, NULL, > + (VOID **)&EsrtManagement); > + if (!EFI_ERROR (Status)) { > + EsrtManagement->SyncEsrtFmp (); > + } > + > + // > + // Find all capsule images from hob > + // > + HobPointer.Raw = GetHobList (); > + NeedReset = FALSE; > + while ((HobPointer.Raw = GetNextHob (EFI_HOB_TYPE_UEFI_CAPSULE, > + HobPointer.Raw)) != NULL) { > + CapsuleHeader = (VOID *)(UINTN)HobPointer.Capsule->BaseAddress; > + > + Status = ProcessCapsuleImage (CapsuleHeader); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a: failed to process capsule %p - %r\n", > + __FUNCTION__, CapsuleHeader, Status)); > + return; > + } > + if ((CapsuleHeader->Flags & CAPSULE_FLAGS_INITIATE_RESET) != 0) { > + NeedReset = TRUE; > + } > + HobPointer.Raw = GET_NEXT_HOB (HobPointer); > + } > + > + if (NeedReset) { > + DEBUG ((DEBUG_WARN, "%a: capsule update successful, resetting ...\n", > + __FUNCTION__)); > + > + gRT->ResetSystem(EfiResetCold, EFI_SUCCESS, 0, NULL); > + CpuDeadLoop(); > + } > +} > + > + > #define VERSION_STRING_PREFIX L"Tianocore/EDK2 firmware version " > > /** > @@ -637,7 +674,6 @@ PlatformBootManagerAfterConsole ( > VOID > ) > { > - ESRT_MANAGEMENT_PROTOCOL *EsrtManagement; > EFI_STATUS Status; > EFI_GRAPHICS_OUTPUT_PROTOCOL *GraphicsOutput; > UINTN FirmwareVerLength; > @@ -675,17 +711,14 @@ PlatformBootManagerAfterConsole ( > // > EfiBootManagerConnectAll (); > > - Status = gBS->LocateProtocol (&gEsrtManagementProtocolGuid, NULL, > - (VOID **)&EsrtManagement); > - if (!EFI_ERROR (Status)) { > - EsrtManagement->SyncEsrtFmp (); > - } > - > - if (GetBootModeHob() == BOOT_ON_FLASH_UPDATE) { > - DEBUG((DEBUG_INFO, "ProcessCapsules After EndOfDxe ......\n")); > - Status = ProcessCapsules (); > - DEBUG((DEBUG_INFO, "ProcessCapsules returned %r\n", Status)); > - } > + // > + // On ARM, there is currently no reason to use the phased capsule > + // update approach where some capsules are dispatched before EndOfDxe > + // and some are dispatched after. So just handle all capsules here, > + // when the console is up and we can actually give the user some > + // feedback about what is going on. > + // > + HandleCapsules (); > > // > // Enumerate all possible boot options. > diff --git a/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf > index e8cbb10dabdd..28d606d5c329 100644 > --- a/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf > +++ b/ArmPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf > @@ -55,6 +55,7 @@ [LibraryClasses] > UefiBootManagerLib > UefiBootServicesTableLib > UefiLib > + UefiRuntimeServicesTableLib > > [FeaturePcd] > gEfiMdePkgTokenSpaceGuid.PcdUgaConsumeSupport > -- > 2.17.1 >