From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail03.groups.io (mail03.groups.io [45.79.227.220]) by spool.mail.gandi.net (Postfix) with ESMTPS id 973BF7803CC for ; Fri, 12 Apr 2024 14:33:57 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=nuQ3fsFRzRoNIQsy+3oPl9yeqydX64kkHhmuZTeBpdE=; c=relaxed/simple; d=groups.io; h=Received-SPF:Received-SPF:From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:NoDisclaimer:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type; s=20240206; t=1712932436; v=1; b=33K7mkshtkvaU3Ifvh0jMPiCbq3gKF/r6Ftv+ojmsSnF2J5nhMMproM29hrVEjlqnk3WhRdV 1rs+PHtOP49FcVN+7xVRB5HqyLjPzkLOgLGN4SDvjwdNt4J1p404vn0fvG9gkZrwkt3RK4rmRUB hywNpGywLLnzet4pn7F23mV+inaY+rVbea4cbXzTwthSBPU9CkfUSNvbTONBFQIuHatt0OAMJYj A8t+hggn4NA3d0I6Q4bhJ0WHlMTlZDCV3cCq9/H0Q8JFshyjCakOjYXcXjW2/CRPCQXcg8stZJz YDwrGSO5Qo7IgmudrIBxlJDI9krJrsbTBJXY7xfaZpmwQ== X-Received: by 127.0.0.2 with SMTP id HrGJYY7687511xF0okFZLwQs; Fri, 12 Apr 2024 07:33:56 -0700 X-Received: from EUR02-VI1-obe.outbound.protection.outlook.com (EUR02-VI1-obe.outbound.protection.outlook.com [40.107.241.77]) by mx.groups.io with SMTP id smtpd.web10.48537.1712932431834132926 for ; Fri, 12 Apr 2024 07:33:52 -0700 X-Received: from DU2PR04CA0183.eurprd04.prod.outlook.com (2603:10a6:10:28d::8) by GV1PR08MB10501.eurprd08.prod.outlook.com (2603:10a6:150:163::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.56; Fri, 12 Apr 2024 14:33:40 +0000 X-Received: from DU2PEPF00028D0D.eurprd03.prod.outlook.com (2603:10a6:10:28d:cafe::d7) by DU2PR04CA0183.outlook.office365.com (2603:10a6:10:28d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46 via Frontend Transport; Fri, 12 Apr 2024 14:33:40 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com;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; pr=C X-Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DU2PEPF00028D0D.mail.protection.outlook.com (10.167.242.21) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.7452.22 via Frontend Transport; Fri, 12 Apr 2024 14:33:40 +0000 X-Received: ("Tessian outbound caed45120527:v313"); Fri, 12 Apr 2024 14:33:39 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 142ff0f4c4af1262 X-CR-MTA-TID: 64aa7808 X-Received: from af689c03d69c.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id 83BC3A0E-879E-443B-915A-9C98C3A3070D.1; Fri, 12 Apr 2024 14:33:33 +0000 X-Received: from EUR05-VI1-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id af689c03d69c.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Fri, 12 Apr 2024 14:33:33 +0000 X-Received: from DB6PR0301CA0077.eurprd03.prod.outlook.com (2603:10a6:6:30::24) by DU0PR08MB7565.eurprd08.prod.outlook.com (2603:10a6:10:316::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Fri, 12 Apr 2024 14:33:29 +0000 X-Received: from DU2PEPF00028CFF.eurprd03.prod.outlook.com (2603:10a6:6:30:cafe::c5) by DB6PR0301CA0077.outlook.office365.com (2603:10a6:6:30::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.26 via Frontend Transport; Fri, 12 Apr 2024 14:33:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 40.67.248.234) smtp.mailfrom=arm.com; dkim=none (message not signed) header.d=none;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; pr=C X-Received: from nebula.arm.com (40.67.248.234) by DU2PEPF00028CFF.mail.protection.outlook.com (10.167.242.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7452.22 via Frontend Transport; Fri, 12 Apr 2024 14:33:29 +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.2507.35; Fri, 12 Apr 2024 14:33:26 +0000 X-Received: from E114225.Arm.com (10.1.196.56) by mail.arm.com (10.251.24.32) with Microsoft SMTP Server id 15.1.2507.35 via Frontend Transport; Fri, 12 Apr 2024 14:33:26 +0000 From: "Sami Mujawar" To: CC: Sami Mujawar , , , , , , , Subject: [edk2-devel] [PATCH v2 04/45] ArmVirtPkg: Add Arm CCA Realm Service Interface Library Date: Fri, 12 Apr 2024 15:32:41 +0100 Message-ID: <20240412143322.5244-5-sami.mujawar@arm.com> In-Reply-To: <20240412143322.5244-1-sami.mujawar@arm.com> References: <20240412143322.5244-1-sami.mujawar@arm.com> MIME-Version: 1.0 X-EOPAttributedMessage: 1 X-MS-TrafficTypeDiagnostic: DU2PEPF00028CFF:EE_|DU0PR08MB7565:EE_|DU2PEPF00028D0D:EE_|GV1PR08MB10501:EE_ X-MS-Office365-Filtering-Correlation-Id: 8569562d-2e32-4a0c-3329-08dc5afd8c03 x-checkrecipientrouted: true NoDisclaimer: true X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: ibxnj8IjIUtvPPhczDDfeRsNh/mHJ7Zotvs7JrcOzvS9XuAeh/DRTKzusQa6taL8KWJMzWZHgANHpfqvtIRakMWZzOLIfrOqxBz+5U2E8QH+s+UGvFWeMvtflUE8pCQDt4xW+TdtnOGnN/jTs91lJCT4O+Skc/wa97HZJv8spzM8a2ZN7yy86nPnwD/EsgHGSWg+fvModcAyqBF4XmUvxWG/vbWnOrZfF2unXHAQHhCfPwSI/2BtFrsb048W3UmXxUvgoGsjCefKzwY8MIuWFwdbiUwG10neBF+anPPTslYYoM16gNnQppMPGvqRH5ImTBbvN8vpMpEbE6Q9I73xHJOM1FiBLi/53dYvLy9hfYHrifVp7PnGbrzIhHc4YFKbEKg+vPTakPr3l4rK0U3uT7Hv9szASJ7M5UGIq9eJjTvD0O0q7uealKc6ooGILC1qbYtZmjSR6LAzCNelK93DdvZ2sdzz1u2ORip7HARGEg6H+en9oMCKYCQveUqYViAGA66ozR/5Jkm5dBQqG7i1zhse3vxHFbP9p1hXE+IZPldgSB48Dk5WSfKL9COLfSunM55dSiyhVht/vebOxm445wC9vksXHFeLawvDjczeEnqc8fquE7f55sqM3BjFuNc6aazkpsro4kGI3RRhvGNvH9UF/3cUBR3lgjlKnObmoBW5vRe44hEjehB7JxXmMGKAteNh4Uml7Haqe4ZXFvAY9hO0TUzdeEhUC3eqK4zDXjjEUE2XvVf5uZuHP7btP2bN 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:(13230031)(82310400014)(376005)(1800799015)(36860700004);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB7565 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DU2PEPF00028D0D.eurprd03.prod.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: fb0fadf7-c3c5-4f75-91ac-08dc5afd85d5 X-Microsoft-Antispam-Message-Info: K+6ZoUAQ7s6+ST9L4HzXTD721QYPLpvzpfnSTg+m04tkZqxx4hysx/QN7zil4gG/pstvRhtRaLjrFRhRNJ2V7w8QamJtX+ZfWFM5jbgjB+hyqqCTAdfXHy6+nnOSKDRYfC8FRhO65D4lAtLpU/LAzgU14HdzGhA/WXHxF6Vos2DPpKJxRrQhHRx/q5YbivwBN4+W/XdhPRyCzVY4+MsmO4CJkOti1TEFUnmxcLCwFVNlzWyOPjkn4UCZM+K8EP4Kl4THYDo5GzeLQPBLoRshM2kWtPtTTk8VoKVcI7V7QyQ84pbevuhMhSvbug4Vz2XMkly07gqEJrb4nHmW1hynXs7uz8+KNn6aAcWzmiQLtgK6KX/va8HkdrQFWySg3UvzRI36aSKp655h7fXIa0S2mvrCIJhiPVdYtlTTDNGuBQQTLxPK8Ay/JP8CSIhWu1BlXaX3rYepZGOILXwes2pBIvNBFsIRIr200fKnmO4eC/6uvlnX5YFtR+4/aONKxN5TlTKDl2LqmaJa+i2dgnjK/7Y3BjocdBg7igv01dN6yMIHQkTfKRUwtHKCV0l85uuNjwe3lO3ijUZvla0n8ErcFO8coArG0eZDFr972l8pCtDRMP8R1t7ZsSfoUJpoE4yJzFvwwlzb/gOdxvNp7NvrZ8H2XpERn9AS2clj6W0OWZR2FgtS2QXxgmqyjlWEEUA7YThY0vAkNdSuxeCfNB/t98E5N7UDSrYj/Raqsi1ROQmnOwA7glQ8M8eK3jIVuPNy X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Apr 2024 14:33:40.1232 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8569562d-2e32-4a0c-3329-08dc5afd8c03 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: DU2PEPF00028D0D.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR08MB10501 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Fri, 12 Apr 2024 07:33:52 -0700 Resent-From: sami.mujawar@arm.com Reply-To: devel@edk2.groups.io,sami.mujawar@arm.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: yYtQZh4ZQYzaZ1Kk2MyOkLNgx7686176AA= Content-Type: text/plain X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b=33K7mksh; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=arm.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.227.220 as permitted sender) smtp.mailfrom=bounce@groups.io The Realm Management Monitor (RMM) is a software component which forms part of a system which implements the Arm Confidential Compute Architecture (CCA) and is responsible for management of Realms. The RMM specification defines a Realm Service Interface (RSI) that the Guest can use to request services from the RMM. Therefore, add a library that implements the RSI interfaces to: - query the RSI version - get the Realm configuration. Cc: Ard Biesheuvel Cc: Leif Lindholm Cc: Gerd Hoffmann Signed-off-by: Sami Mujawar --- ArmVirtPkg/ArmVirtPkg.dec | 1 + ArmVirtPkg/Include/Library/ArmCcaRsiLib.h | 72 ++++++++++ ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsi.h | 40 ++++++ ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c | 145 ++++++++++++++++++++ ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.inf | 29 ++++ 5 files changed, 287 insertions(+) diff --git a/ArmVirtPkg/ArmVirtPkg.dec b/ArmVirtPkg/ArmVirtPkg.dec index 6aa5ea05f4e9bfc7aa17d40777dda916ccc82798..d92cb52fc30a6f0ee3469fbd2a940f88e9cf2c67 100644 --- a/ArmVirtPkg/ArmVirtPkg.dec +++ b/ArmVirtPkg/ArmVirtPkg.dec @@ -26,6 +26,7 @@ [Includes.common] Include # Root include for the package [LibraryClasses] + ArmCcaRsiLib|Include/Library/ArmCcaRsiLib.h ArmVirtMemInfoLib|Include/Library/ArmVirtMemInfoLib.h [Guids.common] diff --git a/ArmVirtPkg/Include/Library/ArmCcaRsiLib.h b/ArmVirtPkg/Include/Library/ArmCcaRsiLib.h new file mode 100644 index 0000000000000000000000000000000000000000..ab70240b3ab2979996f20190ddf669b53183556b --- /dev/null +++ b/ArmVirtPkg/Include/Library/ArmCcaRsiLib.h @@ -0,0 +1,72 @@ +/** @file + Library that implements the Arm CCA Realm Service Interface calls. + + Copyright (c) 2022 - 2023, Arm Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + + - Rsi or RSI - Realm Service Interface + - IPA - Intermediate Physical Address + + @par Reference(s): + - Realm Management Monitor (RMM) Specification, version A-bet0 + (https://developer.arm.com/documentation/den0137/) +**/ + +#ifndef ARM_CCA_RSI_LIB_ +#define ARM_CCA_RSI_LIB_ + +#include + +/** + A macro defining the size of a Realm Granule. + See Section A2.2, RMM Specification, version A-bet0 + DNBXXX A Granule is a unit of physical memory whose size is 4KB. +*/ +#define REALM_GRANULE_SIZE SIZE_4KB + +/** A structure describing the Realm Configuration. + See Section B4.4.4 RsiRealmConfig type, RMM Specification, version A-bet0 + The width of the RsiRealmConfig structure is 4096 (0x1000) bytes. +*/ +typedef struct RealmConfig { + // Width of IPA in bits. + UINT64 IpaWidth; + // Unused bits of the RsiRealmConfig structure should be zero. + UINT8 Reserved[SIZE_4KB - sizeof (UINT64)]; +} REALM_CONFIG; + +/** + Read the Realm Configuration. + + @param [out] Config Pointer to the address of the buffer to retrieve + the Realm configuration. + + Note: The buffer to retrieve the Realm configuration must be aligned to the + Realm granule size. + + @retval RETURN_SUCCESS Success. + @retval RETURN_INVALID_PARAMETER A parameter is invalid. +**/ +RETURN_STATUS +EFIAPI +RsiGetRealmConfig ( + IN REALM_CONFIG *Config + ); + +/** + Get the version of the RSI implementation. + + @param [out] Major The major version of the RSI implementation. + @param [out] Minor The minor version of the RSI implementation. + + @retval RETURN_SUCCESS Success. + @retval RETURN_INVALID_PARAMETER A parameter is invalid. + */ +RETURN_STATUS +EFIAPI +RsiGetVersion ( + OUT UINT16 *CONST Major, + OUT UINT16 *CONST Minor + ); + +#endif // ARM_CCA_RSI_LIB_ diff --git a/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsi.h b/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsi.h new file mode 100644 index 0000000000000000000000000000000000000000..90e9dbb609679c82cd8e8ee8081428fd97021f97 --- /dev/null +++ b/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsi.h @@ -0,0 +1,40 @@ +/** @file + Definitions for Arm CCA Realm Service Interface. + + Copyright (c) 2022 - 2023, ARM Ltd. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Glossary: + - Rsi or RSI - Realm Service Interface + - IPA - Intermediate Physical Address + + @par Reference(s): + - Realm Management Monitor (RMM) Specification, version A-bet0 + (https://developer.arm.com/documentation/den0137/) +**/ + +#ifndef ARM_CCA_RSI_H_ +#define ARM_CCA_RSI_H_ + +// FIDs for Realm Service Interface calls. +#define FID_RSI_REALM_CONFIG 0xC4000196 +#define FID_RSI_VERSION 0xC4000190 + +/** RSI Command Return codes + See Section B4.4.1, RMM Specification, version A-bet0. + The width of the RsiCommandReturnCode enumeration is 64 bits. +*/ +#define RSI_SUCCESS 0ULL +#define RSI_ERROR_INPUT 1ULL +#define RSI_ERROR_STATE 2ULL +#define RSI_INCOMPLETE 3ULL + +/** RSI interface Version + See Section B4.4.3, RMM Specification, version A-bet0. + The width of the RsiInterfaceVersion fieldset is 64 bits. +*/ +#define RSI_VER_MINOR_MASK 0x00FFULL +#define RSI_VER_MAJOR_MASK 0x7F00ULL +#define RSI_VER_MAJOR_SHIFT 16 + +#endif // ARM_CCA_RSI_H_ diff --git a/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c b/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c new file mode 100644 index 0000000000000000000000000000000000000000..42b99fb7a71c8b38512a2f7472f9bc8a034fe1e9 --- /dev/null +++ b/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.c @@ -0,0 +1,145 @@ +/** @file + Library that implements the Arm CCA Realm Service Interface calls. + + Copyright (c) 2022 - 2023, Arm Limited. All rights reserved.
+ SPDX-License-Identifier: BSD-2-Clause-Patent + + @par Glossary: + - Rsi or RSI - Realm Service Interface + - IPA - Intermediate Physical Address + + @par Reference(s): + - Realm Management Monitor (RMM) Specification, version A-bet0 + (https://developer.arm.com/documentation/den0137/) + +**/ +#include + +#include +#include +#include +#include +#include +#include "ArmCcaRsi.h" + +/** + Convert the RSI status code to EFI Status code. + + @param [in] RsiCommandReturnCode RSI status code. + + @retval RETURN_SUCCESS Success. + @retval RETURN_INVALID_PARAMETER A parameter is invalid. + @retval RETURN_ABORTED The operation was aborted as the state + of the Realm or REC does not match the + state expected by the command. + @retval RETURN_NOT_READY The operation requested by the command + is not complete. + **/ +STATIC +RETURN_STATUS +RsiCmdStatusToEfiStatus ( + IN UINT64 RsiCommandReturnCode + ) +{ + switch (RsiCommandReturnCode) { + case RSI_SUCCESS: + return RETURN_SUCCESS; + case RSI_ERROR_INPUT: + return RETURN_INVALID_PARAMETER; + case RSI_ERROR_STATE: + return RETURN_ABORTED; + case RSI_INCOMPLETE: + return RETURN_NOT_READY; + default: + // Unknown error code. + ASSERT (0); + break; + } // switch + + return RETURN_ABORTED; +} + +/** + Check if the address is aligned to the size of the Realm granule. + + @param [in] Address Address to check granule alignment. + + @retval TRUE Address is aligned to the Realm granule size. + @retval FALSE Address is not aligned to the Realm granule size. +**/ +STATIC +BOOLEAN +EFIAPI +AddrIsGranuleAligned ( + IN UINT64 *Address + ) +{ + if (((UINT64)Address & (REALM_GRANULE_SIZE - 1)) != 0) { + return FALSE; + } + + return TRUE; +} + +/** + Read the Realm Configuration. + + @param [out] Config Pointer to the address of the buffer to retrieve + the Realm configuration. + + Note: The buffer to retrieve the Realm configuration must be aligned to the + Realm granule size. + + @retval RETURN_SUCCESS Success. + @retval RETURN_INVALID_PARAMETER A parameter is invalid. +**/ +RETURN_STATUS +EFIAPI +RsiGetRealmConfig ( + OUT REALM_CONFIG *Config + ) +{ + ARM_SMC_ARGS SmcCmd; + + if ((Config == NULL) || (!AddrIsGranuleAligned ((UINT64 *)Config))) { + return RETURN_INVALID_PARAMETER; + } + + ZeroMem (&SmcCmd, sizeof (SmcCmd)); + SmcCmd.Arg0 = FID_RSI_REALM_CONFIG; + SmcCmd.Arg1 = (UINTN)Config; + + ArmCallSmc (&SmcCmd); + return RsiCmdStatusToEfiStatus (SmcCmd.Arg0); +} + +/** + Get the version of the RSI implementation. + + @param [out] Major The major version of the RSI implementation. + @param [out] Minor The minor version of the RSI implementation. + + @retval RETURN_SUCCESS Success. + @retval RETURN_INVALID_PARAMETER A parameter is invalid. + */ +RETURN_STATUS +EFIAPI +RsiGetVersion ( + OUT UINT16 *CONST Major, + OUT UINT16 *CONST Minor + ) +{ + ARM_SMC_ARGS SmcCmd; + + if ((Major == NULL) || (Minor == NULL)) { + return EFI_INVALID_PARAMETER; + } + + ZeroMem (&SmcCmd, sizeof (SmcCmd)); + SmcCmd.Arg0 = FID_RSI_VERSION; + + ArmCallSmc (&SmcCmd); + *Minor = SmcCmd.Arg0 & RSI_VER_MINOR_MASK; + *Major = (SmcCmd.Arg0 & RSI_VER_MAJOR_MASK) >> RSI_VER_MAJOR_SHIFT; + return RETURN_SUCCESS; +} diff --git a/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.inf b/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.inf new file mode 100644 index 0000000000000000000000000000000000000000..1e2b72f312587f822dfca1b26b1910f75d4ec7b6 --- /dev/null +++ b/ArmVirtPkg/Library/ArmCcaRsiLib/ArmCcaRsiLib.inf @@ -0,0 +1,29 @@ +## @file +# Library that implements the Arm CCA Realm Service Interface calls. +# +# Copyright (c) 2022 - 2023, Arm Limited. All rights reserved.
+# +# SPDX-License-Identifier: BSD-2-Clause-Patent +# +## + +[Defines] + INF_VERSION = 0x0001001B + BASE_NAME = ArmCcaRsiLib + FILE_GUID = 5EF34A0A-28B5-4E57-A999-CC1528FC629A + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = ArmCcaRsiLib + +[Sources] + ArmCcaRsiLib.c + ArmCcaRsi.h + +[Packages] + ArmPkg/ArmPkg.dec + ArmVirtPkg/ArmVirtPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + ArmLib + ArmSmcLib -- 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117681): https://edk2.groups.io/g/devel/message/117681 Mute This Topic: https://groups.io/mt/105483419/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-