From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web12.8861.1589448302410757081 for ; Thu, 14 May 2020 02:25:02 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 0D82131B; Thu, 14 May 2020 02:25:02 -0700 (PDT) Received: from [192.168.1.81] (unknown [10.37.8.255]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4AEF03F71E; Thu, 14 May 2020 02:25:00 -0700 (PDT) Subject: Re: [PATCH v1 05/11] ArmPlatformPkg: Dynamic flash variable base To: Sami Mujawar , devel@edk2.groups.io Cc: leif@nuviainc.com, Alexandru.Elisei@arm.com, Andre.Przywara@arm.com, Matteo.Carlini@arm.com, Laura.Moretta@arm.com, nd@arm.com References: <20200514084019.71368-1-sami.mujawar@arm.com> <20200514084019.71368-6-sami.mujawar@arm.com> From: "Ard Biesheuvel" Message-ID: <2ff74115-ef9a-a1d7-5a54-474e2f7f6d00@arm.com> Date: Thu, 14 May 2020 11:24:56 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200514084019.71368-6-sami.mujawar@arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 5/14/20 10:40 AM, Sami Mujawar wrote: > Some virtual machine managers like kvmtool can relocate > the devices in the system memory map. The information > about the devices location in memory is described in the > device tree. Therefore, the CFI memory region and the > associated Non volatile storage variables need to be > adjusted accordingly. > > To support such use cases the non-volatile storage > variable base PCD PcdFlashNvStorageVariableBase has > been defined as a dynamic PCD. > > The NOR flash driver was using the Flash non-volatile > storage variable base PCD as a fixed PCD, thereby > preventing runtime resolution of the variable base > address. > > Therefore update the NOR flash driver to load the > PCD using PcdGet32 instead of FixedPcdGet32. > > Signed-off-by: Sami Mujawar Reviewed-by: Ard Biesheuvel > --- > ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c > index e248fdf6db94191648b5d33bf1a9263f446ee141..9cdd85096a463f69b3b864cecdeaf247e65f4f73 100644 > --- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c > +++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c > @@ -1,6 +1,6 @@ > /*++ @file NorFlashFvbDxe.c > > - Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
> + Copyright (c) 2011 - 2020, ARM Ltd. All rights reserved.
> > SPDX-License-Identifier: BSD-2-Clause-Patent > > @@ -736,7 +736,7 @@ NorFlashFvbInitialize ( > EFI_MEMORY_UC | EFI_MEMORY_RUNTIME); > ASSERT_EFI_ERROR (Status); > > - mFlashNvStorageVariableBase = FixedPcdGet32 (PcdFlashNvStorageVariableBase); > + mFlashNvStorageVariableBase = PcdGet32 (PcdFlashNvStorageVariableBase); > > // Set the index of the first LBA for the FVB > Instance->StartLba = (PcdGet32 (PcdFlashNvStorageVariableBase) - Instance->RegionBaseAddress) / Instance->Media.BlockSize; >