From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR02-VE1-obe.outbound.protection.outlook.com (EUR02-VE1-obe.outbound.protection.outlook.com [40.107.2.55]) by mx.groups.io with SMTP id smtpd.web09.12192.1614604455686711341 for ; Mon, 01 Mar 2021 05:14:16 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=oVkZbzYW; spf=pass (domain: arm.com, ip: 40.107.2.55, mailfrom: sami.mujawar@arm.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y5g9tiUrTpDUosQ3wIFI5NzLZdfoZ8Zi7dIjrNFdFs8=; b=oVkZbzYWiqkSmK7Aj6t1zvuPZWrNfxqUI02rUHlekHZlVpCu18MFlK3EqywZ73ZjjcT+1JmH8RsgVrweYgEd+Fxvk64bT1pyJ9SPpEAfa+2IqxjkYtAiD8D7VW9Yur5e5Ps60v1O7MN26RuwGpAhrwXU05a3L6yPF7pCgBQrwio= Received: from AM5PR0502CA0009.eurprd05.prod.outlook.com (2603:10a6:203:91::19) by AM0PR08MB3796.eurprd08.prod.outlook.com (2603:10a6:208:100::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.23; Mon, 1 Mar 2021 13:14:08 +0000 Received: from AM5EUR03FT062.eop-EUR03.prod.protection.outlook.com (2603:10a6:203:91:cafe::b2) by AM5PR0502CA0009.outlook.office365.com (2603:10a6:203:91::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Mon, 1 Mar 2021 13:14:08 +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 (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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by AM5EUR03FT062.mail.protection.outlook.com (10.152.17.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.19 via Frontend Transport; Mon, 1 Mar 2021 13:14:07 +0000 Received: ("Tessian outbound f266f7758cfb:v71"); Mon, 01 Mar 2021 13:14:07 +0000 X-CR-MTA-TID: 64aa7808 Received: from 13570a744a70.3 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 067C940B-58F3-4214-AA76-A6AC09B9A4B2.1; Mon, 01 Mar 2021 13:14:02 +0000 Received: from EUR05-AM6-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id 13570a744a70.3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 01 Mar 2021 13:14:02 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Le0GQw18enNcv0wYEk4BnZFlxljU1V2uKFihsGGYfTHqt2rm9avpN+XwUlzZL/b+RUNbZ4f9o51T2gFvBIjwvqqHm9yk3MaxIeerZNIQm9TfmMjhLg9hKlY0B01TEiOCglTB5/j5mmIfavJEiFtbqM+gw+SSvtJBoWH6/igSq0gZ9Gecx/surEUiB1b0ICUqsnVxLsRSchmAU8oscsdyad5os13+GtZCqny7qbp6hvCnjG4tS7lCS/2d+HDfHz4B0iNxL1fW38mPNXK8cx65gyIopLNr9pLcEoZcaCi5spV6IjKuxU334zrDVwDNiUUA4iy+/s0fYsny6V7PUSRFDw== 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=y5g9tiUrTpDUosQ3wIFI5NzLZdfoZ8Zi7dIjrNFdFs8=; b=moAK10LrGn076mEQlmhPyhLELutAdo4JGXDGLoF4ivR9rQmtQjSEvYtKBcibK8XHm3v5GaS6/RbkM8GamgwzImLuTfdkEX+WoM3sAHt39kcH0i+mXTUHHDCbS77MudI2I3e7prkE5fLcuR5NXkGAgco5ZBHJ1hEdtSHC9Snj+GNDmfkMOeW0epk8Fedi0yYyNE+0Tn+q6Jb0KKSnYxjY0pJnNcL+tYbS2NTOCtZLTeKx7SrxhpYEfdeMcC/60xb1weIOSfC0f9nTK/CbV0JN5yZ5Nru3mQ4auIK003ELReow60FbdK9uHb9ObhpZtY8yWTGLoGBpQo9FgFJcUM2lDw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector2-armh-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=y5g9tiUrTpDUosQ3wIFI5NzLZdfoZ8Zi7dIjrNFdFs8=; b=oVkZbzYWiqkSmK7Aj6t1zvuPZWrNfxqUI02rUHlekHZlVpCu18MFlK3EqywZ73ZjjcT+1JmH8RsgVrweYgEd+Fxvk64bT1pyJ9SPpEAfa+2IqxjkYtAiD8D7VW9Yur5e5Ps60v1O7MN26RuwGpAhrwXU05a3L6yPF7pCgBQrwio= Received: from DB7PR08MB3097.eurprd08.prod.outlook.com (2603:10a6:5:1d::27) by DB9PR08MB6524.eurprd08.prod.outlook.com (2603:10a6:10:251::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3890.20; Mon, 1 Mar 2021 13:13:53 +0000 Received: from DB7PR08MB3097.eurprd08.prod.outlook.com ([fe80::8c43:eec3:76be:9001]) by DB7PR08MB3097.eurprd08.prod.outlook.com ([fe80::8c43:eec3:76be:9001%4]) with mapi id 15.20.3890.028; Mon, 1 Mar 2021 13:13:53 +0000 From: "Sami Mujawar" To: Chandni Cherukuri , "devel@edk2.groups.io" CC: Ard Biesheuvel , Leif Lindholm , nd Subject: Re: [edk2-platforms][PATCH V1 3/5] Platform/ARM/Morello: Add PlatformDxe driver for Morello Thread-Topic: [edk2-platforms][PATCH V1 3/5] Platform/ARM/Morello: Add PlatformDxe driver for Morello Thread-Index: AQHXCq7FmgnKgL/JVkaBc/hrHxMaC6pu/w5w Date: Mon, 1 Mar 2021 13:13:53 +0000 Message-ID: References: <20210224131224.11481-1-chandni.cherukuri@arm.com> <20210224131224.11481-4-chandni.cherukuri@arm.com> In-Reply-To: <20210224131224.11481-4-chandni.cherukuri@arm.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ts-tracking-id: 1B05068C88D91E46805EDDFB6075E7B8.0 x-checkrecipientchecked: true Authentication-Results-Original: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; x-originating-ip: [217.140.106.53] x-ms-publictraffictype: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: b86c7cc5-bc2d-40d3-b514-08d8dcb3e580 x-ms-traffictypediagnostic: DB9PR08MB6524:|AM0PR08MB3796: x-ms-exchange-transport-forked: True X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true nodisclaimer: true x-ms-oob-tlc-oobclassifiers: OLM:5797;OLM:5797; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: oEzHmBN+lYGZNnSgl93ZCNrx+s48Zc3XDF0TytPgQLsOcYtBVIX7QKJB9bHW/G5t2YPzseV4204bWQN1UAEXEVbxaWb5ia8tNSljJDupCt1diTr8iXWZBIFcgLiel4EM4lZY2fwTEzuYZfT7YvVujUjM7auwQrWSCRtvMYdCDPz/GSGhZIT1zMR/fD9m3nVxh2fyNEmNJlz0aelVgsl/CRAdfGlrLNnHSdF8KBlhKpBAEefQW3nOchsbiZ7oqedinQaTzQ+HV4iaqQtfZdSQ7gkVwfCj3vGKLNcrDW0/EZRmqNvsMBOpfHxxInKUQHem6ZXI74ao4xYJmXcAlcwXtoW4pT+d4ymo+Vg7iPQj9U/ruApnAfjEWJcgEPMT8aStwo9hHxIZE9AyZ/srJNRvA4jwk0OtLjr4jsOI3nAatF6QU3jHldwWv89LywaGUMSOWTi7gerE2TurA1yB2CmmxSV8i6wRoG9Aah6BwxZXlCvmnph7kfqtWn99YjUXYK7RzXFtO3azh88AzoheERaqzg== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR08MB3097.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(346002)(366004)(376002)(136003)(396003)(7696005)(6506007)(5660300002)(76116006)(54906003)(8676002)(66946007)(53546011)(478600001)(33656002)(66446008)(66556008)(66476007)(64756008)(26005)(110136005)(8936002)(83380400001)(4326008)(2906002)(316002)(71200400001)(86362001)(52536014)(186003)(9686003)(55016002);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?kQ13JRoKxpVg8oGW44EyDfTCWgRNGGT6h7JxAG+TeSF3BtWudaixqGlS1IFO?= =?us-ascii?Q?HUwYA1X2yYmKJmzJZO2zL1dbzm0p39k4SKx5jEW1/XUAyHkXNtYkHwqIk2M6?= =?us-ascii?Q?Z3LNe5ugUFjy+Kf7YfU5bwXxiT5d1ZPRMuhG5VkAwLoHqF2JequDxsby5/qa?= =?us-ascii?Q?IHQ17rkxR1JNHRUe8W3gr6HzGuoBsUdTjglmZrdeV9jHZpv4CiQI4NrXrjM1?= =?us-ascii?Q?suxIwpFvVsEZM+BKwrf0txVDN6k+Cer3mpb0e0Xl35rd0LP+vroAoxIYcTcZ?= =?us-ascii?Q?00EYMQzIpZ32XW1mRBZaBbX2eyk9kxbM2FI1Pg9Pm66m6l6+Gu0WyHv4Bb62?= =?us-ascii?Q?9fNpdopmdkrJFXhVOezV49RojOSsk3+4d5YRntS16hH7/W+Yb/HmqVkk+tsX?= =?us-ascii?Q?HMQDLy3KAp51uFLRnY81CDqCihMI7mq/Qm1WGsap1wzaDW6bMx6xhQP16luC?= =?us-ascii?Q?+PqIe5JUPjezLi7WEKE3GPL2ZgP5R3GoAOoqxp+bKflQthqxTf9/KoAzPRix?= =?us-ascii?Q?o+risuVxdoKKhRs0E33uG03MG7gnU8oDs7ogASrZgn/LjEFduSWlmQDBWSBN?= =?us-ascii?Q?PING8GMTTbdEyWkr+5sg9ehrZZphmzNNpvlnA+M03uP9h2VgjuSVnVcOzcMc?= =?us-ascii?Q?Rer0zDqzV9OK5tgptZ+Smagn5CYRf3b2QIP456q7RnctI1Z6yBF9KATm7cdq?= =?us-ascii?Q?5m5W8Y8plod6kNEiyKmI6JhYd1iKU7Qc0dIoG71ebtwRpL4QdZ8tD3WyHARe?= =?us-ascii?Q?+5gL7xgSCkf9NpUNQAMM5u2knmh6mp8di7JutQzk2BU6FEzzogxTk5Sktv0S?= =?us-ascii?Q?zii2eWWZn/xSTklmAk6jTj5LoEQ5xJu0Jb37XEG57qEJDRE6pcpqJpQXxHqk?= =?us-ascii?Q?OHBgqRWAXhbWwuTIdyyacQm11xD+DRoOBRyETSFvX7yAVgsvK076ULaBMI8b?= =?us-ascii?Q?nReTxa3t26kyNSzmwDFubiRi0SH2o9bRz2v9WDZ3wsMgfTkMfbzYw9W8MBTG?= =?us-ascii?Q?Bqwqwc99tInpAnK9tXLa68Qc1rJENHexsXs9ql9cowEMjwt2Lx4FAPA/svzz?= =?us-ascii?Q?SoZMkrjpL7/Zd8kk7f28Qt6pV/EjqLIMT2/PHO6uoCIqHYtwRHBZv6N9Rzq6?= =?us-ascii?Q?OOr7RY6fLwrzaKy70VUVEpS4JAIpCSNeqTLzzW1pAO2OXhPesfeH0aakpff2?= =?us-ascii?Q?um8RH8t8VAuKAwNQ6XOQxoRHHf+pLqsyHjgo52vceQl0Ic9uvj8lb1waFtkk?= =?us-ascii?Q?TRAy5Oq37pru31X+SrDt0SxAfCRB+3uXryUSEvTVGTuCE/EpNsYRqATubggG?= =?us-ascii?Q?dkWpwyPUsxeoRep7/1TBFzKK?= MIME-Version: 1.0 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR08MB6524 Original-Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: AM5EUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-Office365-Filtering-Correlation-Id-Prvs: 7634a0c8-007d-4968-91c4-08d8dcb3dd07 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bLTcXfwJ066yYbG8ZfBZ4Rgr/ZlMgkNDO374ZXKYUUyCsb6iPSTe8c6XtLdN6SyIKv5sB5L3bkWm3EGtftGkjO+WIpxZUVuQzt9flzt9a6tJzwSvZ8WsW7B2rI622wc4Wsz5plPoVGf7mmOENs6wRzZxGKx4xnH+V88+bt9m3PadklttCXc/3ex3TR7jzcTCncec1rsoRYdMTIyVJb14PpqYO0ZuXc+MK5HmIfrDyJxKcjcdAVLsLTVoLFxImRPQQoGOASB+Ofz6N5Ek0UrrZ0ZEsnVG6FFxJG9HuYMwmmf6Z2Yr/3GbFTv4vH6PxvonMhJL4asXu1XDKWwMf/A5ylKGrVH8ShJWJ+Ip55gyTc2kfz+94Puabncz6FU7/kd5dkpBHD2cEd9A1ZJcg5KHCPjS7GGo3IvLrgW2wJV82goXNPf1p1xHCE+4cNUMvNg+WUeU8ad40OeliF4PvJ6jVMYqdaWJDQd5nHS1xI3K//EOOoiAj92LdVXCkxMXLA6/aZ3STWcjrt5l3Bsw+myuQCOLxv+vogeoyvBMEQcc8ZklEDyqQL18RbmRpvECscx0fKRJ0ryDKW5q/o7UVTw9WJAm/yEU5H2RqUUMYFVHuQNQnCQ429RC7mJE/CtiCtl4V/nPZ9JOJZHvwgCmc3gLPVjM7lR7entEJC8xPGOnGn8= X-Forefront-Antispam-Report: CIP:63.35.35.123;CTRY:IE;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:64aa7808-outbound-1.mta.getcheckrecipient.com;PTR:ec2-63-35-35-123.eu-west-1.compute.amazonaws.com;CAT:NONE;SFS:(4636009)(346002)(136003)(39860400002)(376002)(396003)(36840700001)(46966006)(52536014)(7696005)(33656002)(82310400003)(356005)(186003)(70586007)(70206006)(81166007)(86362001)(54906003)(36860700001)(316002)(82740400003)(55016002)(2906002)(83380400001)(110136005)(336012)(8676002)(26005)(9686003)(6506007)(4326008)(5660300002)(478600001)(8936002)(47076005)(53546011);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Mar 2021 13:14:07.9899 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b86c7cc5-bc2d-40d3-b514-08d8dcb3e580 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: AM5EUR03FT062.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3796 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Chandni, Please find my response inline marked [SAMI]. Regards, Sami Mujawar -----Original Message----- From: Chandni Cherukuri =20 Sent: 24 February 2021 01:12 PM To: devel@edk2.groups.io Cc: Ard Biesheuvel ; Leif Lindholm ; Sami Mujawar Subject: [edk2-platforms][PATCH V1 3/5] Platform/ARM/Morello: Add PlatformD= xe driver for Morello From: Anurag Koul This patch adds the PlatformDxe Driver for Morello platform. It includes the registration of the ramdisk device. Co-authored-by: Chandni Cherukuri Signed-off-by: Chandni Cherukuri --- Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeFvp.inf | 43 +++++= ++++ Platform/ARM/Morello/Include/Guid/MorelloVirtioDevicesFormSet.h | 14 +++ Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeFvp.c | 58 +++++= ++++++++ Platform/ARM/Morello/Drivers/PlatformDxe/VirtioDevices.c | 91 +++++= +++++++++++++++ 4 files changed, 206 insertions(+) diff --git a/Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeFvp.inf b/= Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeFvp.inf new file mode 100644 index 000000000000..69df9019cde3 --- /dev/null +++ b/Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeFvp.inf @@ -0,0 +1,43 @@ +## @file +# +# Copyright (c) 2021, ARM Limited. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION =3D 0x0001001A + BASE_NAME =3D PlatformDxe + FILE_GUID =3D 11FC8B5A-377D-47A8-AEE9-0093D3D3407F + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D ArmMorelloEntryPoint + +[Sources.common] + PlatformDxeFvp.c + VirtioDevices.c + +[Packages] + MdePkg/MdePkg.dec + OvmfPkg/OvmfPkg.dec + Platform/ARM/Morello/MorelloPlatform.dec + +[LibraryClasses] + UefiDriverEntryPoint + VirtioMmioDeviceLib + +[Protocols] + gEfiRamDiskProtocolGuid + +[FeaturePcd] + gArmMorelloTokenSpaceGuid.PcdRamDiskSupported + gArmMorelloTokenSpaceGuid.PcdVirtioBlkSupported + +[FixedPcd] + gArmMorelloTokenSpaceGuid.PcdRamDiskBase + gArmMorelloTokenSpaceGuid.PcdRamDiskSize + gArmMorelloTokenSpaceGuid.PcdVirtioBlkBaseAddress + +[Depex] + gEfiRamDiskProtocolGuid diff --git a/Platform/ARM/Morello/Include/Guid/MorelloVirtioDevicesFormSet.= h b/Platform/ARM/Morello/Include/Guid/MorelloVirtioDevicesFormSet.h new file mode 100644 index 000000000000..27ae61bb1cf5 --- /dev/null +++ b/Platform/ARM/Morello/Include/Guid/MorelloVirtioDevicesFormSet.h @@ -0,0 +1,14 @@ +/** @file + + Copyright (c) 2021, ARM Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#ifndef MORELLO_VIRTIO_DEVICES_FORMSET_H__ +#define MORELLO_VIRTIO_DEVICES_FORMSET_H__ + +#define MORELLO_VIRTIO_BLOCK_GUID \ + { 0x2B6E62D0, 0x9346, 0x4E1A, { 0xAA, 0x1E, 0xCB, 0x01, 0xC3, 0x23, 0x4A= , 0x00 } } + +#endif diff --git a/Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeFvp.c b/Pl= atform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeFvp.c new file mode 100644 index 000000000000..ff99c16b2c9a --- /dev/null +++ b/Platform/ARM/Morello/Drivers/PlatformDxe/PlatformDxeFvp.c @@ -0,0 +1,58 @@ +/** @file + + Copyright (c) 2021, ARM Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include + +VOID +InitVirtioDevices ( + VOID + ); + +EFI_STATUS +EFIAPI +ArmMorelloEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_RAM_DISK_PROTOCOL *RamDisk; + EFI_DEVICE_PATH_PROTOCOL *DevicePath; + + Status =3D EFI_SUCCESS; + + InitVirtioDevices (); + + if (FeaturePcdGet (PcdRamDiskSupported)) { + Status =3D gBS->LocateProtocol ( + &gEfiRamDiskProtocolGuid, + NULL, + (VOID**)&RamDisk + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "Couldn't find the RAM Disk protocol %r\n", + __FUNCTION__, Status)); + return Status; + } + + Status =3D RamDisk->Register ( + (UINTN)PcdGet32 (PcdRamDiskBase), + (UINTN)PcdGet32 (PcdRamDiskSize), + &gEfiVirtualCdGuid, + NULL, + &DevicePath + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to register RAM Disk - %r\n", + __FUNCTION__, Status)); + } + } + + return Status; +} diff --git a/Platform/ARM/Morello/Drivers/PlatformDxe/VirtioDevices.c b/Pla= tform/ARM/Morello/Drivers/PlatformDxe/VirtioDevices.c new file mode 100644 index 000000000000..a83a4e71a47e --- /dev/null +++ b/Platform/ARM/Morello/Drivers/PlatformDxe/VirtioDevices.c @@ -0,0 +1,91 @@ +/** @file + + Copyright (c) 2021, ARM Limited. All rights reserved.
+ + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include +#include +#include +#include + +#pragma pack (1) +typedef struct { + VENDOR_DEVICE_PATH VendorDevicePath; + EFI_DEVICE_PATH_PROTOCOL End; +} VIRTIO_DEVICE_PATH; +#pragma pack () + +STATIC VIRTIO_DEVICE_PATH mVirtioBlockDevicePath =3D +{ + { + { + HARDWARE_DEVICE_PATH, + HW_VENDOR_DP, + { + (UINT8)(sizeof (VENDOR_DEVICE_PATH)), + (UINT8)((sizeof (VENDOR_DEVICE_PATH)) >> 8) + } + }, + MORELLO_VIRTIO_BLOCK_GUID, + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + sizeof (EFI_DEVICE_PATH_PROTOCOL), + 0 + } + } +}; + +// +// Initialize platform Virtio devices. +// +// @return None. +// +VOID +InitVirtioDevices ( + VOID + ) [SAMI] Use doxygen style function documentation headers. [/SAMI] +{ + EFI_STATUS Status; + STATIC EFI_HANDLE mVirtIoBlkController =3D NULL; [SAMI] Why is this variable static? [/SAMI] + + Status =3D EFI_SUCCESS; [SAMI] Is this needed? Should this function return the Status code? [/SAMI] + + // Install protocol interface for storage device + if (FeaturePcdGet (PcdVirtioBlkSupported)) { + + Status =3D gBS->InstallProtocolInterface ( + &mVirtIoBlkController, + &gEfiDevicePathProtocolGuid, + EFI_NATIVE_INTERFACE, + &mVirtioBlockDevicePath + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Failed to install EFI_DEVICE_PATH protocol= " + "for Virtio Block device (Status =3D %r)\n", + __FUNCTION__, Status)); + } else { + // Declare the Virtio BlockIo device + Status =3D VirtioMmioInstallDevice ( + FixedPcdGet32 (PcdVirtioBlkBaseAddress), + mVirtIoBlkController + ); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: Unable to find Virtio Block MMIO device = " + "(Status =3D=3D %r)\n", __FUNCTION__, Status)); + gBS->UninstallProtocolInterface ( + mVirtIoBlkController, + &gEfiDevicePathProtocolGuid, + &mVirtioBlockDevicePath + ); + } else { + DEBUG ((DEBUG_INIT, "%a: Installed Virtio Block device\n", + __FUNCTION__)); + } + } + } +} --=20 2.17.1