From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172]) by mx.groups.io with SMTP id smtpd.web10.132065.1671109016309471170 for ; Thu, 15 Dec 2022 04:57:19 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ventanamicro.com header.s=google header.b=W/NoUuCS; spf=pass (domain: ventanamicro.com, ip: 209.85.210.172, mailfrom: sunilvl@ventanamicro.com) Received: by mail-pf1-f172.google.com with SMTP id g1so6647605pfk.2 for ; Thu, 15 Dec 2022 04:57:19 -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=X9zt4rlt+uJdpcKElqMp09Et7qppm2UsDUtDlO3k/Rg=; b=W/NoUuCS6NdN/KGYjbZYvXEzP2fBbwj7dApc2eMRye+NeXQdlXejEwrXSemsVD4Q/o Uh0/lHBfm360R0Q1CnmDCFJXpUtsX2DZ5tf2GjFkDcJxplVgwEolyTyWsw+o+z4tAeOQ Wn92DooaY/xPfd0URPmyorexWUs24qtgxxaVKFkGsmS1IlUyw/3mIll5UPrRwpOaa1l9 JTdAm8RyiUBgxQpIWdWrk4l/9ED5o5CTqCenQ3rf/wIS6xwP19Rg/taweumTuTcdq+EL rGHGc20DyuZPG07+HCJ/R6CWZd7cRWfjk/6keVtYvoeF+5xUvScbWNvFcN0T4RRrZCc9 TqPg== 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=X9zt4rlt+uJdpcKElqMp09Et7qppm2UsDUtDlO3k/Rg=; b=RR3wVFTew//MTYSZtJ67oMslQ+WbBAYMEADrlW/EoHT9aEWXJ98SWlpohCnlhs10la HgmvQ1QNm8PikFLgYJFDIk565lJoYcudE3ulBYMDQgPovHgAshol5TTWYanDD1GUClqU 3xLpdtJ0q/P5ZO2inQ8suolU1g6nw9gZFjB3wqBW83rAQKMhofps3L3HBaqCI4edc9Td grVaEyPhVJ1wilwmI+YJJ6iA5UWFC2ulFVhYuXfGy/HVOELHw3U6cau3UnkeCSoWyCx3 24zwjNW8emNn31+73HiuFBf8y7bRvw3gJDNdM65vayMoCXPgZlNGu1PYJQh1/LwrnKrB WecQ== X-Gm-Message-State: ANoB5pnOGH/yX8auxqaa05iH80sFy6V2TMOyly1KhX0MOZTfJaIOKQbA W9iV0HENywYX5Ccy/qTQ8WaVPZfSPZ0SXMzuFb0= X-Google-Smtp-Source: AA0mqf6Yb4HosE9qsgq748RgyflZsOSe1XCLUpj38ekxXBgNWYVXK9KiKv2oQlMTJBgGVqLrBI/4Kg== X-Received: by 2002:a05:6a00:1c95:b0:578:8864:b25c with SMTP id y21-20020a056a001c9500b005788864b25cmr14915225pfw.25.1671109038916; Thu, 15 Dec 2022 04:57:18 -0800 (PST) Return-Path: Received: from localhost.localdomain ([49.206.11.246]) by smtp.gmail.com with ESMTPSA id j2-20020a625502000000b005762905c89asm1674384pfb.66.2022.12.15.04.57.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 04:57:18 -0800 (PST) From: "Sunil V L" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann , Daniel Schaefer Subject: [edk2-staging/RiscV64QemuVirt PATCH V6 17/23] OvmfPkg: Add PrePiHobListPointerLib library Date: Thu, 15 Dec 2022 18:26:20 +0530 Message-Id: <20221215125626.545372-18-sunilvl@ventanamicro.com> X-Mailer: git-send-email 2.38.0 In-Reply-To: <20221215125626.545372-1-sunilvl@ventanamicro.com> References: <20221215125626.545372-1-sunilvl@ventanamicro.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This library is required to use the PEI less design for RISC-V qemu virt support. Cc: Ard Biesheuvel Cc: Jiewen Yao Cc: Jordan Justen Cc: Gerd Hoffmann Cc: Daniel Schaefer Signed-off-by: Sunil V L --- OvmfPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf | 23 +++++++ OvmfPkg/Library/PrePiHobListPointerLib/RiscV64/PrePiHobListPointer.c | 65 ++++++++++++++++++++ 2 files changed, 88 insertions(+) diff --git a/OvmfPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf b/OvmfPkg/Library/PrePiHobListPointerLib/PrePiHobListPointerLib.inf new file mode 100644 index 000000000000..4105e60f59e1 --- /dev/null +++ b/OvmfPkg/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] + RiscV64/PrePiHobListPointer.c + +[Packages] + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + UefiCpuPkg/UefiCpuPkg.dec diff --git a/OvmfPkg/Library/PrePiHobListPointerLib/RiscV64/PrePiHobListPointer.c b/OvmfPkg/Library/PrePiHobListPointerLib/RiscV64/PrePiHobListPointer.c new file mode 100644 index 000000000000..a58b7aae6bee --- /dev/null +++ b/OvmfPkg/Library/PrePiHobListPointerLib/RiscV64/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