From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (EUR04-HE1-obe.outbound.protection.outlook.com [40.107.7.71]) by mx.groups.io with SMTP id smtpd.web10.10412.1639398399002153701 for ; Mon, 13 Dec 2021 04:26:40 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@armh.onmicrosoft.com header.s=selector2-armh-onmicrosoft-com header.b=XM3nyh0/; spf=pass (domain: arm.com, ip: 40.107.7.71, 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=nLM/5vpSjRwekXUpDHPhk/dViZbgrqPbliHMAE+ks0E=; b=XM3nyh0/oFZa4iYMLRrclUYKYdyVWzHXUJI2wl/SZGSVuuUR71j2VxPWRWfLbJwepWgBxbfKbLWzMv5BoU5EHRvqZJN/MPE2BPczRfubzpUnt8FmE91OjPtYeqN7mm9V8sa4haY0Zs0LyGDMhgYpullg8Ii3cH5+FSa9yQB0KN4= Received: from DB6PR07CA0014.eurprd07.prod.outlook.com (2603:10a6:6:2d::24) by DBBPR08MB5961.eurprd08.prod.outlook.com (2603:10a6:10:203::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.17; Mon, 13 Dec 2021 12:26:34 +0000 Received: from DB5EUR03FT033.eop-EUR03.prod.protection.outlook.com (2603:10a6:6:2d:cafe::26) by DB6PR07CA0014.outlook.office365.com (2603:10a6:6:2d::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.13 via Frontend Transport; Mon, 13 Dec 2021 12:26:34 +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; Received: from 64aa7808-outbound-1.mta.getcheckrecipient.com (63.35.35.123) by DB5EUR03FT033.mail.protection.outlook.com (10.152.20.76) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.12 via Frontend Transport; Mon, 13 Dec 2021 12:26:34 +0000 Received: ("Tessian outbound 9a8c656e7c94:v110"); Mon, 13 Dec 2021 12:26:34 +0000 X-CheckRecipientChecked: true X-CR-MTA-CID: 858801d3ba6d2bd7 X-CR-MTA-TID: 64aa7808 Received: from a5a2fd76290d.2 by 64aa7808-outbound-1.mta.getcheckrecipient.com id E2F504E6-4FC5-4B26-B6C3-D59D2909050F.1; Mon, 13 Dec 2021 12:26:11 +0000 Received: from EUR03-DB5-obe.outbound.protection.outlook.com by 64aa7808-outbound-1.mta.getcheckrecipient.com with ESMTPS id a5a2fd76290d.2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384); Mon, 13 Dec 2021 12:26:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UDJ+cSE12PN11t4g7MSe0Okp78LkTSlQ/arOFlFYlTswuOTvLADLdOABS7c5kEUPk+UheHUGELi71CMH0HQhxb/OGUh+xok/elJT+BAdbyi+TDKq8XFWxGHQVewUFy3aNUqTu9qaXqglO8fYMGJ5VGdhTSourcEjgzGZnJWSHljfw1QLxDGXMUG87/g4dyNgQFNwETU+F75qwoy9ZwUlu9sSpLkD/tI/yjTLP5ik8fhab6gixr1UETCzanvCDAg/vjSBd1hn6hdJiXQSx6ovasA9mnGTwjxCvIzX5FHMUltGW5fZTfLvbdYk1CRF8eODPsXdByga4tG/fdjUO4VOnw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nLM/5vpSjRwekXUpDHPhk/dViZbgrqPbliHMAE+ks0E=; b=mwmWjwQFttWgwyP+OJArViTBLQyYVGohXgcVch3PrwrTJDV95fZByzZS+G7mYKuqBPgqKDebVocN1iC8mAtwDLvDCdTjMZ4evCZZC1EFag+dogv6IpjqFYdNXPf2BdaEHger6hTCg70mfJW+QaJc0iMrwFnBVHyne1V+qDnChO00WS9A8xSj1qUncrIYXa7SjltT/EaenGTMPjY32A46BMog1SfK1t3bytmOMnJcM6KC6dXLGvl22MmV+m/O9GHY2iIclmqYhA/Zviw2hf4cUk/AZ4JroHxGLVSYg6f8H6IRKSeMirE22yXXFz+2cHSS/Wan8+4S8kgaC8nhlvZXfQ== 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=nLM/5vpSjRwekXUpDHPhk/dViZbgrqPbliHMAE+ks0E=; b=XM3nyh0/oFZa4iYMLRrclUYKYdyVWzHXUJI2wl/SZGSVuuUR71j2VxPWRWfLbJwepWgBxbfKbLWzMv5BoU5EHRvqZJN/MPE2BPczRfubzpUnt8FmE91OjPtYeqN7mm9V8sa4haY0Zs0LyGDMhgYpullg8Ii3cH5+FSa9yQB0KN4= Authentication-Results-Original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Received: from AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) by AM6PR08MB5079.eurprd08.prod.outlook.com (2603:10a6:20b:e8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4778.11; Mon, 13 Dec 2021 12:26:09 +0000 Received: from AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::bdcf:cfa6:b2bb:38ac]) by AS8PR08MB6806.eurprd08.prod.outlook.com ([fe80::bdcf:cfa6:b2bb:38ac%6]) with mapi id 15.20.4755.021; Mon, 13 Dec 2021 12:26:09 +0000 Subject: Re: [PATCH v2 1/2] ArmPkg: Add SMC helper functions To: Ard Biesheuvel , Rebecca Cran Cc: Leif Lindholm , Ard Biesheuvel , edk2-devel-groups-io , Gerd Hoffmann , Samer El-Haj-Mahmoud , nd References: <20211101221153.18620-1-rebecca@nuviainc.com> <20211101221153.18620-2-rebecca@nuviainc.com> <20211109115751.5inrccjr2ze4ql63@leviathan> From: "Sami Mujawar" Message-ID: Date: Mon, 13 Dec 2021 12:26:16 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 In-Reply-To: X-ClientProxiedBy: LO4P123CA0365.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18e::10) To AS8PR08MB6806.eurprd08.prod.outlook.com (2603:10a6:20b:39b::12) MIME-Version: 1.0 Received: from [10.1.196.43] (217.140.106.50) by LO4P123CA0365.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18e::10) with Microsoft SMTP Server (version=TLS1_2, cipher=) via Frontend Transport; Mon, 13 Dec 2021 12:26:09 +0000 X-MS-Office365-Filtering-Correlation-Id: 0e2af9f4-69e8-4eae-8c51-08d9be33cd35 X-MS-TrafficTypeDiagnostic: AM6PR08MB5079:EE_|DB5EUR03FT033:EE_|DBBPR08MB5961:EE_ X-Microsoft-Antispam-PRVS: x-checkrecipientrouted: true NoDisclaimer: true X-MS-Oob-TLC-OOBClassifiers: OLM:6790;OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam-Untrusted: BCL:0; X-Microsoft-Antispam-Message-Info-Original: V5gomVmyt0hyYimcdvUXIeSsfUtlhDS+gRmoms9+sidDFpQC2ZXrHN9SrZww/NjUA1IFMLJphcYRBKppLbz5lxkfVm2l7oyjP0y0grV1ZLxGtFv8lqYn84DtcOtAp19lSH177/07mWo7jZ19SjsnWlNxOYhw9mMT/5avfbVasV5qSJ7dVfpN4/Bnpf01Dlf9ziNE7FibTySmzecNbhEteabyT78oz0lw/uuMj2rHkXQcXUR2PLEfeTn+ystKdEqEiIW9P2dYxX5YdPptC2GAzfZjaetUo1UcK/m3EuR1ISNTAuvISZSAr1H1sI3pKIsjqRO5dd8TMg4nKrH2is1t/++BVmDnBsTXLaJN3GKVwJ8N4MdD/hMR2eoTAtNT3VqaJHJM8IfZF13XOpEJY0fPTHehf0zfqAgQuT+A7PCisOtNUPWyuHddexcaAaGnxZzzzpAE+VrpifZvZ72qr6AgSMhOgyINMqQYT2hpYGwTrBE2vsVQpefG26JZ4kAxqdE+t4RXxX645kFPdIowXV/ZlLkW15cte+Jt3ookwTCnTKxF8yOG8NJp5rw0rlABBfzB7Y8lajCfslIVjzBxuoAjjesgJTLtgG7YPhQK3NpaG/7MNYg+/XIfYMQqlS1//JPwwgOpXbZKwV0x9FhVw+V30i+pEaZanLWLBYceBK/MeXCp5ns0lGPWK3wQo6YQQCnNrK/IvYFiHZeMmWYavxpx8xScmKEGwnR3M3Vm5iyLXlNzr1YKMCwaIMkezxJwxtSR2Mdq9qkPcMlg1Z1fI9kgGA== X-Forefront-Antispam-Report-Untrusted: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AS8PR08MB6806.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(31686004)(36756003)(31696002)(186003)(5660300002)(86362001)(54906003)(8676002)(8936002)(2906002)(6666004)(316002)(16576012)(110136005)(66946007)(52116002)(66476007)(66556008)(508600001)(26005)(44832011)(2616005)(83380400001)(956004)(30864003)(38100700002)(53546011)(38350700002)(6486002)(4326008)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR08MB5079 Original-Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com; Return-Path: Sami.Mujawar@arm.com X-EOPAttributedMessage: 0 X-MS-Exchange-Transport-CrossTenantHeadersStripped: DB5EUR03FT033.eop-EUR03.prod.protection.outlook.com X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id-Prvs: 465c8744-16e0-45d2-d5f4-08d9be33be1f X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iES0ETnBe3eRZV6kScAg9Hkcda+rEXk5Im5gFVXfIlfYp2ylvLTeheG0mA0M1E6sJqvtc1amox2lixaewn7tWf/GWwTkU73taxTRK96mwh9n0Y6w+0UcLP0eiXe9QPM5plYP+DQL4buAvts2V6lsdNdxjTpqECTq+3mGwgc90J1Xa6nsUvBQIxgrbBrawA+FBW4zSL7zBfqSG6xm5ka8tVkG77n2eATcX4GiyXhPrvZElzbxVaniyhLHA+poL/gmTV/2xwWepxWFxZnTPXiDJyCl+1Z5FcehOq3nLSeiRy9y6qCFtXjkP1TGm+EdHG7/AE0enbqX7wS0+/780hCM0sFhp+xZK2qUnkHoFHVHAU2cMt6S86BIyXnx4IQUcSYErA22kD2Ewm90mKjq/NIZnkDsY6PwzNmHV9RpE94JruMvIpLkav0a+Mis4S3ygO7g89sHjlkRLrTOm6DxEmK0w4RSfdCpXrjeFl+P0/RXG0SVJkWpbmwVthB5mafYgHdXx8XXIAZ5PuDuMqO0Cxl+MK17DX4wiqO2lVYG+aSwR7K4+fCERW3NbNe1eisWAwQcVdHwuRSIO6CzTG56fXdt1kKO7JQ+UJTf0o2pjYgrHStDT3rylO5r4RbHIj7G5VFfhxOGdKWj0JFkQC74vdGGHZWtQKLnNUY3lXsKOXBjJAmEKK0miKctirwG7DMo4pNLI+sqgqjfCpabFih46slq6noUbWq18IWTomTUR/1pa8k= 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)(36840700001)(46966006)(82310400004)(4326008)(54906003)(2906002)(36756003)(26005)(8936002)(356005)(6666004)(956004)(83380400001)(508600001)(6486002)(81166007)(186003)(47076005)(70586007)(31686004)(2616005)(31696002)(336012)(44832011)(70206006)(36860700001)(316002)(53546011)(16576012)(86362001)(5660300002)(8676002)(30864003)(110136005)(43740500002);DIR:OUT;SFP:1101; X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Dec 2021 12:26:34.5083 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0e2af9f4-69e8-4eae-8c51-08d9be33cd35 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: DB5EUR03FT033.eop-EUR03.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR08MB5961 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-GB Hi Ard, On 13/12/2021 11:49 AM, Ard Biesheuvel wrote: > On Thu, 9 Dec 2021 at 23:54, Rebecca Cran wrote: >> Now that the edk2 tree is unfrozen, I'd like to get this committed. >> >> Could anyone else review it please, or if it's ready commit it? >> >> > I think this is fine to go in, but you'll need to rebase on top of the > uncrustify changes in any case. > > Sami, Leif: any comments? I have some minor suggestions, that I will reply back shortly. Regards, Sami Mujawar > > > >> On 11/9/21 5:15 AM, Ard Biesheuvel wrote: >>> On Tue, 9 Nov 2021 at 12:57, Leif Lindholm wrote: >>>> On Mon, Nov 08, 2021 at 18:56:09 -0700, Rebecca Cran wrote: >>>>> Could I have some reviews on this please? >>>> I'm all for it. It's clunky, but less clunky than the situation >>>> without, and it improves readability at call sites. >>>> >>>> Ard had some reservations for v1 not actually adding any users. >>>> Ard - do you like it any better now Rebecca's added some? >>>> >>> Yeah, this is fine. TBH, I am not going to have time to look into this >>> in detail again, so if you're both happy, then I am too. >>> >>> Acked-by: Ard Biesheuvel >>> >>> >>> >>>>> On 11/1/21 4:11 PM, Rebecca Cran wrote: >>>>>> Add functions ArmCallSmc0/1/2/3 to do SMC calls with 0, 1, 2 or 3 >>>>>> arguments. >>>>>> The functions return up to 3 values. >>>>>> >>>>>> Signed-off-by: Rebecca Cran >>>>>> --- >>>>>> ArmPkg/Include/Library/ArmSmcLib.h | 73 ++++++++++++ >>>>>> ArmPkg/Library/ArmSmcLib/ArmSmc.c | 122 ++++++++++++++++++++ >>>>>> ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf | 3 + >>>>>> ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.c | 85 ++++++++++++++ >>>>>> 4 files changed, 283 insertions(+) >>>>>> >>>>>> diff --git a/ArmPkg/Include/Library/ArmSmcLib.h b/ArmPkg/Include/Library/ArmSmcLib.h >>>>>> index ced60b3c1147..343ae7f40ad2 100644 >>>>>> --- a/ArmPkg/Include/Library/ArmSmcLib.h >>>>>> +++ b/ArmPkg/Include/Library/ArmSmcLib.h >>>>>> @@ -1,5 +1,6 @@ >>>>>> /** @file >>>>>> * >>>>>> +* Copyright (c) 2021, NUVIA Inc. All rights reserved.
>>>>>> * Copyright (c) 2012-2014, ARM Limited. All rights reserved. >>>>>> * >>>>>> * SPDX-License-Identifier: BSD-2-Clause-Patent >>>>>> @@ -37,4 +38,76 @@ ArmCallSmc ( >>>>>> IN OUT ARM_SMC_ARGS *Args >>>>>> ); >>>>>> +/** Trigger an SMC call with 3 arguments. >>>>>> + >>>>>> + @param Function The SMC function. >>>>>> + @param Arg1 Argument/result. >>>>>> + @param Arg2 Argument/result. >>>>>> + @param Arg3 Argument/result. >>>>>> + >>>>>> + @return The SMC error code. >>>>>> + >>>>>> +**/ >>>>>> +UINTN >>>>>> +ArmCallSmc3 ( >>>>>> + IN UINTN Function, >>>>>> + IN OUT UINTN *Arg1, >>>>>> + IN OUT UINTN *Arg2, >>>>>> + IN OUT UINTN *Arg3 >>>>>> + ); >>>>>> + >>>>>> +/** Trigger an SMC call with 2 arguments. >>>>>> + >>>>>> + @param Function The SMC function. >>>>>> + @param Arg1 Argument/result. >>>>>> + @param Arg2 Argument/result. >>>>>> + @param Arg3 Result. >>>>>> + >>>>>> + @return The SMC error code. >>>>>> + >>>>>> +**/ >>>>>> +UINTN >>>>>> +ArmCallSmc2 ( >>>>>> + IN UINTN Function, >>>>>> + IN OUT UINTN *Arg1, >>>>>> + IN OUT UINTN *Arg2, >>>>>> + OUT UINTN *Arg3 >>>>>> + ); >>>>>> + >>>>>> +/** Trigger an SMC call with 1 argument. >>>>>> + >>>>>> + @param Function The SMC function. >>>>>> + @param Arg1 Argument/result. >>>>>> + @param Arg2 Result. >>>>>> + @param Arg3 Result. >>>>>> + >>>>>> + @return The SMC error code. >>>>>> + >>>>>> +**/ >>>>>> +UINTN >>>>>> +ArmCallSmc1 ( >>>>>> + IN UINTN Function, >>>>>> + IN OUT UINTN *Arg1, >>>>>> + OUT UINTN *Arg2, >>>>>> + OUT UINTN *Arg3 >>>>>> + ); >>>>>> + >>>>>> +/** Trigger an SMC call with 0 arguments. >>>>>> + >>>>>> + @param Function The SMC function. >>>>>> + @param Arg1 Result. >>>>>> + @param Arg2 Result. >>>>>> + @param Arg3 Result. >>>>>> + >>>>>> + @return The SMC error code. >>>>>> + >>>>>> +**/ >>>>>> +UINTN >>>>>> +ArmCallSmc0 ( >>>>>> + IN UINTN Function, >>>>>> + OUT UINTN *Arg1, >>>>>> + OUT UINTN *Arg2, >>>>>> + OUT UINTN *Arg3 >>>>>> + ); >>>>>> + >>>>>> #endif // ARM_SMC_LIB_H_ >>>>>> diff --git a/ArmPkg/Library/ArmSmcLib/ArmSmc.c b/ArmPkg/Library/ArmSmcLib/ArmSmc.c >>>>>> new file mode 100644 >>>>>> index 000000000000..d596003a857e >>>>>> --- /dev/null >>>>>> +++ b/ArmPkg/Library/ArmSmcLib/ArmSmc.c >>>>>> @@ -0,0 +1,122 @@ >>>>>> +/** @file >>>>>> + SMC helper functions. >>>>>> + >>>>>> + Copyright (c) 2021, NUVIA Inc. All rights reserved.
>>>>>> + >>>>>> + SPDX-License-Identifier: BSD-2-Clause-Patent >>>>>> + >>>>>> +**/ >>>>>> + >>>>>> +#include >>>>>> + >>>>>> +/** Triggers an SMC call with 3 arguments. >>>>>> + >>>>>> + @param Function The SMC function. >>>>>> + @param Arg1 Argument/result. >>>>>> + @param Arg2 Argument/result. >>>>>> + @param Arg3 Argument/result. >>>>>> + >>>>>> + @return The SMC error code. >>>>>> +**/ >>>>>> +UINTN >>>>>> +ArmCallSmc3 ( >>>>>> + IN UINTN Function, >>>>>> + IN OUT UINTN *Arg1, >>>>>> + IN OUT UINTN *Arg2, >>>>>> + IN OUT UINTN *Arg3 >>>>>> + ) >>>>>> +{ >>>>>> + ARM_SMC_ARGS Args; >>>>>> + UINTN ErrorCode; >>>>>> + >>>>>> + Args.Arg0 = Function; >>>>>> + >>>>>> + if (Arg1 != NULL) { >>>>>> + Args.Arg1 = *Arg1; >>>>>> + } >>>>>> + if (Arg2 != NULL) { >>>>>> + Args.Arg2 = *Arg2; >>>>>> + } >>>>>> + if (Arg3 != NULL) { >>>>>> + Args.Arg3 = *Arg3; >>>>>> + } >>>>>> + >>>>>> + ArmCallSmc (&Args); >>>>>> + >>>>>> + ErrorCode = Args.Arg0; >>>>>> + >>>>>> + if (Arg1 != NULL) { >>>>>> + *Arg1 = Args.Arg1; >>>>>> + } >>>>>> + if (Arg2 != NULL) { >>>>>> + *Arg2 = Args.Arg2; >>>>>> + } >>>>>> + if (Arg3 != NULL) { >>>>>> + *Arg3 = Args.Arg3; >>>>>> + } >>>>>> + >>>>>> + return ErrorCode; >>>>>> +} >>>>>> + >>>>>> +/** Trigger an SMC call with 2 arguments. >>>>>> + >>>>>> + @param Function The SMC function. >>>>>> + @param Arg1 Argument/result. >>>>>> + @param Arg2 Argument/result. >>>>>> + @param Arg3 Result. >>>>>> + >>>>>> + @return The SMC error code. >>>>>> + >>>>>> +**/ >>>>>> +UINTN >>>>>> +ArmCallSmc2 ( >>>>>> + IN UINTN Function, >>>>>> + IN OUT UINTN *Arg1, >>>>>> + IN OUT UINTN *Arg2, >>>>>> + OUT UINTN *Arg3 >>>>>> + ) >>>>>> +{ >>>>>> + return ArmCallSmc3 (Function, Arg1, Arg2, Arg3); >>>>>> +} >>>>>> + >>>>>> +/** Trigger an SMC call with 1 argument. >>>>>> + >>>>>> + @param Function The SMC function. >>>>>> + @param Arg1 Argument/result. >>>>>> + @param Arg2 Result. >>>>>> + @param Arg3 Result. >>>>>> + >>>>>> + @return The SMC error code. >>>>>> + >>>>>> +**/ >>>>>> +UINTN >>>>>> +ArmCallSmc1 ( >>>>>> + IN UINTN Function, >>>>>> + IN OUT UINTN *Arg1, >>>>>> + OUT UINTN *Arg2, >>>>>> + OUT UINTN *Arg3 >>>>>> + ) >>>>>> +{ >>>>>> + return ArmCallSmc3 (Function, Arg1, Arg2, Arg3); >>>>>> +} >>>>>> + >>>>>> +/** Trigger an SMC call with 0 arguments. >>>>>> + >>>>>> + @param Function The SMC function. >>>>>> + @param Arg1 Result. >>>>>> + @param Arg2 Result. >>>>>> + @param Arg3 Result. >>>>>> + >>>>>> + @return The SMC error code. >>>>>> + >>>>>> +**/ >>>>>> +UINTN >>>>>> +ArmCallSmc0 ( >>>>>> + IN UINTN Function, >>>>>> + OUT UINTN *Arg1, >>>>>> + OUT UINTN *Arg2, >>>>>> + OUT UINTN *Arg3 >>>>>> + ) >>>>>> +{ >>>>>> + return ArmCallSmc3 (Function, Arg1, Arg2, Arg3); >>>>>> +} >>>>>> diff --git a/ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf b/ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf >>>>>> index 4f4b09f4528a..a89f9203fb7e 100644 >>>>>> --- a/ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf >>>>>> +++ b/ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf >>>>>> @@ -20,6 +20,9 @@ >>>>>> [Sources.AARCH64] >>>>>> AArch64/ArmSmc.S >>>>>> +[Sources] >>>>>> + ArmSmc.c >>>>>> + >>>>>> [Packages] >>>>>> MdePkg/MdePkg.dec >>>>>> ArmPkg/ArmPkg.dec >>>>>> diff --git a/ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.c b/ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.c >>>>>> index 2d79aadaf1fa..ca1b8830a119 100644 >>>>>> --- a/ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.c >>>>>> +++ b/ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.c >>>>>> @@ -1,4 +1,5 @@ >>>>>> // >>>>>> +// Copyright (c) 2021, NUVIA Inc. All rights reserved. >>>>>> // Copyright (c) 2016, Linaro Limited. All rights reserved. >>>>>> // >>>>>> // SPDX-License-Identifier: BSD-2-Clause-Patent >>>>>> @@ -7,6 +8,7 @@ >>>>>> #include >>>>>> #include >>>>>> +#include >>>>>> VOID >>>>>> ArmCallSmc ( >>>>>> @@ -14,3 +16,86 @@ ArmCallSmc ( >>>>>> ) >>>>>> { >>>>>> } >>>>>> + >>>>>> +/** Triggers an SMC call with 3 arguments. >>>>>> + >>>>>> + @param Function The SMC function. >>>>>> + @param Arg1 Argument/result. >>>>>> + @param Arg2 Argument/result. >>>>>> + @param Arg3 Argument/result. >>>>>> + >>>>>> + @return The SMC error code. >>>>>> +**/ >>>>>> +UINTN >>>>>> +ArmCallSmc3 ( >>>>>> + IN UINTN Function, >>>>>> + IN OUT UINTN *Arg1, >>>>>> + IN OUT UINTN *Arg2, >>>>>> + IN OUT UINTN *Arg3 >>>>>> + ) >>>>>> +{ >>>>>> + return SMC_ARCH_CALL_NOT_SUPPORTED; >>>>>> +} >>>>>> + >>>>>> +/** Trigger an SMC call with 2 arguments. >>>>>> + >>>>>> + @param Function The SMC function. >>>>>> + @param Arg1 Argument/result. >>>>>> + @param Arg2 Argument/result. >>>>>> + @param Arg3 Result. >>>>>> + >>>>>> + @return The SMC error code. >>>>>> + >>>>>> +**/ >>>>>> +UINTN >>>>>> +ArmCallSmc2 ( >>>>>> + IN UINTN Function, >>>>>> + IN OUT UINTN *Arg1, >>>>>> + IN OUT UINTN *Arg2, >>>>>> + OUT UINTN *Arg3 >>>>>> + ) >>>>>> +{ >>>>>> + return SMC_ARCH_CALL_NOT_SUPPORTED; >>>>>> +} >>>>>> + >>>>>> +/** Trigger an SMC call with 1 argument. >>>>>> + >>>>>> + @param Function The SMC function. >>>>>> + @param Arg1 Argument/result. >>>>>> + @param Arg2 Result. >>>>>> + @param Arg3 Result. >>>>>> + >>>>>> + @return The SMC error code. >>>>>> + >>>>>> +**/ >>>>>> +UINTN >>>>>> +ArmCallSmc1 ( >>>>>> + IN UINTN Function, >>>>>> + IN OUT UINTN *Arg1, >>>>>> + OUT UINTN *Arg2, >>>>>> + OUT UINTN *Arg3 >>>>>> + ) >>>>>> +{ >>>>>> + return SMC_ARCH_CALL_NOT_SUPPORTED; >>>>>> +} >>>>>> + >>>>>> +/** Trigger an SMC call with 0 arguments. >>>>>> + >>>>>> + @param Function The SMC function. >>>>>> + @param Arg1 Result. >>>>>> + @param Arg2 Result. >>>>>> + @param Arg3 Result. >>>>>> + >>>>>> + @return The SMC error code. >>>>>> + >>>>>> +**/ >>>>>> +UINTN >>>>>> +ArmCallSmc0 ( >>>>>> + IN UINTN Function, >>>>>> + OUT UINTN *Arg1, >>>>>> + OUT UINTN *Arg2, >>>>>> + OUT UINTN *Arg3 >>>>>> + ) >>>>>> +{ >>>>>> + return SMC_ARCH_CALL_NOT_SUPPORTED; >>>>>> +}