From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) by mx.groups.io with SMTP id smtpd.web11.1515.1674933516723273491 for ; Sat, 28 Jan 2023 11:18:47 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ventanamicro.com header.s=google header.b=b/CzJIh0; spf=pass (domain: ventanamicro.com, ip: 209.85.214.174, mailfrom: sunilvl@ventanamicro.com) Received: by mail-pl1-f174.google.com with SMTP id d3so7963997plr.10 for ; Sat, 28 Jan 2023 11:18:47 -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=2Qr6telBcVtil5l0PN818/LwjoWGT4XgHQJD8Rj63xI=; b=b/CzJIh0cvy6owpx0EtsUk1uqc8HVt/rB8VzDNeG7xdv1m0Ws/sFvT0hikpMScu2Lz TIcsxLOHgzvzXYVSseJVnZuT3kEB4JRVOgE+bHgNGG9lt4c00nST/PN3gCihZ0naUAFy FhwEoXmyvlHI2ks2n6JGMs54+x9IFH4PiKeN7HAqKmrf57gLBjJGvFKNgHwIS8XHjs+z YBijZDl1rlzWJJEb4q8/asckSSN3zfO9t9vwM7b69huI3G1vN+pxjrp4i48VllyI8Q0y nqhTuGQcCNjabFBzmgukTBSFY7OpRr8V5XFrQe3LiVBnYHC7L5PuhahWX2sTXeJ1qBrF uLDw== 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=2Qr6telBcVtil5l0PN818/LwjoWGT4XgHQJD8Rj63xI=; b=KS89hgco5ssJp3EHrZQjGtAQ8jOm06++TyMgS/JZMVDcskKYxhA8QQ9jucrZMpSdCa ZR+QBkTmaZf6IZdiUxJsgmXUWRh6jvr8LF03cdeoxNT6fg5HS1kHehcm4+wL5hQ4cDj7 FXkJ5qg4bZNd68q39ukctHRlAi2hhY+oV8Sc8uXYUtBxe6Wcc3u0KJFdO3X5MD/gWQjt e1k+R9lsw2nqsINmk4FZ5KujDzOzIpvdHNENt5IuTXHCaCxRjBPvD3yHOt+ah2YmUgIB cnYNMZRtmtOv8Br4k8zF7MmOduLVFQEoz4RzNn/TrJW4o4xzM5tmIW7EHTt7vaN5MJf2 xShw== X-Gm-Message-State: AO0yUKW++1sfMYIkPOUxEoxuySHnlt9IZlstpZG+ClLByqkJo23CIR2N jd/VBwxHMTT5OzUdMiEErXYNwNtY2t3sIN49 X-Google-Smtp-Source: AK7set+xEf9b5ZFlU4O7VmyNtS3xi+czIveOqsDPTkWqo5cQtitwzqQgL2IIYD0Z6JxMmN70tPniCw== X-Received: by 2002:a17:903:1109:b0:196:1139:39fc with SMTP id n9-20020a170903110900b00196113939fcmr23366590plh.56.1674933527455; Sat, 28 Jan 2023 11:18:47 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Jan 2023 11:18:47 -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 14/20] OvmfPkg/RiscVVirt: Add PrePiHobListPointerLib library Date: Sun, 29 Jan 2023 00:48:01 +0530 Message-Id: <20230128191807.2080547-15-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 Add the PrePiHobListPointerLib required for RISC-V Qemu Virt machine since it follows PEIless design. 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/PrePiHobListPointerLib/PrePiHobListPointerLib.inf | 23 +++++++ OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointer.c | 65 ++++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf b/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf new file mode 100644 index 000000000000..c539682e8d0b --- /dev/null +++ b/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf @@ -0,0 +1,23 @@ +#/** @file +# +# Copyright (c) 2021, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +#**/ + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = PrePiHobListPointerLib + FILE_GUID = E3FAFC60-758C-471B-A333-FE704A4C11B4 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = PrePiHobListPointerLib + +[Sources.RISCV64] + PrePiHobListPointer.c + +[Packages] + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + UefiCpuPkg/UefiCpuPkg.dec diff --git a/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointer.c b/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointer.c new file mode 100644 index 000000000000..a58b7aae6bee --- /dev/null +++ b/OvmfPkg/RiscVVirt/Library/PrePiHobListPointerLib/PrePiHobListPointer.c @@ -0,0 +1,65 @@ +/** @file +* +* Copyright (c) 2021, Intel Corporation. All rights reserved.
+* SPDX-License-Identifier: BSD-2-Clause-Patent +* +**/ + +#include +#include +#include +#include +#include + +/** + Returns the pointer to the HOB list. + + This function returns the pointer to first HOB in the list. + + @return The pointer to the HOB list. + +**/ +VOID * +EFIAPI +PrePeiGetHobList ( + VOID + ) +{ + EFI_RISCV_FIRMWARE_CONTEXT *FirmwareContext; + + FirmwareContext = NULL; + GetFirmwareContextPointer (&FirmwareContext); + + if (FirmwareContext == NULL) { + DEBUG ((DEBUG_ERROR, "%a: Firmware Context is NULL\n", __FUNCTION__)); + return NULL; + } + + return (VOID *)FirmwareContext->PrePiHobList; +} + +/** + Updates the pointer to the HOB list. + + @param HobList Hob list pointer to store + +**/ +EFI_STATUS +EFIAPI +PrePeiSetHobList ( + IN VOID *HobList + ) +{ + EFI_RISCV_FIRMWARE_CONTEXT *FirmwareContext; + + FirmwareContext = NULL; + GetFirmwareContextPointer (&FirmwareContext); + + if (FirmwareContext == NULL) { + DEBUG ((DEBUG_ERROR, "%a: Firmware Context is NULL\n", __FUNCTION__)); + return EFI_NOT_READY; + } + + FirmwareContext->PrePiHobList = HobList; + return EFI_SUCCESS; +} -- 2.38.0