From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=104.47.36.45; helo=nam02-sn1-obe.outbound.protection.outlook.com; envelope-from=meenakshi.aggarwal@nxp.com; receiver=edk2-devel@lists.01.org Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0045.outbound.protection.outlook.com [104.47.36.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D5DB021B00DD4 for ; Sun, 26 Nov 2017 20:59:32 -0800 (PST) Received: from BN3PR03CA0054.namprd03.prod.outlook.com (2a01:111:e400:7a4d::14) by SN2PR03MB2367.namprd03.prod.outlook.com (2603:10b6:804:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Mon, 27 Nov 2017 05:03:52 +0000 Received: from BY2FFO11FD014.protection.gbl (2a01:111:f400:7c0c::170) by BN3PR03CA0054.outlook.office365.com (2a01:111:e400:7a4d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Mon, 27 Nov 2017 05:03:52 +0000 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; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD014.mail.protection.outlook.com (10.1.14.76) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Mon, 27 Nov 2017 05:03:52 +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 vAR53iMT000785; Sun, 26 Nov 2017 22:03:49 -0700 From: Meenakshi Aggarwal To: , , , Date: Mon, 27 Nov 2017 16:21:49 +0530 Message-ID: <1511779917-9255-2-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> References: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131562326324701306; (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)(39860400002)(39380400002)(376002)(346002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(2906002)(305945005)(356003)(86362001)(2950100002)(97736004)(77096006)(104016004)(105606002)(47776003)(81166006)(106466001)(8676002)(51416003)(50466002)(53376002)(966005)(4326008)(48376002)(81156014)(8656006)(50986999)(5660300001)(189998001)(53936002)(33646002)(85426001)(16799955002)(54906003)(316002)(110136005)(16586007)(15188155005)(6306002)(68736007)(50226002)(36756003)(2201001)(8936002)(76176999)(498600001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB2367; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD014; 1:qd12309mmpcA8NihnRymTikHNsq6dZhXoxdwlzBly/0UD9hU5Mr6Sf1VJ90Gi+iIEuoYxLXSxhkI8NR0+fXu1eQctJNdLOygW+fkJcmGFiVITa+ezgOu6tMEOTv0XhUp MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 844b721f-faa5-4700-687a-08d5355440df X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603258); SRVR:SN2PR03MB2367; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2367; 3:q6WETtA893feFLhb3knA71oCJjV2Ed0cU0BgpZkPqvp8G288yVca+wtE5hJGno4xJ8HtQYZyYEBo9SmUaw6I6HU/8M3Q9/wRP2ML9XLWlbKNViGekaSxcXi18OEq8spBUs2C4RjOCO6LCoEjicTr9x7cI7CI8npXGRzZF+QuSa4gPTATRGFPEHru14043/osO1lwqZz10SPAlMmFWj5ggkw5VGih6rTkrqLOVNjOJAvuNKCT/Rqrfl88Ik9NTBpf2qy3SnfsPfuOOX50xwn0v7ewXayfHoQ7jUk2aAKcE1hf62ee8Vi8/MTj2S4LfnhcoZ2noSsScVrwkiGTFlXnAOfarcnHZWAUSf6Iv/zHFro=; 25:QYsaapgUoPTO3N/4z5NtvejuJR7gcziQjeLlh6eoKxvpT+RmjWrQcQ7TfK9OU3VyLRKZuFObDtctkPSn5lwNZBQCVT+BHXsdP/dInNg/eq9uzMeYnEK7r2qX/jZA1+gt0tDS4t1cYzD17UMaCrLig0VqQuoUGhlB6IDNx5NMkMARG+aKCfPDr7Kuw0S+kMCWqR+QvqxcFyJJCrQLC6aryb729KwJbc0VHDmYUUVJXs8Ad0QFovAf+VX+d61zc5mty7kxyaiQp/1Qy7HvmDxFAXDdBdOFhYm0Gl34SXOCWDIdTLiwTgWmX0Mo0ETIWwwAdHT0LfNdQFegIX5+vRo52A== X-MS-TrafficTypeDiagnostic: SN2PR03MB2367: X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2367; 31:wHpCUVYxabkUo3mOT6bDD7U75M5ecPRE3K5cVVLPyWE+XDmcqsq2PeZKZNAupUGamCDOBqsQlG+U/322szvU058geRvbUU/Zdg4fZUL0h6GhZXKpsAgtk07uf7XwMpQEp7maOXx9zrPsk2J0vEebJmnCbWXsh/AuVVPTQQ65A31ZDSKYOj2dt05F5JSoGjhG+3kHRlhOU0Fcaw7p7RqCrFOdvOqbpOMmrtGwky1YqJo=; 4:xitzcRibfmVSJ1S6F5RK0sobq6CfRgPD243miB9mhD1AmM7UGX/J0dR0MqyumIecXzRLffe05ywLIKFY9yhNE+K0d71Pl3ShvjlUcA2sWlONpNJ9JzR00qFg7qgO9jQyuo4pN+TuDIMCEQ7VSMxgJ6CSecb8ep6anj0Fqcz+e/ae75MgaMZAJe0KQw1mqE7zgO7fiBWeXB6QCEyTbuj5xe1dlOCpGgcVDz0Qh5rq/wx92Si10DI7trUUgzKzkx5gwSrqMwvvX7Bdu9/Krlpgq2mVLFJeCOMw9Zfvum7RreXoA3EZPdiND2J8B1KOhpxu X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231022)(93006095)(93001095)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123559100)(20161123565025)(20161123563025)(20161123556025)(20161123561025)(201708071742011); SRVR:SN2PR03MB2367; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:SN2PR03MB2367; X-Forefront-PRVS: 0504F29D72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR03MB2367; 23:OrS/t2IBl1e3AF9Z84WaWWBjEm7pZatwuBt4MbxYW?= =?us-ascii?Q?eMiMoH34idn7y32BQQbQXJaVO3OJA8g1My9BpPk0pr0IHN6fcnyfsCG6ZY1t?= =?us-ascii?Q?LvHc1Rhsncj1xtdKNcXamMSLPP0qgmlg1c0N+MNoVlpq7xiflWwoDpJZrTT2?= =?us-ascii?Q?DFUl3kcVCLOm1Sjb4/rTfvIEEyHUbXvRbVjRYGKahkFNeWfCbULLwXXUpkTQ?= =?us-ascii?Q?vXd/PNaTKxnYN9Qas11cJF5BVneT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BIrVBealAVWUUtVAt048qAxe5WJqIB3i/fink233Qy2m9Y SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2017 05:03:52.2673 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 844b721f-faa5-4700-687a-08d5355440df 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: SN2PR03MB2367 Subject: [PATCH edk2-platforms] [PATCH v3 1/9] 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: , X-List-Received-Date: Mon, 27 Nov 2017 04:59:33 -0000 Content-Type: text/plain 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..639674f --- /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 + * + * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + * + **/ + +#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 register. + @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 register. + @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 register. + @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 register. + @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 register. + + @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 register. + + @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 register. + + @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 register. + + @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 register. + + @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 register. + + @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 register. + + @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 register. + + @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..c3d2cf8 --- /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 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. + +**/ + +#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 register. + @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 register. + @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 = SwapBytes16 (AndData); + OrData = 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 register. + @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 = SwapBytes32 (AndData); + OrData = 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 register. + @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 = SwapBytes64 (AndData); + OrData = 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 register. + + @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 register. + + @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 register. + + @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 register. + + @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 register. + + @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 register. + + @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 register. + + @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 register. + + @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/Library/BeIoLib/BeIoLib.inf new file mode 100644 index 0000000..7e8e32c --- /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 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 = 0x0001001A + BASE_NAME = BeIoLib + FILE_GUID = 28d77333-77eb-4faf-8735-130e5eb3e343 + MODULE_TYPE = BASE + VERSION_STRING = 1.0 + LIBRARY_CLASS = BeIoLib + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + IoLib + +[Sources.common] + BeIoLib.c -- 1.9.1