From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by mx.groups.io with SMTP id smtpd.web10.13414.1676032288677369579 for ; Fri, 10 Feb 2023 04:31:28 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ventanamicro.com header.s=google header.b=Rl1APWmt; spf=pass (domain: ventanamicro.com, ip: 209.85.216.49, mailfrom: sunilvl@ventanamicro.com) Received: by mail-pj1-f49.google.com with SMTP id f16-20020a17090a9b1000b0023058bbd7b2so5412645pjp.0 for ; Fri, 10 Feb 2023 04:31:28 -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=AkmKi1XFEYIep36j7bteKep6ZbhU6LDMa3F3MNECsWM=; b=Rl1APWmtX2l9Fc21yDVLn9SSPHOV2/1Guu27GLi+tZoJmBjxbwf9yDQMxWyXKIo2/4 Pc3hUJOz/QcM0v8BXhQPnsFglVxI9dB1eSyLTb/+ERU6AXeMNmCXFXnDvy6Cgu8+Zxyl V9DIAKNuOprSJptT37zHdP1Jar+PhrhHvRDaAfoyenrr2UjwcrpafuDxpDsclrUkWrX0 r/xCjR20GNNy1qeOn2ImvmmECEDrOvlTnYWABlbSdcfmnBsg3JlZ6oipZE+AaBSQk+4T MRJknNUXMl133Prq9Nm/jwPaWzHhYWuzq+KZnd157NkM8f/GYYVu/XKqDsV7mtEC+fBu TkWQ== 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=AkmKi1XFEYIep36j7bteKep6ZbhU6LDMa3F3MNECsWM=; b=sApAXfSYY0pNr8Hh10frTpNbd2Z8VDXdkr/LfybrcR6jwtP4rPqYqui/y3orCfbofQ NhD9/p64pC8LpjVrpgLnac25mRkvbWXC7MjV+3Rqc734XTIkpdDdUVMw4sgUrNJGkQ5r XdnWvhX99hhvv3Nvsyn+xO/gM86hh5maAJRgcGyYqtRABX5Wo5H/3iu3sLiVVconlHzV Wv4i/fbb+PeR9YNvgFcZVkur0Ja3Mx16Ooe0DDNkWXeshoDko8ktJsrptFf53pfcHhJ+ gumBDm875nOyrBT8PUBxfX3cpe2KxOpn49Qq4A3gdNhsFN3kDCmZEOF53EfjZJbUBIj7 ezXA== X-Gm-Message-State: AO0yUKWNSnTJCnY2ZW2JBtQhQbuRcX8KggwPUCenHWBfViS2JWWaTvXO hWQ9ObQzxw++IAfaMMxsec6Z/7WguGWsWuO3 X-Google-Smtp-Source: AK7set/Yd2iyfz7yeq3rYqnglp+epTgC7u3i3wTqlgTWkbTSYIOxjO5/coIElbP3IT8r8yoIgpvquw== X-Received: by 2002:a17:902:e807:b0:199:642:1c27 with SMTP id u7-20020a170902e80700b0019906421c27mr17364580plg.12.1676032288012; Fri, 10 Feb 2023 04:31:28 -0800 (PST) Return-Path: Received: from localhost.localdomain ([49.206.14.226]) by smtp.gmail.com with ESMTPSA id b17-20020a170902ed1100b0019a73faf773sm1172961pld.71.2023.02.10.04.31.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Feb 2023 04:31:27 -0800 (PST) From: "Sunil V L" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann , Abner Chang , Andrei Warkentin Subject: [edk2-staging/RiscV64QemuVirt PATCH V8 15/19] OvmfPkg/RiscVVirt: Add VirtNorFlashPlatformLib library Date: Fri, 10 Feb 2023 18:00:37 +0530 Message-Id: <20230210123041.1489506-16-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230210123041.1489506-1-sunilvl@ventanamicro.com> References: <20230210123041.1489506-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 Reviewed-by: Andrei Warkentin --- 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.34.1