From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by mx.groups.io with SMTP id smtpd.web10.1519.1674933511987673378 for ; Sat, 28 Jan 2023 11:18:56 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ventanamicro.com header.s=google header.b=AbN/N1gy; spf=pass (domain: ventanamicro.com, ip: 209.85.214.169, mailfrom: sunilvl@ventanamicro.com) Received: by mail-pl1-f169.google.com with SMTP id r8so1140197pls.2 for ; Sat, 28 Jan 2023 11:18:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ventanamicro.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Jg0oT5XZ0PZjGiPengrxPTg/SJ9QcCVZl/riCIxBv28=; b=AbN/N1gyl8HgFMZYQuYblNDNESWmQkGXq/mTJm8kf9E7e8BOy/MtCyEPekQ8R+7+Ve 0h6rX5RODavmpDczfY5H95ilOB3czWSpYBVU8j6xeVwnPKiqFKN5gTO7qQT7dRyUyLdV 0/j2eGYaOMhA9iTXcnGLDiiXyW5QRyyG4uCCXru86VoN54svYx6XJCpgyeB3AQ8+mGNg Yymkqv5UftvLLByGTJrTeL2ScOVOwdK0VRtCt/ykT0L1vBKeq1aKZv6c3DXNiGXV+3o0 iUIATU2bifwpoc8s242b2GMsvVgTJDA2E7aG/RqWAN1Ne7DJ/+ElX27WijToel7CArWw SN4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Jg0oT5XZ0PZjGiPengrxPTg/SJ9QcCVZl/riCIxBv28=; b=O2nFjz8YeI2NgdEQ7pNW0Hbg4nRai3vpnEX6YBFhlORNES1j5aMe1vilLsnTCg9bLu NiImSjibHeaaPOVLRQiXIN3+jol8VUjRTBc4F4DlJ5Fo1xlcwfCN6WVwotUOsKfezZx5 cvI5vxEJtJgvLJRgC6RTFiD0S8RieuDRqgP+/IsIz8dhCvC55gJ/HA+yXp4DcSCpmor6 gcD7WBaumxlFYYe+0Ij73AXSw1AZSLmz+ddn1U1CTAgV0DT8FC7o2wMAqZNTfkHPS+WO vUhtwj4OGryJkyeznPgWo0kARlS5jXwpNg0cehi37Zx+vqc8neFOV9Z3nQHT2GvBXx59 jDpg== X-Gm-Message-State: AO0yUKUr/sKB/fOjwX0l8/zYXMH9vC+UMGyHgSpt2by2WOB0UMdNTpte nonc6X6jX3v532koKcYU32Pr27PxNFAbdQg5 X-Google-Smtp-Source: AK7set+Egn2FmHlWVdQFZuD4c05/xfIqU2vHR4S0urbnNqfAkRnuuPnmTdSQMjtvAvvBKSf+fpb3+Q== X-Received: by 2002:a17:902:d2c9:b0:196:5484:a064 with SMTP id n9-20020a170902d2c900b001965484a064mr9493933plc.35.1674933536369; Sat, 28 Jan 2023 11:18:56 -0800 (PST) Return-Path: Received: from kerodipc.Dlink ([49.206.11.246]) by smtp.gmail.com with ESMTPSA id n9-20020a1709026a8900b00192d9258532sm139923plk.150.2023.01.28.11.18.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Jan 2023 11:18:56 -0800 (PST) From: "Sunil V L" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann , Abner Chang Subject: [edk2-staging/RiscV64QemuVirt PATCH V7 16/20] OvmfPkg/RiscVVirt: Add VirtNorFlashPlatformLib library Date: Sun, 29 Jan 2023 00:48:03 +0530 Message-Id: <20230128191807.2080547-17-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20230128191807.2080547-1-sunilvl@ventanamicro.com> References: <20230128191807.2080547-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Qemu NOR flash driver needs this library. Add this library for RISC-V leveraged from SbsaQemu. Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen Cc: Gerd Hoffmann Signed-off-by: Sunil V L Acked-by: Abner Chang --- OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.inf | 30 +++++++++++++++ OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.c | 40 ++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.inf b/OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.inf new file mode 100644 index 000000000000..4e87bd437380 --- /dev/null +++ b/OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.inf @@ -0,0 +1,30 @@ +#/** @file +# +# Component description file for VirtNorFlashStaticLib module +# +# Copyright (c) 2014, Linaro Ltd. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION = 0x00010005 + BASE_NAME = VirtNorFlashStaticLib + FILE_GUID = 064742F1-E531-4D7D-A154-22315889CC23 + MODULE_TYPE = DXE_DRIVER + VERSION_STRING = 1.0 + LIBRARY_CLASS = VirtNorFlashPlatformLib + +[Sources.common] + VirtNorFlashStaticLib.c + +[Packages] + MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec + OvmfPkg/OvmfPkg.dec + +[Pcd] + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFdBaseAddress + gUefiOvmfPkgTokenSpaceGuid.PcdOvmfFirmwareFdSize + gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase diff --git a/OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.c b/OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.c new file mode 100644 index 000000000000..fdc2ccb6294e --- /dev/null +++ b/OvmfPkg/RiscVVirt/Library/VirtNorFlashPlatformLib/VirtNorFlashStaticLib.c @@ -0,0 +1,40 @@ +/** @file + + Copyright (c) 2019, Linaro Ltd. All rights reserved + + SPDX-License-Identifier: BSD-2-Clause-Patent + + **/ + +#include +#include +#include + +#define QEMU_NOR_BLOCK_SIZE SIZE_256KB + +EFI_STATUS +VirtNorFlashPlatformInitialization ( + VOID + ) +{ + return EFI_SUCCESS; +} + +VIRT_NOR_FLASH_DESCRIPTION mNorFlashDevice = +{ + FixedPcdGet32 (PcdOvmfFdBaseAddress), + FixedPcdGet64 (PcdFlashNvStorageVariableBase), + FixedPcdGet32 (PcdOvmfFirmwareFdSize), + QEMU_NOR_BLOCK_SIZE +}; + +EFI_STATUS +VirtNorFlashPlatformGetDevices ( + OUT VIRT_NOR_FLASH_DESCRIPTION **NorFlashDescriptions, + OUT UINT32 *Count + ) +{ + *NorFlashDescriptions = &mNorFlashDevice; + *Count = 1; + return EFI_SUCCESS; +} -- 2.38.0