From nobody Wed Dec 25 02:35:00 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 15113448581101007.7272598910413; Wed, 22 Nov 2017 02:00:58 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id C01C82035BB20; Wed, 22 Nov 2017 01:56:40 -0800 (PST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0048.outbound.protection.outlook.com [104.47.37.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 43A722034C5F2 for ; Wed, 22 Nov 2017 01:56:38 -0800 (PST) Received: from BN3PR03CA0068.namprd03.prod.outlook.com (10.167.1.156) by CY4PR03MB2695.namprd03.prod.outlook.com (10.173.43.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.239.5; Wed, 22 Nov 2017 10:00:53 +0000 Received: from BN1BFFO11FD035.protection.gbl (2a01:111:f400:7c10::1:100) by BN3PR03CA0068.outlook.office365.com (2a01:111:e400:7a4d::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.239.5 via Frontend Transport; Wed, 22 Nov 2017 10:00:53 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD035.mail.protection.outlook.com (10.58.144.98) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Wed, 22 Nov 2017 10:00:53 +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 vAMA0nI4030922; Wed, 22 Nov 2017 03:00:50 -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.37.48; helo=nam02-cy1-obe.outbound.protection.outlook.com; envelope-from=meenakshi.aggarwal@nxp.com; receiver=edk2-devel@lists.01.org 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: Wed, 22 Nov 2017 21:18:52 +0530 Message-ID: <1511365740-1157-1-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: 131558184532417572; (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)(346002)(39860400002)(39380400002)(376002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(105606002)(16799955002)(15188155005)(106466001)(81156014)(110136005)(8676002)(77096006)(81166006)(305945005)(356003)(36756003)(33646002)(54906003)(97736004)(50986999)(16586007)(76176999)(53376002)(316002)(53936002)(5660300001)(4326008)(47776003)(6306002)(966005)(8936002)(5003940100001)(50226002)(50466002)(498600001)(48376002)(8656006)(2906002)(86362001)(2201001)(189998001)(104016004)(2950100002)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR03MB2695; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD035; 1:RfzjNRunGdxh59dEfad7oAkN6EuF6KyVO7iQlPS1wCdtXABdMfba3r7JaYao12evM6DxoetgtJLOAEcWhdHITGTurWX9kiEcsnzxZZAk2OK4vK/gu7buJqoG4UxCyP9W MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8fd6f954-5dca-4896-9c24-08d5318fead0 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600022)(4604075)(4534020)(4628075)(201703131517081)(2017052603258); SRVR:CY4PR03MB2695; X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2695; 3:0/Yvw8iL0tvBcFHP9IzjfJpw3FPpa+h9D4g/b+C/QhtP6j5V1bHpxxMrhEreS2Q2HpZ7kmFFDHJRfx6O2MgfdSCMK5MHs2/RZ8GXik3nq7Sp6bTT8F8mNqm8dptK4Zn85JqewrHWF5RxG55Elm1oAi5hC04FyRaInEIfLgChO5rmBhOiwzYS8r8LpI/5zyDAorMSLt7GAtnm9Ue2+/xNv3Q9sU+nb3o/omhVurkvnlPdoVg0P6gpeA7TRsZrPtZ7KxRy2/ESPI8RZiZAVe5dZrLD58QqxZo/5BBc9HAqyCWy3VVDYFpGjoUIWfZGiLtCE8V6/AppOIYLsWC1MHPjzbweXF9HLdsiwM8YN0IV4c4=; 25:dmKWtnqJkFagnqDJ9jAWMBEbbb/8zgdjjugihYyHwqcnXjtTg/+aAR7zdgo9HTkfcvn3qKIvTPIFgqhe9i0pAgGXIC9HRRrCNCk9jo9yKjmUv56Jx1WqDFZo5PafdsgUDaHviGoUrDvLAnu8c/viriMZe7pFc2MPCZwSp5uyPfyWc7SBC2KHi2qhR0i+Dhu9V5xL+36y+7kbRFxqQJxEaD2ju46a0VSb4mNVo5NMBQKZWzyHAWxekzBmz8Sv/z51SQ4dg3tdYX1jKCOLdvy48xL5w2c5QsgN5zoMX7FGWPtp4SweAdLrb2zVQZ8zeeP41wdJBFYzhCs2GcoYToroYoq1Vn+TSOIVFxbD2G1gjHY= X-MS-TrafficTypeDiagnostic: CY4PR03MB2695: X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2695; 31:UnAbreuq17ZF6I36ARs8OnTxgUA+ctTjPLZPvAacOK5MdF74mY7XfLggKNNZg19tIBbWE8/sowj5YT7XHWjk283p6qu8mRmUbWAxyc74e5q5TYMyh0JruJxDMwvYjH7N8/HOJE23pDysoPzLax10krbVBWoKBy5hhlh3z+ZwqMAZjS7PR2OdmdMA0+OY9lwE42D57QstxxeaML2jR8QPxfPpu6cdF2QVpTVPi87lztk=; 4:DC8MoaL+h3nftthUgFhsUvo1wQyJNs0Qfzk1WvqtAY3qhFzeoYq7GTgjPCzQLb8iS2Ga+Y9ZkHpZiJs9wR3gXAK/SA4yl1V9pTyLgdAx1/P1Rag6L89cw4c6b9b0una0PrKFG2/2kSCdV3cZQvEG8je5lQtTNR+U/RVZPRZ2G3eWkDpHyjJoCi6xAUb1i/VgTBvJjlUgGmCFjMi2jnkbxIKryUdm+2EV5jPdDOgTdTNrSvSuqy7GNVcfBYF6NGAVybW6lWrJCDjGYN9EmYptJ+2cf0GGIbIyhpwV9RHp8iApwnCgwSMxmXs8+Hxw1APm X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(100000703101)(100105400095)(3231022)(10201501046)(3002001)(6055026)(6096035)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123559100)(20161123561025)(20161123565025)(20161123563025)(20161123556025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY4PR03MB2695; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY4PR03MB2695; X-Forefront-PRVS: 0499DAF22A X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY4PR03MB2695; 23:rD4zcLkjbFfr5mCtWCD0NaEEF7EyDABN4REPG17KQ?= =?us-ascii?Q?yqQOc66qXovoZFbtpOO2CsXVmXhdnMiZfMc4WYthU7xvRGuFiDaSfS4fxsVQ?= =?us-ascii?Q?iU01t8T03kCXLOIExSKyblN6//8Eyd/MnRIbefs2uvOcSfQDMyIHkNdMRJYL?= =?us-ascii?Q?XOA3QjSXtuabbPXbUH7MmWVQQEBho8eJl+gs3vMwv3Y8C4NaRYvIofSdX6R3?= =?us-ascii?Q?b6fE04hwOsScMESeUa9BVCT44vFKZs3UmstcZMUGiB+YQltPALWBlVbbXLzi?= =?us-ascii?Q?/qaP2um6iFzVxf5alyj3HJfL+aehBqe4raEREusfdIuPUI3poS1RgvqkXsMm?= =?us-ascii?Q?axjWBI2cE7S1D9OvTW0CLluBk+awUnxoKSlq5qtMbWXbcPij1VHqWqCSJKQH?= =?us-ascii?Q?gjCNkifv65rQUj4B8vWWZA3BKhEXI9iLI9P63HGCGo623963V4O6zHifR72k?= =?us-ascii?Q?topJ3+VfxkC9JDJQThCfUZNJsGU76Ft8ZinKES5+4gpAVxQW+psoFyLBYwkD?= =?us-ascii?Q?eZgOP2zcTt6axbCYJ0pLtKFR2TzcXR0OQw5hM7cOufRQd/PAJoedyuMrYPdA?= =?us-ascii?Q?t/Uazp/DlvPIf9/DfVPEgWudTj8tVXo2EyF5xbYxID1exGODhHG/Fk1MTPpY?= =?us-ascii?Q?z9NSGNMYrPk7gr/CHd/4ch3JMjk11oVhVuj9OgmbJNyPOqYWJpuyaGZsK9I3?= =?us-ascii?Q?lHmY/reF1NOn08oISpf6DuP90xTFWvM9hvuXrpLAQff+/rJ7owHGbfUelYGy?= =?us-ascii?Q?PYsblNQFlk8rnQifx4zWP9DiAL6et21CH339XqYUTMdfO96qYwTzGQz1jCBD?= =?us-ascii?Q?nrqrOkEfbC987+1LsGX4krutGZT1IZeMxptxw8HHvcCDYVN/umwTUFqYTIRY?= =?us-ascii?Q?niokjatkdiUAa+9bfzn7axqwKPIo69IJStAzSGcvrbWRKr6013Hv5zqn/DMI?= =?us-ascii?Q?1xpEgFmhugWg5ukdC3YJat+SLa/CA15qV5O54dLFqXYaVp/ru07a4/bhYJlg?= =?us-ascii?Q?KWFAGalj1d6F6l5VnbelB3ijRTzJFMzPh44jRuOIV/dHzWP8WFzSqHVUeQAG?= =?us-ascii?Q?kLPzCcHsS+0GpVyVgrDV7KlpGreeNEzhCuwFNkzBud9mWYBqHTI9HhdOZrGr?= =?us-ascii?Q?55IN3D+8y/orxDsfvmThHoZ5hHRP4yqVJi7USfwdOCZQcVxOvCwSNIwX/+Dv?= =?us-ascii?Q?mbIDphi+iyjv1XwWvN9IwkxYz93YR2fqMMN5ZdxnyUcMooEZz03qT12K2rFn?= =?us-ascii?Q?f8L3XB69ClCO2f2Ud4=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY4PR03MB2695; 6:jMSwNb9DxaP2LXU8USOlMbodLIm7ZFol4Pt3Fko/gLo/oVUxBxkgL+YYq4yiTUswhTnkncPU7RXlv6FbYZhaowm1E+BYGy6Jgs1m5LwxNHo+Y7XAfvnTIrOjTA1GMVMy+rtdAAymCU8mo6f0VtUMAlYtUPrhInxWWVaXUYEfoZFnrinHiyVou5S1nDULEEWbhinLO768eFEx4QPipl5aCan7Dxkh5ebXTZF7csfjxTwbAV/hw/VQ81N/GPvnfXH7Q4q+ozkAn3PCgY31q5zPenPGaEwaNuUGrTrMhvYFVJTKH8b3l8yfd8GTZSvBwH9viynRNBjBYR7THS6Yr3Lqh0OcULvyLyU+HyyKOpfcOw4=; 5:O/36AhvlwgtreBO5+R6jNNNNaU4sCrwegIqtTA0hlcIj4751RMIEw7twpZzouEGjgPN6Bjmab9EL1NxHGB/9l1zUzvNqlNvYYwCpv9xItFkwXa9Lk8TgcipDFj51kl7Fdgdkv+WeofaYi0t/aCQ/1hNl5VByN9Oi2xaoPYbVc1c=; 24:RqFwSmaXkVTsran+NqAHBVsRPG5SjqPRP81ruUFrAKheIKNmYH5PdDcAaq8vDzcwx+Ia3QyyHVbaVcOA6OyPaP5N/5sapcJsqW8SwlDzihE=; 7:iFN2lkWn7nX3CO0lY6N3e3P8iT1NZ4bXUGu5/LbUngb2+oGrQ5wUjuo94yTurvHE4HUVUOQXEUxGaeg6aFOc6LPVt78VeMbLL2U4FPwTqh958TcExEIEvHdrQ9YnaGiPa32L1Xnqh/puNE1DMfuESDd//ByJ7h617t8/uduf1kEh5unxMz98CC3dFmg9VX851lTqFyVsuLefY8HI0dD2Oh7Ev2ins4oDsxC9EZnLMhoK8dQPxp6Y1gnKpgWcYVcp SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2017 10:00:53.0701 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8fd6f954-5dca-4896-9c24-08d5318fead0 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: CY4PR03MB2695 Subject: [edk2] [PATCH v2 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: , 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 Reviewed-by: Leif Lindholm --- 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..a58883a --- /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 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..b4b12ac --- /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..8c466e8 --- /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 0x0001001A + 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 From nobody Wed Dec 25 02:35:00 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 1510044858526289.9039165357293; Tue, 7 Nov 2017 00:54:18 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id EF0C62034D833; Tue, 7 Nov 2017 00:50:17 -0800 (PST) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0051.outbound.protection.outlook.com [104.47.34.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 93F922034D825 for ; Tue, 7 Nov 2017 00:50:16 -0800 (PST) Received: from BN3PR03CA0080.namprd03.prod.outlook.com (10.167.1.168) by DM5PR03MB2697.namprd03.prod.outlook.com (10.168.197.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Tue, 7 Nov 2017 08:54:15 +0000 Received: from BN1BFFO11FD004.protection.gbl (2a01:111:f400:7c10::1:163) by BN3PR03CA0080.outlook.office365.com (2a01:111:e400:7a4d::40) 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:14 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD004.mail.protection.outlook.com (10.58.144.67) 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:14 +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 vA78s4DY009319; Tue, 7 Nov 2017 01:54:11 -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.34.51; helo=nam01-by2-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:07 +0530 Message-ID: <1510065736-9394-2-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: 131545184547706598; (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)(346002)(39380400002)(376002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(50466002)(48376002)(305945005)(104016004)(77096006)(54906003)(110136005)(2950100002)(2201001)(33646002)(36756003)(356003)(50986999)(97736004)(189998001)(2906002)(76176999)(85426001)(47776003)(105606002)(316002)(81166006)(81156014)(8936002)(5003940100001)(106466001)(498600001)(8656006)(8676002)(6306002)(6666003)(50226002)(5660300001)(4326008)(53936002)(68736007)(16586007)(966005)(16799955002)(575784001)(86362001)(53376002)(15188155005)(21314002)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2697; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD004; 1:nm8+g2RxGrD1JZSuo6MlAhB227/nxbfqV8Bq1jBk5M0sA87oAPCrvAGSWIe9dYfMnYeqrcwitujqrb75ceC4TCdudswL0U5638YKgR7s0QmCL1VL+UI0+VaZlpkWH7i1 MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: a917a745-5598-4b12-00d6-08d525bd1f32 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603199); SRVR:DM5PR03MB2697; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2697; 3:IE1Q6W5aQ/IbpTlhhupiR4X0GVyb8AIGyvRkpM6Pn+NpxRuQf4ncJX2Qmxhzriui5hEX3AYgoXvBOsxKBc17zLVBEvzhkDxZEgZ284nn9QyfR76dU7VigkiViyvBMIBq2Aa+35S0yHL7wjxcE86Kpj/C0LC2iablw98nVqNDDHRBkZnmNaywCQO714pHqzEv3+4aLkjp1/wmNQNreMd39KKVlDCO5tx7iQJ1pYDH3cPJRQmJF29ckMOJEbD2q0boouWjphdFOQTqYv8Yuhn1my1sYji0OTVzxazpbS3ns1pSCE7VFHDtgVMBcBIC+5OkulMoAcrob3InrJot+Y0LlxkvoUzgYhZVj1sGDYAkSos=; 25:CUzy933gHU/ZeOygo2Wm/OGUsIpnjIXz9/m5ilU3sDez3E95Djfl2ddQWtT34VJWkdKwSaY7AAlVkyk9HyXlU0c9Akrug9ikFJt81sEpzRrq07LdrStfADiwFOseTzuU0I3kZPDBNO/3phxJwY6BKBgsS6jrWesPAXZNdwPVvcYuHeJ2LJ4MzWPjccxoGCV7R93Xv/nkXfRgcvpQ5RM8572NAZcBcJuSHVr8t8dqwRvUDO/WjkSn5lGS1B7b/nXxpYaxILQjygSbKY4/mjt0nnDalV47nSqZj1+qfQUwOEGvMSEi9v5CSnumtoyPrVUamIIQnTsLQ+G27DeA0Mbhow== X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM5PR03MB2697: X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2697; 31:RIxLQ2t0toYh9fBTbNoyjGKNRjcH8bXKCCttDH/iOJoGpOmZa8OdnXdmZKjqfyHM0e8joodyEFZ7rmSSW/Ww8j0Jp33mFqjPOqj8Q6UySWeEdIdx1AegOK5N4RSrjLXHeAXGkCFrq8GYfX/tFs8OSrd77bSH0Fmc8VnJAMpy9QikCFIWcdCLcU5c9HCM6yt5+eYnVZWl5A80z82dL7HmEKDcJR/Kh+aCxg7nSD2QEW4=; 4:Ab8rPSNwJ8atyLsZWDq3VOTEVNpF/4NQaZKWZLC/QWAJDsQy1Gf5JtRoqjAUNsaN8AovLRf/5mBXgIOA9xwhe469NzDCzkQ6z0q2wn8CAYzwCf9GFSFA+oB7X7rfiDM02NDT1moF4uxxLAPAjDcvikNScnN3BEoF2nCFefyzAgXSGoWqQn3rXA28W5Flnd9BDjtfaohbaJY5SCj0cSqhrWWf0kSnIf+3tm142yB463KAoI3/ZQHY2ALkdEKsOuyxGRHxiKoonVHaxiTPEaTFTC1dk3BvejLnr4eWx6iUgZe9fPkIPXlR9ztgUsLN/NEn 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)(3231021)(93006095)(93001095)(3002001)(100000703101)(100105400095)(10201501046)(6055026)(2017110403001)(6096035)(20161123565025)(20161123559100)(20161123561025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123563025)(20161123556025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR03MB2697; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR03MB2697; X-Forefront-PRVS: 0484063412 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2697; 23:MRqVCaxhmT3VidKfqcAwFtqs6qIEnja3cUitaEkUg?= =?us-ascii?Q?xc05pqfjxSHQXo4rF2pw4Xm6aHZ6In3LXpbDd3sHMuz59pkH18cJYYV+hF5D?= =?us-ascii?Q?xGk7D077hcvbIUzfdBVaNJYV8IoNUv1l8ZVdV9HuSmo5ErjI2rzquvlJQno+?= =?us-ascii?Q?YHQfU/2Vy+UffWiQV8Mt7JOcQRyd4AhwQUPO58zA8fzlVkay3yYwFap8PyKv?= =?us-ascii?Q?Wsrek8EyFEFTAB1WEf2MyMt5BMdPeSQqrIRA+WxywbiJj+5w+lJ5Yi/B1c45?= =?us-ascii?Q?C9szjEisie1HPuWW8+trdu6lINow+qVpE/TU1k9xs1cpqyYLUfpVI+E1Ir0g?= =?us-ascii?Q?IvdSdMhygx0mcXvc5zz8AJg2MWOSSmWoonPbtELPndsxTIuP5V4ryNTN55Lp?= =?us-ascii?Q?ExlvI8VNn4Bv3b5LNMn+m/GA+Z+LjmuY8GDBCIT3A18xHNwy2iGH2QHlrzrH?= =?us-ascii?Q?uqXasKFf5HsmMEjcqoKHCUPZd90NK+lQa3/y2Fen0f4NAHAvz8IkEHVp6Ree?= =?us-ascii?Q?FCTTfUu/KMqqqQyFesfpIkgrJbbzVXznAvF7RDrWg5mCQJ0seh/IPNtFFFXL?= =?us-ascii?Q?JYFSaES6zOG6Maxjt8njtZK2dAuc2OuvzGjTJ8uO/D1EBP6I9ieqB47H3nyP?= =?us-ascii?Q?SS+qeV1rMiG2tE3W4+DAHyeIXW7pgjl6G4daKPwGMn2ptdysdQItScvR0JlU?= =?us-ascii?Q?sK9tH7tn7bG8NjGuOR8Y8VDqVSbpjzLZN+2T+3lf4c1HveHZDuDCQhKcEsup?= =?us-ascii?Q?JyQssD6uvjQtNqenFjrHqVuqk3GTc4DAhEoANAHuVa92pCIN0jGoz9n2jVjg?= =?us-ascii?Q?TeTG0ML1sRKEhE+bjcty7aTr9Gi7ehnpcsvszZczXDS7eoQ3/ObtBWorCuB5?= =?us-ascii?Q?Mgt57OgSxkWfEUiSlrt0W3UlyAgDatxjXxXqPRGImU4QKISajhz3lq7vXAlM?= =?us-ascii?Q?DIi+Xhwgl1QHUDtU68gLFIZ/hmhSlvcm82Xj/PP6OXTNpzuywyUM2dzfDFW4?= =?us-ascii?Q?B/8L59k8rKMVKbbh7xzCS95DCygQgSjmqK9a8pmXXKIm/u4fLS5PR+Fu9db6?= =?us-ascii?Q?thfkh5rwUtNMw7be8KnsFV2FN4ezv2/0cilp5xxITPIp5+aqd/e9a1PuJR96?= =?us-ascii?Q?O8+iPZzYjf7fV5BWkL+c8zkK632e+8cU1b+1QwfFJD0kAKTKCL3fvxkBQZsH?= =?us-ascii?Q?FrZKOhH68C2mGZXnlYihieewUwBmZMUbm3No2Wrf2am7MwFACUR4PTfIzJZ3?= =?us-ascii?Q?fqozWD35GzdYjZy1e+jmV8c84iDPVHcMp+2s+r8qFasqKn5CzxOueunBWBHE?= =?us-ascii?Q?eHxj1Vnp3pq0mGH8N8s+3eZ4f8pIHwZ7H6uy/2z+3TnzYII0waU+Mfb7DqxV?= =?us-ascii?Q?LkmWg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2697; 6:7iC55XlQIVYm5xtPJyM2ywFh2yzR8siG/2c76XKW5cpFKXmAzoF1xngMdbulckkkJ8L1nlskzx2dx4svW7FinMfoWNT5rnr9lxQmkxyUR2mohfY4zgmM/zDNrGnBIhTW0BJMEtQo9OXMzgPKU3bsxMJT9YzP76JYsWgqCGRV3SQY5JNGI7fvLjRmBdDQaP3ICFFj0cejay2GhX4onGMxBod3FI7wEHkffAy7PSW+DEKjsaAlrC6OfzCa3lYQEk4ZsNsSG5e9m0N2aEjWopD6X+2quQIZCnSgkkHKt2ZXAOLY9lwpUDHa4SgY0BEegFCy56wqoKIUm2rmUT+ui7246DvqAyJC3txnYJ9Rna49oYQ=; 5:tU4TNM8QZnLExYqyxANGMQJfm5RZOuXAP6roKTiQczG8SDrZT+qSj2Ff7mpskO6Mu24K3msoqmjKcvvoYwQyDMSrNOkFyMJ9K9N8CbMJoZ1wYtKKLLBnOZQAocvcn4VdWSYkQRDC/jv4n/TXjgmZ7R5ltwWnNfivkKUIW7u84f4=; 24:8qJFVn1IN9VMNdCCUyjXi+Gz5uATeAqXjFwWJx/gzwqasKKXfUWJsXwLySEYShwEooLGBl3/ilf2sw99BEL7dXaqUMDuvQpyzU1eVen4rW4=; 7:QIDtsipRdXUgmPDTpR0CFSpYQd7kNstNJnkhUXovTdpqiSfxaTMGfFpla+4E7tsZlza8B8PQSX34XEvveoanaBilwEKNH7Hf0mpVk/qBn3s8/rHl8TRK7yOpluKYGjgfLrxk579Q4qHHTYPlqibzHfYOns9CQAYNLoIG2x6liGuUkfThnepnYbPep+HeJPIVikyp6/2Cu1zRVjcFFp7bNP02Op0igvmDkxrUK0JSMTMfrAJoFLnMbdSoBxdvGJk5 SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 08:54:14.3494 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: a917a745-5598-4b12-00d6-08d525bd1f32 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: DM5PR03MB2697 Subject: [edk2] [PATCH 01/10] Platform/NXP: Library to provide helper functions. 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" UtilsLib provide helper functions which will be needed by NXP SoCs Library and Drivers. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- Platform/NXP/Include/Library/Utils.h | 137 ++++++++++++++++++++++++++++= ++++ Platform/NXP/Library/UtilsLib/Utils.c | 97 ++++++++++++++++++++++ Platform/NXP/Library/UtilsLib/Utils.inf | 30 +++++++ 3 files changed, 264 insertions(+) create mode 100644 Platform/NXP/Include/Library/Utils.h create mode 100644 Platform/NXP/Library/UtilsLib/Utils.c create mode 100644 Platform/NXP/Library/UtilsLib/Utils.inf diff --git a/Platform/NXP/Include/Library/Utils.h b/Platform/NXP/Include/Li= brary/Utils.h new file mode 100644 index 0000000..8920e4d --- /dev/null +++ b/Platform/NXP/Include/Library/Utils.h @@ -0,0 +1,137 @@ +/** Utils.h + Header defining the General Purpose Utilities + + 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. + +**/ + +#ifndef __UTILS_H__ +#define __UTILS_H__ + +/* + * Divide positive or negative dividend by positive divisor and round + * to closest UINTNeger. Result is undefined for negative divisors and + * for negative dividends if the divisor variable type is unsigned. + */ +#define DIV_ROUND_CLOSEST(X, Divisor)( \ +{ \ + typeof(X) __X =3D X; \ + typeof(Divisor) __D =3D Divisor; \ + (((typeof(X))-1) > 0 || \ + ((typeof(Divisor))-1) > 0 || (__X) > 0) ? \ + (((__X) + ((__D) / 2)) / (__D)) : \ + (((__X) - ((__D) / 2)) / (__D)); \ +} \ +) + +/* + * HammingWeight32: returns the hamming weight (i.e. the number + * of bits set) of a 32-bit word + */ +STATIC +inline +UINTN +HammingWeight32 ( + IN UINTN W + ) +{ + UINTN Res; + + Res =3D (W & 0x55555555) + ((W >> 1) & 0x55555555); + Res =3D (Res & 0x33333333) + ((Res >> 2) & 0x33333333); + Res =3D (Res & 0x0F0F0F0F) + ((Res >> 4) & 0x0F0F0F0F); + Res =3D (Res & 0x00FF00FF) + ((Res >> 8) & 0x00FF00FF); + + return (Res & 0x0000FFFF) + ((Res >> 16) & 0x0000FFFF); +} + +STATIC +inline +UINTN +CpuMaskNext ( + IN UINTN Cpu, + IN UINTN Mask + ) +{ + for (Cpu++; !((1 << Cpu) & Mask); Cpu++) + ; + + return Cpu; +} + +#define ForEachCpu(Iter, Cpu, NumCpus, Mask) \ + for (Iter =3D 0, Cpu =3D CpuMaskNext(-1, Mask); \ + Iter < NumCpus; \ + Iter++, Cpu =3D CpuMaskNext(Cpu, Mask)) \ + +/** + Find last (most-significant) bit set + + @param X : the word to search + + Note Fls(0) =3D 0, Fls(1) =3D 1, Fls(0x80000000) =3D 32. + +**/ +STATIC +inline +INT32 +GenericFls ( + IN INT32 X + ) +{ + INT32 R =3D 32; + + if (!X) + return 0; + + if (!(X & 0xffff0000u)) { + X <<=3D 16; + R -=3D 16; + } + if (!(X & 0xff000000u)) { + X <<=3D 8; + R -=3D 8; + } + if (!(X & 0xf0000000u)) { + X <<=3D 4; + R -=3D 4; + } + if (!(X & 0xc0000000u)) { + X <<=3D 2; + R -=3D 2; + } + if (!(X & 0x80000000u)) { + X <<=3D 1; + R -=3D 1; + } + + return R; +} + +/* + * PrINT32 Sizes As "Xxx KiB", "Xxx.Y KiB", "Xxx MiB", "Xxx.Y MiB", + * Xxx GiB, Xxx.Y GiB, Etc As Needed; Allow for Optional Trailing String + * (Like "\n") + */ +VOID +PrintSize ( + IN UINT64 Size, + IN CONST INT8 *S + ); + +/* Function to convert a frequency to MHz */ +CHAR8 *StringToMHz ( + CHAR8 *Buf, + UINT32 Size, + UINT64 Hz + ); + +#endif diff --git a/Platform/NXP/Library/UtilsLib/Utils.c b/Platform/NXP/Library/U= tilsLib/Utils.c new file mode 100644 index 0000000..4f5a15c --- /dev/null +++ b/Platform/NXP/Library/UtilsLib/Utils.c @@ -0,0 +1,97 @@ +/** Utils.c + + 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 + +/* Function to convert a frequency to MHz */ +CHAR8 * +StringToMHz ( + IN CHAR8 *Buf, + IN UINT32 Size, + IN UINT64 Hz + ) +{ + UINT64 L; + UINT64 M; + UINT64 N; + + N =3D DIV_ROUND_CLOSEST(Hz, 1000) / 1000L; + L =3D AsciiSPrint (Buf, Size, "%ld", N); + + Hz -=3D N * 1000000L; + M =3D DIV_ROUND_CLOSEST(Hz, 1000L); + + if (M !=3D 0) { + AsciiSPrint (Buf + L, Size, ".%03ld", M); + } + + return (Buf); +} + +/* + * PrINT32 Sizes As "Xxx KiB", "Xxx.Y KiB", "Xxx MiB", "Xxx.Y MiB", + * Xxx GiB, Xxx.Y GiB, Etc As Needed; Allow for Optional Trailing String + * (Like "\n") + */ +VOID +PrintSize ( + IN UINT64 Size, + IN CONST INT8 *S + ) +{ + UINT64 M; + UINT64 N; + UINT64 F; + UINT64 D; + CHAR8 C; + UINT32 I; + INT8 Names[6] =3D {'E', 'P', 'T', 'G', 'M', 'K'}; + + M =3D 0; + D =3D 10 * ARRAY_SIZE(Names); + C =3D 0; + + for (I =3D 0; I < ARRAY_SIZE(Names); I++, D -=3D 10) { + if (Size >> D) { + C =3D Names[I]; + break; + } + } + + if (!C) { + DEBUG((DEBUG_ERROR, "%Ld Bytes,\n %a", Size, S)); + return; + } + + N =3D Size >> D; + F =3D Size & ((1ULL << D) - 1); + + /* if There'S A Remainder, Deal With It */ + if (F) { + M =3D (10ULL * F + (1ULL << (D - 1))) >> D; + + if (M >=3D 10) { + M -=3D 10; + N +=3D 1; + } + } + + DEBUG((DEBUG_ERROR, "%Ld", N)); + if (M) { + DEBUG((DEBUG_ERROR, ".%Ld", M)); + } + DEBUG((DEBUG_ERROR, " %ciB, %a ", C, S)); +} diff --git a/Platform/NXP/Library/UtilsLib/Utils.inf b/Platform/NXP/Library= /UtilsLib/Utils.inf new file mode 100644 index 0000000..9901445 --- /dev/null +++ b/Platform/NXP/Library/UtilsLib/Utils.inf @@ -0,0 +1,30 @@ +# @Utils.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 UtilsLib + FILE_GUID =3D 0985d4e8-5a41-40cf-ad12-2ad5d35e817f + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D UtilsLib + +[Packages] + MdePkg/MdePkg.dec + edk2-platforms/Platform/NXP/NxpQoriqLs.dec + +[LibraryClasses] + PrintLib + +[Sources.common] + Utils.c --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed Dec 25 02:35:00 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 1510044869307205.6797199864917; Tue, 7 Nov 2017 00:54:29 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 796DD2034D839; Tue, 7 Nov 2017 00:50:28 -0800 (PST) Received: from NAM01-BN3-obe.outbound.protection.outlook.com (mail-bn3nam01on0083.outbound.protection.outlook.com [104.47.33.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B04832034D825 for ; Tue, 7 Nov 2017 00:50:27 -0800 (PST) Received: from BN6PR03CA0095.namprd03.prod.outlook.com (10.164.122.161) by BN3PR03MB2354.namprd03.prod.outlook.com (10.166.74.149) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.6; Tue, 7 Nov 2017 08:54:25 +0000 Received: from BL2FFO11FD026.protection.gbl (2a01:111:f400:7c09::173) by BN6PR03CA0095.outlook.office365.com (2603:10b6:405:6f::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:18 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD026.mail.protection.outlook.com (10.173.161.105) 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:18 +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 vA78s4DZ009319; Tue, 7 Nov 2017 01:54:15 -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.33.83; helo=nam01-bn3-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:08 +0530 Message-ID: <1510065736-9394-3-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: 131545184584761916; (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)(39380400002)(39860400002)(376002)(346002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(54906003)(2950100002)(498600001)(106466001)(105606002)(110136005)(47776003)(5003940100001)(4326008)(189998001)(316002)(16586007)(33646002)(5660300001)(86362001)(8676002)(50466002)(305945005)(81156014)(8656006)(2906002)(68736007)(6666003)(8936002)(81166006)(104016004)(356003)(16799955002)(15188155005)(97736004)(77096006)(50226002)(966005)(2201001)(53376002)(85426001)(76176999)(36756003)(50986999)(53936002)(48376002)(6306002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2354; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD026; 1:yqCyXHqsdO0eKwquj77JBYFb0EdN0SnSslcPEQ6yU9/a00S69cEEsgiDF0apB1k39lfT/iPsNwcYoKRacHgQTnLmItg3O8gtCIuL7ie8mmJrwfARkGk2oJSO3x8w3IhC MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 144484b9-b8a4-4102-20db-08d525bd218b X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603199); SRVR:BN3PR03MB2354; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2354; 3:i0bmn/I2yHxF29dqqm+bO+aFvLOwe4mqsBcBfVHxaTGsU4V+oY2CqJKnJ9OoqzfKCpvYGepVhq/Ss/QBolFbBSxC99Vmvjrihdb/EeotAabJJbVOhlsLrDUMX07Y08cmQjR3+E/n6OtIAfBrtYUyW5cBaLQSgVF1K4lfI6J+j5XNFqCifV0dYVaEvXO3y1t0Sb22CyT1lrJ6YUnUPCznww4QRjPfM5/2WQA9UMc6YkHUSWLtA/x4JKYomDZYr47wLKOmsdBlvBNkJAfUy4cGbHqrATHIJGXZh1gfs4ziKt7BUEgUfS9x8iZhRotOWhZ/JQEEnJzi3CdnRgeBCNDaPgWsQYjtQgTNXzY69yWLBpU=; 25:KVaZwK+zF8jIAc0Q14h3OVkzvV4niAsT7JnfJGhuDVXaj2QP3deIeUBLVgsZ67ICDO8YhvFLqWcrruggxaYlcuoL3ukmZ/Aboxb5q3y+iFpCSTAkAm61Nuzca0x8dZAcMfzVxqqW8wfX+xaBZj3RDXedwd9bA1eUOJsMp2BdA2eCFe2cNMz1i0l2HtAJ2AolWc6YkzH+xqMh/LioahlaM9SLcL5ZDiwSXBFq6Ut7lDTh1DF7xrz4WaOeMp5tIE+EOxXq/U9qRQCTO/DlDo/rxUMJbKgPWmVG93I0gtXGO1PUupvFOa54bGPHgelfQ0KjuWtjL4J+x5OQ+kckFQuXZA== X-MS-TrafficTypeDiagnostic: BN3PR03MB2354: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2354; 31:ieB2OcF6fgTC7223hJNv/wxWV2oQ++dhNZDqYQsWTkU+cwNz44AgPV2NBHol5jSlKtpL5KByGH0Sg6Doiz9TfT4EpaTm3O03gtXUAPcKT21QUKzftEOv8Tqo8mWQFV+jHfsmMnQ+cb0plM5qd0oagaBjL8fIvKt6OrsvdtfbYtDSeG0PtdWttBcf1H1Situ3ktVUhtrEJDS4wAm5hke6slxNLpLP2Pf2lRrbrCkLYiw=; 4:JJXHsCnz+1qlXW8PXohqkKiLgma8B/vGYvUaTr+2qmbFW6pTHv4oq36pxZJ0uGdJ9US7uZ3o2bhwPpu29LF8J+lGh4GewHQ8ZAWO6yCXsYnaugHMBsCTwAE/wIlTX0/ZIgm7sD82XJI1L1JVn5/nUYTRx5+fXRWWm9D71FyVCvCBog+oH9mCA6r565FrGcBnPHn+NQEnlE+oVxmAGaP61QkRmyBpWJyh2RhnpWdxU/WvMhMvOsuI2LOWkUcj+zEkvB46ZcBkakYqqSpARvyMn5Ch+j0w3gYo8iPPnnH4LDyzI97Hle6i/ioOruAAjQ5t 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)(5005006)(8121501046)(3002001)(100000703101)(100105400095)(3231021)(10201501046)(93006095)(93001095)(6055026)(2017110403001)(6096035)(20161123565025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123556025)(20161123561025)(20161123559100)(20161123563025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR03MB2354; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR03MB2354; X-Forefront-PRVS: 0484063412 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR03MB2354; 23:9m6+worVLpWYT/8SJFDvm4z/lHLfTdqWXdeuV6U90?= =?us-ascii?Q?ShvM9EosZ2t+fpromLrb9cISoPQYdl0m7z6YQmrNGf4AQewza4+Qq7cmioLS?= =?us-ascii?Q?hGPvnVc8IVXsvq4SP7sIS81zBlbewE01hqoksV4SbgUSxVYnayLOmC4OhVOy?= =?us-ascii?Q?n8xsHh0xJvQ9rhegtRkTcnKGu0eNoaq5cGKt5OxZCk6ZhTViX0lEX575sbtM?= =?us-ascii?Q?8E8KFNTcYnv4ILtfgSolP8+jPrar+juhjiLB3BE42tpBAJR77uvMoZlT8jMx?= =?us-ascii?Q?yOLm3eUx3RBGElaX/Nl2zGUX9Oyo4Uk0ywtZQeEMLjukYQs9GcchNeiSJ4rS?= =?us-ascii?Q?5DNuRe2emJTqLAPiQodx+yAZ73bLW/ZjNuW/B3pr2hL9OX8X4EOyV9F4e/BI?= =?us-ascii?Q?cIqoADyHk7HiBVgYOcvQbn6j8iK/50PfLyZE3DC80nuX8WYJS7gcwGLntdwD?= =?us-ascii?Q?3dVYc15Q3rVz23szOfBr+HdVMqCl/h32SrHykn8+GoGoYcPGS0YR8jA0tNti?= =?us-ascii?Q?0OAyfyWPqZi6zWibKgO0CSGBk6qWxriyPATQYpynwncEz2suNvSq/g0KV+ro?= =?us-ascii?Q?eFTPxX5D6sJItUUSsfm1mKCzw3lWCMLSMX9Eym55UkIC7Ned3UU3KyNA4+Ck?= =?us-ascii?Q?NsH5nOAdl8LxUUr7UQkNmhYAgg7oxrMSD+GRZpeALN4xLWsM+xvwEd9StlEW?= =?us-ascii?Q?ESETrrctKHNuKqot+efDxDnAr07/jJic4EF/QrgMQ/D/tRlfQNeIoi9mkdR5?= =?us-ascii?Q?iz1ZwjhLPadvseXnbp8xu+WIOVnRTIRDLxkEVcc5PnpEYmKxMU+UCeWISwLP?= =?us-ascii?Q?V/zTfHxBruMXuzaRI+O1yh/nOIPgyG6aaNwwheFWzW2dVX8pkBeirdCylw10?= =?us-ascii?Q?JBjHWL8BV5367/enSZKhRjg8DiN8dmFrB/610JdYCjd3EPNQi9keGgfGiesl?= =?us-ascii?Q?xHUSisaM586zySzTKDy0vbcCdyUwNwTr7MXIzLyXgNywu92mK5OpjRiSREDM?= =?us-ascii?Q?FXfBQknMVp0Ji7RsUSsekhPhQ+WqIaFwHO5mZ8GcotYhC1TBgOluYNNJk97O?= =?us-ascii?Q?4XtZC1YU5TPD+zNwuZuo17zF1wmST3Raboea5K/MRLguEUtmPjby6Bbb+J2q?= =?us-ascii?Q?x2j+VOfrWVSwhhtbIKrpV47ltjEyBiWzRDkI4JUSJAtDvkpMco5uD+kLRuW3?= =?us-ascii?Q?+ol1SNGzrHo+woA0Rc2MIYaswYeCyDHLaIcz3lpdBfrusuAij1BavD2uNY7U?= =?us-ascii?Q?j5Vi6umYiouG8H7S5Lc+hPSOa8rFJDskZASHDsiX4kKrKvgIKnyefSqZruZD?= =?us-ascii?B?UT09?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2354; 6:j/v32xA9nQ3p5BafNHxTqjovVTyQF54gaSAcr3QaxZcK4DLZwb9uhnxH7U/un5CouvhksvreJlAIma+5l18BI+PfzO/K2sek9S3iBLL3Xr2OuXY/tZZtinc1P2Bbx161d6ZeC31mV77/uIW6An3lcgIBBy8Msg0NUpaPHfVu/LAbqH8XgvzBURqA51SssQ1oSjSakEHSzottQyQ38XuintGzb7jFoU3j84BRWatdF1PPO2latjRr1ezopX4dlX9CFiZQDYjvgeBn7xezHdlcF0McSnWMIcYPbc1Djh0R50rJdy5frxINmJ97sVYE1kf17wbJ6PjBLG2ZEhKGU2LLjix2qCcIFWEzbIIQcR4x+B4=; 5:YORWC7hkq/SWP0gYzzQShNeKjoICI0fbSncY/BX6Ud4sRBXQjJZ7R2lJpy5VkAXjW3nvJP93EEMJVvBhzuixUthqzKylzYSgP/TTqWikTmE7eDQ/6b0S7miBhFLOX90JXfQz5OEObQIZ6fJjNPG8G0c6lyoG6qieuby4CpR50hU=; 24:xBWoJxIFyicIfleaHcdRRaqdHlp9GGh+lcAyDPRwEBM6O+aExbu6SoERBywRhZaibL7T+IQX65AoyZ2uy7sn/NJSSkUepuO2CK6EB7DIEz8=; 7:+PR86+W4K9+pJDDiamHCCbB9VXeGuUcVzsK/rkbk2/9JUTVtR2rx6iZxccANIFaV7R36JGzTFZlbSdyk7Gd2L6O8945bC8YdCkkw2/Vva0xC/iZvcX8LjosAiobns+38jy4RICXCZ/jgLWlGAjrfJHOnYxr0JXwu0/4Vact5Tgv1zYY4CozpGn0PM9rifv2RrDe2ynMSCPS04eBZcExxB55fYLVNVmI0UuEdPeHYvr45fHKXRMw0WcARm7zMGS+o SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 08:54:18.3045 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 144484b9-b8a4-4102-20db-08d525bd218b 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: BN3PR03MB2354 Subject: [edk2] [PATCH 02/10] Platform/NXP: Add support for system reset library 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" Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- .../NXP/Library/ResetSystemLib/ResetSystemLib.c | 96 ++++++++++++++++++= ++++ .../NXP/Library/ResetSystemLib/ResetSystemLib.inf | 33 ++++++++ 2 files changed, 129 insertions(+) create mode 100644 Platform/NXP/Library/ResetSystemLib/ResetSystemLib.c create mode 100644 Platform/NXP/Library/ResetSystemLib/ResetSystemLib.inf diff --git a/Platform/NXP/Library/ResetSystemLib/ResetSystemLib.c b/Platfor= m/NXP/Library/ResetSystemLib/ResetSystemLib.c new file mode 100644 index 0000000..897324a --- /dev/null +++ b/Platform/NXP/Library/ResetSystemLib/ResetSystemLib.c @@ -0,0 +1,96 @@ +/** ResetSystemLib.c + Do a generic Cold Reset + + Based on Reset system library implementation in + BeagleBoardPkg/Library/ResetSystemLib/ResetSystemLib.c + + Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
+ Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved. + 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 +#include +#include +#include +#include +#include +#include + +/** + Resets the entire platform. + + @param ResetType : The type of reset to perform. + @param ResetStatus : The status code for the reset. + @param DataSize : The size, in bytes, of WatchdogData. + @param ResetData : For a ResetType of EfiResetCold, EfiResetWar= m, or + EfiResetShutdown the data buffer starts with= a Null-terminated + Unicode string, optionally followed by addit= ional binary data. +**/ +EFI_STATUS +EFIAPI +LibResetSystem ( + IN EFI_RESET_TYPE ResetType, + IN EFI_STATUS ResetStatus, + IN UINTN DataSize, + IN CHAR16 *ResetData OPTIONAL + ) +{ + ARM_SMC_ARGS ArmSmcArgs; + + switch (ResetType) { + case EfiResetPlatformSpecific: + case EfiResetWarm: + // Map a warm reset into a cold reset + case EfiResetCold: + // Send a PSCI 0.2 SYSTEM_RESET command + ArmSmcArgs.Arg0 =3D ARM_SMC_ID_PSCI_SYSTEM_RESET; + break; + case EfiResetShutdown: + // Send a PSCI 0.2 SYSTEM_OFF command + ArmSmcArgs.Arg0 =3D ARM_SMC_ID_PSCI_SYSTEM_OFF; + break; + default: + ASSERT (FALSE); + return EFI_UNSUPPORTED; + } + + ArmCallSmc (&ArmSmcArgs); + + // We should never be here + DEBUG ((DEBUG_VERBOSE, "%a: PSCI failed in performing %d\n", + __FUNCTION__, ArmSmcArgs.Arg0)); + + CpuDeadLoop (); + return EFI_UNSUPPORTED; +} + +/** + Initialize any infrastructure required for LibResetSystem () to function. + + @param ImageHandle : The firmware allocated handle for the EFI image. + @param SystemTable : A pointer to the EFI System Table. + + @retval EFI_SUCCESS : The constructor always returns EFI_SUCCESS. + +**/ +EFI_STATUS +EFIAPI +LibInitializeResetSystem ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + return EFI_SUCCESS; +} diff --git a/Platform/NXP/Library/ResetSystemLib/ResetSystemLib.inf b/Platf= orm/NXP/Library/ResetSystemLib/ResetSystemLib.inf new file mode 100644 index 0000000..c57fff8 --- /dev/null +++ b/Platform/NXP/Library/ResetSystemLib/ResetSystemLib.inf @@ -0,0 +1,33 @@ +# @ResetSystemLib.inf +# Reset System lib to make it easy to port new platforms +# +# Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved. +# 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 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 IM= PLIED. +# +# + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D ResetSystemLib + FILE_GUID =3D 781371a2-3fdd-41d4-96a1-7b34cbc9e895 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D EfiResetSystemLib + +[Sources.common] + ResetSystemLib.c + +[Packages] + ArmPkg/ArmPkg.dec + MdePkg/MdePkg.dec + +[LibraryClasses] + ArmSmcLib + BaseLib --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed Dec 25 02:35:00 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 From nobody Wed Dec 25 02:35:00 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 1510044872328535.4823816384342; Tue, 7 Nov 2017 00:54:32 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id BF8942034D83C; Tue, 7 Nov 2017 00:50:31 -0800 (PST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0083.outbound.protection.outlook.com [104.47.37.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 462EC2034D825 for ; Tue, 7 Nov 2017 00:50:30 -0800 (PST) Received: from CY1PR03CA0035.namprd03.prod.outlook.com (10.174.128.45) by CY1PR03MB2363.namprd03.prod.outlook.com (10.166.207.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:28 +0000 Received: from BY2FFO11FD013.protection.gbl (2a01:111:f400:7c0c::179) by CY1PR03CA0035.outlook.office365.com (2603:10b6:600::45) 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:28 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD013.mail.protection.outlook.com (10.1.14.75) 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:28 +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 vA78s4Db009319; Tue, 7 Nov 2017 01:54:24 -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.37.83; helo=nam02-cy1-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:10 +0530 Message-ID: <1510065736-9394-5-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: 131545184684466129; (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)(7966004)(336005)(39860400002)(346002)(376002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(199003)(50944005)(189002)(6666003)(48376002)(81166006)(81156014)(15188155005)(47776003)(76176999)(2906002)(105606002)(356003)(50986999)(85426001)(305945005)(53936002)(316002)(68736007)(53376002)(4326008)(8936002)(189998001)(16799955002)(50466002)(8676002)(50226002)(36756003)(2950100002)(104016004)(77096006)(16586007)(6306002)(54906003)(110136005)(86362001)(498600001)(966005)(2201001)(97736004)(5003940100001)(5660300001)(106466001)(8656006)(33646002)(171213001)(44824005)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB2363; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD013; 1:KERFAtQfnvEaYwsTrszVl23IWrnV1xLKoJuwqOl3c3EE2g53pG97/cGd7ZV0dLp6EJiQkg/OEzWX00DFGrdvl4yDBfuYTKEjuewtOY1t/UEYaYo2vPtK+VizTlyHTPId MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: d3d28538-2358-49df-7368-08d525bd2769 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603199); SRVR:CY1PR03MB2363; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2363; 3:lqXdk2JLp2EHEFeRk3qPBjrAmhGynIFs+m0k1RESF9pXGqnxDC42p7Q7xysVnI8/bdUKjEk0zseuA9yoOiNKSJy2qulhdocTzfPmwnpUCCcgcfzhGXFnaXz27rrjrH97NAQm0IJd1Vo2wCtoN6PIzHe0cDHoJe/Pn5CZWe69Gst82+tJ/Kads/Td06fE1R/VQYrouonQm2ZdOrTmXX7qJttcFBnGA96Sd36Qk9M+CgC/ArX779Thllr1hOdj79DKsnGmKYQ7+AERTihZlLHM1/U3huLuEDiQ6Ue/XuVrgmOjw2N5V+y3CkiqckyFFq7YrOKRdRa2V0czoQehSsGgFp7wLsL36YoosPOHDnObTx0=; 25:c6fnkUG93CDO0UBUQnguRBigaqEhpVBWY8HkIQ0ALiU7n52IixqqW6/onf83riVdSbKIorseHlzwjkANqgqXW5cF9Y4mteb1u7qW3Ii3cXIEARvRr3H2nTDLZeEp6NcKA3rytwvqHILJG5f3bQ3D1qoiI2OUfwPz2+IEPXBe7gZk26xG/CaH0JT2XEFNaIYlCX05iT9DezGPR4lFILiAY/LvIzprkMjBWKREAxm7tPcFMP8G9VgjmGduHt7G1ri90Utm9ejKO3vOBI504MTSZTQHurZEJECHrksdMGgQxZoBRmkXMs8l4Bzemv/oCXwq+SEKtC6bpb61UDZEVlKgGQ== X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY1PR03MB2363: X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2363; 31:GP/kpkoOivlAoKsKY4BdhHci4E2LxyG2NxZiLcKW+9s1pjs0mwb22modvBpMAxc9w2rkzW5lj1LJIVwQYYSFHL71NizXmjSZP4/awoyfFqkdpIc4YPu31ukt9sXZGMNS4I2A/whi32gXSmUnKcPzHdCM+oqMEoGE1CHNGi6jPerhz+NttB8petkqS3pBc5PCuKv+rTdUPTNLhpSDMpuTkK2vJ9jzAEPEfSq+rzTo7PI=; 4:l0RuglSRVVeJ30Rsw9gXLJ2PtPWOIXFpD3l0NeZMEZn/yU0oLqz3rFMxLbBbCwR126mNhX06KxT03q/eavA16qeuEQ0EQ/KU3QcQXaWz3pLYfk4dCKVs5ZV9Y43UFGd+YLehwCblAVLn91be8luz+kBcWjmI3SCSJ7//Eos6/ALTdwnG5Oj5jj0S1R3j67aH5buJQ6/IY3mACoi/3PRzCKmoWJusv7qhxfEqUsiDrT1bZw2C4mCyfqS+wGGyewOggZ6n+3G2TfWWc/uHb3V6x583792XHAwSyfGlmQ4hJqPvz8BmNl9vulx/rZj5g0XV 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)(5005006)(8121501046)(93006095)(93001095)(100000703101)(100105400095)(10201501046)(3002001)(3231021)(6055026)(6096035)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123561025)(20161123563025)(20161123559100)(20161123565025)(20161123556025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR03MB2363; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR03MB2363; X-Forefront-PRVS: 0484063412 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB2363; 23:YZADwLwFOKjCggDR9SvnREGgqw8U2o/czn12WT5I9?= =?us-ascii?Q?AtjSY7C+QJ9iOQ341GAgY6j88FZI8tViJXpWGDFmCYc1G4n4fGc3gRdnO3Vb?= =?us-ascii?Q?bkvSu+k3k/23rs26QbqcwlbSM2krTwgX6mFPvAAtzbRuvFIOs7EGDmzlFSjk?= =?us-ascii?Q?geSuMvfLLVHlKaVG0NApnhrEE0AmaPp4agAHiiUGzih1kVHttJFtmLBxeTTh?= =?us-ascii?Q?co6pBUNoAjpuIIpUWtuBypMHiyHJciWW6WGH0bPVz1QJ7DVgEADpnaX6neoc?= =?us-ascii?Q?2qs/EZvRLJushpELdHR+CpuLSp2i3ZmIlE5xaJJsT+BLWT7YJTqJjsw1s681?= =?us-ascii?Q?dh3vHmQ76YhNVxnCOFc42H/9ofsuz6iKLuiNC8b/1yBE+chDRynCqgUnV3n+?= =?us-ascii?Q?5RVoY9NG6iiwTjpKnjuY1xuTfEads6y4F1mKcEV7kS9v5nzyAAeIgp6C6Igm?= =?us-ascii?Q?tmmfW8zgE645ZT4GZ9NUxwi5R9oGTXhNlMFYhnc94mGq005GEve3+KUbDJ7I?= =?us-ascii?Q?rgWlS/T+KWQGMni1EGAsYyqpPa3N6YouTgEVbGLweMBbta0JTd8MXjZcOAz4?= =?us-ascii?Q?Z5AN1jZPY5YXt80Peb7uGZ9xRytuNNHhs2DLuJeVdpWfE7PfXKzLxlS/khMl?= =?us-ascii?Q?ngVoVWchSy3uNZcRVuIKQdjmydCc5E40v9qcw8+X9DdpvZFPPMy1ll7aYte2?= =?us-ascii?Q?ukr0Nx2irVQ6SXBz8Im7u7CKeA89Q9DL/wv/59sdzZ7XnO+wBABk0G/zSXhV?= =?us-ascii?Q?+McdwOP5eGELszhVk1DU4VuHuK9RQ/WVoWRiPR68/Duqg++sTd1AJFSiI4J4?= =?us-ascii?Q?ZdyggOEbcwROu5KV3iIDvMP8Q1ZpmebpVTqevLq6duMYIiPVEa0nrb/ZUUM8?= =?us-ascii?Q?d24EbLdP3qiWKC9GTESw3ftAWgtq7g5//Q59zdJhOmaKgEWc6eN50Ky3/HvI?= =?us-ascii?Q?b3AZ8gtWdbXKaa1iIrjibspeFofzTrdN+rheCljSCkbG5kdzRACutLiuwROu?= =?us-ascii?Q?MOwROsw/+SJoRoatIKEsJyKMlkyBHHVjjwT/QbcbTvVSimveRB0ZUPVIBnq2?= =?us-ascii?Q?a6OeerQOlVddMUv4km4hfLRK3KwYeDkUXkbAz/JyTUYdTbboAfblW84MfJbf?= =?us-ascii?Q?UYr+O3yqQ3HETrsZhJn4Y0UUNTofqcb84nUrlzuB49SALpjHg5zyEUgwoFTQ?= =?us-ascii?Q?SVy7lih4Rh9SN2WDgwx6REt9k4Ar2LWY/hQLaVRmvftGRXTkG2LL2KszHfCw?= =?us-ascii?Q?jtVhFnoT7WG3S4k8Bpur2ipdLRW/Cvsp/n3k30b3XfHbhvEeJjNNvVeANLHu?= =?us-ascii?Q?S//G6EkN8OGYgO+lL9fVdCdPkSw44gpoWnesX1B5yV6UemHkFJ1fh4jrxiHf?= =?us-ascii?Q?mRw4wE6D7u2OgYSRpKMY1zsXlk=3D?= X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2363; 6:ZmIxaB/i/UXqS+gagXaEhz8jv9mbld2N72khg4IXUPqB9J6X3iv5flW7LusjhGSYbMsDlYKdBvNq3sRZGSrtV/j2BVape5nXKrXJjvj6iAWBReIWm4Br6kbQMeyQfwOoULVIiOcxD0N6gXsILmrcRR85IFOTqxbdEJF04iApQlsVW6xadrWjZOx5kURPkyOglzHRKnewhsYDr1d9pXNF+RkcwLjOW/L9UcoBEgGAPVUwMpFLGK3916buAz5xZ9nTF4RO6FdJ96O6MWgRf5nFBgc+KvRSMFIM0Tx+2tY1b/J6De8lb4aqk6BJ0iuXp1b8/a1+lv8D5RXDoEsAQ++mr8fYBgxGRd3ezyGXhoINwu0=; 5:D3QrgJJvBVlk+6iOItMMojmaA6QVhFfGHvzW7dB7s1C6jIFVvUfnloFTxIHWkr7xjo4jIUVWqA3pQ9Sj8aB1jSgm4D0sI3QrjkmHvfgBcvg+cZ9vq59UtNnPU2rxQpFYkTED1YgXXhCdxxS5j2K1gHSI69PkUkt8sr7wmzwvksI=; 24:WK2A3owUS2O41T3b+DijwYNVXy9X9ewfAGoIC1+yqmxibLxKEaUYJ7z2TxtZ8MY/2MoOx4ins3YXkRvx6LBYRUXS9OhTloCWLCKPaaub+A4=; 7:zt/9cqdfZXe/NN1oxmNgHEyLm9MEmSFGpuy9wvgymr9iKcAur9pFBvtn+Je78evCcZXH/9pZ+UIS1rI+NnE5voNI0EZyZpyhXWyGdlTEseo8QaKlTDYjRfSfFIjQeroPDBlsieJYJjZxI7RXITnBTXhCVq4csAffhymyU4jP9y165jJj0ILsxmitAahEwQN3J1/94uMRm0iMJaNIUDFxL6svgFyqeY/vx0sn5M8QP6ekhPnZALg5W7HlGOx5ukuB SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 08:54:28.1190 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d3d28538-2358-49df-7368-08d525bd2769 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: CY1PR03MB2363 Subject: [edk2] [PATCH 04/10] Platform/NXP : Add support for Watchdog driver 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" Installs watchdog timer arch protocol Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- Platform/NXP/Drivers/WatchDog/WatchDog.c | 386 ++++++++++++++++++++++= ++++ Platform/NXP/Drivers/WatchDog/WatchDog.h | 37 +++ Platform/NXP/Drivers/WatchDog/WatchDogDxe.inf | 47 ++++ 3 files changed, 470 insertions(+) create mode 100644 Platform/NXP/Drivers/WatchDog/WatchDog.c create mode 100644 Platform/NXP/Drivers/WatchDog/WatchDog.h create mode 100644 Platform/NXP/Drivers/WatchDog/WatchDogDxe.inf diff --git a/Platform/NXP/Drivers/WatchDog/WatchDog.c b/Platform/NXP/Driver= s/WatchDog/WatchDog.c new file mode 100644 index 0000000..f257a1d --- /dev/null +++ b/Platform/NXP/Drivers/WatchDog/WatchDog.c @@ -0,0 +1,386 @@ +/** WatchDog.c +* +* Based on Watchdog driver implemenation available in +* ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.c +* +* Copyright (c) 2011-2013, ARM Limited. All rights reserved. +* 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. +* +**/ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "WatchDog.h" + +EFI_EVENT EfiExitBootServicesEvent =3D (EFI_EVENT)NULL; + +UINT16 +EFIAPI +WdogRead ( + IN UINTN Address + ) +{ + if (FixedPcdGetBool(PcdWdogBigEndian)) { + return BeMmioRead16(Address); + } else { + return MmioRead16(Address); + } +} + +UINT16 +EFIAPI +WdogWrite ( + IN UINTN Address, + IN UINT16 Value + ) +{ + if (FixedPcdGetBool(PcdWdogBigEndian)) { + return BeMmioWrite16(Address, Value); + } else { + return MmioWrite16(Address, Value); + } +} + +STATIC +VOID +WdogPing ( + VOID + ) +{ + WdogWrite(PcdGet64(PcdWdog1BaseAddr) + WDOG_WSR_OFFSET, + WDOG_SERVICE_SEQ1); + WdogWrite(PcdGet64(PcdWdog1BaseAddr) + WDOG_WSR_OFFSET, + WDOG_SERVICE_SEQ2); +} + +/** + Stop the Wdog watchdog timer from counting down. +**/ +STATIC +VOID +WdogStop ( + VOID + ) +{ + // Watchdog cannot be disabled by software once started. + // At best, we can keep pinging the watchdog + WdogPing(); +} + +/** + Starts the Wdog counting down by feeding Service register with + desired pattern. + The count down will start from the value stored in the Load register, + not from the value where it was previously stopped. +**/ +STATIC +VOID +WdogStart ( + VOID + ) +{ + /* Reload the timeout value */ + WdogPing(); +} + +/** + On exiting boot services we must make sure the Wdog Watchdog Timer + is stopped. +**/ +VOID +EFIAPI +ExitBootServicesEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + WdogStop(); +} + +/** + This function registers the handler NotifyFunction so it is called every= time + the watchdog timer expires. It also passes the amount of time since the= last + handler call to the NotifyFunction. + If NotifyFunction is not NULL and a handler is not already registered, + then the new handler is registered and EFI_SUCCESS is returned. + If NotifyFunction is NULL, and a handler is already registered, + then that handler is unregistered. + If an attempt is made to register a handler when a handler is already re= gistered, + then EFI_ALREADY_STARTED is returned. + If an attempt is made to unregister a handler when a handler is not regi= stered, + then EFI_INVALID_PARAMETER is returned. + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param NotifyFunction The function to call when a timer interrupt fir= es. This + function executes at TPL_HIGH_LEVEL. The DXE Co= re will + register a handler for the timer interrupt, so = it can know + how much time has passed. This information is u= sed to + signal timer based events. NULL will unregister= the handler. + + @retval EFI_SUCCESS The watchdog timer handler was registered. + @retval EFI_ALREADY_STARTED NotifyFunction is not NULL, and a handler = is already + registered. + @retval EFI_INVALID_PARAMETER NotifyFunction is NULL, and a handler was = not + previously registered. + +**/ +EFI_STATUS +EFIAPI +WdogRegisterHandler ( + IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, + IN EFI_WATCHDOG_TIMER_NOTIFY NotifyFunction + ) +{ + // ERROR: This function is not supported. + // The hardware watchdog will reset the board + return EFI_INVALID_PARAMETER; +} + +/** + + This function adjusts the period of timer interrupts to the value specif= ied + by TimerPeriod. If the timer period is updated, then the selected timer + period is stored in EFI_TIMER.TimerPeriod, and EFI_SUCCESS is returned. = If + the timer hardware is not programmable, then EFI_UNSUPPORTED is returned. + If an error occurs while attempting to update the timer period, then the + timer hardware will be put back in its state prior to this call, and + EFI_DEVICE_ERROR is returned. If TimerPeriod is 0, then the timer inter= rupt + is disabled. This is not the same as disabling the CPU's interrupts. + Instead, it must either turn off the timer hardware, or it must adjust t= he + interrupt controller so that a CPU interrupt is not generated when the t= imer + interrupt fires. + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param TimerPeriod The rate to program the timer interrupt in 100 = nS units. If + the timer hardware is not programmable, then EF= I_UNSUPPORTED is + returned. If the timer is programmable, then th= e timer period + will be rounded up to the nearest timer period = that is supported + by the timer hardware. If TimerPeriod is set to= 0, then the + timer interrupts will be disabled. + + + @retval EFI_SUCCESS The timer period was changed. + @retval EFI_UNSUPPORTED The platform cannot change the period of t= he timer interrupt. + @retval EFI_DEVICE_ERROR The timer period could not be changed due = to a device error. + +**/ +EFI_STATUS +EFIAPI +WdogSetTimerPeriod ( + IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, + IN UINT64 TimerPeriod // In 100ns un= its + ) +{ + EFI_STATUS Status; + UINT64 TimerPeriodInSec; + UINT16 Val; + + Status =3D EFI_SUCCESS; + + if (TimerPeriod =3D=3D 0) { + // This is a watchdog stop request + WdogStop(); + goto EXIT; + } else { + // Convert the TimerPeriod (in 100 ns unit) to an equivalent second va= lue + + TimerPeriodInSec =3D DivU64x32(TimerPeriod, NANO_SECOND_BASE); + + // The registers in the Wdog are only 32 bits + if(TimerPeriodInSec > WT_MAX_TIME) { + // We could load the watchdog with the maximum supported value but + // if a smaller value was requested, this could have the watchdog + // triggering before it was intended. + // Better generate an error to let the caller know. + Status =3D EFI_DEVICE_ERROR; + goto EXIT; + } + + // set the new timeout value in the WCR + Val =3D WdogRead(PcdGet64(PcdWdog1BaseAddr) + WDOG_WCR_OFFSET); + Val &=3D ~WDOG_WCR_WT; + // Convert the timeout value from Seconds to timer count + Val |=3D ((WD_COUNT(TimerPeriodInSec) & WD_COUNT_MASK) << 8); + WdogWrite(PcdGet64(PcdWdog1BaseAddr) + WDOG_WCR_OFFSET, Val); + + // Start the watchdog + WdogStart(); + } + + EXIT: + return Status; +} + +/** + This function retrieves the period of timer interrupts in 100 ns units, + returns that value in TimerPeriod, and returns EFI_SUCCESS. If TimerPer= iod + is NULL, then EFI_INVALID_PARAMETER is returned. If a TimerPeriod of 0 = is + returned, then the timer is currently disabled. + + @param This The EFI_TIMER_ARCH_PROTOCOL instance. + @param TimerPeriod A pointer to the timer period to retrieve in 10= 0 ns units. If + 0 is returned, then the timer is currently disa= bled. + + + @retval EFI_SUCCESS The timer period was returned in TimerPeri= od. + @retval EFI_INVALID_PARAMETER TimerPeriod is NULL. + +**/ +EFI_STATUS +EFIAPI +WdogGetTimerPeriod ( + IN CONST EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, + OUT UINT64 *TimerPeriod + ) +{ + EFI_STATUS Status; + UINT64 ReturnValue; + UINT16 Val; + + Status =3D EFI_SUCCESS; + + if (TimerPeriod =3D=3D NULL) { + return EFI_INVALID_PARAMETER; + } + + // Check if the watchdog is stopped + if ((WdogRead(PcdGet64(PcdWdog1BaseAddr) + WDOG_WCR_OFFSET) + & WDOG_WCR_WDE) =3D=3D 0 ) { + // It is stopped, so return zero. + ReturnValue =3D 0; + } else { + // Convert the Watchdog ticks into equivalent TimerPeriod second value. + Val =3D (WdogRead(PcdGet64(PcdWdog1BaseAddr) + WDOG_WCR_OFFSET) + & WDOG_WCR_WT ) >> 8; + ReturnValue =3D WD_SEC(Val); + } + + *TimerPeriod =3D ReturnValue; + return Status; +} + +/** + Interface structure for the Watchdog Architectural Protocol. + + @par Protocol Description: + This protocol provides a service to set the amount of time to wait + before firing the watchdog timer, and it also provides a service to + register a handler that is invoked when the watchdog timer fires. + + @par When the watchdog timer fires, control will be passed to a handler + if one has been registered. If no handler has been registered, + or the registered handler returns, then the system will be + reset by calling the Runtime Service ResetSystem(). + + @param RegisterHandler + Registers a handler that will be called each time the + watchdogtimer interrupt fires. TimerPeriod defines the minimum + time between timer interrupts, so TimerPeriod will also + be the minimum time between calls to the registered + handler. + NOTE: If the watchdog resets the system in hardware, then + this function will not have any chance of executing. + + @param SetTimerPeriod + Sets the period of the timer interrupt in 100 nS units. + This function is optional, and may return EFI_UNSUPPORTED. + If this function is supported, then the timer period will + be rounded up to the nearest supported timer period. + + @param GetTimerPeriod + Retrieves the period of the timer interrupt in 100 nS units. + +**/ +EFI_WATCHDOG_TIMER_ARCH_PROTOCOL gWatchdogTimer =3D { + (EFI_WATCHDOG_TIMER_REGISTER_HANDLER) WdogRegisterHandler, + (EFI_WATCHDOG_TIMER_SET_TIMER_PERIOD) WdogSetTimerPeriod, + (EFI_WATCHDOG_TIMER_GET_TIMER_PERIOD) WdogGetTimerPeriod +}; + +/** + Initialize state information for the Watchdog Timer Architectural Protoc= ol. + + @param ImageHandle of the loaded driver + @param SystemTable Pointer to the System Table + + @retval EFI_SUCCESS Protocol registered + @retval EFI_OUT_OF_RESOURCES Cannot allocate protocol data structure + @retval EFI_DEVICE_ERROR Hardware problems + +**/ +EFI_STATUS +EFIAPI +WdogInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + EFI_HANDLE Handle; + UINT16 Val; + + + Val =3D WdogRead(PcdGet64(PcdWdog1BaseAddr) + WDOG_WCR_OFFSET); + + Val &=3D ~WDOG_WCR_WT; + + Val &=3D ~WDOG_WCR_WDE; + + Val |=3D WD_COUNT(WT_MAX_TIME) & WD_COUNT_MASK; + + WdogWrite(PcdGet64(PcdWdog1BaseAddr) + WDOG_WCR_OFFSET, Val); + + Val |=3D WDOG_WCR_WDE; + + // + // Make sure the Watchdog Timer Architectural Protocol + // has not been installed in the system yet. + // This will avoid conflicts with the universal watchdog + // + ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gEfiWatchdogTimerArchProtocolG= uid); + + // Register for an ExitBootServicesEvent + Status =3D gBS->CreateEvent (EVT_SIGNAL_EXIT_BOOT_SERVICES, TPL_NOTIFY, + ExitBootServicesEvent, NULL, &EfiExitBootServicesEvent); + if (EFI_ERROR(Status)) { + Status =3D EFI_OUT_OF_RESOURCES; + goto EXIT; + } + + // Install the Timer Architectural Protocol onto a new handle + Handle =3D NULL; + Status =3D gBS->InstallMultipleProtocolInterfaces( + &Handle, + &gEfiWatchdogTimerArchProtocolGuid, &gWatchdogTimer, + NULL + ); + if (EFI_ERROR(Status)) { + Status =3D EFI_OUT_OF_RESOURCES; + goto EXIT; + } + +EXIT: + if(EFI_ERROR(Status)) { + // The watchdog failed to initialize + ASSERT(FALSE); + } + + WdogPing(); + + return Status; +} diff --git a/Platform/NXP/Drivers/WatchDog/WatchDog.h b/Platform/NXP/Driver= s/WatchDog/WatchDog.h new file mode 100644 index 0000000..56ddbde --- /dev/null +++ b/Platform/NXP/Drivers/WatchDog/WatchDog.h @@ -0,0 +1,37 @@ +/** WatchDog.h +* +* 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. +* +**/ + +#ifndef __WATCHDOG_H__ +#define __WATCHDOG_H__ + +#define WDOG_SIZE 0x1000 +#define WDOG_WCR_OFFSET 0 +#define WDOG_WSR_OFFSET 2 +#define WDOG_WRSR_OFFSET 4 +#define WDOG_WICR_OFFSET 6 +#define WDOG_WCR_WT (0xFF << 8) +#define WDOG_WCR_WDE (1 << 2) +#define WDOG_SERVICE_SEQ1 0x5555 +#define WDOG_SERVICE_SEQ2 0xAAAA +#define WDOG_WCR_WDZST 0x1 +#define WDOG_WCR_WRE (1 << 3) /* -> WDOG Reset Enable */ + +#define WT_MAX_TIME 128 +#define WD_COUNT(Sec) (((Sec) * 2 - 1) << 8) +#define WD_COUNT_MASK 0xff00 +#define WD_SEC(Cnt) (((Cnt) + 1) / 2) + +#define NANO_SECOND_BASE 10000000 + +#endif //__WATCHDOG_H__ diff --git a/Platform/NXP/Drivers/WatchDog/WatchDogDxe.inf b/Platform/NXP/D= rivers/WatchDog/WatchDogDxe.inf new file mode 100644 index 0000000..4cf7d84 --- /dev/null +++ b/Platform/NXP/Drivers/WatchDog/WatchDogDxe.inf @@ -0,0 +1,47 @@ +# WatchDog.inf +# +# Component description file for WatchDog module +# +# 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 WatchDogDxe + FILE_GUID =3D ebd705fb-fa92-46a7-b32b-7f566d944614 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D WdogInitialize + +[Sources.common] + WatchDog.c + +[Packages] + MdePkg/MdePkg.dec + edk2-platforms/Platform/NXP/NxpQoriqLs.dec + +[LibraryClasses] + BaseLib + BeIoLib + PcdLib + UefiBootServicesTableLib + UefiDriverEntryPoint + +[Pcd] + gNxpQoriqLsTokenSpaceGuid.PcdWdog1BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdWdogBigEndian + +[Protocols] + gEfiWatchdogTimerArchProtocolGuid + +[Depex] + TRUE --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed Dec 25 02:35:00 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 1510044876681365.35925171015003; Tue, 7 Nov 2017 00:54:36 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 11DC62034D83E; Tue, 7 Nov 2017 00:50:36 -0800 (PST) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0049.outbound.protection.outlook.com [104.47.37.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 550562034D825 for ; Tue, 7 Nov 2017 00:50:34 -0800 (PST) Received: from BN6PR03CA0091.namprd03.prod.outlook.com (10.164.122.157) by DM5PR03MB2698.namprd03.prod.outlook.com (10.168.197.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.218.12; Tue, 7 Nov 2017 08:54:32 +0000 Received: from BL2FFO11FD012.protection.gbl (2a01:111:f400:7c09::122) by BN6PR03CA0091.outlook.office365.com (2603:10b6:405:6f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.178.6 via Frontend Transport; Tue, 7 Nov 2017 08:54:31 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD012.mail.protection.outlook.com (10.173.161.18) 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:31 +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 vA78s4Dc009319; Tue, 7 Nov 2017 01:54:28 -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.37.49; helo=nam02-cy1-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:11 +0530 Message-ID: <1510065736-9394-6-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: 131545184717856993; (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)(7966004)(336005)(346002)(39380400002)(39860400002)(376002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(97736004)(85426001)(106466001)(105606002)(2906002)(104016004)(53936002)(8656006)(6666003)(16799955002)(86362001)(2201001)(2950100002)(4326008)(110136005)(16586007)(316002)(77096006)(15188155005)(47776003)(5660300001)(966005)(5003940100001)(8676002)(8936002)(81166006)(81156014)(305945005)(54906003)(53376002)(33646002)(498600001)(48376002)(68736007)(6306002)(189998001)(356003)(36756003)(50226002)(50466002)(76176999)(50986999)(326664003)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR03MB2698; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD012; 1:86HVFxPiXnzJ1zd/8G+YQ8F93eAUQEYktmHybSxhAWVB0Quh9qMcyNbqxOazAU1/ZjfmpN/hhj9rpx24xH5OeXuo32L7+uS5+cLu5zVvv1IAcUCPqHLUHE86k2zewNJH MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e96d13e5-1d9e-44bf-ff80-08d525bd2979 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603199); SRVR:DM5PR03MB2698; X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2698; 3:M4BWPYU2o9N3mWYLnJWLMQya1ercc6GalOHPClXUIpVqn7fRrNlrG0vIXjvVA0OwM8HyGW64RjwfjSWMnsGOjMBxXh/zhExnzxflyef8WDxpTZPXndELCFA5FmeVfL7QwQRQ6oJWGytAdYfAxf4zS0wJuuG9npAu9Z9TBo62A6EqKhx4sTF2Lo+wFkz10PMGH6JsX9ebrzVTtA5MwGDTag3ikWzpWQl092Kjii1GbPPlbPnl0jYXsFTHVVCva1uLtlHoHaFIgB9UccAEV7KiykmfaXX1BFjHCysDpqWM1ofbZT+VrBGY1DI8wsOy+D8EvWBENR00GhXbgeJAbFnrJ02pyUtFbgs2LQ2xxqOSnpI=; 25:qpGVqKDg5H7feXPvQhvpVvp9jqu3oXyYz3+dERNjaxU6GZiDw0D7OO5nF7bIghAmIsdKGnDCs2wWsMHxMJqcyilPfkfQxIqxDwMdJLKkPdMr9Y49F5IGG1Nyw7ZGZ9zLmaK5ON5BfDHVphmCXb9i5AJPT+g3VwBcLf5ywQ5IylhBFAK/+ZZzuJijc/QXK75ZgZvRBfdadkoLiouHrsmd+QBeC2GLcssu1w9YpUp37HDA/F3RYYQlL59Jrsv1/dMLDu3vrRXWjsbi2jsepM0iH88v1vC1sIjUx6ZaBN7S6PG/mSd/Gf1k1MsTBGYjmXNrO7gL/ePje6zbgT1yIvFdwA== X-MS-TrafficTypeDiagnostic: DM5PR03MB2698: X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2698; 31:zvxKjde1wODaGzRXPoLDvnO/kB80l5zDB3YzYU2wI0z8f/z+rr4hBt1CsIPdlUKEw8ERIhYlzEEhpJD/PILIvWtwdfeZBGVXOelpzJqnDeIEaONBMIG8Otl5MVAQHJjzgkUu6Iusz3D7YeQCcuqAmQYw4GulG+VaDA5G2dp4+Mivi58rdcSWop+C17BUOWg0A58DG1DtW1pnj5UOd8H5aA2miPUsxSOKjfkniNh8Qs0=; 4:3pzY370kJ3Ub1YcHpGiq/dic2UL9p4JPG0XPJYLce6IGkqJ1xRXjpgqCxa59FOibJBssTowTGGmqENPQx2eqcABV3rQIxZwoMXyVc3n9UQTnflTnV7Tds1BCMGOpydZv2KXoKa567KdcwKeOQUOqq6ThJogwq4n80XVXTeoNjPwRMFW087cEEiNQjlGeSsFihyJlOWHlXjGvVJB6FAUGhXFo8pxUyUb+A+LdJNGoNZo9SfGUr3qs0uOC6RtLiwhcRNW7uqlN2A3tDzI0oR7+coi249og88fnan4by21IFtUiUxbHpa0eZ0K4wprhvNy1kdfvKDdUsBYzw30NdvdQf58y1J/SoHC4O67YFRcqX7o= X-Exchange-Antispam-Report-Test: UriScan:(278428928389397)(185117386973197); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(2401047)(5005006)(8121501046)(3002001)(10201501046)(100000703101)(100105400095)(3231021)(93006095)(93001095)(6055026)(2017110403001)(6096035)(20161123559100)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123563025)(20161123565025)(20161123561025)(20161123556025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DM5PR03MB2698; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DM5PR03MB2698; X-Forefront-PRVS: 0484063412 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM5PR03MB2698; 23:hUwIta9A9TF3sK32vyxpWJR5XvYRMPgcE+I4y7nIa?= =?us-ascii?Q?C23W2Ob1F285349QQuxJtBCPAtFKxOaX5+0TuSALoMCDy934G4jcfhmX67ef?= =?us-ascii?Q?irymnzM8Z+032ySunFijv9oI/UDr1oKbePKxeS5mNz9/ySlgN+UYpR41R7bF?= =?us-ascii?Q?7fxUXwSuRkbfm+heGhmwdFUfAd3RdWBo7/NCTCynLtfi/6QS4yTHV4kA+2d1?= =?us-ascii?Q?2Vkc4JueTZwvs/vONZAhd5A7wTVS4xIQ1NTzGyVBE5+hEG9XDUr1RpPkprtI?= =?us-ascii?Q?OC5Ly/h5xklLOMJenijc9qrfU0NXM2e5bRCkfY35GrSYCUUwxsYJiOtYM35S?= =?us-ascii?Q?ytCW16nrQsNPtkhVnvsSptmHE/kTILVuYTeOI92Lc2i2owveBVXfCgaqgrmf?= =?us-ascii?Q?3RIxDDNepY/ziGPqJayLHxC7it+V8hvHkWT7T66pa6XIBve6txbhLtiETJaG?= =?us-ascii?Q?ZZPHMH7hehnnm7D0zZRAMqxfW2Lxeqpqu5FkdIcKKS7b0daG6Ue2tw+8uUKX?= =?us-ascii?Q?lgoeADjJPmd8E5NAtxKJTGIDtUD0+UdSkthbwPBpnjjiTGvA/MEHUtwmDPbb?= =?us-ascii?Q?RU2HCqPQz9GKb8t8WeOu+58Zy+J8NC4D84X0iWfZBxuf0F8Agx4UFFkNr9OA?= =?us-ascii?Q?IUcUAmq5DEB7F0i7dxxnrvC5YWCW9uCZcAQeaWrhyN4cE94nYvIc3m4rKxqD?= =?us-ascii?Q?BSAkTVfUBvQpim6qTFv3LS/Rlv6I6Yiy/LGusvl9dfg5xZrhOeHKul2UI1kj?= =?us-ascii?Q?lm2ZmngDCOvKhROa3dDLNlf+EEfsQ5smnp9lbk689NaDYwnjskxLybxSuVES?= =?us-ascii?Q?fTYKa7O/8t7H08BKUKyK+QonrvGiGkydX/oXse1LzcYQkdpeVEzGl9CgiUlM?= =?us-ascii?Q?jUQxXglcLPX0ehdT71LYYKlFtGkSN5DWXALTeWPiJuXtkCxOdtsZDaSFpon/?= =?us-ascii?Q?wAE6qYv0fw48n8ld/xtDy/rRBpn5Exgz/u5zL6rxrG9YhxrRGQjkRTxCDsdx?= =?us-ascii?Q?IablKFvIMFQGc2oxbz9BXFBc2ul3YMYHK9LtaMLZhi74iFROTm5Lv3eO5zPY?= =?us-ascii?Q?bpJWynh0YIprEY4kuOxqIuTgf4RIDMjEppHh6r2HyOLWx006/7YjRwiyH+3m?= =?us-ascii?Q?7TgrDXTTnmHRDKV17wwxgZ/toc4lZFOIVGcWlsl9NovBEn5iZLCb41F79h0k?= =?us-ascii?Q?/pQbrAtVEDHRhWZAm0CtSe+cvEYOPMPfZ4TjiV6HEgy1ueatGo+gcVhJfFq1?= =?us-ascii?Q?qn+okQFB5pLgxKncmcOpJinRMXy0t0vzDRsTWnoKGyqf6dLcWdzAJaeOulsS?= =?us-ascii?Q?SPrG9Gasht/ybLLWNmvZZoL5w6uMtYG5V70g/T6D0If?= X-Microsoft-Exchange-Diagnostics: 1; DM5PR03MB2698; 6:vZX9fn2hfwHcqj1ZPDWsx9jCJCi19fajRIkJEPu9Hy6uEvf9eDAqp4R6KJxIVGdiYWY8h3xHi6o574xerlmYRXQKVHk8BdkG9jxZoTtfHprf7qDc3OrWrH8rmZQaUbRZRIcg/cGTQimt2Krvmmgw2R6OIuVvQZZkM6mtbRsjg7ylKfevy/k9PW9DHRjdf3IJ9LdInjACy08URgt5ihMpN3vK+/hu1noy8EvAi5RDP4N+iV+v80z2tAQ7IXCWW1jBw/Scl2B0CuH1EbWoj29wmSddY9UjTN8dRgwrNfTAQMoMk2E3s8qjEsSgwUkUZQbNa7hFphk8KuK2cpVV/jgD1y1ilZXBzX51q0Pmn+DOkJc=; 5:LUvmkOaneAaYAsqxVZ8U/U1BOdeXvrr7UMGlICFfxDwgwjnfXatC/82VQuRtjINmZgzQlBn0g2gDnTFGcUdSHf7W85uG9DeQBmTJ+q72DiqzcG4rLNdEPqIOlzuNARADHXeM7qqXUZ0L+4N7FAEljyfWPn+G+cf715h8Ybs6eJE=; 24:7tTZE018uKD+Pzmwe7dBjsrjqZ2h1EjkBGxxp26SZxKiAeJ2akZrcGg48eEca8oaGwseFRgxRlA7PSXTy3zQqXUXZMHnBbVhEMcxW0MuFs8=; 7:JmJBadaTsnFnCZg+tkUAnFgVuZyh2dWoITroiLmY7/RwgdOtH/DMzwVrbx/5TzsHJP/pk3RpMtZ6ytOHri9T9NZoPE/yvV5zIscRidT8GSHtaXL1H2gnaZEZ5jTBJ+PK7cHMwlr/HQq8PLfjky+BTy6Ox9USn4dh2lT1NmV5Rvrs6Gl7KzHOpC8JIUuK2tU8+Vz0j7h6CFIoNbK7T5ouvGf/irAumAI6szpg7NAIfY4x9hoQ30T8AxlJuzaDpT+H SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 08:54:31.6140 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e96d13e5-1d9e-44bf-ff80-08d525bd2979 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: DM5PR03MB2698 Subject: [edk2] [PATCH 05/10] Platform/NXP : Add support for DUART library 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" Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- Platform/NXP/Library/DUartPortLib/DUart.h | 128 ++++++++ Platform/NXP/Library/DUartPortLib/DUartPortLib.c | 334 +++++++++++++++++= ++++ Platform/NXP/Library/DUartPortLib/DUartPortLib.inf | 39 +++ 3 files changed, 501 insertions(+) create mode 100644 Platform/NXP/Library/DUartPortLib/DUart.h create mode 100644 Platform/NXP/Library/DUartPortLib/DUartPortLib.c create mode 100644 Platform/NXP/Library/DUartPortLib/DUartPortLib.inf diff --git a/Platform/NXP/Library/DUartPortLib/DUart.h b/Platform/NXP/Libra= ry/DUartPortLib/DUart.h new file mode 100644 index 0000000..907790b --- /dev/null +++ b/Platform/NXP/Library/DUartPortLib/DUart.h @@ -0,0 +1,128 @@ +/** DUart.h +* Header defining the DUART constants (Base addresses, sizes, flags) +* +* Based on Serial I/O Port library headers available in PL011Uart.h +* +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. +* Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved. +* 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. +* +**/ + +#ifndef __DUART_H__ +#define __DUART_H__ + +// FIFO Control Register +#define DUART_FCR_FIFO_EN 0x01 /* Fifo enable */ +#define DUART_FCR_CLEAR_RCVR 0x02 /* Clear the RCVR FIFO */ +#define DUART_FCR_CLEAR_XMIT 0x04 /* Clear the XMIT FIFO */ +#define DUART_FCR_DMA_SELECT 0x08 /* For DMA applications */ +#define DUART_FCR_TRIGGER_MASK 0xC0 /* Mask for the FIFO trigger range= */ +#define DUART_FCR_TRIGGER_1 0x00 /* Mask for trigger set at 1 */ +#define DUART_FCR_TRIGGER_4 0x40 /* Mask for trigger set at 4 */ +#define DUART_FCR_TRIGGER_8 0x80 /* Mask for trigger set at 8 */ +#define DUART_FCR_TRIGGER_14 0xC0 /* Mask for trigger set at 14 */ +#define DUART_FCR_RXSR 0x02 /* Receiver soft reset */ +#define DUART_FCR_TXSR 0x04 /* Transmitter soft reset */ + +// Modem Control Register +#define DUART_MCR_DTR 0x01 /* Reserved */ +#define DUART_MCR_RTS 0x02 /* RTS */ +#define DUART_MCR_OUT1 0x04 /* Reserved */ +#define DUART_MCR_OUT2 0x08 /* Reserved */ +#define DUART_MCR_LOOP 0x10 /* Enable loopback test mode */ +#define DUART_MCR_AFE 0x20 /* AFE (Auto Flow Control) */ +#define DUART_MCR_DMA_EN 0x04 +#define DUART_MCR_TX_DFR 0x08 + +// Line Control Register +/* +* Note: if the word length is 5 bits (DUART_LCR_WLEN5), then setting +* DUART_LCR_STOP will select 1.5 stop bits, not 2 stop bits. +*/ +#define DUART_LCR_WLS_MSK 0x03 /* character length select mask */ +#define DUART_LCR_WLS_5 0x00 /* 5 bit character length */ +#define DUART_LCR_WLS_6 0x01 /* 6 bit character length */ +#define DUART_LCR_WLS_7 0x02 /* 7 bit character length */ +#define DUART_LCR_WLS_8 0x03 /* 8 bit character length */ +#define DUART_LCR_STB 0x04 /* # stop Bits, off=3D1, on=3D1.5 = or 2) */ +#define DUART_LCR_PEN 0x08 /* Parity eneble */ +#define DUART_LCR_EPS 0x10 /* Even Parity Select */ +#define DUART_LCR_STKP 0x20 /* Stick Parity */ +#define DUART_LCR_SBRK 0x40 /* Set Break */ +#define DUART_LCR_BKSE 0x80 /* Bank select enable */ +#define DUART_LCR_DLAB 0x80 /* Divisor latch access bit */ + +// Line Status Register +#define DUART_LSR_DR 0x01 /* Data ready */ +#define DUART_LSR_OE 0x02 /* Overrun */ +#define DUART_LSR_PE 0x04 /* Parity error */ +#define DUART_LSR_FE 0x08 /* Framing error */ +#define DUART_LSR_BI 0x10 /* Break */ +#define DUART_LSR_THRE 0x20 /* Xmit holding register empty */ +#define DUART_LSR_TEMT 0x40 /* Xmitter empty */ +#define DUART_LSR_ERR 0x80 /* Error */ + +// Modem Status Register +#define DUART_MSR_DCTS 0x01 /* Delta CTS */ +#define DUART_MSR_DDSR 0x02 /* Reserved */ +#define DUART_MSR_TERI 0x04 /* Reserved */ +#define DUART_MSR_DDCD 0x08 /* Reserved */ +#define DUART_MSR_CTS 0x10 /* Clear to Send */ +#define DUART_MSR_DSR 0x20 /* Reserved */ +#define DUART_MSR_RI 0x40 /* Reserved */ +#define DUART_MSR_DCD 0x80 /* Reserved */ + +// Interrupt Identification Register +#define DUART_IIR_NO_INT 0x01 /* No interrupts pending */ +#define DUART_IIR_ID 0x06 /* Mask for the interrupt ID */ +#define DUART_IIR_MSI 0x00 /* Modem status interrupt */ +#define DUART_IIR_THRI 0x02 /* Transmitter holding register em= pty */ +#define DUART_IIR_RDI 0x04 /* Receiver data interrupt */ +#define DUART_IIR_RLSI 0x06 /* Receiver line status interrupt = */ + +// Interrupt Enable Register +#define DUART_IER_MSI 0x08 /* Enable Modem status interrupt */ +#define DUART_IER_RLSI 0x04 /* Enable receiver line status int= errupt */ +#define DUART_IER_THRI 0x02 /* Enable Transmitter holding regi= ster int. */ +#define DUART_IER_RDI 0x01 /* Enable receiver data interrupt = */ + +// LCR defaults +#define DUART_LCR_8N1 0x03 +#define DUART_LCRVAL DUART_LCR_8N1 /* 8 data, 1 sto= p, no parity */ +#define DUART_MCRVAL (DUART_MCR_DTR | \ + DUART_MCR_RTS) /* RTS/DTR */ +#define DUART_FCRVAL (DUART_FCR_FIFO_EN | \ + DUART_FCR_RXSR | \ + DUART_FCR_TXSR) /* Clear & enabl= e FIFOs */ + +#define URBR 0x0 +#define UTHR 0x0 +#define UDLB 0x0 +#define UDMB 0x1 +#define UIER 0x1 +#define UIIR 0x2 +#define UFCR 0x2 +#define UAFR 0x2 +#define ULCR 0x3 +#define UMCR 0x4 +#define ULSR 0x5 +#define UMSR 0x6 +#define USCR 0x7 +#define UDSR 0x10 + +extern +UINT32 +CalculateBaudDivisor ( + IN UINT64 BaudRate + ); + +#endif /* __DUART_H__ */ diff --git a/Platform/NXP/Library/DUartPortLib/DUartPortLib.c b/Platform/NX= P/Library/DUartPortLib/DUartPortLib.c new file mode 100644 index 0000000..99766d1 --- /dev/null +++ b/Platform/NXP/Library/DUartPortLib/DUartPortLib.c @@ -0,0 +1,334 @@ +/** DuartPortLib.c + DUART (NS16550) library functions + + Based on Serial I/O Port library functions available in PL011SerialPortL= ib.c + + Copyright (c) 2008 - 2010, Apple Inc. All rights reserved.
+ Copyright (c) 2012 - 2013, ARM Ltd. All rights reserved.
+ Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved. + 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 +#include + +#include "DUart.h" + +STATIC CONST UINT32 mInvalidControlBits =3D (EFI_SERIAL_SOFTWARE_LOOPBACK_= ENABLE | \ + EFI_SERIAL_DATA_TERMINAL_READY); + +/** + Assert or deassert the control signals on a serial port. + The following control signals are set according their bit settings : + . Request to Send + . Data Terminal Ready + + @param[in] Control The following bits are taken into account : + . EFI_SERIAL_REQUEST_TO_SEND : assert/deassert the + "Request To Send" control signal if this bit is + equal to one/zero. + . EFI_SERIAL_DATA_TERMINAL_READY : assert/deassert + the "Data Terminal Ready" control signal if this + bit is equal to one/zero. + . EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : enable/dis= able + the hardware loopback if this bit is equal to + one/zero. + . EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : not suppor= ted. + . EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : enable/ + disable the hardware flow control based on CTS (= Clear + To Send) and RTS (Ready To Send) control signals. + + @retval EFI_SUCCESS The new control bits were set on the device. + @retval EFI_UNSUPPORTED The device does not support this operation. + +**/ +EFI_STATUS +EFIAPI +SerialPortSetControl ( + IN UINT32 Control + ) +{ + UINT32 McrBits; + UINTN UartBase; + + UartBase =3D (UINTN)PcdGet64 (PcdSerialRegisterBase); + + if (Control & (mInvalidControlBits)) { + return EFI_UNSUPPORTED; + } + + McrBits =3D MmioRead8 (UartBase + UMCR); + + if (Control & EFI_SERIAL_REQUEST_TO_SEND) { + McrBits |=3D DUART_MCR_RTS; + } else { + McrBits &=3D ~DUART_MCR_RTS; + } + + if (Control & EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE) { + McrBits |=3D DUART_MCR_LOOP; + } else { + McrBits &=3D ~DUART_MCR_LOOP; + } + + if (Control & EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE) { + McrBits |=3D DUART_MCR_AFE; + } else { + McrBits &=3D ~DUART_MCR_AFE; + } + + MmioWrite32 (UartBase + UMCR, McrBits); + + return EFI_SUCCESS; +} + +/** + Retrieve the status of the control bits on a serial device. + + @param[out] Control Status of the control bits on a serial device : + + . EFI_SERIAL_DATA_CLEAR_TO_SEND, + EFI_SERIAL_DATA_SET_READY, + EFI_SERIAL_RING_INDICATE, + EFI_SERIAL_CARRIER_DETECT, + EFI_SERIAL_REQUEST_TO_SEND, + EFI_SERIAL_DATA_TERMINAL_READY + are all related to the DTE (Data Terminal Equip= ment) + and DCE (Data Communication Equipment) modes of + operation of the serial device. + . EFI_SERIAL_INPUT_BUFFER_EMPTY : equal to one if= the + receive buffer is empty, 0 otherwise. + . EFI_SERIAL_OUTPUT_BUFFER_EMPTY : equal to one i= f the + transmit buffer is empty, 0 otherwise. + . EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : equal to = one if + the hardware loopback is enabled (the ouput fee= ds the + receive buffer), 0 otherwise. + . EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : equal to = one if + a loopback is accomplished by software, 0 other= wise. + . EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : equal= to + one if the hardware flow control based on CTS (= Clear + To Send) and RTS (Ready To Send) control signal= s is + enabled, 0 otherwise. + + @retval EFI_SUCCESS The control bits were read from the serial devi= ce. + +**/ + +EFI_STATUS +EFIAPI +SerialPortGetControl ( + OUT UINT32 *Control + ) +{ + UINT32 MsrRegister; + UINT32 McrRegister; + UINT32 LsrRegister; + UINTN UartBase; + + UartBase =3D (UINTN)PcdGet64 (PcdSerialRegisterBase); + + MsrRegister =3D MmioRead8 (UartBase + UMSR); + McrRegister =3D MmioRead8 (UartBase + UMCR); + LsrRegister =3D MmioRead8 (UartBase + ULSR); + + *Control =3D 0; + + if ((MsrRegister & DUART_MSR_CTS) =3D=3D DUART_MSR_CTS) { + *Control |=3D EFI_SERIAL_CLEAR_TO_SEND; + } + + if ((McrRegister & DUART_MCR_RTS) =3D=3D DUART_MCR_RTS) { + *Control |=3D EFI_SERIAL_REQUEST_TO_SEND; + } + + if ((LsrRegister & DUART_LSR_TEMT) =3D=3D DUART_LSR_TEMT) { + *Control |=3D EFI_SERIAL_OUTPUT_BUFFER_EMPTY; + } + + if ((McrRegister & DUART_MCR_AFE) =3D=3D DUART_MCR_AFE) { + *Control |=3D EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE; + } + + if ((McrRegister & DUART_MCR_LOOP) =3D=3D DUART_MCR_LOOP) { + *Control |=3D EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE; + } + + return EFI_SUCCESS; +} + +/** + Programmed hardware of Serial port. + + @return Always return EFI_SUCCESS. + +**/ + +EFI_STATUS +EFIAPI +SerialPortInitialize ( + VOID + ) +{ + UINT64 BaudRate; + UINT32 BaudDivisor; + UINTN UartBase; + + UartBase =3D (UINTN)PcdGet64 (PcdSerialRegisterBase); + BaudRate =3D (UINTN)PcdGet64 (PcdUartDefaultBaudRate); + + BaudDivisor =3D CalculateBaudDivisor(BaudRate); + + while (!(MmioRead8(UartBase + ULSR) & DUART_LSR_TEMT)); + + // + // Enable received data available interrupt, setup data format, + // setup baud divisor + // + MmioWrite8(UartBase + UIER, 0x1); + MmioWrite8(UartBase + ULCR, DUART_LCR_BKSE | DUART_LCRVAL); + MmioWrite8(UartBase + UDLB, 0); + MmioWrite8(UartBase + UDMB, 0); + MmioWrite8(UartBase + ULCR, DUART_LCRVAL); + MmioWrite8(UartBase + UMCR, DUART_MCRVAL); + MmioWrite8(UartBase + UFCR, DUART_FCRVAL); + MmioWrite8(UartBase + ULCR, DUART_LCR_BKSE | DUART_LCRVAL); + MmioWrite8(UartBase + UDLB, BaudDivisor & 0xff); + MmioWrite8(UartBase + UDMB, (BaudDivisor >> 8) & 0xff); + MmioWrite8(UartBase + ULCR, DUART_LCRVAL); + + return EFI_SUCCESS; +} + +/** + Write data to serial device. + + @param Buffer Point of data buffer which need to be written. + @param NumberOfBytes Number of output bytes which are cached in Buff= er. + + @retval 0 Write data failed. + @retval !0 Actual number of bytes written to serial device. + +**/ +UINTN +EFIAPI +SerialPortWrite ( + IN UINT8 *Buffer, + IN UINTN NumberOfBytes + ) +{ + UINT8 *Final; + UINTN UartBase; + + Final =3D &Buffer[NumberOfBytes]; + UartBase =3D (UINTN)PcdGet64 (PcdSerialRegisterBase); + + while (Buffer < Final) { + while ((MmioRead8(UartBase + ULSR) & DUART_LSR_THRE) =3D=3D 0); + MmioWrite8(UartBase + UTHR, *Buffer++); + } + + return NumberOfBytes; +} + +/** + Read data from serial device and save the data in buffer. + + @param Buffer Point of data buffer which need to be written. + @param NumberOfBytes Number of output bytes which are cached in Buff= er. + + @retval 0 Read data failed. + @retval !0 Actual number of bytes read from serial device. + +**/ +UINTN +EFIAPI +SerialPortRead ( + OUT UINT8 *Buffer, + IN UINTN NumberOfBytes + ) +{ + UINTN Count; + UINTN UartBase; + + UartBase =3D (UINTN)PcdGet64 (PcdSerialRegisterBase); + + for (Count =3D 0; Count < NumberOfBytes; Count++, Buffer++) { + /* + * Loop while waiting for a new char(s) to arrive in the + * RxFIFO + */ + while ((MmioRead8(UartBase + ULSR) & DUART_LSR_DR) =3D=3D 0); + + *Buffer =3D MmioRead8(UartBase + URBR); + } + + return NumberOfBytes; +} + +/** + Check to see if any data is available to be read from the debug device. + + @retval EFI_SUCCESS At least one byte of data is available to be r= ead + @retval EFI_NOT_READY No data is available to be read + @retval EFI_DEVICE_ERROR The serial device is not functioning properly + +**/ +BOOLEAN +EFIAPI +SerialPortPoll ( + VOID + ) +{ + UINTN UartBase; + + UartBase =3D (UINTN)PcdGet64 (PcdSerialRegisterBase); + + return ((MmioRead8 (UartBase + ULSR) & DUART_LSR_DR) !=3D 0); +} + +/** + Set new attributes to LS1043a. + + @param BaudRate The baud rate of the serial device. If t= he baud rate is not supported, + the speed will be reduced down to the ne= arest supported one and the + variable's value will be updated accordi= ngly. + @param ReceiveFifoDepth The number of characters the device will= buffer on input. If the specified + value is not supported, the variable's v= alue will be reduced down to the + nearest supported one. + @param Timeout If applicable, the number of microsecond= s the device will wait + before timing out a Read or a Write oper= ation. + @param Parity If applicable, this is the EFI_PARITY_TY= PE that is computed or checked + as each character is transmitted or rece= ived. If the device does not + support parity, the value is the default= parity value. + @param DataBits The number of data bits in each character + @param StopBits If applicable, the EFI_STOP_BITS_TYPE nu= mber of stop bits per character. + If the device does not support stop bits= , the value is the default stop + bit value. + + @retval EFI_SUCCESS All attributes were set correctly on the= serial device. + +**/ +EFI_STATUS +EFIAPI +SerialPortSetAttributes ( + IN OUT UINT64 *BaudRate, + IN OUT UINT32 *ReceiveFifoDepth, + IN OUT UINT32 *Timeout, + IN OUT EFI_PARITY_TYPE *Parity, + IN OUT UINT8 *DataBits, + IN OUT EFI_STOP_BITS_TYPE *StopBits + ) +{ + return SerialPortInitialize (); +} diff --git a/Platform/NXP/Library/DUartPortLib/DUartPortLib.inf b/Platform/= NXP/Library/DUartPortLib/DUartPortLib.inf new file mode 100644 index 0000000..ead8b40 --- /dev/null +++ b/Platform/NXP/Library/DUartPortLib/DUartPortLib.inf @@ -0,0 +1,39 @@ +# DUartPortLib.inf +# +# Component description file for DUartPortLib module +# +# Copyright (c) 2013, Freescale Ltd. All rights reserved. +# 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 DUartPortLib + FILE_GUID =3D 8ecefc8f-a2c4-4091-b80f-20f7aeb0567f + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D SerialPortLib + +[Sources.common] + DUartPortLib.c + +[LibraryClasses] + PcdLib + SocLib + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + +[Pcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed Dec 25 02:35:00 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 1510044879966165.33180911057593; Tue, 7 Nov 2017 00:54:39 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5160A2034EE00; Tue, 7 Nov 2017 00:50:39 -0800 (PST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0082.outbound.protection.outlook.com [104.47.36.82]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B13CD2034D825 for ; Tue, 7 Nov 2017 00:50:38 -0800 (PST) Received: from MWHPR03CA0056.namprd03.prod.outlook.com (10.174.173.173) by BN3PR03MB2353.namprd03.prod.outlook.com (10.166.74.148) 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:36 +0000 Received: from BL2FFO11FD047.protection.gbl (2a01:111:f400:7c09::180) by MWHPR03CA0056.outlook.office365.com (2603:10b6:301:3b::45) 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:35 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD047.mail.protection.outlook.com (10.173.161.209) 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:35 +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 vA78s4Dd009319; Tue, 7 Nov 2017 01:54:32 -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.36.82; helo=nam02-sn1-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:12 +0530 Message-ID: <1510065736-9394-7-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: 131545184758548163; (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)(346002)(376002)(39380400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(85426001)(33646002)(106466001)(104016004)(305945005)(356003)(2906002)(50986999)(76176999)(105606002)(551934003)(53376002)(966005)(4326008)(36756003)(53936002)(5660300001)(47776003)(498600001)(8656006)(189998001)(16799955002)(15188155005)(2950100002)(6306002)(6666003)(5003940100001)(2201001)(16586007)(110136005)(68736007)(86362001)(575784001)(50466002)(54906003)(48376002)(77096006)(8676002)(97736004)(50226002)(316002)(81156014)(81166006)(8936002)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2353; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD047; 1:lHiLOC24hH48vuTaWZaAjCw8uTfE9PQC6cThldZly9Agif7fOeLFnezN8vyi12N5ORc3EjHIfsIgMmaAH2DdJ/VltWELfiAnj/THh1lIvYoEpHtpMk5KlZ/cEbb+YrF5 MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: c5643cae-5b99-47bb-e564-08d525bd2be6 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603199); SRVR:BN3PR03MB2353; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2353; 3:dDGTq51nlLSNYfh7Y6q+PqOBcBCWZhdslZuM6Vlehsbi2f+ltV3FVHFQcjG338Wwn32GI1MdEbPbOPlmM+fZPovnuVBSe25vGqd6MPddlOk6ci+kTQppb8KnhGMdcyU0y+ReDBrCgx6uqNK0BLZ/RFzOmXlUbXj4MwrkfYObTcSQVlh/JwkIBG4tXwbZFQHK+KtRrh0gPdWu4xCoKxqJmgP3REcgdLWxKkyEYc4LCXeN+Z9xf/XAp5tD1h4Tn6fKaztb9CTXuo5YnR3svz/yaVmyjlDw3gmvbQzC+S6u2Fu1bckiLzPSvNCH0bPVWJY3HlMIZWQzP4p2G13L3YkaF/b/VthyIpVsno2M0sq43D0=; 25:2TWx2oIRBjXfOZZlIzzQOrAlq/D75jF9dC0cPNrokSQIjZdIo1IXdM8K6Q5VbCNV0WyoiB5HFJ5FYl+y/3iFkMuWgJ//pkQgOiWvjn1xeV5gaMWZf3Nu5jxoDVJdP8shq31aOryJeESA/Kqtt+yTqv0q78qY+gfLgJIioaJ8C7YQ5ljaxtpkkLG+9GKkKNFyKNENNyKss/1Gs1w3+D8nlk4dDYKsgjBzfGBgtPQRY+ZCBAmQGvgqmm2UWQIPHvtWmGC4oMpAGVRaO908Rw9CC5Y4Ayc0baJpsNqLeb31HuFg80H5QXoI//6Eb+uNG99+yvW3nqT+0NSHQ75afXkr5g== X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PR03MB2353: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2353; 31:xxYTBJzI9Hn4jCeqCGsO0P7rmsgSgNR+jcmod/jljBBzCcgnWlgo2KcrLAPeOoX1WSe5RqCRO3REE3MZXxwlrYTNMrLyjLgssr9yyM3I/CjzfCDkXTxm2XsXNxmDbQlfBJSI0rEXOnmqVWWn6KGiLNHc/XKziLpsDvyNNcXR8xssiMDcez2v2QLYdUTAAS78ge32p+M2YouM6gWCWQ1xpsJ4ljcC4bpd6ZiyLxZPyO0=; 4:7QfDfel0NM23M9ltzsmXlaNfXsahngQv2riR6gmLBT6gOgBIGPioVTWGkXGZVCeRWsTTzxL7xDWSGe+vV2Mc8hH/nPo9BynaYzTmaGP9crP3HJR9Gf+XKs0s3ucbJ1pcb2TshvSU79/VAO8IGwyZfNwkhLwcrzvULmoQY+PSZdRDj2Ax5P8tY+Z/+l1QCVP+NXOISOXS7WJiOhWdu0UIrjjswWTdJSTAoCm63Jmz/ogsN+Ytvnu7MeTOhn/0cWc6iFO7sTH2oTy+iSidxuf7GIGO0m/DgO1/ANs+4MXfMKATnS4B5a2vJanyo5+iW62q 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)(10201501046)(3002001)(3231021)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6096035)(20161123563025)(20161123556025)(20161123565025)(20161123559100)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123561025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR03MB2353; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR03MB2353; X-Forefront-PRVS: 0484063412 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR03MB2353; 23:Cwvqkr3V0mop+1ePlx9kc853biCzvQN/gQ5rDEmsZ?= =?us-ascii?Q?nPE/mLMTQeDOQ6921OQJ60BEAQXh+TBXCQOThSDs7T8oqi1KJz1bEdfdkihU?= =?us-ascii?Q?KKEjdnEnNm13oGvdai72YbHcg+/vn4empnt/Xef50JdfvrF9HVbQqAt8RybF?= =?us-ascii?Q?v5QHBdjb+W7n6L/V5VBvQBVvbhCJfoDDgxumRtIRf3cz2DV7KSUEtcsZb017?= =?us-ascii?Q?sDYZnMKqlbXszup3Sti5Q+NOW5uFCYg5y9Zr8GS+ctHHKgsK9ksU0BHC2Z2c?= =?us-ascii?Q?roO13NsIkn7JyQnQSy93NYWo9g+J+LCaY06EX5Gwr/nP7MLh9XwpBVkavYho?= =?us-ascii?Q?lkUG96URrV3IiIauTPYfWT9W0qRv/G6L7IMdQkrL3ALO9qpJI0N35H85HMzd?= =?us-ascii?Q?juTxNUZGdL21dWfn1khideqLHlCCjFi/uKBPLFevm0nrgSBnplAamtBgau1e?= =?us-ascii?Q?EkDG1cXjOVp/oE59SAXNogRMwIj0uCKwS0AJkjJs0EseS4bfMdQCsd9jUIUV?= =?us-ascii?Q?ERj3sIEe59BguVb//uqKapADo0e2MNN9x2MJyoTktLjTmwWtSCdkyTOIpnha?= =?us-ascii?Q?36HeAxuyXODGvoTsev1bM2n7RmeDEWcLlAsq0RWlNkGKloAz/XQHBStBqbZ9?= =?us-ascii?Q?g77JAdztTgh/4vBdhw1w8APmVKEVJeORhwf2p12uxTRZuM4RuJ9F5aCzAl+H?= =?us-ascii?Q?wt+JaMn1DYLUKOoe1iXbBxqzeXveREytq/izUH0bkhAEQA0gMHqAsRw5o4Es?= =?us-ascii?Q?5UDBKIvNXp7rFcwiDc6kjy3i1dzl0o6TUKdBREdFJ8MJTDDu9JjVC2+fUFE+?= =?us-ascii?Q?xYYSHHyh86VC7NPh9k+seyX0sSuSsFLhLammn7M6t2jmFmCmyrnoeabkEahW?= =?us-ascii?Q?oslyY4IUlRTxByWRsdZwaRTfHONlHwpqD8aiCE21woJdzv3OnamUttOYj37I?= =?us-ascii?Q?c6oLGGnbS+tmHlo2AXblY0cktJk7Rqr/DytO0G5EC2OE9s28OUCWlIlD8cdB?= =?us-ascii?Q?Evh3gyslS/AfmQrQlvAuoa9dxmDeRogxbVaTZkUS1vf8Vrb/yP213k1wIPqL?= =?us-ascii?Q?qwI/+rBGwUyDchxckKQ2+1Mhg//2chYowrudtURE4tQwDwEd/lN+7+EHmjU0?= =?us-ascii?Q?6HgMQIfbaOd9fFDj/NQjBxq4zlMwZrtDE7shgndSpNLgUZO8S+39g0y47Ntj?= =?us-ascii?Q?tlIAkgpv/N75hynN1RDFDXYIs5CNimY1QnNXCLx6U7EPZD/g+V59vzjGI/bd?= =?us-ascii?Q?YqDlW9GW0kS5XujSIWieRCmJkCDnp1BMvib9xH13XP1JlaAOpx2AUZ6dy6Zj?= =?us-ascii?Q?gl1w4EexE9jUElPWf7tVjrGW8SL1hegqu1kNa0ba51x6Ss/pncOdG4onFImb?= =?us-ascii?Q?s/L14YefQZe7WRlDy4rKzi18QA=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2353; 6:cQfEbMNUr0vPV2QfxphrAFJBTXefDvPxkj2yj86uNp+8Hk6BPo6G2nb1bqzF+e/yfcJeo8xrB2/Dvf4EZJO6UGhraibDa2CxnmagRNWyGZqvTXM5H9hWv5hmkuxIoBks0cDDsPqaqWIfQJt6jweqYWwME3rZqQET9netug8lcEZseN0skiTGdghOEGMEy/xGGkKVyn/edt2ACEVTQR9/dE7s+7+bBjnMBdyluhhKkuACD6F22rs6qZp6/cg/X2tzMt9QrGBQYZaFDnkg8ATXgZbFEeQnhBzM0dRB9zXIDgLtyrJCwOtW8VyMjpbxgMYI/MNzZtdHEUW0Tu+nlNybPNfBqGQumEhlGnrFfe/pXqI=; 5:IClPYbLRDPWB3aq2Di+UYxSFOiA7OrrY2bEOBd8Ur1yEqVmCGZPPO5dPQwfUUmD0kwLUb0MZXyawNbzVujgaxUyVHKzeZlobLBCpQW2948H6XGQHri4D7tJF4UWSv69kUOwa7mtuWiM9RnvApuNSfpnJLGVsfJxNCZ+9ZIjDaMM=; 24:jEB5wKr0pmfNNEUe41OEfkEW1XFHhU+c9t/ITghBo4a/olBLM7OJRjEDWta7+RbEsYKNclL+L2tFUddCBNDzCgIMIwxKf+y88N9/cUrxjQ4=; 7:1zzewo7bhI7u7uTKtQmQjZeA8A7aF6UHVzKxBoR7TDenRfwONSBZg/MX/8Z/64vSgacP/7zmZh4OXCTURzpMDsprL+8MNc7pGYkXTqRdtHaz1RIKUO5S9IPfCAUqMAb0vGbRtgI0oI6NG6q3AhtlLwrBiXXEZU9k0/e0qlvX4gq8048mtSF84guUAQsLBDgqvxwjJIRaqbcVJrvuRHHOiqVdwHYp/0CMcw7UxiF7twmPXt85sLFFJY54jSu2RUFy SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 08:54:35.6676 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: c5643cae-5b99-47bb-e564-08d525bd2be6 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: BN3PR03MB2353 Subject: [edk2] [PATCH 06/10] Platform/NXP: Add support for I2c operations library 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" I2C bus initialization and I2c read/write APIs added. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- Platform/NXP/Include/Library/I2c.h | 125 ++++++++ Platform/NXP/Library/I2cLib/I2cLib.c | 549 +++++++++++++++++++++++++++++= ++++ Platform/NXP/Library/I2cLib/I2cLib.h | 109 +++++++ Platform/NXP/Library/I2cLib/I2cLib.inf | 43 +++ 4 files changed, 826 insertions(+) create mode 100644 Platform/NXP/Include/Library/I2c.h create mode 100644 Platform/NXP/Library/I2cLib/I2cLib.c create mode 100644 Platform/NXP/Library/I2cLib/I2cLib.h create mode 100644 Platform/NXP/Library/I2cLib/I2cLib.inf diff --git a/Platform/NXP/Include/Library/I2c.h b/Platform/NXP/Include/Libr= ary/I2c.h new file mode 100644 index 0000000..c7195ab --- /dev/null +++ b/Platform/NXP/Include/Library/I2c.h @@ -0,0 +1,125 @@ +/** I2c.h + Header defining the constant, base address amd function for I2C controll= er + + 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. + +**/ + +#ifndef __I2C_H___ +#define __I2C_H__ + +#include + +#define I2C1 0 +#define I2C2 1 +#define I2C3 2 +#define I2C4 3 + +/// +/// Define the I2C flags +/// +#define I2C_READ_FLAG 0x1 +#define I2C_WRITE_FLAG 0x2 + +/** + Function to initialize i2c bus + + @param I2cBus I2c Controller number + @param Speed Value to be set + + @retval EFI_SUCCESS +**/ +EFI_STATUS +EFIAPI +I2cBusInit ( + IN UINT32 I2cBus, + IN UINT32 Speed + ); + +/** + Function to read data usin i2c + + @param I2cBus I2c Controller number + @param Chip Address of slave device from where data to be read + @param Offset Offset of slave memory + @param Alen Address length of slave + @param Buffer A pointer to the destination buffer for the data + @param Len Length of data to be read + + @retval EFI_NOT_READY Arbitration lost + @retval EFI_TIMEOUT Failed to initialize data transfer in predefin= ed time + @retval EFI_NOT_FOUND ACK was not recieved + @retval EFI_SUCCESS Read was successful + +**/ +EFI_STATUS +I2cDataRead ( + IN UINT32 I2cBus, + IN UINT8 Chip, + IN UINT32 Offset, + IN UINT32 Alen, + OUT UINT8 *Buffer, + IN UINT32 Len + ); + +/** + Function to write data using i2c bus + + @param I2cBus I2c Controller number + @param Chip Address of slave device where data to b= e written + @param Offset Offset of slave memory + @param Alen Address length of slave + @param Buffer A pointer to the source buffer for the = data + @param Len Length of data to be write + + @retval EFI_NOT_READY Arbitration lost + @retval EFI_TIMEOUT Failed to initialize data transfer in p= redefined time + @retval EFI_NOT_FOUND ACK was not recieved + @retval EFI_SUCCESS Read was successful + +**/ +EFI_STATUS +I2cDataWrite ( + IN UINT32 I2cBus, + IN UINT8 Chip, + IN UINT32 Offset, + IN INT32 Alen, + OUT UINT8 *Buffer, + IN INT32 Len + ); + +/** + Function to reset I2c + @param I2cBus I2c Controller number + + @return VOID +**/ +VOID +I2cReset ( + UINT32 I2cBus + ); + +/** + Function to Probe I2c slave device + @param I2cBus I2c Controller number + + @retval EFI_INVALID_PARAMETER Invalid I2c Controller number + @retval EFI_SUCCESS I2c device probed successfully + +**/ +EFI_STATUS +EFIAPI +I2cProbeDevices ( + IN INT16 I2cBus, + IN UINT8 Chip + ); + +#endif diff --git a/Platform/NXP/Library/I2cLib/I2cLib.c b/Platform/NXP/Library/I2= cLib/I2cLib.c new file mode 100644 index 0000000..574b899 --- /dev/null +++ b/Platform/NXP/Library/I2cLib/I2cLib.c @@ -0,0 +1,549 @@ +/** I2cLib.c + I2c Library containing functions for read, write, initialize, set speed = etc + + 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 +#include +#include + +#include "I2cLib.h" + +EFI_PHYSICAL_ADDRESS I2cAddrArr[FixedPcdGet32(PcdNumI2cController)] =3D { + FixedPcdGet64(PcdI2c0BaseAddr), + FixedPcdGet64(PcdI2c1BaseAddr), + FixedPcdGet64(PcdI2c2BaseAddr), + FixedPcdGet64(PcdI2c3BaseAddr) +}; + +UINT16 ClkDiv[60][2] =3D { + { 20, 0x00 }, { 22, 0x01 }, { 24, 0x02 }, { 26, 0x03 }, + { 28, 0x04 }, { 30, 0x05 }, { 32, 0x09 }, { 34, 0x06 }, + { 36, 0x0A }, { 40, 0x07 }, { 44, 0x0C }, { 48, 0x0D }, + { 52, 0x43 }, { 56, 0x0E }, { 60, 0x45 }, { 64, 0x12 }, + { 68, 0x0F }, { 72, 0x13 }, { 80, 0x14 }, { 88, 0x15 }, + { 96, 0x19 }, { 104, 0x16 }, { 112, 0x1A }, { 128, 0x17 }, + { 136, 0x4F }, { 144, 0x1C }, { 160, 0x1D }, { 176, 0x55 }, + { 192, 0x1E }, { 208, 0x56 }, { 224, 0x22 }, { 228, 0x24 }, + { 240, 0x1F }, { 256, 0x23 }, { 288, 0x5C }, { 320, 0x25 }, + { 384, 0x26 }, { 448, 0x2A }, { 480, 0x27 }, { 512, 0x2B }, + { 576, 0x2C }, { 640, 0x2D }, { 768, 0x31 }, { 896, 0x32 }, + { 960, 0x2F }, { 1024, 0x33 }, { 1152, 0x34 },{ 1280, 0x35 }, + { 1536, 0x36 }, { 1792, 0x3A }, { 1920, 0x37 }, { 2048, 0x3B }, + { 2304, 0x3C }, { 2560, 0x3D }, { 3072, 0x3E }, { 3584, 0x7A }, + { 3840, 0x3F }, { 4096, 0x7B }, { 5120, 0x7D }, { 6144, 0x7E }, +}; + +/** + Calculate and set proper clock divider + + @param Rate : clock rate + + @retval ClkDiv : Value used to get frequency divider value + +**/ +UINT8 +GetClk( + IN UINT32 Rate + ) +{ + UINTN ClkRate; + UINT32 Div; + UINT8 ClkDivx; + + ClkRate =3D CalculateI2cClockRate(); + + Div =3D (ClkRate + Rate - 1) / Rate; + + if (Div < ClkDiv[0][0]) { + ClkDivx =3D 0; + } else if (Div > ClkDiv[ARRAY_SIZE(ClkDiv) - 1][0]){ + ClkDivx =3D ARRAY_SIZE(ClkDiv) - 1; + } else { + for (ClkDivx =3D 0; ClkDiv[ClkDivx][0] < Div; ClkDivx++); + } + + return ClkDivx; +} + +/** + Function to reset I2c + @param I2cBus : I2c Controller number + + @return VOID +**/ + +VOID +I2cReset ( + IN UINT32 I2cBus + ) +{ + I2C_REGS *I2cRegs; + + I2cRegs =3D (I2C_REGS *)I2cAddrArr[I2cBus]; + + /** Reset module */ + MmioWrite8((UINTN)&I2cRegs->I2cCr, I2C_CR_IDIS); + MmioWrite8((UINTN)&I2cRegs->I2cSr, 0); +} + +/** + Function to set I2c bus speed + + @param I2cBus : I2c Controller number + @param Speed : Value to be set + + @retval EFI_SUCCESS +**/ +EFI_STATUS +EFIAPI +I2cSetBusSpeed ( + IN UINT32 I2cBus, + IN UINT32 Speed + ) +{ + I2C_REGS *I2cRegs; + UINT8 ClkId; + UINT8 SpeedId; + + I2cRegs =3D (I2C_REGS *)I2cAddrArr[I2cBus]; + + ASSERT(I2cRegs); + + ClkId =3D GetClk(Speed); + SpeedId =3D ClkDiv[ClkId][1]; + + /** Store divider value */ + MmioWrite8((UINTN)&I2cRegs->I2cFdr, SpeedId); + I2cReset(I2cBus); + + return EFI_SUCCESS; +} + +/** + Function used to check if i2c is in mentioned state or not + + @param I2cRegs : Pointer to I2C registers + @param State : i2c state need to be checked + + @retval EFI_NOT_READY Arbitration was lost + @retval EFI_TIMEOUT Timeout occured + @retval CurrState Value of state register + +**/ +EFI_STATUS +WaitForI2cState ( + IN I2C_REGS *I2cRegs, + IN UINT32 State + ) +{ + UINT8 CurrState; + UINT64 Cnt; + + for (Cnt =3D 0; Cnt < 50; Cnt++) { + CurrState =3D MmioRead8((UINTN)&I2cRegs->I2cSr); + if (CurrState & I2C_SR_IAL) { + MmioWrite8((UINTN)&I2cRegs->I2cSr, CurrState | I2C_SR_IAL); + return EFI_NOT_READY; + } + + if ((CurrState & (State >> 8)) =3D=3D (UINT8)State) { + return CurrState; + } + + MicroSecondDelay(300); + } + + return EFI_TIMEOUT; +} + +/** + Function to transfer byte on i2c + + @param I2cRegs : Pointer to i2c registers + @param Byte : Byte to be transferred on i2c bus + + @retval EFI_NOT_READY Arbitration was lost + @retval EFI_TIMEOUT Timeout occured + @retval EFI_NOT_FOUND ACK was not recieved + @retval EFI_SUCCESS Data transfer was succesful + +**/ +EFI_STATUS +TransferByte ( + IN I2C_REGS *I2cRegs, + IN UINT8 Byte + ) +{ + EFI_STATUS Ret; + + MmioWrite8((UINTN)&I2cRegs->I2cSr, I2C_SR_IIF_CLEAR); + MmioWrite8((UINTN)&I2cRegs->I2cDr, Byte); + + Ret =3D WaitForI2cState(I2cRegs, IIF); + if ((Ret =3D=3D EFI_TIMEOUT) || (Ret =3D=3D EFI_NOT_READY)) { + return Ret; + } + + if (Ret & I2C_SR_RX_NO_AK) { + return EFI_NOT_FOUND; + } + + return EFI_SUCCESS; +} + +/** + Function to stop transaction on i2c bus + + @param I2cRegs : Pointer to i2c registers + + @retval EFI_NOT_READY Arbitration was lost + @retval EFI_TIMEOUT Timeout occured + @retval EFI_SUCCESS Stop operation was successful + +**/ +EFI_STATUS +I2cStop ( + IN I2C_REGS *I2cRegs + ) +{ + INT32 Ret; + UINT32 Temp; + + Temp =3D MmioRead8((UINTN)&I2cRegs->I2cCr); + + Temp &=3D ~(I2C_CR_MSTA | I2C_CR_MTX); + MmioWrite8((UINTN)&I2cRegs->I2cCr, Temp); + + Ret =3D WaitForI2cState(I2cRegs, BUS_IDLE); + + if (Ret < 0) { + return Ret; + } else { + return EFI_SUCCESS; + } +} + +/** + Function to send start signal, Chip Address and + memory offset + + @param I2cRegs : Pointer to i2c base registers + @param Chip : Chip Address + @param Offset : Slave memory's offset + @param Alen : length of chip address + + @retval EFI_NOT_READY Arbitration lost + @retval EFI_TIMEOUT Failed to initialize data transfer in predefine= d time + @retval EFI_NOT_FOUND ACK was not recieved + @retval EFI_SUCCESS Read was successful + +**/ +EFI_STATUS +InitTransfer ( + IN I2C_REGS *I2cRegs, + IN UINT8 Chip, + IN UINT32 Offset, + IN INT32 Alen + ) +{ + UINT32 Temp; + EFI_STATUS Ret; + + /** Enable I2C controller */ + if (MmioRead8((UINTN)&I2cRegs->I2cCr) & I2C_CR_IDIS) { + MmioWrite8((UINTN)&I2cRegs->I2cCr, I2C_CR_IEN); + } + + if (MmioRead8((UINTN)&I2cRegs->I2cAdr) =3D=3D (Chip << 1)) { + MmioWrite8((UINTN)&I2cRegs->I2cAdr, (Chip << 1) ^ 2); + } + + MmioWrite8((UINTN)&I2cRegs->I2cSr, I2C_SR_IIF_CLEAR); + Ret =3D WaitForI2cState(I2cRegs, BUS_IDLE); + if ((Ret =3D=3D EFI_TIMEOUT) || (Ret =3D=3D EFI_NOT_READY)) { + return Ret; + } + + /** Start I2C transaction */ + Temp =3D MmioRead8((UINTN)&I2cRegs->I2cCr); + /** set to master mode */ + Temp |=3D I2C_CR_MSTA; + MmioWrite8((UINTN)&I2cRegs->I2cCr, Temp); + + Ret =3D WaitForI2cState(I2cRegs, BUS_BUSY); + if ((Ret =3D=3D EFI_TIMEOUT) || (Ret =3D=3D EFI_NOT_READY)) { + return Ret; + } + + Temp |=3D I2C_CR_MTX | I2C_CR_TX_NO_AK; + MmioWrite8((UINTN)&I2cRegs->I2cCr, Temp); + + /** write slave Address */ + Ret =3D TransferByte(I2cRegs, Chip << 1); + if (Ret !=3D EFI_SUCCESS) { + return Ret; + } + + if (Alen >=3D 0) { + while (Alen--) { + Ret =3D TransferByte(I2cRegs, (Offset >> (Alen * 8)) & 0xff); + if (Ret !=3D EFI_SUCCESS) + return Ret; + } + } + return EFI_SUCCESS; +} + +/** + Function to check if i2c bud is idle + + @param Base : Pointer to base address of I2c controller + + @retval EFI_SUCCESS + +**/ +INT32 +I2cBusIdle ( + IN VOID *Base + ) +{ + return EFI_SUCCESS; +} + +/** + Function to initiate data transfer on i2c bus + + @param I2cRegs : Pointer to i2c base registers + @param Chip : Chip Address + @param Offset : Slave memory's offset + @param Alen : length of chip address + + @retval EFI_NOT_READY : Arbitration lost + @retval EFI_TIMEOUT : Failed to initialize data transfer in predefine= d time + @retval EFI_NOT_FOUND : ACK was not recieved + @retval EFI_SUCCESS : Read was successful + +**/ +EFI_STATUS +InitDataTransfer ( + IN I2C_REGS *I2cRegs, + IN UINT8 Chip, + IN UINT32 Offset, + IN INT32 Alen + ) +{ + EFI_STATUS Ret; + INT32 Retry; + + for (Retry =3D 0; Retry < 3; Retry++) { + Ret =3D InitTransfer(I2cRegs, Chip, Offset, Alen); + if (Ret =3D=3D EFI_SUCCESS) { + return EFI_SUCCESS; + } + + I2cStop(I2cRegs); + + if (EFI_NOT_FOUND =3D=3D Ret) { + return Ret; + } + + /** Disable controller */ + if (Ret !=3D EFI_NOT_READY) { + MmioWrite8((UINTN)&I2cRegs->I2cCr, I2C_CR_IDIS); + } + + if (I2cBusIdle(I2cRegs) < 0) { + break; + } + } + return Ret; +} + +/** + Function to read data using i2c bus + + @param I2cBus : I2c Controller number + @param Chip : Address of slave device from where data to = be read + @param Offset : Offset of slave memory + @param Alen : Address length of slave + @param Buffer : A pointer to the destination buffer for the= data + @param Len : Length of data to be read + + @retval EFI_NOT_READY : Arbitration lost + @retval EFI_TIMEOUT : Failed to initialize data transfer in prede= fined time + @retval EFI_NOT_FOUND : ACK was not recieved + @retval EFI_SUCCESS : Read was successful + +**/ +EFI_STATUS +I2cDataRead ( + IN UINT32 I2cBus, + IN UINT8 Chip, + IN UINT32 Offset, + IN UINT32 Alen, + IN UINT8 *Buffer, + IN UINT32 Len + ) +{ + EFI_STATUS Ret; + UINT32 Temp; + INT32 I; + I2C_REGS *I2cRegs; + + I2cRegs =3D (I2C_REGS *)I2cAddrArr[I2cBus]; + + Ret =3D InitDataTransfer(I2cRegs, Chip, Offset, Alen); + if (Ret !=3D EFI_SUCCESS) { + return Ret; + } + + Temp =3D MmioRead8((UINTN)&I2cRegs->I2cCr); + Temp |=3D I2C_CR_RSTA; + MmioWrite8((UINTN)&I2cRegs->I2cCr, Temp); + + Ret =3D TransferByte(I2cRegs, (Chip << 1) | 1); + if (Ret !=3D EFI_SUCCESS) { + I2cStop(I2cRegs); + return Ret; + } + + /** setup bus to read data */ + Temp =3D MmioRead8((UINTN)&I2cRegs->I2cCr); + Temp &=3D ~(I2C_CR_MTX | I2C_CR_TX_NO_AK); + if (Len =3D=3D 1) { + Temp |=3D I2C_CR_TX_NO_AK; + } + + MmioWrite8((UINTN)&I2cRegs->I2cCr, Temp); + MmioWrite8((UINTN)&I2cRegs->I2cSr, I2C_SR_IIF_CLEAR); + + /** read data */ + /** Dummy Read to initiate recieve operation */ + MmioRead8((UINTN)&I2cRegs->I2cDr); + + for (I =3D 0; I < Len; I++) { + Ret =3D WaitForI2cState(I2cRegs, IIF); + if ((Ret =3D=3D EFI_TIMEOUT) || (Ret =3D=3D EFI_NOT_READY)) { + I2cStop(I2cRegs); + return Ret; + } + /** + It must generate STOP before read I2DR to prevent + controller from generating another clock cycle + **/ + if (I =3D=3D (Len - 1)) { + I2cStop(I2cRegs); + } else if (I =3D=3D (Len - 2)) { + Temp =3D MmioRead8((UINTN)&I2cRegs->I2cCr); + Temp |=3D I2C_CR_TX_NO_AK; + MmioWrite8((UINTN)&I2cRegs->I2cCr, Temp); + } + MmioWrite8((UINTN)&I2cRegs->I2cSr, I2C_SR_IIF_CLEAR); + Buffer[I] =3D MmioRead8((UINTN)&I2cRegs->I2cDr); + } + + I2cStop(I2cRegs); + + return EFI_SUCCESS; +} + +/** + Function to write data using i2c bus + + @param I2cBus : I2c Controller number + @param Chip : Address of slave device where data to be = written + @param Offset : Offset of slave memory + @param Alen : Address length of slave + @param Buffer : A pointer to the source buffer for the da= ta + @param Len : Length of data to be write + + @retval EFI_NOT_READY : Arbitration lost + @retval EFI_TIMEOUT : Failed to initialize data transfer in pre= defined time + @retval EFI_NOT_FOUND : ACK was not recieved + @retval EFI_SUCCESS : Read was successful + +**/ +EFI_STATUS +I2cDataWrite ( + IN UINT32 I2cBus, + IN UINT8 Chip, + IN UINT32 Offset, + IN INT32 Alen, + OUT UINT8 *Buffer, + IN INT32 Len + ) +{ + EFI_STATUS Ret; + I2C_REGS *I2cRegs; + INT32 I; + + I2cRegs =3D (I2C_REGS *)I2cAddrArr[I2cBus]; + + Ret =3D InitDataTransfer(I2cRegs, Chip, Offset, Alen); + if (Ret !=3D EFI_SUCCESS) { + return Ret; + } + + /** write data */ + /** Dummy write to initiate write operation */ + for (I =3D 0; I < Len; I++) { + Ret =3D TransferByte(I2cRegs, Buffer[I]); + if (Ret !=3D EFI_SUCCESS) { + break; + } + } + + I2cStop(I2cRegs); + return Ret; +} + +/** + Function to Probe i2c bus + + @param I2c : I2c Controller number + + @retval EFI_INVALID_PARAMETER : Input parametr I2c was invalid + @retval EFI_SUCCESS : I2c was initialized successfully + +**/ +EFI_STATUS +EFIAPI +I2cProbeDevices ( + IN INT16 I2c, + IN UINT8 ChipAdd + ) +{ + if(I2c >=3D PcdGet32(PcdNumI2cController) || I2cAddrArr[I2c] =3D=3D 0x0)= { + return EFI_INVALID_PARAMETER; + } + + return I2cDataWrite(I2c, ChipAdd, 0, 0, NULL, 0); +} + +/** + Function to initialize i2c bus + + @param I2cBus : I2c Controller number + @param Speed : value to be set +**/ +EFI_STATUS +EFIAPI +I2cBusInit ( + IN UINT32 I2cBus, + IN UINT32 Speed + ) +{ + return I2cSetBusSpeed(I2cBus, Speed); +} diff --git a/Platform/NXP/Library/I2cLib/I2cLib.h b/Platform/NXP/Library/I2= cLib/I2cLib.h new file mode 100644 index 0000000..61076f5 --- /dev/null +++ b/Platform/NXP/Library/I2cLib/I2cLib.h @@ -0,0 +1,109 @@ +/** I2cLib.h + Header defining the constant, base address amd function for I2C controll= er + + 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. + +**/ + +#ifndef __I2C_H___ +#define __I2C_H__ + +#include + +#define I2C_CR_IIEN (1 << 6) +#define I2C_CR_MSTA (1 << 5) +#define I2C_CR_MTX (1 << 4) +#define I2C_CR_TX_NO_AK (1 << 3) +#define I2C_CR_RSTA (1 << 2) + +#define I2C_SR_ICF (1 << 7) +#define I2C_SR_IBB (1 << 5) +#define I2C_SR_IAL (1 << 4) +#define I2C_SR_IIF (1 << 1) +#define I2C_SR_RX_NO_AK (1 << 0) + +#define I2C_CR_IEN (0 << 7) +#define I2C_CR_IDIS (1 << 7) +#define I2C_SR_IIF_CLEAR (1 << 1) + +#define BUS_IDLE (0 | (I2C_SR_IBB << 8)) +#define BUS_BUSY (I2C_SR_IBB | (I2C_SR_IBB << 8)) +#define IIF (I2C_SR_IIF | (I2C_SR_IIF << 8)) + +/** + Record defining i2c registers +**/ +typedef struct { + UINT8 I2cAdr; + UINT8 I2cFdr; + UINT8 I2cCr; + UINT8 I2cSr; + UINT8 I2cDr; +} I2C_REGS ; + +/** + Function to set I2c bus speed + + @param I2cBus I2c Controller number + @param Speed Value to be set + + @retval EFI_SUCCESS +**/ +EFI_STATUS +EFIAPI +I2cSetBusSpeed ( + IN UINT32 I2cBus, + IN UINT32 Speed + ); + +/** + Function to stop transaction on i2c bus + + @param I2cRegs Pointer to i2c registers + + @retval EFI_NOT_READY Arbitration was lost + @retval EFI_TIMEOUT Timeout occured + @retval EFI_SUCCESS Stop operation was successful + +**/ +EFI_STATUS +I2cStop ( + IN I2C_REGS *I2cRegs + ); + +/** + Function to initiate data transfer on i2c bus + + @param I2cRegs Pointer to i2c base registers + @param Chip Chip Address + @param Offset Slave memory's offset + @param Alen length of chip address + + @retval EFI_NOT_READY Arbitration lost + @retval EFI_TIMEOUT Failed to initialize data transfer in p= redefined time + @retval EFI_NOT_FOUND ACK was not recieved + @retval EFI_SUCCESS Read was successful + +**/ +EFI_STATUS +I2cBusInitTransfer ( + IN I2C_REGS *I2cRegs, + IN UINT8 Chip, + IN UINT32 Offset, + IN INT32 Alen + ); + +UINT32 +CalculateI2cClockRate ( + VOID + ); + +#endif diff --git a/Platform/NXP/Library/I2cLib/I2cLib.inf b/Platform/NXP/Library/= I2cLib/I2cLib.inf new file mode 100644 index 0000000..427c3b8 --- /dev/null +++ b/Platform/NXP/Library/I2cLib/I2cLib.inf @@ -0,0 +1,43 @@ +# I2cLib.inf +# +# Component description file for I2cLib module +# +# 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 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 IM= PLIED. +# +# + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D I2cLib + FILE_GUID =3D 8ecefc8f-a2c4-4091-b81f-20f7aeb0567f + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D I2cLib + +[Sources.common] + I2cLib.c + +[LibraryClasses] + BaseLib + IoLib + SocLib + TimerLib + +[Packages] + MdePkg/MdePkg.dec + edk2-platforms/Platform/NXP/NxpQoriqLs.dec + +[Pcd] + gNxpQoriqLsTokenSpaceGuid.PcdI2c0BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdI2c1BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdI2c2BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdI2c3BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdNumI2cController --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed Dec 25 02:35:00 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 1510044883145753.6806006298027; Tue, 7 Nov 2017 00:54:43 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 901502034EE07; Tue, 7 Nov 2017 00:50:42 -0800 (PST) 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 5F6232034D82B for ; Tue, 7 Nov 2017 00:50:41 -0800 (PST) Received: from BN6PR03CA0092.namprd03.prod.outlook.com (10.164.122.158) by BN3PR03MB2353.namprd03.prod.outlook.com (10.166.74.148) 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:39 +0000 Received: from BL2FFO11FD005.protection.gbl (2a01:111:f400:7c09::182) by BN6PR03CA0092.outlook.office365.com (2603:10b6:405:6f::30) 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:39 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD005.mail.protection.outlook.com (10.173.161.1) 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:39 +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 vA78s4De009319; Tue, 7 Nov 2017 01:54:36 -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.36.45; helo=nam02-sn1-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:13 +0530 Message-ID: <1510065736-9394-8-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: 131545184792988959; (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)(346002)(376002)(39380400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(85426001)(33646002)(106466001)(104016004)(305945005)(356003)(2906002)(50986999)(76176999)(105606002)(53376002)(966005)(4326008)(36756003)(53936002)(5660300001)(47776003)(498600001)(8656006)(189998001)(16799955002)(15188155005)(2950100002)(6306002)(6666003)(5003940100001)(2201001)(16586007)(110136005)(68736007)(86362001)(575784001)(50466002)(54906003)(48376002)(77096006)(8676002)(97736004)(50226002)(316002)(81156014)(81166006)(8936002)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2353; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD005; 1:xJOT7Cj9ey6ILEqmM45o2JVNtJ3saSL2KNfBmAsvhr50THBiqtxy4bQuSm0kvxoGgjRf/oJ8uhcO/ZIOeZeJel3GoiLB+DarjcB1r1oYjs+dZK0MzfqI+Myj1tR7qqvw MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d58a0214-efd6-47d7-6bbe-08d525bd2df4 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603199); SRVR:BN3PR03MB2353; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2353; 3:5a6g/26FTn2ZNk/vdChNDKLh0edQHxbGgl0Ngr8p7SJNmnAwMqbBC2Jmjx+z2ucs0h/OvHwRR8ipPCvub40559BZFeZGANaUYe9eiCx0dbuNZ1rJJDkA8NmRXZLF54xBjnx0UOxsCi5VQvSm0HrJEsjMrt/xlDSpJxWR/aJRzCDO9KoGNnGlx2SUD5jrmZw4fafAQCvKkL3ADrrBbIauXPwOYCmk9keqNmgdOuz6VZ3qETFBcxVpi6FcELbptYu76YW33Wh5bMT2o6xEK/YOLUs1cze4iktj4AEcsGRloE4HnhelUhsKu5Vnm1890NRyBTwqB1wUbdUo85uk34WTDKYhvZHk74NuMs9ABBYx92s=; 25:tMHfaYOxKatt+gwvCaamwumc3gXz5ujZqjWcaGTXoVQSrC6i0yA3XEDWtO21KKs2lDGSD3b+JdH+pRKRj6AtxfNNx7kimaRsT9SezOGpqndU/4mNpRjgu+BzzuU+KZeW2G+3ExLqV/7if+NbwFbYnrJSz183jnZvEbB8knKJ4KRr95AZsmq+RjBnKjfUXS8buumYEsA6lfLoxpTULMFS7Eab/h69SoqI+fTyx39YiNRLQwnbS9oT20sxolKNW3VlglVSJO9ZTlaHSW0SMjm01FsGlau9RpbC8v3x+e2WPhZh/E0vFctt69btI5W43o7k3YNFPJYSgD9nXAH9DZqtRQ== X-MS-TrafficTypeDiagnostic: BN3PR03MB2353: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2353; 31:cL3JS/AT56hGwklKbegU0y9RwqS8QYOrTpeSl63rYM/lrjmUlnT8V89Pz69e8XH/nC6yVlUwZL7o3Pv60EKZ7ggmgFo/40UCHm1bw5iVIiG7nzFkA48ydvpTOHkK0dL8yN2MdvCLJmq3/mjLeoFRzACQJkIZCnuecO3d4LZcUawC6TY111ldXkz913un/16ZXguyYUN+MIVcjUaZc/+eymj9JTq7TzJI1Sl9QrgmBvI=; 4:+FzKw7+QP0Jg74/naCnSv2XRt+T6JYY6Ks6950iiTL4mSjR2PWsKEbWMhw38LVC6eEeDdZ7jZvGsWmIru147hIyREs3PluaXuSu0XfclW6/0uRRd10CpWRpIdu2qR1NfDdfQw7cg0gxAVLaZLZL57ATCSO7tbNS2pKjEL/u5DmC6CPmiqMu+EXGQiAzCsKoU2jhL0QCsVWQt1VlYxljmPih5W3l9OOX1/g70PlvYAyk3cCPtRCWegmFVd4caNfOf3u0T9CvnXih0kxXz7wzVnZvLHIGCd9duNiHT2UDRMrRsdhzdKyFEey47N7Jdlx+q 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)(10201501046)(3002001)(3231021)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6096035)(20161123563025)(20161123556025)(20161123565025)(20161123559100)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123561025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR03MB2353; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR03MB2353; X-Forefront-PRVS: 0484063412 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR03MB2353; 23:rMSOXsgnkSdHBcXDmmPlx1BI4iXB//mcADpuKU0By?= =?us-ascii?Q?IwWj2wWp1FE3q2jGxtEixSnH5Fs6lhma4xstcEwWqauBwta9AVzwBFUVrpV1?= =?us-ascii?Q?QqsdUUXPedMD86vo87lc56JI9WVXa7YPjjzf3jp+x6F9FkxVR2kE8Mt/INgE?= =?us-ascii?Q?iIzP4zwpjS+65zGSsfBFVa2FritMUSlD8StUswNpvMPkju1VHo42DOahyiT6?= =?us-ascii?Q?t1PEdsOy1i4OalHTTGGgiEFz88pzR9a2TEQQ1p4srv0Qq5qVdtK6u8cpdMGt?= =?us-ascii?Q?oPopVrdwv9RqKUgvBzZUA/Y65Xu0G0OcY3vQz831uVkRFecii9T0zoDlHGBE?= =?us-ascii?Q?FedVQc/sgTX6Nch7QnYBTiNijB+2eymrzj4OcPa+58zOYfPleNoTJ7KDyB7e?= =?us-ascii?Q?xYBQBoDOpB0o9ocyLzge0H9msy6ODxaOyNYyIZSgJzW0JhZJYsOAKr/aSFAk?= =?us-ascii?Q?Lh9oqew3vH3Cc/5cSw/XE8gwfSuCC17nBixUV5/JTzTao8OCyhPnhyRIp/tF?= =?us-ascii?Q?KdB/aVSF/pnQUdiNdIUO5l0wAG+MM+i2j/bDqzlfDq5ivUkwi/Ds8G0q8aNY?= =?us-ascii?Q?UY+qGIhW4PXtygNRTUm6JhaY66eCtQtBrY2GmjsEIjCN/z7oApJZ3ZLW52lr?= =?us-ascii?Q?Ap244FKokxpbhDjsk/gHRwldzX7WrBVeEAv3zKZCo0xciwqy+IO9WvDgIw74?= =?us-ascii?Q?Y0xrAyaWURcHyuklykxlt66ws6nsppLIzg4t/5fLMvIvFu60Bd2+TnMrpyYP?= =?us-ascii?Q?3TgPR7AhlVhfOe7B8qvBqpoa1tfobda5td3VIpRLxyoL6Lbp9eJp66Nydp+K?= =?us-ascii?Q?4KrbwTkUUEqfugjXxFUUbDuHH5GJ6m25cxw2SdYUPhPvcrkCMqEHC4pzzKtU?= =?us-ascii?Q?0v9j/2DfO7bqknKsQ2N/O2tCPmr99/kxxjMjv9XlyjEkmVDkysnz4tomqs/i?= =?us-ascii?Q?gZ1/tbOdl/WJrrGxKDMMmsE7i/eNh9Wb6p/4Mz1Xe9a6yWXxmLZETTuu8JUm?= =?us-ascii?Q?yue1M/xhbthnPKGKm1+XAwzZJRCRSCZAqxUHd7gLl5zHWrGWzZTPHAIxoRbr?= =?us-ascii?Q?HTlbQB8IO26PJ5dDugODAA8v6RfBYQ/igIhHcC5hnNZFd/6tP+vrsalr3GYa?= =?us-ascii?Q?agP+IGBzKTGroUR7lx76etuoAEaQHsJa8mxjG5dJL+00aPsBskmgoHRYY/no?= =?us-ascii?Q?tx3NoLkKc/eOuFazQ6jDxAqwonmnUHAvziq6sjVpEDqx2CMDiva8lfXpLewy?= =?us-ascii?Q?m22l6IbcSQyGO/okd8tsHmlcjhJwFi7ZirMkXkP7zswj9uRm/niP807sauNC?= =?us-ascii?Q?LzwMEmAXA1UWoWJ9EgBv0m8NBgJhucWK25ytWJoI4c7?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2353; 6:+71fwx6fwqUXtHEN3UPKZ5WG0ZLRzWc/nWmN1Wx2bCaTz+OkPGJpKX4bQcQEAf8Gh+Q1ROnKwOS+UFNzCxlPYRfTzwWfc3BwNHHAOvo16UbSPwye5FhUkcfhkBn0OI6MI12rKj/8lmTJL3BmSFviMHtvmMzvlJ7kHw5ci/95DInOSw+yD+qZmTe4TehlqaDIWpIB7dIr2VCoIbDZnG55jZRjN+cZesn7S0/Jqr+rVbD5PS/UMI7l9iAwfkgFaXAIxj2KS65f1pXwZQ8Gt97WHKSm+Blk7s+33JaDp2zkBsZeof7EoyOMTGqOZay0PsegGSlALeHA4DLcbIYpX5ltg1Jd19wk7kyRFC6SpzCPnoo=; 5:11wXmFsYGHXnkH7ptUIEJuimbHBZlz71wZCs6bE9fB2do4erBIfSQBRlevKcTDleScGHdVR5hlNdMNS6b8yh3e1vdG0QMzdM71wFaUrpBnzb9iUJcyFWs/REio7aIEs95ay8FygvM0635reSYV+b4hitLCEZCF5NiI30O5RV43A=; 24:iAs9mgq+L/4Xd9Q7neNz1KlR4GxegExF2wy8qkRCI6Iztc44JNlXOofYYGLFYl3D0crLQ7oMpgualbPZ4x2v2PguJeyZ9CmVv3rHmf62qZk=; 7:NZRCaV6e54ZzZ1bKZg/alQNlFVy/gornQX2ZKxNvESmP6X0pNqB4wcbL/0pCrye4ZBTUFhD0qq2IteGzabou+gyNlwccGMOFSa4S1bxm+RjBUp6GHdDYhphFjJHNO1uz/BeRQRRxrGNW+Y1M0J4XK2rM8n8l604kF2DjfydNXJJPOrc7LahDilXgcxaqKUBm4Na5chTaosuZgQAtuhdgYvqhmlG6Sl+pD6Yw1ZnO37eP44A0fuOifbDNBohdJCPA SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 08:54:39.1272 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d58a0214-efd6-47d7-6bbe-08d525bd2df4 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: BN3PR03MB2353 Subject: [edk2] [PATCH 07/10] Platform/NXP : Add support for DS1307 RTC library 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" Real time clock Apis on top of I2C Apis Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- Platform/NXP/Library/Ds1307RtcLib/Ds1307Rtc.h | 40 ++++ Platform/NXP/Library/Ds1307RtcLib/Ds1307RtcLib.c | 226 +++++++++++++++++= ++++ Platform/NXP/Library/Ds1307RtcLib/Ds1307RtcLib.inf | 40 ++++ 3 files changed, 306 insertions(+) create mode 100644 Platform/NXP/Library/Ds1307RtcLib/Ds1307Rtc.h create mode 100644 Platform/NXP/Library/Ds1307RtcLib/Ds1307RtcLib.c create mode 100644 Platform/NXP/Library/Ds1307RtcLib/Ds1307RtcLib.inf diff --git a/Platform/NXP/Library/Ds1307RtcLib/Ds1307Rtc.h b/Platform/NXP/L= ibrary/Ds1307RtcLib/Ds1307Rtc.h new file mode 100644 index 0000000..952933f --- /dev/null +++ b/Platform/NXP/Library/Ds1307RtcLib/Ds1307Rtc.h @@ -0,0 +1,40 @@ +/** Ds1307Rtc.h +* +* 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. +* +**/ + +#ifndef __DS1307RTC_H__ +#define __DS1307RTC_H__ + +#define Bin(Bcd) ((Bcd) & 0x0f) + ((Bcd) >> 4) * 10 +#define Bcd(Bin) (((Bin / 10) << 4) | (Bin % 10)) + +/* + * RTC register addresses + */ +#define DS1307_SEC_REG_ADDR 0x00 +#define DS1307_MIN_REG_ADDR 0x01 +#define DS1307_HR_REG_ADDR 0x02 +#define DS1307_DAY_REG_ADDR 0x03 +#define DS1307_DATE_REG_ADDR 0x04 +#define DS1307_MON_REG_ADDR 0x05 +#define DS1307_YR_REG_ADDR 0x06 +#define DS1307_CTL_REG_ADDR 0x07 + +#define DS1307_SEC_BIT_CH 0x80 /* Clock Halt (in Register 0) */ + +#define DS1307_CTL_BIT_RS0 0x01 /* Rate select 0 */ +#define DS1307_CTL_BIT_RS1 0x02 /* Rate select 1 */ +#define DS1307_CTL_BIT_SQWE 0x10 /* Square Wave Enable */ +#define DS1307_CTL_BIT_OUT 0x80 /* Output Control */ + +#endif // __DS1307RTC_H__ diff --git a/Platform/NXP/Library/Ds1307RtcLib/Ds1307RtcLib.c b/Platform/NX= P/Library/Ds1307RtcLib/Ds1307RtcLib.c new file mode 100644 index 0000000..5f620a3 --- /dev/null +++ b/Platform/NXP/Library/Ds1307RtcLib/Ds1307RtcLib.c @@ -0,0 +1,226 @@ +/** Ds1307RtcLib.c + Implement EFI RealTimeClock with runtime services via RTC Lib for DS1307= RTC. + + Based on RTC implementation available in + EmbeddedPkg/Library/TemplateRealTimeClockLib/RealTimeClockLib.c + + Copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
+ 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 +#include +#include + +#include "Ds1307Rtc.h" + +/** + Read RTC register. + + @param RtcRegAddr Register offset of RTC to be read. + + @retval Register Value read + +**/ + +UINT8 +RtcRead ( + IN UINT8 RtcRegAddr + ) +{ + INT32 Status; + UINT8 Val; + + Val =3D 0; + Status =3D I2cDataRead(PcdGet32(PcdRtcI2cBus), PcdGet32(PcdDs1307I2cAddr= ess), + RtcRegAddr, 0x1, &Val, sizeof(Val)); + if (EFI_ERROR(Status)) + DEBUG((DEBUG_ERROR, "RTC read error at Addr:0x%x\n", RtcRegAddr)); + + return Val; +} +/** + Write RTC register. + + @param RtcRegAddr Register offset of RTC to write. + @param Val Value to be written + +**/ + +VOID +RtcWrite( + IN UINT8 RtcRegAddr, + IN UINT8 Val + ) +{ + EFI_STATUS Status; + + Status =3D I2cDataWrite(PcdGet32(PcdRtcI2cBus), PcdGet32(PcdDs1307I2cAdd= ress), + RtcRegAddr, 0x1, &Val, sizeof(Val)); + if (EFI_ERROR(Status)) + DEBUG((DEBUG_ERROR, "RTC write error at Addr:0x%x\n", RtcRegAddr)); +} + +/** + Returns the current time and date information, and the time-keeping capa= bilities + of the hardware platform. + + @param Time A pointer to storage to receive a snapshot= of the current time. + @param Capabilities An optional pointer to a buffer to receive= the real time clock + device's capabilities. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER Time is NULL. + @retval EFI_DEVICE_ERROR The time could not be retrieved due to har= dware error. + +**/ + +EFI_STATUS +EFIAPI +LibGetTime ( + OUT EFI_TIME *Time, + OUT EFI_TIME_CAPABILITIES *Capabilities + ) +{ + EFI_STATUS Status; + UINT8 Second; + UINT8 Minute; + UINT8 Hour; + UINT8 Day; + UINT8 Month; + UINT8 Year; + + Status =3D EFI_SUCCESS; + + Second =3D RtcRead (DS1307_SEC_REG_ADDR); + Minute =3D RtcRead (DS1307_MIN_REG_ADDR); + Hour =3D RtcRead (DS1307_HR_REG_ADDR); + Day =3D RtcRead (DS1307_DATE_REG_ADDR); + Month =3D RtcRead (DS1307_MON_REG_ADDR); + Year =3D RtcRead (DS1307_YR_REG_ADDR); + + if (Second & DS1307_SEC_BIT_CH) { + DEBUG ((DEBUG_ERROR, "### Warning: RTC oscillator has stopped\n")); + /* clear the CH flag */ + RtcWrite (DS1307_SEC_REG_ADDR, + RtcRead (DS1307_SEC_REG_ADDR) & ~DS1307_SEC_BIT_CH); + Status =3D EFI_DEVICE_ERROR; + } + + Time->Second =3D Bin (Second & 0x7F); + Time->Minute =3D Bin (Minute & 0x7F); + Time->Hour =3D Bin (Hour & 0x3F); + Time->Day =3D Bin (Day & 0x3F); + Time->Month =3D Bin (Month & 0x1F); + Time->Year =3D Bin (Year) + ( Bin (Year) >=3D 70 ? 1900 : 2000); + + return Status; +} + +/** + Sets the current local time and date information. + + @param Time A pointer to the current time. + + @retval EFI_SUCCESS The operation completed successfully. + @retval EFI_INVALID_PARAMETER A time field is out of range. + @retval EFI_DEVICE_ERROR The time could not be set due due to hardw= are error. + +**/ +EFI_STATUS +EFIAPI +LibSetTime ( + IN EFI_TIME *Time + ) +{ + if (Time->Year < 1970 || Time->Year > 2069) + DEBUG((DEBUG_ERROR, "WARNING: Year should be between 1970 and 2069!\n"= )); + + RtcWrite (DS1307_YR_REG_ADDR, Bcd (Time->Year % 100)); + RtcWrite (DS1307_MON_REG_ADDR, Bcd (Time->Month)); + RtcWrite (DS1307_DATE_REG_ADDR, Bcd (Time->Day)); + RtcWrite (DS1307_HR_REG_ADDR, Bcd (Time->Hour)); + RtcWrite (DS1307_MIN_REG_ADDR, Bcd (Time->Minute)); + RtcWrite (DS1307_SEC_REG_ADDR, Bcd (Time->Second)); + + return EFI_SUCCESS; +} + +/** + Returns the current wakeup alarm clock setting. + + @param Enabled Indicates if the alarm is currently enable= d or disabled. + @param Pending Indicates if the alarm signal is pending a= nd requires acknowledgement. + @param Time The current alarm setting. + + @retval EFI_SUCCESS The alarm settings were returned. + @retval EFI_INVALID_PARAMETER Any parameter is NULL. + @retval EFI_DEVICE_ERROR The wakeup time could not be retrieved due= to a hardware error. + +**/ +EFI_STATUS +EFIAPI +LibGetWakeupTime ( + OUT BOOLEAN *Enabled, + OUT BOOLEAN *Pending, + OUT EFI_TIME *Time + ) +{ + // Not a required feature + return EFI_UNSUPPORTED; +} + +/** + Sets the system wakeup alarm clock time. + + @param Enabled Enable or disable the wakeup alarm. + @param Time If Enable is TRUE, the time to set the wak= eup alarm for. + + @retval EFI_SUCCESS If Enable is TRUE, then the wakeup alarm w= as enabled. If + Enable is FALSE, then the wakeup alarm was= disabled. + @retval EFI_INVALID_PARAMETER A time field is out of range. + @retval EFI_DEVICE_ERROR The wakeup time could not be set due to a = hardware error. + @retval EFI_UNSUPPORTED A wakeup timer is not supported on this pl= atform. + +**/ +EFI_STATUS +EFIAPI +LibSetWakeupTime ( + IN BOOLEAN Enabled, + OUT EFI_TIME *Time + ) +{ + // Not a required feature + return EFI_UNSUPPORTED; +} + +/** + This is the declaration of an EFI image entry point. This can be the ent= ry point to an application + written to this specification, an EFI boot service driver, or an EFI run= time driver. + + @param ImageHandle Handle that identifies the loaded image. + @param SystemTable System Table for this image. + + @retval EFI_SUCCESS The operation completed successfully. + +**/ +EFI_STATUS +EFIAPI +LibRtcInitialize ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + return I2cBusInit(PcdGet32(PcdRtcI2cBus), PcdGet32(PcdI2cSpeed)); +} diff --git a/Platform/NXP/Library/Ds1307RtcLib/Ds1307RtcLib.inf b/Platform/= NXP/Library/Ds1307RtcLib/Ds1307RtcLib.inf new file mode 100644 index 0000000..b068b43 --- /dev/null +++ b/Platform/NXP/Library/Ds1307RtcLib/Ds1307RtcLib.inf @@ -0,0 +1,40 @@ +# @Ds1307RtcLib.inf +# +# Lib to provide support for DS1307 Real Time Clock +# +# Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved. +# Copyright (c) 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 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 IM= PLIED. +# +# + +[Defines] + INF_VERSION =3D 0x00010005 + BASE_NAME =3D Ds1307RtcLib + FILE_GUID =3D B661E02D-A90B-42AB-A5F9-CF841AAA43D9 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D RealTimeClockLib + +[Sources.common] + Ds1307RtcLib.c + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + edk2-platforms/Platform/NXP/NxpQoriqLs.dec + +[LibraryClasses] + DebugLib + I2cLib + +[Pcd] + gNxpQoriqLsTokenSpaceGuid.PcdRtcI2cBus + gNxpQoriqLsTokenSpaceGuid.PcdI2cSpeed + gNxpQoriqLsTokenSpaceGuid.PcdDs1307I2cAddress --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed Dec 25 02:35:00 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 1510044888439589.1800457626485; Tue, 7 Nov 2017 00:54:48 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id CF20D2034EE0D; Tue, 7 Nov 2017 00:50:47 -0800 (PST) Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0085.outbound.protection.outlook.com [104.47.38.85]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 01BCF2034EE06 for ; Tue, 7 Nov 2017 00:50:45 -0800 (PST) Received: from BN6PR03CA0015.namprd03.prod.outlook.com (10.168.230.153) 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:43 +0000 Received: from BN1AFFO11FD007.protection.gbl (2a01:111:f400:7c10::163) by BN6PR03CA0015.outlook.office365.com (2603:10b6:404:23::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.178.6 via Frontend Transport; Tue, 7 Nov 2017 08:54:43 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD007.mail.protection.outlook.com (10.58.52.67) 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:43 +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 vA78s4Df009319; Tue, 7 Nov 2017 01:54:40 -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.38.85; helo=nam02-bl2-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:14 +0530 Message-ID: <1510065736-9394-9-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: 131545184835452667; (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)(50944005)(199003)(189002)(36756003)(356003)(76176999)(86362001)(50986999)(575784001)(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)(19627235001); 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; BN1AFFO11FD007; 1:OCTfb2Q3Xrw1eAM82KjT8CwDM97aNZNf4G+uWsYdRdmF7Fq3aSLcyYFzMip/ltsebKXlwnQfMPQgOf48d/jFq3rvlxYcWWubtdzSBkwm70xlGrJuHcRrNyPAmODu4uIO MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84158db1-287a-4a16-5d99-08d525bd307c X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603249); SRVR:BN3PR03MB2355; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2355; 3:SmuEtYbYEH76zSSvNxvwT0XWEdudFZwVxZaufeqy5faTSu63f5Y9Xr0gvaGEJZo1TlPUmu2qLS7pkPA2jsGZ839rtK+ILbqv1RwLaAAu3AqtXpISw8X2m7AyuLu3Xp/NOpxQmYb+Lp/P1NClQTwkUzaZfnlW8dJt5g0uuEnElZd6u7JYzgjGC2HemIdHAfADfviYCOqJMWy0TbXfJpUDgBOY2yinVHJOSwD8wU/v+hCYVOuGFbSmxGGm2XGixTmu1lXgortKzQ8+/vONdpyBRH5LBlTY7hfQHnzVl4bGL3cFxDLbLGaaSSCRqZVl1YIyRg0lHaV0UPCfbgYVDWuABW8FQMfR7R7I4TVqk7NTV4Y=; 25:PfdVMgNhDuEMEOB3ysi+533rHGlFPt2CLkWsfGvVyDPm4+Q55F2MsgTWfpLR0M/6LzKblqxM963lE3+FRMukGZEfRXpYRPEMvN0pcwy3it5I6hvvrUr5pUaHAfX2QKxJ+67UEhxmb8fj/E7TaIUPLVetyL0StrZDTCAuN36w72yrVCfj6ct0+s0gYGJ4w3hFZMBoXOKajL8VtK3BFu/dnzfxRyO/rSE1n4dg0V2oP+mTCRXmEmEtf1dFiWuZEDSKsYAv3tSpG7zVrdzY/ke2BgIJ8ymmvcEjTiM4bC8dPByaQou55Gl4SlfYlnkfqSZJKsSz4vTpisEQQE/8/b6Bmg== X-MS-TrafficTypeDiagnostic: BN3PR03MB2355: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2355; 31:FAuwY06DCND3A+WHG9/ZdkyIWNeOEJ1ONUMHv9myXL7/h+emZKJLyL+zM3V2dm1sas/kYlnidGwnJZENMWS68e3Vi9EZrRphZ+zM3BGhT04KwHf0q5wlDlr3MqBalrsoexOByt0Dzc/1PnzUcllimuPZyGkMhdmSy+SKoutpBqwT2D/wMSNe7tmIBUa0XV/pRa5a6NX3IYOJ1silxjbflZQstP4X56E1yN4k0GWlyGU=; 4:8di6m6ReJNBbXF5SHKry7ww+tOQ4cnYZ8OBsScANXjaLNOVRKVVSo1pd73s9Kn65qnULfabjmBDLNcozjxVFHaOSZJG8JxclD4I4B2ravQF9ziPdIo6fQqCIw+r5wSqf2jytF89jRIIPWlQedgMxy1LMaE8c1nVmMZrVRcLiatkCbg7If82HEa6grUMw9bi/Rl2L9bTN6iQ11i/ubjd0PEXxLr+nZoC/3LQ2LvNXMfc23SOURdycJBp/Z8tAZCa8qqs2wERG22CqjlGXb6Lj3WyMPzUru9G0PiXrbiG5GxVevzCrNmXPHhKFe3cPqhh2 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:h7ag2qXZpgrT+A+9X1+/lFdkFDNVbRDX63xdnHZtY?= =?us-ascii?Q?MdtExpIIHa5KzgYY3vQEg7OzcJCED9XdgZ/511LAk1qJe9Pqd2mP/4O6Q+iY?= =?us-ascii?Q?fRR00l1wjnrIZ4gMzmEB2BgYACUQjwTd75h07Hvpm6wCgRRl7NYYuex+Hp2l?= =?us-ascii?Q?mzPVMeypkYXoCEs2rG8vi0PfxByrENF/mAfiHYN4+FwqYgpb+aJVSSkfyjng?= =?us-ascii?Q?GgJ6LRGQGSuUATcNp7RJpYoj2/tzEhQ9rOh47JC2tpziXFDp4G0kMk+ZFFt4?= =?us-ascii?Q?7VZwbogj54Klka8L7rHhzL7yBJLc4pR5rZro2Ur65xOAKS3GId+8HM9xTvvX?= =?us-ascii?Q?RFuGRvF4AoLqpkENiJx+UQVCOyp0QuFY2ygrkVgM0d8KdKcxQIw8fO2m/sB5?= =?us-ascii?Q?EVLWUmZuNSMkvDTqls2BOKutdxGJhhYbXtjjXbdL9y/DjnLzEdIN1/W6zOFx?= =?us-ascii?Q?JF90eC1qZUVlMvHM2JvAA1bTVgRXjDTSfzx6XgitX3Vud/stjTY0ixHC9ec0?= =?us-ascii?Q?HtZDVc5ysKrag232/xdfaPh4tBUihu9tICYgyWuPMvWeFz3aFFYnISMidYLS?= =?us-ascii?Q?NSLVI1RbYXsfSjja41L1FT9+HhO/t/aUVGi5aA9kr33dFnRIvW9CUmUKpkHo?= =?us-ascii?Q?SMzTA1uaZrnQe00ztP5bMf1HQAH+aNdk3R2fLAhnzGQQ1jPvfTbBWpqTQi3I?= =?us-ascii?Q?p86YVoV2TqQ3qKNyh+3TX927EnZIIXsBWx138S8HFooTxEAH5J7mvjWCX8Oe?= =?us-ascii?Q?Aw/+iIWKPuoNfkkpw6ELrnRzuIhx0C5iRADaK0nomUFFtI1B75pIEksmLbK5?= =?us-ascii?Q?EgBvNdedAoMVH6JPuOf5gPCfEBxt6hoTLkTXNRcI2tv89JpiSyUzRrezpc42?= =?us-ascii?Q?klHNz32U/k616ET0VO3dfE5BiJkPxevAJrbXzZmplc95hIicO1BOJwV70BjQ?= =?us-ascii?Q?LVknULHlEaQ6fGmvhik4/ha+UjMvb+IucL7qMKQHS4jQKOSzuKi4wtE+EJ4m?= =?us-ascii?Q?JfawYYNqLIripmCDTVZjgu9I8WukARvu0a5q2GjKh9SaOd+KIdTNn1XJLgJS?= =?us-ascii?Q?I4WKq8HcVuOPynT3s51P6I+kzZLYt0rLCezmn4/uOb4hB4q48zqtxtoVVgEl?= =?us-ascii?Q?KAMIu8+7sDGQuoJIKuwW/7X7UdU596hqF0K53V9UuI5Z0qK7VUNHjp8EQ1Oq?= =?us-ascii?Q?Q72nQawvdGJGGvGqhQfDYrANqQ+z1xBamwpb5M7/3FD/Lx0N1DywOzgq1siJ?= =?us-ascii?Q?JlI6X4SdFRyh7OrHhrZZkVOVW+TTmnaVXtOVAmIZVgHz3ccUWCsRdOJSDTIe?= =?us-ascii?Q?P2IFZhNCIw6G+Suqy4Jaqvs6/PTMcPyltGHEQ21DSt8IJ1RCHYW8lzamY0bb?= =?us-ascii?Q?3hGcw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2355; 6:SkqwrnRA5Q5n+FAQgnoYnDwdaS2pmRnKAA/gbEQSK4qYe9RlavSeY+YCz1cBmJ2jEtazK8v62sBO04g9ono1FR4BPweFJsN2QwKtFZ3fi+kpXndbGASefrS48REu+HRQSWHMtaAT+ARbR92Q83mhShl7hDFVEkfl13lHF4t50Nd55Dk7Tp0JOTA8JUbO4DaPluQlVqkVz4JFHnpX9t3Q3I43SfxP2OVajGlBNsr0SiT+ItfE+femLUKw5e4saFEM3BB6AaBL8Bc21gJ68fBamWlLMvqo6GGxo3nATXN2Cp8YkzdSyAxLZ0oJdDjDAXlunZZEIBlQbMyr6ugYp01KQAhewAOv2GdgrD42rDlMzT8=; 5:dH9idJ2C4cwYyxuVPksqVlLrrHwuiWZu8MzyumQ+2yemtUdSDuV8jviBwb36G53hHUkJ35uYFnGHLAYN4NppUoMe2bqClMlgaYzG81FjGikCGVoI3Wepjyq1QEPhmBv0RJtuA6w2lEBVdfBOoQTkTBezheG3FtuPg0VlmT830DM=; 24:XKds3JFYl2F6E0zSMB2TyZopdAuibatSv994qm3kSV8d1QtOwaOLlTryl0rUbz47pR6B1Z2E28V7OxKB1LckxDLDHIhP8LUq8pk8oYsCx2w=; 7:0fv6q627ej/6yA+vbbxinXZs/D9G1kky+eu0EcVXk2E8zhLQblxBqR0Gg/yyo90sTash4gAJ6jfKNSQLGUXXcZ/07LM60LsqZLWHHLecVJ2fIf0w38v6X1X5z4JVljpSbEtszyjxOGH1TrfYARRycxG1MJhUr+lTAhsweI1qc7F98kFlZVWO1UYd3/2FJxUqzn79etPbbUi0G+9pgGTDSR5toJcBT84TCQHE3yGB3TGusr0IYVGc0w6d7RY1Y1zi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 08:54:43.3580 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84158db1-287a-4a16-5d99-08d525bd307c 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 08/10] Platform/NXP: Add support for ArmPlatformLib 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" Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- .../Library/PlatformLib/ArmPlatformLib.c | 105 ++++++++++++ .../Library/PlatformLib/ArmPlatformLib.inf | 70 ++++++++ .../Library/PlatformLib/NxpQoriqLsHelper.S | 38 +++++ .../Library/PlatformLib/NxpQoriqLsMem.c | 184 +++++++++++++++++= ++++ 4 files changed, 397 insertions(+) create mode 100644 Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatf= ormLib.c create mode 100644 Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatf= ormLib.inf create mode 100644 Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriq= LsHelper.S create mode 100644 Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriq= LsMem.c diff --git a/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatformLib.= c b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatformLib.c new file mode 100644 index 0000000..21deb41 --- /dev/null +++ b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatformLib.c @@ -0,0 +1,105 @@ +/** ArmPlatformLib.c +* +* Contains board initialization functions. +* +* Based on BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c +* +* Copyright (c) 2011-2012, ARM Limited. All rights reserved. +* Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved. +* 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. +* +**/ + +#include +#include + +extern VOID SocInit(VOID); + +/** + Return the current Boot Mode + + This function returns the boot reason on the platform + +**/ +EFI_BOOT_MODE +ArmPlatformGetBootMode ( + VOID + ) +{ + return BOOT_WITH_FULL_CONFIGURATION; +} + +/** + Placeholder for Platform Initialization +**/ +EFI_STATUS +ArmPlatformInitialize ( + IN UINTN MpId + ) +{ + SocInit(); + + return EFI_SUCCESS; +} + +ARM_CORE_INFO LS1043aMpCoreInfoCTA53x4[] =3D { + { + // Cluster 0, Core 0 + 0x0, 0x0, + + // MP Core MailBox Set/Get/Clear Addresses and Clear Value + (EFI_PHYSICAL_ADDRESS)0, + (EFI_PHYSICAL_ADDRESS)0, + (EFI_PHYSICAL_ADDRESS)0, + (UINT64)0xFFFFFFFF + }, +}; + +EFI_STATUS +PrePeiCoreGetMpCoreInfo ( + OUT UINTN *CoreCount, + OUT ARM_CORE_INFO **ArmCoreTable + ) +{ + *CoreCount =3D sizeof(LS1043aMpCoreInfoCTA53x4) / sizeof(ARM_CORE_INF= O); + *ArmCoreTable =3D LS1043aMpCoreInfoCTA53x4; + + return EFI_SUCCESS; +} + +ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi =3D { PrePeiCoreGetMpCoreInfo }; + +EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] =3D { + { + EFI_PEI_PPI_DESCRIPTOR_PPI, + &gArmMpCoreInfoPpiGuid, + &mMpCoreInfoPpi + } +}; + +VOID +ArmPlatformGetPlatformPpiList ( + OUT UINTN *PpiListSize, + OUT EFI_PEI_PPI_DESCRIPTOR **PpiList + ) +{ + *PpiListSize =3D sizeof(gPlatformPpiTable); + *PpiList =3D gPlatformPpiTable; +} + + +UINTN +ArmPlatformGetCorePosition ( + IN UINTN MpId + ) +{ + return 1; +} diff --git a/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatformLib.= inf b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatformLib.inf new file mode 100644 index 0000000..43956f7 --- /dev/null +++ b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/ArmPlatformLib.inf @@ -0,0 +1,70 @@ +# @file +# +# Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved. +# 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 PlatformLib + FILE_GUID =3D 736343a0-1d96-11e0-aaaa-0002a5d5c51b + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D ArmPlatformLib + +[Packages] + ArmPkg/ArmPkg.dec + ArmPlatformPkg/ArmPlatformPkg.dec + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + edk2-platforms/Platform/NXP/NxpQoriqLs.dec + +[LibraryClasses] + ArmLib + SocLib + +[Sources.common] + NxpQoriqLsHelper.S | GCC + NxpQoriqLsMem.c + ArmPlatformLib.c + +[Ppis] + gArmMpCoreInfoPpiGuid + +[FeaturePcd] + gEmbeddedTokenSpaceGuid.PcdCacheEnable + +[FixedPcd] + gArmTokenSpaceGuid.PcdArmPrimaryCore + gNxpQoriqLsTokenSpaceGuid.PcdCcsrBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdCcsrSize + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion1BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion1Size + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion2BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion2Size + gNxpQoriqLsTokenSpaceGuid.PcdQmanSwpBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdQmanSwpSize + gNxpQoriqLsTokenSpaceGuid.PcdBmanSwpBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdBmanSwpSize + gNxpQoriqLsTokenSpaceGuid.PcdPciExp1BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdPciExp1BaseSize + gNxpQoriqLsTokenSpaceGuid.PcdPciExp2BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdPciExp2BaseSize + gNxpQoriqLsTokenSpaceGuid.PcdPciExp3BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdPciExp3BaseSize + gNxpQoriqLsTokenSpaceGuid.PcdDram1BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdDram1Size + gNxpQoriqLsTokenSpaceGuid.PcdDram2BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdDram2Size + gNxpQoriqLsTokenSpaceGuid.PcdDram3BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdDram3Size + gNxpQoriqLsTokenSpaceGuid.PcdQspiRegionBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdQspiRegionSize diff --git a/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriqLsHelpe= r.S b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriqLsHelper.S new file mode 100644 index 0000000..205c0d8 --- /dev/null +++ b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriqLsHelper.S @@ -0,0 +1,38 @@ +# @file +# +# Copyright (c) 2012-2013, ARM Limited. All rights reserved. +# 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. +# +# + +#include +#include + +.text +.align 2 + +GCC_ASM_IMPORT(ArmReadMpidr) + +ASM_FUNC(ArmPlatformIsPrimaryCore) + tst x0, #3 + cset x0, eq + ret + +ASM_FUNC(ArmPlatformPeiBootAction) +EL1_OR_EL2(x0) +1: +2: + ret + +ASM_FUNC(ArmPlatformGetPrimaryCoreMpId) + MOV32 (x0, FixedPcdGet32(PcdArmPrimaryCore)) + ldrh w0, [x0] + ret diff --git a/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c= b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c new file mode 100644 index 0000000..4b4f558 --- /dev/null +++ b/Platform/NXP/LS1043aRdbPkg/Library/PlatformLib/NxpQoriqLsMem.c @@ -0,0 +1,184 @@ +/** NxpQoriqLsMem.c +* +* Board memory specific Library. +* +* Based on BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoardMem.c +* +* Copyright (c) 2011, ARM Limited. All rights reserved. +* Copyright (c) 2016, Freescale Semiconductor, Inc. All rights reserved. +* 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 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 IM= PLIED. +* +**/ + +#include +#include +#include +#include + +#define MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS 25 + +#define CCSR_BASE_ADDR FixedPcdGet64 (PcdCcsrBaseAddr) +#define CCSR_SIZE FixedPcdGet64 (PcdCcsrSize) +#define IFC_REGION1_BASE_ADDR FixedPcdGet64 (PcdIfcRegion1BaseAddr) +#define IFC_REGION1_SIZE FixedPcdGet64 (PcdIfcRegion1Size) +#define IFC_REGION2_BASE_ADDR FixedPcdGet64 (PcdIfcRegion2BaseAddr) +#define IFC_REGION2_SIZE FixedPcdGet64 (PcdIfcRegion2Size) +#define QMAN_SWP_BASE_ADDR FixedPcdGet64 (PcdQmanSwpBaseAddr) +#define QMAN_SWP_SIZE FixedPcdGet64 (PcdQmanSwpSize) +#define BMAN_SWP_BASE_ADDR FixedPcdGet64 (PcdBmanSwpBaseAddr) +#define BMAN_SWP_SIZE FixedPcdGet64 (PcdBmanSwpSize) +#define PCI_EXP1_BASE_ADDR FixedPcdGet64 (PcdPciExp1BaseAddr) +#define PCI_EXP1_BASE_SIZE FixedPcdGet64 (PcdPciExp1BaseSize) +#define PCI_EXP2_BASE_ADDR FixedPcdGet64 (PcdPciExp2BaseAddr) +#define PCI_EXP2_BASE_SIZE FixedPcdGet64 (PcdPciExp2BaseSize) +#define PCI_EXP3_BASE_ADDR FixedPcdGet64 (PcdPciExp3BaseAddr) +#define PCI_EXP3_BASE_SIZE FixedPcdGet64 (PcdPciExp3BaseSize) +#define DRAM1_BASE_ADDR FixedPcdGet64 (PcdDram1BaseAddr) +#define DRAM1_SIZE FixedPcdGet64 (PcdDram1Size) +#define DRAM2_BASE_ADDR FixedPcdGet64 (PcdDram2BaseAddr) +#define DRAM2_SIZE FixedPcdGet64 (PcdDram2Size) +#define DRAM3_BASE_ADDR FixedPcdGet64 (PcdDram3BaseAddr) +#define DRAM3_SIZE FixedPcdGet64 (PcdDram3Size) +#define QSPI_REGION_BASE_ADDR FixedPcdGet64 (PcdQspiRegionBaseAddr) +#define QSPI_REGION_SIZE FixedPcdGet64 (PcdQspiRegionSize) + +/** + Return the Virtual Memory Map of your platform + + This Virtual Memory Map is used by MemoryInitPei Module to initialize th= e MMU on your platform. + + @param VirtualMemoryMap : Array of ARM_MEMORY_REGION_DESCRIPTOR descr= ibing a Physical-to- + Virtual Memory mapping. This array must be = ended by a zero-filled + entry + +**/ + +VOID +ArmPlatformGetVirtualMemoryMap ( + IN ARM_MEMORY_REGION_DESCRIPTOR** VirtualMemoryMap + ) +{ + ARM_MEMORY_REGION_ATTRIBUTES CacheAttributes; + UINTN Index; + ARM_MEMORY_REGION_DESCRIPTOR *VirtualMemoryTable; + + Index =3D 0; + + ASSERT(VirtualMemoryMap !=3D NULL); + + VirtualMemoryTable =3D (ARM_MEMORY_REGION_DESCRIPTOR*)AllocatePages( + EFI_SIZE_TO_PAGES (sizeof(ARM_MEMORY_REGION_DESCRIPTOR) * MAX_VI= RTUAL_MEMORY_MAP_DESCRIPTORS)); + + if (VirtualMemoryTable =3D=3D NULL) { + return; + } + + if (FeaturePcdGet(PcdCacheEnable) =3D=3D TRUE) { + CacheAttributes =3D ARM_MEMORY_REGION_ATTRIBUTE_WRITE_BACK; + } else { + CacheAttributes =3D ARM_MEMORY_REGION_ATTRIBUTE_UNCACHED_UNBUFFERED; + } + + // DRAM1 (Must be 1st entry) + VirtualMemoryTable[Index].PhysicalBase =3D DRAM1_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase =3D DRAM1_BASE_ADDR; + VirtualMemoryTable[Index].Length =3D DRAM1_SIZE; + VirtualMemoryTable[Index].Attributes =3D CacheAttributes; + + // CCSR Space + VirtualMemoryTable[++Index].PhysicalBase =3D CCSR_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase =3D CCSR_BASE_ADDR; + VirtualMemoryTable[Index].Length =3D CCSR_SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + // IFC region 1 + // + // A-009241 : Unaligned write transactions to IFC may result in corrup= tion of data + // Affects : IFC + // Description: 16 byte unaligned write from system bus to IFC may resul= t in extra unintended + // writes on external IFC interface that can corrupt data o= n external flash. + // Impact : Data corruption on external flash may happen in case of = unaligned writes to + // IFC memory space. + // Workaround: Following are the workarounds: + // For write transactions from core, IFC interface memories = (including IFC SRAM) + // should be configured as device type memory in MMU. + // For write transactions from non-core masters (like system= DMA), the address + // should be 16 byte aligned and the data size should be = multiple of 16 bytes. + // + VirtualMemoryTable[++Index].PhysicalBase =3D IFC_REGION1_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase =3D IFC_REGION1_BASE_ADDR; + VirtualMemoryTable[Index].Length =3D IFC_REGION1_SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + // QMAN SWP + VirtualMemoryTable[++Index].PhysicalBase =3D QMAN_SWP_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase =3D QMAN_SWP_BASE_ADDR; + VirtualMemoryTable[Index].Length =3D QMAN_SWP_SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_U= NCACHED_UNBUFFERED; + + // BMAN SWP + VirtualMemoryTable[++Index].PhysicalBase =3D BMAN_SWP_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase =3D BMAN_SWP_BASE_ADDR; + VirtualMemoryTable[Index].Length =3D BMAN_SWP_SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_U= NCACHED_UNBUFFERED; + + // IFC region 2 + VirtualMemoryTable[++Index].PhysicalBase =3D IFC_REGION2_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase =3D IFC_REGION2_BASE_ADDR; + VirtualMemoryTable[Index].Length =3D IFC_REGION2_SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + // DRAM2 + VirtualMemoryTable[++Index].PhysicalBase =3D DRAM2_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase =3D DRAM2_BASE_ADDR; + VirtualMemoryTable[Index].Length =3D DRAM2_SIZE; + VirtualMemoryTable[Index].Attributes =3D CacheAttributes; + + // PCIe1 + VirtualMemoryTable[++Index].PhysicalBase =3D PCI_EXP1_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase =3D PCI_EXP1_BASE_ADDR; + VirtualMemoryTable[Index].Length =3D PCI_EXP1_BASE_SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + // PCIe2 + VirtualMemoryTable[++Index].PhysicalBase =3D PCI_EXP2_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase =3D PCI_EXP2_BASE_ADDR; + VirtualMemoryTable[Index].Length =3D PCI_EXP2_BASE_SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + // PCIe3 + VirtualMemoryTable[++Index].PhysicalBase =3D PCI_EXP3_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase =3D PCI_EXP3_BASE_ADDR; + VirtualMemoryTable[Index].Length =3D PCI_EXP3_BASE_SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_D= EVICE; + + // DRAM3 + VirtualMemoryTable[++Index].PhysicalBase =3D DRAM3_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase =3D DRAM3_BASE_ADDR; + VirtualMemoryTable[Index].Length =3D DRAM3_SIZE; + VirtualMemoryTable[Index].Attributes =3D CacheAttributes; + + // QSPI region + VirtualMemoryTable[++Index].PhysicalBase =3D QSPI_REGION_BASE_ADDR; + VirtualMemoryTable[Index].VirtualBase =3D QSPI_REGION_BASE_ADDR; + VirtualMemoryTable[Index].Length =3D QSPI_REGION_SIZE; + VirtualMemoryTable[Index].Attributes =3D ARM_MEMORY_REGION_ATTRIBUTE_U= NCACHED_UNBUFFERED; + + // End of Table + VirtualMemoryTable[++Index].PhysicalBase =3D 0; + VirtualMemoryTable[Index].VirtualBase =3D 0; + VirtualMemoryTable[Index].Length =3D 0; + VirtualMemoryTable[Index].Attributes =3D (ARM_MEMORY_REGION_ATTRIBUTES= )0; + + ASSERT((Index + 1) <=3D MAX_VIRTUAL_MEMORY_MAP_DESCRIPTORS); + + *VirtualMemoryMap =3D VirtualMemoryTable; +} --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed Dec 25 02:35:00 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 1510044893790107.6440344834956; Tue, 7 Nov 2017 00:54:53 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 14C012035D109; Tue, 7 Nov 2017 00:50:52 -0800 (PST) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0080.outbound.protection.outlook.com [104.47.34.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 7BD822034EE0C for ; Tue, 7 Nov 2017 00:50:50 -0800 (PST) Received: from CY4PR03CA0097.namprd03.prod.outlook.com (10.171.242.166) by BN6PR03MB2692.namprd03.prod.outlook.com (10.173.144.11) 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:48 +0000 Received: from BL2FFO11OLC015.protection.gbl (2a01:111:f400:7c09::143) by CY4PR03CA0097.outlook.office365.com (2603:10b6:910:4d::38) 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:47 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11OLC015.mail.protection.outlook.com (10.173.160.81) 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:47 +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 vA78s4Dg009319; Tue, 7 Nov 2017 01:54:44 -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.34.80; helo=nam01-by2-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:15 +0530 Message-ID: <1510065736-9394-10-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: 131545184879353986; (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)(7966004)(336005)(376002)(39860400002)(39380400002)(346002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(15188155005)(53946003)(81166006)(8656006)(2201001)(97736004)(4326008)(356003)(5003940100001)(16799955002)(305945005)(104016004)(77096006)(316002)(16586007)(76176999)(47776003)(86362001)(54906003)(575784001)(110136005)(81156014)(8676002)(85426001)(50986999)(36756003)(106466001)(189998001)(50226002)(2906002)(33646002)(105606002)(8936002)(48376002)(68736007)(50466002)(6306002)(5660300001)(498600001)(6666003)(2950100002)(53376002)(966005)(53936002)(11771545001)(559001)(579004)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR03MB2692; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC015; 1:eDDplhBDamAFNQUWBFciuD84ls76OmOR2+8Zs4cfj2qMErv4nnvpAYhvMQVeHpvx3FCP2TeW9lN7PHmlegidPfN/kKotOtqVQk7/X1VSZtwsxHQjCJCnyPfTCKF9dRIu MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 43f57b25-1723-4729-3f25-08d525bd331a X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603249); SRVR:BN6PR03MB2692; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2692; 3:G1FbkDbP2ZydvdGrk4zMQvhcJcL1paC1zKYypukS2V4tLY+otiRgWp+f069hZYmmOcvE9/ILRyH2EWdD1zcbXL5IZrYJuxvmUu0X6mPG0QVGv0ZxvFTGDycY7nVVrp0RITNPitl22cEvVf6IDy55//IO0aniFOYSvu8t4fGasenw9X3vEFLgLBiBuPgzX9fV/bxDUbHUanWF9HBKUsuJxzzalDg7DUWDT0Kvr+pY96H411CMQ4oHmCnWEictx37eJ32Wrjr1Ga/6TFkrKotjHFPUskWEamS8E2V/tknqwJW0Jey4pyCEGKKXNEKgPf3FGmSlaXl8Dsh6NhbT5WQ1H48LxJhQk4ZmoRzawzNS2IU=; 25:ZJk2/TzZsgI4wTFWObcaATODUvBST3Yy45sxUzvgCMg6IHHKd3EL+S2HOa8c/+TjnuplH/46E9djuaNo5ndc8xPSMaFqxdizEMI0IxxBNOSjOLil1ABSTkZj85dKU2dSIiRA6d+Bc57vpE4miZAS0O6VCHcnTaUAkOzoGw0rcZCcVuy/dKWx+RSpiUe5s05RGeADW7Go+9Dm0hbfC1r8V7zk/McRosfRVpFY+HSKsJrs6dTZygmqKBR0Ug1ysk2BMtLHIQ+M4acott6cGrIsSStp2O/GlCjS1cmUNb+D4Uo6P7xg2w/fjvozgqAxIbZyVXBckNj1w6MLGNWwTx5oCw== X-MS-TrafficTypeDiagnostic: BN6PR03MB2692: X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2692; 31:VwLBiee6u/Xk0vvo39xyY12Nv19MOI7BsD12tKAGjCmGXgmcBXly731r9812a9IhWy/1uqFZi+4zcqizgcRLMne/DYIrV4OLi/raIR4XVi2L8vuIji7T/JPegAMS8Y3A1FUJB9gBNVfpXD1sKuD4lgteZltwdbkAv6Na5UWF/AYRJMiVllMDB4IJhPXIy7HA2SxydY9AIGndF1ISPco1bAHDXn6QpGkPrRmrRIIKo8o=; 4:9zQAJFPuI2M3yLk38QxJMOi++4UH8Duvqms6WZFCOZ6jQmE7YkvPHcDvXxRTxOfiZoNFg/Nxeg5X3l7J6LvMVm28DuP0NzgGW+61XO4yXnMqrwt7H3gBWFVatmrFuitgr7fBsNWOVe82fmm7VIYASXY2WHqP70KUgzLIblit9afCsn6DBqQYPftPGEANCdowT4j/zfVDAMA7OTbBVzEdrvloItredXol6fmDK0mOkFMHVhhcAIEn3ylWfB5rZZ0Qw0EMHiwMX6R7XPwuyqWul3ISSDPNw52Ll5BdryFpnZSX/VFeleWfeLnchgeDx4gx 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)(5005006)(8121501046)(3231021)(100000703101)(100105400095)(10201501046)(93006095)(93001095)(3002001)(6055026)(6096035)(20161123561025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123563025)(20161123556025)(20161123559100)(20161123565025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN6PR03MB2692; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN6PR03MB2692; X-Forefront-PRVS: 0484063412 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2692; 23:Z9LCwoGH5szcLASD/MPF84Ptm5lzAUKtdbBUMe+/9?= =?us-ascii?Q?HTmJfuzGPwBBcjzZY1eBgRmwdHtQpb0pHQqqKddF62IQj4LKAWxRb8QAAU4y?= =?us-ascii?Q?yd9WEuVaVGDHRa7bezEyx9LRTjU2coV/ADkmrgJ1bCZsgSbwXQlJ3ud8/sO4?= =?us-ascii?Q?a7VQCOgrWdk3Cg65+z0A5jSsrQzSSn2zTN0NHJf0spDpK929XhcF0jXrgV5z?= =?us-ascii?Q?FKA3iLk3Ag048gLpTt9v2yI6qGBt73griNUxonD3+FsEXvaE/3VWz0ORe4zy?= =?us-ascii?Q?jPlx4dKZuZ6Xg+DYpdZRV4XTZoBeFL6sGEhaQD1vw0MOziP3BxVnDLC69IzT?= =?us-ascii?Q?gnN/R65osbT8mexMFH805Evz+SJm0raujCJjHhYhfBfv7RdjT+uucQ0E1Hw4?= =?us-ascii?Q?TB3PcOjW+HRhOMac/l4mikMTsK3pNibORZzkVLkOP1CXh9WRMgIP3O1dXfN2?= =?us-ascii?Q?iDxULdnvraasOggZcvihNnwoRfpG3WPGb7bLTzy5JlCpcz+KU82uEBJct9Sc?= =?us-ascii?Q?j/NyVADyyCsyNrDZBhJFVy7Z0cYWDFCxlSmgIcl+h4R9SIuZ0MjgqEeuBSBy?= =?us-ascii?Q?VH1nCTtscbgvdLQbWn2z+E12uA672Z+9OVHO3SCM+vivj8Pwum/Dv+YFOOZU?= =?us-ascii?Q?gC5KvOR7UWhouFbQdAtXMZJcs5ZkmKe+Deeaa4KMnipbVp/PXfEJOqT4f4uG?= =?us-ascii?Q?al+kxBeAq6IgeJGf9vJ+duIojh+jWFLm8NiAdgFmuzIfzEOqgT1CcsGAGfxu?= =?us-ascii?Q?kC03kiUhNjuXGO8xoDPzTSor+JCyziQ6WqAIrFCezec2tv8tXFQRseRPYl/j?= =?us-ascii?Q?vzWuxLCZm7Q1OFgHLxLXwZHyybNOOhPBTiTiQIuAGc7GNsh8bTXOmVMceGP/?= =?us-ascii?Q?Admp1JPSA24b/gbhhzo9kzL7JLNFAtZOUKoc4F9mkt0OdWSXnKHLv+eFPd9x?= =?us-ascii?Q?rdwJfjBYfCNTXAP+aBLbCKyknK3Xt+vS1puiWu2Aw/TLAGj9RryDlbLujpy9?= =?us-ascii?Q?f/sXoWicwgMfhNFlT1wNdeeWPknibfzjZMOBPzSghZfu/n9j88OS1eL5KERq?= =?us-ascii?Q?EE0UWL9Vn9XkV48ZJyA8LlbOpnaalcbETfCntWa9BmNkl/nBMrHFY4iG1N7z?= =?us-ascii?Q?jZ/iEHUOd9Vo64/7DkHqLc6I5cMRf3lTBA7xDPMKYu04BrNbmRQTPcnlhav0?= =?us-ascii?Q?PBCMZ/ngX3jMiwxT7psV7GLpyvfcZ/AqpbqAohQJLDYOcMrE7wWJGjvhn/gM?= =?us-ascii?Q?rNlpZ3oAXssHmHJLSS3EWxm5W8oSfiyUHeMjBP9tYlno7J83ddCdlWOc10tf?= =?us-ascii?Q?slhzioEEH/Z8lwsrp6wXkqzMVUAJLDn2qtVx8NrhOn2esWGfzZ15XNVLC1/a?= =?us-ascii?Q?zrNKt/HebbkirpbX5baxbMjneJG2A8INNO5HAt+y+vUMHind6Sd4I9quH+Yc?= =?us-ascii?Q?UGwKZdN3Q=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2692; 6:fso0JdLgCNst0bHkl8Ef3l9bWZ6ZEkPSOM0Mm6m1MOuRAdnGIlJoQ9z0VgAFbd/Ud1plqWKKj2GVHIkQtdZanhFz4d4wgWt+8SPFeHAQq/KRNXGFLktDWiSBeENG/dAMexKzFNYLyENBB4OJP2pBA35B8Nou8onTV0fQFi4urEBaOMT4d0fmPCtScnqBdRB8crp7WrlJxzmQlDeIIpxCApDYTWrgaxXIKZeIDVuUUTmJanL+yRtZRlVSlKKK6dcJuykJ7Lv/rRyY2UUu8yOM0JvKffu9ZmhKEAoGPpU2IzV+HaT7/E80UT+DDzxRSEI8k7MzAlB5kd3DXHAnHJ46kn8llt6V1jNunIXc/QCh8q0=; 5:ahONRMZVvXa9FU8XjMYffI/qk/0dFbnKtq5qwX0koPJbTbSAvJs9pNEVqADvCgyat+Weq5SCz28g6sSh19y271o/dzu7U3MUlnL8hZvb8qxhW/46iICxJ5uK6g81miA4U/4u3ST+mK4pnhZajMlukin1ufSLhBvIyQ2p5EysREA=; 24:oQZzbgwjfR+rR+D7Fv3Fn4JRzvfJ7iAJ7qopSCQoWhpOqYQtJlWujcIgJrXv7ob83zjkWxtOP7S+wDR4tEyh2sP4OrBQFCJzRahfi92eH8Q=; 7:3dzGtiCXSZ3Hj0v6uhBGR7ArFA1xlNcOucnL422e+/O5vPTH07f39m/ETDdrdp27pkYn4/McjfgHWc9ryiYByRz4o/nrpdSrInhO7iguJITnnb3SlB1SKZ9TJixMUkqTbkoGYPcu61cVq9OXll0aoQCujKimuEA/mxy35t21k2rBPjS+eib6b+2IJwuzm5L03r1Wf+G69n0L498BUcz0rE/q3XKU0Jt4LQXz2YDLROHh0E/1rBkiQyHXxJqhiOXF SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 08:54:47.7482 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43f57b25-1723-4729-3f25-08d525bd331a 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: BN6PR03MB2692 Subject: [edk2] [PATCH 09/10] SocLib : Add support for initialization of peripherals 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" Add SocInit function that initializes peripherals and print board and soc information. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- Platform/NXP/Include/Bitops.h | 179 +++++++++++++++ Silicon/NXP/Chassis/Chassis.c | 393 ++++++++++++++++++++++++++++= ++++ Silicon/NXP/Chassis/Chassis.h | 123 ++++++++++ Silicon/NXP/Chassis/Chassis2/SerDes.h | 82 +++++++ Silicon/NXP/Chassis/Chassis2/Soc.c | 146 ++++++++++++ Silicon/NXP/Chassis/Chassis2/Soc.h | 376 ++++++++++++++++++++++++++++= ++ Silicon/NXP/Chassis/LS1043aSocLib.inf | 48 ++++ Silicon/NXP/Chassis/SerDes.c | 253 ++++++++++++++++++++ Silicon/NXP/LS1043A/Include/SocSerDes.h | 55 +++++ 9 files changed, 1655 insertions(+) create mode 100644 Platform/NXP/Include/Bitops.h create mode 100644 Silicon/NXP/Chassis/Chassis.c create mode 100644 Silicon/NXP/Chassis/Chassis.h create mode 100644 Silicon/NXP/Chassis/Chassis2/SerDes.h create mode 100644 Silicon/NXP/Chassis/Chassis2/Soc.c create mode 100644 Silicon/NXP/Chassis/Chassis2/Soc.h create mode 100644 Silicon/NXP/Chassis/LS1043aSocLib.inf create mode 100644 Silicon/NXP/Chassis/SerDes.c create mode 100644 Silicon/NXP/LS1043A/Include/SocSerDes.h diff --git a/Platform/NXP/Include/Bitops.h b/Platform/NXP/Include/Bitops.h new file mode 100644 index 0000000..90e6404 --- /dev/null +++ b/Platform/NXP/Include/Bitops.h @@ -0,0 +1,179 @@ +/** Bitops.h + Header defining the general bitwise operations + + 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. + +**/ + +#ifndef __BITOPS_H__ +#define __BITOPS_H__ + +#include + +#define MASK_LOWER_16 0xFFFF0000 +#define MASK_UPPER_16 0x0000FFFF +#define MASK_LOWER_8 0xFF000000 +#define MASK_UPPER_8 0x000000FF + +/* + * Returns the bit mask for a bit index from 0 to 31 + */ +#define BIT(_BitIndex) (0x1u << (_BitIndex)) + +/** + * Upper32Bits - return bits 32-63 of a number + * @N: the number we're accessing + * + * A basic shift-right of a 64- or 32-bit quantity. Use this to suppress + * the "right shift count >=3D width of type" warning when that quantity is + * 32-bits. + */ +#define Upper32Bits(N) ((UINT32)(((N) >> 16) >> 16)) + +/** + * Lower32Bits - return bits 0-31 of a number + * @N: the number we're accessing + */ +#define Lower32Bits(N) ((UINT32)(N)) + + +/* + * Stores a value for a given bit field in 32-bit '_Container' + */ + +#define SET_BIT_FIELD32(_Container, _BitShift, _BitWidth, _Value) \ + __SET_BIT_FIELD32(_Container, \ + __GEN_BIT_FIELD_MASK32(_BitShift, _BitWidth), \ + _BitShift, \ + _Value) + +#define __SET_BIT_FIELD32(_Container, _BitMask, _BitShift, _Value) \ + do { \ + (_Container) &=3D ~(_BitMask); \ + if ((_Value) !=3D 0) { \ + ASSERT(((UINT32)(_Value) << (_BitShift)) <=3D (_BitMask)); \ + (_Container) |=3D \ + ((UINT32)(_Value) << (_BitShift)) & (_BitMask); \ + } \ + } while (0) + +/* + * Extracts the value for a given bit field in 32-bit _Container + */ + +#define GET_BIT_FIELD32(_Container, _BitShift, _BitWidth) \ + __GET_BIT_FIELD32(_Container, \ + __GEN_BIT_FIELD_MASK32(_BitShift, _BitWidth), \ + _BitShift) + +#define __GET_BIT_FIELD32(_Container, _BitMask, _BitShift) \ + (((UINT32)(_Container) & (_BitMask)) >> (_BitShift)) + +#define __GEN_BIT_FIELD_MASK32(_BitShift, _BitWidth) \ + ((_BitWidth) < 32 ? \ + (((UINT32)1 << (_BitWidth)) - 1) << (_BitShift) : \ + ~(UINT32)0) + +/* + *Stores a value for a given bit field in 64-bit '_Container' + */ +#define SET_BIT_FIELD64(_Container, _BitShift, _BitWidth, _Value) \ + __SET_BIT_FIELD64(_Container, \ + __GEN_BIT_FIELD_MASK64(_BitShift, _BitWidth), \ + _BitShift, \ + _Value) + +#define __SET_BIT_FIELD64(_Container, _BitMask, _BitShift, _Value) \ + do { \ + (_Container) &=3D ~(_BitMask); \ + if ((_Value) !=3D 0) { \ + ASSERT(((UINT64)(_Value) << (_BitShift)) <=3D (_BitMask)); \ + (_Container) |=3D \ + ((UINT64)(_Value) << (_BitShift)) & (_BitMask); \ + } \ + } while (0) + +/* + * Extracts the value for a given bit field in 64-bit _Container + */ +#define GET_BIT_FIELD64(_Container, _BitShift, _BitWidth) \ + __GET_BIT_FIELD64(_Container, \ + __GEN_BIT_FIELD_MASK64(_BitShift, _BitWidth), \ + _BitShift) + +#define __GET_BIT_FIELD64(_Container, _BitMask, _BitShift) \ + (((UINT64)(_Container) & (_BitMask)) >> (_BitShift)) + +#define __GEN_BIT_FIELD_MASK64(_BitShift, _BitWidth) \ + ((_BitWidth) < 64 ? \ + (((UINT64)1 << (_BitWidth)) - 1) << (_BitShift) : \ + ~(UINT64)0) + +/** + + Test If the Destination buffer sets (0->1) or clears (1->0) any bit in So= urce buffer ? + + @param[in] Source Source Buffer Pointer + @param[in] Destination Destination Buffer Pointer + @param[in] NumBytes Bytes to Compare + @param[in] Set True : Test Weather Destination buffer sets any = bit in Source buffer ? + False : Test Weather Destination buffer clears a= ny bit in Source buffer ? + + @retval TRUE Destination buffer sets/clear a bit in source bu= ffer. + @retval FALSE Destination buffer doesn't sets/clear bit in sou= rce buffer. + +**/ +STATIC +inline +BOOLEAN +TestBitSetClear ( + IN VOID *Source, + IN VOID *Destination, + IN UINTN NumBytes, + IN BOOLEAN Set + ) +{ + UINTN Index =3D 0; + VOID* Buffer; + + if (Set) { + Buffer =3D Destination; + } else { + Buffer =3D Source; + } + + while(Index < NumBytes) { + if ((NumBytes - Index) >=3D 8) { + if ((*((UINT64*)(Source+Index)) ^ *((UINT64*)(Destination+Index))) &= *((UINT64*)(Buffer+Index))) { + return TRUE; + } + Index +=3D 8; + } else if ((NumBytes - Index) >=3D 4) { + if ((*((UINT32*)(Source+Index)) ^ *((UINT32*)(Destination+Index))) &= *((UINT32*)(Buffer+Index))) { + return TRUE; + } + Index +=3D 4; + } else if ((NumBytes - Index) >=3D 2) { + if ((*((UINT16*)(Source+Index)) ^ *((UINT16*)(Destination+Index))) &= *((UINT16*)(Buffer+Index))) { + return TRUE; + } + Index +=3D 2; + } else if ((NumBytes - Index) >=3D 1) { + if ((*((UINT8*)(Source+Index)) ^ *((UINT8*)(Destination+Index))) & *= ((UINT8*)(Buffer+Index))) { + return TRUE; + } + Index +=3D 1; + } + } + return FALSE; +} + +#endif diff --git a/Silicon/NXP/Chassis/Chassis.c b/Silicon/NXP/Chassis/Chassis.c new file mode 100644 index 0000000..35814ca --- /dev/null +++ b/Silicon/NXP/Chassis/Chassis.c @@ -0,0 +1,393 @@ +/** @file + SoC specific Library containg functions to initialize various SoC compon= ents + + Copyright (c) 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 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 IMP= LIED. + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "Chassis.h" + +UINT32 +EFIAPI +GurRead ( + IN UINTN Address + ) +{ + if (FixedPcdGetBool(PcdGurBigEndian)) { + return BeMmioRead32(Address); + } else { + return MmioRead32(Address); + } +} + +/* + * Structure to list available SOCs. + */ +STATIC CPU_TYPE CpuTypeList[] =3D { + CPU_TYPE_ENTRY(LS1043A, LS1043A, 4), +}; + +UINT32 +InitiatorType ( + IN UINT32 Cluster, + IN UINTN InitId + ) +{ + CCSR_GUR *GurBase; + UINT32 Idx; + UINT32 Type; + + GurBase =3D (VOID *)PcdGet64(PcdGutsBaseAddr); + Idx =3D (Cluster >> (InitId * 8)) & TP_CLUSTER_INIT_MASK; + Type =3D GurRead((UINTN)&GurBase->TpItyp[Idx]); + + if (Type & TP_ITYP_AV_MASK) { + return Type; + } + + return 0; +} + +/* + * Return the mask for number of cores on this SOC. + */ +UINT32 +CpuMask ( + VOID + ) +{ + CCSR_GUR *GurBase; + UINTN ClusterIndex; + UINTN Count; + UINT32 Cluster; + UINT32 Type; + UINT32 Mask; + UINTN InitiatorIndex; + + GurBase =3D (VOID *)PcdGet64(PcdGutsBaseAddr); + ClusterIndex =3D 0; + Count =3D 0; + Mask =3D 0; + + do { + Cluster =3D GurRead((UINTN)&GurBase->TpCluster[ClusterIndex].Lower); + for (InitiatorIndex =3D 0; InitiatorIndex < TP_INIT_PER_CLUSTER; Initi= atorIndex++) { + Type =3D InitiatorType(Cluster, InitiatorIndex); + if (Type) { + if (TP_ITYP_TYPE_MASK(Type) =3D=3D TP_ITYP_TYPE_ARM) + Mask |=3D 1 << Count; + Count++; + } + } + ClusterIndex++; + } while (CHECK_CLUSTER(Cluster)); + + return Mask; +} + +/* + * Return the number of cores on this SOC. + */ +UINTN +CpuNumCores ( + VOID + ) +{ + return HammingWeight32(CpuMask()); +} + +UINT32 +QoriqCoreToType ( + IN UINTN Core + ) +{ + CCSR_GUR *GurBase; + UINTN ClusterIndex; + UINTN Count; + UINT32 Cluster; + UINT32 Type; + UINTN InitiatorIndex; + + GurBase =3D (VOID *)PcdGet64(PcdGutsBaseAddr); + ClusterIndex =3D 0; + Count =3D 0; + + do { + Cluster =3D GurRead((UINTN)&GurBase->TpCluster[ClusterIndex].Lower); + for (InitiatorIndex =3D 0; InitiatorIndex < TP_INIT_PER_CLUSTER; Initi= atorIndex++) { + Type =3D InitiatorType(Cluster, InitiatorIndex); + if (Type) { + if (Count =3D=3D Core) + return Type; + Count++; + } + } + ClusterIndex++; + } while (CHECK_CLUSTER(Cluster)); + + return -1; /* cannot identify the cluster */ +} + +/* + * Print CPU information + */ +VOID +PrintCpuInfo ( + VOID + ) +{ + SYS_INFO SysInfo; + UINTN CoreIndex; + UINTN Core; + UINT32 Type; + CHAR8 Buf[32]; + CHAR8 Buffer[100]; + UINTN CharCount; + + GetSysInfo(&SysInfo); + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "Clock Configuration= :"); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + + ForEachCpu(CoreIndex, Core, CpuNumCores(), CpuMask()) { + if (!(CoreIndex % 3)) { + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "\n "); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + } + + Type =3D TP_ITYP_VERSION(QoriqCoreToType(Core)); + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "CPU%d(%a):%-4a MH= z ", Core, + Type =3D=3D TY_ITYP_VERSION_A7 ? "A7 " : + (Type =3D=3D TY_ITYP_VERSION_A53 ? "A53" : + (Type =3D=3D TY_ITYP_VERSION_A57 ? "A57" : + (Type =3D=3D TY_ITYP_VERSION_A72 ? "A72" : " Unknown Core "))), + StringToMHz(Buf, sizeof(Buf), SysInfo.FreqProcessor[Core])); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + } + + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "\n Bus: %= -4a MHz ", + StringToMHz(Buf, sizeof(Buf), SysInfo.FreqSystemBus)); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "DDR: %-4a MHz", + StringToMHz(Buf, sizeof(Buf), SysInfo.FreqDdrBus)); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + + if (SysInfo.FreqFman[0] !=3D 0) { + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "\n FMAN: = %-4a MHz ", + StringToMHz(Buf, sizeof(Buf), SysInfo.FreqFman[0])); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + } + + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "\n"); + SerialPortWrite ((UINT8 *) Buffer, CharCount); +} + +/* + * Return system bus frequency + */ +UINT64 +GetBusFrequency ( + VOID + ) +{ + SYS_INFO SocSysInfo; + + GetSysInfo(&SocSysInfo); + + return SocSysInfo.FreqSystemBus; +} + +/* + * Return SDXC bus frequency + */ +UINT64 +GetSdxcFrequency ( + VOID + ) +{ + SYS_INFO SocSysInfo; + + GetSysInfo(&SocSysInfo); + + return SocSysInfo.FreqSdhc; +} + +/* + * Print Soc information + */ +VOID +PrintSoc ( + VOID + ) +{ + CHAR8 Buf[16]; + CCSR_GUR *GurBase; + UINTN Count; + UINTN Svr; + UINTN Ver; + + GurBase =3D (VOID *)PcdGet64(PcdGutsBaseAddr); + + Buf[0] =3D L'\0'; + Svr =3D GurRead((UINTN)&GurBase->Svr); + Ver =3D SVR_SOC_VER(Svr); + + for (Count =3D 0; Count < ARRAY_SIZE(CpuTypeList); Count++) + if ((CpuTypeList[Count].SocVer & SVR_WO_E) =3D=3D Ver) { + AsciiStrCpy(Buf, (CONST CHAR8 *)CpuTypeList[Count].Name); + + if (IS_E_PROCESSOR(Svr)) { + AsciiStrCat(Buf, (CONST CHAR8 *)"E"); + } + break; + } + + if (Count =3D=3D ARRAY_SIZE(CpuTypeList)) { + AsciiStrCpy(Buf, (CONST CHAR8 *)"unknown"); + } + + DEBUG((DEBUG_INFO, "SoC: %a (0x%x); Rev %d.%d\n", + Buf, Svr, SVR_MAJOR(Svr), SVR_MINOR(Svr))); + + return; +} + +/* + * Dump RCW (Reset Control Word) on console + */ +VOID +PrintRCW ( + VOID + ) +{ + CCSR_GUR *Base; + UINTN Count; + CHAR8 Buffer[100]; + UINTN CharCount; + + Base =3D (VOID *)PcdGet64(PcdGutsBaseAddr); + + /* + * Display the RCW, so that no one gets confused as to what RCW + * we're actually using for this boot. + */ + + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), + "Reset Configuration Word (RCW):"); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + for (Count =3D 0; Count < ARRAY_SIZE(Base->RcwSr); Count++) { + UINT32 Rcw =3D BeMmioRead32((UINTN)&Base->RcwSr[Count]); + + if ((Count % 4) =3D=3D 0) { + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), + "\n %08x:", Count * 4); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + } + + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), " %08x", Rcw); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + } + + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "\n"); + SerialPortWrite ((UINT8 *) Buffer, CharCount); +} + +/* + * Setup SMMU in bypass mode + * and also set its pagesize + */ +VOID +SmmuInit ( + VOID + ) +{ + UINT32 Value; + + /* set pagesize as 64K and ssmu-500 in bypass mode */ + Value =3D (MmioRead32((UINTN)SMMU_REG_SACR) | SACR_PAGESIZE_MASK); + MmioWrite32((UINTN)SMMU_REG_SACR, Value); + + Value =3D (MmioRead32((UINTN)SMMU_REG_SCR0) | SCR0_CLIENTPD_MASK) & ~(SC= R0_USFCFG_MASK); + MmioWrite32((UINTN)SMMU_REG_SCR0, Value); + + Value =3D (MmioRead32((UINTN)SMMU_REG_NSCR0) | SCR0_CLIENTPD_MASK) & ~(S= CR0_USFCFG_MASK); + MmioWrite32((UINTN)SMMU_REG_NSCR0, Value); +} + +/* + * Return current Soc Name form CpuTypeList + */ +CHAR8 * +GetSocName ( + VOID + ) +{ + UINT8 Count; + UINTN Svr; + UINTN Ver; + CCSR_GUR *GurBase; + + GurBase =3D (VOID *)PcdGet64(PcdGutsBaseAddr); + + Svr =3D GurRead((UINTN)&GurBase->Svr); + Ver =3D SVR_SOC_VER(Svr); + + for (Count =3D 0; Count < ARRAY_SIZE(CpuTypeList); Count++) { + if ((CpuTypeList[Count].SocVer & SVR_WO_E) =3D=3D Ver) { + return (CHAR8 *)CpuTypeList[Count].Name; + } + } + + return NULL; +} + +/* + * Return Baud divisor on basis of Baudrate + */ +UINT32 +CalculateBaudDivisor ( + IN UINT64 BaudRate + ) +{ + SYS_INFO SocSysInfo; + UINTN DUartClk; + + GetSysInfo(&SocSysInfo); + DUartClk =3D SocSysInfo.FreqSystemBus/PcdGet32(PcdPlatformFreqDiv); + + return ((DUartClk)/(BaudRate * 16)); +} + +/* + * Return I2c bus frequency + */ +UINT32 +CalculateI2cClockRate ( + VOID + ) +{ + SYS_INFO SocSysInfo; + + GetSysInfo(&SocSysInfo); + + return SocSysInfo.FreqSystemBus; +} diff --git a/Silicon/NXP/Chassis/Chassis.h b/Silicon/NXP/Chassis/Chassis.h new file mode 100644 index 0000000..8c97a3a --- /dev/null +++ b/Silicon/NXP/Chassis/Chassis.h @@ -0,0 +1,123 @@ +/** @file +* Header defining the Base addresses, sizes, flags etc for chassis 1 +* +* 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. +* +**/ + +#ifndef __CHASSIS_H__ +#define __CHASSIS_H__ + +#define TP_ITYP_AV_MASK 0x00000001 /* Initiator available */ +#define TP_ITYP_TYPE_MASK(x) (((x) & 0x6) >> 1) /* Initiator Type */ +#define TP_ITYP_TYPE_ARM 0x0 +#define TP_ITYP_TYPE_PPC 0x1 +#define TP_ITYP_TYPE_OTHER 0x2 /* StarCore DSP */ +#define TP_ITYP_TYPE_HA 0x3 /* HW Accelerator */ +#define TP_ITYP_THDS(x) (((x) & 0x18) >> 3) /* # threads */ +#define TP_ITYP_VERSION(x) (((x) & 0xe0) >> 5) /* Initiator Versi= on */ +#define TP_CLUSTER_INIT_MASK 0x0000003f /* initiator mask */ +#define TP_INIT_PER_CLUSTER 4 + +#define TY_ITYP_VERSION_A7 0x1 +#define TY_ITYP_VERSION_A53 0x2 +#define TY_ITYP_VERSION_A57 0x3 +#define TY_ITYP_VERSION_A72 0x4 + +#define CPU_TYPE_ENTRY(N, V, NC) \ + { .Name =3D #N, .SocVer =3D SVR_##V, .NumCores =3D (NC)} + +#define SVR_WO_E 0xFFFFFE +#define SVR_LS1043A 0x879200 + +#define SVR_MAJOR(svr) (((svr) >> 4) & 0xf) +#define SVR_MINOR(svr) (((svr) >> 0) & 0xf) +#define SVR_SOC_VER(svr) (((svr) >> 8) & SVR_WO_E) +#define IS_E_PROCESSOR(svr) (!((svr >> 8) & 0x1)) + +typedef struct { + CHAR8 Name[16]; + UINT32 SocVer; + UINT32 NumCores; +} CPU_TYPE; + +typedef struct { + UINTN CpuClk; /* CPU clock in Hz! */ + UINTN BusClk; + UINTN MemClk; + UINTN PciClk; + UINTN SdhcClk; +} SOC_CLOCK_INFO; + +/* + * Print Soc information + */ +VOID +PrintSoc ( + VOID + ); + +/* + * Initialize Clock structure + */ +VOID +ClockInit ( + VOID + ); + +/* + * Setup SMMU in bypass mode + * and also set its pagesize + */ +VOID +SmmuInit ( + VOID + ); + +/* + * Print CPU information + */ +VOID +PrintCpuInfo ( + VOID + ); + +/* + * Dump RCW (Reset Control Word) on console + */ +VOID +PrintRCW ( + VOID + ); + +UINT32 +InitiatorType ( + IN UINT32 Cluster, + IN UINTN InitId + ); + +/* + * Return the mask for number of cores on this SOC. + */ +UINT32 +CpuMask ( + VOID + ); + +/* + * Return the number of cores on this SOC. + */ +UINTN +CpuNumCores ( + VOID + ); + +#endif /* __CHASSIS_H__ */ diff --git a/Silicon/NXP/Chassis/Chassis2/SerDes.h b/Silicon/NXP/Chassis/Ch= assis2/SerDes.h new file mode 100644 index 0000000..844cad0 --- /dev/null +++ b/Silicon/NXP/Chassis/Chassis2/SerDes.h @@ -0,0 +1,82 @@ +/** SerDes.h + The Header file of SerDes Module for Chassis 2 + + 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 + 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 IMPL= IED. + +**/ + +#ifndef __SERDES_H__ +#define __SERDES_H__ + +#include + +#define SRDS_MAX_LANES 4 + +typedef enum { + NONE =3D 0, + PCIE1, + PCIE2, + PCIE3, + SATA, + SGMII_FM1_DTSEC1, + SGMII_FM1_DTSEC2, + SGMII_FM1_DTSEC5, + SGMII_FM1_DTSEC6, + SGMII_FM1_DTSEC9, + SGMII_FM1_DTSEC10, + QSGMII_FM1_A, + XFI_FM1_MAC9, + XFI_FM1_MAC10, + SGMII_2500_FM1_DTSEC2, + SGMII_2500_FM1_DTSEC5, + SGMII_2500_FM1_DTSEC9, + SGMII_2500_FM1_DTSEC10, + SERDES_PRTCL_COUNT +} SERDES_PROTOCOL; + +typedef enum { + SRDS_1 =3D 0, + SRDS_2, + SRDS_MAX_NUM +} SERDES_NUMBER; + +typedef struct { + UINT16 Protocol; + UINT8 SrdsLane[SRDS_MAX_LANES]; +} SERDES_CONFIG; + +typedef +VOID +SERDES_PROBE_LANES_CALLBACK ( + IN SERDES_PROTOCOL LaneProtocol, + IN VOID *Arg + ); + +VOID +SerDesProbeLanes( + IN SERDES_PROBE_LANES_CALLBACK *SerDesLaneProbeCallback, + IN VOID *Arg + ); + +EFI_STATUS +CheckSerDesPrtclValid ( + IN INTN SerDes, + IN UINT32 Prtcl + ); + +SERDES_PROTOCOL +GetSerDesPrtcl ( + IN INTN SerDes, + IN INTN Cfg, + IN INTN Lane + ); + +#endif /* __SERDES_H */ diff --git a/Silicon/NXP/Chassis/Chassis2/Soc.c b/Silicon/NXP/Chassis/Chass= is2/Soc.c new file mode 100644 index 0000000..e18c390 --- /dev/null +++ b/Silicon/NXP/Chassis/Chassis2/Soc.c @@ -0,0 +1,146 @@ +/** @Soc.c + SoC specific Library containg functions to initialize various SoC compon= ents + + 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 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 IMP= LIED. + +**/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Soc.h" + +VOID +GetSysInfo ( + OUT SYS_INFO *PtrSysInfo + ) +{ + CCSR_GUR *GurBase; + CCSR_CLOCK *ClkBase; + UINTN CpuIndex; + UINT32 TempRcw; + UINT32 CPllSel; + UINT32 CplxPll; + CONST UINT8 CoreCplxPll[8] =3D { + [0] =3D 0, /* CC1 PPL / 1 */ + [1] =3D 0, /* CC1 PPL / 2 */ + [4] =3D 1, /* CC2 PPL / 1 */ + [5] =3D 1, /* CC2 PPL / 2 */ + }; + + CONST UINT8 CoreCplxPllDivisor[8] =3D { + [0] =3D 1, /* CC1 PPL / 1 */ + [1] =3D 2, /* CC1 PPL / 2 */ + [4] =3D 1, /* CC2 PPL / 1 */ + [5] =3D 2, /* CC2 PPL / 2 */ + }; + + UINTN PllCount; + UINTN FreqCPll[NUM_CC_PLLS]; + UINTN PllRatio[NUM_CC_PLLS]; + UINTN SysClk; + + GurBase =3D (VOID *)PcdGet64(PcdGutsBaseAddr); + ClkBase =3D (VOID *)PcdGet64(PcdClkBaseAddr); + SysClk =3D CLK_FREQ; + + InternalMemZeroMem(PtrSysInfo, sizeof (SYS_INFO)); + + PtrSysInfo->FreqSystemBus =3D SysClk; + PtrSysInfo->FreqDdrBus =3D SysClk; + + PtrSysInfo->FreqSystemBus *=3D (GurRead((UINTN)&GurBase->RcwSr[0]) >> + CHASSIS2_RCWSR0_SYS_PLL_RAT_SHIFT) & + CHASSIS2_RCWSR0_SYS_PLL_RAT_MASK; + PtrSysInfo->FreqDdrBus *=3D (GurRead((UINTN)&GurBase->RcwSr[0]) >> + CHASSIS2_RCWSR0_MEM_PLL_RAT_SHIFT) & + CHASSIS2_RCWSR0_MEM_PLL_RAT_MASK; + + for (PllCount =3D 0; PllCount < NUM_CC_PLLS; PllCount++) { + PllRatio[PllCount] =3D (GurRead((UINTN)&ClkBase->PllCgSr[PllCount].Pll= CnGSr) >> 1) & 0xff; + if (PllRatio[PllCount] > 4) { + FreqCPll[PllCount] =3D SysClk * PllRatio[PllCount]; + } else { + FreqCPll[PllCount] =3D PtrSysInfo->FreqSystemBus * PllRatio[PllCount= ]; + } + } + + for (CpuIndex =3D 0; CpuIndex < MAX_CPUS; CpuIndex++) { + CPllSel =3D (GurRead((UINTN)&ClkBase->ClkcSr[CpuIndex].ClkCnCSr) >> 27= ) & 0xf; + CplxPll =3D CoreCplxPll[CPllSel]; + + PtrSysInfo->FreqProcessor[CpuIndex] =3D FreqCPll[CplxPll] / CoreCplxPl= lDivisor[CPllSel]; + } + + TempRcw =3D GurRead((UINTN)&GurBase->RcwSr[7]); + switch ((TempRcw & HWA_CGA_M1_CLK_SEL) >> HWA_CGA_M1_CLK_SHIFT) { + case 2: + PtrSysInfo->FreqFman[0] =3D FreqCPll[0] / 2; + break; + case 3: + PtrSysInfo->FreqFman[0] =3D FreqCPll[0] / 3; + break; + case 4: + PtrSysInfo->FreqFman[0] =3D FreqCPll[0] / 4; + break; + case 5: + PtrSysInfo->FreqFman[0] =3D PtrSysInfo->FreqSystemBus; + break; + case 6: + PtrSysInfo->FreqFman[0] =3D FreqCPll[1] / 2; + break; + case 7: + PtrSysInfo->FreqFman[0] =3D FreqCPll[1] / 3; + break; + default: + DEBUG((DEBUG_WARN, "Error: Unknown FMan1 clock select!\n")); + break; + } + PtrSysInfo->FreqSdhc =3D PtrSysInfo->FreqSystemBus/PcdGet32(PcdPlatformF= reqDiv); + PtrSysInfo->FreqQman =3D PtrSysInfo->FreqSystemBus/PcdGet32(PcdPlatformF= reqDiv); +} + +/** + Function to initialize SoC specific constructs + // CPU Info + // SoC Personality + // Board Personality + // RCW prints + **/ +VOID +SocInit ( + VOID + ) +{ + CHAR8 Buffer[100]; + UINTN CharCount; + + SmmuInit(); + + // Initialize the Serial Port + SerialPortInitialize (); + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "\nUEFI firmware (ve= rsion %s built at %a on %a)\n\r", + (CHAR16*)PcdGetPtr(PcdFirmwareVersionString), __TIME__, __DATE__); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + + PrintCpuInfo(); + PrintRCW(); + + return; +} diff --git a/Silicon/NXP/Chassis/Chassis2/Soc.h b/Silicon/NXP/Chassis/Chass= is2/Soc.h new file mode 100644 index 0000000..e6b89d3 --- /dev/null +++ b/Silicon/NXP/Chassis/Chassis2/Soc.h @@ -0,0 +1,376 @@ +/** Soc.h +* Header defining the Base addresses, sizes, flags etc for chassis 1 +* +* 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. +* +**/ + +#ifndef __SOC_H__ +#define __SOC_H__ + +#define HWA_CGA_M1_CLK_SEL 0xe0000000 +#define HWA_CGA_M1_CLK_SHIFT 29 + +#define TP_CLUSTER_EOC_MASK 0xc0000000 /* end of clusters mask */ +#define NUM_CC_PLLS 2 +#define CLK_FREQ 100000000 +#define MAX_CPUS 4 +#define NUM_FMAN 1 +#define CHECK_CLUSTER(Cluster) ((Cluster & TP_CLUSTER_EOC_MASK) =3D=3D = 0x0) + +/* RCW SERDES MACRO */ +#define RCWSR_INDEX 4 +#define RCWSR_SRDS1_PRTCL_MASK 0xffff0000 +#define RCWSR_SRDS1_PRTCL_SHIFT 16 +#define RCWSR_SRDS2_PRTCL_MASK 0x0000ffff +#define RCWSR_SRDS2_PRTCL_SHIFT 0 + +/* SMMU Defintions */ +#define SMMU_BASE_ADDR 0x09000000 +#define SMMU_REG_SCR0 (SMMU_BASE_ADDR + 0x0) +#define SMMU_REG_SACR (SMMU_BASE_ADDR + 0x10) +#define SMMU_REG_IDR1 (SMMU_BASE_ADDR + 0x24) +#define SMMU_REG_NSCR0 (SMMU_BASE_ADDR + 0x400) +#define SMMU_REG_NSACR (SMMU_BASE_ADDR + 0x410) + +#define SCR0_USFCFG_MASK 0x00000400 +#define SCR0_CLIENTPD_MASK 0x00000001 +#define SACR_PAGESIZE_MASK 0x00010000 +#define IDR1_PAGESIZE_MASK 0x80000000 + +typedef struct { + UINTN FreqProcessor[MAX_CPUS]; + UINTN FreqSystemBus; + UINTN FreqDdrBus; + UINTN FreqLocalBus; + UINTN FreqSdhc; + UINTN FreqFman[NUM_FMAN]; + UINTN FreqQman; +} SYS_INFO; + +typedef enum { + ARM_CLK =3D 0, + BUS_CLK, + UART_CLK, + ESDHC_CLK, + I2C_CLK, + DSPI_CLK, +} PERIPHERAL_CLOCK; + +/* Device Configuration and Pin Control */ +typedef struct { + UINT32 PorSr1; /* POR status 1 */ +#define CHASSIS2_CCSR_PORSR1_RCW_MASK 0xFF800000 + UINT32 PorSr2; /* POR status 2 */ + UINT8 Res008[0x20-0x8]; + UINT32 GppOrCr1; /* General-purpose POR configuration */ + UINT32 GppOrCr2; + UINT32 DcfgFuseSr; /* Fuse status register */ + UINT8 Res02c[0x70-0x2c]; + UINT32 DevDisr; /* Device disable control */ + UINT32 DevDisr2; /* Device disable control 2 */ + UINT32 DevDisr3; /* Device disable control 3 */ + UINT32 DevDisr4; /* Device disable control 4 */ + UINT32 DevDisr5; /* Device disable control 5 */ + UINT32 DevDisr6; /* Device disable control 6 */ + UINT32 DevDisr7; /* Device disable control 7 */ + UINT8 Res08c[0x94-0x8c]; + UINT32 CoreDisrU; /* uppper portion for support of 64 cores */ + UINT32 CoreDisrL; /* lower portion for support of 64 cores */ + UINT8 Res09c[0xa0-0x9c]; + UINT32 Pvr; /* Processor version */ + UINT32 Svr; /* System version */ + UINT32 Mvr; /* Manufacturing version */ + UINT8 Res0ac[0xb0-0xac]; + UINT32 RstCr; /* Reset control */ + UINT32 RstRqPblSr; /* Reset request preboot loader status */ + UINT8 Res0b8[0xc0-0xb8]; + UINT32 RstRqMr1; /* Reset request mask */ + UINT8 Res0c4[0xc8-0xc4]; + UINT32 RstRqSr1; /* Reset request status */ + UINT8 Res0cc[0xd4-0xcc]; + UINT32 RstRqWdTmrL; /* Reset request WDT mask */ + UINT8 Res0d8[0xdc-0xd8]; + UINT32 RstRqWdtSrL; /* Reset request WDT status */ + UINT8 Res0e0[0xe4-0xe0]; + UINT32 BrrL; /* Boot release */ + UINT8 Res0e8[0x100-0xe8]; + UINT32 RcwSr[16]; /* Reset control word status */ +#define CHASSIS2_RCWSR0_SYS_PLL_RAT_SHIFT 25 +#define CHASSIS2_RCWSR0_SYS_PLL_RAT_MASK 0x1f +#define CHASSIS2_RCWSR0_MEM_PLL_RAT_SHIFT 16 +#define CHASSIS2_RCWSR0_MEM_PLL_RAT_MASK 0x3f + UINT8 Res140[0x200-0x140]; + UINT32 ScratchRw[4]; /* Scratch Read/Write */ + UINT8 Res210[0x300-0x210]; + UINT32 ScratcHw1R[4]; /* Scratch Read (Write once) */ + UINT8 Res310[0x400-0x310]; + UINT32 CrstSr[12]; + UINT8 Res430[0x500-0x430]; + /* PCI Express n Logical I/O Device Number register */ + UINT32 DcfgCcsrPex1LiodNr; + UINT32 DcfgCcsrPex2LiodNr; + UINT32 DcfgCcsrPex3LiodNr; + UINT32 DcfgCcsrPex4LiodNr; + /* RIO n Logical I/O Device Number register */ + UINT32 DcfgCcsrRio1LiodNr; + UINT32 DcfgCcsrRio2LiodNr; + UINT32 DcfgCcsrRio3LiodNr; + UINT32 DcfgCcsrRio4LiodNr; + /* USB Logical I/O Device Number register */ + UINT32 DcfgCcsrUsb1LiodNr; + UINT32 DcfgCcsrUsb2LiodNr; + UINT32 DcfgCcsrUsb3LiodNr; + UINT32 DcfgCcsrUsb4LiodNr; + /* SD/MMC Logical I/O Device Number register */ + UINT32 DcfgCcsrSdMmc1LiodNr; + UINT32 DcfgCcsrSdMmc2LiodNr; + UINT32 DcfgCcsrSdMmc3LiodNr; + UINT32 DcfgCcsrSdMmc4LiodNr; + /* RIO Message Unit Logical I/O Device Number register */ + UINT32 DcfgCcsrRiomaintLiodNr; + UINT8 Res544[0x550-0x544]; + UINT32 SataLiodNr[4]; + UINT8 Res560[0x570-0x560]; + UINT32 DcfgCcsrMisc1LiodNr; + UINT32 DcfgCcsrMisc2LiodNr; + UINT32 DcfgCcsrMisc3LiodNr; + UINT32 DcfgCcsrMisc4LiodNr; + UINT32 DcfgCcsrDma1LiodNr; + UINT32 DcfgCcsrDma2LiodNr; + UINT32 DcfgCcsrDma3LiodNr; + UINT32 DcfgCcsrDma4LiodNr; + UINT32 DcfgCcsrSpare1LiodNr; + UINT32 DcfgCcsrSpare2LiodNr; + UINT32 DcfgCcsrSpare3LiodNr; + UINT32 DcfgCcsrSpare4LiodNr; + UINT8 Res5a0[0x600-0x5a0]; + UINT32 DcfgCcsrPblSr; + UINT32 PamuBypENr; + UINT32 DmaCr1; + UINT8 Res60c[0x610-0x60c]; + UINT32 DcfgCcsrGenSr1; + UINT32 DcfgCcsrGenSr2; + UINT32 DcfgCcsrGenSr3; + UINT32 DcfgCcsrGenSr4; + UINT32 DcfgCcsrGenCr1; + UINT32 DcfgCcsrGenCr2; + UINT32 DcfgCcsrGenCr3; + UINT32 DcfgCcsrGenCr4; + UINT32 DcfgCcsrGenCr5; + UINT32 DcfgCcsrGenCr6; + UINT32 DcfgCcsrGenCr7; + UINT8 Res63c[0x658-0x63c]; + UINT32 DcfgCcsrcGenSr1; + UINT32 DcfgCcsrcGenSr0; + UINT8 Res660[0x678-0x660]; + UINT32 DcfgCcsrcGenCr1; + UINT32 DcfgCcsrcGenCr0; + UINT8 Res680[0x700-0x680]; + UINT32 DcfgCcsrSrIoPstecr; + UINT32 DcfgCcsrDcsrCr; + UINT8 Res708[0x740-0x708]; /* add more registers when needed */ + UINT32 TpItyp[64]; /* Topology Initiator Type Register */ + struct { + UINT32 Upper; + UINT32 Lower; + } TpCluster[16]; + UINT8 Res8c0[0xa00-0x8c0]; /* add more registers when needed */ + UINT32 DcfgCcsrQmBmWarmRst; + UINT8 Resa04[0xa20-0xa04]; /* add more registers when needed */ + UINT32 DcfgCcsrReserved0; + UINT32 DcfgCcsrReserved1; +} CCSR_GUR; + +/* Supplemental Configuration Unit */ +typedef struct { + UINT8 Res000[0x070-0x000]; + UINT32 Usb1Prm1Cr; + UINT32 Usb1Prm2Cr; + UINT32 Usb1Prm3Cr; + UINT32 Usb2Prm1Cr; + UINT32 Usb2Prm2Cr; + UINT32 Usb2Prm3Cr; + UINT32 Usb3Prm1Cr; + UINT32 Usb3Prm2Cr; + UINT32 Usb3Prm3Cr; + UINT8 Res094[0x100-0x094]; + UINT32 Usb2Icid; + UINT32 Usb3Icid; + UINT8 Res108[0x114-0x108]; + UINT32 DmaIcid; + UINT32 SataIcid; + UINT32 Usb1Icid; + UINT32 QeIcid; + UINT32 SdhcIcid; + UINT32 EdmaIcid; + UINT32 EtrIcid; + UINT32 Core0SftRst; + UINT32 Core1SftRst; + UINT32 Core2SftRst; + UINT32 Core3SftRst; + UINT8 Res140[0x158-0x140]; + UINT32 AltCBar; + UINT32 QspiCfg; + UINT8 Res160[0x180-0x160]; + UINT32 DmaMcr; + UINT8 Res184[0x188-0x184]; + UINT32 GicAlign; + UINT32 DebugIcid; + UINT8 Res190[0x1a4-0x190]; + UINT32 SnpCnfGcr; +#define CCSR_SCFG_SNPCNFGCR_SECRDSNP BIT31 +#define CCSR_SCFG_SNPCNFGCR_SECWRSNP BIT30 +#define CCSR_SCFG_SNPCNFGCR_SATARDSNP BIT23 +#define CCSR_SCFG_SNPCNFGCR_SATAWRSNP BIT22 +#define CCSR_SCFG_SNPCNFGCR_USB1RDSNP BIT21 +#define CCSR_SCFG_SNPCNFGCR_USB1WRSNP BIT20 +#define CCSR_SCFG_SNPCNFGCR_USB2RDSNP BIT15 +#define CCSR_SCFG_SNPCNFGCR_USB2WRSNP BIT16 +#define CCSR_SCFG_SNPCNFGCR_USB3RDSNP BIT13 +#define CCSR_SCFG_SNPCNFGCR_USB3WRSNP BIT14 + UINT8 Res1a8[0x1ac-0x1a8]; + UINT32 IntpCr; + UINT8 Res1b0[0x204-0x1b0]; + UINT32 CoreSrEnCr; + UINT8 Res208[0x220-0x208]; + UINT32 RvBar00; + UINT32 RvBar01; + UINT32 RvBar10; + UINT32 RvBar11; + UINT32 RvBar20; + UINT32 RvBar21; + UINT32 RvBar30; + UINT32 RvBar31; + UINT32 LpmCsr; + UINT8 Res244[0x400-0x244]; + UINT32 QspIdQScr; + UINT32 EcgTxcMcr; + UINT32 SdhcIoVSelCr; + UINT32 RcwPMuxCr0; + /**Setting RCW PinMux Register bits 17-19 to select USB2_DRVVBUS + *Setting RCW PinMux Register bits 21-23 to select USB2_PWRFAULT + *Setting RCW PinMux Register bits 25-27 to select USB3_DRVVBUS + Setting RCW PinMux Register bits 29-31 to select USB3_DRVVBUS*/ +#define CCSR_SCFG_RCWPMUXCRO_SELCR_USB 0x3333 + /**Setting RCW PinMux Register bits 17-19 to select USB2_DRVVBUS + *Setting RCW PinMux Register bits 21-23 to select USB2_PWRFAULT + *Setting RCW PinMux Register bits 25-27 to select IIC4_SCL + Setting RCW PinMux Register bits 29-31 to select IIC4_SDA*/ +#define CCSR_SCFG_RCWPMUXCRO_NOT_SELCR_USB 0x3300 + UINT32 UsbDrvVBusSelCr; +#define CCSR_SCFG_USBDRVVBUS_SELCR_USB1 0x00000000 +#define CCSR_SCFG_USBDRVVBUS_SELCR_USB2 0x00000001 +#define CCSR_SCFG_USBDRVVBUS_SELCR_USB3 0x00000003 + UINT32 UsbPwrFaultSelCr; +#define CCSR_SCFG_USBPWRFAULT_INACTIVE 0x00000000 +#define CCSR_SCFG_USBPWRFAULT_SHARED 0x00000001 +#define CCSR_SCFG_USBPWRFAULT_DEDICATED 0x00000002 +#define CCSR_SCFG_USBPWRFAULT_USB3_SHIFT 4 +#define CCSR_SCFG_USBPWRFAULT_USB2_SHIFT 2 +#define CCSR_SCFG_USBPWRFAULT_USB1_SHIFT 0 + UINT32 UsbRefclkSelcr1; + UINT32 UsbRefclkSelcr2; + UINT32 UsbRefclkSelcr3; + UINT8 Res424[0x600-0x424]; + UINT32 ScratchRw[4]; + UINT8 Res610[0x680-0x610]; + UINT32 CoreBCr; + UINT8 Res684[0x1000-0x684]; + UINT32 Pex1MsiIr; + UINT32 Pex1MsiR; + UINT8 Res1008[0x2000-0x1008]; + UINT32 Pex2; + UINT32 Pex2MsiR; + UINT8 Res2008[0x3000-0x2008]; + UINT32 Pex3MsiIr; + UINT32 Pex3MsiR; +} CCSR_SCFG; + +#define USB_TXVREFTUNE 0x9 +#define USB_SQRXTUNE 0xFC7FFFFF +#define USB_PCSTXSWINGFULL 0x47 +#define USB_PHY_RX_EQ_VAL_1 0x0000 +#define USB_PHY_RX_EQ_VAL_2 0x8000 +#define USB_PHY_RX_EQ_VAL_3 0x8003 +#define USB_PHY_RX_EQ_VAL_4 0x800b + +/*USB_PHY_SS memory map*/ +typedef struct { + UINT16 IpIdcodeLo; + UINT16 SupIdcodeHi; + UINT8 Res4[0x0006-0x0004]; + UINT16 RtuneDebug; + UINT16 RtuneStat; + UINT16 SupSsPhase; + UINT16 SsFreq; + UINT8 ResE[0x0020-0x000e]; + UINT16 Ateovrd; + UINT16 MpllOvrdInLo; + UINT8 Res24[0x0026-0x0024]; + UINT16 SscOvrdIn; + UINT8 Res28[0x002A-0x0028]; + UINT16 LevelOvrdIn; + UINT8 Res2C[0x0044-0x002C]; + UINT16 ScopeCount; + UINT8 Res46[0x0060-0x0046]; + UINT16 MpllLoopCtl; + UINT8 Res62[0x006C-0x0062]; + UINT16 SscClkCntrl; + UINT8 Res6E[0x2002-0x006E]; + UINT16 Lane0TxOvrdInHi; + UINT16 Lane0TxOvrdDrvLo; + UINT8 Res2006[0x200C-0x2006]; + UINT16 Lane0RxOvrdInHi; + UINT8 Res200E[0x2022-0x200E]; + UINT16 Lane0TxCmWaitTimeOvrd; + UINT8 Res2024[0x202A-0x2024]; + UINT16 Lane0TxLbertCtl; + UINT16 Lane0RxLbertCtl; + UINT16 Lane0RxLbertErr; + UINT8 Res2030[0x205A-0x2030]; + UINT16 Lane0TxAltBlock; +} CCSR_USB_PHY; + +/* Clocking */ +typedef struct { + struct { + UINT32 ClkCnCSr; /* core cluster n clock control status */ + UINT8 Res004[0x0c]; + UINT32 ClkcGHwAcSr; /* Clock generator n hardware accelerator */ + UINT8 Res014[0x0c]; + } ClkcSr[4]; + UINT8 Res040[0x780]; /* 0x100 */ + struct { + UINT32 PllCnGSr; + UINT8 Res804[0x1c]; + } PllCgSr[2]; + UINT8 Res840[0x1c0]; + UINT32 ClkPCSr; /* 0xa00 Platform clock domain control/status */ + UINT8 Resa04[0x1fc]; + UINT32 PllPGSr; /* 0xc00 Platform PLL General Status */ + UINT8 Resc04[0x1c]; + UINT32 PllDGSr; /* 0xc20 DDR PLL General Status */ + UINT8 Resc24[0x3dc]; +} CCSR_CLOCK; + +VOID +GetSysInfo ( + OUT SYS_INFO * + ); + +UINT32 +EFIAPI +GurRead ( + IN UINTN Address + ); + +#endif /* __SOC_H__ */ diff --git a/Silicon/NXP/Chassis/LS1043aSocLib.inf b/Silicon/NXP/Chassis/LS= 1043aSocLib.inf new file mode 100644 index 0000000..c914b27 --- /dev/null +++ b/Silicon/NXP/Chassis/LS1043aSocLib.inf @@ -0,0 +1,48 @@ +# @file +# +# 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 SocLib + FILE_GUID =3D 736343a0-1d96-11e0-aaaa-0002a5d5c51b + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D SocLib + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + edk2-platforms/Platform/NXP/NxpQoriqLs.dec + edk2-platforms/Silicon/NXP/Chassis/Chassis2/Chassis2.dec + edk2-platforms/Silicon/NXP/LS1043A/LS1043A.dec + +[LibraryClasses] + BaseLib + BeIoLib + DebugLib + SerialPortLib + UtilsLib + +[Sources.common] + Chassis.c + Chassis2/Soc.c + SerDes.c + +[FixedPcd] + gEfiMdeModulePkgTokenSpaceGuid.PcdFirmwareVersionString + gNxpQoriqLsTokenSpaceGuid.PcdGutsBaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdPlatformFreqDiv + gNxpQoriqLsTokenSpaceGuid.PcdSerdes2Enabled + gNxpQoriqLsTokenSpaceGuid.PcdGurBigEndian + gNxpQoriqLsTokenSpaceGuid.PcdClkBaseAddr diff --git a/Silicon/NXP/Chassis/SerDes.c b/Silicon/NXP/Chassis/SerDes.c new file mode 100644 index 0000000..28d9847 --- /dev/null +++ b/Silicon/NXP/Chassis/SerDes.c @@ -0,0 +1,253 @@ +/** SerDes.c + Provides the basic interfaces for SerDes Module + + 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 be= found + 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 +#include +#include +#include + +UINT64 *SerDesPrtclMap; + +/** + Function to get serdes Lane protocol corresponding to + serdes protocol. + + @param SerDes Serdes number. + @param Cfg Serdes Protocol. + @param Lane Serdes Lane number. + + @return Serdes Lane protocol. + +**/ +SERDES_PROTOCOL +GetSerDesPrtcl ( + IN INTN SerDes, + IN INTN Cfg, + IN INTN Lane + ) +{ + SERDES_CONFIG *Config; + + if (SerDes >=3D ARRAY_SIZE(SerDesConfigTbl)) { + return 0; + } + + Config =3D SerDesConfigTbl[SerDes]; + while (Config->Protocol) { + if (Config->Protocol =3D=3D Cfg) { + return Config->SrdsLane[Lane]; + } + Config++; + } + + return EFI_SUCCESS; +} + +/** + Function to check if inputted protocol is a valid serdes protocol. + + @param SerDes Serdes number. + @param Prtcl Serdes Protocol to be verified. + + @return EFI_INVALID_PARAMETER Input parameter in invalid. + @return EFI_NOT_FOUND Serdes Protocol not a valid protocol. + @return EFI_SUCCESS Serdes Protocol is a valid protocol. + +**/ +EFI_STATUS +CheckSerDesPrtclValid ( + IN INTN SerDes, + IN UINT32 Prtcl + ) +{ + SERDES_CONFIG *Config; + INTN Cnt; + + if (SerDes >=3D ARRAY_SIZE(SerDesConfigTbl)) { + return EFI_INVALID_PARAMETER; + } + + Config =3D SerDesConfigTbl[SerDes]; + while (Config->Protocol) { + if (Config->Protocol =3D=3D Prtcl) { + DEBUG((DEBUG_INFO, "Protocol: %x Matched with the one in Table\n", P= rtcl)); + break; + } + Config++; + } + + if (!Config->Protocol) { + return EFI_NOT_FOUND; + } + + for (Cnt =3D 0; Cnt < SRDS_MAX_LANES; Cnt++) { + if (Config->SrdsLane[Cnt] !=3D NONE) { + return EFI_SUCCESS; + } + } + + return EFI_NOT_FOUND; +} + +/** + Function to fill serdes map information. + + @param Srds Serdes number. + @param SERDES_PROTOCOLMask Serdes Protocol Mask. + @param SERDES_PROTOCOLShift Serdes Protocol shift value. + @param SerDesPrtclMap Pointer to Serdes Protocol map. + +**/ +VOID +LSSerDesMap ( + IN UINT32 Srds, + IN UINT32 SERDES_PROTOCOLMask, + IN UINT32 SERDES_PROTOCOLShift, + OUT UINT64 *SerDesPrtclMap + ) +{ + CCSR_GUR *Gur; + UINT32 SrdsProt; + INTN Lane; + UINT32 Flag; + + Gur =3D (VOID *)PcdGet64(PcdGutsBaseAddr); + *SerDesPrtclMap =3D 0x0; + Flag =3D 0; + + SrdsProt =3D GurRead((UINTN)&Gur->RcwSr[RCWSR_INDEX]) & SERDES_PROTOCOLM= ask; + SrdsProt >>=3D SERDES_PROTOCOLShift; + + DEBUG((DEBUG_INFO, "Using SERDES%d Protocol: %d (0x%x)\n", + Srds + 1, SrdsProt, SrdsProt)); + + if (EFI_SUCCESS !=3D CheckSerDesPrtclValid(Srds, SrdsProt)) { + DEBUG((DEBUG_ERROR, "SERDES%d[PRTCL] =3D 0x%x is not valid\n", + Srds + 1, SrdsProt)); + Flag++; + } + + for (Lane =3D 0; Lane < SRDS_MAX_LANES; Lane++) { + SERDES_PROTOCOL LanePrtcl =3D GetSerDesPrtcl(Srds, SrdsProt, Lane); + if (LanePrtcl >=3D SERDES_PRTCL_COUNT) { + DEBUG((DEBUG_ERROR, "Unknown SerDes lane protocol %d\n", LanePrtcl)); + Flag++; + } else { + *SerDesPrtclMap |=3D BIT(LanePrtcl); + } + } + + if (Flag) { + DEBUG((DEBUG_ERROR, "Could not configure SerDes module!!\n")); + } else { + DEBUG((DEBUG_INFO, "Successfully configured SerDes module!!\n")); + } +} + +STATIC +VOID +SerDesInstanceProbeLanes ( + IN UINT32 Srds, + IN UINT32 SERDES_PROTOCOLMask, + IN UINT32 SERDES_PROTOCOLShift, + IN SERDES_PROBE_LANES_CALLBACK *SerDesLaneProbeCallback, + IN VOID *Arg + ) +{ + + CCSR_GUR *Gur; + UINT32 SrdsProt; + INTN Lane; + + Gur =3D (VOID *)PcdGet64(PcdGutsBaseAddr);; + + SrdsProt =3D GurRead((UINTN)&Gur->RcwSr[RCWSR_INDEX]) & SERDES_PROTOCOLM= ask; + SrdsProt >>=3D SERDES_PROTOCOLShift; + + /* + * Invoke callback for all lanes in the SerDes instance: + */ + for (Lane =3D 0; Lane < SRDS_MAX_LANES; Lane++) { + SERDES_PROTOCOL LanePrtcl =3D GetSerDesPrtcl(Srds, SrdsProt, Lane); + if (LanePrtcl >=3D SERDES_PRTCL_COUNT || LanePrtcl < NONE) { + DEBUG((DEBUG_ERROR, "Unknown SerDes lane protocol %d\n", LanePrtcl)); + } + else if (LanePrtcl !=3D NONE) { + SerDesLaneProbeCallback(LanePrtcl, Arg); + } + } +} + +VOID +SerDesProbeLanes ( + IN SERDES_PROBE_LANES_CALLBACK *SerDesLaneProbeCallback, + IN VOID *Arg + ) +{ + SerDesInstanceProbeLanes(SRDS_1, + RCWSR_SRDS1_PRTCL_MASK, + RCWSR_SRDS1_PRTCL_SHIFT, + SerDesLaneProbeCallback, + Arg); + + if (PcdGetBool(PcdSerdes2Enabled)) { + SerDesInstanceProbeLanes(SRDS_2, + RCWSR_SRDS2_PRTCL_MASK, + RCWSR_SRDS2_PRTCL_SHIFT, + SerDesLaneProbeCallback, + Arg); + } +} + +/** + Function to return Serdes protocol map for all serdes available on board. + + @param SerDesPrtclMap Pointer to Serdes protocl map. + +**/ +VOID +GetSerdesProtocolMaps ( + OUT UINT64 *SerDesPrtclMap + ) +{ + LSSerDesMap(SRDS_1, + RCWSR_SRDS1_PRTCL_MASK, + RCWSR_SRDS1_PRTCL_SHIFT, + SerDesPrtclMap); + + if (PcdGetBool(PcdSerdes2Enabled)) { + LSSerDesMap(SRDS_2, + RCWSR_SRDS2_PRTCL_MASK, + RCWSR_SRDS2_PRTCL_SHIFT, + SerDesPrtclMap); + } + +} + +BOOLEAN +IsSerDesLaneProtocolConfigured ( + IN UINT64 SerDesPrtclMap, + IN SERDES_PROTOCOL Device + ) +{ + if (Device >=3D SERDES_PRTCL_COUNT || Device < NONE) { + ASSERT(Device > NONE && Device < SERDES_PRTCL_COUNT); + DEBUG((DEBUG_ERROR, "Unknown SerDes lane protocol Device %d\n", Device= )); + } + + return (SerDesPrtclMap & BIT(Device)) !=3D 0 ; +} diff --git a/Silicon/NXP/LS1043A/Include/SocSerDes.h b/Silicon/NXP/LS1043A/= Include/SocSerDes.h new file mode 100644 index 0000000..90e165f --- /dev/null +++ b/Silicon/NXP/LS1043A/Include/SocSerDes.h @@ -0,0 +1,55 @@ +/** @file + The Header file of SerDes Module for LS1043A + + 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 + 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 IMPL= IED. + +**/ + +#ifndef __SOC_SERDES_H__ +#define __SOC_SERDES_H__ + +#include + +SERDES_CONFIG SerDes1ConfigTbl[] =3D { + /* SerDes 1 */ + {0x1555, {XFI_FM1_MAC9, PCIE1, PCIE2, PCIE3 } }, + {0x2555, {SGMII_2500_FM1_DTSEC9, PCIE1, PCIE2, PCIE3 } }, + {0x4555, {QSGMII_FM1_A, PCIE1, PCIE2, PCIE3 } }, + {0x4558, {QSGMII_FM1_A, PCIE1, PCIE2, SATA } }, + {0x1355, {XFI_FM1_MAC9, SGMII_FM1_DTSEC2, PCIE2, PCIE3 } }, + {0x2355, {SGMII_2500_FM1_DTSEC9, SGMII_FM1_DTSEC2, PCIE2, PCIE3 } }, + {0x3335, {SGMII_FM1_DTSEC9, SGMII_FM1_DTSEC2, SGMII_FM1_DTSEC5, PCIE3 } = }, + {0x3355, {SGMII_FM1_DTSEC9, SGMII_FM1_DTSEC2, PCIE2, PCIE3 } }, + {0x3358, {SGMII_FM1_DTSEC9, SGMII_FM1_DTSEC2, PCIE2, SATA } }, + {0x3555, {SGMII_FM1_DTSEC9, PCIE1, PCIE2, PCIE3 } }, + {0x3558, {SGMII_FM1_DTSEC9, PCIE1, PCIE2, SATA } }, + {0x7000, {PCIE1, PCIE1, PCIE1, PCIE1 } }, + {0x9998, {PCIE1, PCIE2, PCIE3, SATA } }, + {0x6058, {PCIE1, PCIE1, PCIE2, SATA } }, + {0x1455, {XFI_FM1_MAC9, QSGMII_FM1_A, PCIE2, PCIE3 } }, + {0x2455, {SGMII_2500_FM1_DTSEC9, QSGMII_FM1_A, PCIE2, PCIE3 } }, + {0x2255, {SGMII_2500_FM1_DTSEC9, SGMII_2500_FM1_DTSEC2, PCIE2, PCIE3 } }, + {0x3333, {SGMII_FM1_DTSEC9, SGMII_FM1_DTSEC2, SGMII_FM1_DTSEC5, SGMII_FM= 1_DTSEC6 } }, + {0x1460, {XFI_FM1_MAC9, QSGMII_FM1_A, PCIE3, PCIE3 } }, + {0x2460, {SGMII_2500_FM1_DTSEC9, QSGMII_FM1_A, PCIE3, PCIE3 } }, + {0x3460, {SGMII_FM1_DTSEC9, QSGMII_FM1_A, PCIE3, PCIE3 } }, + {0x3455, {SGMII_FM1_DTSEC9, QSGMII_FM1_A, PCIE2, PCIE3 } }, + {0x9960, {PCIE1, PCIE2, PCIE3, PCIE3 } }, + {0x2233, {SGMII_2500_FM1_DTSEC9, SGMII_FM1_DTSEC2, SGMII_FM1_DTSEC5, SGM= II_FM1_DTSEC6 } }, + {0x2533, {SGMII_2500_FM1_DTSEC9, PCIE1, SGMII_FM1_DTSEC5, SGMII_FM1_DTSE= C6 } }, + {} +}; + +SERDES_CONFIG *SerDesConfigTbl[] =3D { + SerDes1ConfigTbl +}; + +#endif /* __SOC_SERDES_H */ --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Wed Dec 25 02:35:00 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 1510044898482610.6987676083222; Tue, 7 Nov 2017 00:54:58 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 7667921C913AB; Tue, 7 Nov 2017 00:50:56 -0800 (PST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0074.outbound.protection.outlook.com [104.47.36.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 71BFF2034D82D for ; Tue, 7 Nov 2017 00:50:54 -0800 (PST) Received: from BN3PR03CA0067.namprd03.prod.outlook.com (10.167.1.155) by BN3PR03MB2353.namprd03.prod.outlook.com (10.166.74.148) 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:51 +0000 Received: from BN1AFFO11FD027.protection.gbl (2a01:111:f400:7c10::160) by BN3PR03CA0067.outlook.office365.com (2a01:111:e400:7a4d::27) 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:51 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD027.mail.protection.outlook.com (10.58.52.87) 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:51 +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 vA78s4Dh009319; Tue, 7 Nov 2017 01:54:48 -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.36.74; helo=nam02-sn1-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:16 +0530 Message-ID: <1510065736-9394-11-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: 131545184917887265; (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)(346002)(376002)(39380400002)(39860400002)(2980300002)(1110001)(1109001)(339900001)(199003)(174874002)(189002)(85426001)(33646002)(106466001)(104016004)(305945005)(356003)(2906002)(50986999)(76176999)(105606002)(53376002)(966005)(4326008)(36756003)(5890100001)(16200700003)(53936002)(5660300001)(47776003)(498600001)(8656006)(189998001)(16799955002)(53946003)(15188155005)(2950100002)(6306002)(6666003)(5003940100001)(2201001)(16586007)(110136005)(68736007)(86362001)(575784001)(50466002)(54906003)(48376002)(77096006)(8676002)(97736004)(561924002)(50226002)(316002)(81156014)(81166006)(8936002)(579004)(559001)(569006); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2353; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD027; 1:NXcZKAS0RBOGUnF6NWNIxy3uMDJftfDCrEgH0yk64VOnwAgfFN6GZP47ajvojGyTtGUEL/cyM9b4bOo256OvuZWyYbgEOOmP7544YO9BScw0OCg65YxUUICZrXRjAfEH MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7e497901-a6b4-4e9c-9921-08d525bd3568 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4628075)(201703131517081)(2017052603199); SRVR:BN3PR03MB2353; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2353; 3:ppoo1KxzmCilYfmSsBXgfAeKqOTpZ4RA8YAPP8IioX/7xHW+N1DTeCQg8nD/hvzqGXXFebaTXxDaXNJvpTRQztu+xrswOBSJHHbkBURUnj/a1p1W2LQivLThiZnwaqNJQtUqZC1hmNFpWCe0f0/16Bo6osXCE+PHKHA5Bx8+jcNTOAwAlRR1JAmo2CnXLn+R8ugXOWoOCPC336Z1/NQc935Elymm3+jaZbsKBW77hi7kMMPbPbdnwvRiZYrQi4eGRdQzDdcvfyL46RgD4/fZSQcirfqPOBIz46UoXMRjPh2+nBLhKOIEB3T7LyNK5kQp7IC+C4cBe+Vo8eNcXT2CRXRbdzTK6k5BtInU6HWg2/o=; 25:mfW69oAl0cU4iOdbJJFKUb2inAE/qGcY3F6mKVQSWpj33NqBLBudqfPvBKigeuQu5oldFU3A2PGVmb/ZY4fnEZXdnZ6m4mBiboJGeyhU8jNtSIA9DfEZgaY1uuVX5P4Rqqajpojvoh4DmD/cADMTOb0+1xQvDPaAFDezpfvpETfWQbe1tbCEQ7K6G+Tn12Y8XS6Bgle+sUYwGAgMEdzKH5CiMQfUd87rfOkItt1ez37AtNCUBbeOervGYcgxeu3o8x9JW1+PLV0f2gOaRTesvclThFyzJwYowu/9ufVlHMMRPEoqNs2rjP3mhVvpEkcT1Z6GdSvDcQe3Xkf0+wAbTw== X-MS-TrafficTypeDiagnostic: BN3PR03MB2353: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2353; 31:8+xoKOGmj/c0LqPR4xmr59EZIO+Ypenqm/hCeo7p9Com42LlM7lMlz6+DNnAhvfOOZAJjEyfqKEnJz+83prdhOFtl0wCw150sGpat3vLyYWLANm7voB7jde9wxaS7lZJ0PkORv7Xgpx5pR1oHlaaEecRzfXbxJAffvjTjZ0a+sPapAFcZiEPMwwdjVbEJhGaEyIfMx1I9umlD8TcXyeQ+oYoN4j/UYbROFnPjLTIaC4=; 4:KGCavXvgRuTYEiBT1Gni00hMuYyGR9oKHDYaMtqRCp6eQ4MRd+0JSZiS9eCsGth9/mCNfcHeUvQ6fDzfUDmCchjMI4Y9E7beHKKBFwR50BcK/o8TiZ8cNLhJCwncKfbrFIgs+BgHJfByavNH7kd2EtVBT1wo4El8IhftBRl97OICQPBOu9/wn7kAaM3Stqp1sraWPJbw9dOcsJqC/Wi+IWAissG8+zQHHYXDO04ky/bSJbRuSQc+s2K8bXwUlLxWg/ypSgeswBn/wTr/UBh3KouujNu+Xsmd27BQFguqTJf2lGRuAI2pG/Qn9iLucuIrKz1PkehLzTapFL+/nXBqh/tXNfUDDmZwXz1EIcTT8Tg= X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(111885846020525); 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)(10201501046)(3002001)(3231021)(93006095)(93001095)(100000703101)(100105400095)(6055026)(6096035)(20161123563025)(20161123556025)(20161123565025)(20161123559100)(201703131430075)(201703131433075)(201703131441075)(201703131448075)(201703161259150)(20161123561025)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BN3PR03MB2353; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BN3PR03MB2353; X-Forefront-PRVS: 0484063412 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR03MB2353; 23:ySqP/zpCgCbdTF/vV6CNHVBRdMAKB310p1adl+fua?= =?us-ascii?Q?ykPeMYV45xBc554fDu6sEWuL6HbE37HQthdC3KQjD6ZeibW6iE38Wgugk+7m?= =?us-ascii?Q?Gw/Euuyci2Zw9zgRG0vg9jljIlDAD08F4Uuqz86XD6L4Jth2cn02t5X0T3Ax?= =?us-ascii?Q?9rgkOhyGE4pfwZg9E/qW4JJWl7UjQwNDacIsNna/Wp+Jfoq7wrVv8CVkn1NG?= =?us-ascii?Q?ZSYr7gjldGhvcrwIh28xJYxu8bsJy9VeYCzIqIqTD/82SHsgPR2UqNChvdzk?= =?us-ascii?Q?9vqnLhEQq41dX0aCQBpJEqgg8aXNk6YsmnFWandEZUYmCspsm5F0HLEvp3QN?= =?us-ascii?Q?ZRxU96m9mOM3MTUlRkobaYr/yPTPbnEmkBGeXh2Sv8XVrty00Hbm6okauBIS?= =?us-ascii?Q?g+f9NBH7nFmuKZUNrY73m9Qn0nCXNo7h027//hOlRx1xdQI2jtvQSk/PzZe9?= =?us-ascii?Q?J10ie93YKzF2rcs9DJEQ09RSr3LpYZmHjmMEINdH8ABeTnx5k147kCjD61EL?= =?us-ascii?Q?D+7ME2LcflB5GN+hBwYsHnlSTL/+jGDbTNqlhu2GPP+ATT8AUxAWQtbCh5St?= =?us-ascii?Q?sXuX9wQA98DYBprs2KHck108LmxRwiQDSh/AWvheJv1Arp17r3NGQzf7/p1S?= =?us-ascii?Q?JoyWsUclTfsbIv0/sOluDad8mc5NRxTKsa3q/DL7fvAiJKlEft5k+Tp6Az5R?= =?us-ascii?Q?d42dE5mR08WmGPO2BKwj4mhnu30b+i+dPQUJW99znpJ7TT7GWuNhbUhNsF/n?= =?us-ascii?Q?d0p34QuYCQ3afp/0fI55sVVI8A76ec+jKgbog+EAT523xVC13QV1ljnSerQY?= =?us-ascii?Q?szMk4pPiT6kb/c1XFS1pFPxBG3VyST93+Ur6dCilPzmBbP77j8fCZDbfLs7j?= =?us-ascii?Q?sYB8/p3RaPS8inmS71++uwghGctcz8HPJFpLGXPyv6QRepG4+BuNeqVDYJhJ?= =?us-ascii?Q?3Xtc9DvT7puYmvmMlJAlPfUxRpLThOyn/Vt8G0qQi6KTJ3+EGzNay1Z+zmzw?= =?us-ascii?Q?3WI4xS1Lca11O7ywvUMowjNE1zVRyuEzEcXj450O2+ithXSMWh+ttdku1+QB?= =?us-ascii?Q?2jlBXOJVebEv4hNwMM4qG8KkrDlST53mAvY3VhlyOXcHHLhXtyeKmoq6zpGr?= =?us-ascii?Q?kHhVYP2d6uylrKhv2Jn+Gi3+8H1ZM6Yn6GhZA7hJuWddq+kRyYQtjHMa62ph?= =?us-ascii?Q?VD0hdsCR9U2Tu32u2wAF7GS9a6bPbuc6Nwg+hdB0aQkMYrdKGM9oDunHhf/k?= =?us-ascii?Q?fHCSqom6J7KP0VStzYRrBZn+qA67WkhUtEaraifr7H5OBPknIJO3mKQUudRJ?= =?us-ascii?Q?0KBssjWHHmE2ZkRiStI2pgImiEf8x4jwb/h01X+tkTOGBy/MatDwYycaGLOt?= =?us-ascii?Q?Dq5vCEjq6MdsuZoWvPANJwYJNRkibOXHR8m/hCvODakOJOhBWQHyGu3N84DG?= =?us-ascii?Q?/uoJEEoXvTvRNDn0dd7W+uhRhlC8hNV1NhjS7I/Z/RXmnnPLO800xJOdPSP6?= =?us-ascii?Q?hbRofVVwFaYLQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2353; 6:1E3JkrMxEQ49+yq5IRWYaFnj6w3bOKY6hFWhODJVO38bciPFgDIQwZna8CzhTcG7lw8YTfVOZaN4gwk5KtgY4Yyjx8qQ830XwO+qmwRAqaX7h3ofL48g19xloDeogY9ZsSTP4f83SZPEuNqZpP4+xMUSCDNGXM18eJT6qGgqLI6fWKI1Hnfqjxa5+/mIeIknkQGuDatwOgJdOKHhSG4lMDtP/7QbBzKGtF/fcpK5aY/FfzpzuRUVDwqRlkQgIqYSGaj9qMZ0wxMgRJ9pvOOL3gBkgNvsfJsxKCwH/jEZc21xfnUDN1l6pEDNwJ0YCuLm5797jFiv6HiZ5kKxB60u0ZLwaOFB4mHHLd99qdKhJjY=; 5:Hf5QfWVRoFDst0XQbKBM2dO3+wpYFCcXSxtzz0aDTrh4lJB5yENaRSZsOIyIL5yN6wIpl2FSBoKIFev3X6mR32smIoDu1gQk+BGEq1NnBxW5Tq7G4YP2PMU6deDh8l2ZjtlpSBe8ckzCeQM1HLlZWQQOQNUSGBXwBDiFNJ1bSmA=; 24:5BhAwIGzNi2uFghEFbw5yJlapUIOUYVsPRaddSwcm9xRcCHRK59h5YsShKASCXLnYs1aUHZBd4EfxVbhQVEsozAaVlEBtlqx/0fA9eLoCEE=; 7:lh9yVHodsIu0m2zejh14Fn4U2tXtvIdkOT6zeE+YuvOD0Mnkubzmsayv57lnd2ccR+k66GILDsCV4D23QnEAt+lrt3827RVNHFIPItxxnmAPoo5iunTXQUNCmPJULhmqo26/N6xsuPbj2TaSnpZQjGd0aSGpJkrUnVZqGZVZiY/bT+FXv7iyixlo99pNOLONmRuyiOOxfM7EV0+vsuEiWYpJBe334YBdkX262s7YXcvgU/RCrhEGC9jDAmyPCR4V SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Nov 2017 08:54:51.6171 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e497901-a6b4-4e9c-9921-08d525bd3568 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: BN3PR03MB2353 Subject: [edk2] [PATCH 10/10] Compilation : Add the fdf, dsc and dec files. 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" The firware device, description and declaration files. Build script and Environment setup script. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- Platform/NXP/Env.cshrc | 75 +++++ Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dec | 29 ++ Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dsc | 74 +++++ Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.fdf | 279 +++++++++++++++++ Platform/NXP/NxpQoriqLs.dec | 257 +++++++++++++++ Platform/NXP/NxpQoriqLs.dsc | 453 +++++++++++++++++++++++= ++++ Platform/NXP/Readme.md | 14 + Platform/NXP/build.sh | 100 ++++++ Silicon/NXP/Chassis/Chassis2/Chassis2.dec | 19 ++ Silicon/NXP/LS1043A/LS1043A.dec | 22 ++ Silicon/NXP/LS1043A/LS1043A.dsc | 82 +++++ 11 files changed, 1404 insertions(+) create mode 100644 Platform/NXP/Env.cshrc create mode 100644 Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dec create mode 100644 Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dsc create mode 100644 Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.fdf create mode 100644 Platform/NXP/NxpQoriqLs.dec create mode 100644 Platform/NXP/NxpQoriqLs.dsc create mode 100644 Platform/NXP/Readme.md create mode 100755 Platform/NXP/build.sh create mode 100644 Silicon/NXP/Chassis/Chassis2/Chassis2.dec create mode 100644 Silicon/NXP/LS1043A/LS1043A.dec create mode 100644 Silicon/NXP/LS1043A/LS1043A.dsc diff --git a/Platform/NXP/Env.cshrc b/Platform/NXP/Env.cshrc new file mode 100644 index 0000000..9b7f261 --- /dev/null +++ b/Platform/NXP/Env.cshrc @@ -0,0 +1,75 @@ +# @file. +# +# Copyright 2017 NXP +# +# This program and the accompanying materials are licensed and made avail= able under +# the terms and conditions of the BSD License which accompanies this dist= ribution. +# 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. +# +# + +unset GCC_UTILITY GCC_VERSION MajorVersion MinorVersion + +if [ X"$CROSS_COMPILE_64" !=3D X"" ]; then + ARM64_PREFIX=3D"$CROSS_COMPILE_64" +elif [ X"$CROSS_COMPILE" !=3D X"" ]; then + ARM64_PREFIX=3D"$CROSS_COMPILE" +else + ARM64_PREFIX=3D"aarch64-linux-gnu-" +fi + +GCC_UTILITY=3D"${ARM64_PREFIX}gcc" +CheckGcc=3D`which $GCC_UTILITY >/dev/null 2>&1` +if [ "$?" -eq 0 ];then + GCC_VERSION=3D`$GCC_UTILITY -v 2>&1 | tail -n 1 | awk '{print $3}'` + MajorVersion=3D`echo $GCC_VERSION | cut -d . -f 1` + MinorVersion=3D`echo $GCC_VERSION | cut -d . -f 2` + GCC_ARCH_PREFIX=3D + NOTSUPPORTED=3D0 + + case $MajorVersion in + 4) + case $MinorVersion in + 9) + GCC_ARCH_PREFIX=3D"GCC49_AARCH64_PREFIX" + ;; + *) + NOTSUPPORTED=3D1 + ;; + esac + ;; + 5) + case $MinorVersion in + 4) + GCC_ARCH_PREFIX=3D"GCC5_AARCH64_PREFIX" + ;; + *) + GCC_ARCH_PREFIX=3D"GCC5_AARCH64_PREFIX" + echo "Warning: ${GCC_UTILITY} version ($MajorVersion.$MinorVersion= ) has not been tested, please use at own risk." + ;; + esac + ;; + *) + NOTSUPPORTED=3D1 + ;; + esac + + [ "$NOTSUPPORTED" -eq 1 ] && { + echo "Error: ${GCC_UTILITY} version ($MajorVersion.$MinorVersion) no= t supported ." + unset GCC_UTILITY GCC_VERSION MajorVersion MinorVersion + } + + [ -n "$GCC_ARCH_PREFIX" ] && { + export GCC_ARCH_PREFIX=3D"$GCC_ARCH_PREFIX" + export "$GCC_ARCH_PREFIX=3D$ARM64_PREFIX" + } + + unset ARCH +else + echo "Error: ${GCC_UTILITY} not found. Please check PATH variable." + unset GCC_UTILITY GCC_VERSION MajorVersion MinorVersion +fi diff --git a/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dec b/Platform/NXP/LS= 1043aRdbPkg/LS1043aRdbPkg.dec new file mode 100644 index 0000000..1b639e2 --- /dev/null +++ b/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dec @@ -0,0 +1,29 @@ +# LS1043aRdbPkg.dec +# LS1043a board package. +# +# Copyright 2017 NXP +# +# This program and the accompanying materials are licensed and made avail= able under +# the terms and conditions of the BSD License which accompanies this dist= ribution. +# 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] + PACKAGE_NAME =3D LS1043aRdbPkg + PACKAGE_GUID =3D 6eba6648-d853-4eb3-9761-528b82d5ab04 + +##########################################################################= ###### +# +# Include Section - list of Include Paths that are provided by this packag= e. +# Comments are used for Keywords and Module Types. +# +# Supported Module Types: +# BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER DXE_SMM_D= RIVER DXE_SAL_DRIVER UEFI_DRIVER UEFI_APPLICATION +# +##########################################################################= ###### +[Includes.common] + Include # Root include for the package diff --git a/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dsc b/Platform/NXP/LS= 1043aRdbPkg/LS1043aRdbPkg.dsc new file mode 100644 index 0000000..9a6cf1c --- /dev/null +++ b/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dsc @@ -0,0 +1,74 @@ +# LS1043aRdbPkg.dsc +# +# LS1043ARDB Board package. +# +# 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 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 IM= PLIED. +# + +##########################################################################= ###### +# +# Defines Section - statements that will be processed to create a Makefile. +# +##########################################################################= ###### +[Defines] + # + # Defines for default states. These can be changed on the command line. + # -D FLAG=3DVALUE + # + PLATFORM_NAME =3D LS1043aRdbPkg + PLATFORM_GUID =3D 60169ec4-d2b4-44f8-825e-f8684fd42e4f + OUTPUT_DIRECTORY =3D Build/LS1043aRdbPkg + FLASH_DEFINITION =3D edk2-platforms/Platform/NXP/LS1043aRd= bPkg/LS1043aRdbPkg.fdf + +!include ../NxpQoriqLs.dsc +!include ../../../Silicon/NXP/LS1043A/LS1043A.dsc + +[LibraryClasses.common] + ArmPlatformLib|edk2-platforms/Platform/NXP/LS1043aRdbPkg/Library/Platfor= mLib/ArmPlatformLib.inf + EfiResetSystemLib|edk2-platforms/Platform/NXP/Library/ResetSystemLib/Res= etSystemLib.inf + I2cLib|edk2-platforms/Platform/NXP/Library/I2cLib/I2cLib.inf + SerialPortLib|edk2-platforms/Platform/NXP/Library/DUartPortLib/DUartPort= Lib.inf + BeIoLib|edk2-platforms/Platform/NXP/Library/BeIoLib/BeIoLib.inf + SocLib|edk2-platforms/Silicon/NXP/Chassis/LS1043aSocLib.inf + RealTimeClockLib|edk2-platforms/Platform/NXP/Library/Ds1307RtcLib/Ds1307= RtcLib.inf + UtilsLib|edk2-platforms/Platform/NXP/Library/UtilsLib/Utils.inf + +[PcdsFixedAtBuild.common] + gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"LS1043a RDB board" + + # + # Board Specific Pcds + # + gNxpQoriqLsTokenSpaceGuid.PcdSerdes2Enabled|FALSE + gNxpQoriqLsTokenSpaceGuid.PcdPlatformFreqDiv|0x1 + + # + # RTC Specific Pcds + # + gNxpQoriqLsTokenSpaceGuid.PcdRtcI2cBus|0 + gNxpQoriqLsTokenSpaceGuid.PcdI2cSpeed|100000 + gNxpQoriqLsTokenSpaceGuid.PcdDs1307I2cAddress|0x68 + + # + # Big Endian IPs + # + gNxpQoriqLsTokenSpaceGuid.PcdGurBigEndian|TRUE + gNxpQoriqLsTokenSpaceGuid.PcdWdogBigEndian|TRUE + +##########################################################################= ###### +# +# Components Section - list of all EDK II Modules needed by this Platform +# +##########################################################################= ###### +[Components.common] + edk2-platforms/Platform/NXP/Drivers/WatchDog/WatchDogDxe.inf + + ## diff --git a/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.fdf b/Platform/NXP/LS= 1043aRdbPkg/LS1043aRdbPkg.fdf new file mode 100644 index 0000000..6d187a9 --- /dev/null +++ b/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.fdf @@ -0,0 +1,279 @@ +# LS1043aRdbPkg.fdf +# +# FLASH layout file for LS1043a board. +# +# Copyright (c) 2016, Freescale Ltd. All rights reserved. +# 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 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 IM= PLIED. +# + +##########################################################################= ###### +# +# FD Section +# The [FD] Section is made up of the definition statements and a +# description of what goes into the Flash Device Image. Each FD section +# defines one flash "device" image. A flash device image may be one of +# the following: Removable media bootable image (like a boot floppy +# image,) an Option ROM image (that would be "flashed" into an add-in +# card,) a System "Flash" image (that would be burned into a system's +# flash) or an Update ("Capsule") image that will be used to update and +# existing system flash. +# +##########################################################################= ###### + +[FD.LS1043ARDB_EFI] +BaseAddress =3D 0x82000000|gArmTokenSpaceGuid.PcdFdBaseAddress #The bas= e address of the FLASH Device. +Size =3D 0x000EC890|gArmTokenSpaceGuid.PcdFdSize #The siz= e in bytes of the FLASH Device +ErasePolarity =3D 1 +BlockSize =3D 0x1 +NumBlocks =3D 0xEC890 + +##########################################################################= ###### +# +# Following are lists of FD Region layout which correspond to the location= s of different +# images within the flash device. +# +# Regions must be defined in ascending order and may not overlap. +# +# A Layout Region start with a eight digit hex offset (leading "0x" requir= ed) followed by +# the pipe "|" character, followed by the size of the region, also in hex = with the leading +# "0x" characters. Like: +# Offset|Size +# PcdOffsetCName|PcdSizeCName +# RegionType +# +##########################################################################= ###### +0x00000000|0x000EC890 +gArmTokenSpaceGuid.PcdFvBaseAddress|gArmTokenSpaceGuid.PcdFvSize +FV =3D FVMAIN_COMPACT + + +##########################################################################= ###### +# +# FV Section +# +# [FV] section is used to define what components or modules are placed wit= hin a flash +# device file. This section also defines order the components and modules= are positioned +# within the image. The [FV] section consists of define statements, set s= tatements and +# module statements. +# +##########################################################################= ###### + +[FV.FvMain] +FvNameGuid =3D 1037c42b-8452-4c41-aac7-41e6c31468da +BlockSize =3D 0x1 +NumBlocks =3D 0 # This FV gets compressed so make it just= big enough +FvAlignment =3D 8 # FV alignment and FV attributes setting. +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE + + INF MdeModulePkg/Core/Dxe/DxeMain.inf + INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf + + # + # PI DXE Drivers producing Architectural Protocols (EFI Services) + # + INF ArmPkg/Drivers/CpuDxe/CpuDxe.inf + + INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + INF ArmPkg/Drivers/ArmGic/ArmGicDxe.inf + INF ArmPkg/Drivers/TimerDxe/TimerDxe.inf + INF edk2-platforms/Platform/NXP/Drivers/WatchDog/WatchDogDxe.inf + INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + INF EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf + INF MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.= inf + INF EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + INF EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + + # + # Multiple Console IO support + # + INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe= .inf + INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + INF MdeModulePkg/Universal/SerialDxe/SerialDxe.inf + + INF EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + INF EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf + + # + # Network modules + # + INF MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf + INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf + INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf + INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf + INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf + INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf + INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf + INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf + INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf + INF MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf + INF MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf +!if $(NETWORK_IP6_ENABLE) =3D=3D TRUE + INF NetworkPkg/Ip6Dxe/Ip6Dxe.inf + INF NetworkPkg/TcpDxe/TcpDxe.inf + INF NetworkPkg/Udp6Dxe/Udp6Dxe.inf + INF NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf + INF NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf + INF NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf +!else + INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf +!endif + + # + # FAT filesystem + GPT/MBR partitioning + # + INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.i= nf + INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + INF FatPkg/FatPei/FatPei.inf + INF FatPkg/EnhancedFatDxe/Fat.inf + + # + # UEFI application (Shell Embedded Boot Loader) + # + INF ShellPkg/Application/Shell/Shell.inf + + # + # Bds + # + INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + INF MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf + INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + INF MdeModulePkg/Universal/BdsDxe/BdsDxe.inf + INF MdeModulePkg/Application/UiApp/UiApp.inf + +[FV.FVMAIN_COMPACT] +FvAlignment =3D 8 +ERASE_POLARITY =3D 1 +MEMORY_MAPPED =3D TRUE +STICKY_WRITE =3D TRUE +LOCK_CAP =3D TRUE +LOCK_STATUS =3D TRUE +WRITE_DISABLED_CAP =3D TRUE +WRITE_ENABLED_CAP =3D TRUE +WRITE_STATUS =3D TRUE +WRITE_LOCK_CAP =3D TRUE +WRITE_LOCK_STATUS =3D TRUE +READ_DISABLED_CAP =3D TRUE +READ_ENABLED_CAP =3D TRUE +READ_STATUS =3D TRUE +READ_LOCK_CAP =3D TRUE +READ_LOCK_STATUS =3D TRUE + + INF ArmPlatformPkg/PrePi/PeiUniCore.inf + + FILE FV_IMAGE =3D 9E21FD93-9C72-4c15-8C4B-E77F1DB2D792 { + SECTION GUIDED EE4E5898-3914-4259-9D6E-DC7BD79403CF PROCESSING_REQUIRE= D =3D TRUE { + SECTION FV_IMAGE =3D FVMAIN + } + } + +##########################################################################= ###### +# +# Rules are use with the [FV] section's module INF type to define +# how an FFS file is created for a given INF file. The following Rule are = the default +# rules for the different module type. User can add the customized rules t= o define the +# content of the FFS file. +# +##########################################################################= ###### + +[Rule.Common.SEC] + FILE SEC =3D $(NAMED_GUID) RELOCS_STRIPPED { + TE TE Align =3D 32 $(INF_OUTPUT)/$(MODULE_NAME).efi + } + +[Rule.Common.PEI_CORE] + FILE PEI_CORE =3D $(NAMED_GUID) { + TE TE $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING =3D"$(MODULE_NAME)" Optional + } + +[Rule.Common.PEIM] + FILE PEIM =3D $(NAMED_GUID) { + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + } + +[Rule.Common.PEIM.TIANOCOMPRESSED] + FILE PEIM =3D $(NAMED_GUID) DEBUG_MYTOOLS_IA32 { + PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex + GUIDED A31280AD-481E-41B6-95E8-127F4C984779 PROCESSING_REQUIRED =3D TR= UE { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + } + } + +[Rule.Common.DXE_CORE] + FILE DXE_CORE =3D $(NAMED_GUID) { + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + } + + +[Rule.Common.UEFI_DRIVER] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NA= ME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + } + +[Rule.Common.DXE_DRIVER] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NA= ME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + } + +[Rule.Common.DXE_RUNTIME_DRIVER] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NA= ME).depex + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + UI STRING=3D"$(MODULE_NAME)" Optional + } + +[Rule.Common.UEFI_APPLICATION] + FILE APPLICATION =3D $(NAMED_GUID) { + UI STRING =3D"$(MODULE_NAME)" Optional + PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi + } + +[Rule.Common.UEFI_DRIVER.BINARY] + FILE DRIVER =3D $(NAMED_GUID) { + DXE_DEPEX DXE_DEPEX Optional |.depex + PE32 PE32 |.efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R) + } + +[Rule.Common.UEFI_APPLICATION.BINARY] + FILE APPLICATION =3D $(NAMED_GUID) { + PE32 PE32 |.efi + UI STRING=3D"$(MODULE_NAME)" Optional + VERSION STRING=3D"$(INF_VERSION)" Optional BUILD_NUM=3D$(BUILD_NUMBE= R) + } diff --git a/Platform/NXP/NxpQoriqLs.dec b/Platform/NXP/NxpQoriqLs.dec new file mode 100644 index 0000000..550dbd6 --- /dev/null +++ b/Platform/NXP/NxpQoriqLs.dec @@ -0,0 +1,257 @@ +# @file. +# +# Copyright 2017 NXP +# +# This program and the accompanying materials are licensed and made avail= able under +# the terms and conditions of the BSD License which accompanies this dist= ribution. +# 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] + DEC_SPECIFICATION =3D 0x00010005 + PACKAGE_VERSION =3D 0.1 + +[Includes] + . + Include + +[Guids.common] + gNxpQoriqLsTokenSpaceGuid =3D {0x98657342, 0x4aee, 0x4fc6, {0xbc, 0= xb5, 0xff, 0x45, 0xb7, 0xa8, 0x71, 0xf2}} + +[PcdsFixedAtBuild.common] + # + # Pcds for I2C Controller + # + gNxpQoriqLsTokenSpaceGuid.PcdI2cBus|0|UINT32|0x00000001 + gNxpQoriqLsTokenSpaceGuid.PcdI2cSpeed|0|UINT32|0x00000002 + gNxpQoriqLsTokenSpaceGuid.PcdNumI2cController|0|UINT32|0x00000003 + + # + # Pcds for RTC device + # + gNxpQoriqLsTokenSpaceGuid.PcdRtcI2cBus|0|UINT32|0x00000005 + gNxpQoriqLsTokenSpaceGuid.PcdRTCI2cAddress|0|UINT32|0x00000006 + gNxpQoriqLsTokenSpaceGuid.PcdDs3231I2cAddress|0|UINT32|0x00000007 + gNxpQoriqLsTokenSpaceGuid.PcdDs1307I2cAddress|0|UINT32|0x00000008 + gNxpQoriqLsTokenSpaceGuid.PcdPcf2129I2cAddress|0|UINT32|0x00000009 + + # + # Pcds for base address and size + # + gNxpQoriqLsTokenSpaceGuid.PcdGutsBaseAddr|0x0|UINT64|0x00000100 + gNxpQoriqLsTokenSpaceGuid.PcdPiFdSize|0x0|UINT32|0x00000101 + gNxpQoriqLsTokenSpaceGuid.PcdPiFdBaseAddress|0x0|UINT64|0x00000102 + gNxpQoriqLsTokenSpaceGuid.PcdDspiBaseAddr|0|UINT64|0x00000103 + gNxpQoriqLsTokenSpaceGuid.PcdClkBaseAddr|0x0|UINT64|0x00000104 + gNxpQoriqLsTokenSpaceGuid.PcdWdog1BaseAddr|0x0|UINT64|0x00000105 + gNxpQoriqLsTokenSpaceGuid.PcdWdog2BaseAddr|0x0|UINT64|0x00000106 + gNxpQoriqLsTokenSpaceGuid.PcdWdog3BaseAddr|0x0|UINT64|0x00000107 + gNxpQoriqLsTokenSpaceGuid.PcdWdog4BaseAddr|0x0|UINT64|0x00000108 + gNxpQoriqLsTokenSpaceGuid.PcdWdog5BaseAddr|0x0|UINT64|0x00000109 + gNxpQoriqLsTokenSpaceGuid.PcdDdrBaseAddr|0x0|UINT64|0x0000010A + gNxpQoriqLsTokenSpaceGuid.PcdSdxcBaseAddr|0|UINT64|0x0000010B + gNxpQoriqLsTokenSpaceGuid.PcdScfgBaseAddr|0|UINT64|0x0000010C + gNxpQoriqLsTokenSpaceGuid.PcdI2c0BaseAddr|0|UINT64|0x0000010D + gNxpQoriqLsTokenSpaceGuid.PcdI2c1BaseAddr|0|UINT64|0x0000010E + gNxpQoriqLsTokenSpaceGuid.PcdI2c2BaseAddr|0|UINT64|0x0000010F + gNxpQoriqLsTokenSpaceGuid.PcdI2c3BaseAddr|0|UINT64|0x00000110 + gNxpQoriqLsTokenSpaceGuid.PcdSataController1BaseAddress|0x0|UINT32|0x000= 00111 + gNxpQoriqLsTokenSpaceGuid.PcdSataController2BaseAddress|0x0|UINT32|0x000= 00112 + gNxpQoriqLsTokenSpaceGuid.PcdQmanSwpBaseAddr|0x0500000000|UINT64|0x00000= 113 + gNxpQoriqLsTokenSpaceGuid.PcdQmanSwpSize|0x0080000000|UINT64|0x00000114 + gNxpQoriqLsTokenSpaceGuid.PcdBmanSwpBaseAddr|0x0508000000|UINT64|0x00000= 115 + gNxpQoriqLsTokenSpaceGuid.PcdBmanSwpSize|0x0080000000|UINT64|0x00000116 + gNxpQoriqLsTokenSpaceGuid.PcdPciExp1BaseAddr|0x0|UINT64|0x00000117 + gNxpQoriqLsTokenSpaceGuid.PcdPciExp1BaseSize|0x0|UINT64|0x00000118 + gNxpQoriqLsTokenSpaceGuid.PcdPciExp2BaseAddr|0x0|UINT64|0x00000119 + gNxpQoriqLsTokenSpaceGuid.PcdPciExp2BaseSize|0x0|UINT64|0x0000011A + gNxpQoriqLsTokenSpaceGuid.PcdPciExp3BaseAddr|0x0|UINT64|0x0000011B + gNxpQoriqLsTokenSpaceGuid.PcdPciExp3BaseSize|0x0|UINT64|0x0000011C + gNxpQoriqLsTokenSpaceGuid.PcdPciExp4BaseAddr|0x3800000000|UINT64|0x00001= 1D + gNxpQoriqLsTokenSpaceGuid.PcdPciExp4BaseSize|0x800000000|UINT64|0x000011E + gNxpQoriqLsTokenSpaceGuid.PcdDram1BaseAddr|0x0080000000|UINT64|0x0000011F + gNxpQoriqLsTokenSpaceGuid.PcdDram1Size|0x0080000000|UINT64|0x00000120 + gNxpQoriqLsTokenSpaceGuid.PcdDram2BaseAddr|0x0880000000|UINT64|0x00000121 + gNxpQoriqLsTokenSpaceGuid.PcdDram2Size|0x0780000000|UINT64|0x00000122 + gNxpQoriqLsTokenSpaceGuid.PcdDram3BaseAddr|0x8800000000|UINT64|0x00000123 + gNxpQoriqLsTokenSpaceGuid.PcdDram3Size|0x7800000000|UINT64|0x00000124 + gNxpQoriqLsTokenSpaceGuid.PcdQspiRegionBaseAddr|0x40000000|UINT64|0x0000= 0125 + gNxpQoriqLsTokenSpaceGuid.PcdQspiRegionSize|0x20000000|UINT64|0x00000126 + gNxpQoriqLsTokenSpaceGuid.PcdQspiRegion2BaseAddr|0x0|UINT64|0x00000127 + gNxpQoriqLsTokenSpaceGuid.PcdQspiRegion2Size|0x0|UINT64|0x00000128 + gNxpQoriqLsTokenSpaceGuid.PcdSystemMemoryExBase|0|UINT64|0x00000129 + gNxpQoriqLsTokenSpaceGuid.PcdSystemMemoryExSize|0|UINT64|0x0000012A + gNxpQoriqLsTokenSpaceGuid.PcdUsbBaseAddr|0|UINT32|0x0000012B + gNxpQoriqLsTokenSpaceGuid.PcdUsbSize|0|UINT32|0x0000012C + gNxpQoriqLsTokenSpaceGuid.PcdCcsrBaseAddr|0x01000000|UINT64|0x0000012D + gNxpQoriqLsTokenSpaceGuid.PcdCcsrSize|0x0F000000|UINT64|0x0000012E + gNxpQoriqLsTokenSpaceGuid.PcdDramMemSize|0x0|UINT64|0x0000012F + + # + # DSPI Pcds + # + gNxpQoriqLsTokenSpaceGuid.PcdDspiSpeed|0|UINT32|0x00000150 + gNxpQoriqLsTokenSpaceGuid.PcdDspiMode|0|UINT32|0x00000151 + gNxpQoriqLsTokenSpaceGuid.PcdDspiBusNumber|0|UINT32|0x00000152 + gNxpQoriqLsTokenSpaceGuid.PcdDspiCs|0|UINT32|0x00000153 + + # + # IFC PCDs + # + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion1BaseAddr|0x60000000|UINT64|0x0000= 0190 + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion1Size|0x20000000|UINT64|0x00000191 + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion2BaseAddr|0x0620000000|UINT64|0x00= 000192 + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion2Size|0x00E0000000|UINT64|0x000001= 93 + gNxpQoriqLsTokenSpaceGuid.PcdIfcNandReservedSize|0x0|UINT32|0x00000194 + gNxpQoriqLsTokenSpaceGuid.PcdFlashDeviceBase64|0x0|UINT64|0x00000195 + gNxpQoriqLsTokenSpaceGuid.PcdFlashReservedRegionBase64|0x0|UINT64|0x0000= 0196 + + # + # PCI PCDs + # + gNxpQoriqLsTokenSpaceGuid.PcdPciMaxPayloadFixup|FALSE|BOOLEAN|0x000001C0 + gNxpQoriqLsTokenSpaceGuid.PcdKludgeMapPciMmioAsCached|FALSE|BOOLEAN|0x00= 0001C1 + gNxpQoriqLsTokenSpaceGuid.PcdPciBusMin|0|UINT64|0x000001C2 + gNxpQoriqLsTokenSpaceGuid.PcdPciBusMax|255|UINT64|0x000001C3 + gNxpQoriqLsTokenSpaceGuid.PcdPci1Mmio64Base|0x0|UINT64|0x000001C4 + gNxpQoriqLsTokenSpaceGuid.PcdPci2Mmio64Base|0x0|UINT64|0x000001C5 + gNxpQoriqLsTokenSpaceGuid.PcdPci3Mmio64Base|0x0|UINT64|0x000001C6 + gNxpQoriqLsTokenSpaceGuid.PcdPci4Mmio64Base|0x0|UINT64|0x000001C7 + gNxpQoriqLsTokenSpaceGuid.PcdPciMmio64Size|0x0|UINT64|0x000001C8 + gNxpQoriqLsTokenSpaceGuid.PcdPciExp1SysAddr|0x0|UINT64|0x000001C9 + gNxpQoriqLsTokenSpaceGuid.PcdPciExp2SysAddr|0x0|UINT64|0x000001CA + gNxpQoriqLsTokenSpaceGuid.PcdPciExp3SysAddr|0x0|UINT64|0x000001CB + gNxpQoriqLsTokenSpaceGuid.PcdPciExp4SysAddr|0x0|UINT64|0x000001CC + gNxpQoriqLsTokenSpaceGuid.PcdPciDebug|FALSE|BOOLEAN|0x000001CD + gNxpQoriqLsTokenSpaceGuid.PcdNumPciController|0|UINT32|0x000001CE + gNxpQoriqLsTokenSpaceGuid.PcdPciMemOneTransaction|0x0|UINT64|0x000001CF + gNxpQoriqLsTokenSpaceGuid.PcdPcieLutBase|0x0|UINT64|0x000001D0 + gNxpQoriqLsTokenSpaceGuid.PcdPcieLutDbg|0x0|UINT64|0x000001D1 + + # + # NV Pcd + # + gNxpQoriqLsTokenSpaceGuid.PcdNvFdBase|0x0|UINT64|0x00000210 + gNxpQoriqLsTokenSpaceGuid.PcdNvFdSize|0x0|UINT64|0x00000211 + + # + # QSPI PCDs + # + gNxpQoriqLsTokenSpaceGuid.PcdQspiFdtCompatible|""|VOID*|0x00000220 + gNxpQoriqLsTokenSpaceGuid.PcdFdtAddress|0|UINT64|0x00000221 + + # + # Platform PCDs + # + gNxpQoriqLsTokenSpaceGuid.PcdPlatformFreqDiv|0|UINT32|0x00000250 + gNxpQoriqLsTokenSpaceGuid.PcdSerdes2Enabled|FALSE|BOOLEAN|0x00000251 + gNxpQoriqLsTokenSpaceGuid.PcdIfcNorEnabled|0x0|UINT64|0x00000252 + gNxpQoriqLsTokenSpaceGuid.PcdMuxToUsb3|FALSE|BOOLEAN|0x00000253 + + # + # Erratum PCDs + # + gNxpQoriqLsTokenSpaceGuid.PcdI2cErratumA009203|FALSE|BOOLEAN|0x00000270 + gNxpQoriqLsTokenSpaceGuid.PcdUsbErratumA009007|FALSE|BOOLEAN|0x00000271 + gNxpQoriqLsTokenSpaceGuid.PcdErratumA008751|FALSE|BOOLEAN|0x00000272 + gNxpQoriqLsTokenSpaceGuid.PcdErratumA009008|FALSE|BOOLEAN|0x00000273 + gNxpQoriqLsTokenSpaceGuid.PcdErratumA009798|FALSE|BOOLEAN|0x00000274 + gNxpQoriqLsTokenSpaceGuid.PcdErratumA008514|FALSE|BOOLEAN|0x00000275 + gNxpQoriqLsTokenSpaceGuid.PcdErratumA008336|FALSE|BOOLEAN|0x00000276 + gNxpQoriqLsTokenSpaceGuid.PcdSataErratumA009185|FALSE|BOOLEAN|0x00000277 + + # + # Test PCDs + # + gNxpQoriqLsTokenSpaceGuid.PcdDspiTest|FALSE|BOOLEAN|0x00000290 + + # + # Clock PCDs + # + gNxpQoriqLsTokenSpaceGuid.PcdSysClk|0x0|UINT64|0x000002A0 + gNxpQoriqLsTokenSpaceGuid.PcdDdrClk|0x0|UINT64|0x000002A1 + + # + # DPAA1 PCDs + # + # Valid values for PcdDpaa1DebugFlags: + # - 0x1 Enable DPAA1 debugging messages + # - 0x2 Dump values of RAM words or registers + # - 0x4 Perform extra checks + # - 0x8 Trace sent/received network packets + # + gNxpQoriqLsTokenSpaceGuid.PcdDpaa1Initialize|FALSE|BOOLEAN|0x000002B0 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa1DebugFlags|0x0|UINT32|0x000002B1 + gNxpQoriqLsTokenSpaceGuid.PcdFManFwFlashAddr|0x0|UINT32|0x000002B2 + gNxpQoriqLsTokenSpaceGuid.PcdSgmiiPrtclInit|FALSE|BOOLEAN|0x000002B3 + # + # Bit mask to indicate the DPAA1 MEMACs to be used. + # MeMaci is selected to be used, if bit 'i - 1' is set in the bit mask, + # where i is the range '1 .. #Memacs'. For example, if we want MEMAC5 + # to be used, the value of the mask needs to be 0x10 (bit 4 set) + # + gNxpQoriqLsTokenSpaceGuid.PcdDpaa1UsedMemacsMask|0x0|UINT64|0x000002B4 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa1FmanMdio1Addr|0x0|UINT64|0x000002B5 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa1FmanMdio2Addr|0x0|UINT64|0x000002B6 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa1FmanAddr|0x0|UINT64|0x000002B7 + + # + # DPAA2 PCDs + # + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McPortalBaseAddr|0x0|UINT64|0x000002D0 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McPortalSize|0x0|UINT64|0x000002D1 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2NiPortalsBaseAddr|0x0|UINT64|0x000002D2 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2NiPortalsSize|0x0|UINT64|0x000002D3 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2QBmanPortalsBaseAddr|0x0|UINT64|0x0000= 02D4 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2QBmanPortalSize|0x0|UINT64|0x000002D5 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2QBmanPortalsCacheSize|0x0|UINT64|0x000= 002D6 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McRamSize|0x0|UINT64|0x000002D7 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2Initialize|FALSE|BOOLEAN|0x000002D8 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McFwSrc|0x0|UINT8|0x000002D9 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McFwNorAddr|0x0|UINT64|0x000002DA + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McDpcNorAddr|0x0|UINT64|0x000002DB + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McDplNorAddr|0x0|UINT64|0x000002DC + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McDpcMaxLen|0x0|UINT32|0x000002DD + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McDpcMcDramOffset|0x0|UINT32|0x000002DE + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McDplMaxLen|0x0|UINT32|0x000002DF + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McDplMcDramOffset|0x0|UINT32|0x000002E0 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McPrivateRamSize|0x0|UINT32|0x000002E1 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2StreamIdStart|0x0|UINT32|0x000002E2 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2StreamIdEnd|0x0|UINT32|0x000002E3 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McBootTimeoutMs|0x0|UINT32|0x000002E4 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McLogMcDramOffset|0x0|UINT32|0x000002E5 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2McLogLevel|0x0|UINT8|0x000002E6 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2DebugFlags|0x0|UINT32|0x000002E7 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2CortinaFwSrc|0x0|UINT8|0x000002E8 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2CortinaFwNorAddr|0x0|UINT64|0x000002E9 + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2CortinaFwMaxLen|0x0|UINT32|0x000002EA + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2UsedDpmacsMask|0x0|UINT64|0x000002EB + gNxpQoriqLsTokenSpaceGuid.PcdMacDeviceDisableRegAddr|0x0|UINT64|0x000002= EC + gNxpQoriqLsTokenSpaceGuid.PcdBypassAmqMask|0x0|UINT32|0x000002ED + gNxpQoriqLsTokenSpaceGuid.PcdMdioBustCount|0x0|UINT8|0x000002EE + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2Wriop1Mdio1Addr|0x0|UINT64|0x000002EF + gNxpQoriqLsTokenSpaceGuid.PcdDpaa2Wriop1Mdio2Addr|0x0|UINT64|0x000002F0 + + # + # USB Pcds + # + gNxpQoriqLsTokenSpaceGuid.PcdNumUsbController|0|UINT32|0x00000300 + + # + # Pcds to support Big Endian IPs + # + gNxpQoriqLsTokenSpaceGuid.PcdMmcBigEndian|FALSE|BOOLEAN|0x0000310 + gNxpQoriqLsTokenSpaceGuid.PcdGurBigEndian|FALSE|BOOLEAN|0x0000311 + gNxpQoriqLsTokenSpaceGuid.PcdPciLutBigEndian|FALSE|BOOLEAN|0x00000312 + gNxpQoriqLsTokenSpaceGuid.PcdWdogBigEndian|FALSE|BOOLEAN|0x00000313 + + # + # System ID Eeprom Pcds + # + gNxpQoriqLsTokenSpaceGuid.PcdSysEepromI2cBus|0|UINT32|0x0000330 + gNxpQoriqLsTokenSpaceGuid.PcdSysEepromI2cAddress|0|UINT32|0x0000331 diff --git a/Platform/NXP/NxpQoriqLs.dsc b/Platform/NXP/NxpQoriqLs.dsc new file mode 100644 index 0000000..8bf65a6 --- /dev/null +++ b/Platform/NXP/NxpQoriqLs.dsc @@ -0,0 +1,453 @@ +# @file +# +# Copyright (c) 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 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 IM= PLIED. +# +# + +##########################################################################= ###### +# +# Defines Section - statements that will be processed to create a Makefile. +# +##########################################################################= ###### +[Defines] + # + # Defines for default states. These can be changed on the command line. + # -D FLAG=3DVALUE + # + PLATFORM_VERSION =3D 0.1 + DSC_SPECIFICATION =3D 0x00010005 + SUPPORTED_ARCHITECTURES =3D AARCH64 + BUILD_TARGETS =3D DEBUG|RELEASE + SKUID_IDENTIFIER =3D DEFAULT + +[LibraryClasses.common] + ArmLib|ArmPkg/Library/ArmLib/ArmBaseLib.inf + ArmMmuLib|ArmPkg/Library/ArmMmuLib/ArmMmuBaseLib.inf + ArmSmcLib|ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf + ArmGenericTimerCounterLib|ArmPkg/Library/ArmGenericTimerPhyCounterLib/Ar= mGenericTimerPhyCounterLib.inf + TimerLib|ArmPkg/Library/ArmArchTimerLib/ArmArchTimerLib.inf + ArmTrustZoneLib|ArmPlatformPkg/Drivers/ArmTrustZone/ArmTrustZone.inf + ArmPlatformStackLib|ArmPlatformPkg/Library/ArmPlatformStackLib/ArmPlatfo= rmStackLib.inf + HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf + UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServic= esLib.inf + FileExplorerLib|MdeModulePkg/Library/FileExplorerLib/FileExplorerLib.inf + BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf + PlatformBootManagerLib|ArmPkg/Library/PlatformBootManagerLib/PlatformBoo= tManagerLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + UefiBootManagerLib|MdeModulePkg/Library/UefiBootManagerLib/UefiBootManag= erLib.inf + CustomizedDisplayLib|MdeModulePkg/Library/CustomizedDisplayLib/Customize= dDisplayLib.inf + + # Networking Requirements + NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf + DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf + UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf + IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf + + # ARM GIC400 General Interrupt Driver + ArmGicLib|ArmPkg/Drivers/ArmGic/ArmGicLib.inf + ArmGicArchLib|ArmPkg/Library/ArmGicArchLib/ArmGicArchLib.inf + DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf + DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseD= ebugPrintErrorLevelLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + BaseLib|MdePkg/Library/BaseLib/BaseLib.inf + SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchroniza= tionLib.inf + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibN= ull.inf + PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf + EfiFileLib|EmbeddedPkg/Library/EfiFileLib/EfiFileLib.inf + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf + PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeC= offGetEntryPointLib.inf + PeCoffExtraActionLib|ArmPkg/Library/DebugPeCoffExtraActionLib/DebugPeCof= fExtraActionLib.inf + CacheMaintenanceLib|ArmPkg/Library/ArmCacheMaintenanceLib/ArmCacheMainte= nanceLib.inf + DefaultExceptionHandlerLib|ArmPkg/Library/DefaultExceptionHandlerLib/Def= aultExceptionHandlerLib.inf + CpuExceptionHandlerLib|ArmPkg/Library/ArmExceptionLib/ArmExceptionLib.inf + PrePiLib|EmbeddedPkg/Library/PrePiLib/PrePiLib.inf + SemihostLib|ArmPkg/Library/SemihostLib/SemihostLib.inf + IoLib|MdePkg/Library/BaseIoLibIntrinsic/BaseIoLibIntrinsic.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + UefiLib|MdePkg/Library/UefiLib/UefiLib.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/U= efiRuntimeServicesTableLib.inf + DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf + UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBoo= tServicesTableLib.inf + DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableL= ib.inf + UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntry= Point.inf + UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiA= pplicationEntryPoint.inf + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf + CpuLib|MdePkg/Library/BaseCpuLib/BaseCpuLib.inf + ArmDisassemblerLib|ArmPkg/Library/ArmDisassemblerLib/ArmDisassemblerLib.= inf + DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.i= nf + DmaLib|EmbeddedPkg/Library/NonCoherentDmaLib/NonCoherentDmaLib.inf + BdsLib|ArmPkg/Library/BdsLib/BdsLib.inf + FdtLib|EmbeddedPkg/Library/FdtLib/FdtLib.inf + ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf + ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib= .inf + FileHandleLib|MdePkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf + ShellCEntryLib|ShellPkg/Library/UefiShellCEntryLib/UefiShellCEntryLib.inf + SortLib|MdeModulePkg/Library/UefiSortLib/UefiSortLib.inf + NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf + HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsing= Lib.inf + BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCom= mandLib.inf + TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurem= entLibNull.inf + AuthVariableLib|MdeModulePkg/Library/AuthVariableLibNull/AuthVariableLib= Null.inf + VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf + NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + +[LibraryClasses.common.SEC] + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + ReportStatusCodeLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReport= StatusCode/PeiDxeDebugLibReportStatusCode.inf + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompres= sLib.inf + ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib= /PrePiExtractGuidedSectionLib.inf + LzmaDecompressLib|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLi= b/LzmaCustomDecompressLib.inf + PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf + HobLib|EmbeddedPkg/Library/PrePiHobLib/PrePiHobLib.inf + PrePiHobListPointerLib|ArmPlatformPkg/Library/PrePiHobListPointerLib/Pre= PiHobListPointerLib.inf + MemoryAllocationLib|EmbeddedPkg/Library/PrePiMemoryAllocationLib/PrePiMe= moryAllocationLib.inf + PerformanceLib|MdeModulePkg/Library/PeiPerformanceLib/PeiPerformanceLib.= inf + PlatformPeiLib|ArmPlatformPkg/PlatformPei/PlatformPeiLib.inf + MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf + + # 1/123 faster than Stm or Vstm version + BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf + + # Uncomment to turn on GDB stub in SEC. + #DebugAgentLib|EmbeddedPkg/Library/GdbDebugAgent/GdbDebugAgent.inf + +[LibraryClasses.common.PEIM] + PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf + PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf + PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf + PeiServicesTablePointerLib|MdePkg/Library/PeiServicesTablePointerLib/Pei= ServicesTablePointerLib.inf + HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf + MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAlloc= ationLib.inf + +[LibraryClasses.common.DXE_CORE] + HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf + MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeC= oreMemoryAllocationLib.inf + DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf + ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeL= ibFramework/DxeReportStatusCodeLib.inf + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExt= ractGuidedSectionLib.inf + UefiDecompressLib|MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompres= sLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + PeCoffLib|EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf + PerformanceLib|MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerform= anceLib.inf + +[LibraryClasses.common.DXE_DRIVER] + ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeL= ibFramework/DxeReportStatusCodeLib.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeS= ecurityManagementLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf + MemoryInitPeiLib|ArmPlatformPkg/MemoryInitPei/MemoryInitPeiLib.inf + +[LibraryClasses.common.UEFI_APPLICATION] + PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeL= ibFramework/DxeReportStatusCodeLib.inf + UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDec= ompressLib/BaseUefiTianoCustomDecompressLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf + +[LibraryClasses.common.UEFI_DRIVER] + ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeL= ibFramework/DxeReportStatusCodeLib.inf + UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDec= ompressLib/BaseUefiTianoCustomDecompressLib.inf + ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExt= ractGuidedSectionLib.inf + PerformanceLib|MdeModulePkg/Library/DxePerformanceLib/DxePerformanceLib.= inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + +[LibraryClasses.common.DXE_RUNTIME_DRIVER] + HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf + MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAll= ocationLib.inf + ReportStatusCodeLib|IntelFrameworkModulePkg/Library/DxeReportStatusCodeL= ibFramework/DxeReportStatusCodeLib.inf + CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf + PeCoffLib|EmbeddedPkg/Library/DxeHobPeCoffLib/DxeHobPeCoffLib.inf + +[LibraryClasses.AARCH64] + # + # It is not possible to prevent the ARM compiler for generic intrinsic f= unctions. + # This library provides the instrinsic functions generate by a given com= piler. + # [LibraryClasses.ARM] and NULL mean link this library into all ARM imag= es. + # + NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf + +[BuildOptions] + XCODE:*_*_ARM_PLATFORM_FLAGS =3D=3D -arch armv7 + GCC:*_*_ARM_PLATFORM_FLAGS =3D=3D -march=3Darmv7-a + RVCT:*_*_ARM_PLATFORM_FLAGS =3D=3D --cpu cortex-a9 + +[BuildOptions.common.EDKII.DXE_RUNTIME_DRIVER] + GCC:*_*_ARM_DLINK_FLAGS =3D -z common-page-size=3D0x1000 + GCC:*_*_AARCH64_DLINK_FLAGS =3D -z common-page-size=3D0x10000 + +##########################################################################= ###### +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform +# +##########################################################################= ###### + +[PcdsFeatureFlag.common] + ## If TRUE, Graphics Output Protocol will be installed on virtual handle= created by ConsplitterDxe. + # It could be set FALSE to save size. + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutGopSupport|TRUE + gEfiMdeModulePkgTokenSpaceGuid.PcdConOutUgaSupport|FALSE + gEfiMdePkgTokenSpaceGuid.PcdComponentNameDisable|TRUE + gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnosticsDisable|TRUE + gEfiMdePkgTokenSpaceGuid.PcdComponentName2Disable|TRUE + gEfiMdePkgTokenSpaceGuid.PcdDriverDiagnostics2Disable|TRUE + + # + # Control what commands are supported from the UI + # Turn these on and off to add features or save size + # + gEmbeddedTokenSpaceGuid.PcdEmbeddedMacBoot|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedDirCmd|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedHobCmd|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedHwDebugCmd|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedPciDebugCmd|TRUE + gEmbeddedTokenSpaceGuid.PcdEmbeddedIoEnable|FALSE + gEmbeddedTokenSpaceGuid.PcdEmbeddedScriptCmd|FALSE + gEmbeddedTokenSpaceGuid.PcdCacheEnable|TRUE + + # Use the Vector Table location in CpuDxe. We will not copy the Vector T= able at PcdCpuVectorBaseAddress + gArmTokenSpaceGuid.PcdRelocateVectorTable|FALSE + gEmbeddedTokenSpaceGuid.PcdPrePiProduceMemoryTypeInformationHob|TRUE + gArmTokenSpaceGuid.PcdCpuDxeProduceDebugSupport|FALSE + gEfiMdeModulePkgTokenSpaceGuid.PcdTurnOffUsbLegacySupport|TRUE + +[PcdsDynamicDefault.common] + # + # Set video resolution for boot options and for text setup. + # PlatformDxe can set the former at runtime. + # + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoHorizontalResolution|800 + gEfiMdeModulePkgTokenSpaceGuid.PcdVideoVerticalResolution|600 + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoHorizontalResolution|640 + gEfiMdeModulePkgTokenSpaceGuid.PcdSetupVideoVerticalResolution|480 + +[PcdsDynamicHii.common.DEFAULT] + gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVar= iableGuid|0x0|10 + +[PcdsFixedAtBuild.common] + gEmbeddedTokenSpaceGuid.PcdMetronomeTickPeriod|1000 + gEmbeddedTokenSpaceGuid.PcdTimerPeriod|10000 # expressed in 100ns units,= 100,000 x 100 ns =3D 10,000,000 ns =3D 10 ms + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000 + gEfiMdeModulePkgTokenSpaceGuid.PcdMaxAuthVariableSize|0x2800 + gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FAL= SE + gEfiMdeModulePkgTokenSpaceGuid.PcdBootManagerMenuFile|{ 0x21, 0xaa, 0x2c= , 0x46, 0x14, 0x76, 0x03, 0x45, 0x83, 0x6e, 0x8a, 0xb6, 0xf4, 0x66, 0x23, 0= x31 } + gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x0= 4, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, = 0xD1 } + gArmPlatformTokenSpaceGuid.PcdCoreCount|1 # Only one core + gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|2000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000 + gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF + gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1 + gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0 + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320 + +!if $(TARGET) =3D=3D RELEASE + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x27 + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x81000000 +!else + gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2F + gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x81000044 +!endif + + gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x07 + gEmbeddedTokenSpaceGuid.PcdEmbeddedAutomaticBootCommand|"" + gEmbeddedTokenSpaceGuid.PcdEmbeddedDefaultTextColor|0x07 + gEmbeddedTokenSpaceGuid.PcdEmbeddedMemVariableStoreSize|0x10000 + + # + # Optional feature to help prevent EFI memory map fragments + # Turned on and off via: PcdPrePiProduceMemoryTypeInformationHob + # Values are in EFI Pages (4K). DXE Core will make sure that + # at least this much of each type of memory can be allocated + # from a single memory range. This way you only end up with + # maximum of two fragements for each type in the memory map + # (the memory used, and the free memory that was prereserved + # but not used). + # + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIReclaimMemory|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiACPIMemoryNVS|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiReservedMemoryType|0 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesData|80 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiRuntimeServicesCode|40 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesCode|400 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiBootServicesData|3000 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderCode|10 + gEmbeddedTokenSpaceGuid.PcdMemoryTypeEfiLoaderData|0 + + # Serial Terminal + gEfiMdePkgTokenSpaceGuid.PcdUartDefaultBaudRate|115200 + gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|4 + + # Size of the region reserved for fixed address allocations (Reserved 32= MB) + gArmTokenSpaceGuid.PcdArmLinuxKernelMaxOffset|0x08000000 + gArmTokenSpaceGuid.PcdArmLinuxFdtMaxOffset|0x08000000 + gArmTokenSpaceGuid.PcdArmLinuxFdtAlignment|0x0 + gArmTokenSpaceGuid.PcdCpuVectorBaseAddress|0x94A00000 + gArmTokenSpaceGuid.PcdCpuResetAddress|0x94A00000 + + # Timer + gArmTokenSpaceGuid.PcdArmArchTimerFreqInHz|0 + + # We want to use the Shell Libraries but don't want it to initialise + # automatically. We initialise the libraries when the command is called = by the + # Shell. + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE + + # Use the serial console for both ConIn & ConOut + gArmPlatformTokenSpaceGuid.PcdDefaultConOutPaths|L"VenHw(D3987D4B-971A-4= 35F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi();" + gArmPlatformTokenSpaceGuid.PcdDefaultConInPaths|L"VenHw(D3987D4B-971A-43= 5F-8CAF-4967EB627241)/Uart(115200,8,N,1)/VenPcAnsi()" + gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE + gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|16000 +!ifdef $(NO_SHELL_PROFILES) + gEfiShellPkgTokenSpaceGuid.PcdShellProfileMask|0x00 +!endif #$(NO_SHELL_PROFILES) + +##########################################################################= ###### +# +# Components Section - list of all EDK II Modules needed by this Platform +# +##########################################################################= ###### +[Components.common] + # + # SEC + # + ArmPlatformPkg/PrePi/PeiUniCore.inf + MdeModulePkg/Universal/PCD/Pei/Pcd.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + + # + # DXE + # + MdeModulePkg/Core/Dxe/DxeMain.inf { + + NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32Gu= idedSectionExtractLib.inf + NULL|EmbeddedPkg/Library/LzmaHobCustomDecompressLib/LzmaHobCustomDec= ompressLib.inf + } + MdeModulePkg/Universal/PCD/Dxe/Pcd.inf { + + PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf + } + + # + # Architectural Protocols + # + ArmPkg/Drivers/CpuDxe/CpuDxe.inf + MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf + MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf + MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf + MdeModulePkg/Universal/Variable/EmuRuntimeDxe/EmuVariableRuntimeDxe.inf + EmbeddedPkg/ResetRuntimeDxe/ResetRuntimeDxe.inf + EmbeddedPkg/RealTimeClockRuntimeDxe/RealTimeClockRuntimeDxe.inf + EmbeddedPkg/EmbeddedMonotonicCounter/EmbeddedMonotonicCounter.inf + + # FDT installation + EmbeddedPkg/Drivers/FdtPlatformDxe/FdtPlatformDxe.inf + MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf + MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf + MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf + MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf + MdeModulePkg/Universal/SerialDxe/SerialDxe.inf + MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiTableDxe.inf + EmbeddedPkg/MetronomeDxe/MetronomeDxe.inf + ArmPkg/Drivers/TimerDxe/TimerDxe.inf + ArmPkg/Drivers/ArmGic/ArmGicDxe.inf + EmbeddedPkg/SimpleTextInOutSerial/SimpleTextInOutSerial.inf + + # + # Networking stack + # + MdeModulePkg/Universal/Network/SnpDxe/SnpDxe.inf + MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf + MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf + MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf + MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf + MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf + MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf + MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf + MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf + MdeModulePkg/Universal/Network/UefiPxeBcDxe/UefiPxeBcDxe.inf + MdeModulePkg/Universal/Network/IScsiDxe/IScsiDxe.inf +!if $(NETWORK_IP6_ENABLE) =3D=3D TRUE + NetworkPkg/Ip6Dxe/Ip6Dxe.inf + NetworkPkg/TcpDxe/TcpDxe.inf + NetworkPkg/Udp6Dxe/Udp6Dxe.inf + NetworkPkg/Dhcp6Dxe/Dhcp6Dxe.inf + NetworkPkg/Mtftp6Dxe/Mtftp6Dxe.inf + NetworkPkg/UefiPxeBcDxe/UefiPxeBcDxe.inf +!else + MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf +!endif + + # + # FAT filesystem + GPT/MBR partitioning + # + MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf + MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf + MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf + FatPkg/FatPei/FatPei.inf + FatPkg/EnhancedFatDxe/Fat.inf + + # + # Bds + # + MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf + MdeModulePkg/Universal/DisplayEngineDxe/DisplayEngineDxe.inf + MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf + MdeModulePkg/Universal/BdsDxe/BdsDxe.inf + MdeModulePkg/Application/UiApp/UiApp.inf { + + NULL|MdeModulePkg/Library/DeviceManagerUiLib/DeviceManagerUiLib.inf + NULL|MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf + NULL|MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanc= eManagerUiLib.inf + } + MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf + + # + # Example Application + # + MdeModulePkg/Application/HelloWorld/HelloWorld.inf + ShellPkg/Library/UefiShellLib/UefiShellLib.inf + ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf + ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.i= nf + ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf + ShellPkg/Library/UefiDpLib/UefiDpLib.inf { + + TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTem= plate.inf + PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformance= LibNull.inf + DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf + } + ShellPkg/Application/Shell/Shell.inf { + + NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3Comm= andsLib.inf +!ifndef $(NO_SHELL_PROFILES) + NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1Co= mmandsLib.inf + NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1= CommandsLib.inf + NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1Comm= andsLib.inf + NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1= CommandsLib.inf + NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLi= b.inf +!ifdef $(INCLUDE_DP) + NULL|ShellPkg/Library/UefiDpLib/UefiDpLib.inf +!endif #$(INCLUDE_DP) +!ifdef $(INCLUDE_TFTP_COMMAND) + NULL|ShellPkg/Library/UefiShellTftpCommandLib/UefiShellTftpCommandLi= b.inf +!endif #$(INCLUDE_TFTP_COMMAND) +!endif #$(NO_SHELL_PROFILES) + } + + ## diff --git a/Platform/NXP/Readme.md b/Platform/NXP/Readme.md new file mode 100644 index 0000000..984ed8b --- /dev/null +++ b/Platform/NXP/Readme.md @@ -0,0 +1,14 @@ +Support for all NXP boards is available in this directory. + +# How to build + +1. Source Environment file: + source Env.cshrc + +2. Build desired board + ./build.sh (optional) + + board-name : LS1043 / LS1046 / LS2088 + build-candidate : DEBUG / RELEASE + +Currently, support for LS1043 is provided. diff --git a/Platform/NXP/build.sh b/Platform/NXP/build.sh new file mode 100755 index 0000000..4e393d1 --- /dev/null +++ b/Platform/NXP/build.sh @@ -0,0 +1,100 @@ +#!/bin/bash + +# UEFI build script for NXP LS SoCs +# +# 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. +# + +# Global Defaults +ARCH=3DAARCH64 +TARGET_TOOLS=3D`echo $GCC_ARCH_PREFIX | cut -d _ -f 1` +BASE_DIR=3D../../.. + +[ -z "$TARGET_TOOLS" ] && { + echo "TARGET_TOOLS not found. Please run \"source Env.cshrc\" ." + exit 1 +} + +print_usage_banner() +{ + echo "" + echo "This shell script expects:" + echo " Arg 1 (mandatory): Board Type (can be LS1043 / LS1046 / LS20= 88)." + echo " Arg 2 (mandatory): Build candidate (can be RELEASE or DEBUG)= . By + default we build the RELEASE candidate." + echo " Arg 3 (optional): clean - To do a 'make clean' operation." +} + +# Check for total num of input arguments +if [[ "$#" -gt 3 ]]; then + echo "Illegal number of parameters" + print_usage_banner + exit +fi + +# Check for third parameter to be clean only +if [[ "$3" && $3 !=3D "clean" ]]; then + echo "Error ! Either clean or emplty" + print_usage_banner + exit +fi + +# Check for input arguments +if [[ $1 =3D=3D "" || $2 =3D=3D "" ]]; then + echo "Error !" + print_usage_banner + exit +fi + +# Check for input arguments +if [[ $1 !=3D "LS1043" && $1 !=3D "LS1046" && $1 !=3D "LS2088" ]]; then + echo "Error ! Incorrect Board Type specified." + print_usage_banner + exit +fi + +# Check for input arguments +if [[ $2 !=3D "RELEASE" ]]; then + if [[ $2 !=3D "DEBUG" ]]; then + echo "Error ! Incorrect build target specified." + print_usage_banner + exit + fi +fi + +PKG=3D"aRdbPkg" + +echo ".........................................." +echo "Welcome to $1$PKG UEFI Build environment" +echo ".........................................." + +if [[ $3 =3D=3D "clean" ]]; then + echo "Cleaning up the build directory '$BASE_DIR/Build/$1$PKG/'.." + rm -rf $BASE_DIR/Build/$1$PKG/* + exit +fi + +# Clean-up +set -e +shopt -s nocasematch + +# +# Setup workspace now +# +echo Initializing workspace +cd $BASE_DIR + +# Use the BaseTools in edk2 +export EDK_TOOLS_PATH=3D`pwd`/BaseTools +source edksetup.sh BaseTools + + +build -p "$WORKSPACE/edk2-platforms/Platform/NXP/$1$PKG/$1$PKG.dsc" -a $AR= CH -t $TARGET_TOOLS -b $2 diff --git a/Silicon/NXP/Chassis/Chassis2/Chassis2.dec b/Silicon/NXP/Chassi= s/Chassis2/Chassis2.dec new file mode 100644 index 0000000..cf41b3c --- /dev/null +++ b/Silicon/NXP/Chassis/Chassis2/Chassis2.dec @@ -0,0 +1,19 @@ +# @file +# +# Copyright 2017 NXP +# +# This program and the accompanying materials are licensed and made availa= ble under +# the terms and conditions of the BSD License which accompanies this distr= ibution. +# 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 IMP= LIED. +# +# + +[Defines] + DEC_SPECIFICATION =3D 0x00010005 + +[Includes] + . diff --git a/Silicon/NXP/LS1043A/LS1043A.dec b/Silicon/NXP/LS1043A/LS1043A.= dec new file mode 100644 index 0000000..f14edb2 --- /dev/null +++ b/Silicon/NXP/LS1043A/LS1043A.dec @@ -0,0 +1,22 @@ +# LS1043A.dec +# +# Copyright 2017 NXP +# +# This program and the accompanying materials are licensed and made availa= ble under +# the terms and conditions of the BSD License which accompanies this distr= ibution. +# 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 IMP= LIED. +# +# + +[Defines] + DEC_SPECIFICATION =3D 0x00010005 + +[Guids.common] + gNxpLs1043ATokenSpaceGuid =3D {0x6834fe45, 0x4aee, 0x4fc6, {0xbc, 0= xb5, 0xff, 0x45, 0xb7, 0xa8, 0x71, 0xf2}} + +[Includes] + Include diff --git a/Silicon/NXP/LS1043A/LS1043A.dsc b/Silicon/NXP/LS1043A/LS1043A.= dsc new file mode 100644 index 0000000..78f8011 --- /dev/null +++ b/Silicon/NXP/LS1043A/LS1043A.dsc @@ -0,0 +1,82 @@ +# LS1043A.dsc +# LS1043A Soc package. +# +# 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 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 IM= PLIED. +# +# + +##########################################################################= ###### +# +# Pcd Section - list of all EDK II PCD Entries defined by this Platform +# +##########################################################################= ###### +[PcdsDynamicDefault.common] + + # + # ARM General Interrupt Controller + gArmTokenSpaceGuid.PcdGicDistributorBase|0x01401000 + gArmTokenSpaceGuid.PcdGicInterruptInterfaceBase|0x01402000 + +[PcdsFixedAtBuild.common] + + gEmbeddedTokenSpaceGuid.PcdEmbeddedPrompt|"LS1043a" + gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x021c0500 + + # + # LS1043a board Specific PCDs + # XX (DRAM - Region 1 2GB) + # (NOR - IFC Region 1 512MB) + gArmTokenSpaceGuid.PcdSystemMemoryBase|0x80000000 + gArmTokenSpaceGuid.PcdSystemMemorySize|0x80000000 + gArmPlatformTokenSpaceGuid.PcdSystemMemoryUefiRegionSize|0x02000000 + + # + # CCSR Address Space and other attached Memories + # + gNxpQoriqLsTokenSpaceGuid.PcdCcsrBaseAddr|0x01000000 + gNxpQoriqLsTokenSpaceGuid.PcdCcsrSize|0x0F000000 + gNxpQoriqLsTokenSpaceGuid.PcdClkBaseAddr|0x01EE1000 + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion1BaseAddr|0x60000000 + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion1Size|0x20000000 + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion2BaseAddr|0x0620000000 + gNxpQoriqLsTokenSpaceGuid.PcdIfcRegion2Size|0x00E0000000 + gNxpQoriqLsTokenSpaceGuid.PcdIfcNandReservedSize|0x2EA + gNxpQoriqLsTokenSpaceGuid.PcdQmanSwpBaseAddr|0x0500000000 + gNxpQoriqLsTokenSpaceGuid.PcdQmanSwpSize|0x0080000000 + gNxpQoriqLsTokenSpaceGuid.PcdBmanSwpBaseAddr|0x0508000000 + gNxpQoriqLsTokenSpaceGuid.PcdBmanSwpSize|0x0080000000 + gNxpQoriqLsTokenSpaceGuid.PcdPciExp1BaseAddr|0x4000000000 + gNxpQoriqLsTokenSpaceGuid.PcdPciExp1BaseSize|0x800000000 + gNxpQoriqLsTokenSpaceGuid.PcdPciExp2BaseAddr|0x4800000000 + gNxpQoriqLsTokenSpaceGuid.PcdPciExp2BaseSize|0x800000000 + gNxpQoriqLsTokenSpaceGuid.PcdPciExp3BaseAddr|0x5000000000 + gNxpQoriqLsTokenSpaceGuid.PcdPciExp3BaseSize|0x800000000 + gNxpQoriqLsTokenSpaceGuid.PcdDram1BaseAddr|0x0080000000 + gNxpQoriqLsTokenSpaceGuid.PcdDram1Size|0x0080000000 + gNxpQoriqLsTokenSpaceGuid.PcdDram2BaseAddr|0x0880000000 + gNxpQoriqLsTokenSpaceGuid.PcdDram2Size|0x0780000000 + gNxpQoriqLsTokenSpaceGuid.PcdDram3BaseAddr|0x8800000000 + gNxpQoriqLsTokenSpaceGuid.PcdDram3Size|0x7800000000 + gNxpQoriqLsTokenSpaceGuid.PcdScfgBaseAddr|0x1570000 + gNxpQoriqLsTokenSpaceGuid.PcdGutsBaseAddr|0x01EE0000 + gNxpQoriqLsTokenSpaceGuid.PcdWdog1BaseAddr|0x02AD0000 + gNxpQoriqLsTokenSpaceGuid.PcdWdog2BaseAddr|0x02AE0000 + gNxpQoriqLsTokenSpaceGuid.PcdWdog3BaseAddr|0x02A70000 + gNxpQoriqLsTokenSpaceGuid.PcdWdog4BaseAddr|0x02A80000 + gNxpQoriqLsTokenSpaceGuid.PcdWdog5BaseAddr|0x02A90000 + gNxpQoriqLsTokenSpaceGuid.PcdSdxcBaseAddr|0x01560000 + gNxpQoriqLsTokenSpaceGuid.PcdI2c0BaseAddr|0x02180000 + gNxpQoriqLsTokenSpaceGuid.PcdI2c1BaseAddr|0x02190000 + gNxpQoriqLsTokenSpaceGuid.PcdI2c2BaseAddr|0x021A0000 + gNxpQoriqLsTokenSpaceGuid.PcdI2c3BaseAddr|0x021B0000 + gNxpQoriqLsTokenSpaceGuid.PcdNumI2cController|4 + +## --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel