From nobody Tue Feb 10 05:10:00 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+62143+1787277+3901457@groups.io; arc=fail (BodyHash is different from the expected one) Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1594126120116424.89037526561583; Tue, 7 Jul 2020 05:48:40 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 0VxZYY1788612x0PBms7i4YO; Tue, 07 Jul 2020 05:48:38 -0700 X-Received: from EUR04-VI1-obe.outbound.protection.outlook.com (EUR04-VI1-obe.outbound.protection.outlook.com [40.107.8.79]) by mx.groups.io with SMTP id smtpd.web10.15413.1594126116460352320 for ; Tue, 07 Jul 2020 05:48:36 -0700 X-Received: from AM5PR1001CA0027.EURPRD10.PROD.OUTLOOK.COM (2603:10a6:206:2::40) by HE1PR0801MB2059.eurprd08.prod.outlook.com (2603:10a6:3:53::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.24; Tue, 7 Jul 2020 12:48:32 +0000 X-Received: from VE1EUR03FT048.eop-EUR03.prod.protection.outlook.com (2603:10a6:206:2:cafe::8e) by AM5PR1001CA0027.outlook.office365.com (2603:10a6:206:2::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21 via Frontend Transport; Tue, 7 Jul 2020 12:48:32 +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=bestguesspass 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+62143+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 VE1EUR03FT048.mail.protection.outlook.com (10.152.19.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.24 via Frontend Transport; Tue, 7 Jul 2020 12:48:32 +0000 X-Received: ("Tessian outbound 2dd9eeca983c:v62"); Tue, 07 Jul 2020 12:48:31 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 6fa4c1e4cde77ab7 X-CR-MTA-TID: 64aa7808 X-Received: from 14480e58cb7a.1 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E9E7B11C-E7AF-4C04-B782-AA2F0A59DFBE.1; Tue, 07 Jul 2020 12:48:26 +0000 X-Received: from EUR04-HE1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 14480e58cb7a.1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Tue, 07 Jul 2020 12:48:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SZ+47i8RXobaV02mTh+s+fy3QC9kiH2sbuJuodgyuK5h/2GGcZJl1SC1Py8LF3PjDJCcUu9nWuZVF6gAFR3ofeYAU8vMK9WhDg2UJKI3ouT2Ra4pPN24lXcxG7UpykNxYDgmfD4d6q/lUe5Ak9+JxAomjw8PJizJEsTste0eqwrXOU6BOPh5DbkXO6Gp/bYxHY4bArm/kOUmdOslpnfMWyo3qAUVyCUNGUDl6giL3AV8kewcbkt0JpVZzTGeIVp4FrzZhKFQ4yM4wV5igsk2NJc/RQMVtSiMBURG8SzSQgWrhp8AGWyrTco/QAV2z1dM4jwQ+m9vdHapP4coLXk5+A== 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=SnCASzadBtCfGkblN5f57Eko0VQ2mJmmvYu1THWpOp8=; b=n0DyXRJhwMmocBcXyN+C9OaFJjPHRSUmcuI46WEhuh+yQg2rfYc6vgY2k3psREEjT4cFUUuSa7/eqJATNi2qqRictRx3euTp6FVCcNZnRO2lPikwIfD34gtVqH9LgSRvyhperhmR/WVN6SNadKPBqkJQaYALVJwxdLKxGurqzepQuHRvGbTwE0G6ZPYLBgOeAyBhL2+yz3+T9s+k8vl35sNoN+2wCmUY81+HZtCMoIqulOPgu3mWU2hEj6aSKipak0lu3sCMMLUgAfM0OV0cvoMV29W37fBQ+ehqmnS0rTY3mAoYCRNJRwZKzxaITjYpUIoICwtwQLnpg7FeLX2qGg== 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=bestguesspass action=none header.from=arm.com; dkim=none (message not signed); arc=none X-Received: from DB6PR0501CA0011.eurprd05.prod.outlook.com (2603:10a6:4:8f::21) by AM6PR08MB3173.eurprd08.prod.outlook.com (2603:10a6:209:4c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.21; Tue, 7 Jul 2020 12:48:24 +0000 X-Received: from DB5EUR03FT047.eop-EUR03.prod.protection.outlook.com (2603:10a6:4:8f:cafe::b8) by DB6PR0501CA0011.outlook.office365.com (2603:10a6:4:8f::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3153.22 via Frontend Transport; Tue, 7 Jul 2020 12:48: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=bestguesspass 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 DB5EUR03FT047.mail.protection.outlook.com (10.152.21.232) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.3153.24 via Frontend Transport; Tue, 7 Jul 2020 12:48:24 +0000 X-Received: from AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) by AZ-NEU-EX04.Arm.com (10.251.24.32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1415.2; Tue, 7 Jul 2020 12:48:23 +0000 X-Received: from AZ-NEU-EX03.Arm.com (10.251.24.31) by AZ-NEU-EX01.Emea.Arm.com (10.251.26.4) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1779.2; Tue, 7 Jul 2020 12:48:22 +0000 X-Received: from E107187.Arm.com (10.57.21.15) by mail.arm.com (10.251.24.31) with Microsoft SMTP Server id 15.1.1415.2 via Frontend Transport; Tue, 7 Jul 2020 12:48:21 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , , Subject: [edk2-devel] [PATCH v4 10/15] ArmVirtPkg: Add Kvmtool Platform Pei Lib Date: Tue, 7 Jul 2020 13:48:04 +0100 Message-ID: <20200707124810.50668-11-sami.mujawar@arm.com> In-Reply-To: <20200707124810.50668-1-sami.mujawar@arm.com> References: <20200707124810.50668-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-Office365-Filtering-HT: Tenant 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;SFTY:;SFS:(4636009)(346002)(136003)(376002)(396003)(39860400002)(46966005)(83380400001)(1076003)(8936002)(4326008)(8676002)(2906002)(86362001)(19627235002)(70586007)(6916009)(5660300002)(70206006)(47076004)(82310400002)(44832011)(6666004)(7696005)(2616005)(966005)(82740400003)(426003)(316002)(336012)(81166007)(478600001)(26005)(356005)(36756003)(54906003)(186003);DIR:OUT;SFP:1101; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b7abea69-3444-4a1d-0680-08d822740e3e X-MS-TrafficTypeDiagnostic: AM6PR08MB3173:|HE1PR0801MB2059: X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:2958;OLM:2958; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: +dyGU6t5Of/HfsWNLlb/jnmf/+9jHrWe9pMnpfMCzY++uZk25n9heWlqMQxrpYEWGYJqohmidAz1jJ+SyLLQey8Vd3m87oIrCugeVYeGeqEgJhk4R3AHs2Sw/rmZeBovjr8YIXK2s17L2f3xsnMD85UkJz8xKB3qsGLmTN8XrnMOFGjFsSzTsJF87qtyDtDFJaG6WMo00zpJum16SMPw1psR8z7hLpPIc2TUXK+0vVuKWiUKuXCt7cYUQlyJ1gK90575pw0Iu4VWWTRDi/lBXbGjgpMssHfQ7IA/S5M0dPw2ajuQ0R/3LUMZ23WCjBTpTis9QHBJY/PY7e4eV4pvK7saPqY81Cbn2RyXZ53hmLN3HAoa1SMyClbkqxZIrMWHf4UD+SivFD5LVZihsNx96cFWWH66JyhUY1hZisNMfNB78Q6Hufin6UqBR8RnU0VLoPRdVNo8868ILOZPJ8MIRrmSfsj1g//QneHOmwgoK5c= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB3173 X-MS-Exchange-Transport-CrossTenantHeadersStripped: VE1EUR03FT048.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: c158ed24-5c3d-419b-3936-08d8227409c5 X-Microsoft-Antispam-Message-Info: aEH2JJOcOmP8z+OAtrEh+3F7c2MZ2DIQF2cMn7XGbPkWauEOfOOmslXkqdZzybUh+kMK6vdgCz3i8E2GIDtzeXG/eDIlFMKzxuwtsJTs8Q15/O4Rk49Y/wgLRB6G66tjVMWQDp0JUBZMDQ7MVoFnEGEcK2xdfVsYs1iWwjnvq/qLqTbqRRu9MeaTVwJU5AQvgT5yx3MjDdxDYjaM4OvgafawN+pYJngXLqWzxJYPOZtF4WGc5nhDLIp4lEIdSMxyTPxTqg76ekcGgtRwKqqdVmuYTgeSGXkqfU3j+BBcTp7ir4LNjHBnGtB2SY2RHEgyUCX9HEVgnXbB23vTWMT4rqP5CE3Vt2JJVH6Bv/Syyt+lZHJwOk1MG8JxEJWumvpVUQ3EKxZKWYqbwzDP2m8vYTPkhLcymdNpxtY447Z5Kr/2+35qN8HBGja5oCNSFSLwFbFQ+fhvEJgFLTemBa+OhhwSF2ZIgYQwWpbKb4/S5CE= X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2020 12:48:32.2312 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b7abea69-3444-4a1d-0680-08d822740e3e 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: VE1EUR03FT048.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB2059 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: GqhEWqlidREUOW3mHLzb4QZxx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1594126118; bh=62jo0xYv2NbNh2IzUriyzoc2VtsHUEemyCFDIyV3xtg=; h=CC:Content-Type:Date:From:Reply-To:Subject:To; b=fKNzOVZn3j/BoU1NrFRfDK8HikIJlUXdbcvmKzO8/h9C9VdbD1eIjuxRk3BHyKyXDop J5vYwvY921Cmb8P6iggo13E3yoDvIVYmyDv3YBYpoSdD1UXuoGgSju328/G+izMKI0hiJ OjKB6pkJtdyiQAJDeSkWaPkwucezS1jXpQc= 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: v4: - No code change, resending patch with v4 series. [Sami] Ref: https://edk2.groups.io/g/devel/message/61722 ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.c | 78 ++= ++++++++++++++++++ ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.inf | 48 ++= ++++++++++ 2 files changed, 126 insertions(+) diff --git a/ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib= .c b/ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.c new file mode 100644 index 0000000000000000000000000000000000000000..a97b31537fbc8071eed030f912a= de60de3945356 --- /dev/null +++ b/ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.c @@ -0,0 +1,78 @@ +/** @file +* +* 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..9f44b8885d3c131de1d41ac6947= bd9218cfdf3e7 --- /dev/null +++ b/ArmVirtPkg/Library/KvmtoolPlatformPeiLib/KvmtoolPlatformPeiLib.inf @@ -0,0 +1,48 @@ +#/** @file +# +# 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 (#62143): https://edk2.groups.io/g/devel/message/62143 Mute This Topic: https://groups.io/mt/75354090/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-