From nobody Mon Apr 29 07:08:14 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 1511759037311623.8850056691064; Sun, 26 Nov 2017 21:03:57 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id CE3EE220C1603; Sun, 26 Nov 2017 20:59:34 -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 D5DB021B00DD4 for ; Sun, 26 Nov 2017 20:59:32 -0800 (PST) Received: from BN3PR03CA0054.namprd03.prod.outlook.com (2a01:111:e400:7a4d::14) by SN2PR03MB2367.namprd03.prod.outlook.com (2603:10b6:804:e::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Mon, 27 Nov 2017 05:03:52 +0000 Received: from BY2FFO11FD014.protection.gbl (2a01:111:f400:7c0c::170) by BN3PR03CA0054.outlook.office365.com (2a01:111:e400:7a4d::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Mon, 27 Nov 2017 05:03:52 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD014.mail.protection.outlook.com (10.1.14.76) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Mon, 27 Nov 2017 05:03:52 +0000 Received: from uefi-OptiPlex-790.ap.freescale.net (uefi-OptiPlex-790.ap.freescale.net [10.232.132.78]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id vAR53iMT000785; Sun, 26 Nov 2017 22:03:49 -0700 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: Mon, 27 Nov 2017 16:21:49 +0530 Message-ID: <1511779917-9255-2-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> References: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131562326324701306; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39860400002)(39380400002)(376002)(346002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(2906002)(305945005)(356003)(86362001)(2950100002)(97736004)(77096006)(104016004)(105606002)(47776003)(81166006)(106466001)(8676002)(51416003)(50466002)(53376002)(966005)(4326008)(48376002)(81156014)(8656006)(50986999)(5660300001)(189998001)(53936002)(33646002)(85426001)(16799955002)(54906003)(316002)(110136005)(16586007)(15188155005)(6306002)(68736007)(50226002)(36756003)(2201001)(8936002)(76176999)(498600001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN2PR03MB2367; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD014; 1:qd12309mmpcA8NihnRymTikHNsq6dZhXoxdwlzBly/0UD9hU5Mr6Sf1VJ90Gi+iIEuoYxLXSxhkI8NR0+fXu1eQctJNdLOygW+fkJcmGFiVITa+ezgOu6tMEOTv0XhUp MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 844b721f-faa5-4700-687a-08d5355440df X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603258); SRVR:SN2PR03MB2367; X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2367; 3:q6WETtA893feFLhb3knA71oCJjV2Ed0cU0BgpZkPqvp8G288yVca+wtE5hJGno4xJ8HtQYZyYEBo9SmUaw6I6HU/8M3Q9/wRP2ML9XLWlbKNViGekaSxcXi18OEq8spBUs2C4RjOCO6LCoEjicTr9x7cI7CI8npXGRzZF+QuSa4gPTATRGFPEHru14043/osO1lwqZz10SPAlMmFWj5ggkw5VGih6rTkrqLOVNjOJAvuNKCT/Rqrfl88Ik9NTBpf2qy3SnfsPfuOOX50xwn0v7ewXayfHoQ7jUk2aAKcE1hf62ee8Vi8/MTj2S4LfnhcoZ2noSsScVrwkiGTFlXnAOfarcnHZWAUSf6Iv/zHFro=; 25:QYsaapgUoPTO3N/4z5NtvejuJR7gcziQjeLlh6eoKxvpT+RmjWrQcQ7TfK9OU3VyLRKZuFObDtctkPSn5lwNZBQCVT+BHXsdP/dInNg/eq9uzMeYnEK7r2qX/jZA1+gt0tDS4t1cYzD17UMaCrLig0VqQuoUGhlB6IDNx5NMkMARG+aKCfPDr7Kuw0S+kMCWqR+QvqxcFyJJCrQLC6aryb729KwJbc0VHDmYUUVJXs8Ad0QFovAf+VX+d61zc5mty7kxyaiQp/1Qy7HvmDxFAXDdBdOFhYm0Gl34SXOCWDIdTLiwTgWmX0Mo0ETIWwwAdHT0LfNdQFegIX5+vRo52A== X-MS-TrafficTypeDiagnostic: SN2PR03MB2367: X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2367; 31:wHpCUVYxabkUo3mOT6bDD7U75M5ecPRE3K5cVVLPyWE+XDmcqsq2PeZKZNAupUGamCDOBqsQlG+U/322szvU058geRvbUU/Zdg4fZUL0h6GhZXKpsAgtk07uf7XwMpQEp7maOXx9zrPsk2J0vEebJmnCbWXsh/AuVVPTQQ65A31ZDSKYOj2dt05F5JSoGjhG+3kHRlhOU0Fcaw7p7RqCrFOdvOqbpOMmrtGwky1YqJo=; 4:xitzcRibfmVSJ1S6F5RK0sobq6CfRgPD243miB9mhD1AmM7UGX/J0dR0MqyumIecXzRLffe05ywLIKFY9yhNE+K0d71Pl3ShvjlUcA2sWlONpNJ9JzR00qFg7qgO9jQyuo4pN+TuDIMCEQ7VSMxgJ6CSecb8ep6anj0Fqcz+e/ae75MgaMZAJe0KQw1mqE7zgO7fiBWeXB6QCEyTbuj5xe1dlOCpGgcVDz0Qh5rq/wx92Si10DI7trUUgzKzkx5gwSrqMwvvX7Bdu9/Krlpgq2mVLFJeCOMw9Zfvum7RreXoA3EZPdiND2J8B1KOhpxu X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(3002001)(10201501046)(3231022)(93006095)(93001095)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123559100)(20161123565025)(20161123563025)(20161123556025)(20161123561025)(201708071742011); SRVR:SN2PR03MB2367; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:SN2PR03MB2367; X-Forefront-PRVS: 0504F29D72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN2PR03MB2367; 23:OrS/t2IBl1e3AF9Z84WaWWBjEm7pZatwuBt4MbxYW?= =?us-ascii?Q?eMiMoH34idn7y32BQQbQXJaVO3OJA8g1My9BpPk0pr0IHN6fcnyfsCG6ZY1t?= =?us-ascii?Q?LvHc1Rhsncj1xtdKNcXamMSLPP0qgmlg1c0N+MNoVlpq7xiflWwoDpJZrTT2?= =?us-ascii?Q?DFUl3kcVCLOm1Sjb4/rTfvIEEyHUbXvRbVjRYGKahkFNeWfCbULLwXXUpkTQ?= =?us-ascii?Q?vXd/PNaTKxnYN9Qas11cJF5BVneT+2sOlNqV0bhM4O1xNs7MlzxVS2LqvBLe?= =?us-ascii?Q?8143ctfCzbPrxsOTdS0Z54QSAq5a6oCwu5dWyppt8suEFeLR74UAfNrntLlR?= =?us-ascii?Q?OLFBDmN3UeR7ACWmQoeXcY3C5efNXVi6fVCKeVJBlZJP8ZS8JwZJPaSTHzqq?= =?us-ascii?Q?rbL0gpImDC2eAxCJbzDXBygj4l34ffJHaGR/SdXUSABag2nB4vog4qOA3+TE?= =?us-ascii?Q?r7ULOEvnA0KRvSO1ZXgPIOn7C93yEbBxMX8h3b0Wtnj/Z3aab4VQ+zrpgJIE?= =?us-ascii?Q?DyUOh1ZmFKEnkp9t1a6MC9LYq4eQ03XRogt7vxvcphNDErfttaEd661Bm2zS?= =?us-ascii?Q?vRnVc3u1Tqb/ABL9suC277jPuqAPWo2v9l1XphcSgS8/8PpIvP7gdpi+rmqm?= =?us-ascii?Q?PNZFu/kpKl27+aUn0aX31Zx9dY0ncPwbDSPiHXY3VKSAfk6yUFcqMOercSbt?= =?us-ascii?Q?zpb5SnN8ScJahkvz3vl/IeOGc0VilTRSBTkgW9w4TEQNrt6FtPNIcZvFfBRi?= =?us-ascii?Q?HV/rvF2a+OqdQCk418UXlvfYXieegNPQgMb/bIwl1G7X2ryOScah3/3gNC2l?= =?us-ascii?Q?TLetxHzHZy+eGGgyt/BhQZSVgIrbsh8+wwutMhSCdO23OR9MITCyo7nGDbzZ?= =?us-ascii?Q?4p96iquAfxjF7jj9g+/mnTL1qTmjWehWNnpg5dZo5WARYCmo7YnhcjxRxNBn?= =?us-ascii?Q?lC71xf/gWNoru0ce45gKBK66pMPJIFKA26Vpkk8LeA7IExad3H05N07d8/3P?= =?us-ascii?Q?MSb5v4ZOKoqgrX8JKiAZYLLuobP2Tyto+6zrxCQ4KVa4v/7ZgQ3asJElpu/f?= =?us-ascii?Q?CLd16n+uhtxIs/gsjLWNRlDTdGSeLYc8z1UNm2yKaZ40kvP2kEWWnr25jl5t?= =?us-ascii?Q?7Lnd7rkJtVrCsPKSDEjfZmmX3aUVMkuSH8E4R8Xi4IvHT/1KHVNh4cP3klFG?= =?us-ascii?Q?kGbi9UC5k4BEaR+ASqGkh+E4UEH7x1TO+LYeGxuKuaWP7qiv70a+xkoX4OvO?= =?us-ascii?Q?L0GMxqPE9mGPnNdHwU=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN2PR03MB2367; 6:yvgFZQdL6l4hvN/ipibC0u3iiMHHWN+TYmYzKiVnpgF1N4bnyguH2dC3QCLUHFU7vXOJzvmtkLFRE54wDcfHbopZUWryPH0t+C/6hpg+uIxfSPjFok85E1d9BfgvthZ/b2/a1g1IKYPozuYQSCU4/2gs+nMxhJWnqxVCrAfYy7zCJjOudwjDOjCf3vqZ1srkvYkyAVe2SXW/DprqkLm+3ZS3cAfzymNsLaOchHboroDnmJN3ONvFlV1gQtxGm+Zu4GMrfClKm7/uTuuVmOhCWbgIX443OnLlmj3diLKNmigk+KgwtH47r48qx3WC74va3KpPfS4/3cPiO71k1zH3g6L96leWTt14uo872/RVeLY=; 5:qTgnEt0EB3K21fHJANpiGWE2pL+mfEvhHLGv6DToUf+zrG9XlMeCOrbLAheyvnrEL12vHEPMILxA5raSecsjLSbHnT7klo3mdcRHV3bNHRE/de7SLr52OAdQqRFghJ9KTqZPDb4IZa7pn4k2Lkd8upZtKObHHshxHQLEdvqI4lk=; 24:A3cXeXUNjHcMWZRstZM2N3Vx3XzmKoQkeEIERVKMClJk9Zbs8Cjbi5vyua7K1c5frkPr/68PBKy8RCVrVSGz9tjoiGZ9ZVAHG9f4FUKpHro=; 7:1hzlpZDj68bIUbsKrn7/BG0WCkFOTiB6nWVRBAjFV9kGtYBSBg7BMXEqh2Ac8mCmBi+tV7Lcfpr/e1qPvTXzL0KpGcDLKTzUtluE68PtDHIGt9HFAXYKu+/1Igcgypm+sIW5zSZ+A0Vzj8wEWc58gpe/pfcyr8a5MURGD7J6XGDTnYIYiFqo2p47g7Xa9nWva+jO7+2p2KskicJQHNBIrVBealAVWUUtVAt048qAxe5WJqIB3i/fink233Qy2m9Y SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2017 05:03:52.2673 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 844b721f-faa5-4700-687a-08d5355440df X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN2PR03MB2367 Subject: [edk2] [PATCH edk2-platforms] [PATCH v3 1/9] Platform/NXP: Add support for Big Endian Mmio APIs X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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..639674f --- /dev/null +++ b/Platform/NXP/Include/Library/BeIoLib.h @@ -0,0 +1,332 @@ +/** BeIoLib.h + * + * Copyright 2017 NXP + * + * This program and the accompanying materials + * are licensed and made available under the terms and conditions of the = BSD License + * which accompanies this distribution. The full text of the license may= be found at + * http://opensource.org/licenses/bsd-license.php + * + * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 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..c3d2cf8 --- /dev/null +++ b/Platform/NXP/Library/BeIoLib/BeIoLib.c @@ -0,0 +1,400 @@ +/** BeIoLib.c + + Provide MMIO APIs for BE modules. + + Copyright 2017 NXP + + This program and the accompanying materials + are licensed and made available under the terms and conditions of the 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..7e8e32c --- /dev/null +++ b/Platform/NXP/Library/BeIoLib/BeIoLib.inf @@ -0,0 +1,31 @@ +## @BeIoLib.inf + +# Copyright 2017 NXP +# +# This program and the accompanying materials +# are licensed and made available under the terms and conditions of the 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 Mon Apr 29 07:08:14 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 151175904068688.87454979638164; Sun, 26 Nov 2017 21:04:00 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1B72521B00DFC; Sun, 26 Nov 2017 20:59:38 -0800 (PST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0049.outbound.protection.outlook.com [104.47.36.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 B5C2421A1099E for ; Sun, 26 Nov 2017 20:59:36 -0800 (PST) Received: from CY4PR03CA0099.namprd03.prod.outlook.com (10.171.242.168) by MWHPR03MB2702.namprd03.prod.outlook.com (10.168.207.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Mon, 27 Nov 2017 05:03:56 +0000 Received: from BN1AFFO11FD011.protection.gbl (2a01:111:f400:7c10::178) by CY4PR03CA0099.outlook.office365.com (2603:10b6:910:4d::40) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Mon, 27 Nov 2017 05:03:56 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD011.mail.protection.outlook.com (10.58.52.71) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Mon, 27 Nov 2017 05:03:56 +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 vAR53iMU000785; Sun, 26 Nov 2017 22:03:53 -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.49; 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: Mon, 27 Nov 2017 16:21:50 +0530 Message-ID: <1511779917-9255-3-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> References: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131562326361799950; (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)(376002)(39860400002)(39380400002)(346002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(50944005)(106466001)(498600001)(76176999)(15188155005)(16799955002)(189998001)(53936002)(50986999)(33646002)(53376002)(105606002)(4326008)(6306002)(5660300001)(50466002)(2950100002)(48376002)(47776003)(966005)(2201001)(305945005)(2906002)(104016004)(356003)(8656006)(81156014)(81166006)(8936002)(86362001)(36756003)(316002)(97736004)(110136005)(50226002)(68736007)(8676002)(54906003)(16586007)(51416003)(77096006)(85426001)(171213001)(44824005)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2702; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD011; 1:5Fl9SZ8MzjlucoosPMDxd47xOe7zIffAx7G1rDtcrQDRKeNCHzLPxcVZSjOwTV2Om4hLXxrtX9cKH+HU6P+9RYvX7NvNEocAVqEqbgXSYGpwFeDYJ5RkaQ7fB77qQVaz MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 873ab576-b5e1-4996-7d0e-08d535544315 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603258); SRVR:MWHPR03MB2702; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2702; 3:EYEDiRS9HjHRtwxZl5pFjml7pjVrezG4BcnqdT87Q+8b1FRVx/0TDHFhcgnTHgOdw6Kxqutt9CqxyAwENuWvCEH4FNRDIS3wgi6vOkmaddn3ZOFYVnMHPpKkR6fGXOP+fBsFzeaYeSg/K8dCFP/zOmit3d5xW54sBM9gEx3cVmPuhbiTYlOV6mxJxCuh4eFHGvJQrTHrxF6ZQbxe5DK/NNcpcDlvc6uNNgzjtVfxSnOo0uAnFF/RZF9n0i26m1A4KT3if7ZEo/ljrBZyJsOrHps1JWYtYlumlwSx1VtDt+LMVAk78FFX4AOre6suh+BssFOavJz1bTJ1ZzxR0abfFDTbG1qjv8tzzUMZ6cr1PVo=; 25:kDnuk0RXx3INsm1AOvcv0WarWdWLkuodIHTjPyiPzt+5ZVLWNbB9yNFFO9aJLsMI1sYhQmn+7H2B8+Z/DflQtb+jO53b33r3VZdnBfWzI6pTO/EBDIchtnvH7+DZUyUaZ7q57/g/jkqm+oSLdCLQ3kTBes0eIInrMQ/jSOj0L7/X90LDEkLlUO4turSh8HeF8eYPpPkzi9pcm52NHU5cHDhiHUF4piZUOOIJk/LOQufy5bKiI4oJxntJpTGOwO38VtNpuhOk3US0DArOGLV4Hm+8LAEt5H7X9pa3CNkE462a5DMJfajZrDgK7hIGa53K9wxbyrOh7ze0hGravOS2ig== X-MS-TrafficTypeDiagnostic: MWHPR03MB2702: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2702; 31:jnZBWf9Uu1tIPlromPzDqvoW+Ewcf/1sZQGhmEdt1p2epm4ivG1CyEXkOH1K+BYpdIChOr67eqIJ2NG336iTG02eKaiWLK8/RI/PVImuf4+uxxPUHOUgjQl+QG1WJyx4b6vY9A+19qCJgYeoo2/AQxJy1pPjsTXnnuoBRT0fwlXb0rAb8wsS4p/UIbxBJTTEjRd0+/PYU0LStvnxvMYF11Dol3AEOeKw398cs2xx0qU=; 4:wZC/LdjbMPR7tscrTpfCSGiFcubiGw8NfqOsv503TarOZD8JOfYzbwVbhC19v3Zcxger8D00Qu+XENP6GbhKs4IF4Tc0w7oJza7z7+C8TkUiJWZtUjkoh9dfoG3PxaZ2kMOCu0N9DpnuU8a4+a0mASRE6KSJQeAXeYUgfi9RkZMnCqXfVKIiLA3mgb2duVRpt1e/p7Atki0+a8mM+uqEsWuypJgXiYY5RGzr1j2k02Jw/7qa+vhwtE4CAQwDE49mAJP2B9oqCA6UKnhVC1rxDEaV5bMvzxxRCHrL5z7t6QJsSYulue9UqlOlOvrthSS6 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231022)(93006095)(93001095)(6055026)(6096035)(20161123565025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123559100)(20161123556025)(20161123561025)(20161123563025)(201708071742011); SRVR:MWHPR03MB2702; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:MWHPR03MB2702; X-Forefront-PRVS: 0504F29D72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2702; 23:COQAiSp5FuYED6ArA5hc2u41kIuFa6aLctvmG2ieg?= =?us-ascii?Q?bRblU+MRxkMit1FPjkO+rH7llvMgnqKcnhfKEdBQEE3D8rqQom2LAbzKVrcx?= =?us-ascii?Q?FcQqvd4a9gO7Pjh/89V5REBzdsafAImvPFH897F1hm7jdbH26Sh73qzYdZfQ?= =?us-ascii?Q?EjHzwo8TYCiL3aMW94zsUDavBa0dNPAcuBaXgeTbn3x6DTdNn3Dn6yI8RcmK?= =?us-ascii?Q?KiRptl7dqHBK3tXLJZ6WtM0XGP4erD1uvq5PxO5vEhRFC87bBnWVd5x/ymj8?= =?us-ascii?Q?ufR7+fGQ/NDO4ZVwscx5dix+QKeo8AAj9Mxeik8qVZLPDNXQ0Rs1hCusbWZ3?= =?us-ascii?Q?wWv6Y+gosX8ZwiUaoH/qvYe3i36ya91db+zJlJ/mcJvtIhdWUoe0My03nBgx?= =?us-ascii?Q?XEbHuhIWrq+mtRJL7APGfpChQpA5MWXU9st2r8fYsz9KIEeVhD/U9cPa3DaM?= =?us-ascii?Q?kLDE8WHXXIeV5n3Zq2cDvhtxCCdWsAkvUTzwHSX0ypAh3Cc97M1R7fHZHejp?= =?us-ascii?Q?2i8kXsH0wUINSYHDBK8Vvyqj3EDodw2WzawfGc26Udw27VHC2N4MT6Ac1Dj8?= =?us-ascii?Q?0ALWxWs2z8hoxsHSPB65mALwof4kJ+h2PpzydpyTUMQkFpq+pPMSg0rquq2m?= =?us-ascii?Q?+JQLACCn0FzDkVAL/W0N7MeADsGpGWZv8rMQTs1dppD8RnfxVT6RW6gw1jci?= =?us-ascii?Q?g7RYZ8IJrJjNPHpu4SstKTSVrlyj+mTIc5fI48zqIXK592nTKADVP4QPyzAy?= =?us-ascii?Q?+5yZxRbeFTjJUCocre6DUAfCDwxZ9XC1SC3ChARDqUdyEo0+MpwLYADr3lYf?= =?us-ascii?Q?VL1ywHcfjfhikRqMlBxJA8KA0grqFmtln6ifrRDtLXDQKgJruwBWVfkwt+X7?= =?us-ascii?Q?+EL68taMdHOY90ORfAgGOBZ/pX3wMGpbdJjbme1m009w76EF3jioC3iCZDqg?= =?us-ascii?Q?9wvoAZzyz5b1xNOXEwFY7TxLOM5idPyCWPUWFdhPe+w7aEp5gPG1eieK2Q2Z?= =?us-ascii?Q?pOVs2Q1CguJ5yE9eoaA0MhapeJsNXBdHAA0JFzpWWVwW1EAqodpgMyoCFEUg?= =?us-ascii?Q?JYvP3H5EhkAUeXltoh8vaY7msD8RXzIDqIdSD8qgmrshMcp7BN7jvK4zolIR?= =?us-ascii?Q?z9p0CjHUZ6t/VVUvGMA5H6eL5MeW0BpmGPKE+cZybKX2TlGDPuyj3Z1iXbgt?= =?us-ascii?Q?zbA51PRLo8kG0fiLXs3Xg1M+btEcPqzMfHwfhWtp0VyX++GMwY63o1DEnm2n?= =?us-ascii?Q?Oz/DlR6XVXF+adgQ4Qsc7/kKKN3ohMlPZMP86XaJzFMFBRsbUAAklzkg8et3?= =?us-ascii?Q?A+ZfrLM8o2tpEHkFJ39YGEsMnBxvWhGSZHUIlKbNzUj?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2702; 6:njxV15zu62WxA5PHXMksf8wb8t0JqmmmSJy8FOOvh3HRYxQ5my8QcIsG2AqB1M3mjdPYfZ2WUS7gFEvPZjRnsO4l8y7CdQi7FP4OzHH1R/VyovBq3xOLGjPkEl63KQ+0aZKYxB9o81KaYveXn26LA1Us+sjI5PDteukFUCARWGvxNKWiz68sa7IRRFZPAOEtEv8gQoGQ3CJVFNfs9fKijwowoMhNuJoUSoFmoKdSQd0wtwd1b+gySv5knvDsYjM0c5P98kGq7d+390EMt/MtyJjIa46pbsIUEB+jHj/9g72MUu224mAHfwUDgOZssHK/wXdyZj1EDDeHq+YiMLbhApTNEbRMDaO9+Zj9yvfMvUc=; 5:qxxjR1h0TWx3FKGYdNznoRAuaMY9PTk84f8JERSVusB/YmejZsRzWVcUpzZlOT2/eRzt5MP7/4Q5201h3YIf0YNNOxGSxQPR2I2mgikxtgwstQqZPdoW2YrM0SP/3VWCo4R20dH52DuksVRuVA8JwnVeorfm2QwY8SLQUa9T/tA=; 24:dr2fRyHpuNurNlF95OI88jjy78OIn43HrYriHtZg+cUa1q6taV2vrGg6sNMGiBdKJwWv463vvw9v5YX2OAOI6KSV1BbY0AYuUFwCaAriE50=; 7:MioEKfr5XFGhmn4gOYRkj+d2XEuLssKTIuOoQg5Hso3zH/5kkjfwL/iViNAmk4W3YuVD0BR065L4NAsMglwxniW0HVlOoR+M86HHV00FeG0vgMxqP6NmQvwag5fe4mC5kzO0MPwOEG2N64pUZWGmy+t28NLUn2EpW5stYf8TU1Fyd5yxJchi2kWrtF7u04pOpvaHN/mqST78zptUoAFwFmDUVQrtfOUs6/7Ggj1L80mIC5BDBT1dD1wfU1IN3QHy SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2017 05:03:56.0083 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 873ab576-b5e1-4996-7d0e-08d535544315 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: MWHPR03MB2702 Subject: [edk2] [PATCH edk2-platforms] [PATCH v3 2/9] 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 | 421 ++++++++++++++++++++++= ++++ Platform/NXP/Drivers/WatchDog/WatchDog.h | 37 +++ Platform/NXP/Drivers/WatchDog/WatchDogDxe.inf | 47 +++ 3 files changed, 505 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..a9c70ef --- /dev/null +++ b/Platform/NXP/Drivers/WatchDog/WatchDog.c @@ -0,0 +1,421 @@ +/** 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" + +STATIC EFI_EVENT EfiExitBootServicesEvent; + +STATIC +UINT16 +EFIAPI +WdogRead ( + IN UINTN Address + ) +{ + if (FixedPcdGetBool (PcdWdogBigEndian)) { + return BeMmioRead16 (Address); + } else { + return MmioRead16(Address); + } +} + +STATIC +UINT16 +EFIAPI +WdogWrite ( + IN UINTN Address, + IN UINT16 Value + ) +{ + if (FixedPcdGetBool (PcdWdogBigEndian)) { + return BeMmioWrite16 (Address, Value); + } else { + return MmioWrite16 (Address, Value); + } +} + +STATIC +UINT16 +EFIAPI +WdogAndThenOr ( + IN UINTN Address, + IN UINT16 And, + IN UINT16 Or + ) +{ + if (FixedPcdGetBool (PcdWdogBigEndian)) { + return BeMmioAndThenOr16 (Address, And, Or); + } else { + return MmioAndThenOr16 (Address, And, Or); + } +} + +STATIC +UINT16 +EFIAPI +WdogOr ( + IN UINTN Address, + IN UINT16 Or + ) +{ + if (FixedPcdGetBool (PcdWdogBigEndian)) { + return BeMmioOr16 (Address, Or); + } else { + return MmioOr16 (Address, Or); + } +} + +STATIC +VOID +WdogPing ( + VOID + ) +{ + // + // To reload a timeout value to the counter the proper service sequence = begins by + // writing 0x_5555 followed by 0x_AAAA to the Watchdog Service Register = (WDOG_WSR). + // This service sequence will reload the counter with the timeout value = WT[7:0] of + // Watchdog Control Register (WDOG_WCR). + // + + 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 reload counter with maximum value + + WdogAndThenOr (PcdGet64 (PcdWdog1BaseAddr) + WDOG_WCR_OFFSET, + (UINT16)(~WDOG_WCR_WT), + (WD_COUNT (WT_MAX_TIME) & WD_COUNT_MASK)); + 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. +**/ +STATIC +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. + +**/ +STATIC +EFI_STATUS +EFIAPI +WdogRegisterHandler ( + IN 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. + +**/ +STATIC +EFI_STATUS +EFIAPI +WdogSetTimerPeriod ( + IN EFI_WATCHDOG_TIMER_ARCH_PROTOCOL *This, + IN UINT64 TimerPeriod // In 100ns units + ) +{ + EFI_STATUS Status; + UINT64 TimerPeriodInSec; + UINT16 Val; + + Status =3D EFI_SUCCESS; + + if (TimerPeriod =3D=3D 0) { + // This is a watchdog stop request + WdogStop (); + return Status; + } 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; + return Status; + } + + // set the new timeout value in the WCR + // Convert the timeout value from Seconds to timer count + Val =3D ((WD_COUNT(TimerPeriodInSec) & WD_COUNT_MASK) << 8); + + WdogAndThenOr (PcdGet64 (PcdWdog1BaseAddr) + WDOG_WCR_OFFSET, + (UINT16)(~WDOG_WCR_WT), + Val); + // Start the watchdog + WdogStart (); + } + + 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. + +**/ +STATIC +EFI_STATUS +EFIAPI +WdogGetTimerPeriod ( + IN 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. + +**/ +STATIC +EFI_WATCHDOG_TIMER_ARCH_PROTOCOL gWatchdogTimer =3D { + WdogRegisterHandler, + WdogSetTimerPeriod, + 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; + + WdogAndThenOr (PcdGet64 (PcdWdog1BaseAddr) + WDOG_WCR_OFFSET, + (UINT16)(~WDOG_WCR_WT), + (WD_COUNT (WT_MAX_TIME) & WD_COUNT_MASK)); + + WdogOr (PcdGet64 (PcdWdog1BaseAddr) + WDOG_WCR_OFFSET, 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; + return Status; + } + + // Install the Timer Architectural Protocol onto a new handle + Handle =3D NULL; + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &Handle, + &gEfiWatchdogTimerArchProtocolGuid, &gWatchdogTimer, + NULL + ); + if (EFI_ERROR (Status)) { + gBS->CloseEvent (EfiExitBootServicesEvent); + Status =3D EFI_OUT_OF_RESOURCES; + return Status; + } + + 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..1de308b --- /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..63b0816 --- /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 0x0001001A + BASE_NAME =3D WatchDogDxe + FILE_GUID =3D 0358b544-ec65-4339-89cd-cad60a3dd787 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D WdogInitialize + +[Sources.common] + WatchDog.c + +[Packages] + MdePkg/MdePkg.dec + 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 Mon Apr 29 07:08:14 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 1511759045965624.370091394702; Sun, 26 Nov 2017 21:04:05 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 58803220F3C55; Sun, 26 Nov 2017 20:59:43 -0800 (PST) Received: from NAM03-BY2-obe.outbound.protection.outlook.com (mail-by2nam03on0064.outbound.protection.outlook.com [104.47.42.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 109D221B00DD4 for ; Sun, 26 Nov 2017 20:59:40 -0800 (PST) Received: from BN6PR03CA0007.namprd03.prod.outlook.com (10.168.230.145) 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.239.5; Mon, 27 Nov 2017 05:04:00 +0000 Received: from BL2FFO11FD015.protection.gbl (2a01:111:f400:7c09::176) by BN6PR03CA0007.outlook.office365.com (2603:10b6:404:23::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Mon, 27 Nov 2017 05:04:00 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD015.mail.protection.outlook.com (10.173.160.223) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Mon, 27 Nov 2017 05:04:00 +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 vAR53iMV000785; Sun, 26 Nov 2017 22:03:57 -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.42.64; helo=nam03-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: Mon, 27 Nov 2017 16:21:51 +0530 Message-ID: <1511779917-9255-4-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> References: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131562326406445227; (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)(39380400002)(39860400002)(376002)(346002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(85426001)(77096006)(53936002)(47776003)(575784001)(86362001)(36756003)(54906003)(50986999)(50226002)(50466002)(48376002)(16586007)(110136005)(76176999)(8936002)(966005)(498600001)(51416003)(2201001)(2906002)(105606002)(53946003)(68736007)(4326008)(53376002)(6306002)(316002)(8676002)(81156014)(81166006)(189998001)(2950100002)(6666003)(8656006)(356003)(5660300001)(97736004)(104016004)(305945005)(15188155005)(33646002)(106466001)(16799955002)(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; BL2FFO11FD015; 1:M3zbGccjvGc+yi+1LgIuFtbTUjssjQ0ONuegWDg7zH/oSx8DZNEi8ZW/XRQrqRlOOf2TYORlN8w5JfpaaGK17Hv7oc1abmQ3k+82InfbWAm7jD0qp7c4xfyR5WAoR3UI MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 66ebb1ed-8e4a-4657-574a-08d5355445bc X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603258); SRVR:BN6PR03MB2692; X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2692; 3:fBpk/A/Q5GwcYGLbWSdZeY/iodSEiLyuhHtQeuaAjUklBJxUUizJWkdiAFMl3rzfUJO10OghUHx+vhtcQ+YpQIdmlij8J91ZnCZXTJwozpHp6Jzj7jpNemSb0Xio50oMWRT8A48CYsBCjpE8HIKszF6QStcOkWwyHYlenAx8tKgpm7MRCWdCT0zO5yJiXkmQWTAva0VKcv9onQopfvKp0ZUDI2I2M5zmz0dTVN5swAwryVdCjtqx6BtwwY5ZBwom4s4ucfF52zmXdjWKTZcz6lewPNVe97O9uzVwsm4EKx4j3aXvlDi++/vLdcP8xT8mn7G+9FgiUjgWBSkvJzJ8bPCJmCINcmQd8FkXbfb+Dsg=; 25:zyUtEGlFaMGYgBJPZc4GST47SY1nOXVwojMBC5R9gLJWQpPwEyNUR0gljavnYRF5u142ogH+TgzsD2rvovSebQLz/Vvxn16OW9V/XhWzFDDcIc0lPRO/yFQfm6OSyNypKHXBeCmKP9FH6sFon744LuEysI/kab71O8sO+RyQrUnw9Hi2TV9hKNCGSWvnGMWgqoU0vf9FfThDvIjZ//1ClRIprI6bNcO7dxcu/ivOMTwGiN3hi58Nr4xcQ8g6kyxmxlvRDsGjma3L+F7r6hV8aiGl4Of9F1Z0OvI0hh749j4B6BitoAeAe0+k/DYC6yhlluLgXAe4ptq/D2cyElrdvA== X-MS-TrafficTypeDiagnostic: BN6PR03MB2692: X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2692; 31:CKgIUnbYAxvG3Nb+RB5tZrLdzWWvzlQrixH3R+nbJ3sZwQPqo6KY/epY9dzMH9hpxZPzzU/NF1JbPBYkurN5Byt5cf2i7HOs+s6js61ulVwrBBt3fqF8NCvbQY9xwRs8nYb9VyIu038kkICDEsrksGFhAFg6vB/o0T8e2/HigOihRgZR08PiOUAZtCuPerHJd30Ln9Y8kqPQrwwLkW5whMgWXFi7gUEnqSYoPZ30JkQ=; 4:3JdFeY5NS38uoA38hEmTXZnCzX5DsQAdxbGKvNeCCs8oN0xXp/htJe/hgToJHBWuEQdt+061e155JLP4+FffKeLhJrB/T/wh30HDpp6UdgRpHPkygmoByPSIIFZ+5l+xQjgvnrCeH7yvyJonLwAh9zlYM3LZeY/4Nro38AZBd/nn2Itp0Hq4e0griNkd1oI07t8tlhPlfZ2uhVKSF1ji9nvChV0aMvpPuHPAtElAK7qBoygMmtxzmvt4QVoyixBKromHShZ24uVcg+zxFrLRiHfNNZ7vpO+GYZb1K9xs/PxmnnSlSqAfMDXOwjCcqHE4 X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(10201501046)(3231022)(3002001)(93006095)(93001095)(6055026)(6096035)(20161123561025)(20161123556025)(20161123565025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123559100)(20161123563025)(201708071742011); SRVR:BN6PR03MB2692; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN6PR03MB2692; X-Forefront-PRVS: 0504F29D72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN6PR03MB2692; 23:HAyhlfebblhaYB1+1jncZJ8mw8K8SZewrZlqzVjgw?= =?us-ascii?Q?D2dwSUVilpmN90ktF6M//pGHMmzJnRvpM27C2BLEVHkEY43Ucy9NqiMsJXZe?= =?us-ascii?Q?e5/Qs91Zn3ztw+2zQsAq3+OC7RYdCpvpWmtuZ0Q/BddRQ4TgrHVvCdmZxnMc?= =?us-ascii?Q?uSj/gWvZ+0HMEFyaeIPOOZBLN4RN1irrdBAOv0B3X5du6AOafVsz2/+fQEjw?= =?us-ascii?Q?UApz2ldLUYuZ+DEfvXqqx9dIWCx8oQHRdRIUqhtqpZSBUA382cPjQg19Se6m?= =?us-ascii?Q?ifzprgKHoJVeu7w4L99WX3AdMzT/K2MMRM73BRrnt5lMv38cnDpLRtUxIEFi?= =?us-ascii?Q?TumPxADleKpgAuAScaIKE1qaq/sH2KsqqwPAhHce8gq/WgghLjcfyyYxNkNe?= =?us-ascii?Q?A9QoRlTDeqzn0AZ2I81Bh/SyWEDZcT9XZQ17UrzKQMvZ3KVSQs+Ea6WiZJsj?= =?us-ascii?Q?C0S5slN0QMLW1PRd1w8WGuhqg/lp5N32Fex3CdcRIqa5tQSZUn/txDEeO9oW?= =?us-ascii?Q?uVyjT1KphDA92xD6ZoS1OcJCHWOCe3hYQm8Oj04zwvtkAW7UP9gQDV/jlx2E?= =?us-ascii?Q?TWvrCrO0LLXtaYk8qiRRIDWj7Q0zvwcNJrE0HP9qt6dSWroLJ7Y+ZSTF4SKj?= =?us-ascii?Q?EPgvB8VR0YCk2LAnPx23TOVGkRq3KSzo7eWv7na+mPdOf1vLr4qrFAnMsBXs?= =?us-ascii?Q?A0kXeMK1i/wCAkx8FNaes4+6WffsXdFtoSlGo6Hkt+mYDTKnxhm3qjrArCz3?= =?us-ascii?Q?hqiMzzCglbhnpBWF/JbT48XSpH7YWPJsc8ey62jvnOrInnIYzw5FUqtF+cxy?= =?us-ascii?Q?7XCILJOoDhq+rrV+WTC+koH/5Zt8PKythSBkMgTLlIDJiakjLgDRiMH3osg3?= =?us-ascii?Q?1uZYLDgoF9o47SCJ/0OCstj8wHJAK7VxRYo66Jt9yCRVcMCHF+F+4va4GVPx?= =?us-ascii?Q?ykPKeJGbtxsUNZNalAoQBtIGtB24ZKzUgK+Ajsea+hhdX+eicE+wLK4q/jUR?= =?us-ascii?Q?/xIaM5vZhC62pcQll8wqAB6ULtXLVfaHzo7lTlyFbP06aNO8+xWlBjXM9dAe?= =?us-ascii?Q?7bplsestAdbNiJpqTffo3N+iiGIcfKr6oCy/2ToV0cTUQvovuNGxbyCApiM5?= =?us-ascii?Q?VDQTCGgHGbPhVRQGpVuK3fYaX38oE0+KDwEwsCeVDg2JTMyjMBWa2x2XWTRZ?= =?us-ascii?Q?HqPKhoxspbdRR/7uNzM0f9RzCHEqgNCQqYHeNtasIcRsHts46kY6VeS84MzY?= =?us-ascii?Q?98bFD6krPwlbz6dC0kfqgYdrfP9OwW4Y3zz0E1514EXHEe9YMmOFXnzEgQvo?= =?us-ascii?Q?WUWd2ZbzFlRzv0342D6XK81XOlkg/Rm9w3ZNwHn3MyKJo3IrnqHW2OGSSK0K?= =?us-ascii?Q?iqD6wOZ1JOeQC/kZrt6OsHP98zGOMkeSbN9QqjATlIN2IV0?= X-Microsoft-Exchange-Diagnostics: 1; BN6PR03MB2692; 6:MrJwwuj1bk7UuoRAJMOYRxRz8YLmaEyYVjS2xHDMtLFyDy71Q9h4UPbWNJtputD1OM2e6VbQ7WZtsRQ2wDzzAXBfm000HSVLQSDQor9nOnXHql7rmdQnDyUdGP+YwrhAV9xup796RlkpfQR4qwZjpY5UFQYkQ90fVgXoqYco19Ell9RO9uThhw1svMODroOYyt8znYrN1RlFDIRUDB27QDcr20yLIdUCnovVEOtRsjoYarqFC+1lFJjplFKKEq2L68GkehTlthUjemdbQhcj+O595ZiKI3nekcimOI9m1XiAOoWeng7GtEJmOkzmAQjdAlmFmMlHEi6rGGEeIkIhSQoFNPlzc+AkhDURFZBjoJE=; 5:43Vg3vf/blamckO6ym/cDkGS/+gFvLH0ZIyEVNICW48LEMl2rw+F1yHShMfBOit2CWOllzKf2oW5hG1GFLjCp8vG5zWJYJdE0Ys8CxGiBQXOvyVd90ob/yQHA5eZFc/QK/7yC8h8quBwhYfnvviu5YWrH9Qzl7UxMcUeyN+UrU4=; 24:uzRHRMNLFJj+VpN1GgwHn/p6jooeW+Pu7h5a2wI/fHurYUra5Q7q7m6RPcsFhpcaTkdbfMvY9tbhJFvBzzAPaQrY1dWfVXH0465jiQ7YW7U=; 7:9ZmQzw7CTF0T65IbI77S5RzUORv3qnBsRqJe0nBYYWqXJlM5CsAYUqGhP7O4eLUO5XwzhhJA6hQ0mMrS958Yx5hqIZXyc2nSdWbCif0NTVsye2W2HaO9534xeyBX4YZZWGd+cNN9fuhaTpA2OZYJ+ypp1RYsOST+kwkFfPkgnO6l+mMuLwdaCUgA0vB7OYaXK+9z9a8AfvDqyKKpjDDXsjHB5ZwX0glnveSlIuctr70j6KNsCzePLGWECpK/RBzw SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2017 05:04:00.4729 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 66ebb1ed-8e4a-4657-574a-08d5355445bc 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 edk2-platforms] [PATCH v3 3/9] 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 | 413 ++++++++++++++++++++++++++= ++++ Silicon/NXP/Chassis/Chassis.h | 144 +++++++++++ Silicon/NXP/Chassis/Chassis2/Chassis2.dec | 19 ++ Silicon/NXP/Chassis/Chassis2/SerDes.h | 69 +++++ Silicon/NXP/Chassis/Chassis2/Soc.c | 145 +++++++++++ Silicon/NXP/Chassis/Chassis2/Soc.h | 376 +++++++++++++++++++++++++++ Silicon/NXP/Chassis/LS1043aSocLib.inf | 47 ++++ Silicon/NXP/Chassis/SerDes.c | 254 ++++++++++++++++++ Silicon/NXP/LS1043A/Include/SocSerDes.h | 55 ++++ 10 files changed, 1701 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/Chassis2.dec 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..3d6f111 --- /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..fb5c1c4 --- /dev/null +++ b/Silicon/NXP/Chassis/Chassis.c @@ -0,0 +1,413 @@ +/** @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 "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), +}; + +/* + * Return the number of bits set + */ +STATIC +inline +UINTN +CountSetBits ( + IN UINTN Num + ) +{ + UINTN Count; + + Count =3D 0; + + while (Num) { + Count +=3D Num & 1; + Num >>=3D 1; + } + + return Count; +} + +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 CountSetBits (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 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):%-4d 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 "))), + SysInfo.FreqProcessor[Core] / MEGA_HZ); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + } + + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "\n Bus: %= -4d MHz ", + SysInfo.FreqSystemBus / MEGA_HZ); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "DDR: %-4d MT/s= ", + SysInfo.FreqDdrBus / MEGA_HZ); + SerialPortWrite ((UINT8 *) Buffer, CharCount); + + if (SysInfo.FreqFman[0] !=3D 0) { + CharCount =3D AsciiSPrint (Buffer, sizeof (Buffer), "\n FMAN: = %-4d MHz ", + SysInfo.FreqFman[0] / MEGA_HZ); + 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..b75a9a0 --- /dev/null +++ b/Silicon/NXP/Chassis/Chassis.h @@ -0,0 +1,144 @@ +/** @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 + +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)) \ + +#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)) + +#define MEGA_HZ 1000000 + +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/Chassis2.dec b/Silicon/NXP/Chassi= s/Chassis2/Chassis2.dec new file mode 100644 index 0000000..c7fc65b --- /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/Chassis/Chassis2/SerDes.h b/Silicon/NXP/Chassis/Ch= assis2/SerDes.h new file mode 100644 index 0000000..c27e7e6 --- /dev/null +++ b/Silicon/NXP/Chassis/Chassis2/SerDes.h @@ -0,0 +1,69 @@ +/** 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 + ); + +#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..ff9575a --- /dev/null +++ b/Silicon/NXP/Chassis/Chassis2/Soc.c @@ -0,0 +1,145 @@ +/** @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 "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].Pl= lCnGSr) >> 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) >> 2= 7) & 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 (PcdPlatform= FreqDiv); + PtrSysInfo->FreqQman =3D PtrSysInfo->FreqSystemBus/PcdGet32 (PcdPlatform= FreqDiv); +} + +/** + 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..f7bfab7 --- /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..a7c6ee5 --- /dev/null +++ b/Silicon/NXP/Chassis/LS1043aSocLib.inf @@ -0,0 +1,47 @@ +# @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 0x0001001A + BASE_NAME =3D SocLib + FILE_GUID =3D e868c5ca-9729-43ae-bff4-438c67de8c68 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D SocLib + +[Packages] + MdeModulePkg/MdeModulePkg.dec + MdePkg/MdePkg.dec + Platform/NXP/NxpQoriqLs.dec + Silicon/NXP/Chassis/Chassis2/Chassis2.dec + Silicon/NXP/LS1043A/LS1043A.dec + +[LibraryClasses] + BaseLib + BeIoLib + DebugLib + SerialPortLib + +[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..55e95fb --- /dev/null +++ b/Silicon/NXP/Chassis/SerDes.c @@ -0,0 +1,254 @@ +/** 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 + +/** + 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. + +**/ +STATIC +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. + +**/ +STATIC +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", = Prtcl)); + 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 SerdesProtocolMask Serdes Protocol Mask. + @param SerdesProtocolShift Serdes Protocol shift value. + @param SerDesPrtclMap Pointer to Serdes Protocol map. + +**/ +STATIC +VOID +LSSerDesMap ( + IN UINT32 Srds, + IN UINT32 SerdesProtocolMask, + IN UINT32 SerdesProtocolShift, + 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]) & SerdesProtocolM= ask; + SrdsProt >>=3D SerdesProtocolShift; + + 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 SerdesProtocolMask, + IN UINT32 SerdesProtocolShift, + 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]) & SerdesProtocolM= ask; + SrdsProt >>=3D SerdesProtocolShift; + + /* + * 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", Devic= e)); + } + + 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..cee0da9 --- /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 Mon Apr 29 07:08:14 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 1511759049092590.2624648440177; Sun, 26 Nov 2017 21:04:09 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 94095220F3C59; Sun, 26 Nov 2017 20:59:46 -0800 (PST) Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0089.outbound.protection.outlook.com [104.47.32.89]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id C222321A1099E for ; Sun, 26 Nov 2017 20:59:45 -0800 (PST) Received: from CY1PR03CA0042.namprd03.prod.outlook.com (2603:10b6:600::52) by DM2PR0301MB0735.namprd03.prod.outlook.com (2a01:111:e400:3c0d::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Mon, 27 Nov 2017 05:04:05 +0000 Received: from BN1BFFO11FD046.protection.gbl (2a01:111:f400:7c10::1:134) by CY1PR03CA0042.outlook.office365.com (2603:10b6:600::52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Mon, 27 Nov 2017 05:04:04 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1BFFO11FD046.mail.protection.outlook.com (10.58.145.1) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Mon, 27 Nov 2017 05:04:04 +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 vAR53iMW000785; Sun, 26 Nov 2017 22:04:01 -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.32.89; helo=nam01-sn1-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: Mon, 27 Nov 2017 16:21:52 +0530 Message-ID: <1511779917-9255-5-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> References: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131562326450216444; (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)(39380400002)(376002)(346002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(47776003)(2906002)(356003)(68736007)(97736004)(305945005)(8676002)(81166006)(81156014)(51416003)(86362001)(50986999)(316002)(50466002)(16586007)(2201001)(15188155005)(54906003)(104016004)(5660300001)(76176999)(575784001)(16799955002)(36756003)(110136005)(498600001)(33646002)(53936002)(6306002)(966005)(53376002)(48376002)(4326008)(6666003)(2950100002)(77096006)(8936002)(50226002)(105606002)(8656006)(106466001)(189998001)(326664003)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM2PR0301MB0735; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD046; 1:MEjDtbg4SaAZsMUVxvC/8bbI4VzC7N+l020PiIIY6jE6FSuZOUQ7aDobP/TM5QJG0wNHxDPw70D8l3w+GwVw5gxkF6aEcLbsyjwLSBZiLASd9BoqUxXfpQtN+5SN3F6y MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 9adf94b2-6a43-4ee0-3c9d-08d535544858 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603258); SRVR:DM2PR0301MB0735; X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0735; 3:6e1RlvxrJq+AIoj70COctuyBW8Yt8T21fMTB73WrSqQaD1d7dWM8kqZgX/1LQp2MnpsGNXvBx0BdtTKcLApETuWJLSNEr+TQNeop0iGPdrayJk188pFRXvA4zAia2lrLcATSOsdhnwQBch3AYCxOBjinDovYnRtqHDVcX3LhiGCWjwzIwx80MqRWHJ+wNIVJ8ro+loKhFu8ZULANwbGZXTIqw71fgeXU3JXElfbnMKd84y/x5qyqgrz/J+anAtX81SngQ9u7kWD20Nr5GlaS4Q5c5aL1GZfetnmTmJnj3JwON3iPk24kXXQh/nejDQ4TVWR1P0/agJoyze7DjqbOUtxsoXdYo6PmtllJHcsLMXA=; 25:b/Dktvg7IIRGaJQorSWWjN6JxJxapBzHPavrXWc8lv9C7+uh5Xo1SC03PiTUB8G8BcvH6xTCZIMxrowxwyW3kelp5UxTeDb0zLzdyMy61Vs7I7P/H5wVD6/zniWWH7phExciHDx7xeXVxq7USoeRvTm6sMr9yekaXzAtNf1qBS0OKR19eSQlp1x9M+AzvIk+Q7oPKCTzVKvJBGd1rEc4Xlo1hbPfhvGG/3Sp306RnpqMeYydSuw85GdP2THTKMjxuypxEqa8L+eWVeL/DxrdcyHOBl/Pa4hRFkcUj/B6YAFlHJB+3xPjE5FllSwSHuUY3Bmc5w/IOxbphTkppbltmJB1hmUm0SzNSthifb7pLA4= X-MS-TrafficTypeDiagnostic: DM2PR0301MB0735: X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0735; 31:d+kURyksVtHNCSBhpQ1R10Wsl4AxB0XYnmAAXORsj+xN5aut+5JLkSXSKHdneNcA/ws+BX10flRza3GVtfZYRC3PduHXdc0P7ZpdKYUugqC969AAMIYAq/8tBNd4bVSgwMJm1ldCPhW11aZfvq0tNTd1REQdoD+6ZFfWep8EN9zAbD9goJcjp3l1fjgHHuNh6ZJC1yyQhitNueNjKbB9Cnh1sFIUJ3P2IdtPDiMfEA8=; 4:Y4Q5EqukIEZB1n3A+g8H4nKCSivAwQpWq7vrt5strd+42ApdCgmkIMUJuLHjwMg7LPgrzRXyWguxtq2bjnufPravNY7GlbHvJ8W4h8sma23EspQvur4dl5/+DCzqftPTLPh3Pv9GrGlrVx2gUFT3dRpCflJ3DQ1sVEe9dRo1aDXzEq4gm2t8LbQ3r+PCPWK5ajoH4+oqRULyJa9sxS1kFLJAcLWZqMuWkBsaMB5f3EcTt4DQYTx1wqLdZv9wNUQJG0cVMMQ46iFFtDSlqd4iBQWnieyf9RjmS6dayeD4GsLVFnzqA4MEp+lgJZRZFt7rmyVoZzb1ta00NubLDvfF8VPSJANAQenAebttEaapdvU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(278428928389397)(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231022)(3002001)(10201501046)(6055026)(6096035)(20161123563025)(20161123561025)(20161123565025)(20161123559100)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123556025)(201708071742011); SRVR:DM2PR0301MB0735; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:DM2PR0301MB0735; X-Forefront-PRVS: 0504F29D72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DM2PR0301MB0735; 23:DChqdkwilWdb2KqX0wDJd/38K4BsthiPl5yofu3?= =?us-ascii?Q?p3/kBlrD65+6fDXZg77dlrnGVQ7keWjVJvuMca87NSTCpJBANv8JLMakIoWW?= =?us-ascii?Q?FnqtPZXxR8SAlGjhkUqwduDeVdGG+zJIkWxe+9mUYaV6q6fZDJVlJPMVR8gg?= =?us-ascii?Q?/rDQ/YbPmAnK0SssFMqaeQsidj1roqRZy9eE0q2HBibaxk+j6K6/DJY+9+KA?= =?us-ascii?Q?xFcA1+jqHN+U8qcHURp4L+hSKLw9AjoD46x+OSiU2ekzY+hZFaRqIULTkInE?= =?us-ascii?Q?D00e0IVhVNr6bx8dGRpFN1mNCuywu/Hc8YF485A+SrgmBFBJiIQRAZe9cKca?= =?us-ascii?Q?7axbcdx/GGnjxvWr4lHrvp8cjaJLfORTvLMxnTk4GgVUIGBOIyAtddVo8BYm?= =?us-ascii?Q?W0oHSuUDnAWZOVVwty9eP7wocjEZEVfsJZvLOZc1Gi0ZImhFuMTOsWezw8TT?= =?us-ascii?Q?04QKcLBALv6qIfrWDaCKdBitD4TvxoL/tYNupkMZoZphfi3gFAXn88nj5At0?= =?us-ascii?Q?y+KfiTJ/NMVzxDes3d24Xi2vQd1/Tun/tOBphV/wGoaH4tVyZWkS4sWG2jyW?= =?us-ascii?Q?1tL+1n3UcvTEiwrYczgMVSnlbIfcPiPJVexPiFzQeN2XhHYnlO1Q+YwmcUla?= =?us-ascii?Q?B0PAaOwKqC2LKY0pTErr3LCxQtHFwLJvSoBZISSFZyKaq92XOzii0E8CmJo8?= =?us-ascii?Q?g7/zg/cNZSq6tphZXTDUE4TY/Kv1FvVfmV4pUBLnGu+r/b2kEIucAz4qMG/w?= =?us-ascii?Q?+mIRCBkw8jfXNyoswRcwOg8G7btSbevLeX4X1+VPyV3bCNIc/Gs1X4Ixt/b6?= =?us-ascii?Q?uLS9iAuIffF/dBLPcdF87qur6zt2G5YIl1dxyczU1GcUJUScamcpiw61Zbey?= =?us-ascii?Q?ki/PkEq3Nt+SBXIFPg2IPi2WDKfR4ERldSmmEjgd3Rh/7fQ0OZ3dElPra/cd?= =?us-ascii?Q?p4h7jaSU0LtsGNe3Y+/MsklmgMP6srDzaGwHaR/7drSZy7COieoMUhHgSzFe?= =?us-ascii?Q?IEdhQJPSGWhiVNM5lJYa3vcgDstSDecMFhsi1LN8JFfpgb2ylrj3xcQPOqdT?= =?us-ascii?Q?P1YscQapjLUMbeGmY5EvOUMIH8lH6kQ4rqJ/u/AVuhmrlV20fGHCIQdmIL1g?= =?us-ascii?Q?faEJ+3kdhzgNo89IvdRhBLbTwnti1x894hjRMSidmhnteknnBge6x4ZnCK4C?= =?us-ascii?Q?pE9TXBAqOGYQ9Z47ENbB3FtGDgsF56es4E7Za/ohGRdL/xWcJeqUqJr2628e?= =?us-ascii?Q?Dw+vnOyLFsrpU5RzSKTQl7NMLZRIdM8x545RKboyXeyf/EP00Q3C6WiVPg9U?= =?us-ascii?Q?0a5hykQhkhzdweJ8ZzdGZgnE=3D?= X-Microsoft-Exchange-Diagnostics: 1; DM2PR0301MB0735; 6:kwoUOP9WDim6g0tzwo83hE89Fh8BHzZCMtv18VPY85vv3+Qud+oXlxDAv/nYobnYEumXvFqsTmI9EhAPgU6eTVWqHjMA059LQElaXdM4cqkBpDcyYO6UTX6bHX7IbBNWIObL/SlMGdWSPOvzjOKgUGR+XDmEIgTBeLEw70HGJDnJyRH28JTG/1qIsEA41Hs306uuRokctBSldQye42mhSgZ3j/kRnbvR91WtWwocI17JiGwfBcsJsaZYDogSSpLzh3o7/cLkFuVyLoJYngz0TZwPkFxMVDZD05PbBRLuxz3dezaBLmWPqeWNBR5u7+yBZJqVpXJW1Znj/u6/VZA2C/P8+US/AX17sm6ZhzKO5Dw=; 5:Kd166lvDmNR9CIaY+ndYNP4f3AsJwLD69GoNhUn2CDLjmAqGpZH6p1H0QmebL9+Jnylt+jUl3En0X4nniqx/22mAxcx45XMdqNJ/9ZlX0dHcqNbc1BSJBZPM28ko/nsKIYG5R043O/+oe36VphyWZbP3hzYG+h3Lnzn3mQnvVtI=; 24:qH3klsOEKoFnlM+YZitn+hJ38L5ZEUpgB61/0CbPv+5TR0bLvnrn5lkqyHF4juacNZTbj0nI75oNkvDW/ZViqsh6DCwZcUnibEyWoU3CCzE=; 7:Vl1R4SrtMwqwIp3Ok3siQH4qnnJoweXDHAKqAS8xhu1YJ/qn5unlhfQmd+OxB5J78ximbPlUUiBfSniPKnRZk3WJOXxm0slAygUP7JzkUcFYrQvC8BhP76Ul9yBjdNo8liaX+qBI6O7ZTNJrSVfyAFAv9IO2ZbWLGhXZHln/VvEJLLHZMLiYKEKKoYV6/O1i1ADMIx8q/lrNyKIpUtUel9shyv8cXYidg9olK1Sb4geeecQgpLqY/CjuLz+wPEff SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2017 05:04:04.8500 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9adf94b2-6a43-4ee0-3c9d-08d535544858 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: DM2PR0301MB0735 Subject: [edk2] [PATCH edk2-platforms] [PATCH v3 4/9] 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 | 331 +++++++++++++++++= ++++ Platform/NXP/Library/DUartPortLib/DUartPortLib.inf | 39 +++ 3 files changed, 498 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..5ad198d --- /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..ad416de --- /dev/null +++ b/Platform/NXP/Library/DUartPortLib/DUartPortLib.c @@ -0,0 +1,331 @@ +/** 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 t= he + "Request To Send" control signal if this bit is + equal to one/zero. + . EFI_SERIAL_DATA_TERMINAL_READY : assert/deasse= rt + the "Data Terminal Ready" control signal if th= is + bit is equal to one/zero. + . EFI_SERIAL_HARDWARE_LOOPBACK_ENABLE : enable/d= isable + the hardware loopback if this bit is equal to + one/zero. + . EFI_SERIAL_SOFTWARE_LOOPBACK_ENABLE : not supp= orted. + . EFI_SERIAL_HARDWARE_FLOW_CONTROL_ENABLE : enab= le/ + disable the hardware flow control based on CTS= (Clear + To Send) and RTS (Ready To Send) control signa= ls. + + @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 and assert interrupt when new data is available on + // external device, + // 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..7eb02ce --- /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 0x0001001A + BASE_NAME =3D DUartPortLib + FILE_GUID =3D c42dfe79-8de5-429e-a055-2d0a58591498 + 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 Mon Apr 29 07:08:14 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 1511759053358707.3995940459829; Sun, 26 Nov 2017 21:04:13 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id D51A3220F3C5D; Sun, 26 Nov 2017 20:59:50 -0800 (PST) Received: from NAM02-SN1-obe.outbound.protection.outlook.com (mail-sn1nam02on0079.outbound.protection.outlook.com [104.47.36.79]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 698BC21B00DD4 for ; Sun, 26 Nov 2017 20:59:49 -0800 (PST) Received: from MWHPR03CA0013.namprd03.prod.outlook.com (10.175.133.151) by MWHPR03MB2702.namprd03.prod.outlook.com (10.168.207.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Mon, 27 Nov 2017 05:04:08 +0000 Received: from BY2FFO11FD005.protection.gbl (2a01:111:f400:7c0c::101) by MWHPR03CA0013.outlook.office365.com (2603:10b6:300:117::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Mon, 27 Nov 2017 05:04:08 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BY2FFO11FD005.mail.protection.outlook.com (10.1.14.126) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Mon, 27 Nov 2017 05:04:08 +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 vAR53iMX000785; Sun, 26 Nov 2017 22:04:05 -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.79; 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: Mon, 27 Nov 2017 16:21:53 +0530 Message-ID: <1511779917-9255-6-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> References: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131562326487944791; (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)(376002)(39860400002)(39380400002)(346002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(106466001)(498600001)(76176999)(15188155005)(16799955002)(189998001)(53936002)(551934003)(50986999)(33646002)(53376002)(105606002)(4326008)(6306002)(5660300001)(50466002)(2950100002)(48376002)(6666003)(47776003)(966005)(2201001)(305945005)(2906002)(104016004)(356003)(8656006)(81156014)(81166006)(575784001)(8936002)(86362001)(36756003)(316002)(97736004)(110136005)(50226002)(68736007)(8676002)(54906003)(16586007)(51416003)(77096006)(85426001)(44824005)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2702; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BY2FFO11FD005; 1:f5FDnkcFnHrAcWoiB8oNJQa/ndgvmEZfzkELr2eLGq058DR9baMHyWmzjaRkaHlVk+FDq2h4f0gICC/46hN6MOfIma8E8U+ClRqbwj0rz7lRiDoKnXBpeQw5kV/s9DC3 MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0267b2e0-aac6-4c9e-4367-08d535544a87 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603258); SRVR:MWHPR03MB2702; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2702; 3:rXw/bSxYwp0FYTWOPIt7HOl/3m/q0TDDGs/i6+Wnyr4lmOeXS+DJgVozvjZN0s9O0Qv1Bw8W3lGbR+EgTYE86tkTJ02/GQd6br1uFucijtoLttgCf6sTPYf9LwgEjFziLdUGmiB0lZgpkQaGHuIK+gIrX8axVjygUxGYNgMtxU5xE4BzzwwPlHMBjGVGxf6F8xFOrRzHEBVcVeI9I4dVyIkEIRSyP59jnhbkEm827kP2EBWVGJd+TuWYi+O/0H/S54kZ5ypFDRP/lbrxv1GNn7AShUXz2XNrkqe2vrFl78+8AuFVPDfTkL304okD4f/53nBjtqi/3ztm+KN0yHZqh8bAfixxuufY3qyzCIwIHXc=; 25:13fTqMWRqb/4YbvVRuOOrKbjJ4LhDqIjTlwUljHgdSmQS/dQISomt3FmNHxvJGVV4Fb3zGta8dsomwHC556OaTwtLAsXV86ZUVU650bsyo3+UDtPMI7MQcb2qH2yaFN2SacSXEdX+g8+OiLhJ6blHH19CnXQ1XVfI1W33NdfepIGU7TL/ynQ3kGOwkeLowPiYagfFWxq66d0tpzLDQPMMu8H3IiNOwX/2Km16ZunnTTk7mvE3nrryEDH1z9bUhT6poxmlWlXTkr1wQcGfxhe3V9+QSFDLe3OsmCbzQA8oynQruvGAef6GVxVui+cd0qH3OlK8pEPyGzYWfFzEDrMRw== X-MS-TrafficTypeDiagnostic: MWHPR03MB2702: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2702; 31:FpfLyxO7rinF/tYuUiKLS1cvoF3lRDGhi7dJGHVaZhtgSX9B2S13zrDRlitHcsdHvB64mukqMGZ3CCNF3ZM3fpKbAu5WPilzCgVWLAd2ifmrPJa2J7OPKqqDIWKlN5nj+bMjkbT2SRNxtqjDJjiv6brFfl7TtiBftQqSfQ6EXB68FiR0XBX3f9dlUQzvB5kFUVKq+L7iCwbOJy/IzwWDA8fDqJy3BCJu47TW3yyUIEI=; 4:c3mtb0lo2wVdkk+G6+vvyrwK/Drb9/2w5iGO8invoQamu5wtsKnQNhzHzaWk9LXlNVWDjne9orzF9kje74ALI9rK+opbwZYmaby9uw12B4fVnkxCymT5rjtt2KKfOWcF0pS0XHsOPsDgATrHpZ6zNdkPMqNA+HXo16BYiFuvvSimiRK25l4hPO6OzTRGGay4FsGWS1ADGIKRNHXHTD9379OaDZJIx6OM3J0Z31x/tEIloJtBK/udbfTGRquwvdzzTgW34oNg81WGuoZDrTdphIp8b1Qiqx087UVieipm+JBoWv3zHEfKn7wFGG4vtvXP X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(10201501046)(3002001)(3231022)(93006095)(93001095)(6055026)(6096035)(20161123565025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123559100)(20161123556025)(20161123561025)(20161123563025)(201708071742011); SRVR:MWHPR03MB2702; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:MWHPR03MB2702; X-Forefront-PRVS: 0504F29D72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2702; 23:DvGiIizyeCok/VS8yHVYErlVIl4FcPXalPkhMHZ++?= =?us-ascii?Q?nVrBUr+UbJrItTDyQrEyuuOrJlqiGtyF389oFxx20CLwUrEkg6yqMSHybExg?= =?us-ascii?Q?VnTPrX38yE+V8X5nIg6WOjZl0LkbChA9B43k6JmgibS9236mtJ2JshiDwexV?= =?us-ascii?Q?3kt7bhx/9x38LbDosPioUECQCvkmd/B7dvrc3hZQFLjgkIfwenANqYer3Lyq?= =?us-ascii?Q?shWBz3TjlBjLu47eWCvPZpCHh4CIxeANtJIFwWt+TGurq245eMv3a9FQXzpK?= =?us-ascii?Q?rPQT68XVHspASL5jucrFu1aY9PskyZ92O5bYfH3n5AWjBKaJdvvPFFSNkFfS?= =?us-ascii?Q?ghvDUoSDRgAJd5Bfgp8tWJx1Xjf/m5LoIkiMkQtv6jxZ1Wz4tB0wFS37IAyY?= =?us-ascii?Q?I1V4btKqoS+xtqcOyevaOCxc1rpxTggC05YUFJ2rAySTiBvarBvWmFH79UV7?= =?us-ascii?Q?AIcoCUR+7+8dTu5NEQBPdKOsQQB8OHDeTc7T5HQAXizGKQKmPlz4WWyT0Ong?= =?us-ascii?Q?p+iJ9ZT+KgwcPm5eEUXYS/pfiodKmG+oURij9qDi1UEKsNwl1ZUOCOBVX/qA?= =?us-ascii?Q?3qvkhhcEsHIyEM+H0uDabvI8i4OEewkaE+2ADPKmDCl56m5+4+0Q5ZFm9adV?= =?us-ascii?Q?0DCL+j9aS+z8mJBl3WbtLPectYbQwRIvZLVpG/dtFv7QgPEWtPPyeHNiRYUU?= =?us-ascii?Q?sx4rc+OnM8DaCtg3yG4YAmJ64WPgt1Y8ZqUAqn59+bt5M/SSAXAopqAS6ZLx?= =?us-ascii?Q?RKAYYRdqeHVz+eVxQ+IBDsH0WgjiPV3zgXPC2GSn3NIHzDHPoet5gjMIxIOj?= =?us-ascii?Q?/Gec9valemAHe/YjVdhSikWTkE/PnT1QZIHL03cqoUAgp7hyTFEdOzaRl4Fv?= =?us-ascii?Q?CpZXRzIvtWvlR6UbD3+YmRprt2QrnSKsKAOZY0DqmlEocrOlfHfJZ/hG34HK?= =?us-ascii?Q?mRS9PNQ6GSgBS4pLQJbc/w06V9sYpfwpLvGnpW1cKIwjnezF+xPeWNYPz22L?= =?us-ascii?Q?XoqxYuknXikDzQPOxpcRQFkwGP1lU6yE/F/4fwlvUj78aFKoCxakED33T9DF?= =?us-ascii?Q?Zgnv8K8S4wVj7DaMXUgsNFq8EWcO6ADeHY/ktKMjQBrQAaCJVIWFwW2KEB7e?= =?us-ascii?Q?13TVV0BuFjZ0POBfokAW+ExYiMp1ER2gOmklt7GNL4b5Call7FOuunNGVELz?= =?us-ascii?Q?mOXfcPxWbxryH/7eW1FjHhXaT7oTaqm5b4pmNC6X7vcyAj8zrfdmyiRExW5d?= =?us-ascii?Q?Ap8WlKTv6xlpXJ7/xvPZzAcmbUbEp1kln30ShSTMVM6+0R6CXxre3s2pKtvH?= =?us-ascii?Q?wxmsLPj9312CLsPSbyAXe23xciSkL/ay1EhR7IsEvyCWlzYkFqKsjHsl1Swk?= =?us-ascii?Q?MnY+A=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2702; 6:jQ5TkDvhDgOINlMJVob7QBS9ZWTJo7OQlkiFW0bW+cWWP6pyvym0GYWapfzBB5Z4escZ8jJ47u0Gu2NDsgwrawQCpM1GozLbXYKJbfjYxdFk8y2W7yOzN34MvwTaOLgDlDL0800Mb1K7N0OOUOK80wAMVbcl53z+KyE5AqEOQ/Otw8ZSfz2XI3AKpPT2AQJtvDVi1PbwjRhTj5oiuZ5s0k6gEHP7zD3mzysKnk+4n3aUAr3MypjuyuwASK54f+1Wq7u6LorGWewjF5eDBaTGPQTYN9xVQLCWKVtXfMiWVbMLvoEwOoa0olndb8arGT4HwUCKVe4yOHV0sqRbz2itoV8ghPEgVj13rHclTZ+9FeQ=; 5:2XPfVhWpx4NYr3b6hx4ImeuVY9sPpJZZGqY76uhLjmbXKaAkmQ2JuqPuPnxe9LS15pzNCZ9eCFF2HSl1w0xkaPZX1TBVj/3uPly4hlUsbDSLlSCNM5jBflCJL+pR0qlUd5r9k1YlGjt199EHFcvt2sq3qBWUuNIdFeDt8lFM4hc=; 24:Q6gSCOKqVccztdPHJyAgK0mw6E/8jrjPMT50DkYl+exPTbgndGvUEbT7MkFG6sqbIs1ZoH9vv1bd3pxPzS3/miiKCVL+WQ3NGJtza5WEAfo=; 7:VFnXyPL9kT8eKsLh1z/TzXR33ra/2nHbmAlaWDKInkhWfmr8xCBWkVVWYjItljGgCZeNlXmHNruUdU2OR7bJMgSnafyAE7Gy7w+xBid7wCPRLEsj2gN6wjnFj2K+PMCDUs8kQLkj4RzlF25hfgYzeNOkZm2jpE3jhbZyFExE5PPWLN9/8cQJKZgKdQws17uqvmQbVAOQWU8ZO2l7yhpeC67uO5m3axKddtYLsQxWqLXkbf5QXUii5m9EtFljtund SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2017 05:04:08.4824 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 0267b2e0-aac6-4c9e-4367-08d535544a87 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: MWHPR03MB2702 Subject: [edk2] [PATCH edk2-platforms] [PATCH v3 5/9] Platform/NXP: Add support for I2c 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" I2C driver produces gEfiI2cMasterProtocolGuid which can be used by other modules. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- Platform/NXP/Drivers/I2cDxe/I2cDxe.c | 728 +++++++++++++++++++++++++++++= ++++ Platform/NXP/Drivers/I2cDxe/I2cDxe.h | 64 +++ Platform/NXP/Drivers/I2cDxe/I2cDxe.inf | 57 +++ 3 files changed, 849 insertions(+) create mode 100644 Platform/NXP/Drivers/I2cDxe/I2cDxe.c create mode 100644 Platform/NXP/Drivers/I2cDxe/I2cDxe.h create mode 100644 Platform/NXP/Drivers/I2cDxe/I2cDxe.inf diff --git a/Platform/NXP/Drivers/I2cDxe/I2cDxe.c b/Platform/NXP/Drivers/I2= cDxe/I2cDxe.c new file mode 100644 index 0000000..30eb6f4 --- /dev/null +++ b/Platform/NXP/Drivers/I2cDxe/I2cDxe.c @@ -0,0 +1,728 @@ +/** I2cDxe.c + I2c driver APIs for read, write, initialize, set speed and reset + + Copyright NXP 2017 + + 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 "I2cDxe.h" + +STATIC CONST EFI_PHYSICAL_ADDRESS I2cAddrArr[FixedPcdGet32 (PcdNumI2cContr= oller)] =3D { + FixedPcdGet64 (PcdI2c0BaseAddr), + FixedPcdGet64 (PcdI2c1BaseAddr), + FixedPcdGet64 (PcdI2c2BaseAddr), + FixedPcdGet64 (PcdI2c3BaseAddr) +}; + +STATIC CONST 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 + +**/ +STATIC +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 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 + +**/ +STATIC +EFI_STATUS +WaitForI2cState ( + IN I2C_REGS *I2cRegs, + IN UINT32 State + ) +{ + UINT8 CurrState; + UINT64 Cnt; + + for (Cnt =3D 0; Cnt < 50000; Cnt++) { + MemoryFence (); + 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; + } + } + + 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 + +**/ +STATIC +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 + +**/ +STATIC +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 + +**/ +STATIC +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 bus is idle + + @param Base Pointer to base address of I2c controller + + @retval EFI_SUCCESS + +**/ +STATIC +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 + +**/ +STATIC +EFI_STATUS +InitDataTransfer ( + IN I2C_REGS *I2cRegs, + IN UINT8 Chip, + IN UINT32 Offset, + IN INT32 Alen + ) +{ + EFI_STATUS Status; + INT32 Retry; + + for (Retry =3D 0; Retry < 3; Retry++) { + Status =3D InitTransfer (I2cRegs, Chip, Offset, Alen); + if (Status =3D=3D EFI_SUCCESS) { + return EFI_SUCCESS; + } + + I2cStop (I2cRegs); + + if (EFI_NOT_FOUND =3D=3D Status) { + return Status; + } + + // Disable controller + if (Status !=3D EFI_NOT_READY) { + MmioWrite8 ((UINTN)&I2cRegs->I2cCr, I2C_CR_IDIS); + } + + if (I2cBusIdle (I2cRegs) < 0) { + break; + } + } + return Status; +} + +/** + Function to read data using i2c bus + + @param I2cBus I2c Controller number + @param Chip Address of slave device from where data to be r= ead + @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 predefine= d time + @retval EFI_NOT_FOUND ACK was not recieved + @retval EFI_SUCCESS Read was successful + +**/ +STATIC +EFI_STATUS +I2cDataRead ( + IN UINT32 I2cBus, + IN UINT8 Chip, + IN UINT32 Offset, + IN UINT32 Alen, + IN UINT8 *Buffer, + IN UINT32 Len + ) +{ + EFI_STATUS Status; + UINT32 Temp; + INT32 I; + I2C_REGS *I2cRegs; + + I2cRegs =3D (I2C_REGS *)I2cAddrArr[I2cBus]; + + Status =3D InitDataTransfer (I2cRegs, Chip, Offset, Alen); + if (Status !=3D EFI_SUCCESS) { + return Status; + } + + Temp =3D MmioRead8 ((UINTN)&I2cRegs->I2cCr); + Temp |=3D I2C_CR_RSTA; + MmioWrite8 ((UINTN)&I2cRegs->I2cCr, Temp); + + Status =3D TransferByte (I2cRegs, (Chip << 1) | 1); + if (Status !=3D EFI_SUCCESS) { + I2cStop (I2cRegs); + return Status; + } + + // 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); + + // Dummy Read to initiate recieve operation + MmioRead8 ((UINTN)&I2cRegs->I2cDr); + + for (I =3D 0; I < Len; I++) { + Status =3D WaitForI2cState (I2cRegs, IIF); + if ((Status =3D=3D EFI_TIMEOUT) || (Status =3D=3D EFI_NOT_READY)) { + I2cStop (I2cRegs); + return Status; + } + // + // 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 data + @param Len Length of data to be write + + @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 + +**/ +STATIC +EFI_STATUS +I2cDataWrite ( + IN UINT32 I2cBus, + IN UINT8 Chip, + IN UINT32 Offset, + IN INT32 Alen, + OUT UINT8 *Buffer, + IN INT32 Len + ) +{ + EFI_STATUS Status; + I2C_REGS *I2cRegs; + INT32 I; + + I2cRegs =3D (I2C_REGS *)I2cAddrArr[I2cBus]; + + Status =3D InitDataTransfer (I2cRegs, Chip, Offset, Alen); + if (Status !=3D EFI_SUCCESS) { + return Status; + } + + // Write operation + for (I =3D 0; I < Len; I++) { + Status =3D TransferByte (I2cRegs, Buffer[I]); + if (Status !=3D EFI_SUCCESS) { + break; + } + } + + I2cStop (I2cRegs); + return Status; +} + +/** + Function to set i2c bus frequency + + @param This Pointer to I2c master protocol + @param BusClockHertz value to be set + + @retval EFI_SUCCESS Operation successfull +**/ + +EFI_STATUS +EFIAPI +SetBusFrequency ( + IN CONST EFI_I2C_MASTER_PROTOCOL *This, + IN OUT UINTN *BusClockHertz + ) +{ + I2C_REGS *I2cRegs; + UINT8 ClkId; + UINT8 SpeedId; + + I2cRegs =3D (I2C_REGS *)I2cAddrArr[PcdGet32 (PcdI2cBus)]; + + ClkId =3D GetClk (*BusClockHertz); + SpeedId =3D ClkDiv[ClkId][1]; + + // Store divider value + MmioWrite8 ((UINTN)&I2cRegs->I2cFdr, SpeedId); + + MemoryFence (); + + return EFI_SUCCESS; +} + +/** + Function to reset I2c Controller + + @param This Pointer to I2c master protocol + + @return EFI_SUCCESS Operation successfull +**/ +EFI_STATUS +EFIAPI +Reset ( + IN CONST EFI_I2C_MASTER_PROTOCOL *This + ) +{ + I2C_REGS *I2cRegs; + + I2cRegs =3D (I2C_REGS *)I2cAddrArr[PcdGet32 (PcdI2cBus)]; + + // Reset module + MmioWrite8 ((UINTN)&I2cRegs->I2cCr, I2C_CR_IDIS); + MmioWrite8 ((UINTN)&I2cRegs->I2cSr, 0); + + MemoryFence (); + + return EFI_SUCCESS; +} + +EFI_STATUS +EFIAPI +StartRequest ( + IN CONST EFI_I2C_MASTER_PROTOCOL *This, + IN UINTN SlaveAddress, + IN EFI_I2C_REQUEST_PACKET *RequestPacket, + IN EFI_EVENT Event OPTIONAL, + OUT EFI_STATUS *I2cStatus OPTIONAL + ) +{ + UINT32 Count; + INT32 Ret; + UINT32 Length; + UINT8 *Buffer; + UINT32 Flag; + UINT8 RegAddress; + + RegAddress =3D 0; + + if (RequestPacket->OperationCount <=3D 0) { + DEBUG ((DEBUG_ERROR,"%a: Operation count is not valid %d\n", + __FUNCTION__, RequestPacket->OperationCount)); + return EFI_INVALID_PARAMETER; + } + + for (Count =3D 0; Count < RequestPacket->OperationCount; Count++) { + Flag =3D RequestPacket->Operation[Count].Flags; + Length =3D RequestPacket->Operation[Count].LengthInBytes; + Buffer =3D RequestPacket->Operation[Count].Buffer; + + if (Length <=3D 0) { + DEBUG ((DEBUG_ERROR,"%a: Invalid length of buffer %d\n", + __FUNCTION__, Length)); + return EFI_INVALID_PARAMETER; + } + + if (Flag =3D=3D I2C_FLAG_WRITE && Count =3D=3D 0) { + RegAddress =3D *Buffer; + continue; + } else if (Flag =3D=3D I2C_FLAG_READ) { + Ret =3D I2cDataRead (PcdGet32 (PcdI2cBus), SlaveAddress, + RegAddress, sizeof(SlaveAddress)/8, Buffer, Length); + if (Ret !=3D EFI_SUCCESS) { + DEBUG ((DEBUG_ERROR,"%a: I2c read operation failed (error %d)\n", + __FUNCTION__, Ret)); + return Ret; + } + } else if (Flag =3D=3D I2C_FLAG_WRITE) { + Ret =3D I2cDataWrite (PcdGet32 (PcdI2cBus), SlaveAddress, + RegAddress, sizeof(SlaveAddress)/8, Buffer, Length); + if (Ret !=3D EFI_SUCCESS) { + DEBUG ((DEBUG_ERROR,"%a: I2c write operation failed (error %d)\n", + __FUNCTION__, Ret)); + return Ret; + } + } else { + DEBUG ((DEBUG_ERROR,"%a: Invalid Flag %d\n", + __FUNCTION__, Flag)); + return EFI_INVALID_PARAMETER; + } + } + + return EFI_SUCCESS; +} + +CONST EFI_I2C_CONTROLLER_CAPABILITIES I2cControllerCapabilities =3D { + 0, + 0, + 0, + 0 +}; + +STATIC EFI_I2C_MASTER_PROTOCOL gI2c =3D { + /// + /// Set the clock frequency for the I2C bus. + /// + SetBusFrequency, + /// + /// Reset the I2C host controller. + /// + Reset, + /// + /// Start an I2C transaction in master mode on the host controller. + /// + StartRequest, + /// + /// Pointer to an EFI_I2C_CONTROLLER_CAPABILITIES data structure contain= ing + /// the capabilities of the I2C host controller. + /// + &I2cControllerCapabilities +}; + +STATIC I2C_DEVICE_PATH gDevicePath =3D { + { + { + HARDWARE_DEVICE_PATH, HW_VENDOR_DP, + { + sizeof (VENDOR_DEVICE_PATH), 0 + } + }, + EFI_CALLER_ID_GUID + }, + { + END_DEVICE_PATH_TYPE, + END_ENTIRE_DEVICE_PATH_SUBTYPE, + { + sizeof (EFI_DEVICE_PATH_PROTOCOL), 0 + } + } +}; + +/** + The Entry Point for I2C driver. + + @param[in] ImageHandle The firmware allocated handle for the EFI imag= e. + @param[in] SystemTable A pointer to the EFI System Table. + + @retval EFI_SUCCESS The entry point is executed successfully. + @retval other Some error occurs when executing this entry po= int. + +**/ +EFI_STATUS +EFIAPI +I2cDxeEntryPoint ( + IN EFI_HANDLE ImageHandle, + IN EFI_SYSTEM_TABLE *SystemTable + ) +{ + EFI_STATUS Status; + + // + // Install I2c Master protocol on this controller + // + Status =3D gBS->InstallMultipleProtocolInterfaces ( + &ImageHandle, + &gEfiI2cMasterProtocolGuid, + (VOID**)&gI2c, + &gEfiDevicePathProtocolGuid, + &gDevicePath, + NULL + ); + + ASSERT_EFI_ERROR (Status); + + return Status; +} + +/** + Unload function for the I2c Driver. + + @param ImageHandle[in] The allocated handle for the EFI image + + @retval EFI_SUCCESS The driver was unloaded successfully + @retval EFI_INVALID_PARAMETER ImageHandle is not a valid image handle. + +**/ +EFI_STATUS +EFIAPI +I2cDxeUnload ( + IN EFI_HANDLE ImageHandle + ) +{ + EFI_STATUS Status; + EFI_HANDLE *HandleBuffer; + UINTN HandleCount; + UINTN Index; + + // + // Retrieve all I2c handles in the handle database + // + Status =3D gBS->LocateHandleBuffer (ByProtocol, + &gEfiI2cMasterProtocolGuid, + NULL, + &HandleCount, + &HandleBuffer); + if (EFI_ERROR (Status)) { + return Status; + } + + // + // Disconnect the driver from the handles in the handle database + // + for (Index =3D 0; Index < HandleCount; Index++) { + Status =3D gBS->DisconnectController (HandleBuffer[Index], + gImageHandle, + NULL); + } + + // + // Free the handle array + // + gBS->FreePool (HandleBuffer); + + // + // Uninstall protocols installed by the driver in its entrypoint + // + Status =3D gBS->UninstallMultipleProtocolInterfaces (ImageHandle, + &gEfiI2cMasterProtocolGuid, &gI2c, + &gEfiDevicePathProtocolGuid, &gDevicePath, + NULL); + + return Status; +} diff --git a/Platform/NXP/Drivers/I2cDxe/I2cDxe.h b/Platform/NXP/Drivers/I2= cDxe/I2cDxe.h new file mode 100644 index 0000000..604396c --- /dev/null +++ b/Platform/NXP/Drivers/I2cDxe/I2cDxe.h @@ -0,0 +1,64 @@ +/** I2cDxe.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_DXE_H___ +#define __I2C_DXE_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)) + +#define I2C_FLAG_WRITE 0x0 + +typedef struct { + VENDOR_DEVICE_PATH Guid; + EFI_DEVICE_PATH_PROTOCOL End; +} I2C_DEVICE_PATH; + +/** + Record defining i2c registers +**/ +typedef struct { + UINT8 I2cAdr; + UINT8 I2cFdr; + UINT8 I2cCr; + UINT8 I2cSr; + UINT8 I2cDr; +} I2C_REGS ; + +UINT32 +CalculateI2cClockRate ( + VOID + ); + +#endif diff --git a/Platform/NXP/Drivers/I2cDxe/I2cDxe.inf b/Platform/NXP/Drivers/= I2cDxe/I2cDxe.inf new file mode 100644 index 0000000..d6496cf --- /dev/null +++ b/Platform/NXP/Drivers/I2cDxe/I2cDxe.inf @@ -0,0 +1,57 @@ +# @file +# +# Component description file for I2c driver +# +# Copyright (c) 2015, Freescale Semiconductor, Inc. All rights reserved. +# Copyright NXP 2017 +# +# 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 0x0001001A + BASE_NAME =3D I2cDxe + FILE_GUID =3D 5f2927ba-1b04-4d5f-8bef-2b50c635d1e7 + MODULE_TYPE =3D DXE_DRIVER + VERSION_STRING =3D 1.0 + ENTRY_POINT =3D I2cDxeEntryPoint + UNLOAD =3D I2cDxeUnload + +[Sources.common] + I2cDxe.c + +[LibraryClasses] + ArmLib + IoLib + MemoryAllocationLib + PcdLib + SocLib + TimerLib + UefiDriverEntryPoint + UefiLib + +[Packages] + MdePkg/MdePkg.dec + Platform/NXP/NxpQoriqLs.dec + +[Protocols] + gEfiI2cMasterProtocolGuid + +[Pcd] + gNxpQoriqLsTokenSpaceGuid.PcdI2cBus + gNxpQoriqLsTokenSpaceGuid.PcdI2cSpeed + gNxpQoriqLsTokenSpaceGuid.PcdI2c0BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdI2c1BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdI2c2BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdI2c3BaseAddr + gNxpQoriqLsTokenSpaceGuid.PcdNumI2cController + +[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 Mon Apr 29 07:08:14 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 1511759058622697.2832460137661; Sun, 26 Nov 2017 21:04:18 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1FB082211B401; Sun, 26 Nov 2017 20:59:56 -0800 (PST) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0078.outbound.protection.outlook.com [104.47.34.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0A66321B00DD4 for ; Sun, 26 Nov 2017 20:59:54 -0800 (PST) Received: from BN6PR03CA0081.namprd03.prod.outlook.com (10.164.122.147) by MWHPR03MB2701.namprd03.prod.outlook.com (10.168.207.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Mon, 27 Nov 2017 05:04:15 +0000 Received: from BN1AFFO11FD005.protection.gbl (2a01:111:f400:7c10::114) by BN6PR03CA0081.outlook.office365.com (2603:10b6:405:6f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Mon, 27 Nov 2017 05:04:15 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BN1AFFO11FD005.mail.protection.outlook.com (10.58.52.65) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Mon, 27 Nov 2017 05:04: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 vAR53iMY000785; Sun, 26 Nov 2017 22:04: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.78; 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: Mon, 27 Nov 2017 16:21:54 +0530 Message-ID: <1511779917-9255-7-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> References: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131562326547580419; (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)(346002)(376002)(39860400002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(48376002)(50466002)(2201001)(6666003)(33646002)(16586007)(110136005)(575784001)(54906003)(86362001)(8936002)(51416003)(50226002)(6306002)(16799955002)(105606002)(5660300001)(85426001)(2950100002)(106466001)(2906002)(97736004)(316002)(50986999)(4326008)(76176999)(81166006)(498600001)(68736007)(81156014)(189998001)(8676002)(47776003)(36756003)(53936002)(53376002)(104016004)(8656006)(305945005)(356003)(77096006)(15188155005)(966005)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2701; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD005; 1:V0gStrSliISgt9Mmk1PsSCX+pNLniDqsZNjISObxJhLSxr1/+H2DH/Gb4xTqpCFg+AVsFdHw0CyRkjxvrVNU+UvhjOXo0OkDcmwDIYAAJm7GG06gIF0cpklhp0Zi/833 MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: 236c307c-2ade-4aae-21e0-08d535544e21 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603258); SRVR:MWHPR03MB2701; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2701; 3:iJiHOB3gvNZdXoysiy/pgKourl3l05sAK+SL8ZTeU/0ORDPOX/2tjZJ9ydV+0ThV2LdOt1YYb7yP/NawAbY3X7KiBvAy61YUDX5s8X5gubjjLwmQn6hOMzhLX8bSPUaNAjuABvqA0TcSZph9Xos0WIRaOl7HPGpLLU87DBBnlQ63tZXVAaCV/0dpaddEXrOtHSMcicgXLih6PuJvZ27KGuWp41S89Pk68vzCpJaCY1udDhZwU9DfzH4hUamRzxw4xI9HoOPlS1BczzhVdLMXFD9vHoXbFDZSOljN9GlDjlpj/s5HFHhD0PfMvtuvQeArbRi0Z8uQPwBscHjia/GeVzL+kaIz4rkhQyJsUfGfLoA=; 25:xdd8ZYh+TnZf1Xgq0WK/NqBvWx+bOTAK0ZH4jdF074sT6wd54k0XGu3Y3CREEARIhugDlH3at7AP9n1kLA79a+9qQC9wjCfSOC2/AYfkoGvg70J+vR473xB9ck/lNtaylIR2j2hTeVrc+YiB659WDe/M5HUUaJjDBJ7J8goReYhm1ECR1lXr9OZo6LOrvBKU6lMtnHSyizX/gV7sb5PVyLw4Vz/2fGVATVN8tlmyOj5nrjxOGtGvhdwh+DDdU41rI5v2+xissP5ltnc2myBIpMOVwwC7XN0cItFNvU9Z3vBx0QWtprJuhZIxw64c8gojozJ24Rgx4u4lbAZcNcuMeQ== X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MWHPR03MB2701: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2701; 31:V5Dt6QZ7n3o2LD04Mrt17Vu2Jh5JKVqxOpKFpdH+udxML8YL9wDl/TsltfXXV+yPkIK/ym/vIcEVjJ8CYLNOUJuN4EaPGuOQL+BwE43klLA5h94tD1Tabftw+L6ZlHz+nvQHiUCIk0eJ7+OBBt9TtJnYEH+ajV9AXZv/dNE9Oh0S1nKX8622MKUw3t5SkRhu3ebD+CB508NPpevJvHTFCngLo9qU8pPBu3wdtDgLHFo=; 4:a3Fe+TtF13NhfZcOObKoexbm1aJMX/pkHt4jtMskLQhx4jmaz2FLpfJxcu+fYB92XRB6kwxIjICVwDo/bkHA3hotmmTCUMw+b/vOPA5s0lgloyEiQpRKG4XhbTPu8n5ihqyPCHm5DYNXptDQLtYBKmHFZG6FSDZnFtO7/WLorjidQ6GlYo4MLKQVVFBs+N3xX0pEmsvOU39/XQ+CpXMjmavEpVPa5IjO18upj5VXCEjbbQj5UQksPlmF3ZqCU4NwIZiQ65lH4GtnVJLGDzvzapRBgpupZg+4J4nwx/GkeRt4a/q+wjBtUAEvCkkTpExW9nIJTWqRFeYoprpF/uUkbkEFv1VnUkeujvVsrhm6XeU= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(21532816269658); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(3002001)(3231022)(10201501046)(93006095)(93001095)(6055026)(6096035)(20161123563025)(20161123559100)(20161123556025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123561025)(20161123565025)(201708071742011); SRVR:MWHPR03MB2701; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:MWHPR03MB2701; X-Forefront-PRVS: 0504F29D72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2701; 23:GFAfmwk2QOdbN9aVDGsegekfAQHkISWjFE5Y/DHjn?= =?us-ascii?Q?yaqKknc5hjGwJ9yNjZKz+zdVOIxVk9gDop9UrIjg2IR7ZyxAth4swUCicmun?= =?us-ascii?Q?K3y+CQephwR5U0RSmYK3keX/Z3ysAX5RPKbXQJB/pFKJPigOyKm0W2Adp0sv?= =?us-ascii?Q?hsSORGRWukX4vzjGWs5wUNDkLP5roSDD9ETbwRwXfAiezB6apF/VpnbdMB2c?= =?us-ascii?Q?bM/YK+KvckZJvtxGHXCKhJgTW/qcE9S3zcyRvzVRvAkhywt3DLXe/b6aQ1S6?= =?us-ascii?Q?sNyWWIRqFCPfCppt4aEaeBChq4dNZEaSSXALUimJAdJReWUqzW641GNYNZde?= =?us-ascii?Q?gWHPLrbalb7FF73pX5omesz8o09Ryd9UQ8VWr0+34UI59smsdD1AY0rpRz6l?= =?us-ascii?Q?4El6loO4vDSNYC7SaD5YZaKT8o6MG8jxayj5og4CrmqP2SWl5cP/ZOkX1GIc?= =?us-ascii?Q?X/x3aUtJdKTtBs1kwjo3KJ59S/n5tErf9FGNPX6ZzTsisv5v0RRhDXCmzhQE?= =?us-ascii?Q?f1fKgiWXRzH0oPhNnEmg3z3Jjgr5yTM7Ntf0okBQE9FEr5LEOnZF0v2N6Tjt?= =?us-ascii?Q?0f4004HJDMEXz5io79towK3arDLzJzGhmNGCfK8WSBsSNflWz8kPF/vqdmHO?= =?us-ascii?Q?7CZIdys+Oh1EYJpd9rx9W2nonhxGZb4KMv8tu2fGrnZHIHT5RMjNpjhESORL?= =?us-ascii?Q?J3vhGFmjqJAzOHvK9OaOIdT+0iLboVELqzO4JIbUFn5Ejc2FwhPJ5sQIoA0i?= =?us-ascii?Q?iG3IELJh5F/DlX8lvWoSr7O2K0n7is5JVOnPRcraQEwrd1ZwoCLuv9t1bc3d?= =?us-ascii?Q?QvUeF2SQKLJKv3fCn2JV8aT1v9MpUAdiIKCwPNQs1CuV3MwVhbrOfJ4XSifw?= =?us-ascii?Q?7CiAXwvI/nvWLX+yX3G8fPf1v0vgImDlQHVF3ev78lUCUYpX89cGQWJdg3fh?= =?us-ascii?Q?5KHW+ymZZlXD/S9+mhn0edQ2BDnnC6CqoJ7iRviHrlCjEJgVy92tdV2eE8ze?= =?us-ascii?Q?QXayYmOrHD/m/lOdGP7Prn+OxCivH9lI8PD+xnJqZn8bGxW2jz3XPMCpKkRZ?= =?us-ascii?Q?Tizf7Z8IfmixBoAOBRRTg1W3JICQtH4+9riEm6aCCzF1dsvZCw7kPSpmLPKm?= =?us-ascii?Q?KOsv9uVjJ4CJKUMvaNa1rNU54faJdFUljiLsoWznHwXrwCFMOQgWEdFwcSu4?= =?us-ascii?Q?IMq4ICy1gZFeiXKuIVNBEfiGiIWFAAUICm4M9yqrrgxIT7HAp6VGGBP4P+nK?= =?us-ascii?Q?AJDtHWazy3OsPQAwwzDX6hC0ad1RbIgPbYjK44QQdHuTfhLw0PXE/7j/5yW4?= =?us-ascii?Q?3CNQsJ+TmAYNuBBx8HYnCk=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2701; 6:QW/jvKBjzlr4P9E9wV1cCTjzw+TQy/HnDz1z6K5e0Q91MOZVL2oLnQ1/g3nZoT17qWk7S5/GCCDvogGUtQH+jsTqV1/6s0nZZ0ZBaq7jw9RC7PgwP6eYVJUAPT2bw4/21fdGKGhD3P4N3WJHmpuHEyr0EC1ZCtoHH1Y0uXPTzZZlPMgmVD1839Hp9uzk2sqRS1ELx5x8F3bDXRkbB+B4uOkWQhpqH4kkT4fUu/tGtB9xqCDgnJG5TywI3vgvegS/sYwq4toazG5niTnMX4Kqo4mfooghAAS0hYj4VjWo5N0NBljtbdjWa6L1RgK8Qdry4I4Aej970n6zA/jqJGiJ/U5HTDVYCaTmuakl8bWGOiA=; 5:Rj4uh8G4uvMwQ9Uz8T6Ll6elEA6mSPxiyhT5vMTyAXjgEF5mdrJt30wjShBWLAFVUFJcemBzbb8Eg42o4w4L/E7YO2AnY6rxoE4TFK9GiORxWu/Qtw/miHU6x3mfZVlayLnB2B920crEZRR961ruFe+2bCkuEswEJ9qWqen/cxw=; 24:WePQm47O1K5De4UhmbuNwk5Rpc85cIEYeADg4JGCo5IQHcgAt7mUwA6QccCSYximkmRZEWphfZGDXZ5qoyxrugwSvlmumnDRKajOFiDG8Mg=; 7:jD5xc3jLwg0oZ8eHhH+gSmKAcrmg57oGQBICp/1/N/m/gYYIXEh+kFHoc4p4c7e5iUPEZsPWrj8QaHIP2g+f8WchM/EYbcgQgmza9aWhnqBuo5WVu2K8DKN0y8ZONwFY5kmrui5A+y4M4JwbDf7KvJPhgXIkZqSTrZLqcEoQwAnWlrvU8Z1GMdxFIAdLpUjdfxcKREPIGTpel/ZtXRSfQ/q16lSjmtNWCzllZSiY4d7tg05Uj362Na6JfmfH9Abw SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2017 05:04:14.4304 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 236c307c-2ade-4aae-21e0-08d535544e21 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: MWHPR03MB2701 Subject: [edk2] [PATCH edk2-platforms] [PATCH v3 6/9] Silicon/Maxim : 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 --- Silicon/Maxim/Library/Ds1307RtcLib/Ds1307Rtc.h | 59 ++++ Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.c | 327 +++++++++++++++++= ++++ .../Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.dec | 26 ++ .../Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.inf | 45 +++ 4 files changed, 457 insertions(+) create mode 100644 Silicon/Maxim/Library/Ds1307RtcLib/Ds1307Rtc.h create mode 100644 Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.c create mode 100644 Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.dec create mode 100644 Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.inf diff --git a/Silicon/Maxim/Library/Ds1307RtcLib/Ds1307Rtc.h b/Silicon/Maxim= /Library/Ds1307RtcLib/Ds1307Rtc.h new file mode 100644 index 0000000..636be88 --- /dev/null +++ b/Silicon/Maxim/Library/Ds1307RtcLib/Ds1307Rtc.h @@ -0,0 +1,59 @@ +/** 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__ + +/* + * RTC time register + */ +#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_SEC_BIT_CH 0x80 /* Clock Halt (in Register 0) */ + +/* + * RTC control register + */ +#define DS1307_CTL_REG_ADDR 0x07 + +#define START_YEAR 1970 +#define END_YEAR 2070 + +/* + * TIME MASKS + */ +#define MASK_SEC 0x7F +#define MASK_MIN 0x7F +#define MASK_HOUR 0x3F +#define MASK_DAY 0x3F +#define MASK_MONTH 0x1F + +/* + * I2C FLAGS + */ +#define I2C_REG_ADDRESS 0x2 + +typedef struct { + UINTN OperationCount; + EFI_I2C_OPERATION SetAddressOp; + EFI_I2C_OPERATION GetSetDateTimeOp; +} RTC_I2C_REQUEST; + +#endif // __DS1307RTC_H__ diff --git a/Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.c b/Silicon/Ma= xim/Library/Ds1307RtcLib/Ds1307RtcLib.c new file mode 100644 index 0000000..b09c0bf --- /dev/null +++ b/Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.c @@ -0,0 +1,327 @@ +/** Ds1307RtcLib.c + Implement EFI RealTimeClock 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 +#include +#include + +#include "Ds1307Rtc.h" + +STATIC VOID *mDriverEventRegistration; +STATIC EFI_I2C_MASTER_PROTOCOL *mI2cMaster; + +/** + Read RTC register. + + @param RtcRegAddr Register offset of RTC to be read. + + @retval Register Value read + +**/ + +STATIC +UINT8 +RtcRead ( + IN UINT8 RtcRegAddr + ) +{ + RTC_I2C_REQUEST Req; + EFI_STATUS Status; + UINT8 Val; + + Val =3D 0; + + Req.OperationCount =3D 2; + + Req.SetAddressOp.Flags =3D 0; + Req.SetAddressOp.LengthInBytes =3D sizeof (RtcRegAddr); + Req.SetAddressOp.Buffer =3D &RtcRegAddr; + + Req.GetSetDateTimeOp.Flags =3D I2C_FLAG_READ; + Req.GetSetDateTimeOp.LengthInBytes =3D sizeof (Val); + Req.GetSetDateTimeOp.Buffer =3D &Val; + + Status =3D mI2cMaster->StartRequest (mI2cMaster, FixedPcdGet8 (PcdI2cSla= veAddress), + (VOID *)&Req, + NULL, NULL); + 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 + +**/ + +STATIC +VOID +RtcWrite ( + IN UINT8 RtcRegAddr, + IN UINT8 Val + ) +{ + RTC_I2C_REQUEST Req; + EFI_STATUS Status; + + Req.OperationCount =3D 2; + + Req.SetAddressOp.Flags =3D 0; + Req.SetAddressOp.LengthInBytes =3D sizeof (RtcRegAddr); + Req.SetAddressOp.Buffer =3D &RtcRegAddr; + + Req.GetSetDateTimeOp.Flags =3D 0; + Req.GetSetDateTimeOp.LengthInBytes =3D sizeof (Val); + Req.GetSetDateTimeOp.Buffer =3D &Val; + + Status =3D mI2cMaster->StartRequest (mI2cMaster, FixedPcdGet8 (PcdI2cSla= veAddress), + (VOID *)&Req, + NULL, NULL); + 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; + + if (mI2cMaster =3D=3D NULL) { + return EFI_DEVICE_ERROR; + } + + 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 BcdToDecimal8 (Second & MASK_SEC); + Time->Minute =3D BcdToDecimal8 (Minute & MASK_MIN); + Time->Hour =3D BcdToDecimal8 (Hour & MASK_HOUR); + Time->Day =3D BcdToDecimal8 (Day & MASK_DAY); + Time->Month =3D BcdToDecimal8 (Month & MASK_MONTH); + + // + // RTC can save year 1970 to 2069 + // On writing Year, save year % 100 + // On Reading reversing the operation e.g. 2012 + // write =3D 12 (2012 % 100) + // read =3D 2012 (12 + 2000) + // + Time->Year =3D BcdToDecimal8 (Year) + + (BcdToDecimal8 (Year) >=3D 70 ? START_YEAR - 70 : END_YEAR = -70); + + 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. + +**/ +EFI_STATUS +EFIAPI +LibSetTime ( + IN EFI_TIME *Time + ) +{ + if (mI2cMaster =3D=3D NULL) { + return EFI_DEVICE_ERROR; + } + + if (Time->Year < START_YEAR || Time->Year >=3D END_YEAR){ + DEBUG ((DEBUG_ERROR, "WARNING: Year should be between 1970 and 2069!\n= ")); + return EFI_INVALID_PARAMETER; + } + + RtcWrite (DS1307_YR_REG_ADDR, DecimalToBcd8 (Time->Year % 100)); + RtcWrite (DS1307_MON_REG_ADDR, DecimalToBcd8 (Time->Month)); + RtcWrite (DS1307_DATE_REG_ADDR, DecimalToBcd8 (Time->Day)); + RtcWrite (DS1307_HR_REG_ADDR, DecimalToBcd8 (Time->Hour)); + RtcWrite (DS1307_MIN_REG_ADDR, DecimalToBcd8 (Time->Minute)); + RtcWrite (DS1307_SEC_REG_ADDR, DecimalToBcd8 (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; +} + +STATIC +VOID +I2cDriverRegistrationEvent ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + EFI_STATUS Status; + EFI_I2C_MASTER_PROTOCOL *I2cMaster; + UINTN BusFrequency; + + Status =3D gBS->LocateProtocol (&gEfiI2cMasterProtocolGuid, NULL, (VOID = **)&I2cMaster); + + gBS->CloseEvent (Event); + + ASSERT_EFI_ERROR (Status); + + Status =3D I2cMaster->Reset (I2cMaster); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: I2CMaster->Reset () failed - %r\n", + __FUNCTION__, Status)); + return; + } + + BusFrequency =3D FixedPcdGet16 (PcdI2cBusFrequency); + Status =3D I2cMaster->SetBusFrequency (I2cMaster, &BusFrequency); + if (EFI_ERROR (Status)) { + DEBUG ((DEBUG_ERROR, "%a: I2CMaster->SetBusFrequency () failed - %r\n", + __FUNCTION__, Status)); + return; + } + + mI2cMaster =3D I2cMaster; +} + +/** + 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. + + @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 + ) +{ + // + // Register a protocol registration notification callback on the driver + // binding protocol so we can attempt to connect our I2C master to it + // as soon as it appears. + // + EfiCreateProtocolNotifyEvent ( + &gEfiI2cMasterProtocolGuid, + TPL_CALLBACK, + I2cDriverRegistrationEvent, + NULL, + &mDriverEventRegistration); + + return EFI_SUCCESS; +} diff --git a/Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.dec b/Silicon/= Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.dec new file mode 100644 index 0000000..5312551 --- /dev/null +++ b/Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.dec @@ -0,0 +1,26 @@ +#/** @file +# +# 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. +# +#**/ + +[Defines] + DEC_SPECIFICATION =3D 0x0001001A + PACKAGE_NAME =3D Ds1307RtcLib + PACKAGE_GUID =3D 0c095cf6-834d-4fa2-a5a0-31ac35591ad2 + PACKAGE_VERSION =3D 0.1 + +[Guids] + gDs1307RtcLibTokenSpaceGuid =3D { 0xd939eb84, 0xa95a, 0x46a0, { 0xa8, 0x= 2b, 0xb9, 0x64, 0x30, 0xcf, 0xf5, 0x99 }} + +[PcdsFixedAtBuild] + gDs1307RtcLibTokenSpaceGuid.PcdI2cSlaveAddress|0|UINT8|0x00000001 + gDs1307RtcLibTokenSpaceGuid.PcdI2cBusFrequency|0|UINT32|0x00000002 diff --git a/Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.inf b/Silicon/= Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.inf new file mode 100644 index 0000000..c0f1268 --- /dev/null +++ b/Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.inf @@ -0,0 +1,45 @@ +# @Ds1307RtcLib.inf +# +# 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 0x0001001A + BASE_NAME =3D Ds1307RtcLib + FILE_GUID =3D 7112fb46-8dda-4a41-ac40-bf212fedfc08 + MODULE_TYPE =3D BASE + VERSION_STRING =3D 1.0 + LIBRARY_CLASS =3D RealTimeClockLib + +[Sources.common] + Ds1307RtcLib.c + +[Packages] + EmbeddedPkg/EmbeddedPkg.dec + MdePkg/MdePkg.dec + Silicon/Maxim/Library/Ds1307RtcLib/Ds1307RtcLib.dec + +[LibraryClasses] + DebugLib + UefiBootServicesTableLib + UefiLib + +[Protocols] + gEfiDriverBindingProtocolGuid ## CONSUMES + gEfiI2cMasterProtocolGuid ## CONSUMES + +[FixedPcd] + gDs1307RtcLibTokenSpaceGuid.PcdI2cSlaveAddress + gDs1307RtcLibTokenSpaceGuid.PcdI2cBusFrequency + +[Depex] + gEfiI2cMasterProtocolGuid --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel From nobody Mon Apr 29 07:08:14 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 1511759063854251.65730320251373; Sun, 26 Nov 2017 21:04:23 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 5F6222211B406; Sun, 26 Nov 2017 21:00:01 -0800 (PST) Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0086.outbound.protection.outlook.com [104.47.40.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 760042211B400 for ; Sun, 26 Nov 2017 20:59:59 -0800 (PST) Received: from MWHPR03CA0009.namprd03.prod.outlook.com (10.175.133.147) by CO2PR03MB2357.namprd03.prod.outlook.com (10.166.93.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Mon, 27 Nov 2017 05:04:20 +0000 Received: from BL2FFO11FD035.protection.gbl (2a01:111:f400:7c09::144) by MWHPR03CA0009.outlook.office365.com (2603:10b6:300:117::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Mon, 27 Nov 2017 05:04:19 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD035.mail.protection.outlook.com (10.173.161.131) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Mon, 27 Nov 2017 05:04:19 +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 vAR53iMZ000785; Sun, 26 Nov 2017 22:04:16 -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.40.86; helo=nam03-co1-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: Mon, 27 Nov 2017 16:21:55 +0530 Message-ID: <1511779917-9255-8-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> References: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131562326595582885; (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)(376002)(346002)(39380400002)(2980300002)(1110001)(1109001)(339900001)(189002)(50944005)(199003)(50466002)(97736004)(498600001)(4326008)(305945005)(2201001)(2906002)(16799955002)(8936002)(54906003)(966005)(356003)(48376002)(110136005)(8676002)(316002)(81156014)(16586007)(189998001)(47776003)(36756003)(86362001)(81166006)(6306002)(105606002)(5660300001)(77096006)(33646002)(8656006)(50226002)(106466001)(53936002)(53376002)(15188155005)(68736007)(76176999)(50986999)(51416003)(6666003)(104016004)(2950100002)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:CO2PR03MB2357; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD035; 1:XugRcnPViXNH9kJr87MPcdyDYvRhOgQLwLO0+zVgpWaPxIJDPTv+bjJv3iowjPk7Cv/YNH5SsSogePYt314Rwx0oPt9K3AbiTHff3ixy9G1Bj3Tf1PcTH7PDEVW38i5Q MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: e001a653-c4f5-4072-5a44-08d535545102 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603258); SRVR:CO2PR03MB2357; X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2357; 3:Eh/B25gEgBxmbNzE3YZARJhVtbt6FdWRh6eAoZDb/qayJYKCsPC/UrqdOWbIWaeuj4xefZqqff80Vg2rVM1XBSKWST39OHx2IcMBVNjglvKb92SgS3RXRIgBj45MzwfSVjesEbsjfLQeuh6u0ODYHse8fvTIPqrxDgkA8yEIpkjiEZ0jsc2w4ZZXIWMuj7DscYA7st9rfkGpCC2mrLWHlRqlbLIaHylUe6I9y7dLx2uKgAfc+sRUWgLey6kRi2Rkphq8oTbuQ13cVqgqkPc/4YVsETztPUGGp+9XIbzgq2It2fsEeGgBLEfCUP5DkCQ1XbNQ+XKAvHC5OKk0FW8rKuiJiwPojk5HEf3YwQiegjg=; 25:/+lm/AXGvHsD+OZAVzob5eNKCIwch/HqbUmpTdZKBOevuso2rj854pMcyZE2y+/+JBFnU5wh4i/Lr5l2xIQeyeonn7q/Iy7x29crCidH2ZhI01SyrHO5x3oC5IjBlzYSC+1LHIrKBdn8xMjAqHteVjYXzFAkPaJWx6VWml/u3s6pZCb0QJOy4aWtVB/feKXzOBQ9MXC6+TxrxIkXqTKjKYb0qjiWmraD0ScuKXHBak0Ar/emSgtxOVqvMBHYyffNft6TQtejovcnwd/HTY+7EFrOgt9ZFUV+KKO0IjvoviA476G0O/jYYwkJ4yFnq30bINGTTH/1LNZBJo89nl4gRw== X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO2PR03MB2357: X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2357; 31:ujbtzCU8vxBAjv38tHwWz5Su0nrjL736cZpWFTEm49UMccoFTQ47FhkOL1IoDLNYJwzywvQmMH0tbfQVlNdxc486dv+Uc1HWL5PtmaAnn3xN+f8M4kgvmgRaFXBUcWU/39ShFZyk2NMgBG+gPEG/+QHNhRjz8btoTCGa+wAWCf88+oaeJ7k8DL0AEU+gkDgNxFC+i3j40rAjl6MKtGKYGzcIUY3IxM32TvcX29qB+zg=; 4:ZU7TE+D7KpieEuNYc1Y+Pcr2ZtAIw8YN6clLNajEkIFGkpw0BoRscecQsEiwNH8XA5Aze0nBDJw/eDp2QUvh5YEyRDVD0flmiD5i43r4zAfxUPcYMnoGsdEoGsTQO5ZFpD03vNwJXDJ3NAOkwsnnc6NMvbHleuP8fSZWFtiAEmMeu6z+Hf209WGbuSdbsxpyLARCTvXrCmh2HXSE7lzEP+jz62F9Wv6kSSb2YaPMUFnupN86w/uBsxmiiaNBOehk9eMUkZATKCcKcZmoEaQ9HsdNblwMjYMyAb2Bw/SZlqIRnPtSAg7xHINLle/v6/Cr X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(3002001)(3231022)(10201501046)(93006095)(93001095)(6055026)(6096035)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123565025)(20161123559100)(20161123563025)(20161123561025)(20161123556025)(201708071742011); SRVR:CO2PR03MB2357; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:CO2PR03MB2357; X-Forefront-PRVS: 0504F29D72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CO2PR03MB2357; 23:oS/NAN3CrmpQMz0LCxIMLiHuYq21A3jW8IMrxMYnt?= =?us-ascii?Q?1DjmjlGQf4pmZ6PX1dV9GhMf7ztgdjKvnDQOixPf4R0JFy0Ys5H7YX4fgBFW?= =?us-ascii?Q?trDq6/ErGQBGJ571BTivIIwCvit6aADU5PHkUizYLshYGbCEYPux2ocRs97+?= =?us-ascii?Q?z3XE6BQ41sNa3RxGDfC5qiL2yNIOVLU0keLoAQ+oCpXwakEFLVO4Henzm0gQ?= =?us-ascii?Q?XjEFtWKVjKvLHxgWPg1LsNsBoAafR1R72iQOa46IEisUJPNjvnB3DpK6Stx0?= =?us-ascii?Q?hjn2zrgimwl/fnZf7O5mRNNCynEFGUoEC19B3294af4H0FHG+dL5BlT0fb8p?= =?us-ascii?Q?+Plq4tiMeWo9cGFxEQlD+ZVIZ8gDYddTRMgWKYeGu/38+QKgtCsHDTgH2c+5?= =?us-ascii?Q?NlnjtPNodxLp/AWrL7JvdPJ+1v808n3HvJWkKn/0E7j4gORCKzVEm4NuVbIf?= =?us-ascii?Q?2zxTccVuUYWrE9CDVOJ6DK7UXijLFaBuNvtu4sxqrB+AyeHViB7dU/1WtQMI?= =?us-ascii?Q?+0Sw7V9MHK8n6os5aYIdSGW4WuKpY0K478us+RsJxKUn8D6i7gXkczyv43eE?= =?us-ascii?Q?BRpg3oqBGtjNu/H65ELUDyd1WsPvLngW1qv1eBw72nxyaBBWUOHJWFQPxDRN?= =?us-ascii?Q?DstOHpOp+4U5ymZv0d9QfbMX6X3bfYLLFBakErhL7To0MC9wlT9+c8SybvpH?= =?us-ascii?Q?ZJ9B8ukrKW2AnCOm5RtTFDGwznBJH/MdoZCnYbwYJ5HoIkrqkbGsELamAzcC?= =?us-ascii?Q?qOeJehmezEMbhabL3tYX+rmKX7pA9LPZyqD0AWXXv+cqbEiShBmSjhmPTenF?= =?us-ascii?Q?cMy25ofzEm1hYQZBrwa+sIfFCqsFGdYqk1UWmXi7AAuYJPcJlY3HrRtxry/S?= =?us-ascii?Q?tY8LhYm7wX5k3TNwr9wBZhr3xXVsfg4YoQLCDRB7rjIPkf3x8+WnyUcZmtPX?= =?us-ascii?Q?z+qBLVYhklk0JUf4IOCgVBmZyexJU2N1iU1D6XnHM2j/oVWcPm5kKC18Fy2u?= =?us-ascii?Q?mtUjNjpXmLPzBf0aGb+qTKYl63yVtx7r86ZU2mYtocRTb0fR358Pr3ABSkii?= =?us-ascii?Q?hAC4OaJrXXC09BASAsiJhT7r/0cMemh7SQ3N2yud2XSSjGiWIcufjx9un77F?= =?us-ascii?Q?+EhQXDP5FUqGRulsot2mopKk64S4Ez52r6PXifmCpvQ+Kgog9iMxSOSHecf3?= =?us-ascii?Q?SIFKv/SJx2ZCUOQwmPosCfWc7OlgBtQkfRZJO3fDvkTkBmFEHxBGwDVbRUV5?= =?us-ascii?Q?FgEI2KGDpCvgFexANycngBkT1D6DrAMroaxkJkHmNsgrpC+YjiQ0nJ3Y/3bY?= =?us-ascii?B?Zz09?= X-Microsoft-Exchange-Diagnostics: 1; CO2PR03MB2357; 6:s/O3dpqmKKXclH3INCoW8P3f29NvmzSt+4kfMMzoqV2uOJ2BVxZUBMyG5WJpik5qrjlSpbnw7jZK7TMrK41/ovfESTuJZsKbqKCYmY3qf64cuwYuroOWl9jvC7VLUsTyp/2QvMFKN40DwXOCrEXOv9rABmRu18794nD4tW2jB4H91EyPE87OWqKG2udWTegEG8UmvEUzOVS0CmpnviR7AvneZPynAXVjIZoe+isafqFV5kXvNl0eeE16EGtJSmtl3uQKvRqA3cf60uBW62faTqblVhYtv90zfoOx8qcOdcpLtD2TfACaI9IEzaYW9sVORdx2fQ597tBIImybZs17jFzA3V9heW24Zh/BtIm/2aU=; 5:GcJKZ0YeJ2j6YEOnszgOZuNfz0K0LQC4uKKRhmkW/ow2aIy06lD/RCjomZakkj5Kpu6K8SZSwXpigJ3nOROLw+NcFzqo22LS5hFg+L+6dDNPQdt7kXZEfwHnqh1HlB/0ZNYMbVPwOu3dq5ziAbeHZ/u947soPL4Q1kTX+YLP3ss=; 24:s38EZ1n+xL282S8iVkNuK/A624lIOXNyZa5UpXHdSeyoEi1f1ynpLs99TFS91TJyRDMSqKmdShPRYCj7RZntXnHX+xCpU4S68ommyKWeAZk=; 7:Ylep57FNFDi4HvZwx9rEqsJs6FL9ESuL2A62Tb+j5IVoh1I9HQAnl1i9Zbc1t/tbT5vfhK0tJf/CDCj4eCC7ovpkf27uPtgzVOy6Tg4m/zkY4nzLhp4FOUUrx8ok9s7Hh8pOakPA9VRGTd2R0105y9x/025KPuCrHXGINgdpHUZX0aAO+knDEs4EN6agl6naqsVsWzzpM2sx2vVTGRbK6SHxeS/MWxJ4g69CsYfbOihMS67xphTEN5vvQNUFtZus SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2017 05:04:19.3866 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e001a653-c4f5-4072-5a44-08d535545102 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: CO2PR03MB2357 Subject: [edk2] [PATCH edk2-platforms] [PATCH v3 7/9] 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..21f5215 --- /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_I= NFO); + *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..e4ec451 --- /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 0x0001001A + 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 + 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..2e085c9 --- /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..72be71a --- /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_V= IRTUAL_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 Mon Apr 29 07:08:14 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 15117590711659.592827520731248; Sun, 26 Nov 2017 21:04:31 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id A2C322211B409; Sun, 26 Nov 2017 21:00:08 -0800 (PST) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0078.outbound.protection.outlook.com [104.47.34.78]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 12A142211B400 for ; Sun, 26 Nov 2017 21:00:08 -0800 (PST) Received: from BN6PR03CA0062.namprd03.prod.outlook.com (10.173.137.24) by MWHPR03MB2701.namprd03.prod.outlook.com (10.168.207.135) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Mon, 27 Nov 2017 05:04:27 +0000 Received: from BL2FFO11FD007.protection.gbl (2a01:111:f400:7c09::191) by BN6PR03CA0062.outlook.office365.com (2603:10b6:404:4c::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Mon, 27 Nov 2017 05:04:27 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD007.mail.protection.outlook.com (10.173.161.3) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Mon, 27 Nov 2017 05:04:27 +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 vAR53iMa000785; Sun, 26 Nov 2017 22:04: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.34.78; 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: Mon, 27 Nov 2017 16:21:56 +0530 Message-ID: <1511779917-9255-9-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> References: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131562326675207133; (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)(346002)(376002)(39860400002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(48376002)(50466002)(2201001)(6666003)(33646002)(16586007)(110136005)(575784001)(54906003)(86362001)(8936002)(51416003)(50226002)(6306002)(53946003)(16799955002)(105606002)(5660300001)(85426001)(2950100002)(561924002)(106466001)(5890100001)(2906002)(97736004)(316002)(50986999)(4326008)(76176999)(81166006)(498600001)(68736007)(81156014)(189998001)(8676002)(47776003)(36756003)(53936002)(53376002)(104016004)(8656006)(305945005)(356003)(77096006)(15188155005)(966005)(579004)(559001)(19627235001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR03MB2701; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD007; 1:BxgFDLYkLxUltW3JRJXcLnrHqSAtwfuWfoMHuoQaOe/TLfVwqAZebqRnyyQ9OWJKVBU4YqJTVBgNRIho3LbcuSilyuxWTVX0zkFY4iZHWg1/o1bHiDL71bYKd1GbX+hp MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 48321379-f1a7-4a01-b3dd-08d5355455c3 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603258); SRVR:MWHPR03MB2701; X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2701; 3:nOR12KjHEm+Ec87ElgEIbpT2AuWNGQwVpnDIns/vHd3bxPIdfgCx+gf6coDUzOeXJ8/1ixJWmtKR7IjzrQX4nO6ZkWRD9TAsN2CdpgkJOQplaXNvIvVaQGrZJwyev6gqxneP0FN7L97YA67sonHWdHy8dfM5A7uaJQoXtP6ibKSshODQDNF2G+D9SzemI21eLOgz0gYbvyPxNwcLSSD/T9uRQebF/l1EU7baQyyTBbtr44Jd1ap+Ua3FvbggE3UqjE0PdnMPs4YnPAVajYK2//v7uRWNJeCuyfWb1BQTE+ibwUb84d9agN9tod6FPUuPmNkcG3qWMT4+xKwkTgMU13+AzbFWhSOG7utKSwjsEu4=; 25:1/C5DSK/r2kWvfuuVT7UnMeSIQltxzUiuGzlFvLasXHqTpalRQOSMJTxm9S2Q+ybH62C9re0peQxNVJlyeezyeNCAeyg0Ru3I0DMCZO6Txwq4Hud3cxNtDsshEss2nh6sV7Op3N9jt5GBrJq+7gjFxYAUn/Ye554/CMbPlqprNKbhiC2ptmC7Ok7CkSEwbrMGWREspupsuteeuRdsuCKDtUERNH7EMDHs4B9elYItTVJjTtXqeDVyee+E8ybX/1yKF8hn9MjhAOhXEDvORb2Zb8vlR4ewKWTbBsxm+Hf2ABXg9iQZYbJ9MUcFgcPNIO0aQoVWIklyV0mKHcVV/fMJQ== X-MS-TrafficTypeDiagnostic: MWHPR03MB2701: X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2701; 31:TwQ7zo4gdyFiGk1PF7+f81A7YRZNMuyanTIy6Ft+N4dskYn+i1tcCKxZsTKUwCJE3JP8XfXNUpakcfOkARZwPqAWqfvtzeqVcs9lKAiBtCg89jwKKtLQG4MigqWbplRba5WiJoVmftfVtbEK91HzgmnQUEqHLXplQxyYJHfWHRqA0EOaG3U0uuqleixpB/G8wzsic4a6sx+v1lmzLv6boL0DDMzvM1JqmiyXJ6QuKNo=; 4:NUznvfqKj+B/HXN7nAFe/v3wiGDi//A/V+aHTLXLyE9HNMRRMPDWT1PQYFpb3Fm16LdbeRLal0SIMr2+YhH0pbNiXSVuVak51qbLZbwaPk2XvW9gi9awZmbc2S+REKQw85AMkUowMJEgPqgAH1O1kbWh4p5z1/nfm6wbouu/XhN/vdFqhgq1Yxvnx6ZjLQ68PiA/m4XzvCQKTkVEF08esSJUCbF2SFHOsSJbV268IKW53hAQu5UwiFC0yhaYY0e+WhkMVU1N2CMaAQ42wngg9On4Rq0hZ/8MR8ut5o6ibxVdpqmrLX90y+vlcYB6uoBb X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(8121501046)(5005006)(3002001)(3231022)(10201501046)(93006095)(93001095)(6055026)(6096035)(20161123563025)(20161123559100)(20161123556025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123561025)(20161123565025)(201708071742011); SRVR:MWHPR03MB2701; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:MWHPR03MB2701; X-Forefront-PRVS: 0504F29D72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR03MB2701; 23:JQ+KvvbKRKiPe3L8t/Bx5Sw0/Ujit+vorIULSzKbP?= =?us-ascii?Q?zs2pISAkxIpwpP5sVyyO3/2CPK7mrHse7ycq9qdO5CRGIi/Wptxuu9U3/AX/?= =?us-ascii?Q?SAqBC32Haq8qclZEghM+g38mnMc2V77cF3GHMu+k0Bvy5jNXU8Ce954jW5m+?= =?us-ascii?Q?HB1S+nDy3CpCKSnooDDVF2a8wAi9E1baLXtSC0uDq+CJa95P14aZwPYRy5/D?= =?us-ascii?Q?mowBaFGR1W3izk+0250OIx9YsfdUXTyjYcK4QwnNjJEPXv3bCB9gxsZ66jrv?= =?us-ascii?Q?rerJPGO8Y3kMKEb+gTqo/6g38JWbgLTY0Gm02/L6Lwvx34pavOYl6dBhxIba?= =?us-ascii?Q?UXztW5keV+tmoPEM0x1JBqagcZzzN2A8vTz5ob3HlFcYofDstbvHkOOOAA0O?= =?us-ascii?Q?9Hp5MdG2ACDgE19zgNLjQea0SoTE6M2HcfcNmyv2GI384A0sqOqk5OQ5wVRM?= =?us-ascii?Q?0wR8cld1EUsp3cMXNlZWkFIV0DJ/BYY3wag/wuncVq6EI5WjHYj0xdPYKQE7?= =?us-ascii?Q?Tri0PugobL6jaeUyhYGJb4rnI7wmzWxvX4tAl0vGgZd0GqG8eibUAJXmCAv/?= =?us-ascii?Q?mckpmn8RlYG/EmP+zXBLSdLdeDY/Y8CDD2uv1VrvDMWquKJzsrAxpeKtc4rR?= =?us-ascii?Q?FLxkS/eDUzobfvxxfy/iiwPxkp2wXGNaZXjtmOxVqXm/t8wYDfPpt21eZFKV?= =?us-ascii?Q?D53J7Z65ymagD5lVGaHLFmMPh2HRTsa7+xd0xC6p7m3YlfX6oXKzL1rOruoY?= =?us-ascii?Q?0Ho3pJpF7dRVI7lpU2rP8ZjTNnTRJT7R8D+IXEd5mf/rF0whhSr/sb8jSltX?= =?us-ascii?Q?+tHXPZyK/apzdb/F7y5jpsHEeJ+TKJMQEVMamMhh+lpM9sqBSw+iby4tH3as?= =?us-ascii?Q?+nFwYaLE4OHjEi6qtvlCmR0HT2KLdbMgPaLyg8OEKjjTqEymVyWaNAnR96KV?= =?us-ascii?Q?4Hqt721OPw+2aD4I5onZsgWPOo3sS5juoHtm2+j7MQFCW2oLG9Yirqm/7sXo?= =?us-ascii?Q?jsnySsyo0gQXnu2Jrvz0Skf6GqmnO20AMeaYVgK/teqw91ruEt0EOgWfoxC8?= =?us-ascii?Q?bqPq8m7qdedqgCt981WDBdCinW+wpADmGJT/M0/NpNsVblRdjCGRb6bG0Avj?= =?us-ascii?Q?/BNBU1P9nPvHHoFZ49mMts7Ej0D4ITv2n41gUAw7iI5q4vGkCvtrp8f5dCP+?= =?us-ascii?Q?GeisGGtSLYPfXAzqAVvW3pkODolM5+LjUPxag2Crn1kIX3ylGFy0QyB0qMoz?= =?us-ascii?Q?vDV4ow/p1ak0vPK45nTb36tCyVLeSZ3TR3bn6ILNg71NN/XW2qpba63wfEOr?= =?us-ascii?Q?2bWnPekPWN8q8VvmNRHtuGRf6HaJytT+mrFa0B0lwRiU8PNHIoV5Nzi/hyLv?= =?us-ascii?Q?uA5VnIzHpMBv4uc7oajPblneN2Z10BJvzBqZj+VP6u2sk+OyzeM9Q+DoH8az?= =?us-ascii?Q?giPJgpzMw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; MWHPR03MB2701; 6:oRmeVOlDHrBrzQdfAKo3QDW2RV96Kl5b5+7k3lITbhxtDrIIkjmSJD5GYQxbJEQl7y3YEbeBt8o2VE+e/rHHCDI+uFPHezrOy6/nRiuwwt3uZBARbJFclX5kyOG9VUvDqJtF13sIfR5B+t7zDONoGnXNR7Osg8teVKTxAbOlrX0vT1FYGJNuDa4UDNXLbTxTa0y3KnaIaaIqyM+kkarFGD6yekWVLqz0zAB9+wpX3/gfqG25Ah06Slw4F75vHP2K+JDL41LWKDAyJE6V9UdIoENpPkKNUwoIcoIz9XX3sQTU4zlHSa1ep5jOf+K6PEhkkkq11oph8CJS76wEatE0eLZkEIUNHL1D70cagtiz0ic=; 5:Rt9LlHPjwywZPdSXw8thoxaZ22/6zk+/534TMISyx7th789UvJ2YFF8yS0tgr7ySWk9z0qhQ6Lc1yiKFK4DA6sgShVMOttFfoYtQgeCm7YaNv34dMR3iTYgs+JzQ6NRselXAwINFlszTGbC/KQmFJLwPgdK/N/krd70v4u2hGKI=; 24:sUj/EZxCxNDddPO/EQe+D+VHojM4QfqJbfZs+P0vymt7Yzi3k1DRS3QeHh/icIOK2qMJ7Zi8xULe2/cTi518JQwa9teyYu3YcShru/p1Xwc=; 7:nTiuuEn0N9ORuS/UJBzcZ5/KbLG0/ZIAAceU8500QB64/zhZ5EO+tzrR+JAT17x8IXEO4l2FmWlL6bHqi42U8oxjxU6WY55zyoRy7G3qhJScP6y6slD6pHEk6E6CeR1fPFxuKasGNl6r89E5hyA0KRWZTkGeU9q1FS3dy8wU7gxNCTnXyNHcko6q+kXbNQkA9mGnuczyA/VmhtiON/q38rldatesqevvyKdDJWmCapk7dS2b0IyjIkNPHVcCPlWa SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2017 05:04:27.3491 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 48321379-f1a7-4a01-b3dd-08d5355455c3 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: MWHPR03MB2701 Subject: [edk2] [PATCH edk2-platforms] [PATCH v3 8/9] 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 firmware device, description and declaration files. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dec | 29 ++ Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dsc | 77 +++++ Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.fdf | 281 +++++++++++++++++ Platform/NXP/NxpQoriqLs.dec | 248 +++++++++++++++ Platform/NXP/NxpQoriqLs.dsc | 453 +++++++++++++++++++++++= ++++ Silicon/NXP/LS1043A/LS1043A.dec | 22 ++ Silicon/NXP/LS1043A/LS1043A.dsc | 82 +++++ 7 files changed, 1192 insertions(+) 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 Silicon/NXP/LS1043A/LS1043A.dec create mode 100644 Silicon/NXP/LS1043A/LS1043A.dsc diff --git a/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dec b/Platform/NXP/LS= 1043aRdbPkg/LS1043aRdbPkg.dec new file mode 100644 index 0000000..af40169 --- /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..19d4d30 --- /dev/null +++ b/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.dsc @@ -0,0 +1,77 @@ +# 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 + ResetSystemLib|ArmPkg/Library/ArmSmcPsciResetSystemLib/ArmSmcPsciResetSy= stemLib.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/Silicon/Maxim/Library/Ds1307RtcLib/Ds130= 7RtcLib.inf + +[PcdsFixedAtBuild.common] + gArmPlatformTokenSpaceGuid.PcdFirmwareVendor|"LS1043a RDB board" + + # + # Board Specific Pcds + # + gNxpQoriqLsTokenSpaceGuid.PcdSerdes2Enabled|FALSE + gNxpQoriqLsTokenSpaceGuid.PcdPlatformFreqDiv|0x1 + + # + # Big Endian IPs + # + gNxpQoriqLsTokenSpaceGuid.PcdGurBigEndian|TRUE + gNxpQoriqLsTokenSpaceGuid.PcdWdogBigEndian|TRUE + + # + # I2C controller Pcds + # + gNxpQoriqLsTokenSpaceGuid.PcdI2cBus|0 + + # + # RTC Pcds + # + gDs1307RtcLibTokenSpaceGuid.PcdI2cSlaveAddress|0x68 + gDs1307RtcLibTokenSpaceGuid.PcdI2cBusFrequency|100000 + +##########################################################################= ###### +# +# Components Section - list of all EDK II Modules needed by this Platform +# +##########################################################################= ###### +[Components.common] + edk2-platforms/Platform/NXP/Drivers/WatchDog/WatchDogDxe.inf + edk2-platforms/Platform/NXP/Drivers/I2cDxe/I2cDxe.inf + + ## diff --git a/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.fdf b/Platform/NXP/LS= 1043aRdbPkg/LS1043aRdbPkg.fdf new file mode 100644 index 0000000..9a8f242 --- /dev/null +++ b/Platform/NXP/LS1043aRdbPkg/LS1043aRdbPkg.fdf @@ -0,0 +1,281 @@ +# 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 MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.i= nf + 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 + + INF edk2-platforms/Platform/NXP/Drivers/I2cDxe/I2cDxe.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..4af35a1 --- /dev/null +++ b/Platform/NXP/NxpQoriqLs.dec @@ -0,0 +1,248 @@ +# @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 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..2ea3757 --- /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 + MdeModulePkg/Universal/ResetSystemRuntimeDxe/ResetSystemRuntimeDxe.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/Silicon/NXP/LS1043A/LS1043A.dec b/Silicon/NXP/LS1043A/LS1043A.= dec new file mode 100644 index 0000000..0648327 --- /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..e2c19bf --- /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 From nobody Mon Apr 29 07:08:14 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 1511759076341896.6350220695307; Sun, 26 Nov 2017 21:04:36 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id E61AE2211B405; Sun, 26 Nov 2017 21:00:13 -0800 (PST) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0067.outbound.protection.outlook.com [104.47.34.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3AE5B2211B400 for ; Sun, 26 Nov 2017 21:00:12 -0800 (PST) Received: from CY1PR03CA0024.namprd03.prod.outlook.com (10.174.128.34) by BN3PR03MB2356.namprd03.prod.outlook.com (10.166.74.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.260.4; Mon, 27 Nov 2017 05:04:32 +0000 Received: from BL2FFO11OLC012.protection.gbl (2a01:111:f400:7c09::161) by CY1PR03CA0024.outlook.office365.com (2603:10b6:600::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.260.4 via Frontend Transport; Mon, 27 Nov 2017 05:04:32 +0000 Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11OLC012.mail.protection.outlook.com (10.173.160.159) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.20.218.12 via Frontend Transport; Mon, 27 Nov 2017 05:04:32 +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 vAR53iMb000785; Sun, 26 Nov 2017 22:04:29 -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.67; 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: Mon, 27 Nov 2017 16:21:57 +0530 Message-ID: <1511779917-9255-10-git-send-email-meenakshi.aggarwal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> References: <1511779917-9255-1-git-send-email-meenakshi.aggarwal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131562326725089512; (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)(346002)(39860400002)(376002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(174874002)(50986999)(8936002)(51416003)(16799955002)(966005)(2950100002)(68736007)(6666003)(50226002)(77096006)(498600001)(86362001)(48376002)(85426001)(53376002)(4326008)(189998001)(2201001)(15188155005)(36756003)(316002)(54906003)(110136005)(106466001)(53936002)(5660300001)(50466002)(104016004)(6306002)(33646002)(105606002)(97736004)(76176999)(8656006)(305945005)(47776003)(81166006)(16586007)(8676002)(81156014)(356003)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR03MB2356; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11OLC012; 1:pJO6iiR1N0FudqTWEW4mAutHH3b4y0QyV7YvUCueZsMdjT9qJOJbJ/9KWlXEIiyzR6y7osniKy224vGPvmVvSKyIVAkeg21Eyriy5H4YA6mV1xz/aFVh0RcKJtfyPJ+e MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b1dc3877-cee8-4ab9-162e-08d5355458b8 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(5600026)(4604075)(4534020)(4628075)(201703131517081)(2017052603258); SRVR:BN3PR03MB2356; X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2356; 3:pQLjPZA7LngVffK4jMQJtsuzRgr7QxiziJHgrsE9mKzIrvMKT6pUX9YqvxIC6I81bz0rJuPWdD9uCtC21Kkjgvignw3SuHbzf4PXDIXrf4kNFrpQHTB7Bq1lKSJY9nmcpHgVEQhLCdyDGjqTP0b7/YzfkZJYKWx7hcJ73g+GNoNqZJ1UG5ZMsAE0UmuWUwECC0EdLN/WZCUzXhhRu2OBlUdlSUv3QMwLZlKHI7m7b+5PUrhZEe0oW3ctwBA8bgc5aPwH1QXTOnpGs2muRfXw+MeuTPsB3Y89Hkx7kQLsZeF570nDnBfYWmn+Up403ymCYw26z9qeqjXIZl+3qObxYfv1VRJUb7QqF/e4W2CgyyM=; 25:mOvpd4MlIIhGWOQWs6bzlMVsDge+4QLhlgRAybXiuznktaQ95hrRffsHxx4Mh9c0VEqyb83N1m5JWBO58PWkE8rjMRkqhrCIXfAc86eUu5NYfbsTittk7pqAfYjh8it8ZIDt0fkaqMZY2X2Fy/vd5sUQwhwldjDpacE3Rrzrs/h2Nt5W5xD49j1qwhoVEOvULnMRB6OnjhKz9TExwf6B1siSnTLdgb5HUGySk0qBwtPo0/wqhV/npJU3UN/16euxFwg+KySHOmAax83op6s3ljoGR36DzVwsD2dVUjo9uf3AgCp4hL5qdG7+yS9QrftGqdIqyjv+V87b31a2lx4q1A== X-MS-TrafficTypeDiagnostic: BN3PR03MB2356: X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2356; 31:CmdhNSqcwk0/Stn+ZIMpChxG/zR71GBItJobl6tHsPdAwcCY3QeKcMBAk/lajX2ZocvQR5/IHtSM1v2+i6alcQbwViGVO1uSkorPVVevb8ersjLOP/UQZgx1jqOg6nCW5OUoK7EgXrRhG338hTDVU1IfReuzMp8GIvgATp4audgJzASrJbU2FBnFr2KU1W1kXq+XJ0N1LOQOWuSVJgjwX5uTBFCy8YPkAbclymMxgxA=; 4:Z0xIp9ImkATGIcnf4A2OQHkEifDBoLE95mZNAI/iAcmSXblVy45tloMHBFpD/VVkl+vn1979pXA/KvSfEYfsjG1X4bEqa+k+n8o2QpIW6HRxHrB+8xW9Gmu30znJdIHv7gnGJpC5C2aKOgVJLv87DI4nuHsXVzx1BIRdqAZ+JDIsAdom+bpqfxnbMbtG7vOj+tuTcgS+5N5eoWh5U5McOUYbp1N1MIDNxfH1buR/l9V4wrxmMS77d7U5QP6WqeVlljxq2fXjZ5m+xa77QungXfnFAnWOtAXHr1Py5eBbAFoZTLRUdoUwaqeKYMIAglkyQTW+E8ILDNuV6pYIdG+AhHDkEGluFG6f0Vrcpknpj6w= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(111885846020525); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(2401047)(5005006)(8121501046)(3002001)(10201501046)(3231022)(93006095)(93001095)(6055026)(6096035)(20161123561025)(201703131430075)(201703131433075)(201703131448075)(201703161259150)(201703151042153)(20161123556025)(20161123559100)(20161123563025)(20161123565025)(201708071742011); SRVR:BN3PR03MB2356; BCL:0; PCL:0; RULEID:(100000803101)(100110400095)(400006); SRVR:BN3PR03MB2356; X-Forefront-PRVS: 0504F29D72 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR03MB2356; 23:nrqNvi3g4+R7FOtzDa/PY2Ka5yNpFatjDd23dkoWx?= =?us-ascii?Q?PgeW7Wwcw213j4xe447nNCKTD9UrDVUpvMStFOFxjVLJIiyf2Z9VJVagZOx+?= =?us-ascii?Q?TKaQcOFqaPCYZXW/d4yZ267i5tLiiGY4dwSMkr4qx+bszkGKDAAjrAKNuZZZ?= =?us-ascii?Q?Wx8ItNpZzWiRIfu7lc2ukZVKk8bWbHq+rwlkYyqPSQZJxS0oOpBxI6Xh+tI9?= =?us-ascii?Q?c08QfY4uwjmfFzTFX8jcEfXUUpdeJsDHQOUJO7TKMzaE17WAe2PWykoI2I7E?= =?us-ascii?Q?CZrpgoIENZvsFDjAJTE5dANNguuAvgpH3u8AS1sUoY7AhcUJA2KH4Pg9S8kN?= =?us-ascii?Q?coqXIIyxW5Vv/qgret31N/PCVQ8VBaEblZId5E41w38sj7TEKj2BieM5XIy1?= =?us-ascii?Q?iG3fga7wwKFmjm1YtGEh/dhp7DqO6M0HAHuK5viOnG7zFdQ4AHf37unQrlPK?= =?us-ascii?Q?/23SUn0vj7W+p92pJBB97BTwRBRbJr/9gmSbiBzNfYTqL3HeLutuiuOYTw/M?= =?us-ascii?Q?Eu4lPehqre9zPhlxz63MG7C7vrXlVBjeK4rirVuQIND8zoWVEnV1HXlt+Tn1?= =?us-ascii?Q?MB6VauXJ23RxTNIbjWVHyym0pSzZFXXqh3CKPr70rRRntFrytGboRgGMz5hR?= =?us-ascii?Q?2os8QMwIO0ARFGvYjnpUVG6TO3h38WWWnLWmalSX5zH1fOvwstuakrLOX++c?= =?us-ascii?Q?oTFOtowP9RuHD5URknvtoRixbRkVDZDQRiq6oDdJU5geWEHgrYeoMJ36F93i?= =?us-ascii?Q?+sj2yV5Pgn61f08mX1cSIw/T5Qrn5dclLyt+dhZVJagGGtQImAA3I5xEP++i?= =?us-ascii?Q?u8g3LiALQTs8NVt+7GRiZdtyPyMNwG3fRZ8kmhsZNTD4Gti80+/C+jqqGWe+?= =?us-ascii?Q?b1wjsSYKRXXuN022EkDlyH9ToAkQJ67bmeaMAfE4BjnEwK7ZPQSwXSjS2bTd?= =?us-ascii?Q?jwFtwgRNSWn23gBWAzjrQZZXm5x+Z0Fn+KAju96Ba3zxnx9BrI3QWFNcX+73?= =?us-ascii?Q?Kyi6b18zpLRtZfScqu3rj4c5ZOFnW/KsEG+dKjGaIAiaF+nFj9J5pcuIrjU9?= =?us-ascii?Q?SZVtFFtXclAhOcqOdluLqm/ZA4vzBQIR6UGd/W0CoHgRhIS88WLvJHbDHpNU?= =?us-ascii?Q?wN8eastib6hyrlyfiiCOc6oVPCW9XSQOYph/JJieJoMZA/XyDxHsFtd5e7HF?= =?us-ascii?Q?1CQEnQQUuV+XXTLanoFOW01AkAZ/iA0koQO7PqwV2Umtlfn5pIbFJA/p9/xa?= =?us-ascii?Q?zEn7/annk1Gn69pqrKGBr1HmnynLbxUqE9OlIEO+JQ+xvRrFr3vRAaW2NfqN?= =?us-ascii?B?UT09?= X-Microsoft-Exchange-Diagnostics: 1; BN3PR03MB2356; 6:mesWRZUOUl5R2Zldz2WP4bw1DHuaigt7TT2yelrtoq5N27WqWiDTjoiUkyGVEcEtOLrKAYzGJ0vi9d9xIcuLk5A+QlGzf1ib6akDq6HtEbXtpnjTkapNYbrBZ8dMZFZaTpmQAUuMVrL5siEVMJK92BTeRh3scyb3u3gmqkxdyyvGfrWv1QES2L+8yz9yaBgnfxbijmOpkcmnqv/QtvsKSNjrji/Ig5y1cKs6eSXxs7GpFKVkZNtTYlkVGPSjsuSWakMGrKAhJh7Q1tHirfMOPBOGtrgaLSKm4zuFOrPLq/meC/K4073YbSXxjNM0pz7aTth7GUh4u/m6Sw4Z6UBtvMQLQkuviQfbLRiDd0U0aNQ=; 5:JpnOAgLkwSCCbpT0yQLITjiT25cELKXyreK/RTkrtQsxnGXhqsOQ0BUgyZbaR4cwNy+7iu+h3g3bcxz3kJgwgI7d4Jn8xd0OuH2HUpBa7kD/PpUS5n3DqgfLKdnPDrpN8r6cilDRwiLcstaQfvWBBQsU6HE9h964zp/LLUKYbfo=; 24:k1atvVv9GkELcHfNPG3ZHjd22FZP6WTYHDsMmqNsAX8W/10MMfiL+xSJdV/d9lldD6mFb9GiavB1g9veV2ly1odPC0YiJ0LPnauVruptMVc=; 7:eVzW2sweD/9LAst1aFA24gPszhAMpch3e+pFRjPlHlPJuct53Qt0/whL4yTiw/bFupAEY3/eAjjFaEdnAFuXiGCTsA7WXZoWjHVo/PaAb7TZQDDLyZpH7sVmcEoat3L14iFEPG1ccmB7pM8S9sRIcowJnnbCmDQRCknubecUncjfaUuTx5u6nco2OcT9h8T1lhKuHQv1xFGnhbRSkYhTik1wwUYwYDdDWpR9SpczgAeYMI5lC0nDj0WGCN+ovSJY SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Nov 2017 05:04:32.3217 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b1dc3877-cee8-4ab9-162e-08d5355458b8 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: BN3PR03MB2356 Subject: [edk2] [PATCH edk2-platforms] [PATCH v3 9/9] Build : Add build script and environment script 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" Build script and Environment setup script. Readme to explain how to run build script Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Meenakshi Aggarwal --- Platform/NXP/Env.cshrc | 77 ++++++++++++++++++++++++++++++++++++ Platform/NXP/Readme.md | 15 +++++++ Platform/NXP/build.sh | 103 +++++++++++++++++++++++++++++++++++++++++++++= ++++ 3 files changed, 195 insertions(+) create mode 100755 Platform/NXP/Env.cshrc create mode 100644 Platform/NXP/Readme.md create mode 100755 Platform/NXP/build.sh diff --git a/Platform/NXP/Env.cshrc b/Platform/NXP/Env.cshrc new file mode 100755 index 0000000..31abb04 --- /dev/null +++ b/Platform/NXP/Env.cshrc @@ -0,0 +1,77 @@ +# @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 + +export PACKAGES_PATH=3D$PWD/../../../edk2-platforms diff --git a/Platform/NXP/Readme.md b/Platform/NXP/Readme.md new file mode 100644 index 0000000..a11b90c --- /dev/null +++ b/Platform/NXP/Readme.md @@ -0,0 +1,15 @@ +Support for all NXP boards is available in this directory. + +# How to build + +build script source environment file Env.cshrc + +user need to run only build command. + +1. 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..e465ebf --- /dev/null +++ b/Platform/NXP/build.sh @@ -0,0 +1,103 @@ +#!/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. +# + +# source environment file +source Env.cshrc + +# 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 --=20 1.9.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel