From patchwork Wed Jun 13 16:28:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 138507 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp949155lji; Wed, 13 Jun 2018 09:28:35 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJTkkLmmJnBDBTPd6Hxb8aT84Wsyy8VIAcIih+L8SSb/NUhHh3k3lgyh2Bs8BGcqk0Ojhvg X-Received: by 2002:a65:4487:: with SMTP id l7-v6mr4674242pgq.357.1528907315779; Wed, 13 Jun 2018 09:28:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528907315; cv=none; d=google.com; s=arc-20160816; b=szMSvHO+3qDpVJlSnmyRMQdSCk4bjyiXO4ncjEJU4EkAAb2cQQxEdeDwJMhwGPnjcs cJ9+ke5EMjnfui6iuT++5rquCdkjdonE03qPdkhy+hNjEJkfGkrhcuUrFOZoeOwF9Enb XAoLLg3Uw83O0cTLix/qZ+3pLbMMU3bQgNiDJC+eODFxvifEoTOHR4gMU5W1MKpO1vYe pWrpVomaNqyiRFod8kBeQB3fW02BLLx+ABDcTA0d3gUbJIkGLlpPZ3nXQt6EKS8kylm8 ry5sgw2j19nhD5qpq04WQiU7c6rRTuIcJo1UCjaqMD8WgQRHqCjznV2bWEyRMLhiduJR ln9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=zGTaGVyGtwMv717tZuqUeeVk1UF5t4+/iiHFe+0I06A=; b=WgpbfYxBVUZ8G2SaQAAKWvcgF3hD/DFa9SIcGqANzy/ugMhc4SSe0fej3nXCwRnyAP MqcNtbg+87ic8Q0aIWFciK6n0bcJGrZZ0yveRPaoqUFK8CAKoldg00JurDZ9JETU9kQq w13UHK0HKzNoSLQFw2fHQG3qBMnKg9UhZXZwe45NUlag7KTt6HsC/ndexJXIo4D7mHIL t+PTTiJzwhFxH8zlzKqnd7M6WvB7uOx8RztjxsOksfZcdeSkWbpiqJX0X1ATUzMAjWAs csVmPNEWN94MMHtYEY2qgY56yKbM6rQ405BKthZtzOYD8OIKslBwGQMzGpIXC0Ea8vYF OD0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ZDMI1HMW; 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 Return-Path: Received: from ml01.01.org (ml01.01.org. [2001:19d0:306:5::1]) by mx.google.com with ESMTPS id z6-v6si1224721pgo.364.2018.06.13.09.28.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 09:28:35 -0700 (PDT) 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 header.s=google header.b=ZDMI1HMW; 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 566BF2127421C; Wed, 13 Jun 2018 09:28:35 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::242; helo=mail-wr0-x242.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) (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 D88D521251133 for ; Wed, 13 Jun 2018 09:28:32 -0700 (PDT) Received: by mail-wr0-x242.google.com with SMTP id x4-v6so3400879wro.11 for ; Wed, 13 Jun 2018 09:28:32 -0700 (PDT) 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=ruT8nGqvlrGiu50lPEI5hgpeH8sVwtDye3H6eJT+KL0=; b=ZDMI1HMW1vcsPg+C048sB3PBT3Zf6MbnzlnfMw1pLF0oVf9j9eVIiGaooL3jU8ZvPJ NvitaffTIv1r9kg90H8sko8JgLOtgvjSrdGIXS9sO+zpdejkv21cLxYxLJPev40cAD/W d+Zh9h1p1gqqgzyL/33bwyvRVLf8Hypyg1V+w= 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=ruT8nGqvlrGiu50lPEI5hgpeH8sVwtDye3H6eJT+KL0=; b=YmPkGyUNuHObyxQwBIO7rbDxaXrO1LvMpCbrT8J0pn3nklTm9j5P6N8kmBQJ1hnjAH g0BC1gV5dL4XbOt27JSKzGAIAThF77xvxhhdpRaDNRG4rAKKYlbLI0zgHuDLYFuiQ9wQ I3L9dwk7IIHlVASx3yFDjx/g8iXn+Uz1UrVstdxw9sPpoLUdX2SXegcoOMMMEy0cYbyT QPMLSLL0XBy3in8RBEn1WBUzSRbqVkf7Xh4FBGhqW5ke2J6WWc5DaHV8WktoXyTT15Km 6xIsDv20L+gtWriT/50nY9dqcl+5eqLDcl41T5DZtUgnJIKQ0/+a1GAL5EfJWoX6WJ6I SxGA== X-Gm-Message-State: APt69E27NhLCJ0LqT8lxxUNvb2G8NRG83GsVtG+dQyyGtDttjeksNJOu oYg5gcyWRRse8pxU0dsNnmTCfugGLbQ= X-Received: by 2002:adf:b258:: with SMTP id y24-v6mr4469725wra.168.1528907311184; Wed, 13 Jun 2018 09:28:31 -0700 (PDT) Received: from dogfood.home ([2a01:cb1d:112:6f00:6dfc:b76c:4240:35ff]) by smtp.gmail.com with ESMTPSA id s191-v6sm6234782wmd.27.2018.06.13.09.28.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 09:28:30 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 13 Jun 2018 18:28:25 +0200 Message-Id: <20180613162826.19986-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180613162826.19986-1-ard.biesheuvel@linaro.org> References: <20180613162826.19986-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms v2 1/2] Silicon/SynQuacerPlatformFlashAccessLib: relax FV address check 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: , Cc: leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" In commit 913fdda9f4b9 ("Silicon/SynQuacerPlatformFlashAccessLib: don't dereference FVB header fields"), we dropped all accesses to FVB header field, which was necessary because the flash partition may not in fact contain such a header. Instead, only an exact match on the base address of the FV compared to the base address of the capsule payload would result in a match, making it difficult to create capsules that only update a subset of the flash contents. Given that the FVB protocol provides a GetBlockSize() method that also returns the number of consecutive blocks of that size, and does not rely on the FVB header contents, we can actually infer the size of the flash partition, and use it to decide whether a capsule payload targets an area that is covered by this partition entirely. This optimization allows us to extend the FV description to include the SCP firmware partition without requiring us to actually provide a payload for that partition immediately, which is useful as a preparatory step. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c | 56 ++++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c index 48d385993b38..51bf9f62457f 100644 --- a/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c +++ b/Silicon/Socionext/SynQuacer/Library/SynQuacerPlatformFlashAccessLib/SynQuacerPlatformFlashAccessLib.c @@ -45,8 +45,10 @@ STATIC EFI_STATUS GetFvbByAddress ( IN EFI_PHYSICAL_ADDRESS Address, + IN UINTN Length, OUT EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL **OutFvb, - OUT EFI_PHYSICAL_ADDRESS *FvbBaseAddress + OUT EFI_LBA *Lba, + OUT UINTN *BlockSize ) { EFI_STATUS Status; @@ -55,6 +57,8 @@ GetFvbByAddress ( UINTN Index; EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb; EFI_FVB_ATTRIBUTES_2 Attributes; + EFI_PHYSICAL_ADDRESS FvbBaseAddress; + UINTN NumberOfBlocks; // // Locate all handles with Firmware Volume Block protocol @@ -85,7 +89,7 @@ GetFvbByAddress ( // // Checks if the address range of this handle contains parameter Address // - Status = Fvb->GetPhysicalAddress (Fvb, FvbBaseAddress); + Status = Fvb->GetPhysicalAddress (Fvb, &FvbBaseAddress); if (EFI_ERROR (Status)) { continue; } @@ -103,9 +107,27 @@ GetFvbByAddress ( continue; } - if (Address == *FvbBaseAddress) { + Status = Fvb->GetBlockSize (Fvb, 0, BlockSize, &NumberOfBlocks); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_INFO, "%a: failed to get FVB blocksize - %r, ignoring\n", + __FUNCTION__, Status)); + continue; + } + + if ((Length % *BlockSize) != 0) { + DEBUG ((DEBUG_INFO, + "%a: Length 0x%lx is not a multiple of the blocksize 0x%lx, ignoring\n", + __FUNCTION__, Length, *BlockSize)); + Status = EFI_INVALID_PARAMETER; + continue; + } + + if ((Address >= FvbBaseAddress) && + ((Address + Length) <= + (FvbBaseAddress + (*BlockSize * NumberOfBlocks)))) { *OutFvb = Fvb; - Status = EFI_SUCCESS; + *Lba = (Address - FvbBaseAddress) / *BlockSize; + Status = EFI_SUCCESS; break; } @@ -191,9 +213,7 @@ PerformFlashWriteWithProgress ( EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL *Fvb; EFI_STATUS Status; UINTN BlockSize; - UINTN NumberOfBlocks; EFI_LBA Lba; - EFI_PHYSICAL_ADDRESS FvbBaseAddress; UINTN NumBytes; EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION Black; EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION White; @@ -227,7 +247,7 @@ PerformFlashWriteWithProgress ( // that covers the system firmware // Fvb = NULL; - Status = GetFvbByAddress (FlashAddress, &Fvb, &FvbBaseAddress); + Status = GetFvbByAddress (FlashAddress, Length, &Fvb, &Lba, &BlockSize); if (EFI_ERROR (Status)) { DEBUG ((DEBUG_ERROR, "%a: failed to locate FVB handle for address 0x%llx - %r\n", @@ -235,28 +255,6 @@ PerformFlashWriteWithProgress ( return Status; } - Status = Fvb->GetBlockSize(Fvb, 0, &BlockSize, &NumberOfBlocks); - if (EFI_ERROR (Status)) { - DEBUG ((DEBUG_ERROR, "%a: failed to get FVB blocksize - %r\n", - __FUNCTION__, Status)); - return Status; - } - - if ((Length % BlockSize) != 0) { - DEBUG ((DEBUG_ERROR, - "%a: Length 0x%lx is not a multiple of the blocksize 0x%lx\n", - __FUNCTION__, Length, BlockSize)); - return EFI_INVALID_PARAMETER; - } - - Lba = (FlashAddress - FvbBaseAddress) / BlockSize; - if (Lba > NumberOfBlocks - 1) { - DEBUG ((DEBUG_ERROR, - "%a: flash device with non-uniform blocksize not supported\n", - __FUNCTION__)); - return EFI_UNSUPPORTED; - } - // // Remap the region as device rather than uncached. // From patchwork Wed Jun 13 16:28:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 138508 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp949247lji; Wed, 13 Jun 2018 09:28:38 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIIS0tBYVBib0GeB7M88NoJVNw88Xgy2N+2l+4v3ho/H5mwS9+vXXR6lhZfxGGZwh1/U2gn X-Received: by 2002:a62:4653:: with SMTP id t80-v6mr5540154pfa.58.1528907318603; Wed, 13 Jun 2018 09:28:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528907318; cv=none; d=google.com; s=arc-20160816; b=ycB6s72GWpyMzAMoVqXHIitIJEO1yZAdHrYNOWeSDqyviFlYLUkrqLm9xI9sBDgNMM bVrh60cMDZAg/Y1LbTo4p7htDiWSkCDRg15pMu2KZXynNJM+92J9uh/H3aqhhq2zMUOA aV9gGl4PGRvFuAPqbQZIxChO4btrZcYO7s/KOp1ILvxfbjUq62ZRRTebA1FqOwBeBRYY wYDXzcdAtwo4kYRW3lDfksu8qprVl0gFLDP7To9OLhvWVnbtMvIn3fNS9s9ZMECvVVd/ ecJlP/ecIDrGfUFJMUOni7WcZ2tEWdKOuGRu+2/Gy3BoCnUhwMyo/UOMFPVnI+ZDhOIB Ejjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:references:in-reply-to:message-id:date :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=a6WiUmlRscFIsqvqbQEHw29CUaW8tN+T1HHZ3D1BVvc=; b=z+S3AReRJMtSK+9CUg3D9/pSCLYvdL89dPw5LLUcaeq8r7g3VGofKx7s5JQJ1fM2Ze tKJOkGItaH5CM+5D2eHXIV7EQbsYny0Iw6TjIcIKEUkgLXo2Ara/n9V9yjtdjXvU9ISW IU4qW6kfOm3EKCvRpN78ddQBxigeMVm8NtYt1hN6XGrfqsHEExY39SGtgEeHXPSzrUl0 +oMCnLMw2iLWDWqZxo1lDOcfx8FrRk4E/fzJDWQPjwHOae0uh1uT47Sa8mO6y0PgveOm uw+JTQ5WZj0CgglxCgXVGXm8gBDRSzX4xpRaIgWADxqdEn8HQ7CWzEi6Tauz+vKdiGsN 4sZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Otqr7Wk7; 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 Return-Path: Received: from ml01.01.org (ml01.01.org. [198.145.21.10]) by mx.google.com with ESMTPS id e95-v6si3326920plb.239.2018.06.13.09.28.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 09:28:38 -0700 (PDT) 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 header.s=google header.b=Otqr7Wk7; 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 90017212746E5; Wed, 13 Jun 2018 09:28:35 -0700 (PDT) X-Original-To: edk2-devel@lists.01.org Delivered-To: edk2-devel@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c09::244; helo=mail-wm0-x244.google.com; envelope-from=ard.biesheuvel@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (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 E9BA7212733E4 for ; Wed, 13 Jun 2018 09:28:33 -0700 (PDT) Received: by mail-wm0-x244.google.com with SMTP id n5-v6so6547417wmc.5 for ; Wed, 13 Jun 2018 09:28:33 -0700 (PDT) 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=oSC3QiYXuo7vF2NE8qh7dnb1L7wt+1/sR2zveKZmqmE=; b=Otqr7Wk7REka1PD/VX/XezYNtGYONKTIL+GQmVPRVWE12hReDB9xVcOByflVsfVwrb ATGrOMmAuUJ2eyBlHPabStyOLwIiAmc6ob2xaLcSguMA2as802+z42tr4nqTKC6PYaMw jCOYMwiTZ5sAi3VOtqUuOcBHxrmsMfKVP8OsE= 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=oSC3QiYXuo7vF2NE8qh7dnb1L7wt+1/sR2zveKZmqmE=; b=XDgzaHoX+wMFunPDD+B38psMjd8GmmDJoq/36/Ez6sMqE9eK+1ee2aRob4sthYd1Kh O5345IzrnsXbDJpjxR5wBm4nJi+Y5qrn2lF+esxt+mNG0okIZJ7f+5/I8TPUyCS+Tu0w e/uN5lJcudi/wlIpZBqtSHfCzhA1MwmG+dWkP+DAbuwKbzOIu4CvCbKf3GPAzqbiwBRa gBVq88F9BvphnjQ1bF03gFVDVId+xF2qBHTfMwY1bKaPLbeGjyl3/g0mtOBdDk9RHNx2 teQiLiaMR9AKQAanvKK+QaJgNWI1uQGcF4VA1SS2LJzau2p7W5ANjykmDLTF6qf7cHxr lYag== X-Gm-Message-State: APt69E0pJEq5qahXbOSpbWURHBv4AJoj8oPbaPnnHw4Hn+o9Q+C2UlR6 fm1A13qchCmo0gnDGCK3rJli/d+QiRk= X-Received: by 2002:a1c:903:: with SMTP id 3-v6mr4087677wmj.130.1528907312289; Wed, 13 Jun 2018 09:28:32 -0700 (PDT) Received: from dogfood.home ([2a01:cb1d:112:6f00:6dfc:b76c:4240:35ff]) by smtp.gmail.com with ESMTPSA id s191-v6sm6234782wmd.27.2018.06.13.09.28.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Jun 2018 09:28:31 -0700 (PDT) From: Ard Biesheuvel To: edk2-devel@lists.01.org Date: Wed, 13 Jun 2018 18:28:26 +0200 Message-Id: <20180613162826.19986-3-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180613162826.19986-1-ard.biesheuvel@linaro.org> References: <20180613162826.19986-1-ard.biesheuvel@linaro.org> Subject: [edk2] [PATCH edk2-platforms v2 2/2] Silicon/NorFlashSynQuacerLib: describe entire firmware region as FV 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: , Cc: leif.lindholm@linaro.org, Ard Biesheuvel MIME-Version: 1.0 Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" In order to allow for more flexibility when updating parts of the firmware via capsule update, expand the description of the code FV to cover the entire 4 MB region at the base of the NOR flash. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Ard Biesheuvel --- Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) -- 2.17.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel diff --git a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c index 816d8ba33f8c..d44fe3e4e94c 100644 --- a/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c +++ b/Silicon/Socionext/SynQuacer/Library/NorFlashSynQuacerLib/NorFlashSynQuacer.c @@ -19,12 +19,20 @@ #include +#define FW_CODE_REGION_BASE SYNQUACER_SPI_NOR_BASE +#define FW_CODE_REGION_SIZE (FW_ENV_REGION_BASE - FW_CODE_REGION_BASE) + +#define FW_ENV_REGION_BASE FixedPcdGet32 (PcdFlashNvStorageVariableBase) +#define FW_ENV_REGION_SIZE (FixedPcdGet32 (PcdFlashNvStorageVariableSize) + \ + FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + \ + FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize)) + STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = { { // UEFI code region SYNQUACER_SPI_NOR_BASE, // device base - FixedPcdGet64 (PcdFdBaseAddress), // region base - FixedPcdGet32 (PcdFdSize), // region size + FW_CODE_REGION_BASE, // region base + FW_CODE_REGION_SIZE, // region size SIZE_64KB, // block size { 0x19c118b0, 0xc423, 0x42be, { 0xb8, 0x0f, 0x70, 0x6f, 0x1f, 0xcb, 0x59, 0x9a } @@ -33,10 +41,8 @@ STATIC NOR_FLASH_DESCRIPTION mNorFlashDevices[] = { { // Environment variable region SYNQUACER_SPI_NOR_BASE, // device base - FixedPcdGet32 (PcdFlashNvStorageVariableBase), // region base - FixedPcdGet32 (PcdFlashNvStorageVariableSize) + - FixedPcdGet32 (PcdFlashNvStorageFtwWorkingSize) + - FixedPcdGet32 (PcdFlashNvStorageFtwSpareSize), // region size + FW_ENV_REGION_BASE, // region base + FW_ENV_REGION_SIZE, // region size SIZE_64KB, // block size { 0x3105bd7a, 0x82c3, 0x486f, { 0xb1, 0x03, 0x1e, 0x09, 0x54, 0xec, 0x85, 0x75 }