From nobody Sun Feb 8 20:57:59 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+65867+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one); dmarc=fail(p=none dis=none) header.from=arm.com Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1601673282237253.65558222500442; Fri, 2 Oct 2020 14:14:42 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id mkOpYY1788612x5XgFvkwQPe; Fri, 02 Oct 2020 14:14:41 -0700 X-Received: from FRA01-MR2-obe.outbound.protection.outlook.com (FRA01-MR2-obe.outbound.protection.outlook.com [40.107.9.78]) by mx.groups.io with SMTP id smtpd.web10.5612.1601673281022324441 for ; Fri, 02 Oct 2020 14:14:41 -0700 X-Received: from AM6P194CA0082.EURP194.PROD.OUTLOOK.COM (2603:10a6:209:8f::23) by PR2PR08MB4633.eurprd08.prod.outlook.com (2603:10a6:101:1c::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.35; Fri, 2 Oct 2020 21:14:37 +0000 X-Received: from AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com (2603:10a6:209:8f:cafe::93) by AM6P194CA0082.outlook.office365.com (2603:10a6:209:8f::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.32 via Frontend Transport; Fri, 2 Oct 2020 21:14:37 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; edk2.groups.io; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+65867+1787277+3901457@groups.io; helo=web01.groups.io; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 63.35.35.123 as permitted sender) receiver=protection.outlook.com; client-ip=63.35.35.123; helo=64aa7808-outbound-1.mta.getcheckrecipient.com; X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT059.mail.protection.outlook.com (10.152.17.193) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.34 via Frontend Transport; Fri, 2 Oct 2020 21:14:37 +0000 X-Received: ("Tessian outbound e8cdb8c6f386:v64"); Fri, 02 Oct 2020 21:14:37 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 5f664404e4a6fec2 X-CR-MTA-TID: 64aa7808 X-Received: from 60aab818ebad.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id AB5C731E-A70E-4A53-8387-76A1F351B839.1; Fri, 02 Oct 2020 21:14:26 +0000 X-Received: from EUR02-AM5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 60aab818ebad.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 02 Oct 2020 21:14:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=S6Vy7QF/vZsYhV0cYj1y7YybZ/pmdS2Y7TMa8Q4y6vopgejMyIUUXJLXI8gakdD5NTuROt4olKM4RhEa6wMCaTH9X4i/B4KudXBdhJR9E2HYPfcjXuaZTZc3GK3eyKJJnLfSolar/pbPmDdgb4gJ2UMvlX6BPJA3iduem2bcbeueVw7FbtYgd+RgleQjydFG4eDdjIhtG1sJXS+9/e+2yTBIy5t5kTRO6QtEAvYe3E4cii0VUlUNdLwbc7FRgt1hEFK/hoQIq/a/QCMd+OkPL9xguiKaa63hCvMTtwUAyAi3hOHNJuS+68Y5GVErx6RdHRsQjM+OrXrcSeTSOoTLtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=QxPag8k9VXug+3tZd9PG02em0fr9GaV3u+Cn10RrpoQ=; b=iPTx5Tf0kAbXZnPEXX83qXsUM3iG6rBQmZaGgcviOmHcMnIwb/KB5ef7bpmbMaLaSwpwH1WRud78i2+IdoI4tuuBLZlrKGBOQV7tPHhEP8lgbCBggiwdJ2HXhZhsnjxHu20FL6mNJiNMDjcXx2bSFN2wvO4y5YW92xojUwZOyzDShTCYBXFq6VwcAnDxpVKkt+f1ka336Vj2sh+49XNZvOX4B22GqwlnXIC/X8baDrFhceeefjXS4VnZrUXwuoUe+rl8ursr/D4B3yy3iU7Rc6fBZranu9rzi2qqpOWKBJWU4yohI1YjclzZM94WUyfBXFdS9b4Aq6HnO9obKlc72g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 40.67.248.234) smtp.rcpttodomain=edk2.groups.io smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from AM3PR05CA0117.eurprd05.prod.outlook.com (2603:10a6:207:2::19) by AM0PR08MB4467.eurprd08.prod.outlook.com (2603:10a6:208:138::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.38; Fri, 2 Oct 2020 21:14:24 +0000 X-Received: from AM5EUR03FT049.eop-EUR03.prod.protection.outlook.com (2603:10a6:207:2:cafe::33) by AM3PR05CA0117.outlook.office365.com (2603:10a6:207:2::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3433.35 via Frontend Transport; Fri, 2 Oct 2020 21:14:24 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=pass action=none header.from=arm.com; Received-SPF: Pass (protection.outlook.com: domain of arm.com designates 40.67.248.234 as permitted sender) receiver=protection.outlook.com; client-ip=40.67.248.234; helo=nebula.arm.com; X-Received: from nebula.arm.com (40.67.248.234) by AM5EUR03FT049.mail.protection.outlook.com (10.152.17.130) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3433.34 via Frontend Transport; Fri, 2 Oct 2020 21:14:24 +0000 X-Received: from AZ-NEU-EX04.Arm.com (10.251.24.32) by AZ-NEU-EX03.Arm.com (10.251.24.31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2044.4; Fri, 2 Oct 2020 21:14:20 +0000 X-Received: from E107187.Arm.com (10.57.53.44) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2044.4 via Frontend Transport; Fri, 2 Oct 2020 21:14:19 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , Subject: [edk2-devel] [PATCH v5 10/15] ArmVirtPkg: Add Kvmtool Platform Pei Lib Date: Fri, 2 Oct 2020 22:14:04 +0100 Message-ID: <20201002211409.43888-11-sami.mujawar@arm.com> In-Reply-To: <20201002211409.43888-1-sami.mujawar@arm.com> References: <20201002211409.43888-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 62cdee3f-a4ab-4d5a-23e4-08d867182b32 X-MS-TrafficTypeDiagnostic: AM0PR08MB4467:|PR2PR08MB4633: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:3383;OLM:3383; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: vz1NSX/WPZFRXN+AfJmVfwhyycyGoQ5TtlDAc9+2izjv6c7Fp+h9kivER2TgoKUxyk04VK9P3k6noi4K8ZtrXl+FugrAtuBOwXD1x0W5fH8/nLed6BWdSiEIFoRso7c6aAkXkiKXFyp7Rfe/4GHz4Y80yuRZjT9MP56pSvwgbUOjxKyYa4co3IQ6ANcn+sHhI5gd6NAygs+bMyOqmvyM7X3eKPn5mPbR1za2Spp8Yk3O07AoujyuKiUmEt6Uuxf6C6MykIbSIKdqIicvbct2HmlQcwz4tIOsV5uMm9Er4tDwHQrvqPL3LPNb05Cdeq9tRsvf6F8RZ7LGaWQgb9SHBrsBi1yyrbeZ9DI1u4k558IjCN6tGYQiT1lUgJSUIcU6HTG2aaEWvBztgX0odTBDlxX1GLHzWV+/p+LSWVURvoNKbKo3R5mk/VTv5VZuw5Yq/ewZbvn+3d8iEpK3H1jdtF8GvJSyyjbyjm0I91u6joU= X-Forefront-Antispam-Report-Untrusted: CIP:40.67.248.234;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:nebula.arm.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(4636009)(376002)(39860400002)(346002)(396003)(136003)(46966005)(8676002)(2906002)(83380400001)(4326008)(44832011)(36756003)(356005)(316002)(8936002)(54906003)(86362001)(81166007)(5660300002)(82310400003)(7696005)(83080400001)(1076003)(19627235002)(6666004)(336012)(26005)(47076004)(82740400003)(186003)(70586007)(70206006)(478600001)(966005)(2616005)(426003)(6916009);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB4467 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 079a66b0-6de4-4c10-1e44-08d8671823ab X-Microsoft-Antispam-Message-Info: eEySvr7qL6gqui1FM9TBb2HLF3EqvrIdfFg072qgUIVVdXh+y+g+j69jQTKUG3XUlhuRbrvoBXIDUMc9WngGtkBc/nZBc2+zr5WnrIbYjFXKXSqWEm8jEj4prIxkBjCH1l3z8CJOHPRkpb2qcUFbpGGLcXgsysP/S1epFDAE+mIcT4dmKn4Ms0/RCKHSaQtd0J1iIRSrdK3LSBITk3G8JliyjBxPnFij2MeF0tAbfDzwYE3UInisnjoiBu0ZNnq6aRfcZk6YbEaOHKubwm+jy+jcnbd66yhNUo8sgK3L1XCfKgmWQ3CSKqRNhG7xaIAoiaUMu50A04JsT0lMGTRVYaHgXDhg4XjZm2Kj0OqgCQyE4Uhlsmju92w4urK3FXhhZFSd6hGzeq5A9A+L+EvG5XVpX4kM1ha00qsbp/NTQdQiv5RH6BUwhcMJ0lkdgTkG18VCPfu7a7OinqObxvOKz4woLpjVnRznweFUTqKDqG8= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Oct 2020 21:14:37.3917 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 62cdee3f-a4ab-4d5a-23e4-08d867182b32 X-MS-Exchange-CrossTenant-Id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=f34e5979-57d9-4aaa-ad4d-b122a662184d;Ip=[63.35.35.123];Helo=[64aa7808-outbound-1.mta.getcheckrecipient.com] X-MS-Exchange-CrossTenant-AuthSource: AM5EUR03FT059.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR2PR08MB4633 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,sami.mujawar@arm.com X-Gm-Message-State: 7MSkvJAMoMGRYeGFlJWCMb9nx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1601673281; bh=m70q4+86rLK8mxR94n+ipAha/5bwhPB9sRKFaGxKplI=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=XDA+kBAcqIxdkv3HGfH480AGKodaMWpyohG9MCUiaNXj4A5WzzYQQA/dUV+UsynXSEA rv0hcyiUNVKsAE0Ky5DgbIIOR+gGUiPN3TGFoY8JyPvMAiJrMKxmhu4Psu1O4Ta5493/P WJ1MsisxhO302LjBHc2Z1qRKwjcsDkNiBoI= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The PlatformPeim() in the PlatformPeiLib is invoked by the PrePiMain() and provides the platform an opportunity to setup the plaform specific HOBs. This PlatfromPeiLib initialises the Kvmtool platform HOBs like the Fdt, 16550BaseAddress, etc. Signed-off-by: Sami Mujawar Reviewed-by: Ard Biesheuvel --- Notes: v5: - Fixed minor ECC reported issues in file header. [Sami] Ref: https://edk2.groups.io/g/devel/message/62143 =20 v4: - No code change, resending patch with v4 series. [Sami] Ref: https://edk2.groups.io/g/devel/message/61722 ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.c | 79 ++= ++++++++++++++++++ ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.inf | 49 ++= ++++++++++ 2 files changed, 128 insertions(+) diff --git a/ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib= .c b/ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.c new file mode 100644 index 0000000000000000000000000000000000000000..255eb0599e4ad73874282eef842= 2e0b0d8eab2ac --- /dev/null +++ b/ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.c @@ -0,0 +1,79 @@ +/** @file + Kvmtool platform PEI library. + + Copyright (c) 2020, ARM Limited. All rights reserved. + + SPDX-License-Identifier: BSD-2-Clause-Patent + +**/ + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +/** Initialise Platform HOBs + + @retval EFI_SUCCESS Success. + @retval EFI_INVALID_PARAMETER A parameter is invalid. + @retval EFI_OUT_OF_RESOURCES Out of resources. +**/ +EFI_STATUS +EFIAPI +PlatformPeim ( + VOID + ) +{ + VOID *Base; + VOID *NewBase; + UINTN FdtSize; + UINTN FdtPages; + UINT64 *FdtHobData; + UINT64 *UartHobData; + + Base =3D (VOID*)(UINTN)PcdGet64 (PcdDeviceTreeInitialBaseAddress); + if ((Base =3D=3D NULL) || (fdt_check_header (Base) !=3D 0)) { + ASSERT (0); + return EFI_INVALID_PARAMETER; + } + + FdtSize =3D fdt_totalsize (Base) + PcdGet32 (PcdDeviceTreeAllocationPadd= ing); + FdtPages =3D EFI_SIZE_TO_PAGES (FdtSize); + NewBase =3D AllocatePages (FdtPages); + if (NewBase =3D=3D NULL) { + ASSERT (0); + return EFI_OUT_OF_RESOURCES; + } + + fdt_open_into (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages)); + + FdtHobData =3D BuildGuidHob (&gFdtHobGuid, sizeof (*FdtHobData)); + if (FdtHobData =3D=3D NULL) { + ASSERT (0); + return EFI_OUT_OF_RESOURCES; + } + + *FdtHobData =3D (UINTN)NewBase; + + UartHobData =3D BuildGuidHob ( + &gEarly16550UartBaseAddressGuid, + sizeof (*UartHobData) + ); + if (UartHobData =3D=3D NULL) { + ASSERT (0); + return EFI_OUT_OF_RESOURCES; + } + + *UartHobData =3D PcdGet64 (PcdSerialRegisterBase); + + BuildFvHob (PcdGet64 (PcdFvBaseAddress), PcdGet32 (PcdFvSize)); + + return EFI_SUCCESS; +} diff --git a/ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib= .inf b/ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.inf new file mode 100644 index 0000000000000000000000000000000000000000..f201aee50cdd07f9424c620152e= 240ef50715f88 --- /dev/null +++ b/ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.inf @@ -0,0 +1,49 @@ +## @file +# Kvmtool platform PEI library. +# +# Copyright (c) 2020, ARM Limited. All rights reserved. +# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001B + BASE_NAME =3D PlatformPeiLib + FILE_GUID =3D 21073FB3-BA6F-43EB-83F0-4A840C648165 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D KvmtoolPlatformPeiLib + +[Sources] + KvmtoolPlatformPeiLib.c + +[Packages] + ArmPkg/ArmPkg.dec + ArmVirtPkg/ArmVirtPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + DebugLib + HobLib + FdtLib + PcdLib + PeiServicesLib + +[FixedPcd] + gArmTokenSpaceGuid.PcdFvSize + gArmVirtTokenSpaceGuid.PcdDeviceTreeAllocationPadding + +[Pcd] + gArmTokenSpaceGuid.PcdFvBaseAddress + gArmVirtTokenSpaceGuid.PcdDeviceTreeInitialBaseAddress + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + +[Guids] + gFdtHobGuid + gEarly16550UartBaseAddressGuid + +[Depex] + gEfiPeiMemoryDiscoveredPpiGuid --=20 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#65867): https://edk2.groups.io/g/devel/message/65867 Mute This Topic: https://groups.io/mt/77270962/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-