From patchwork Thu Mar 2 16:15:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 94792 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp235410qgd; Thu, 2 Mar 2017 08:15:20 -0800 (PST) X-Received: by 10.98.147.10 with SMTP id b10mr16407115pfe.177.1488471320532; Thu, 02 Mar 2017 08:15:20 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id f30si7836376plf.93.2017.03.02.08.15.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 08:15:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 149D8821F1; Thu, 2 Mar 2017 08:15:20 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wr0-x22b.google.com (mail-wr0-x22b.google.com [IPv6:2a00:1450:400c:c0c::22b]) (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 7FA30821F1 for ; Thu, 2 Mar 2017 08:15:18 -0800 (PST) Received: by mail-wr0-x22b.google.com with SMTP id l37so55999416wrc.1 for ; Thu, 02 Mar 2017 08:15:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=brDjxG0onGeyR3YBFBy+aT6C0gGR5xpG9ywxd+bJn1I=; b=SsGdBS62nnSoUylTAuRdJXwytcYc/lgZQycuEgc4CZGG/HwxqxRMeyplkopUnLQaiR Sua0+aeabJ3yg5kM6XM5rTTYMhyFfauWvrrS41UBDfR+8P1ZDy0zVkHiNLXgM4yvel2/ EmXI7LRbp4Vza5MHWIAfeyJ0Iss7jfkCepWMY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=brDjxG0onGeyR3YBFBy+aT6C0gGR5xpG9ywxd+bJn1I=; b=H6/JKHSe4e17rVOEpO/3UR5ybad5IQgvXaWxmxOqHF3I99j9tDYm8WchVA2DvFgFGe d0lfgEJmh7vwpe1wF+Wl/oWAvL2gync9UcN9N28SvJH3mgSZ60EilyjJ9mIHryBXL7nC n/qLrGPSXLf37TtFPFExQRl30khxSR+etYpjAswNvWlYRbQ00c/pyYrRCFQXUkmfD2ga reVuUnSxGWTCW+w1RkST6Oaqd1BIPgTKRIaMuCPZwSJvStsm7g6IXWlGwLTWUcMcMJmp rfhsXJhryjwm0HwvpbtwGSXc99xyEups1w+t0OrT0pfEVF+8tGzDc6jccO3qgU+AQmrx ikmw== X-Gm-Message-State: AMke39m+39kP5r2l8tAr2LtwajxVinndDViGOggaskyfPs2IHGeB34LcMfyOfgvJms/a2/q9 X-Received: by 10.223.164.9 with SMTP id d9mr13269060wra.146.1488471316865; Thu, 02 Mar 2017 08:15:16 -0800 (PST) Received: from localhost.localdomain ([105.147.1.203]) by smtp.gmail.com with ESMTPSA id n13sm11412650wra.17.2017.03.02.08.15.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Mar 2017 08:15:16 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com, leif.lindholm@linaro.org Date: Thu, 2 Mar 2017 16:15:02 +0000 Message-Id: <1488471305-23752-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488471305-23752-1-git-send-email-ard.biesheuvel@linaro.org> References: <1488471305-23752-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 1/4] ArmVirtPkg/ArmVirtPlatformLib: base boot mode on capsule presence X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jiewen.yao@intel.com, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Instead of unconditionally returning BOOT_WITH_FULL_CONFIGURATION when enquiring the platform about the boot mode, let's return enable the use of capsules by returning BOOT_ON_FLASH_UPDATE when a capsule HOB is detected. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf | 5 +++-- ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c | 4 ++++ 2 files changed, 7 insertions(+), 2 deletions(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf b/ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf index 3cb3fb1f3aea..dbbe0fbee21a 100644 --- a/ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf +++ b/ArmVirtPkg/Library/ArmVirtPlatformLib/ArmVirtPlatformLib.inf @@ -29,11 +29,12 @@ [Packages] ArmVirtPkg/ArmVirtPkg.dec [LibraryClasses] + ArmLib + FdtLib + HobLib IoLib MemoryAllocationLib - ArmLib PrintLib - FdtLib [Sources.common] Virt.c diff --git a/ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c b/ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c index fcaf3c681a97..58175110ab43 100644 --- a/ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c +++ b/ArmVirtPkg/Library/ArmVirtPlatformLib/Virt.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -38,6 +39,9 @@ ArmPlatformGetBootMode ( VOID ) { + if (GetFirstHob (EFI_HOB_TYPE_UEFI_CAPSULE) != NULL) { + return BOOT_ON_FLASH_UPDATE; + } return BOOT_WITH_FULL_CONFIGURATION; } From patchwork Thu Mar 2 16:15:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 94793 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp235429qgd; Thu, 2 Mar 2017 08:15:22 -0800 (PST) X-Received: by 10.84.192.137 with SMTP id c9mr19881889pld.17.1488471322410; Thu, 02 Mar 2017 08:15:22 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id f21si7810923pgh.242.2017.03.02.08.15.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 08:15:22 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4EF00821F5; Thu, 2 Mar 2017 08:15:21 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x22c.google.com (mail-wm0-x22c.google.com [IPv6:2a00:1450:400c:c09::22c]) (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 27B37821F3 for ; Thu, 2 Mar 2017 08:15:20 -0800 (PST) Received: by mail-wm0-x22c.google.com with SMTP id n11so28648014wma.1 for ; Thu, 02 Mar 2017 08:15:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A8Xw0cURSFXmebgSJtoXTj3rOm2Y3DFwoF0Z4LmK2lY=; b=XbMJdf9lzocX/Gps3E/mqq/kVWBfuEWRgpNzJ+vFZitwiESRGpoUT9O/pnd0kKjl0y oWWWYnRquCsfKkWNnwd7BygggjoTJcMn3JG/ZCPTehreGBCb8/EqyvnZzFowK5r4kCGg 5gXnOE/D+QIeT4xNIdq8cS4hSFKh4ExucqebA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=A8Xw0cURSFXmebgSJtoXTj3rOm2Y3DFwoF0Z4LmK2lY=; b=cxFOORAbWZPh4TuVCHFlz8db5Xvyyz86wMIUlT809KRDvfKGekXqztymEj+NUvUELu hc92I03qNCAckoHWEvbqt2q2Qnktv2tuD6qMCOCoYeR+uUEnW+CGl7rORK0M2g8oaDBL mT0DmyiR6iSU2ITgkbJGIo09WU3uq6k0D3tOuClygtiL4Yznk/0m4QBM1rl+Mk3tS7yF X16BTMw1MwoYmjGz/0nfNxmypVn3RawavBxs9rAAKnVAlm9s/VE8xhBC5v1Bx4PB9yHO u5aOIK2x+N5+uOGBZrGb1oaGj5m8U1N9KixmXehQAv5aCgmO7LKsgEkCKLpRAFBDSqm7 MKrw== X-Gm-Message-State: AMke39lTOwswFyg5KK8T9WKXabUspYD5QEJuJzx4eXfbaEvLHcLQg6ZZGa70aL7er1lNRyaw X-Received: by 10.28.31.139 with SMTP id f133mr8883151wmf.25.1488471318723; Thu, 02 Mar 2017 08:15:18 -0800 (PST) Received: from localhost.localdomain ([105.147.1.203]) by smtp.gmail.com with ESMTPSA id n13sm11412650wra.17.2017.03.02.08.15.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Mar 2017 08:15:18 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com, leif.lindholm@linaro.org Date: Thu, 2 Mar 2017 16:15:03 +0000 Message-Id: <1488471305-23752-3-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488471305-23752-1-git-send-email-ard.biesheuvel@linaro.org> References: <1488471305-23752-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 2/4] ArmVirtPkg/ArmVirtMemoryInitPeiLib: check for capsules before memory init X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jiewen.yao@intel.com, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Look for any capsules left in memory by the OS across reset before releasing the memory for normal use, so that they can be preserved and processed later. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c | 60 +++++++++++++++++++- ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf | 9 ++- 2 files changed, 67 insertions(+), 2 deletions(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c index 6f3e54b7afcb..7f55f634e4e5 100644 --- a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c +++ b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.c @@ -17,11 +17,15 @@ #include #include +#include #include #include #include #include -#include +#include +#include + +#include VOID BuildMemoryTypeInformationHob ( @@ -49,6 +53,58 @@ InitMmu ( } } +STATIC +VOID +CheckCapsule ( + IN EFI_PHYSICAL_ADDRESS UefiMemoryBase, + IN UINT64 UefiMemorySize + ) +{ + EFI_STATUS Status; + EFI_PEI_SERVICES **PeiServices; + PEI_CAPSULE_PPI *Capsule; + VOID *CapsuleBuffer; + UINTN CapsuleBufferLength; + + PeiServices = (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (); + ASSERT (PeiServices != NULL); + + // + // Check for persistent capsules + // + Status = PeiServicesLocatePpi (&gPeiCapsulePpiGuid, 0, NULL, + (VOID **)&Capsule); + if (Status == EFI_SUCCESS) { + Status = Capsule->CheckCapsuleUpdate (PeiServices); + if (Status == EFI_SUCCESS) { + + CapsuleBuffer = (VOID *)((UINTN)FixedPcdGet32 (PcdCPUCoresStackBase) + + FixedPcdGet32 (PcdCPUCorePrimaryStackSize)); + CapsuleBufferLength = (UINTN)UefiMemoryBase - (UINTN)CapsuleBuffer; + + PeiServicesSetBootMode (BOOT_ON_FLASH_UPDATE); + Status = Capsule->Coalesce (PeiServices, &CapsuleBuffer, + &CapsuleBufferLength); + if (!EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "%a: Coalesced capsule @ %p (0x%lx) capsule\n", + __FUNCTION__, CapsuleBuffer, CapsuleBufferLength)); + } else { + DEBUG ((DEBUG_WARN, "%a: failed to coalesce() capsule (Status == %r)\n", + __FUNCTION__, Status)); + return; + } + + Status = Capsule->CreateState (PeiServices, CapsuleBuffer, + CapsuleBufferLength); + + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_WARN, "%a: Capsule->CreateState failed (Status == %r)\n", + __FUNCTION__, Status)); + } + } + } +} + EFI_STATUS EFIAPI MemoryPeim ( @@ -109,6 +165,8 @@ MemoryPeim ( // Build Memory Allocation Hob InitMmu (); + CheckCapsule (UefiMemoryBase, UefiMemorySize); + if (FeaturePcdGet (PcdPrePiProduceMemoryTypeInformationHob)) { // Optional feature that helps prevent EFI memory map fragmentation. BuildMemoryTypeInformationHob (); diff --git a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf index 028d6fb5ac28..4524afd2c7ed 100644 --- a/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf +++ b/ArmVirtPkg/Library/ArmVirtMemoryInitPeiLib/ArmVirtMemoryInitPeiLib.inf @@ -37,6 +37,8 @@ [LibraryClasses] ArmMmuLib ArmPlatformLib CacheMaintenanceLib + PeiServicesLib + PeiServicesTablePointerLib [Guids] gEfiMemoryTypeInformationGuid @@ -48,6 +50,8 @@ [FixedPcd] gArmTokenSpaceGuid.PcdFdSize gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize + gArmPlatformTokenSpaceGuid.PcdCPUCoresStackBase + gArmPlatformTokenSpaceGuid.PcdCPUCorePrimaryStackSize gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS @@ -64,5 +68,8 @@ [Pcd] gArmTokenSpaceGuid.PcdSystemMemorySize gArmTokenSpaceGuid.PcdFdBaseAddress +[Ppis] + gPeiCapsulePpiGuid + [Depex] - TRUE + gPeiCapsulePpiGuid From patchwork Thu Mar 2 16:15:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 94794 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp235452qgd; Thu, 2 Mar 2017 08:15:25 -0800 (PST) X-Received: by 10.98.193.69 with SMTP id i66mr16475296pfg.35.1488471325478; Thu, 02 Mar 2017 08:15:25 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id x5si7810119pgj.207.2017.03.02.08.15.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 08:15:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) client-ip=198.145.21.10; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 198.145.21.10 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 87E86821F8; Thu, 2 Mar 2017 08:15:24 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x229.google.com (mail-wm0-x229.google.com [IPv6:2a00:1450:400c:c09::229]) (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 6D312821ED for ; Thu, 2 Mar 2017 08:15:22 -0800 (PST) Received: by mail-wm0-x229.google.com with SMTP id t193so16232838wmt.1 for ; Thu, 02 Mar 2017 08:15:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=lQs9ws4NqlwTku8oB8GQqupss9+QnIGREg8E8e90TpY=; b=dp3rz7JC5diLnE0n0AWxmAy311SIA/2HZlfXLQW52XtMVboiOx40GT73fzvylH8fWr LxpS2HjS0aWtnomwFA/vqpXIL9tn3TDcCVxRT3S84/wc6pMS53mWhZkHzGHM05+9F5NX lb9eSnn3LnzsUfYlmbQYHS3FU9xw/Zx60xB94= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=lQs9ws4NqlwTku8oB8GQqupss9+QnIGREg8E8e90TpY=; b=h93LP5zOKwA8V1oOwQ9asdcwiZAfA4A4lvAW4+Dpg6aFxLDREybGkLGrYfNSUpJCFw cSmOlr6sYU4Zd7GcX1lmbY6TfDg9gxqQ58sA1aRvlhjmrjWjjR6g7KI0P9tlZby5NNtQ OAjy9bX4x/1vAuOG6EN6eF/SQWknKUjDPMqtQ41+V8JGU0/M9iARtqKI06LVtL3AfE1j 24fq61/hrfbYV0G55PVM0/Czh1HSMNnzMzUmvStgLyXA3UTCtTjsMh/9jMey/imc//FI WxEtBwDMawPWTZ97KcusLjtU5KDSoY9rnAEoWu9t/4H87MG2Uitncftv65axS+BNbHzQ /67w== X-Gm-Message-State: AMke39kiG8989ehl1T40nqQrehH6+rwpBYF8APKaenzmWRbRxpeT8V+v2flMHMuGGmjlNi5J X-Received: by 10.28.207.7 with SMTP id f7mr9001066wmg.112.1488471320773; Thu, 02 Mar 2017 08:15:20 -0800 (PST) Received: from localhost.localdomain ([105.147.1.203]) by smtp.gmail.com with ESMTPSA id n13sm11412650wra.17.2017.03.02.08.15.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Mar 2017 08:15:20 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com, leif.lindholm@linaro.org Date: Thu, 2 Mar 2017 16:15:04 +0000 Message-Id: <1488471305-23752-4-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488471305-23752-1-git-send-email-ard.biesheuvel@linaro.org> References: <1488471305-23752-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 3/4] ArmVirtPkg/PlatformBootManagerLib: process pending capsules X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jiewen.yao@intel.com, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" Process any capsule HOBs that were left for us by CapsulePei. This involves calling ProcessCapsules() twice, as explained in the comment in DxeCapsuleLibFmp. 1) The first call must be before EndOfDxe. The system capsules is processed. If device capsule FMP protocols are exposted at this time and device FMP capsule has zero EmbeddedDriverCount, the device capsules are processed. Each individual capsule result is recorded in capsule record variable. System may reset in this function, if reset is required by capsule and all capsules are processed. If not all capsules are processed, reset will be defered to second call. 2) The second call must be after EndOfDxe and after ConnectAll, so that all device capsule FMP protocols are exposed. The system capsules are skipped. If the device capsules are NOT processed in first call, they are processed here. Each individual capsule result is recorded in capsule record variable. System may reset in this function, if reset is required by capsule processed in first call and second call. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c | 17 +++++++++++++++++ ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf | 2 ++ 2 files changed, 19 insertions(+) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c index 94da51ad49f1..1ebfecd992f7 100644 --- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBm.c @@ -17,7 +17,9 @@ #include #include +#include #include +#include #include #include #include @@ -579,6 +581,13 @@ PlatformBootManagerBeforeConsole ( ) { RETURN_STATUS PcdStatus; + EFI_STATUS Status; + + if (GetBootModeHob() == BOOT_ON_FLASH_UPDATE) { + DEBUG((DEBUG_INFO, "ProcessCapsules Before EndOfDxe ......\n")); + Status = ProcessCapsules (); + DEBUG((DEBUG_INFO, "ProcessCapsules %r\n", Status)); + } // // Signal EndOfDxe PI Event @@ -663,6 +672,8 @@ PlatformBootManagerAfterConsole ( VOID ) { + EFI_STATUS Status; + // // Show the splash screen. // @@ -673,6 +684,12 @@ PlatformBootManagerAfterConsole ( // EfiBootManagerConnectAll (); + if (GetBootModeHob() == BOOT_ON_FLASH_UPDATE) { + DEBUG((DEBUG_INFO, "ProcessCapsules After EndOfDxe ......\n")); + Status = ProcessCapsules (); + DEBUG((DEBUG_INFO, "ProcessCapsules %r\n", Status)); + } + // // Process QEMU's -kernel command line option. Note that the kernel booted // this way should receive ACPI tables, which is why we connect all devices diff --git a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf index 1f162c663fc1..4d218097a420 100644 --- a/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf +++ b/ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf @@ -45,8 +45,10 @@ [LibraryClasses] BaseLib BaseMemoryLib BootLogoLib + CapsuleLib DebugLib DevicePathLib + HobLib MemoryAllocationLib PcdLib PrintLib From patchwork Thu Mar 2 16:15:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 94795 Delivered-To: patch@linaro.org Received: by 10.140.82.71 with SMTP id g65csp235468qgd; Thu, 2 Mar 2017 08:15:28 -0800 (PST) X-Received: by 10.84.194.129 with SMTP id h1mr19708696pld.56.1488471328291; Thu, 02 Mar 2017 08:15:28 -0800 (PST) Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id 18si7828666pfa.133.2017.03.02.08.15.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 08:15:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) client-ip=2001:19d0:306:5::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of edk2-devel-bounces@lists.01.org designates 2001:19d0:306:5::1 as permitted sender) smtp.mailfrom=edk2-devel-bounces@lists.01.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BEDA9821FB; Thu, 2 Mar 2017 08:15:24 -0800 (PST) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received: from mail-wm0-x232.google.com (mail-wm0-x232.google.com [IPv6:2a00:1450:400c:c09::232]) (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 34DC9821ED for ; Thu, 2 Mar 2017 08:15:24 -0800 (PST) Received: by mail-wm0-x232.google.com with SMTP id n11so28649969wma.1 for ; Thu, 02 Mar 2017 08:15:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Wcet63ulzpe5jl+9qz+1eBgzhmTVeT3FGU6OifJrGBc=; b=FCLU3K4B6BHidPz071+GG7l9piwPeqpi1tm157MTNZQhNNPsw29/eoQO68KPuVi56r Q0oItGIhsrVBtX7sBlyepn+iFfm8o3dWuCy4WcfXNNa8iVCRKsXIHzR0odRkRkh84bI/ yCl/qO1lMF9afn0PdeD26f73vzgDx4eIIXelo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Wcet63ulzpe5jl+9qz+1eBgzhmTVeT3FGU6OifJrGBc=; b=dgEOZbS0Pkdfgmji52ILZUdLZikQAaWfJzt344vpnpGg7XaqQFeA+sJ+hwOQtswqFu XUcggiKXaGcXgWLYuxv3RA0Lpe577pB6WwMHba5xyI4ZIeEA3BJLW42LYLVlpR3ZRObD IMwtmxj0LJ6wz7Wi9CSzkGIx3DyrygEGLIlmufyespN6bqBYBUuzCqFtpwO/0lWqhUKW qidJEqzuKPlhoK3B3z2Vaweo/J/kF691FVKw2qiwRbxidd/qE6lZ9yzjBCuUNIEtayxu qTbCs8fEev20dwTuQb9+TxsXOnUK69FQvKFY6UCPvpMMzKR2PzHJ0JQfIqkLJYKM3chM Zqkg== X-Gm-Message-State: AMke39kHOlJ4z2gLK5Sbnsuzq/0veG1Z19a/NehbcmJ/MPAUnIkiAzJn1/+YbRKYbuxF+nej X-Received: by 10.28.198.139 with SMTP id w133mr8700769wmf.80.1488471322501; Thu, 02 Mar 2017 08:15:22 -0800 (PST) Received: from localhost.localdomain ([105.147.1.203]) by smtp.gmail.com with ESMTPSA id n13sm11412650wra.17.2017.03.02.08.15.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Mar 2017 08:15:21 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com, leif.lindholm@linaro.org Date: Thu, 2 Mar 2017 16:15:05 +0000 Message-Id: <1488471305-23752-5-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1488471305-23752-1-git-send-email-ard.biesheuvel@linaro.org> References: <1488471305-23752-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH 4/4] ArmVirtPkg/ArmVirtQemu: enable basic capsule support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: jiewen.yao@intel.com, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" This wires up the existing code for processing capsule: it enables CapsulePei, which preserves capsules left in memory by the OS, and combined with the PlatformBootManagerLib and other changes in previous patches, this will ensure that capsules are handed back to the OS via the system table if it requested so. This enables features like the capsule-pstore for Linux, which is currently under review (sadly, Gmane nor marc.info archive the linux-efi mailing list) Implementing the firmware management protocol on top of this should certainly be doable, but has not been attempted yet. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/ArmVirtQemu.dsc | 7 ++++++- ArmVirtPkg/ArmVirtQemu.fdf | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) -- 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/ArmVirtPkg/ArmVirtQemu.dsc b/ArmVirtPkg/ArmVirtQemu.dsc index 477dfdcfc764..b44b3c82abac 100644 --- a/ArmVirtPkg/ArmVirtQemu.dsc +++ b/ArmVirtPkg/ArmVirtQemu.dsc @@ -59,7 +59,7 @@ [LibraryClasses.common] TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf NorFlashPlatformLib|ArmVirtPkg/Library/NorFlashQemuLib/NorFlashQemuLib.inf - CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf PlatformBootManagerLib|ArmVirtPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.inf @@ -98,6 +98,9 @@ [PcdsFeatureFlag.common] gArmVirtTokenSpaceGuid.PcdPureAcpiBoot|TRUE !endif + gEfiMdeModulePkgTokenSpaceGuid.PcdSupportUpdateCapsuleReset|TRUE + + [PcdsFixedAtBuild.common] gArmPlatformTokenSpaceGuid.PcdCoreCount|1 !if $(ARCH) == AARCH64 @@ -234,7 +237,9 @@ [Components.common] ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf ArmPkg/Drivers/CpuPei/CpuPei.inf + MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf MdeModulePkg/Universal/Variable/Pei/VariablePei.inf + MdeModulePkg/Universal/CapsulePei/CapsulePei.inf MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf { diff --git a/ArmVirtPkg/ArmVirtQemu.fdf b/ArmVirtPkg/ArmVirtQemu.fdf index c6a22dc018f3..28d10f2e85d6 100644 --- a/ArmVirtPkg/ArmVirtQemu.fdf +++ b/ArmVirtPkg/ArmVirtQemu.fdf @@ -108,7 +108,9 @@ [FV.FVMAIN_COMPACT] INF ArmPlatformPkg/MemoryInitPei/MemoryInitPeim.inf INF ArmPkg/Drivers/CpuPei/CpuPei.inf INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf + INF MdeModulePkg/Universal/FaultTolerantWritePei/FaultTolerantWritePei.inf INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf + INF MdeModulePkg/Universal/CapsulePei/CapsulePei.inf INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf FILE FV_IMAGE = 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 {