From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a01:111:f400:fe08::61d; helo=eur03-am5-obe.outbound.protection.outlook.com; envelope-from=evan.lloyd@arm.com; receiver=edk2-devel@lists.01.org Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-am5eur03on061d.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe08::61d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1AEA3225E966B for ; Wed, 21 Mar 2018 05:47:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Hq/f9Ver1eo5Adps3vthEWybQhGOtdgkiejqAyxYyx0=; b=FfSF7amBktdr0nALzqS/kiHVTSELxJVGv9lgKgaF9rbEMMQsIELXIfLEW1aQmjDVBh8NCLqOxYQru/zng6kQC71rKnvj8/iYKrrqUk4wiXTs2LVyaSldsF7bcMy7CMHIqjLnkrF686vYkHnxGAwUlRbWLtt4A+p+fSRyfc4HCcY= Received: from HE1PR0801MB1771.eurprd08.prod.outlook.com (10.168.150.14) by HE1PR0801MB1786.eurprd08.prod.outlook.com (10.168.150.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.588.14; Wed, 21 Mar 2018 12:54:25 +0000 Received: from HE1PR0801MB1771.eurprd08.prod.outlook.com ([fe80::69cc:3ecf:9c8c:f5a3]) by HE1PR0801MB1771.eurprd08.prod.outlook.com ([fe80::69cc:3ecf:9c8c:f5a3%17]) with mapi id 15.20.0588.017; Wed, 21 Mar 2018 12:54:25 +0000 From: Evan Lloyd To: Girish Pathak , "edk2-devel@lists.01.org" CC: nd , Stephanie Hughes-Fitt , "leif.lindholm@linaro.org" , "ard.biesheuvel@linaro.org" Thread-Topic: [edk2] [PATCH v3 15/16] ArmPkg: MTL Library interface and Null library implementation Thread-Index: AQHTwGZcuOP0fu6hxki9eJ4Ob5Jl/KPapqkQ Date: Wed, 21 Mar 2018 12:54:25 +0000 Message-ID: References: <20180320161212.79120-1-girish.pathak@arm.com> <20180320161212.79120-16-girish.pathak@arm.com> In-Reply-To: <20180320161212.79120-16-girish.pathak@arm.com> Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [217.140.96.140] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; HE1PR0801MB1786; 7:2y6cK28ERtZISEcF+876In+lxyH+NpGHn8w3Wg0TzKZJfPuMNkzgM+R2KdhcvWGkMxIqHRI8e+Q65WNXC5AjlbgGfl8JdiSMv9v0jdrkovhVWFve9Irad7hC6zVHne82WcS6MmczYL1YaN1u7Y+jNfVmN4z8QgeuLB8cDpv0dg+X83jzpJQx39MNqKhfL/Hw+BNSbQ1/dSNHQvRkYniYZnxeniEIvUaLzjD3y9jtwd4dPOi8MUwZiXNc8pDP/d7U x-ms-exchange-antispam-srfa-diagnostics: SOS;SOR; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: aab8a411-d79f-44cf-10cf-08d58f2ae001 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(2017052603328)(7153060)(7193020); SRVR:HE1PR0801MB1786; x-ms-traffictypediagnostic: HE1PR0801MB1786: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Evan.Lloyd@arm.com; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917)(162533806227266); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231221)(944501323)(52105095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(6072148)(201708071742011); SRVR:HE1PR0801MB1786; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0801MB1786; x-forefront-prvs: 0618E4E7E1 x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(39380400002)(366004)(346002)(376002)(396003)(39860400002)(13464003)(189003)(199004)(2950100002)(97736004)(16799955002)(15188155005)(105586002)(3280700002)(2906002)(25786009)(81156014)(99286004)(316002)(59450400001)(7696005)(966005)(26005)(110136005)(14454004)(478600001)(76176011)(6506007)(102836004)(72206003)(2900100001)(8676002)(54906003)(81166006)(5660300001)(86362001)(5250100002)(4326008)(53376002)(33656002)(6246003)(6436002)(9686003)(229853002)(53546011)(2501003)(575784001)(3846002)(106356001)(3660700001)(6116002)(66066001)(53936002)(7736002)(68736007)(305945005)(55016002)(6306002)(8936002)(74316002); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0801MB1786; H:HE1PR0801MB1771.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: pkGRehwpmhI4seNcILMG2PEsZbIMukbKYi+6qY8t8x3YxAhJq5U/43scLw04mbDSQr3CYCWMrZnM+TFHLZy/K//+MRD86aAZGRzPtsC2BcUKTe+dn0CTmz+Jnm4cQfSEdGmwUlkZ7rQiL5CRvyaoI3g7/lBwb5QMUG7HRRHZP5w54d03QP5bRKsIHoIIYROtdTdU7+WA/S6V0xRH1+AkIqb+/5ugN9LnysXzAMiougyiGF7ZbL5zR/hWujHK+mGEeBSf85CPmGe76Fzn/lo8E5lzgecLMtM2xc52gs+dmqSE8T5kbNll/7Z9qMjXpBUvOL4FeSIKTPs1wB1sQGeGsQ== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-Network-Message-Id: aab8a411-d79f-44cf-10cf-08d58f2ae001 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Mar 2018 12:54:25.0795 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0801MB1786 Subject: Re: [PATCH v3 15/16] ArmPkg: MTL Library interface and Null library implementation X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2018 12:47:57 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Evan Lloyd > -----Original Message----- > From: edk2-devel On Behalf Of Girish > Pathak > Sent: 20 March 2018 16:12 > To: edk2-devel@lists.01.org > Cc: nd ; Stephanie Hughes-Fitt Fitt@arm.com>; leif.lindholm@linaro.org; ard.biesheuvel@linaro.org > Subject: [edk2] [PATCH v3 15/16] ArmPkg: MTL Library interface and Null > library implementation >=20 > Upcoming new component ArmPkg/Drivers/ArmScmiDxe is dependent on > platform specific ArmMtlLib library implementation, however in order to b= e > able to build the ArmScmiDxe component outside of the context of a > particular platform, this change adds Null implementation of the ArmMtlLi= b > along with ARM MTL library header. >=20 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Girish Pathak > Signed-off-by: Evan Lloyd > --- > ArmPkg/ArmPkg.dec | 3 +- > ArmPkg/Include/Library/ArmMtlLib.h | 137 > ++++++++++++++++++++ > ArmPkg/Library/ArmMtlNullLib/ArmMtlNullLib.c | 108 > +++++++++++++++ > ArmPkg/Library/ArmMtlNullLib/ArmMtlNullLib.inf | 26 ++++ > 4 files changed, 273 insertions(+), 1 deletion(-) >=20 > diff --git a/ArmPkg/ArmPkg.dec b/ArmPkg/ArmPkg.dec index > a55b6268ff85ffd7da140be813ec875f7f242c4d..881751d81c6384a3eb0b4c > 180c76d01a58266a74 100644 > --- a/ArmPkg/ArmPkg.dec > +++ b/ArmPkg/ArmPkg.dec > @@ -2,7 +2,7 @@ > # ARM processor package. > # > # Copyright (c) 2009 - 2010, Apple Inc. All rights reserved.
-# > Copyright (c) 2011 - 2017, ARM Limited. All rights reserved. > +# Copyright (c) 2011 - 2018, ARM Limited. All rights reserved. > # > # This program and the accompanying materials > # are licensed and made available under the terms and conditions of t= he > BSD License > @@ -40,6 +40,7 @@ [LibraryClasses.common] > ArmDisassemblerLib|Include/Library/ArmDisassemblerLib.h > ArmGicArchLib|Include/Library/ArmGicArchLib.h > ArmSvcLib|Include/Library/ArmSvcLib.h > + ArmMtlLib|ArmPlatformPkg/Include/Library/ArmMtlLib.h >=20 > [Guids.common] > gArmTokenSpaceGuid =3D { 0xBB11ECFE, 0x820F, 0x4968, { 0xBB, 0xA= 6, > 0xF7, 0x6A, 0xFE, 0x30, 0x25, 0x96 } } > diff --git a/ArmPkg/Include/Library/ArmMtlLib.h > b/ArmPkg/Include/Library/ArmMtlLib.h > new file mode 100644 > index > 0000000000000000000000000000000000000000..4218a741e5ebddd080 > 22b94354d5ef47576cd3b8 > --- /dev/null > +++ b/ArmPkg/Include/Library/ArmMtlLib.h > @@ -0,0 +1,137 @@ > +/** @file > + > + Copyright (c) 2017-2018, Arm Limited. All rights reserved. > + > + This program and the accompanying materials are licensed and made > + available under the terms and conditions of the BSD License which > + accompanies this distribution. The full text of the license may be > + found at http://opensource.org/licenses/bsd-license.php > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > + > + System Control and Management Interface V1.0 > + http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/ > + DEN0056A_System_Control_and_Management_Interface.pdf > +**/ > + > +#ifndef ARM_MTL_LIB_H_ > +#define ARM_MTL_LIB_H_ > + > +#include > + > +// Ideally we don't need packed struct. However we can't rely on compile= rs. > +#pragma pack(1) > + > +typedef struct { > + UINT32 Reserved1; > + UINT32 ChannelStatus; > + UINT64 Reserved2; > + UINT32 Flags; > + UINT32 Length; > + UINT32 MessageHeader; > + > + // NOTE: Since EDK2 does not allow flexible array member [] we > +declare > + // here array of 1 element length. However below is used as a > +variable > + // length array. > + UINT32 Payload[1]; // size less object gives offset to payload. > +} MTL_MAILBOX; > + > +#pragma pack() > + > +// Channel Type, Low-priority, and High-priority typedef enum { > + MTL_CHANNEL_TYPE_LOW =3D 0, > + MTL_CHANNEL_TYPE_HIGH =3D 1 > +} MTL_CHANNEL_TYPE; > + > +typedef struct { > + UINT64 PhysicalAddress; > + UINT32 ModifyMask; > + UINT32 PreserveMask; > +} MTL_DOORBELL; > + > +typedef struct { > + MTL_CHANNEL_TYPE ChannelType; > + MTL_MAILBOX * CONST MailBox; > + MTL_DOORBELL DoorBell; > +} MTL_CHANNEL; > + > +/** Wait until channel is free. > + > + @param[in] Channel Pointer to a channel. > + @param[in] TimeOutInMicroSeconds Time out in micro seconds. > + > + @retval EFI_SUCCESS Channel is free. > + @retval EFI_TIMEOUT Time out error. > +**/ > +EFI_STATUS > +MtlWaitUntilChannelFree ( > + IN MTL_CHANNEL *Channel, > + IN UINT64 TimeOutInMicroSeconds > + ); > + > +/** Return the address of the message payload. > + > + @param[in] Channel Pointer to a channel. > + > + @retval UINT32* Pointer to the payload. > +**/ > +UINT32* > +MtlGetChannelPayload ( > + IN MTL_CHANNEL *Channel > + ); > + > +/** Return pointer to a channel for the requested channel type. > + > + @param[in] ChannelType ChannelType, Low or High priority channe= l. > + MTL_CHANNEL_TYPE_LOW or > + MTL_CHANNEL_TYPE_HIGH > + > + @param[out] Channel Holds pointer to the channel. > + > + @retval EFI_SUCCESS Pointer to channel is returned. > + @retval EFI_UNSUPPORTED Requested channel type not supported. > +**/ > +EFI_STATUS > +MtlGetChannel ( > + IN MTL_CHANNEL_TYPE ChannelType, > + OUT MTL_CHANNEL **Channel > + ); > + > +/** Mark the channel busy and ring the doorbell. > + > + @param[in] Channel Pointer to a channel. > + @param[in] MessageHeader Message header. > + > + @param[out] PayloadLength Message length. > + > + @retval EFI_SUCCESS Message sent successfully. > + @retval EFI_DEVICE_ERROR Channel is busy. > +**/ > +EFI_STATUS > +MtlSendMessage ( > + IN MTL_CHANNEL *Channel, > + IN UINT32 MessageHeader, > + OUT UINT32 PayloadLength > + ); > + > +/** Wait for a response on a channel. > + > + If channel is free after sending message, it implies SCP responded > + with a response on the channel. > + > + @param[in] Channel Pointer to a channel. > + > + @retval EFI_SUCCESS Message received successfully. > + @retval EFI_TIMEOUT Time out error. > +**/ > +EFI_STATUS > +MtlReceiveMessage ( > + IN MTL_CHANNEL *Channel, > + OUT UINT32 *MessageHeader, > + OUT UINT32 *PayloadLength > + ); > + > +#endif /* ARM_MTL_LIB_H_ */ > + > diff --git a/ArmPkg/Library/ArmMtlNullLib/ArmMtlNullLib.c > b/ArmPkg/Library/ArmMtlNullLib/ArmMtlNullLib.c > new file mode 100644 > index > 0000000000000000000000000000000000000000..f1862371113e342e4a > 4c8059be27884842210d08 > --- /dev/null > +++ b/ArmPkg/Library/ArmMtlNullLib/ArmMtlNullLib.c > @@ -0,0 +1,108 @@ > +/** @file > + > + Copyright (c) 2017-2018, Arm Limited. All rights reserved. > + > + This program and the accompanying materials are licensed and made > + available under the terms and conditions of the BSD License which > + accompanies this distribution. The full text of the license may be > + found at http://opensource.org/licenses/bsd-license.php > + > + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > BASIS, > + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > + > + System Control and Management Interface V1.0 > + http://infocenter.arm.com/help/topic/com.arm.doc.den0056a/ > + DEN0056A_System_Control_and_Management_Interface.pdf > +**/ > + > +#include > +#include > + > +/** Wait until channel is free. > + > + @param[in] Channel Pointer to a channel. > + @param[in] TimeOutInMicroSeconds Timeout in micro seconds. > + > + @retval EFI_UNSUPPORTED Interface not implemented. > +**/ > +EFI_STATUS > +MtlWaitUntilChannelFree ( > + IN MTL_CHANNEL *Channel, > + IN UINTN TimeOutInMicroSeconds > + ) > +{ > + return EFI_UNSUPPORTED; > +} > + > +/** Return the address of the message payload. > + > + @param[in] Channel Pointer to a channel. > + > + @retval UINT32* Pointer to the payload. > +**/ > +UINT32* > +MtlGetChannelPayload ( > + IN MTL_CHANNEL *Channel > + ) > +{ > + ASSERT (FALSE); > + return NULL; > +} > + > +/** Return pointer to a channel for the requested channel type. > + > + @param[in] ChannelType ChannelType, Low or High priority channe= l. > + MTL_CHANNEL_TYPE_LOW or > + MTL_CHANNEL_TYPE_HIGH > + > + @param[out] Channel Holds pointer to the channel. > + > + @retval EFI_UNSUPPORTED Requested channel type not supported or > + interface not implemented. > +**/ > +EFI_STATUS > +MtlGetChannel ( > + IN MTL_CHANNEL_TYPE ChannelType, > + OUT MTL_CHANNEL **Channel > + ) > +{ > + return EFI_UNSUPPORTED; > +} > + > +/** Mark the channel busy and ring the doorbell. > + > + @param[in] Channel Pointer to a channel. > + @param[in] MessageHeader Message header. > + > + @param[out] PayloadLength Message length. > + > + @retval EFI_UNSUPPORTED Interface not implemented. > +**/ > +EFI_STATUS > +MtlSendMessage ( > + IN MTL_CHANNEL *Channel, > + IN UINT32 MessageHeader, > + OUT UINT32 PayloadLength > + ) > +{ > + return EFI_UNSUPPORTED; > +} > + > +/** Wait for a response on a channel. > + > + If channel is free after sending message, it implies SCP responded > + with a response on the channel. > + > + @param[in] Channel Pointer to a channel. > + > + @retval EFI_UNSUPPORTED Interface not implemented. > +**/ > +EFI_STATUS > +MtlReceiveMessage ( > + IN MTL_CHANNEL *Channel, > + OUT UINT32 *MessageHeader, > + OUT UINT32 *PayloadLength > + ) > +{ > + return EFI_UNSUPPORTED; > +} > diff --git a/ArmPkg/Library/ArmMtlNullLib/ArmMtlNullLib.inf > b/ArmPkg/Library/ArmMtlNullLib/ArmMtlNullLib.inf > new file mode 100644 > index > 0000000000000000000000000000000000000000..9c0426b00e48e791da > e9ad11e2f47d248d9c09ce > --- /dev/null > +++ b/ArmPkg/Library/ArmMtlNullLib/ArmMtlNullLib.inf > @@ -0,0 +1,26 @@ > +#/** @file > +# Copyright (c) 2017-2018, Arm Limited. All rights reserved. > +# > +# This program and the accompanying materials # are licensed and made > +available under the terms and conditions of the BSD License # which > +accompanies this distribution. The full text of the license may be > +found at # http://opensource.org/licenses/bsd-license.php > +# > +# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > +BASIS, # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, > EITHER EXPRESS OR IMPLIED. > +#**/ > + > +[Defines] > + INF_VERSION =3D 0x00010019 > + BASE_NAME =3D ArmMtlNullLib > + FILE_GUID =3D 05810525-FDEC-4006-9F1F-37609B3675F= A > + MODULE_TYPE =3D BASE > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D ArmMtlLib > + > +[Sources.common] > + ArmMtlNullLib.c > + > +[Packages] > + ArmPkg/ArmPkg.dec > + MdePkg/MdePkg.dec > -- > 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)' >=20 >=20 > _______________________________________________ > edk2-devel mailing list > edk2-devel@lists.01.org > https://lists.01.org/mailman/listinfo/edk2-devel