From nobody Wed Dec 25 13:55:16 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1510044867103554.0711327539789; Tue, 7 Nov 2017 00:54:27 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 38B2A2034D836; Tue, 7 Nov 2017 00:50:26 -0800 (PST) Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0040.outbound.protection.outlook.com [104.47.41.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2A3502034D825 for ; Tue, 7 Nov 2017 00:50:24 -0800 (PST) Received: from BN3PR03CA0073.namprd03.prod.outlook.com (10.167.1.161) by BN3PR03MB2355.namprd03.prod.outlook.com (10.166.74.150) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Tue, 7 Nov 2017 08:54:22 +0000 Received: from BN1BFFO11FD026.protection.gbl (2a01:111:f400:7c10::1:119) by BN3PR03CA0073.outlook.office365.com (2a01:111:e400:7a4d::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.197.13 via Frontend Transport; Tue, 7 Nov 2017 08:54:22 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD026.mail.protection.outlook.com (10.58.144.89) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.178.5 via Frontend Transport; Tue, 7 Nov 2017 08:54:22 +0000 Received: from uefi-OptiPlex-790.ap.freescale.net (uefi-OptiPlex-790.ap.freescale.net [10.232.132.78]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vA78s4Da009319; Tue, 7 Nov 2017 01:54:19 -0700 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.41.40; helo=nam03-dm3-obe.outbound.protection.outlook.com; envelope-from=meenakshi.aggarwal@nxp.com; receiver=edk2-devel@lists.01.org Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; From: Meenakshi Aggarwal To: , , , Date: Tue, 7 Nov 2017 20:12:09 +0530 Message-ID: <1510065736-9394-4-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1510065736-9394-1-git-send-email-meenakshi.aggarwal@nxp.com> References: <1510065736-9394-1-git-send-email-meenakshi.aggarwal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131545184627163450; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(7966004)(376002)(39380400002)(346002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(36756003)(356003)(76176999)(86362001)(50986999)(316002)(15188155005)(48376002)(5660300001)(6306002)(16586007)(16799955002)(54906003)(110136005)(50466002)(305945005)(33646002)(106466001)(5003940100001)(50226002)(105606002)(53936002)(966005)(85426001)(2201001)(189998001)(8676002)(8656006)(81156014)(6666003)(4326008)(81166006)(2950100002)(97736004)(104016004)(8936002)(77096006)(47776003)(68736007)(53376002)(2906002)(498600001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2355; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD026; 1:sBtt4oKnemUV3a3gPGAVaiKuKnq8NFgOwYA5XnuHwbLONEreWZuB1yfSwjEw5+t5ENnVvNEQy4CWgtOrnUWZSEqn5Z0pkZNhbTrxwfR6hb0TGTzlbzHA6rqHD1Vpde1U MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 8f0951d6-86e4-437b-be78-08d525bd240f X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603249); SRVR:BN3PR03MB2355; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2355; 3:UBzqvG6tX53peMvngEb1R7cOQxs/9U1gBUhLvWAWB1hwpizV4TwRCYN6DNixp485jIFh9mBEYzqs6E09ZcAVhiJBWS1BJlRgrqkyQ5wrYuyqjG2z0hbPVQOOJF8bZBMYkBgtynyCH6yuUgtdH8tHtxC0lgzXh2jZHJjLxXOdOJhVFE6s2AJHRa4XtqbJFmNAMHfJ7ZwTyQdByPSChDNaFYpias5OiJ19eVoyJ1OwNHGxydJYWUTNO8xqp8CWsKepAjh0Uqy2vNnObEAPrs5ZNXPIwvMTdyqtvTlZsdENTPSYO/JfS0uo4wg43RCHPss418QeKqe7FZXycl5RCi5L6beJ2/G1cjiifAKjem7u+oE=; 25:o0OJ1/DB9vMT/+Eoh8G2Jk0gxlim6WQiQoZ7rWZeAn8WYnoH+dUQHytdTbxQFSuIiUqK4arPpGpGV/RwSCoL1q636WaVwPdh3fn49/8nombHImBiAwqNo3j3QVS+gWd9bUBeLSs9iwA85Io2KOh+RGVKFXOhQqnMFX+/iT4MiU8u7O5+ZElfBDx68IUz9MM6zVM+ZLgUDqgI20Ft1hA5d+G8YZOs9AcfG52ZcKDVN4TyXxT2q9aclPM6t8HBWOXBMRYnFg9D1bmRUi4OTEUVNtB4DXKSPpG1/FgNH8DMEXAd4xZ/72BTCeOcbxWmMLeV/dgRIjjoRBRs7wS3QZEtnQ== X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PR03MB2355: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2355; 31:gYsV0rwBsdoT+oxtOwyPZl/qmVS7sYEo71HlYU5bWEUE8TtkOUBmz24w4oNqSoH69R/szoEOw1pk61bUbNLKyW1DgM0M1XYO7VKHCcS1u/8dd4bWPAq64wO33lSNvVdRpFAx35kLfRgcAmEeuIIbI57VE7mQ9kSk+AbrnXv2ENjhJtwlWTDHEYXBrSOctN3fSGpoztszWJ6HLvHleVSeOjnjW8DRoM7nu3/c1cvdyWE=; 4:c1doazpCjHaSGq0FIpALGqKniqil7pxR0XnZFliInZSVT8kletNvFg+0F114ShGYGkgxBG+eD7kExVjJN6qiWciIgVbFB12HMYPKbLoI9Qf3CYfXVRY+4Eccn3qid+Q4rdiQJDLcOya7gJ+oK5OSbuzF8zyybPLgKi5PeU6vzKN0zQYi5hT6y2beG6pYN68mJ51W4rimMD+OdSYmebqtX2CUoi8Qcu2qu7fkfETBZUdCBJuEpodIorC0k5uy8kirRpIf1whRucwtRQz20C6BE0OPQ7IifHyPWg8o9KSzR4e9cBWyEJiDcmgg0OcdlnLo X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231021)(100000703101)(100105400095)(6055026)(6096035)(20161123559100)(20161123556025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123561025)(20161123563025)(20161123565025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR03MB2355; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR03MB2355; X-Forefront-PRVS: 0484063412 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR03MB2355; 23:M6O/CX7Mdqmd0F5oBJJ26/+t/+RJUmUF9dawSKNFE?= =?us-ascii?Q?/HemjBt23Gkht1KnSuaBZOEVXiLXuzMOnXCKF7/MnwkYCXnPNaN+k83BTfBx?= =?us-ascii?Q?vvM5nOryQ07vsDupAh2wJt7/ntGyoYs0+BuJK6F43kixCa4FxQVJPPvMFa5F?= =?us-ascii?Q?Z/b8NDzYPDMfmH/pNQu9D/hsLqpRZQC4bg6s8eM+wY8yJrUeO0hRG/7AizxL?= =?us-ascii?Q?OVuKtNIW4yrQcE4MoGP23d7PKvMfxnrqkd9BxEgdNJ7v/onj0ook+WEjpQSm?= =?us-ascii?Q?7qi0br5fpi53qyVrHlmo/pHrwTEpidYqJZVdUqXtQCARVh97ZOuUTPr4ag19?= =?us-ascii?Q?SXPB0HeG3oPp1WAOrFykkvHgcQ+/wWXhZrhy5FMQc5hMCmzAbofBTwi0UWlV?= =?us-ascii?Q?dfiOk+thJkPcF+VGfPtYYNKOb0tch13VKmvWaZfQ0C0TJh0U/RWagcP+66yi?= =?us-ascii?Q?hhcTeOEsHiTQ7uJaLYRsrH4mnXgYzeU/WEbCkMu8UEWNG5NUxYURAMA780rb?= =?us-ascii?Q?CMkd/63oOQijTDGP3BNCtKkKj/+JZyp6VMzdLkgTsI1cd65SmdaPkXokJHEH?= =?us-ascii?Q?ZaapLM/0KTnOUxvGD+JGkCMmi4kmEBtR14O9xewIgPyqQh95nToJxe4w2lQR?= =?us-ascii?Q?mbM/JMvoM80XhyY1rRhNKh7uw63sIdTXwKgzxaq3eRKfox9/E0s3TCloD09u?= =?us-ascii?Q?TCgr2O94RbfeUzFtf8TEOWQLtY7BlihFnBpHCFSJxVeonppDyhTV3ePll0Kf?= =?us-ascii?Q?7mSfeQ94H9xfpS3uMH0OYCkIuiYRa2Emm58WXGlewvFNAOxWhaLWzr4yt+nZ?= =?us-ascii?Q?vnjpvGCq8kROaWdEdM06nWyyG/h4wA4EsRPy/0i5gkZJKAjaKrQgLLioeO00?= =?us-ascii?Q?F/whpjPkJYTAfXy9FvbNZgk+N1FNqU4BS44w6KSM6LCh/nQjuGlycsNmWV2g?= =?us-ascii?Q?bqaSDsDN9yVMUgelIooBmix6ioMW2gQ2kqGpyL3WEFqDvzd6bw41JmjPZesV?= =?us-ascii?Q?UkvhIxptcxQmNb8WAJbshYk9cIU26eWvPIu+aZYEBP9Gxk2wzKQrgNL0NXaF?= =?us-ascii?Q?DOo1ETeshauM254nKGYucxzz6Jq5xYtMZKVQofQGWFvgh2nXvMgMtbwN+G3w?= =?us-ascii?Q?vS3wmv4yYN0cdaZ9JIQ2oR9EwCuHBrcgtV2svVjk1BXCMlso+aK58Y2yIj6z?= =?us-ascii?Q?xnUur2k+LXLOfER6dp5xJ6xQgehDopuUqCipIpKDIu0GHbEBtKO/g2klpepx?= =?us-ascii?Q?shDUUdngBgWFewt3BfVqpCufnqJYWmd8HDAM7l0swG8juGYTPPYfqL6LU6gJ?= =?us-ascii?B?Zz09?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2355; 6:iszac27KQkD3Ft5dIpC3ivsCgW1UNlfr1mbwnTFUqK6wZcrb/Y7zrTMamquGXUn9eyDsDAftWizFCdD41wLSKq3VWUoVptnhmvCDeRuaCGZkKzrIOiWx6aM7qTWGu+wFKNBmMRM52nUE9QYpwGub/d9SDcpO0EHIO00a1VtDd4xqlSgXPM7eUZ4X0sx5ndJYF5b9roCYMoqEsUa3XlllPxAuBGkD92Ol60gS+95rVIPdANY5pHoZi5wb6a5wlzJUDPEeT9xNDWBckvca+ACr8WbUqk93By3H74NCPyGYNQ6h7BuUxGQsUZ3A1clSAaGuFb2gY0mPeBxgFe8OnYg79jGTZufK1HzkUaPQza+Uroo=; 5:TdyOzsUqZ6xyFgKy3CfAT7UNGTn/tr487JMYBl6Qy6J81p3srorJ/HtW1qnZSwSghkTbbQOyV7hWjGN5QF36h1DT132q1dgqJ2PQHND+Yr2Rl7TKGQ81d1NOmtgc7USPKDf/oSiKfrfA3+PEn8nf0OVzEfjFeAHfIwRY06VcnVY=; 24:3Pb2RGNLU9bDCi8NywTfgmLy2KwdKlEa5vviShe91j85rbEO9SRWCR80enUMw5G/ogX01zD/8PqQ2EWLHIk249SZ7j8HIAqGvO6rOtn9cQQ=; 7:zy/0ZA0WgLIRV9DcxNA7bJOM8SrCYuhcbgEX/lHdV6on58aQu5Tj7PDTuTo0YdX55z37IHYgtmCWnjtoQDsrVIgI4gUKVG4uVvlpRLpFlgDfRmSsVk1CZd9/XFgkbFO4RHWcVhCFkdF/irpXML9qzZTWFSVvlHVHR0y89SgfhFikCD33K8tHLCrNJ3KVhADN7TbOXy4OXN9vv6A8McX85E+7bkttQs9zr+rWqvEqnP0DpaTEbCyxNaeZ0XK190xA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 08:54:22.5135 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f0951d6-86e4-437b-be78-08d525bd240f X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR03MB2355 Subject: [edk2] [PATCH 03/10] Platform/NXP: Add support for Big Endian Mmio APIs X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This library add supports for BE read/write and other MMIO helper function. In this data swapped after reading from MMIO and before write using MMIO. It can be used by any module with BE address space. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- Platform/NXP/Include/Library/BeIoLib.h | 332 +++++++++++++++++++++++++ Platform/NXP/Library/BeIoLib/BeIoLib.c | 400 +++++++++++++++++++++++++++= ++++ Platform/NXP/Library/BeIoLib/BeIoLib.inf | 31 +++ 3 files changed, 763 insertions(+) create mode 100644 Platform/NXP/Include/Library/BeIoLib.h create mode 100644 Platform/NXP/Library/BeIoLib/BeIoLib.c create mode 100644 Platform/NXP/Library/BeIoLib/BeIoLib.inf diff --git a/Platform/NXP/Include/Library/BeIoLib.h b/Platform/NXP/Include/= Library/BeIoLib.h new file mode 100644 index 0000000..209262d --- /dev/null +++ b/Platform/NXP/Include/Library/BeIoLib.h @@ -0,0 +1,332 @@ +/** BeIoLib.h + * + * Copyright 2017 NXP + * + * 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 + * + * HE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR I= MPLIED. + * + **/ + +#ifndef __BE_IOLIB_H__ +#define __BE_IOLIB_H__ + +#include + +/** + MmioRead8 for Big-Endian modules. + + @param Address The MMIO register to read. + + @return The value read. + +**/ +UINT8 +EFIAPI +BeMmioRead8 ( + IN UINTN Address + ); + +/** + MmioRead16 for Big-Endian modules. + + @param Address The MMIO register to read. + + @return The value read. + +**/ +UINT16 +EFIAPI +BeMmioRead16 ( + IN UINTN Address + ); + +/** + MmioRead32 for Big-Endian modules. + + @param Address The MMIO register to read. + + @return The value read. + +**/ +UINT32 +EFIAPI +BeMmioRead32 ( + IN UINTN Address + ); + +/** + MmioRead64 for Big-Endian modules. + + @param Address The MMIO register to read. + + @return The value read. + +**/ +UINT64 +EFIAPI +BeMmioRead64 ( + IN UINTN Address + ); + +/** + MmioWrite8 for Big-Endian modules. + + @param Address The MMIO register to write. + @param Value The value to write to the MMIO register. + +**/ +UINT8 +EFIAPI +BeMmioWrite8 ( + IN UINTN Address, + IN UINT8 Value + ); + +/** + MmioWrite16 for Big-Endian modules. + + @param Address The MMIO register to write. + @param Value The value to write to the MMIO register. + +**/ +UINT16 +EFIAPI +BeMmioWrite16 ( + IN UINTN Address, + IN UINT16 Value + ); + +/** + MmioWrite32 for Big-Endian modules. + + @param Address The MMIO register to write. + @param Value The value to write to the MMIO register. + +**/ +UINT32 +EFIAPI +BeMmioWrite32 ( + IN UINTN Address, + IN UINT32 Value + ); + +/** + MmioWrite64 for Big-Endian modules. + + @param Address The MMIO register to write. + @param Value The value to write to the MMIO register. + +**/ +UINT64 +EFIAPI +BeMmioWrite64 ( + IN UINTN Address, + IN UINT64 Value + ); + +/** + MmioAndThenOr8 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + @param OrData The value to OR with the result of the AND operation. + + @return The value written back to the MMIO register. + +**/ +UINT8 +EFIAPI +BeMmioAndThenOr8 ( + IN UINTN Address, + IN UINT8 AndData, + IN UINT8 OrData + ); + +/** + MmioAndThenOr16 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + @param OrData The value to OR with the result of the AND operation. + + @return The value written back to the MMIO register. + +**/ +UINT16 +EFIAPI +BeMmioAndThenOr16 ( + IN UINTN Address, + IN UINT16 AndData, + IN UINT16 OrData + ); + +/** + MmioAndThenOr32 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + @param OrData The value to OR with the result of the AND operation. + + @return The value written back to the MMIO register. + +**/ +UINT32 +EFIAPI +BeMmioAndThenOr32 ( + IN UINTN Address, + IN UINT32 AndData, + IN UINT32 OrData + ); + +/** + MmioAndThenOr64 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + @param OrData The value to OR with the result of the AND operation. + + @return The value written back to the MMIO register. + +**/ +UINT64 +EFIAPI +BeMmioAndThenOr64 ( + IN UINTN Address, + IN UINT64 AndData, + IN UINT64 OrData + ); + +/** + MmioOr8 for Big-Endian modules. + + @param Address The MMIO register to write. + @param OrData The value to OR with the read value from the MMIO regist= er. + + @return The value written back to the MMIO register. + +**/ +UINT8 +EFIAPI +BeMmioOr8 ( + IN UINTN Address, + IN UINT8 OrData + ); + +/** + MmioOr16 for Big-Endian modules. + + @param Address The MMIO register to write. + @param OrData The value to OR with the read value from the MMIO regist= er. + + @return The value written back to the MMIO register. + +**/ +UINT16 +EFIAPI +BeMmioOr16 ( + IN UINTN Address, + IN UINT16 OrData + ); + +/** + MmioOr32 for Big-Endian modules. + + @param Address The MMIO register to write. + @param OrData The value to OR with the read value from the MMIO regist= er. + + @return The value written back to the MMIO register. + +**/ +UINT32 +EFIAPI +BeMmioOr32 ( + IN UINTN Address, + IN UINT32 OrData + ); + +/** + MmioOr64 for Big-Endian modules. + + @param Address The MMIO register to write. + @param OrData The value to OR with the read value from the MMIO regist= er. + + @return The value written back to the MMIO register. + +**/ +UINT64 +EFIAPI +BeMmioOr64 ( + IN UINTN Address, + IN UINT64 OrData + ); + +/** + MmioAnd8 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + + @return The value written back to the MMIO register. + +**/ +UINT8 +EFIAPI +BeMmioAnd8 ( + IN UINTN Address, + IN UINT8 AndData + ); + +/** + MmioAnd16 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + + @return The value written back to the MMIO register. + +**/ +UINT16 +EFIAPI +BeMmioAnd16 ( + IN UINTN Address, + IN UINT16 AndData + ); + +/** + MmioAnd32 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + + @return The value written back to the MMIO register. + +**/ +UINT32 +EFIAPI +BeMmioAnd32 ( + IN UINTN Address, + IN UINT32 AndData + ); + +/** + MmioAnd64 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + + @return The value written back to the MMIO register. + +**/ +UINT64 +EFIAPI +BeMmioAnd64 ( + IN UINTN Address, + IN UINT64 AndData + ); + +#endif /* _BE_IOLIB_H */ diff --git a/Platform/NXP/Library/BeIoLib/BeIoLib.c b/Platform/NXP/Library/= BeIoLib/BeIoLib.c new file mode 100644 index 0000000..b4e7c90 --- /dev/null +++ b/Platform/NXP/Library/BeIoLib/BeIoLib.c @@ -0,0 +1,400 @@ +/** BeIoLib.c + + Provide MMIO APIs for BE modules. + + Copyright 2017 NXP + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the BS= D License + which accompanies this distribution. The full text of the license may b= e 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 IMP= LIED. + +**/ + +#include +#include +#include + +/** + MmioRead8 for Big-Endian modules. + + @param Address The MMIO register to read. + + @return The value read. + +**/ +UINT8 +EFIAPI +BeMmioRead8 ( + IN UINTN Address + ) +{ + return MmioRead8(Address); +} + +/** + MmioRead16 for Big-Endian modules. + + @param Address The MMIO register to read. + + @return The value read. + +**/ +UINT16 +EFIAPI +BeMmioRead16 ( + IN UINTN Address + ) +{ + return SwapBytes16(MmioRead16(Address)); +} + +/** + MmioRead32 for Big-Endian modules. + + @param Address The MMIO register to read. + + @return The value read. + +**/ +UINT32 +EFIAPI +BeMmioRead32 ( + IN UINTN Address + ) +{ + return SwapBytes32(MmioRead32(Address)); +} + +/** + MmioRead64 for Big-Endian modules. + + @param Address The MMIO register to read. + + @return The value read. + +**/ +UINT64 +EFIAPI +BeMmioRead64 ( + IN UINTN Address + ) +{ + return SwapBytes64(MmioRead64(Address)); +} + +/** + MmioWrite8 for Big-Endian modules. + + @param Address The MMIO register to write. + @param Value The value to write to the MMIO register. + +**/ +UINT8 +EFIAPI +BeMmioWrite8 ( + IN UINTN Address, + IN UINT8 Value + ) +{ + return MmioWrite8(Address, Value); +} + +/** + MmioWrite16 for Big-Endian modules. + + @param Address The MMIO register to write. + @param Value The value to write to the MMIO register. + +**/ +UINT16 +EFIAPI +BeMmioWrite16 ( + IN UINTN Address, + IN UINT16 Value + ) +{ + return MmioWrite16(Address, SwapBytes16(Value)); +} + +/** + MmioWrite32 for Big-Endian modules. + + @param Address The MMIO register to write. + @param Value The value to write to the MMIO register. + +**/ +UINT32 +EFIAPI +BeMmioWrite32 ( + IN UINTN Address, + IN UINT32 Value + ) +{ + return MmioWrite32(Address, SwapBytes32(Value)); +} + +/** + MmioWrite64 for Big-Endian modules. + + @param Address The MMIO register to write. + @param Value The value to write to the MMIO register. + +**/ +UINT64 +EFIAPI +BeMmioWrite64 ( + IN UINTN Address, + IN UINT64 Value + ) +{ + return MmioWrite64(Address, SwapBytes64(Value)); +} + +/** + MmioAndThenOr8 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + @param OrData The value to OR with the result of the AND operation. + + @return The value written back to the MMIO register. + +**/ +UINT8 +EFIAPI +BeMmioAndThenOr8 ( + IN UINTN Address, + IN UINT8 AndData, + IN UINT8 OrData + ) +{ + return MmioAndThenOr8(Address, AndData, OrData); +} + +/** + MmioAndThenOr16 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + @param OrData The value to OR with the result of the AND operation. + + @return The value written back to the MMIO register. + +**/ +UINT16 +EFIAPI +BeMmioAndThenOr16 ( + IN UINTN Address, + IN UINT16 AndData, + IN UINT16 OrData + ) +{ + AndData =3D SwapBytes16(AndData); + OrData =3D SwapBytes16(OrData); + + return MmioAndThenOr16(Address, AndData, OrData); +} + +/** + MmioAndThenOr32 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + @param OrData The value to OR with the result of the AND operation. + + @return The value written back to the MMIO register. + +**/ +UINT32 +EFIAPI +BeMmioAndThenOr32 ( + IN UINTN Address, + IN UINT32 AndData, + IN UINT32 OrData + ) +{ + AndData =3D SwapBytes32(AndData); + OrData =3D SwapBytes32(OrData); + + return MmioAndThenOr32(Address, AndData, OrData); +} + +/** + MmioAndThenOr64 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + @param OrData The value to OR with the result of the AND operation. + + @return The value written back to the MMIO register. + +**/ +UINT64 +EFIAPI +BeMmioAndThenOr64 ( + IN UINTN Address, + IN UINT64 AndData, + IN UINT64 OrData + ) +{ + AndData =3D SwapBytes64(AndData); + OrData =3D SwapBytes64(OrData); + + return MmioAndThenOr64(Address, AndData, OrData); +} + +/** + MmioOr8 for Big-Endian modules. + + @param Address The MMIO register to write. + @param OrData The value to OR with the read value from the MMIO regist= er. + + @return The value written back to the MMIO register. + +**/ +UINT8 +EFIAPI +BeMmioOr8 ( + IN UINTN Address, + IN UINT8 OrData + ) +{ + return MmioOr8(Address, OrData); +} + +/** + MmioOr16 for Big-Endian modules. + + @param Address The MMIO register to write. + @param OrData The value to OR with the read value from the MMIO regist= er. + + @return The value written back to the MMIO register. + +**/ +UINT16 +EFIAPI +BeMmioOr16 ( + IN UINTN Address, + IN UINT16 OrData + ) +{ + return MmioOr16(Address, SwapBytes16(OrData)); +} + +/** + MmioOr32 for Big-Endian modules. + + @param Address The MMIO register to write. + @param OrData The value to OR with the read value from the MMIO regist= er. + + @return The value written back to the MMIO register. + +**/ +UINT32 +EFIAPI +BeMmioOr32 ( + IN UINTN Address, + IN UINT32 OrData + ) +{ + return MmioOr32(Address, SwapBytes32(OrData)); +} + +/** + MmioOr64 for Big-Endian modules. + + @param Address The MMIO register to write. + @param OrData The value to OR with the read value from the MMIO regist= er. + + @return The value written back to the MMIO register. + +**/ +UINT64 +EFIAPI +BeMmioOr64 ( + IN UINTN Address, + IN UINT64 OrData + ) +{ + return MmioOr64(Address, SwapBytes64(OrData)); +} + +/** + MmioAnd8 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + + @return The value written back to the MMIO register. + +**/ +UINT8 +EFIAPI +BeMmioAnd8 ( + IN UINTN Address, + IN UINT8 AndData + ) +{ + return MmioAnd8(Address, AndData); +} + +/** + MmioAnd16 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + + @return The value written back to the MMIO register. + +**/ +UINT16 +EFIAPI +BeMmioAnd16 ( + IN UINTN Address, + IN UINT16 AndData + ) +{ + return MmioAnd16(Address, SwapBytes16(AndData)); +} + +/** + MmioAnd32 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + + @return The value written back to the MMIO register. + +**/ +UINT32 +EFIAPI +BeMmioAnd32 ( + IN UINTN Address, + IN UINT32 AndData + ) +{ + return MmioAnd32(Address, SwapBytes32(AndData)); +} + +/** + MmioAnd64 for Big-Endian modules. + + @param Address The MMIO register to write. + @param AndData The value to AND with the read value from the MMIO regis= ter. + + @return The value written back to the MMIO register. + +**/ +UINT64 +EFIAPI +BeMmioAnd64 ( + IN UINTN Address, + IN UINT64 AndData + ) +{ + return MmioAnd64(Address, SwapBytes64(AndData)); +} diff --git a/Platform/NXP/Library/BeIoLib/BeIoLib.inf b/Platform/NXP/Librar= y/BeIoLib/BeIoLib.inf new file mode 100644 index 0000000..ca64d8f --- /dev/null +++ b/Platform/NXP/Library/BeIoLib/BeIoLib.inf @@ -0,0 +1,31 @@ +## @BeIoLib.inf + +# Copyright 2017 NXP +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the B= SD 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 IM= PLIED. +# +## + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D BeIoLib + FILE_GUID =3D 28d77333-77eb-4faf-8735-130e5eb3e343 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D BeIoLib + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + IoLib + +[Sources.common] + BeIoLib.c --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel