From patchwork Tue Dec 21 12:51:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 526687 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 171AFC43217 for ; Tue, 21 Dec 2021 12:51:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237766AbhLUMvd (ORCPT ); Tue, 21 Dec 2021 07:51:33 -0500 Received: from mail-mw2nam12on2053.outbound.protection.outlook.com ([40.107.244.53]:4928 "EHLO NAM12-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235157AbhLUMvd (ORCPT ); Tue, 21 Dec 2021 07:51:33 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J1f9snyuBc8lsoUx0PZXn6owQEnFqG8PzUTons85UQkufqYOCd0cU71lCvMqbqNsDuGqqEKvSUg1UvZHI/UAF9iLPGutmRRSiRqp+yXk1ln2Vm7zMVEeGEKCKYPjxz2+TeemwAtN11ELC+vgKNHb8iNiYov9XKznALcFtSLf0AuFqvEHCeAV4NgxwgRBIoO1zK85w2VzobwoRd7NpaPNU1Bjmn8H6jlkCvMe6yAOS6+wLtonHeM4fAN+UCdKrMBDFKGzrHhNxhIpQikgsfYPehcb0ZmPySACF9QIv5ee0tkQfiK7S9RhAoHMW6ZhmrkbUfNcj0RgXl2JiMnb6EhnWg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/2KBrdKJnqi/sr5Z9lw2Jj4KvhINWL7vuMhcbWuIfos=; b=OJmLsvTJ1qFwcyfSnroRhowERRJx9yyUk0THWpjbzwdxzQag9xb6cQ7RlZbm9sdDC83t1FJsUNpyYhccgxxOC6mcl3RoLl4Yu+12iJFIQcEgfqTDnJ9+lAL55ExMSsnXqvTVFlMdDu1DZoLCKUzIYt1pwpntJz7eLdHSWY+4iL8LGZJcK9Ix+xAg4GweNAyVhOAURVoLNkWTaG7xpyTY+M1fQQIs9eeKZU80OrVw34wzbzVgccoGzFY7QF66cnW4yX06+uEZtB3GyvyYXcGhkri9Tbjc0uAq3d4e280OlD0f0a5qBBfqrSxA7AGhzNxVNTFNfn0zI8qjcaNyVi30cw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.234) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/2KBrdKJnqi/sr5Z9lw2Jj4KvhINWL7vuMhcbWuIfos=; b=sJN0eiYJdXakue2Bq3pHuHAHlOQN6jncyY3FtXA3TCzLLh35TUe4OtHsSDbf7oMDKZMpQ0pJY4fb3SWz9VckBDkKyKjWE2rYVIzrMv8oIbhDUV5KdN1jyO8+d3LFDBtYTMDUFrmOKMjaxvVWkkja7/j937+wGO7TWTDTv7gyTMbZVREbgvw05SIUINn1bixnWtLtLHttb+7yef6ID3LpMrX5U8ZH++1sL2DyTiajHAnKPWkiTmUWZwgOGPsScC3TbFVjy8vTdY/0TJZIWMy+l5XbTR1zoPAJgfsb4QekmYAggamsL8IDRw7KaVSkzV2/wJ4sGVoY9GcNMWGXBT64tQ== Received: from MWHPR2001CA0022.namprd20.prod.outlook.com (2603:10b6:301:15::32) by MWHPR1201MB0158.namprd12.prod.outlook.com (2603:10b6:301:56::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14; Tue, 21 Dec 2021 12:51:31 +0000 Received: from CO1NAM11FT047.eop-nam11.prod.protection.outlook.com (2603:10b6:301:15:cafe::9d) by MWHPR2001CA0022.outlook.office365.com (2603:10b6:301:15::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Tue, 21 Dec 2021 12:51:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.234) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.234 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.234; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.234) by CO1NAM11FT047.mail.protection.outlook.com (10.13.174.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4801.14 via Frontend Transport; Tue, 21 Dec 2021 12:51:31 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by DRHQMAIL101.nvidia.com (10.27.9.10) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Dec 2021 12:51:30 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Dec 2021 04:51:30 -0800 Received: from sumitg-l4t.nvidia.com (172.20.187.6) by mail.nvidia.com (172.20.187.12) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 21 Dec 2021 12:51:27 +0000 From: Sumit Gupta To: , , , , , CC: , , , , Subject: [Patch v3 2/9] dt-bindings: arm: tegra: Add NVIDIA Tegra194 CBB1.0 binding Date: Tue, 21 Dec 2021 18:21:10 +0530 Message-ID: <20211221125117.6545-3-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211221125117.6545-1-sumitg@nvidia.com> References: <20211221125117.6545-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 197dfe3e-cbff-4e56-c969-08d9c4809caa X-MS-TrafficTypeDiagnostic: MWHPR1201MB0158:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vwBCTC7fBhZ01Q0okE9WqL1ca4YupNQfhgLjhOLe8oxbr0emYvcT4vrEYfpxiWEEk1nWzI4VbFeORYRzfkaoTVea3FYsr7QfTCEGe+hYH/ubtiKczRm+kBbnrEba7FU4SDfCRxPqwaMEJdHA+fCAvTr+S/Wa9+sWuGXm3Y72n9YfSD2PhHfO6xk6qKO27AcrE8BmguBdVBaFP02rrotKBi4RBXSBFTFNQ3/lqklOKZLWTZBusxG4MvUYX1JeRrSCdMuEG2TPVKZ7+HQE4Xh1WMamwfls/adEzO87BJr0sg7u/kpCnvs/kHNnZKZOhVBHtdJFbR9XFnzToNAPlKwss6jmSVXGJDs+UlrWQ61U6/FLJm0XBQMtA5374nK5NkyhW51M1nqv4g/AQSvCw3/Ax8UUvFm1mVsCxHXGW91CRVZGKpOnPC5DrJ1ZMjYjy1RTZP5HeO9+3pY7g7N2zq31IQxIzlUwAm61wxX4VmvteMCWUZJJQ+Sm4dGFTXJojaY2haoKoFa0IY4VZ162CFlfJT2xvecfBJ5AkSACTq3R+HLXUwfPWVkxn4+Hxt4fRqDZ/NCh9tnnJsc6+wKa4u5BkTg8A+XnDVmp82uFV4CUtKofJSRzxIQcG10eEbGNhxvutEdmqUB+JOMfK4eN19PAuOCp5IcVGuH+VTkY937tfi+lR92wLrAK6YpCSXqjri4XkWsEfGRIqtza9hG6GMWIURHyfbpoqwkHarAGjZwVMkGcynPj7lBIWU1nkjMoZpPGUReluHDfJRzBukgSRzy3bBYIqddOwLCZ2Y48viLkmDICAmicEPes2YFYYzC7NsE4PR2mYdaZWxlWUC4qsNSWhKQVux3LuU/gMd4X8KXnC82cxq2ut5rO4j3UcMxtzCzInBqa8Un5fh8eEZCbevG6caZe2f4FzFkbV7YD0c29NomuN68eswOG2nb19xgGCG44DisSyyiu0+n0vuILA3usHg== X-Forefront-Antispam-Report: CIP:12.22.5.234; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(36840700001)(40470700002)(46966006)(82310400004)(70206006)(8936002)(110136005)(2906002)(36756003)(40460700001)(54906003)(70586007)(2616005)(336012)(426003)(356005)(47076005)(81166007)(34020700004)(36860700001)(107886003)(5660300002)(6666004)(26005)(186003)(1076003)(83380400001)(316002)(508600001)(86362001)(4326008)(8676002)(7696005)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2021 12:51:31.1682 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 197dfe3e-cbff-4e56-c969-08d9c4809caa X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.234]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT047.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR1201MB0158 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Add device-tree binding documentation to represent the error handling driver for Control Backbone (CBB) version 1.0 used in Tegra194 SOC. The driver prints debug information about failed transactions due to illegal register accesses on receiving interrupt from CBB. Signed-off-by: Sumit Gupta --- .../arm/tegra/nvidia,tegra194-cbb.yaml | 93 +++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/tegra/nvidia,tegra194-cbb.yaml diff --git a/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra194-cbb.yaml b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra194-cbb.yaml new file mode 100644 index 000000000000..3167f0450298 --- /dev/null +++ b/Documentation/devicetree/bindings/arm/tegra/nvidia,tegra194-cbb.yaml @@ -0,0 +1,93 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: "http://devicetree.org/schemas/arm/tegra/nvidia,tegra194-cbb.yaml#" +$schema: "http://devicetree.org/meta-schemas/core.yaml#" + +title: NVIDIA Tegra194 CBB 1.0 device tree bindings + +maintainers: + - Sumit Gupta + +description: |+ + The Control Backbone (CBB) is comprised of the physical path from an initiator to a target's + register configuration space. CBB 1.0 has multiple hierarchical sub-NOCs (Network-on-Chip) and + connects various initiators and targets using different bridges like AXIP2P, AXI2APB. + + This driver handles errors due to illegal register accesses reported by the NOCs inside the CBB. + NOCs reporting errors are cluster NOCs "AON-NOC, SCE-NOC, RCE-NOC, BPMP-NOC, CV-NOC" and "CBB + Central NOC" which is the main NOC. + + By default, the access issuing initiator is informed about the error using SError or Data Abort + exception unless the ERD (Error Response Disable) is enabled/set for that initiator. If the ERD + is enabled, then SError or Data Abort is masked and the error is reported with interrupt. + + - For CCPLEX (CPU Complex) initiator, the driver sets ERD bit. So, the errors due to illegal + accesses from CCPLEX are reported by interrupts. If ERD is not set, then error is reported by + SError. + - For other initiators, the ERD is disabled. So, the access issuing initiator is informed about + the illegal access by Data Abort exception. In addition, an interrupt is also generated to + CCPLEX. These initiators include all engines using Cortex-R5 (which is ARMv7 CPU cluster) and + engines like TSEC (Security co-processor), NVDEC (NVIDIA Video Decoder engine) etc which can + initiate transactions. + + The driver prints relevant debug information like Error Code, Error Description, Master, Address, + AXI ID, Cache, Protection, Security Group etc on receiving error notification. + +properties: + $nodename: + pattern: "^[a-z]+-noc@[0-9a-f]+$" + + compatible: + enum: + - nvidia,tegra194-cbb-noc + - nvidia,tegra194-aon-noc + - nvidia,tegra194-bpmp-noc + - nvidia,tegra194-rce-noc + - nvidia,tegra194-sce-noc + + reg: + maxItems: 1 + + interrupts: + description: + CCPLEX receives secure or nonsecure interrupt depending on error type. A secure interrupt is + received for SEC(firewall) & SLV errors and a non-secure interrupt is received for TMO & DEC + errors. + items: + - description: non-secure interrupt + - description: secure interrupt + + nvidia,axi2apb: + $ref: '/schemas/types.yaml#/definitions/phandle' + description: + Specifies the node having all axi2apb bridges which need to be checked for any error logged + in their status register. + + nvidia,apbmisc: + $ref: '/schemas/types.yaml#/definitions/phandle' + description: + Specifies the apbmisc node which need to be used for reading ERD register. + +additionalProperties: false + +required: + - compatible + - reg + - interrupts + - nvidia,axi2apb + - nvidia,apbmisc + +examples: + - | + #include + + cbb-noc@2300000 { + compatible = "nvidia,tegra194-cbb-noc"; + reg = <0x02300000 0x1000>; + interrupts = , + ; + nvidia,axi2apb = <&axi2apb>; + nvidia,apbmisc = <&apbmisc>; + status = "okay"; + }; From patchwork Tue Dec 21 12:51:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 526686 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4B31FC433FE for ; Tue, 21 Dec 2021 12:51:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237835AbhLUMvl (ORCPT ); Tue, 21 Dec 2021 07:51:41 -0500 Received: from mail-dm6nam11on2087.outbound.protection.outlook.com ([40.107.223.87]:24160 "EHLO NAM11-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S235157AbhLUMvk (ORCPT ); Tue, 21 Dec 2021 07:51:40 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=khN815j9hq9I5sVIHRzg91Il5uReexTsIFg9JFNB3G240NYbG2r96L9JO/JYsVIliNteO+824rM7in+uPB7wtiQwiSISnKcezz/S2HwubR78ntwEpAozUolGYOegJ+T1hxoJBUhPJI8jF2Q4lWSXujaEHYFBcHVexPzcNuIcV3IE3UM2cRDxQhuKzKk/WkKnBo4HlB1O5GnwMavrO1mmgl1dAolT8r+IxYKBMGZYB+/PUB5qMtaU7iF0k7bh3XFpg9t9Xe5wdgDTqaDs2HU+0OPSw/XidoOtYth/hiWe5gd6kDR3uowynWlV0RHcqKt+GPp7DBx7FOHv+WU5Q094Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=YrTzuzVkHkdoEkxZZEBbamQ/HZPPn8PSyb6DIXse8dk=; b=BM+lg25woromPGFqKYheKwzeIo+lGh9OISoq+uti5sgRyvTr4E1/8GjMsRSDmLrDjAc1rduD3AM6ZDDhEajta2ICw86y6wNz4UGuy9v89e0C7/g8H/oQmcFAD8fkhIwDL70foA5bEok4/FXhDLdefaFnMHQ9Lhet7uSxLPlyo1aZLAEoUirnJE87m1hYJUcsuEeZZ2YG4n7y2BBzuye15okmsofLfXB3DnmummRZwNsUTyBdPQ6AjZB/WlN8zBzZ9SI4lBKgt0M3dFKhQgxrZ7ZH+3zjcwAaswIuMc1gMAE6+GTBR2U3EPDlmHiIYQBfrYtfOTZIS1n52lt20LLF4w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YrTzuzVkHkdoEkxZZEBbamQ/HZPPn8PSyb6DIXse8dk=; b=nE9UxySpM6d0F9Mkldi5NN4zq6T5qlVdV7Wdh49pY8XFsGkTzOk779v1uterqTU/qLWawjXb2D2Ma5Gt2SFlwc6sKO/yqeLDDO+GPydg67FZHxPgY6CAN/2epdWmrs9M5e7N8t77m/9TpLFKKS666ZEEtdRIM6vJfUOqwSBjuDCgxjxQNDjuIakioHAYw/DBcteeeXcJ/cA8gHKaUIzP0Lc3zeiuS+4UOUZ/r2+LC9+jqCbnCutGQFwiPutzV5TUOOTqQA0Guq9P9EKW8B2Y2aQjLcLeVZ58r/BIkfREwHFMnF9vw90RB/Y/PBxUvRodEITrfPHB548KKexJ4MIt4A== Received: from MWHPR07CA0021.namprd07.prod.outlook.com (2603:10b6:300:116::31) by CY4PR1201MB0056.namprd12.prod.outlook.com (2603:10b6:910:1c::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.20; Tue, 21 Dec 2021 12:51:38 +0000 Received: from CO1NAM11FT045.eop-nam11.prod.protection.outlook.com (2603:10b6:300:116:cafe::c5) by MWHPR07CA0021.outlook.office365.com (2603:10b6:300:116::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Tue, 21 Dec 2021 12:51:38 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by CO1NAM11FT045.mail.protection.outlook.com (10.13.175.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4801.14 via Frontend Transport; Tue, 21 Dec 2021 12:51:38 +0000 Received: from HQMAIL109.nvidia.com (172.20.187.15) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Dec 2021 12:51:37 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL109.nvidia.com (172.20.187.15) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Dec 2021 04:51:37 -0800 Received: from sumitg-l4t.nvidia.com (172.20.187.6) by mail.nvidia.com (172.20.187.12) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 21 Dec 2021 12:51:34 +0000 From: Sumit Gupta To: , , , , , CC: , , , , Subject: [Patch v3 4/9] arm64: tegra: Add node for CBB1.0 in Tegra194 SOC Date: Tue, 21 Dec 2021 18:21:12 +0530 Message-ID: <20211221125117.6545-5-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211221125117.6545-1-sumitg@nvidia.com> References: <20211221125117.6545-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2178e706-43cf-471f-b37f-08d9c480a0d2 X-MS-TrafficTypeDiagnostic: CY4PR1201MB0056:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:3513; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KmMSL7rIIiWk6Cb9fwfPa7dBvuENWX4JQfcTGXNGfGGkvZIv9IU0AmSkx9Xn/u7Y0kXdvdeaCx9fxUePGcxe/pzZjnxaDZ1VrebT0S58ONDjlPiJSvXM37thhT0tAtp4XcBUdA4CUO7iLOwcUsdwXLMk2hOnxsQwpjMItV+4f6TyoaRKwcydttoXjE33eClqGhK4pOczSDgKOHwysotNi0+gkmLdnTX8577QgQxBusM9u7DuVkbZiHWscPI7yMzRFIn0On+dB79JyxnRb46ATx/Os8HzT1PsomsHkwuhM2o2SXPtrRBuCacvLhLGDV9myNrpyTQybCQ5khqqW7yNPDk8T0S4+7zIL+y+2o8hub4xK2q0Vcv8zTA+HpoX4ILp2d9FCXFiKbWy6PALfbKHtdu/FAxpsMoRCLAdjjoHL5heJygWh+GMuuwDuZRRADa51Cb/DKR59eG/g5/6W8k9BRyb9kqve+9HL5PS1XcrC+M40pJ0TmUgPAI950Z+MUFLaKrxA32L0Vsf05gAnwHHMrwWdnt9UvMEmxfthM3BSxFl7RTDXkrxlSwkbAZ3WQXwAxq3yWJc3859J3YdbURPcY+Mx6KYL1wCbipm/53AV/F0mx7tWqfZTxNuQTE5FQ7N+wQEFBImuxTZ9X06mqsQMKE9zT2bWE317yBu04J010K/AvoR+cNXeGU/qfJhigErpifRahPvhRHGIcPnSyxiGuJfc7fhZJKYcTVx+i3Db73VHcmcv2ewAAarI7ze4vj19x992BohBvIIKivXBbaOER9XVC9wK+OJwpXX3EtYnotKo0QlXP+RuZyhDIgiqAIOEpdwCPubsUOJYqXyMSRiag== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(40470700002)(46966006)(36840700001)(5660300002)(40460700001)(26005)(4326008)(54906003)(316002)(8676002)(8936002)(70206006)(2906002)(107886003)(110136005)(186003)(6666004)(81166007)(36860700001)(36756003)(34020700004)(2616005)(336012)(86362001)(70586007)(47076005)(1076003)(83380400001)(7696005)(356005)(82310400004)(426003)(508600001)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2021 12:51:38.1593 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2178e706-43cf-471f-b37f-08d9c480a0d2 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT045.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR1201MB0056 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Adding device tree nodes to enable the driver for handling errors from Control Backbone(CBB). CBB version 1.0 is used in Tegra194 SOC. Signed-off-by: Sumit Gupta --- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 62 +++++++++++++++++++++++- 1 file changed, 61 insertions(+), 1 deletion(-) diff --git a/arch/arm64/boot/dts/nvidia/tegra194.dtsi b/arch/arm64/boot/dts/nvidia/tegra194.dtsi index 851e049b3519..dddc4982b35a 100644 --- a/arch/arm64/boot/dts/nvidia/tegra194.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra194.dtsi @@ -22,7 +22,7 @@ #size-cells = <1>; ranges = <0x0 0x0 0x0 0x40000000>; - misc@100000 { + apbmisc: misc@100000 { compatible = "nvidia,tegra194-misc"; reg = <0x00100000 0xf000>, <0x0010f000 0x1000>; @@ -87,6 +87,27 @@ gpio-controller; }; + cbb-noc@2300000 { + compatible = "nvidia,tegra194-cbb-noc"; + reg = <0x02300000 0x1000>; + interrupts = , + ; + nvidia,axi2apb = <&axi2apb>; + nvidia,apbmisc = <&apbmisc>; + status = "okay"; + }; + + axi2apb: axi2apb@2390000 { + compatible = "nvidia,tegra194-axi2apb"; + reg = <0x2390000 0x1000>, + <0x23a0000 0x1000>, + <0x23b0000 0x1000>, + <0x23c0000 0x1000>, + <0x23d0000 0x1000>, + <0x23e0000 0x1000>; + status = "okay"; + }; + ethernet@2490000 { compatible = "nvidia,tegra194-eqos", "nvidia,tegra186-eqos", @@ -1359,6 +1380,26 @@ #phy-cells = <0>; }; + sce-noc@b600000 { + compatible = "nvidia,tegra194-sce-noc"; + reg = <0xb600000 0x1000>; + interrupts = , + ; + nvidia,axi2apb = <&axi2apb>; + nvidia,apbmisc = <&apbmisc>; + status = "okay"; + }; + + rce-noc@be00000 { + compatible = "nvidia,tegra194-rce-noc"; + reg = <0xbe00000 0x1000>; + interrupts = , + ; + nvidia,axi2apb = <&axi2apb>; + nvidia,apbmisc = <&apbmisc>; + status = "okay"; + }; + hsp_aon: hsp@c150000 { compatible = "nvidia,tegra194-hsp", "nvidia,tegra186-hsp"; reg = <0x0c150000 0x90000>; @@ -1374,6 +1415,15 @@ #mbox-cells = <2>; }; + aon-noc@c600000 { + compatible = "nvidia,tegra194-aon-noc"; + reg = <0xc600000 0x1000>; + interrupts = , + ; + nvidia,apbmisc = <&apbmisc>; + status = "okay"; + }; + gen2_i2c: i2c@c240000 { compatible = "nvidia,tegra194-i2c"; reg = <0x0c240000 0x10000>; @@ -1552,6 +1602,16 @@ status = "okay"; }; + bpmp-noc@d600000 { + compatible = "nvidia,tegra194-bpmp-noc"; + reg = <0xd600000 0x1000>; + interrupts = , + ; + nvidia,axi2apb = <&axi2apb>; + nvidia,apbmisc = <&apbmisc>; + status = "okay"; + }; + host1x@13e00000 { compatible = "nvidia,tegra194-host1x"; reg = <0x13e00000 0x10000>, From patchwork Tue Dec 21 12:51:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 526685 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2FD09C433F5 for ; Tue, 21 Dec 2021 12:51:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237862AbhLUMvv (ORCPT ); Tue, 21 Dec 2021 07:51:51 -0500 Received: from mail-bn8nam12on2065.outbound.protection.outlook.com ([40.107.237.65]:5856 "EHLO NAM12-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237866AbhLUMvt (ORCPT ); Tue, 21 Dec 2021 07:51:49 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lAlKOGzKY1Qq9/6MYmF32Dq/ZLb5YLcQuy8eoBdZZefPOpI02cBAOA1TJJrYlwZHflYcT+whFXyaCOLJh/cK6LVTRYz3Gcdw60YHSHSsTFiNG7G51ck7khOXDNea9nuZgsY2bF2v1VxncWNxpz4ouaYkSSDeB6YY39mpwF210Ja4zVyvYFgpDLnwjsWdWDICNs7JjPHyEvJYo9/q3tMsBZYPQa3MVQywaA70J5fbdAA7XeNbGgXEnod1/SYfagGkRn1Ur7enZGr7Uh3lHM/NA7jRDHNPHvJppP34z89SPNsbGA8cOyE/BN292q2Vl0cbq/RTDY588N+ftkTdEtlS1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qE3TI4PRgZrQxUQLe7l1835G3yeTqu3c1ZtxK4Lz9eI=; b=nKnc/1Y+1nZ1Pwf773sQoJh2Wr/nfu0IH9P4Assxv0+D3O+VcNqK9vpsiNYFDQjBLgZNxQXp316e9GekTDjS8dMTIL76qYLkTVXgIIXxzPUd9A0iOVGuKamj2o1UfSTWvffGjFgbkLfAPyUypoNnpyaFxYPrSW/DCqd6iMoq7/eKjzPRBxGwEyEgAzSEwevZ1CigHVQb5QHjmAKCu6bj1VsUmQ6vaWibHXU7uQ4znfF6sG24ZUsI3UxHwaV7cHwPjH6URTau4qCIVtll2M9nI7Rqs1iUAYJZbsO8V9kZGb8L1C8U0rkPffqprzsAeNqiU/lU3O78eiDDf+h6KGw+tg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.236) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qE3TI4PRgZrQxUQLe7l1835G3yeTqu3c1ZtxK4Lz9eI=; b=jTNcCaNlCwVUbQ8C6ZR4vMzZ4M9s15Qd+xdFzhcpMdtKOjB9G6oWjddnJD5/DrFV+hy2obJNheZqTHqrd7ag3pPGObi9KxWTEAFMXZE6Lu4dlxAQGA9of489OjAFMxlUXGr5PzS/PAGq9zKD5YgfuLV75uxPvuh1KhymEmfGQwhnzQzkwOY6Hp4a4ITsx9P5XCkH/Y/aSVkOUiXO/Dc3LzjKhEJLGDvm7j4AYUkRJWxKilBiny8gBo/iLwvF/kq7GKs73ffDPyamWyueIFXSbQ+bfytnW86GzlDKiSum+mOtuYFrTi0/cgEIRsFxGIieNO5ls5bk+PiR+7QcBDfY+g== Received: from MWHPR22CA0013.namprd22.prod.outlook.com (2603:10b6:300:ef::23) by MN2PR12MB2863.namprd12.prod.outlook.com (2603:10b6:208:103::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.19; Tue, 21 Dec 2021 12:51:44 +0000 Received: from CO1NAM11FT053.eop-nam11.prod.protection.outlook.com (2603:10b6:300:ef:cafe::70) by MWHPR22CA0013.outlook.office365.com (2603:10b6:300:ef::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Tue, 21 Dec 2021 12:51:44 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.236) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.236 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.236; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.236) by CO1NAM11FT053.mail.protection.outlook.com (10.13.175.63) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4801.14 via Frontend Transport; Tue, 21 Dec 2021 12:51:44 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by DRHQMAIL109.nvidia.com (10.27.9.19) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Dec 2021 12:51:43 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Dec 2021 12:51:40 +0000 Received: from sumitg-l4t.nvidia.com (172.20.187.6) by mail.nvidia.com (172.20.187.12) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 21 Dec 2021 12:51:37 +0000 From: Sumit Gupta To: , , , , , CC: , , , , Subject: [Patch v3 5/9] soc: tegra: cbb: Add CBB1.0 driver for Tegra194 Date: Tue, 21 Dec 2021 18:21:13 +0530 Message-ID: <20211221125117.6545-6-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211221125117.6545-1-sumitg@nvidia.com> References: <20211221125117.6545-1-sumitg@nvidia.com> MIME-Version: 1.0 X-NVConfidentiality: public X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 80dfc394-d2f1-4fcc-afd1-08d9c480a464 X-MS-TrafficTypeDiagnostic: MN2PR12MB2863:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:449; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bRVtl0c96GVS7kUKD2g9S0vNhYGZ4YjiAUJXB5SUiaPr1IqcDehlnBnK4eXK8O4r7QOoGSr4J1FH1f1mV7fVsQKuTiFpLnHyVbAEHfIa7KzR4nBt7s2BFyif9YF+pSRidrNTDLm/RqNMjIvsb7i37PiG5M+vf5yjHV39tXtgdacO+by0bBaOiOA4b0tEuIP0G6jgAjaefTin4sSyR+SZ6I8gF0bJGUMVtsS8S6CtifRc22l7jIHlfMmXzNMZqus2OeRPDG1gmp8ib/ZJc5YAAEDJVETz+u6/2xg2Wj4I5CnDeBJqafIJpsgRi1nv5Y4I3mHN2wetT8ITywKK3Hpvvtg24/3cXzqZMLxLD1A2RYACwrxkQZILi/fYXbw2amgr1KAY/YoNrDKqOmro0pLjt/byWB77eEsN1RNykKFcoYMt1Npc1j+PkRqQTiF5rt3qxjOLSkNyZ7prhhyPI6U+MB8FNQV93twqwTEyKC6lN5UE/TBNm8UB0calkfvA9COszkUm9y393/r95x+AiJ3y3IEN+QBYMmRbtElEaEdwYJXF7Fl+wHk3Ddu7V1DTELLq8uVVsjHVQaKDplVL1vH8tRQ7stDMwxl24SWag7v37U87MtPHM5v5bsRN5r/FilYOIMXd2jJNOarsnVy2oEPQlTqiwaoOwLpxEktvNX9LeS3ynobpKi8NHI6ozO9afhBUbgvSfZS9eSO2qbRlM6GdVY42EAXfOEa08pMwgqqrScMKpwY/lLl4bpI2RvAkQdEMWUsaYKTCrGBJJaww8tXCxwBjXsJf7j2r3V3siM2plUev4/POtOAhcFGZCJ9sHpm4Gt2XZSCLknKpeW8ODsyYkQ== X-Forefront-Antispam-Report: CIP:12.22.5.236; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700002)(426003)(47076005)(83380400001)(5660300002)(4326008)(7696005)(36860700001)(508600001)(6666004)(81166007)(34020700004)(8936002)(316002)(70586007)(107886003)(336012)(2616005)(26005)(70206006)(356005)(186003)(30864003)(82310400004)(8676002)(86362001)(110136005)(54906003)(2906002)(1076003)(40460700001)(36756003)(36900700001)(579004)(559001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2021 12:51:44.1149 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 80dfc394-d2f1-4fcc-afd1-08d9c480a464 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.236]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT053.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB2863 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Adding driver to handle errors from Control Backbone(CBB) which are generated due to illegal accesses. CBB1.0 is used in Tegra194 SOC. When an error is reported from a NOC within CBB, the driver prints debug information about failed transaction like Error Code, Error Description, Master, Address, AXI ID, Cache, Protection, Security Group etc. It then causes system crash using BUG_ON() or call WARN() based on whether the error type is fatal or not. Signed-off-by: Sumit Gupta --- drivers/soc/tegra/Kconfig | 9 + drivers/soc/tegra/Makefile | 1 + drivers/soc/tegra/cbb/Makefile | 8 + drivers/soc/tegra/cbb/tegra-cbb.c | 198 +++ drivers/soc/tegra/cbb/tegra194-cbb.c | 2261 ++++++++++++++++++++++++++ include/soc/tegra/tegra-cbb.h | 43 + include/soc/tegra/tegra194-cbb.h | 158 ++ 7 files changed, 2678 insertions(+) create mode 100644 drivers/soc/tegra/cbb/Makefile create mode 100644 drivers/soc/tegra/cbb/tegra-cbb.c create mode 100644 drivers/soc/tegra/cbb/tegra194-cbb.c create mode 100644 include/soc/tegra/tegra-cbb.h create mode 100644 include/soc/tegra/tegra194-cbb.h diff --git a/drivers/soc/tegra/Kconfig b/drivers/soc/tegra/Kconfig index 8b53ed1cc67e..0520b9744ec4 100644 --- a/drivers/soc/tegra/Kconfig +++ b/drivers/soc/tegra/Kconfig @@ -161,3 +161,12 @@ config SOC_TEGRA30_VOLTAGE_COUPLER bool "Voltage scaling support for Tegra30 SoCs" depends on ARCH_TEGRA_3x_SOC || COMPILE_TEST depends on REGULATOR + +config SOC_TEGRA_CBB + tristate "Tegra driver to handle error from CBB" + depends on ARCH_TEGRA_194_SOC + default y + help + Support for handling error from Tegra Control Backbone(CBB). + This driver handles the errors from CBB and prints debug + information about the failed transactions. diff --git a/drivers/soc/tegra/Makefile b/drivers/soc/tegra/Makefile index 054e862b63d8..d722f512dc9d 100644 --- a/drivers/soc/tegra/Makefile +++ b/drivers/soc/tegra/Makefile @@ -1,5 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 obj-y += fuse/ +obj-y += cbb/ obj-y += common.o obj-$(CONFIG_SOC_TEGRA_FLOWCTRL) += flowctrl.o diff --git a/drivers/soc/tegra/cbb/Makefile b/drivers/soc/tegra/cbb/Makefile new file mode 100644 index 000000000000..3f9ff6575628 --- /dev/null +++ b/drivers/soc/tegra/cbb/Makefile @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0 +# +# Control Backbone Driver code. +# +ifdef CONFIG_SOC_TEGRA_CBB +obj-y += tegra-cbb.o +obj-$(CONFIG_ARCH_TEGRA_194_SOC) += tegra194-cbb.o +endif diff --git a/drivers/soc/tegra/cbb/tegra-cbb.c b/drivers/soc/tegra/cbb/tegra-cbb.c new file mode 100644 index 000000000000..75583c938a97 --- /dev/null +++ b/drivers/soc/tegra/cbb/tegra-cbb.c @@ -0,0 +1,198 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +void tegra_cbb_print_err(struct seq_file *file, const char *fmt, ...) +{ + va_list args; + struct va_format vaf; + + va_start(args, fmt); + + if (file) { + seq_vprintf(file, fmt, args); + } else { + vaf.fmt = fmt; + vaf.va = &args; + pr_crit("%pV", &vaf); + } + + va_end(args); +} + +void tegra_cbb_print_cache(struct seq_file *file, u32 cache) +{ + char *buff_str; + char *mod_str; + char *rd_str; + char *wr_str; + + buff_str = (cache & BIT(0)) ? "Bufferable " : ""; + mod_str = (cache & BIT(1)) ? "Modifiable " : ""; + rd_str = (cache & BIT(2)) ? "Read-Allocate " : ""; + wr_str = (cache & BIT(3)) ? "Write-Allocate" : ""; + + if (cache == 0x0) + buff_str = "Device Non-Bufferable"; + + tegra_cbb_print_err(file, "\t Cache\t\t\t: 0x%x -- %s%s%s%s\n", + cache, buff_str, mod_str, rd_str, wr_str); +} + +void tegra_cbb_print_prot(struct seq_file *file, u32 prot) +{ + char *data_str; + char *secure_str; + char *priv_str; + + data_str = (prot & 0x4) ? "Instruction" : "Data"; + secure_str = (prot & 0x2) ? "Non-Secure" : "Secure"; + priv_str = (prot & 0x1) ? "Privileged" : "Unprivileged"; + + tegra_cbb_print_err(file, "\t Protection\t\t: 0x%x -- %s, %s, %s Access\n", + prot, priv_str, secure_str, data_str); +} + +#ifdef CONFIG_DEBUG_FS +static int created_root; + +static int cbb_err_show(struct seq_file *file, void *data) +{ + struct tegra_cbb *cbb = file->private; + + return cbb->ops->cbb_err_debugfs_show(cbb, file, data); +} + +static int cbb_err_open(struct inode *inode, struct file *file) +{ + return single_open(file, cbb_err_show, inode->i_private); +} + +static const struct file_operations cbb_err_fops = { + .open = cbb_err_open, + .read = seq_read, + .llseek = seq_lseek, + .release = single_release +}; + +static int tegra_cbb_err_dbgfs_init(struct tegra_cbb *cbb) +{ + struct dentry *d; + + if (!created_root) { + d = debugfs_create_file("tegra_cbb_err", 0444, NULL, cbb, + &cbb_err_fops); + if (IS_ERR_OR_NULL(d)) { + pr_err + ("%s: could not create 'tegra_cbb_err' node\n", + __func__); + return PTR_ERR(d); + } + created_root = true; + } + return 0; +} + +#else +static int tegra_cbb_err_dbgfs_init(void) { return 0; } +#endif + +void tegra_cbb_stallen(struct tegra_cbb *cbb) +{ + if (cbb->ops->stallen) + cbb->ops->stallen(cbb); +} + +void tegra_cbb_faulten(struct tegra_cbb *cbb) +{ + if (cbb->ops->faulten) + cbb->ops->faulten(cbb); +} + +void tegra_cbb_errclr(struct tegra_cbb *cbb) +{ + if (cbb->ops->errclr) + cbb->ops->errclr(cbb); +} + +u32 tegra_cbb_errvld(struct tegra_cbb *cbb) +{ + if (cbb->ops->errvld) + return cbb->ops->errvld(cbb); + else + return 0; +} + +int tegra_cbb_err_getirq(struct platform_device *pdev, int *nonsec_irq, int *sec_irq) +{ + int num_intr = 0; + int intr_indx = 0; + + num_intr = platform_irq_count(pdev); + if (!num_intr) + return -EINVAL; + + if (num_intr == 2) { + *nonsec_irq = platform_get_irq(pdev, intr_indx); + if (*nonsec_irq <= 0) { + dev_err(&pdev->dev, "can't get irq (%d)\n", *nonsec_irq); + return -ENOENT; + } + intr_indx++; + } + + *sec_irq = platform_get_irq(pdev, intr_indx); + if (*sec_irq <= 0) { + dev_err(&pdev->dev, "can't get irq (%d)\n", *sec_irq); + return -ENOENT; + } + + if (num_intr == 1) + dev_info(&pdev->dev, "secure_irq = %d\n", *sec_irq); + if (num_intr == 2) + dev_info(&pdev->dev, "secure_irq = %d, nonsecure_irq = %d>\n", + *sec_irq, *nonsec_irq); + return 0; +} + +int tegra_cbb_register_isr_enaberr(struct tegra_cbb *cbb) +{ + struct platform_device *pdev = cbb->pdev; + int ret = 0; + + ret = tegra_cbb_err_dbgfs_init(cbb); + if (ret) { + dev_err(&pdev->dev, "failed to create debugfs\n"); + return ret; + } + + /* register interrupt handler for errors due to different initiators */ + ret = cbb->ops->cbb_intr_enable(cbb); + if (ret < 0) { + dev_err(&pdev->dev, "Failed to register CBB Interrupt ISR"); + return ret; + } + + cbb->ops->cbb_err_enable(cbb); + dsb(sy); + + return 0; +} diff --git a/drivers/soc/tegra/cbb/tegra194-cbb.c b/drivers/soc/tegra/cbb/tegra194-cbb.c new file mode 100644 index 000000000000..740fc2a029f9 --- /dev/null +++ b/drivers/soc/tegra/cbb/tegra194-cbb.c @@ -0,0 +1,2261 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved + * + * The driver handles Error's from Control Backbone(CBB) generated due to + * illegal accesses. When an error is reported from a NOC within CBB, + * the driver checks ErrVld status of all three Error Logger's of that NOC. + * It then prints debug information about failed transaction using ErrLog + * registers of error logger which has ErrVld set. Currently, SLV, DEC, + * TMO, SEC, UNS are the codes which are supported by CBB. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static LIST_HEAD(cbb_noc_list); +static DEFINE_SPINLOCK(cbb_noc_lock); + +static const char *t194_cbb_trantype[] = { + "RD - Read, Incrementing", + "RDW - Read, Wrap", /* Not Supported */ + "RDX - Exclusive Read", /* Not Supported */ + "RDL - Linked Read", /* Not Supported */ + "WR - Write, Incrementing", + "WRW - Write, Wrap", /* Not Supported */ + "WRC - Exclusive Write", /* Not Supported */ + "PRE - Preamble Sequence for Fixed Accesses" +}; + +static const char *t194_axi2apb_err[] = { + "SFIFONE - Status FIFO Not Empty interrupt", + "SFIFOF - Status FIFO Full interrupt", + "TIM - Timer(Timeout) interrupt", + "SLV - SLVERR interrupt", + "NULL", + "ERBF - Early response buffer Full interrupt", + "NULL", + "RDFIFOF - Read Response FIFO Full interrupt", + "WRFIFOF - Write Response FIFO Full interrupt", + "CH0DFIFOF - Ch0 Data FIFO Full interrupt", + "CH1DFIFOF - Ch1 Data FIFO Full interrupt", + "CH2DFIFOF - Ch2 Data FIFO Full interrupt", + "UAT - Unsupported alignment type error", + "UBS - Unsupported burst size error", + "UBE - Unsupported Byte Enable error", + "UBT - Unsupported burst type error", + "BFS - Block Firewall security error", + "ARFS - Address Range Firewall security error", + "CH0RFIFOF - Ch0 Request FIFO Full interrupt", + "CH1RFIFOF - Ch1 Request FIFO Full interrupt", + "CH2RFIFOF - Ch2 Request FIFO Full interrupt" +}; + +static const char *t194_master_id[] = { + "CCPLEX", /* 0x1 */ + "CCPLEX_DPMU", /* 0x2 */ + "BPMP", /* 0x3 */ + "AON", /* 0x4 */ + "SCE", /* 0x5 */ + "GPCDMA_PERIPHERAL", /* 0x6 */ + "TSECA", /* 0x7 */ + "TSECB", /* 0x8 */ + "JTAGM_DFT", /* 0x9 */ + "CORESIGHT_AXIAP", /* 0xa */ + "APE", /* 0xb */ + "PEATR", /* 0xc */ + "NVDEC", /* 0xd */ + "RCE", /* 0xe */ + "NVDEC1" /* 0xf */ +}; + +static const struct tegra_noc_errors t194_noc_errors[] = { + {.errcode = "SLV", + .src = "Target", + .type = "Target error detected by CBB slave" + }, + {.errcode = "DEC", + .src = "Initiator NIU", + .type = "Address decode error" + }, + {.errcode = "UNS", + .src = "Target NIU", + .type = "Unsupported request. Not a valid transaction" + }, + {.errcode = "DISC", /* Not Supported by CBB */ + .src = "Power Disconnect", + .type = "Disconnected target or domain" + }, + {.errcode = "SEC", + .src = "Initiator NIU or Firewall", + .type = "Security violation. Firewall error" + }, + {.errcode = "HIDE", /* Not Supported by CBB */ + .src = "Firewall", + .type = "Hidden security violation, reported as OK to initiator" + }, + {.errcode = "TMO", + .src = "Target NIU", + .type = "Target time-out error" + }, + {.errcode = "RSV", + .src = "None", + .type = "Reserved" + } +}; + +/* + * CBB NOC aperture lookup table as per file "cbb_central_noc_Structure.info". + */ +static char *t194_cbbcentralnoc_routeid_initflow[] = { + "aon_p2ps/I/aon", /* 0x0 */ + "ape_p2ps/I/ape_p2ps", /* 0x1 */ + "bpmp_p2ps/I/bpmp_p2ps", /* 0x2 */ + "ccroc_p2ps/I/ccroc_p2ps", /* 0x3 */ + "csite_p2ps/I/0", /* 0x4 */ + "gpcdma_mmio_p2ps/I/0", /* 0x5 */ + "jtag_p2ps/I/0", /* 0x6 */ + "nvdec1_p2ps/I/0", /* 0x7 */ + "nvdec_p2ps/I/0", /* 0x8 */ + "rce_p2ps/I/rce_p2ps", /* 0x9 */ + "sce_p2ps/I/sce_p2ps", /* 0xA */ + "tseca_p2ps/I/0", /* 0xB */ + "tsecb_p2ps/I/0", /* 0xC */ + "RESERVED", /* 0xD */ + "RESERVED", /* 0xE */ + "RESERVED" /* 0xF */ +}; + +static char *t194_cbbcentralnoc_routeid_targflow[] = { + "SVC/T/intreg", /*0x0*/ + "axis_satellite_axi2apb_p2pm/T/axis_satellite_axi2apb_p2pm", /*0x1*/ + "axis_satellite_grout/T/axis_satellite_grout", /*0x2*/ + "cbb_firewall/T/cbb_firewall", /*0x3*/ + "gpu_p2pm/T/gpu_p2pm", /*0x4*/ + "host1x_p2pm/T/host1x_p2pm", /*0x5*/ + "sapb_3_p2pm/T/sapb_3_p2pm", /*0x6*/ + "smmu0_p2pm/T/smmu0_p2pm", /*0x7*/ + "smmu1_p2pm/T/smmu1_p2pm", /*0x8*/ + "smmu2_p2pm/T/smmu2_p2pm", /*0x9*/ + "stm_p2pm/T/stm_p2pm", /*0xA*/ + "RESERVED", /*0xB*/ + "RESERVED", /*0xC*/ + "RESERVED", /*0xD*/ + "RESERVED", /*0xE*/ + "RESERVED" /*0xF*/ +}; + +/* + * Fields of CBB NOC lookup table: + * Init flow, Targ flow, Targ subrange, Init mapping, Init localAddress, + * Targ mapping, Targ localAddress + * ---------------------------------------------------------------------------- + */ +static const struct tegra194_cbb_aperture t194_cbbcentralnoc_apert_lookup[] = { + { 0x0, 0x0, 0x00, 0x0, 0x02300000, 0, 0x0 }, + { 0x0, 0x1, 0x00, 0x0, 0x02003000, 0, 0x02003000 }, + { 0x0, 0x1, 0x01, 0x0, 0x02006000, 2, 0x02006000 }, + { 0x0, 0x1, 0x02, 0x0, 0x02016000, 3, 0x02016000 }, + { 0x0, 0x1, 0x03, 0x0, 0x0201d000, 4, 0x0201d000 }, + { 0x0, 0x1, 0x04, 0x0, 0x0202b000, 6, 0x0202b000 }, + { 0x0, 0x1, 0x05, 0x0, 0x02434000, 20, 0x02434000 }, + { 0x0, 0x1, 0x06, 0x0, 0x02436000, 21, 0x02436000 }, + { 0x0, 0x1, 0x07, 0x0, 0x02438000, 22, 0x02438000 }, + { 0x0, 0x1, 0x08, 0x0, 0x02445000, 24, 0x02445000 }, + { 0x0, 0x1, 0x09, 0x0, 0x02446000, 25, 0x02446000 }, + { 0x0, 0x1, 0x0a, 0x0, 0x02004000, 1, 0x02004000 }, + { 0x0, 0x1, 0x0b, 0x0, 0x0201e000, 5, 0x0201e000 }, + { 0x0, 0x1, 0x0c, 0x0, 0x0202c000, 7, 0x0202c000 }, + { 0x0, 0x1, 0x0d, 0x0, 0x02204000, 8, 0x02204000 }, + { 0x0, 0x1, 0x0e, 0x0, 0x02214000, 9, 0x02214000 }, + { 0x0, 0x1, 0x0f, 0x0, 0x02224000, 10, 0x02224000 }, + { 0x0, 0x1, 0x10, 0x0, 0x02234000, 11, 0x02234000 }, + { 0x0, 0x1, 0x11, 0x0, 0x02244000, 12, 0x02244000 }, + { 0x0, 0x1, 0x12, 0x0, 0x02254000, 13, 0x02254000 }, + { 0x0, 0x1, 0x13, 0x0, 0x02264000, 14, 0x02264000 }, + { 0x0, 0x1, 0x14, 0x0, 0x02274000, 15, 0x02274000 }, + { 0x0, 0x1, 0x15, 0x0, 0x02284000, 16, 0x02284000 }, + { 0x0, 0x1, 0x16, 0x0, 0x0243a000, 23, 0x0243a000 }, + { 0x0, 0x1, 0x17, 0x0, 0x02370000, 17, 0x02370000 }, + { 0x0, 0x1, 0x18, 0x0, 0x023d0000, 18, 0x023d0000 }, + { 0x0, 0x1, 0x19, 0x0, 0x023e0000, 19, 0x023e0000 }, + { 0x0, 0x1, 0x1a, 0x0, 0x02450000, 26, 0x02450000 }, + { 0x0, 0x1, 0x1b, 0x0, 0x02460000, 27, 0x02460000 }, + { 0x0, 0x1, 0x1c, 0x0, 0x02490000, 28, 0x02490000 }, + { 0x0, 0x1, 0x1d, 0x0, 0x03130000, 31, 0x03130000 }, + { 0x0, 0x1, 0x1e, 0x0, 0x03160000, 32, 0x03160000 }, + { 0x0, 0x1, 0x1f, 0x0, 0x03270000, 33, 0x03270000 }, + { 0x0, 0x1, 0x20, 0x0, 0x032e0000, 35, 0x032e0000 }, + { 0x0, 0x1, 0x21, 0x0, 0x03300000, 36, 0x03300000 }, + { 0x0, 0x1, 0x22, 0x0, 0x13090000, 40, 0x13090000 }, + { 0x0, 0x1, 0x23, 0x0, 0x20120000, 43, 0x20120000 }, + { 0x0, 0x1, 0x24, 0x0, 0x20170000, 44, 0x20170000 }, + { 0x0, 0x1, 0x25, 0x0, 0x20190000, 45, 0x20190000 }, + { 0x0, 0x1, 0x26, 0x0, 0x201b0000, 46, 0x201b0000 }, + { 0x0, 0x1, 0x27, 0x0, 0x20250000, 47, 0x20250000 }, + { 0x0, 0x1, 0x28, 0x0, 0x20260000, 48, 0x20260000 }, + { 0x0, 0x1, 0x29, 0x0, 0x20420000, 49, 0x20420000 }, + { 0x0, 0x1, 0x2a, 0x0, 0x20460000, 50, 0x20460000 }, + { 0x0, 0x1, 0x2b, 0x0, 0x204f0000, 51, 0x204f0000 }, + { 0x0, 0x1, 0x2c, 0x0, 0x20520000, 52, 0x20520000 }, + { 0x0, 0x1, 0x2d, 0x0, 0x20580000, 53, 0x20580000 }, + { 0x0, 0x1, 0x2e, 0x0, 0x205a0000, 54, 0x205a0000 }, + { 0x0, 0x1, 0x2f, 0x0, 0x205c0000, 55, 0x205c0000 }, + { 0x0, 0x1, 0x30, 0x0, 0x20690000, 56, 0x20690000 }, + { 0x0, 0x1, 0x31, 0x0, 0x20770000, 57, 0x20770000 }, + { 0x0, 0x1, 0x32, 0x0, 0x20790000, 58, 0x20790000 }, + { 0x0, 0x1, 0x33, 0x0, 0x20880000, 59, 0x20880000 }, + { 0x0, 0x1, 0x34, 0x0, 0x20990000, 62, 0x20990000 }, + { 0x0, 0x1, 0x35, 0x0, 0x20e10000, 65, 0x20e10000 }, + { 0x0, 0x1, 0x36, 0x0, 0x20e70000, 66, 0x20e70000 }, + { 0x0, 0x1, 0x37, 0x0, 0x20e80000, 67, 0x20e80000 }, + { 0x0, 0x1, 0x38, 0x0, 0x20f30000, 68, 0x20f30000 }, + { 0x0, 0x1, 0x39, 0x0, 0x20f50000, 69, 0x20f50000 }, + { 0x0, 0x1, 0x3a, 0x0, 0x20fc0000, 70, 0x20fc0000 }, + { 0x0, 0x1, 0x3b, 0x0, 0x21110000, 72, 0x21110000 }, + { 0x0, 0x1, 0x3c, 0x0, 0x21270000, 73, 0x21270000 }, + { 0x0, 0x1, 0x3d, 0x0, 0x21290000, 74, 0x21290000 }, + { 0x0, 0x1, 0x3e, 0x0, 0x21840000, 75, 0x21840000 }, + { 0x0, 0x1, 0x3f, 0x0, 0x21880000, 76, 0x21880000 }, + { 0x0, 0x1, 0x40, 0x0, 0x218d0000, 77, 0x218d0000 }, + { 0x0, 0x1, 0x41, 0x0, 0x21950000, 78, 0x21950000 }, + { 0x0, 0x1, 0x42, 0x0, 0x21960000, 79, 0x21960000 }, + { 0x0, 0x1, 0x43, 0x0, 0x21a10000, 80, 0x21a10000 }, + { 0x0, 0x1, 0x44, 0x0, 0x024a0000, 29, 0x024a0000 }, + { 0x0, 0x1, 0x45, 0x0, 0x024c0000, 30, 0x024c0000 }, + { 0x0, 0x1, 0x46, 0x0, 0x032c0000, 34, 0x032c0000 }, + { 0x0, 0x1, 0x47, 0x0, 0x03400000, 37, 0x03400000 }, + { 0x0, 0x1, 0x48, 0x0, 0x130a0000, 41, 0x130a0000 }, + { 0x0, 0x1, 0x49, 0x0, 0x130c0000, 42, 0x130c0000 }, + { 0x0, 0x1, 0x4a, 0x0, 0x208a0000, 60, 0x208a0000 }, + { 0x0, 0x1, 0x4b, 0x0, 0x208c0000, 61, 0x208c0000 }, + { 0x0, 0x1, 0x4c, 0x0, 0x209a0000, 63, 0x209a0000 }, + { 0x0, 0x1, 0x4d, 0x0, 0x21a40000, 81, 0x21a40000 }, + { 0x0, 0x1, 0x4e, 0x0, 0x03440000, 38, 0x03440000 }, + { 0x0, 0x1, 0x4f, 0x0, 0x20d00000, 64, 0x20d00000 }, + { 0x0, 0x1, 0x50, 0x0, 0x21000000, 71, 0x21000000 }, + { 0x0, 0x1, 0x51, 0x0, 0x0b000000, 39, 0x0b000000 }, + { 0x0, 0x2, 0x00, 0x0, 0x00000000, 0, 0x00000000 }, + { 0x0, 0x3, 0x00, 0x0, 0x02340000, 0, 0x00000000 }, + { 0x0, 0x4, 0x00, 0x0, 0x17000000, 0, 0x17000000 }, + { 0x0, 0x4, 0x01, 0x0, 0x18000000, 1, 0x18000000 }, + { 0x0, 0x5, 0x00, 0x0, 0x13e80000, 1, 0x13e80000 }, + { 0x0, 0x5, 0x01, 0x0, 0x15810000, 12, 0x15810000 }, + { 0x0, 0x5, 0x02, 0x0, 0x15840000, 14, 0x15840000 }, + { 0x0, 0x5, 0x03, 0x0, 0x15a40000, 17, 0x15a40000 }, + { 0x0, 0x5, 0x04, 0x0, 0x13f00000, 3, 0x13f00000 }, + { 0x0, 0x5, 0x05, 0x0, 0x15820000, 13, 0x15820000 }, + { 0x0, 0x5, 0x06, 0x0, 0x13ec0000, 2, 0x13ec0000 }, + { 0x0, 0x5, 0x07, 0x0, 0x15200000, 6, 0x15200000 }, + { 0x0, 0x5, 0x08, 0x0, 0x15340000, 7, 0x15340000 }, + { 0x0, 0x5, 0x09, 0x0, 0x15380000, 8, 0x15380000 }, + { 0x0, 0x5, 0x0a, 0x0, 0x15500000, 10, 0x15500000 }, + { 0x0, 0x5, 0x0b, 0x0, 0x155c0000, 11, 0x155c0000 }, + { 0x0, 0x5, 0x0c, 0x0, 0x15a00000, 16, 0x15a00000 }, + { 0x0, 0x5, 0x0d, 0x0, 0x13e00000, 0, 0x13e00000 }, + { 0x0, 0x5, 0x0e, 0x0, 0x15100000, 5, 0x15100000 }, + { 0x0, 0x5, 0x0f, 0x0, 0x15480000, 9, 0x15480000 }, + { 0x0, 0x5, 0x10, 0x0, 0x15880000, 15, 0x15880000 }, + { 0x0, 0x5, 0x11, 0x0, 0x15a80000, 18, 0x15a80000 }, + { 0x0, 0x5, 0x12, 0x0, 0x15b00000, 19, 0x15b00000 }, + { 0x0, 0x5, 0x13, 0x0, 0x14800000, 4, 0x14800000 }, + { 0x0, 0x5, 0x14, 0x0, 0x15c00000, 20, 0x15c00000 }, + { 0x0, 0x5, 0x15, 0x0, 0x16000000, 21, 0x16000000 }, + { 0x0, 0x6, 0x00, 0x0, 0x02000000, 4, 0x02000000 }, + { 0x0, 0x6, 0x01, 0x0, 0x02007000, 5, 0x02007000 }, + { 0x0, 0x6, 0x02, 0x0, 0x02008000, 6, 0x02008000 }, + { 0x0, 0x6, 0x03, 0x0, 0x02013000, 7, 0x02013000 }, + { 0x0, 0x6, 0x04, 0x0, 0x0201c000, 8, 0x0201c000 }, + { 0x0, 0x6, 0x05, 0x0, 0x02020000, 9, 0x02020000 }, + { 0x0, 0x6, 0x06, 0x0, 0x0202a000, 10, 0x0202a000 }, + { 0x0, 0x6, 0x07, 0x0, 0x0202e000, 11, 0x0202e000 }, + { 0x0, 0x6, 0x08, 0x0, 0x06400000, 33, 0x06400000 }, + { 0x0, 0x6, 0x09, 0x0, 0x02038000, 12, 0x02038000 }, + { 0x0, 0x6, 0x0a, 0x0, 0x00100000, 0, 0x00100000 }, + { 0x0, 0x6, 0x0b, 0x0, 0x023b0000, 13, 0x023b0000 }, + { 0x0, 0x6, 0x0c, 0x0, 0x02800000, 16, 0x02800000 }, + { 0x0, 0x6, 0x0d, 0x0, 0x030e0000, 22, 0x030e0000 }, + { 0x0, 0x6, 0x0e, 0x0, 0x03800000, 23, 0x03800000 }, + { 0x0, 0x6, 0x0f, 0x0, 0x03980000, 25, 0x03980000 }, + { 0x0, 0x6, 0x10, 0x0, 0x03a60000, 26, 0x03a60000 }, + { 0x0, 0x6, 0x11, 0x0, 0x03d80000, 31, 0x03d80000 }, + { 0x0, 0x6, 0x12, 0x0, 0x20000000, 36, 0x20000000 }, + { 0x0, 0x6, 0x13, 0x0, 0x20050000, 38, 0x20050000 }, + { 0x0, 0x6, 0x14, 0x0, 0x201e0000, 40, 0x201e0000 }, + { 0x0, 0x6, 0x15, 0x0, 0x20280000, 42, 0x20280000 }, + { 0x0, 0x6, 0x16, 0x0, 0x202c0000, 43, 0x202c0000 }, + { 0x0, 0x6, 0x17, 0x0, 0x20390000, 44, 0x20390000 }, + { 0x0, 0x6, 0x18, 0x0, 0x20430000, 45, 0x20430000 }, + { 0x0, 0x6, 0x19, 0x0, 0x20440000, 46, 0x20440000 }, + { 0x0, 0x6, 0x1a, 0x0, 0x204e0000, 47, 0x204e0000 }, + { 0x0, 0x6, 0x1b, 0x0, 0x20550000, 48, 0x20550000 }, + { 0x0, 0x6, 0x1c, 0x0, 0x20570000, 49, 0x20570000 }, + { 0x0, 0x6, 0x1d, 0x0, 0x20590000, 50, 0x20590000 }, + { 0x0, 0x6, 0x1e, 0x0, 0x20730000, 52, 0x20730000 }, + { 0x0, 0x6, 0x1f, 0x0, 0x209f0000, 54, 0x209f0000 }, + { 0x0, 0x6, 0x20, 0x0, 0x20e20000, 55, 0x20e20000 }, + { 0x0, 0x6, 0x21, 0x0, 0x20ed0000, 56, 0x20ed0000 }, + { 0x0, 0x6, 0x22, 0x0, 0x20fd0000, 57, 0x20fd0000 }, + { 0x0, 0x6, 0x23, 0x0, 0x21120000, 59, 0x21120000 }, + { 0x0, 0x6, 0x24, 0x0, 0x211a0000, 60, 0x211a0000 }, + { 0x0, 0x6, 0x25, 0x0, 0x21850000, 61, 0x21850000 }, + { 0x0, 0x6, 0x26, 0x0, 0x21860000, 62, 0x21860000 }, + { 0x0, 0x6, 0x27, 0x0, 0x21890000, 63, 0x21890000 }, + { 0x0, 0x6, 0x28, 0x0, 0x21970000, 64, 0x21970000 }, + { 0x0, 0x6, 0x29, 0x0, 0x21990000, 65, 0x21990000 }, + { 0x0, 0x6, 0x2a, 0x0, 0x21a00000, 66, 0x21a00000 }, + { 0x0, 0x6, 0x2b, 0x0, 0x21a90000, 68, 0x21a90000 }, + { 0x0, 0x6, 0x2c, 0x0, 0x21ac0000, 70, 0x21ac0000 }, + { 0x0, 0x6, 0x2d, 0x0, 0x01f80000, 3, 0x01f80000 }, + { 0x0, 0x6, 0x2e, 0x0, 0x024e0000, 14, 0x024e0000 }, + { 0x0, 0x6, 0x2f, 0x0, 0x030c0000, 21, 0x030c0000 }, + { 0x0, 0x6, 0x30, 0x0, 0x03820000, 24, 0x03820000 }, + { 0x0, 0x6, 0x31, 0x0, 0x03aa0000, 27, 0x03aa0000 }, + { 0x0, 0x6, 0x32, 0x0, 0x03c80000, 29, 0x03c80000 }, + { 0x0, 0x6, 0x33, 0x0, 0x130e0000, 34, 0x130e0000 }, + { 0x0, 0x6, 0x34, 0x0, 0x20020000, 37, 0x20020000 }, + { 0x0, 0x6, 0x35, 0x0, 0x20060000, 39, 0x20060000 }, + { 0x0, 0x6, 0x36, 0x0, 0x20200000, 41, 0x20200000 }, + { 0x0, 0x6, 0x37, 0x0, 0x206a0000, 51, 0x206a0000 }, + { 0x0, 0x6, 0x38, 0x0, 0x20740000, 53, 0x20740000 }, + { 0x0, 0x6, 0x39, 0x0, 0x20fe0000, 58, 0x20fe0000 }, + { 0x0, 0x6, 0x3a, 0x0, 0x21a20000, 67, 0x21a20000 }, + { 0x0, 0x6, 0x3b, 0x0, 0x21aa0000, 69, 0x21aa0000 }, + { 0x0, 0x6, 0x3c, 0x0, 0x02b80000, 17, 0x02b80000 }, + { 0x0, 0x6, 0x3d, 0x0, 0x03080000, 20, 0x03080000 }, + { 0x0, 0x6, 0x3e, 0x0, 0x13100000, 35, 0x13100000 }, + { 0x0, 0x6, 0x3f, 0x0, 0x01f00000, 2, 0x01f00000 }, + { 0x0, 0x6, 0x40, 0x0, 0x03000000, 19, 0x03000000 }, + { 0x0, 0x6, 0x41, 0x0, 0x03c00000, 28, 0x03c00000 }, + { 0x0, 0x6, 0x42, 0x0, 0x03d00000, 30, 0x03d00000 }, + { 0x0, 0x6, 0x43, 0x0, 0x01700000, 1, 0x01700000 }, + { 0x0, 0x6, 0x44, 0x0, 0x02c00000, 18, 0x02c00000 }, + { 0x0, 0x6, 0x45, 0x0, 0x02600000, 15, 0x02600000 }, + { 0x0, 0x6, 0x46, 0x0, 0x06000000, 32, 0x06000000 }, + { 0x0, 0x6, 0x47, 0x0, 0x24000000, 71, 0x24000000 }, + { 0x0, 0x7, 0x00, 0x0, 0x12000000, 0, 0x12000000 }, + { 0x0, 0x8, 0x00, 0x0, 0x11000000, 0, 0x11000000 }, + { 0x0, 0x9, 0x00, 0x0, 0x10000000, 0, 0x10000000 }, + { 0x0, 0xA, 0x00, 0x0, 0x22000000, 0, 0x22000000 } +}; + +/* + * BPMP NOC aperture lookup table as per file "BPMP_NOC_Structure.info". + */ +static char *t194_bpmpnoc_routeid_initflow[] = { + "cbb_i/I/0", /* 0x0 */ + "cpu_m_i/I/0", /* 0x1 */ + "cpu_p_i/I/0", /* 0x2 */ + "cvc_i/I/0", /* 0x3 */ + "dma_m_i/I/0", /* 0x4 */ + "dma_p_i/I/0", /* 0x5 */ + "RESERVED", /* 0x6 */ + "RESERVED" /* 0x6 */ +}; + +static char *t194_bpmpnoc_routeid_targflow[] = { + "multiport0_t/T/actmon", /* 0x0 */ + "multiport0_t/T/ast_0", /* 0x1 */ + "multiport0_t/T/ast_1", /* 0x2 */ + "multiport0_t/T/atcm_cfg", /* 0x3 */ + "multiport0_t/T/car", /* 0x4 */ + "multiport0_t/T/central_pwr_mgr", /* 0x5 */ + "multiport0_t/T/central_vtg_ctlr", /* 0x6 */ + "multiport0_t/T/cfg", /* 0x7 */ + "multiport0_t/T/dma", /* 0x8 */ + "multiport0_t/T/err_collator", /* 0x9 */ + "multiport0_t/T/err_collator_car", /* 0xA */ + "multiport0_t/T/fpga_misc", /* 0xB */ + "multiport0_t/T/fpga_uart", /* 0xC */ + "multiport0_t/T/gte", /* 0xD */ + "multiport0_t/T/hsp", /* 0xE */ + "multiport0_t/T/misc", /* 0xF */ + "multiport0_t/T/pm", /* 0x10 */ + "multiport0_t/T/simon0", /* 0x11 */ + "multiport0_t/T/simon1", /* 0x12 */ + "multiport0_t/T/simon2", /* 0x13 */ + "multiport0_t/T/simon3", /* 0x14 */ + "multiport0_t/T/simon4", /* 0x15 */ + "multiport0_t/T/soc_therm", /* 0x16 */ + "multiport0_t/T/tke", /* 0x17 */ + "multiport0_t/T/vic_0", /* 0x18 */ + "multiport0_t/T/vic_1", /* 0x19 */ + "ast0_t/T/0", /* 0x1A */ + "ast1_t/T/0", /* 0x1B */ + "bpmp_noc_firewall/T/0", /* 0x1C */ + "cbb_t/T/0", /* 0x1D */ + "cpu_t/T/0", /* 0x1E */ + "svc_t/T/0" /* 0x1F */ +}; + +/* + * Fields of BPMP NOC lookup table: + * Init flow, Targ flow, Targ subrange, Init mapping, Init localAddress, + * Targ mapping, Targ localAddress + * ---------------------------------------------------------------------------- + */ +static const struct tegra194_cbb_aperture t194_bpmpnoc_apert_lookup[] = { + { 0x0, 0x1C, 0x0, 0x0, 0xd640000, 0, 0x0000000 }, + { 0x0, 0x1E, 0x0, 0x0, 0xd400000, 0, 0xd400000 }, + { 0x0, 0x00, 0x0, 0x0, 0xd230000, 0, 0x0000000 }, + { 0x0, 0x01, 0x0, 0x0, 0xd040000, 0, 0x0000000 }, + { 0x0, 0x02, 0x0, 0x0, 0xd050000, 0, 0x0000000 }, + { 0x0, 0x03, 0x0, 0x0, 0xd000000, 0, 0x0000000 }, + { 0x0, 0x04, 0x0, 0x0, 0x20ae0000, 3, 0xe0000 }, + { 0x0, 0x04, 0x1, 0x0, 0x20ac0000, 2, 0xc0000 }, + { 0x0, 0x04, 0x2, 0x0, 0x20a80000, 1, 0x80000 }, + { 0x0, 0x04, 0x3, 0x0, 0x20a00000, 0, 0x0000000 }, + { 0x0, 0x05, 0x0, 0x0, 0xd2a0000, 0, 0x0000000 }, + { 0x0, 0x06, 0x0, 0x0, 0xd290000, 0, 0x0000000 }, + { 0x0, 0x07, 0x0, 0x0, 0xd2c0000, 0, 0x0000000 }, + { 0x0, 0x08, 0x0, 0x0, 0xd0e0000, 4, 0x80000 }, + { 0x0, 0x08, 0x1, 0x0, 0xd060000, 0, 0x0000000 }, + { 0x0, 0x08, 0x2, 0x0, 0xd080000, 1, 0x20000 }, + { 0x0, 0x08, 0x3, 0x0, 0xd0a0000, 2, 0x40000 }, + { 0x0, 0x08, 0x4, 0x0, 0xd0c0000, 3, 0x60000 }, + { 0x0, 0x09, 0x0, 0x0, 0xd650000, 0, 0x0000000 }, + { 0x0, 0x0A, 0x0, 0x0, 0x20af0000, 0, 0x0000000 }, + { 0x0, 0x0B, 0x0, 0x0, 0xd3e0000, 0, 0x0000000 }, + { 0x0, 0x0C, 0x0, 0x0, 0xd3d0000, 0, 0x0000000 }, + { 0x0, 0x0D, 0x0, 0x0, 0xd1e0000, 0, 0x0000000 }, + { 0x0, 0x0E, 0x0, 0x0, 0xd150000, 0, 0x0000000 }, + { 0x0, 0x0E, 0x1, 0x0, 0xd160000, 1, 0x10000 }, + { 0x0, 0x0E, 0x2, 0x0, 0xd170000, 2, 0x20000 }, + { 0x0, 0x0E, 0x3, 0x0, 0xd180000, 3, 0x30000 }, + { 0x0, 0x0E, 0x4, 0x0, 0xd190000, 4, 0x40000 }, + { 0x0, 0x0E, 0x5, 0x0, 0xd1a0000, 5, 0x50000 }, + { 0x0, 0x0E, 0x6, 0x0, 0xd1b0000, 6, 0x60000 }, + { 0x0, 0x0E, 0x7, 0x0, 0xd1c0000, 7, 0x70000 }, + { 0x0, 0x0E, 0x8, 0x0, 0xd1d0000, 8, 0x80000 }, + { 0x0, 0x0F, 0x0, 0x0, 0xd660000, 0, 0x0000000 }, + { 0x0, 0x10, 0x0, 0x0, 0xd1f0000, 0, 0x0000000 }, + { 0x0, 0x10, 0x1, 0x0, 0xd200000, 1, 0x10000 }, + { 0x0, 0x10, 0x2, 0x0, 0xd210000, 2, 0x20000 }, + { 0x0, 0x10, 0x3, 0x0, 0xd220000, 3, 0x30000 }, + { 0x0, 0x11, 0x0, 0x0, 0xd240000, 0, 0x0000000 }, + { 0x0, 0x12, 0x0, 0x0, 0xd250000, 0, 0x0000000 }, + { 0x0, 0x13, 0x0, 0x0, 0xd260000, 0, 0x0000000 }, + { 0x0, 0x14, 0x0, 0x0, 0xd270000, 0, 0x0000000 }, + { 0x0, 0x15, 0x0, 0x0, 0xd2b0000, 0, 0x0000000 }, + { 0x0, 0x16, 0x0, 0x0, 0xd280000, 0, 0x0000000 }, + { 0x0, 0x17, 0x0, 0x0, 0xd0f0000, 0, 0x0000000 }, + { 0x0, 0x17, 0x1, 0x0, 0xd100000, 1, 0x10000 }, + { 0x0, 0x17, 0x2, 0x0, 0xd110000, 2, 0x20000 }, + { 0x0, 0x17, 0x3, 0x0, 0xd120000, 3, 0x30000 }, + { 0x0, 0x17, 0x4, 0x0, 0xd130000, 4, 0x40000 }, + { 0x0, 0x17, 0x5, 0x0, 0xd140000, 5, 0x50000 }, + { 0x0, 0x18, 0x0, 0x0, 0xd020000, 0, 0x0000000 }, + { 0x0, 0x19, 0x0, 0x0, 0xd030000, 0, 0x0000000 }, + { 0x0, 0x1F, 0x0, 0x0, 0xd600000, 0, 0x0000000 }, + { 0x0, 0x1F, 0x1, 0x0, 0x0, 0, 0x0000000 }, + { 0x1, 0x1A, 0x0, 0x0, 0x40000000, 0, 0x40000000 }, + { 0x1, 0x1A, 0x1, 0x1, 0x80000000, 1, 0x80000000 }, + { 0x1, 0x1A, 0x2, 0x0, 0x0, 0, 0x0000000 }, + { 0x2, 0x1C, 0x0, 0x0, 0xd640000, 0, 0x0000000 }, + { 0x2, 0x1D, 0x0, 0x0, 0x20b00000, 8, 0x20b00000 }, + { 0x2, 0x1D, 0x1, 0x0, 0x20800000, 7, 0x20800000 }, + { 0x2, 0x1D, 0x2, 0x0, 0x20c00000, 9, 0x20c00000 }, + { 0x2, 0x1D, 0x3, 0x0, 0xd800000, 3, 0xd800000 }, + { 0x2, 0x1D, 0x4, 0x0, 0x20000000, 6, 0x20000000 }, + { 0x2, 0x1D, 0x5, 0x0, 0xc000000, 2, 0xc000000 }, + { 0x2, 0x1D, 0x6, 0x0, 0x21000000, 10, 0x21000000 }, + { 0x2, 0x1D, 0x7, 0x0, 0xe000000, 4, 0xe000000 }, + { 0x2, 0x1D, 0x8, 0x0, 0x22000000, 11, 0x22000000 }, + { 0x2, 0x1D, 0x9, 0x0, 0x8000000, 1, 0x8000000 }, + { 0x2, 0x1D, 0xa, 0x0, 0x24000000, 12, 0x24000000 }, + { 0x2, 0x1D, 0xb, 0x0, 0x0, 0, 0x0000000 }, + { 0x2, 0x1D, 0xc, 0x0, 0x28000000, 13, 0x28000000 }, + { 0x2, 0x1D, 0xd, 0x0, 0x10000000, 5, 0x10000000 }, + { 0x2, 0x1D, 0xe, 0x0, 0x30000000, 14, 0x30000000 }, + { 0x2, 0x00, 0x0, 0x0, 0xd230000, 0, 0x0000000 }, + { 0x2, 0x01, 0x0, 0x0, 0xd040000, 0, 0x0000000 }, + { 0x2, 0x02, 0x0, 0x0, 0xd050000, 0, 0x0000000 }, + { 0x2, 0x03, 0x0, 0x0, 0xd000000, 0, 0x0000000 }, + { 0x2, 0x04, 0x0, 0x0, 0x20ae0000, 3, 0xe0000 }, + { 0x2, 0x04, 0x1, 0x0, 0x20ac0000, 2, 0xc0000 }, + { 0x2, 0x04, 0x2, 0x0, 0x20a80000, 1, 0x80000 }, + { 0x2, 0x04, 0x3, 0x0, 0x20a00000, 0, 0x0000000 }, + { 0x2, 0x05, 0x0, 0x0, 0xd2a0000, 0, 0x0000000 }, + { 0x2, 0x06, 0x0, 0x0, 0xd290000, 0, 0x0000000 }, + { 0x2, 0x07, 0x0, 0x0, 0xd2c0000, 0, 0x0000000 }, + { 0x2, 0x08, 0x0, 0x0, 0xd0e0000, 4, 0x80000 }, + { 0x2, 0x08, 0x1, 0x0, 0xd060000, 0, 0x0000000 }, + { 0x2, 0x08, 0x2, 0x0, 0xd080000, 1, 0x20000 }, + { 0x2, 0x08, 0x3, 0x0, 0xd0a0000, 2, 0x40000 }, + { 0x2, 0x08, 0x4, 0x0, 0xd0c0000, 3, 0x60000 }, + { 0x2, 0x09, 0x0, 0x0, 0xd650000, 0, 0x0000000 }, + { 0x2, 0x0A, 0x0, 0x0, 0x20af0000, 0, 0x0000000 }, + { 0x2, 0x0B, 0x0, 0x0, 0xd3e0000, 0, 0x0000000 }, + { 0x2, 0x0C, 0x0, 0x0, 0xd3d0000, 0, 0x0000000 }, + { 0x2, 0x0D, 0x0, 0x0, 0xd1e0000, 0, 0x0000000 }, + { 0x2, 0x0E, 0x0, 0x0, 0xd150000, 0, 0x0000000 }, + { 0x2, 0x0E, 0x1, 0x0, 0xd160000, 1, 0x10000 }, + { 0x2, 0x0E, 0x2, 0x0, 0xd170000, 2, 0x20000 }, + { 0x2, 0x0E, 0x3, 0x0, 0xd180000, 3, 0x30000 }, + { 0x2, 0x0E, 0x4, 0x0, 0xd190000, 4, 0x40000 }, + { 0x2, 0x0E, 0x5, 0x0, 0xd1a0000, 5, 0x50000 }, + { 0x2, 0x0E, 0x6, 0x0, 0xd1b0000, 6, 0x60000 }, + { 0x2, 0x0E, 0x7, 0x0, 0xd1c0000, 7, 0x70000 }, + { 0x2, 0x0E, 0x8, 0x0, 0xd1d0000, 8, 0x80000 }, + { 0x2, 0x0F, 0x0, 0x0, 0xd660000, 0, 0x0000000 }, + { 0x2, 0x10, 0x0, 0x0, 0xd1f0000, 0, 0x0000000 }, + { 0x2, 0x10, 0x1, 0x0, 0xd200000, 1, 0x10000 }, + { 0x2, 0x10, 0x2, 0x0, 0xd210000, 2, 0x20000 }, + { 0x2, 0x10, 0x3, 0x0, 0xd220000, 3, 0x30000 }, + { 0x2, 0x11, 0x0, 0x0, 0xd240000, 0, 0x0000000 }, + { 0x2, 0x12, 0x0, 0x0, 0xd250000, 0, 0x0000000 }, + { 0x2, 0x13, 0x0, 0x0, 0xd260000, 0, 0x0000000 }, + { 0x2, 0x14, 0x0, 0x0, 0xd270000, 0, 0x0000000 }, + { 0x2, 0x15, 0x0, 0x0, 0xd2b0000, 0, 0x0000000 }, + { 0x2, 0x16, 0x0, 0x0, 0xd280000, 0, 0x0000000 }, + { 0x2, 0x17, 0x0, 0x0, 0xd0f0000, 0, 0x0000000 }, + { 0x2, 0x17, 0x1, 0x0, 0xd100000, 1, 0x10000 }, + { 0x2, 0x17, 0x2, 0x0, 0xd110000, 2, 0x20000 }, + { 0x2, 0x17, 0x3, 0x0, 0xd120000, 3, 0x30000 }, + { 0x2, 0x17, 0x4, 0x0, 0xd130000, 4, 0x40000 }, + { 0x2, 0x17, 0x5, 0x0, 0xd140000, 5, 0x50000 }, + { 0x2, 0x18, 0x0, 0x0, 0xd020000, 0, 0x0000000 }, + { 0x2, 0x19, 0x0, 0x0, 0xd030000, 0, 0x0000000 }, + { 0x2, 0x1F, 0x0, 0x0, 0xd600000, 0, 0x0000000 }, + { 0x2, 0x1F, 0x1, 0x0, 0x0, 0, 0x0000000 }, + { 0x3, 0x1B, 0x0, 0x0, 0x40000000, 0, 0x40000000 }, + { 0x3, 0x1B, 0x1, 0x1, 0x80000000, 1, 0x80000000 }, + { 0x3, 0x1C, 0x0, 0x2, 0xd640000, 0, 0x0000000 }, + { 0x3, 0x1D, 0x0, 0x2, 0x20b00000, 8, 0x20b00000 }, + { 0x3, 0x1D, 0x1, 0x2, 0x20800000, 7, 0x20800000 }, + { 0x3, 0x1D, 0x2, 0x2, 0x20c00000, 9, 0x20c00000 }, + { 0x3, 0x1D, 0x3, 0x2, 0xd800000, 3, 0xd800000 }, + { 0x3, 0x1D, 0x4, 0x2, 0x20000000, 6, 0x20000000 }, + { 0x3, 0x1D, 0x5, 0x2, 0xc000000, 2, 0xc000000 }, + { 0x3, 0x1D, 0x6, 0x2, 0x21000000, 10, 0x21000000 }, + { 0x3, 0x1D, 0x7, 0x2, 0xe000000, 4, 0xe000000 }, + { 0x3, 0x1D, 0x8, 0x2, 0x22000000, 11, 0x22000000 }, + { 0x3, 0x1D, 0x9, 0x2, 0x8000000, 1, 0x8000000 }, + { 0x3, 0x1D, 0xa, 0x2, 0x24000000, 12, 0x24000000 }, + { 0x3, 0x1D, 0xb, 0x2, 0x0, 0, 0x0000000 }, + { 0x3, 0x1D, 0xc, 0x2, 0x28000000, 13, 0x28000000 }, + { 0x3, 0x1D, 0xd, 0x2, 0x10000000, 5, 0x10000000 }, + { 0x3, 0x1D, 0xe, 0x2, 0x30000000, 14, 0x30000000 }, + { 0x3, 0x1E, 0x0, 0x2, 0xd400000, 0, 0xd400000 }, + { 0x3, 0x00, 0x0, 0x2, 0xd230000, 0, 0x0000000 }, + { 0x3, 0x01, 0x0, 0x2, 0xd040000, 0, 0x0000000 }, + { 0x3, 0x02, 0x0, 0x2, 0xd050000, 0, 0x0000000 }, + { 0x3, 0x03, 0x0, 0x2, 0xd000000, 0, 0x0000000 }, + { 0x3, 0x04, 0x0, 0x2, 0x20ae0000, 3, 0xe0000 }, + { 0x3, 0x04, 0x1, 0x2, 0x20ac0000, 2, 0xc0000 }, + { 0x3, 0x04, 0x2, 0x2, 0x20a80000, 1, 0x80000 }, + { 0x3, 0x04, 0x3, 0x2, 0x20a00000, 0, 0x0000000 }, + { 0x3, 0x05, 0x0, 0x2, 0xd2a0000, 0, 0x0000000 }, + { 0x3, 0x06, 0x0, 0x2, 0xd290000, 0, 0x0000000 }, + { 0x3, 0x07, 0x0, 0x2, 0xd2c0000, 0, 0x0000000 }, + { 0x3, 0x08, 0x0, 0x2, 0xd0e0000, 4, 0x80000 }, + { 0x3, 0x08, 0x1, 0x2, 0xd060000, 0, 0x0000000 }, + { 0x3, 0x08, 0x2, 0x2, 0xd080000, 1, 0x20000 }, + { 0x3, 0x08, 0x3, 0x2, 0xd0a0000, 2, 0x40000 }, + { 0x3, 0x08, 0x4, 0x2, 0xd0c0000, 3, 0x60000 }, + { 0x3, 0x09, 0x0, 0x2, 0xd650000, 0, 0x0000000 }, + { 0x3, 0x0A, 0x0, 0x2, 0x20af0000, 0, 0x0000000 }, + { 0x3, 0x0B, 0x0, 0x2, 0xd3e0000, 0, 0x0000000 }, + { 0x3, 0x0C, 0x0, 0x2, 0xd3d0000, 0, 0x0000000 }, + { 0x3, 0x0D, 0x0, 0x2, 0xd1e0000, 0, 0x0000000 }, + { 0x3, 0x0E, 0x0, 0x2, 0xd150000, 0, 0x0000000 }, + { 0x3, 0x0E, 0x1, 0x2, 0xd160000, 1, 0x10000 }, + { 0x3, 0x0E, 0x2, 0x2, 0xd170000, 2, 0x20000 }, + { 0x3, 0x0E, 0x3, 0x2, 0xd180000, 3, 0x30000 }, + { 0x3, 0x0E, 0x4, 0x2, 0xd190000, 4, 0x40000 }, + { 0x3, 0x0E, 0x5, 0x2, 0xd1a0000, 5, 0x50000 }, + { 0x3, 0x0E, 0x6, 0x2, 0xd1b0000, 6, 0x60000 }, + { 0x3, 0x0E, 0x7, 0x2, 0xd1c0000, 7, 0x70000 }, + { 0x3, 0x0E, 0x8, 0x2, 0xd1d0000, 8, 0x80000 }, + { 0x3, 0x0F, 0x0, 0x2, 0xd660000, 0, 0x0000000 }, + { 0x3, 0x10, 0x0, 0x2, 0xd1f0000, 0, 0x0000000 }, + { 0x3, 0x10, 0x1, 0x2, 0xd200000, 1, 0x10000 }, + { 0x3, 0x10, 0x2, 0x2, 0xd210000, 2, 0x20000 }, + { 0x3, 0x10, 0x3, 0x2, 0xd220000, 3, 0x30000 }, + { 0x3, 0x11, 0x0, 0x2, 0xd240000, 0, 0x0000000 }, + { 0x3, 0x12, 0x0, 0x2, 0xd250000, 0, 0x0000000 }, + { 0x3, 0x13, 0x0, 0x2, 0xd260000, 0, 0x0000000 }, + { 0x3, 0x14, 0x0, 0x2, 0xd270000, 0, 0x0000000 }, + { 0x3, 0x15, 0x0, 0x2, 0xd2b0000, 0, 0x0000000 }, + { 0x3, 0x16, 0x0, 0x2, 0xd280000, 0, 0x0000000 }, + { 0x3, 0x17, 0x0, 0x2, 0xd0f0000, 0, 0x0000000 }, + { 0x3, 0x17, 0x1, 0x2, 0xd100000, 1, 0x10000 }, + { 0x3, 0x17, 0x2, 0x2, 0xd110000, 2, 0x20000 }, + { 0x3, 0x17, 0x3, 0x2, 0xd120000, 3, 0x30000 }, + { 0x3, 0x17, 0x4, 0x2, 0xd130000, 4, 0x40000 }, + { 0x3, 0x17, 0x5, 0x2, 0xd140000, 5, 0x50000 }, + { 0x3, 0x18, 0x0, 0x2, 0xd020000, 0, 0x0000000 }, + { 0x3, 0x19, 0x0, 0x2, 0xd030000, 0, 0x0000000 }, + { 0x3, 0x1F, 0x0, 0x2, 0xd600000, 0, 0x0000000 }, + { 0x3, 0x1F, 0x1, 0x0, 0x0, 0, 0x0000000 }, + { 0x4, 0x1B, 0x0, 0x0, 0x40000000, 0, 0x40000000 }, + { 0x4, 0x1B, 0x1, 0x1, 0x80000000, 1, 0x80000000 }, + { 0x4, 0x1E, 0x0, 0x2, 0xd400000, 0, 0xd400000 }, + { 0x4, 0x1E, 0x1, 0x0, 0x0, 0, 0x0000000 }, + { 0x5, 0x1C, 0x0, 0x0, 0xd640000, 0, 0x0000000 }, + { 0x5, 0x1D, 0x0, 0x0, 0x20b00000, 8, 0x20b00000 }, + { 0x5, 0x1D, 0x1, 0x0, 0x20800000, 7, 0x20800000 }, + { 0x5, 0x1D, 0x2, 0x0, 0x20c00000, 9, 0x20c00000 }, + { 0x5, 0x1D, 0x3, 0x0, 0xd800000, 3, 0xd800000 }, + { 0x5, 0x1D, 0x4, 0x0, 0x20000000, 6, 0x20000000 }, + { 0x5, 0x1D, 0x5, 0x0, 0xc000000, 2, 0xc000000 }, + { 0x5, 0x1D, 0x6, 0x0, 0x21000000, 10, 0x21000000 }, + { 0x5, 0x1D, 0x7, 0x0, 0xe000000, 4, 0xe000000 }, + { 0x5, 0x1D, 0x8, 0x0, 0x22000000, 11, 0x22000000 }, + { 0x5, 0x1D, 0x9, 0x0, 0x8000000, 1, 0x8000000 }, + { 0x5, 0x1D, 0xa, 0x0, 0x24000000, 12, 0x24000000 }, + { 0x5, 0x1D, 0xb, 0x0, 0x0, 0, 0x0000000 }, + { 0x5, 0x1D, 0xc, 0x0, 0x28000000, 13, 0x28000000 }, + { 0x5, 0x1D, 0xd, 0x0, 0x10000000, 5, 0x10000000 }, + { 0x5, 0x1D, 0xe, 0x0, 0x30000000, 14, 0x30000000 }, + { 0x5, 0x00, 0x0, 0x0, 0xd230000, 0, 0x0000000 }, + { 0x5, 0x01, 0x0, 0x0, 0xd040000, 0, 0x0000000 }, + { 0x5, 0x02, 0x0, 0x0, 0xd050000, 0, 0x0000000 }, + { 0x5, 0x03, 0x0, 0x0, 0xd000000, 0, 0x0000000 }, + { 0x5, 0x04, 0x0, 0x0, 0x20ae0000, 3, 0xe0000 }, + { 0x5, 0x04, 0x1, 0x0, 0x20ac0000, 2, 0xc0000 }, + { 0x5, 0x04, 0x2, 0x0, 0x20a80000, 1, 0x80000 }, + { 0x5, 0x04, 0x3, 0x0, 0x20a00000, 0, 0x0000000 }, + { 0x5, 0x05, 0x0, 0x0, 0xd2a0000, 0, 0x0000000 }, + { 0x5, 0x06, 0x0, 0x0, 0xd290000, 0, 0x0000000 }, + { 0x5, 0x07, 0x0, 0x0, 0xd2c0000, 0, 0x0000000 }, + { 0x5, 0x08, 0x0, 0x0, 0xd0e0000, 4, 0x80000 }, + { 0x5, 0x08, 0x1, 0x0, 0xd060000, 0, 0x0000000 }, + { 0x5, 0x08, 0x2, 0x0, 0xd080000, 1, 0x20000 }, + { 0x5, 0x08, 0x3, 0x0, 0xd0a0000, 2, 0x40000 }, + { 0x5, 0x08, 0x4, 0x0, 0xd0c0000, 3, 0x60000 }, + { 0x5, 0x09, 0x0, 0x0, 0xd650000, 0, 0x0000000 }, + { 0x5, 0x0A, 0x0, 0x0, 0x20af0000, 0, 0x0000000 }, + { 0x5, 0x0B, 0x0, 0x0, 0xd3e0000, 0, 0x0000000 }, + { 0x5, 0x0C, 0x0, 0x0, 0xd3d0000, 0, 0x0000000 }, + { 0x5, 0x0D, 0x0, 0x0, 0xd1e0000, 0, 0x0000000 }, + { 0x5, 0x0E, 0x0, 0x0, 0xd150000, 0, 0x0000000 }, + { 0x5, 0x0E, 0x1, 0x0, 0xd160000, 1, 0x10000 }, + { 0x5, 0x0E, 0x2, 0x0, 0xd170000, 2, 0x20000 }, + { 0x5, 0x0E, 0x3, 0x0, 0xd180000, 3, 0x30000 }, + { 0x5, 0x0E, 0x4, 0x0, 0xd190000, 4, 0x40000 }, + { 0x5, 0x0E, 0x5, 0x0, 0xd1a0000, 5, 0x50000 }, + { 0x5, 0x0E, 0x6, 0x0, 0xd1b0000, 6, 0x60000 }, + { 0x5, 0x0E, 0x7, 0x0, 0xd1c0000, 7, 0x70000 }, + { 0x5, 0x0E, 0x8, 0x0, 0xd1d0000, 8, 0x80000 }, + { 0x5, 0x0F, 0x0, 0x0, 0xd660000, 0, 0x0000000 }, + { 0x5, 0x10, 0x0, 0x0, 0xd1f0000, 0, 0x0000000 }, + { 0x5, 0x10, 0x1, 0x0, 0xd200000, 1, 0x10000 }, + { 0x5, 0x10, 0x2, 0x0, 0xd210000, 2, 0x20000 }, + { 0x5, 0x10, 0x3, 0x0, 0xd220000, 3, 0x30000 }, + { 0x5, 0x11, 0x0, 0x0, 0xd240000, 0, 0x0000000 }, + { 0x5, 0x12, 0x0, 0x0, 0xd250000, 0, 0x0000000 }, + { 0x5, 0x13, 0x0, 0x0, 0xd260000, 0, 0x0000000 }, + { 0x5, 0x14, 0x0, 0x0, 0xd270000, 0, 0x0000000 }, + { 0x5, 0x15, 0x0, 0x0, 0xd2b0000, 0, 0x0000000 }, + { 0x5, 0x16, 0x0, 0x0, 0xd280000, 0, 0x0000000 }, + { 0x5, 0x17, 0x0, 0x0, 0xd0f0000, 0, 0x0000000 }, + { 0x5, 0x17, 0x1, 0x0, 0xd100000, 1, 0x10000 }, + { 0x5, 0x17, 0x2, 0x0, 0xd110000, 2, 0x20000 }, + { 0x5, 0x17, 0x3, 0x0, 0xd120000, 3, 0x30000 }, + { 0x5, 0x17, 0x4, 0x0, 0xd130000, 4, 0x40000 }, + { 0x5, 0x17, 0x5, 0x0, 0xd140000, 5, 0x50000 }, + { 0x5, 0x18, 0x0, 0x0, 0xd020000, 0, 0x0000000 }, + { 0x5, 0x19, 0x0, 0x0, 0xd030000, 0, 0x0000000 }, + { 0x5, 0x1F, 0x0, 0x0, 0xd600000, 0, 0x0000000 }, + { 0x5, 0x1F, 0x1, 0x0, 0x0, 0, 0x0000000 } +}; + +/* + * AON NOC aperture lookup table as per file "AON_NOC_Structure.info". + */ +static char *t194_aonnoc_routeid_initflow[] = { + "cbb_i/I/0", /* 0x0 */ + "cpu_p_i/I/0", /* 0x1 */ + "dma_m_i/I/0", /* 0x2 */ + "dma_p_i/I/0" /* 0x3 */ +}; + +static char *t194_aonnoc_routeid_targflow[] = { + "multiport1_t/T/aon_misc", /* 0 */ + "multiport1_t/T/avic0", /* 1 */ + "multiport1_t/T/avic1", /* 2 */ + "multiport1_t/T/can1", /* 3 */ + "multiport1_t/T/can2", /* 4 */ + "multiport1_t/T/dma", /* 5 */ + "multiport1_t/T/dmic", /* 6 */ + "multiport1_t/T/err_collator", /* 7 */ + "multiport1_t/T/fpga_misc", /* 8 */ + "multiport1_t/T/gte", /* 9 */ + "multiport1_t/T/hsp", /* A */ + "multiport1_t/T/i2c2", /* B */ + "multiport1_t/T/i2c8", /* C */ + "multiport1_t/T/pwm", /* D */ + "multiport1_t/T/spi2", /* E */ + "multiport1_t/T/tke", /* F */ + "multiport1_t/T/uartg", /* 10 */ + "RESERVED", /* 11 */ + "RESERVED", /* 12 */ + "RESERVED", /* 13 */ + "RESERVED", /* 14 */ + "RESERVED", /* 15 */ + "RESERVED", /* 16 */ + "RESERVED", /* 17 */ + "RESERVED", /* 18 */ + "RESERVED", /* 19 */ + "RESERVED", /* 1A */ + "RESERVED", /* 1B */ + "RESERVED", /* 1C */ + "RESERVED", /* 1D */ + "RESERVED", /* 1E */ + "RESERVED", /* 1F */ + "multiport0_t/T/aovc", /* 20 */ + "multiport0_t/T/atcm", /* 21 */ + "multiport0_t/T/cast", /* 22 */ + "multiport0_t/T/dast", /* 23 */ + "multiport0_t/T/err_collator_car", /* 24 */ + "multiport0_t/T/gpio", /* 25 */ + "multiport0_t/T/i2c10", /* 26 */ + "multiport0_t/T/mss", /* 27 */ + "multiport0_t/T/padctl_a12", /* 28 */ + "multiport0_t/T/padctl_a14", /* 29 */ + "multiport0_t/T/padctl_a15", /* 2A */ + "multiport0_t/T/rtc", /* 2B */ + "multiport0_t/T/tsc", /* 2C */ + "RESERVED", /* 2D */ + "RESERVED", /* 2E */ + "RESERVED", /* 2F */ + "multiport2_t/T/aon_vref_ro", /* 30 */ + "multiport2_t/T/aopm", /* 31 */ + "multiport2_t/T/car", /* 32 */ + "multiport2_t/T/pmc", /* 33 */ + "ast1_t/T/0", /* 34 */ + "cbb_t/T/0", /* 35 */ + "cpu_t/T/0", /* 36 */ + "firewall_t/T/0", /* 37 */ + "svc_t/T/0", /* 38 */ + "uartc/T/uartc", /* 39 */ + "RESERVED", /* 3A */ + "RESERVED", /* 3B */ + "RESERVED", /* 3C */ + "RESERVED", /* 3D */ + "RESERVED", /* 3E */ + "RESERVED" /* 3F */ +}; + +/* + * Fields of AON NOC lookup table: + * Init flow, Targ flow, Targ subrange, Init mapping, Init localAddress, + * Targ mapping, Targ localAddress + * ---------------------------------------------------------------------------- + */ +static const struct tegra194_cbb_aperture t194_aonnoc_aperture_lookup[] = { + { 0x0, 0x37, 0x0, 0, 0xc640000, 0, 0x0 }, + { 0x0, 0x20, 0x0, 0, 0xc3b0000, 0, 0x0 }, + { 0x0, 0x21, 0x0, 0, 0xc000000, 0, 0x0 }, + { 0x0, 0x22, 0x0, 0, 0xc040000, 0, 0x0 }, + { 0x0, 0x23, 0x0, 0, 0xc050000, 0, 0x0 }, + { 0x0, 0x24, 0x0, 0, 0x20cf0000, 0, 0x0 }, + { 0x0, 0x25, 0x0, 0, 0xc2f0000, 0, 0x0 }, + { 0x0, 0x26, 0x0, 0, 0xc230000, 0, 0x0 }, + { 0x0, 0x27, 0x0, 0, 0xc350000, 0, 0x0 }, + { 0x0, 0x28, 0x0, 0, 0xc301000, 0, 0x0 }, + { 0x0, 0x29, 0x0, 0, 0xc302000, 0, 0x0 }, + { 0x0, 0x2A, 0x0, 0, 0xc303000, 0, 0x0 }, + { 0x0, 0x2B, 0x0, 0, 0xc2a0000, 0, 0x0 }, + { 0x0, 0x2C, 0x0, 0, 0xc2b0000, 0, 0x0 }, + { 0x0, 0x2C, 0x1, 0, 0xc2c0000, 1, 0x10000 }, + { 0x0, 0x2C, 0x2, 0, 0xc2d0000, 2, 0x20000 }, + { 0x0, 0x2C, 0x3, 0, 0xc2e0000, 3, 0x30000 }, + { 0x0, 0x0, 0x0, 0, 0xc660000, 0, 0x0 }, + { 0x0, 0x1, 0x0, 0, 0xc020000, 0, 0x0 }, + { 0x0, 0x2, 0x0, 0, 0xc030000, 0, 0x0 }, + { 0x0, 0x3, 0x0, 0, 0xc310000, 0, 0x0 }, + { 0x0, 0x4, 0x0, 0, 0xc320000, 0, 0x0 }, + { 0x0, 0x5, 0x0, 0, 0xc0a0000, 2, 0x40000 }, + { 0x0, 0x5, 0x1, 0, 0xc0b0000, 3, 0x50000 }, + { 0x0, 0x5, 0x2, 0, 0xc0e0000, 5, 0x80000 }, + { 0x0, 0x5, 0x3, 0, 0xc060000, 0, 0x0 }, + { 0x0, 0x5, 0x4, 0, 0xc080000, 1, 0x20000 }, + { 0x0, 0x5, 0x5, 0, 0xc0c0000, 4, 0x60000 }, + { 0x0, 0x6, 0x0, 0, 0xc330000, 0, 0x0 }, + { 0x0, 0x7, 0x0, 0, 0xc650000, 0, 0x0 }, + { 0x0, 0x8, 0x0, 0, 0xc3e0000, 0, 0x0 }, + { 0x0, 0x9, 0x0, 0, 0xc1e0000, 0, 0x0 }, + { 0x0, 0xA, 0x0, 0, 0xc150000, 0, 0x0 }, + { 0x0, 0xA, 0x1, 0, 0xc160000, 1, 0x10000 }, + { 0x0, 0xA, 0x2, 0, 0xc170000, 2, 0x20000 }, + { 0x0, 0xA, 0x3, 0, 0xc180000, 3, 0x30000 }, + { 0x0, 0xA, 0x4, 0, 0xc190000, 4, 0x40000 }, + { 0x0, 0xA, 0x5, 0, 0xc1a0000, 5, 0x50000 }, + { 0x0, 0xA, 0x6, 0, 0xc1b0000, 6, 0x60000 }, + { 0x0, 0xA, 0x7, 0, 0xc1c0000, 7, 0x70000 }, + { 0x0, 0xA, 0x8, 0, 0xc1d0000, 8, 0x80000 }, + { 0x0, 0xB, 0x0, 0, 0xc240000, 0, 0x0 }, + { 0x0, 0xC, 0x0, 0, 0xc250000, 0, 0x0 }, + { 0x0, 0xD, 0x0, 0, 0xc340000, 0, 0x0 }, + { 0x0, 0xE, 0x0, 0, 0xc260000, 0, 0x0 }, + { 0x0, 0xF, 0x0, 0, 0xc0f0000, 0, 0x0 }, + { 0x0, 0xF, 0x1, 0, 0xc100000, 1, 0x10000 }, + { 0x0, 0xF, 0x2, 0, 0xc110000, 2, 0x20000 }, + { 0x0, 0xF, 0x3, 0, 0xc120000, 3, 0x30000 }, + { 0x0, 0xF, 0x4, 0, 0xc130000, 4, 0x40000 }, + { 0x0, 0xF, 0x5, 0, 0xc140000, 5, 0x50000 }, + { 0x0, 0x10, 0x0, 0, 0xc290000, 0, 0x0 }, + { 0x0, 0x30, 0x0, 0, 0x20ce0000, 0, 0x0 }, + { 0x0, 0x31, 0x0, 0, 0xc1f0000, 0, 0x0 }, + { 0x0, 0x31, 0x1, 0, 0xc200000, 1, 0x10000 }, + { 0x0, 0x31, 0x2, 0, 0xc210000, 2, 0x20000 }, + { 0x0, 0x31, 0x3, 0, 0xc220000, 3, 0x30000 }, + { 0x0, 0x32, 0x0, 0, 0x20cc0000, 3, 0x1c0000 }, + { 0x0, 0x32, 0x1, 0, 0x20c80000, 2, 0x180000 }, + { 0x0, 0x32, 0x2, 0, 0x20c00000, 1, 0x100000 }, + { 0x0, 0x32, 0x3, 0, 0x20b00000, 0, 0x0 }, + { 0x0, 0x33, 0x0, 0, 0xc360000, 0, 0x0 }, + { 0x0, 0x33, 0x1, 0, 0xc370000, 1, 0x10000 }, + { 0x0, 0x33, 0x2, 0, 0xc3a0000, 3, 0x40000 }, + { 0x0, 0x33, 0x3, 0, 0xc380000, 2, 0x20000 }, + { 0x0, 0x38, 0x0, 0, 0xc600000, 0, 0x0 }, + { 0x0, 0x38, 0x1, 0, 0x0000000, 0, 0x0, }, + { 0x0, 0x39, 0x0, 0, 0xc280000, 0, 0x0 }, + { 0x1, 0x35, 0x0, 0, 0x0000000, 0, 0x0, }, + { 0x1, 0x35, 0x1, 0, 0x100000, 1, 0x100000 }, + { 0x1, 0x35, 0x2, 0, 0x5a00000, 11, 0x5a00000 }, + { 0x1, 0x35, 0x3, 0, 0x5b00000, 32, 0x5b00000 }, + { 0x1, 0x35, 0x4, 0, 0x5c00000, 33, 0x5c00000 }, + { 0x1, 0x35, 0x5, 0, 0x5d00000, 12, 0x5d00000 }, + { 0x1, 0x35, 0x6, 0, 0x20000000, 19, 0x20000000 }, + { 0x1, 0x35, 0x7, 0, 0x20100000, 20, 0x20100000 }, + { 0x1, 0x35, 0x8, 0, 0x20a00000, 24, 0x20a00000 }, + { 0x1, 0x35, 0x9, 0, 0x20d00000, 25, 0x20d00000 }, + { 0x1, 0x35, 0xa, 0, 0x200000, 2, 0x200000 }, + { 0x1, 0x35, 0xb, 0, 0x5800000, 10, 0x5800000 }, + { 0x1, 0x35, 0xc, 0, 0x5e00000, 13, 0x5e00000 }, + { 0x1, 0x35, 0xd, 0, 0x20200000, 21, 0x20200000 }, + { 0x1, 0x35, 0xe, 0, 0x20800000, 23, 0x20800000 }, + { 0x1, 0x35, 0xf, 0, 0x20e00000, 26, 0x20e00000 }, + { 0x1, 0x35, 0x10, 0, 0x400000, 3, 0x400000 }, + { 0x1, 0x35, 0x11, 0, 0x20400000, 22, 0x20400000 }, + { 0x1, 0x35, 0x12, 0, 0x800000, 4, 0x800000 }, + { 0x1, 0x35, 0x13, 0, 0x5000000, 9, 0x5000000 }, + { 0x1, 0x35, 0x14, 0, 0xc800000, 34, 0xc800000 }, + { 0x1, 0x35, 0x15, 0, 0x1000000, 5, 0x1000000 }, + { 0x1, 0x35, 0x16, 0, 0x3000000, 7, 0x3000000 }, + { 0x1, 0x35, 0x17, 0, 0x4000000, 8, 0x4000000 }, + { 0x1, 0x35, 0x18, 0, 0xd000000, 16, 0xd000000 }, + { 0x1, 0x35, 0x19, 0, 0x21000000, 27, 0x21000000 }, + { 0x1, 0x35, 0x1a, 0, 0x2000000, 6, 0x2000000 }, + { 0x1, 0x35, 0x1b, 0, 0x6000000, 14, 0x6000000 }, + { 0x1, 0x35, 0x1c, 0, 0xe000000, 17, 0xe000000 }, + { 0x1, 0x35, 0x1d, 0, 0x22000000, 28, 0x22000000 }, + { 0x1, 0x35, 0x1e, 0, 0x8000000, 15, 0x8000000 }, + { 0x1, 0x35, 0x1f, 0, 0x24000000, 29, 0x24000000 }, + { 0x1, 0x35, 0x20, 0, 0x28000000, 30, 0x28000000 }, + { 0x1, 0x35, 0x21, 0, 0x10000000, 18, 0x10000000 }, + { 0x1, 0x35, 0x22, 0, 0x30000000, 31, 0x30000000 }, + { 0x1, 0x37, 0x0, 0, 0xc640000, 0, 0x0 }, + { 0x1, 0x20, 0x0, 0, 0xc3b0000, 0, 0x0 }, + { 0x1, 0x21, 0x0, 0, 0xc000000, 0, 0x0 }, + { 0x1, 0x22, 0x0, 0, 0xc040000, 0, 0x0 }, + { 0x1, 0x23, 0x0, 0, 0xc050000, 0, 0x0 }, + { 0x1, 0x24, 0x0, 0, 0x20cf0000, 0, 0x0 }, + { 0x1, 0x25, 0x0, 0, 0xc2f0000, 0, 0x0 }, + { 0x1, 0x26, 0x0, 0, 0xc230000, 0, 0x0 }, + { 0x1, 0x27, 0x0, 0, 0xc350000, 0, 0x0 }, + { 0x1, 0x28, 0x0, 0, 0xc301000, 0, 0x0 }, + { 0x1, 0x29, 0x0, 0, 0xc302000, 0, 0x0 }, + { 0x1, 0x2A, 0x0, 0, 0xc303000, 0, 0x0 }, + { 0x1, 0x2B, 0x0, 0, 0xc2a0000, 0, 0x0 }, + { 0x1, 0x2C, 0x0, 0, 0xc2b0000, 0, 0x0 }, + { 0x1, 0x2C, 0x1, 0, 0xc2c0000, 1, 0x10000 }, + { 0x1, 0x2C, 0x2, 0, 0xc2d0000, 2, 0x20000 }, + { 0x1, 0x2C, 0x3, 0, 0xc2e0000, 3, 0x30000 }, + { 0x1, 0x0, 0x0, 0, 0xc660000, 0, 0x0 }, + { 0x1, 0x1, 0x0, 0, 0xc020000, 0, 0x0 }, + { 0x1, 0x2, 0x0, 0, 0xc030000, 0, 0x0 }, + { 0x1, 0x3, 0x0, 0, 0xc310000, 0, 0x0 }, + { 0x1, 0x4, 0x0, 0, 0xc320000, 0, 0x0 }, + { 0x1, 0x5, 0x0, 0, 0xc0a0000, 2, 0x40000 }, + { 0x1, 0x5, 0x1, 0, 0xc0b0000, 3, 0x50000 }, + { 0x1, 0x5, 0x2, 0, 0xc0e0000, 5, 0x80000 }, + { 0x1, 0x5, 0x3, 0, 0xc060000, 0, 0x0 }, + { 0x1, 0x5, 0x4, 0, 0xc080000, 1, 0x20000 }, + { 0x1, 0x5, 0x5, 0, 0xc0c0000, 4, 0x60000 }, + { 0x1, 0x6, 0x0, 0, 0xc330000, 0, 0x0 }, + { 0x1, 0x7, 0x0, 0, 0xc650000, 0, 0x0 }, + { 0x1, 0x8, 0x0, 0, 0xc3e0000, 0, 0x0 }, + { 0x1, 0x9, 0x0, 0, 0xc1e0000, 0, 0x0 }, + { 0x1, 0xA, 0x0, 0, 0xc150000, 0, 0x0 }, + { 0x1, 0xA, 0x1, 0, 0xc160000, 1, 0x10000 }, + { 0x1, 0xA, 0x2, 0, 0xc170000, 2, 0x20000 }, + { 0x1, 0xA, 0x3, 0, 0xc180000, 3, 0x30000 }, + { 0x1, 0xA, 0x4, 0, 0xc190000, 4, 0x40000 }, + { 0x1, 0xA, 0x5, 0, 0xc1a0000, 5, 0x50000 }, + { 0x1, 0xA, 0x6, 0, 0xc1b0000, 6, 0x60000 }, + { 0x1, 0xA, 0x7, 0, 0xc1c0000, 7, 0x70000 }, + { 0x1, 0xA, 0x8, 0, 0xc1d0000, 8, 0x80000 }, + { 0x1, 0xB, 0x0, 0, 0xc240000, 0, 0x0 }, + { 0x1, 0xC, 0x0, 0, 0xc250000, 0, 0x0 }, + { 0x1, 0xD, 0x0, 0, 0xc340000, 0, 0x0 }, + { 0x1, 0xE, 0x0, 0, 0xc260000, 0, 0x0 }, + { 0x1, 0xF, 0x0, 0, 0xc0f0000, 0, 0x0 }, + { 0x1, 0xF, 0x1, 0, 0xc100000, 1, 0x10000 }, + { 0x1, 0xF, 0x2, 0, 0xc110000, 2, 0x20000 }, + { 0x1, 0xF, 0x3, 0, 0xc120000, 3, 0x30000 }, + { 0x1, 0xF, 0x4, 0, 0xc130000, 4, 0x40000 }, + { 0x1, 0xF, 0x5, 0, 0xc140000, 5, 0x50000 }, + { 0x1, 0x10, 0x0, 0, 0xc290000, 0, 0x0 }, + { 0x1, 0x30, 0x0, 0, 0x20ce0000, 0, 0x0 }, + { 0x1, 0x31, 0x0, 0, 0xc1f0000, 0, 0x0 }, + { 0x1, 0x31, 0x1, 0, 0xc200000, 1, 0x10000 }, + { 0x1, 0x31, 0x2, 0, 0xc210000, 2, 0x20000 }, + { 0x1, 0x31, 0x3, 0, 0xc220000, 3, 0x30000 }, + { 0x1, 0x32, 0x0, 0, 0x20cc0000, 3, 0x1c0000 }, + { 0x1, 0x32, 0x1, 0, 0x20c80000, 2, 0x180000 }, + { 0x1, 0x32, 0x2, 0, 0x20c00000, 1, 0x100000 }, + { 0x1, 0x32, 0x3, 0, 0x20b00000, 0, 0x0 }, + { 0x1, 0x33, 0x0, 0, 0xc360000, 0, 0x0 }, + { 0x1, 0x33, 0x1, 0, 0xc370000, 1, 0x10000 }, + { 0x1, 0x33, 0x2, 0, 0xc3a0000, 3, 0x40000 }, + { 0x1, 0x33, 0x3, 0, 0xc380000, 2, 0x20000 }, + { 0x1, 0x38, 0x0, 0, 0xc600000, 0, 0x0 }, + { 0x1, 0x38, 0x1, 0, 0x0000000, 0, 0x0, }, + { 0x1, 0x39, 0x0, 0, 0xc280000, 0, 0x0 }, + { 0x2, 0x34, 0x0, 0, 0x40000000, 0, 0x40000000 }, + { 0x2, 0x34, 0x1, 0, 0x80000000, 1, 0x80000000 }, + { 0x2, 0x36, 0x0, 0, 0xc400000, 0, 0xc400000 }, + { 0x2, 0x36, 0x1, 0, 0x0000000, 0, 0x0, }, + { 0x3, 0x35, 0x0, 0, 0x0000000, 0, 0x0, }, + { 0x3, 0x35, 0x1, 0, 0x100000, 1, 0x100000 }, + { 0x3, 0x35, 0x2, 0, 0x5a00000, 11, 0x5a00000 }, + { 0x3, 0x35, 0x3, 0, 0x5b00000, 32, 0x5b00000 }, + { 0x3, 0x35, 0x4, 0, 0x5c00000, 33, 0x5c00000 }, + { 0x3, 0x35, 0x5, 0, 0x5d00000, 12, 0x5d00000 }, + { 0x3, 0x35, 0x6, 0, 0x20000000, 19, 0x20000000 }, + { 0x3, 0x35, 0x7, 0, 0x20100000, 20, 0x20100000 }, + { 0x3, 0x35, 0x8, 0, 0x20a00000, 24, 0x20a00000 }, + { 0x3, 0x35, 0x9, 0, 0x20d00000, 25, 0x20d00000 }, + { 0x3, 0x35, 0xa, 0, 0x200000, 2, 0x200000 }, + { 0x3, 0x35, 0xb, 0, 0x5800000, 10, 0x5800000 }, + { 0x3, 0x35, 0xc, 0, 0x5e00000, 13, 0x5e00000 }, + { 0x3, 0x35, 0xd, 0, 0x20200000, 21, 0x20200000 }, + { 0x3, 0x35, 0xe, 0, 0x20800000, 23, 0x20800000 }, + { 0x3, 0x35, 0xf, 0, 0x20e00000, 26, 0x20e00000 }, + { 0x3, 0x35, 0x10, 0, 0x400000, 3, 0x400000 }, + { 0x3, 0x35, 0x11, 0, 0x20400000, 22, 0x20400000 }, + { 0x3, 0x35, 0x12, 0, 0x800000, 4, 0x800000 }, + { 0x3, 0x35, 0x13, 0, 0x5000000, 9, 0x5000000 }, + { 0x3, 0x35, 0x14, 0, 0xc800000, 34, 0xc800000 }, + { 0x3, 0x35, 0x15, 0, 0x1000000, 5, 0x1000000 }, + { 0x3, 0x35, 0x16, 0, 0x3000000, 7, 0x3000000 }, + { 0x3, 0x35, 0x17, 0, 0x4000000, 8, 0x4000000 }, + { 0x3, 0x35, 0x18, 0, 0xd000000, 16, 0xd000000 }, + { 0x3, 0x35, 0x19, 0, 0x21000000, 27, 0x21000000 }, + { 0x3, 0x35, 0x1a, 0, 0x2000000, 6, 0x2000000 }, + { 0x3, 0x35, 0x1b, 0, 0x6000000, 14, 0x6000000 }, + { 0x3, 0x35, 0x1c, 0, 0xe000000, 17, 0xe000000 }, + { 0x3, 0x35, 0x1d, 0, 0x22000000, 28, 0x22000000 }, + { 0x3, 0x35, 0x1e, 0, 0x8000000, 15, 0x8000000 }, + { 0x3, 0x35, 0x1f, 0, 0x24000000, 29, 0x24000000 }, + { 0x3, 0x35, 0x20, 0, 0x28000000, 30, 0x28000000 }, + { 0x3, 0x35, 0x21, 0, 0x10000000, 18, 0x10000000 }, + { 0x3, 0x35, 0x22, 0, 0x30000000, 31, 0x30000000 }, + { 0x3, 0x37, 0x0, 0, 0xc640000, 0, 0x0 }, + { 0x3, 0x20, 0x0, 0, 0xc3b0000, 0, 0x0 }, + { 0x3, 0x21, 0x0, 0, 0xc000000, 0, 0x0 }, + { 0x3, 0x22, 0x0, 0, 0xc040000, 0, 0x0 }, + { 0x3, 0x23, 0x0, 0, 0xc050000, 0, 0x0 }, + { 0x3, 0x24, 0x0, 0, 0x20cf0000, 0, 0x0 }, + { 0x3, 0x25, 0x0, 0, 0xc2f0000, 0, 0x0 }, + { 0x3, 0x26, 0x0, 0, 0xc230000, 0, 0x0 }, + { 0x3, 0x27, 0x0, 0, 0xc350000, 0, 0x0 }, + { 0x3, 0x28, 0x0, 0, 0xc301000, 0, 0x0 }, + { 0x3, 0x29, 0x0, 0, 0xc302000, 0, 0x0 }, + { 0x3, 0x2A, 0x0, 0, 0xc303000, 0, 0x0 }, + { 0x3, 0x2B, 0x0, 0, 0xc2a0000, 0, 0x0 }, + { 0x3, 0x2C, 0x0, 0, 0xc2b0000, 0, 0x0 }, + { 0x3, 0x2C, 0x1, 0, 0xc2c0000, 1, 0x10000 }, + { 0x3, 0x2C, 0x2, 0, 0xc2d0000, 2, 0x20000 }, + { 0x3, 0x2C, 0x3, 0, 0xc2e0000, 3, 0x30000 }, + { 0x3, 0x0, 0x0, 0, 0xc660000, 0, 0x0 }, + { 0x3, 0x1, 0x0, 0, 0xc020000, 0, 0x0 }, + { 0x3, 0x2, 0x0, 0, 0xc030000, 0, 0x0 }, + { 0x3, 0x3, 0x0, 0, 0xc310000, 0, 0x0 }, + { 0x3, 0x4, 0x0, 0, 0xc320000, 0, 0x0 }, + { 0x3, 0x5, 0x0, 0, 0xc0a0000, 2, 0x40000 }, + { 0x3, 0x5, 0x1, 0, 0xc0b0000, 3, 0x50000 }, + { 0x3, 0x5, 0x2, 0, 0xc0e0000, 5, 0x80000 }, + { 0x3, 0x5, 0x3, 0, 0xc060000, 0, 0x0 }, + { 0x3, 0x5, 0x4, 0, 0xc080000, 1, 0x20000 }, + { 0x3, 0x5, 0x5, 0, 0xc0c0000, 4, 0x60000 }, + { 0x3, 0x6, 0x0, 0, 0xc330000, 0, 0x0 }, + { 0x3, 0x7, 0x0, 0, 0xc650000, 0, 0x0 }, + { 0x3, 0x8, 0x0, 0, 0xc3e0000, 0, 0x0 }, + { 0x3, 0x9, 0x0, 0, 0xc1e0000, 0, 0x0 }, + { 0x3, 0xA, 0x0, 0, 0xc150000, 0, 0x0 }, + { 0x3, 0xA, 0x1, 0, 0xc160000, 1, 0x10000 }, + { 0x3, 0xA, 0x2, 0, 0xc170000, 2, 0x20000 }, + { 0x3, 0xA, 0x3, 0, 0xc180000, 3, 0x30000 }, + { 0x3, 0xA, 0x4, 0, 0xc190000, 4, 0x40000 }, + { 0x3, 0xA, 0x5, 0, 0xc1a0000, 5, 0x50000 }, + { 0x3, 0xA, 0x6, 0, 0xc1b0000, 6, 0x60000 }, + { 0x3, 0xA, 0x7, 0, 0xc1c0000, 7, 0x70000 }, + { 0x3, 0xA, 0x8, 0, 0xc1d0000, 8, 0x80000 }, + { 0x3, 0xB, 0x0, 0, 0xc240000, 0, 0x0 }, + { 0x3, 0xC, 0x0, 0, 0xc250000, 0, 0x0 }, + { 0x3, 0xD, 0x0, 0, 0xc340000, 0, 0x0 }, + { 0x3, 0xE, 0x0, 0, 0xc260000, 0, 0x0 }, + { 0x3, 0xF, 0x0, 0, 0xc0f0000, 0, 0x0 }, + { 0x3, 0xF, 0x1, 0, 0xc100000, 1, 0x10000 }, + { 0x3, 0xF, 0x2, 0, 0xc110000, 2, 0x20000 }, + { 0x3, 0xF, 0x3, 0, 0xc120000, 3, 0x30000 }, + { 0x3, 0xF, 0x4, 0, 0xc130000, 4, 0x40000 }, + { 0x3, 0xF, 0x5, 0, 0xc140000, 5, 0x50000 }, + { 0x3, 0x10, 0x0, 0, 0xc290000, 0, 0x0 }, + { 0x3, 0x30, 0x0, 0, 0x20ce0000, 0, 0x0 }, + { 0x3, 0x31, 0x0, 0, 0xc1f0000, 0, 0x0 }, + { 0x3, 0x31, 0x1, 0, 0xc200000, 1, 0x10000 }, + { 0x3, 0x31, 0x2, 0, 0xc210000, 2, 0x20000 }, + { 0x3, 0x31, 0x3, 0, 0xc220000, 3, 0x30000 }, + { 0x3, 0x32, 0x0, 0, 0x20cc0000, 3, 0x1c0000 }, + { 0x3, 0x32, 0x1, 0, 0x20c80000, 2, 0x180000 }, + { 0x3, 0x32, 0x2, 0, 0x20c00000, 1, 0x100000 }, + { 0x3, 0x32, 0x3, 0, 0x20b00000, 0, 0x0 }, + { 0x3, 0x33, 0x0, 0, 0xc360000, 0, 0x0 }, + { 0x3, 0x33, 0x1, 0, 0xc370000, 1, 0x10000 }, + { 0x3, 0x33, 0x2, 0, 0xc3a0000, 3, 0x40000 }, + { 0x3, 0x33, 0x3, 0, 0xc380000, 2, 0x20000 }, + { 0x3, 0x38, 0x0, 0, 0xc600000, 0, 0x0 }, + { 0x3, 0x38, 0x1, 0, 0x0, 0, 0x0 }, + { 0x3, 0x39, 0x0, 0, 0xc280000, 0, 0x0 } +}; + +/* + * SCE/RCE NOC aperture lookup table as per file "AON_NOC_Structure.info". + */ +static char *t194_scenoc_routeid_initflow[] = { + "cbb_i/I/0", /* 0 */ + "cpu_m_i/I/0", /* 1 */ + "cpu_p_i/I/0", /* 2 */ + "dma_m_i/I/0", /* 3 */ + "dma_p_i/I/0", /* 4 */ + "RESERVED", /* 5 */ + "RESERVED", /* 6 */ + "RESERVED" /* 7 */ +}; + +static char *t194_scenoc_routeid_targflow[] = { + "multiport0_t/T/atcm_cfg", /* 0x0 */ + "multiport0_t/T/car", /* 0x1 */ + "multiport0_t/T/cast", /* 0x2 */ + "multiport0_t/T/cfg", /* 0x3 */ + "multiport0_t/T/dast", /* 0x4 */ + "multiport0_t/T/dma", /* 0x5 */ + "multiport0_t/T/err_collator", /* 0x6 */ + "multiport0_t/T/err_collator_car", /* 0x7 */ + "multiport0_t/T/fpga_misc", /* 0x8 */ + "multiport0_t/T/fpga_uart", /* 0x9 */ + "multiport0_t/T/gte", /* 0xA */ + "multiport0_t/T/hsp", /* 0xB */ + "multiport0_t/T/misc", /* 0xC */ + "multiport0_t/T/pm", /* 0xD */ + "multiport0_t/T/tke", /* 0xE */ + "RESERVED", /* 0xF */ + "multiport1_t/T/hsm", /* 0x10 */ + "multiport1_t/T/vic0", /* 0x11 */ + "multiport1_t/T/vic1", /* 0x12 */ + "ast0_t/T/0", /* 0x13 */ + "ast1_t/T/0", /* 0x14 */ + "cbb_t/T/0", /* 0x15 */ + "cpu_t/T/0", /* 0x16 */ + "sce_noc_firewall/T/0", /* 0x17 */ + "svc_t/T/0", /* 0x18 */ + "RESERVED", /* 0x19 */ + "RESERVED", /* 0x1A */ + "RESERVED", /* 0x1B */ + "RESERVED", /* 0x1C */ + "RESERVED", /* 0x1D */ + "RESERVED", /* 0x1E */ + "RESERVED" /* 0x1F */ +}; + +/* + * Fields of SCE/RCE NOC lookup table: + * Init flow, Targ flow, Targ subrange, Init mapping, Init localAddress, + * Targ mapping, Targ localAddress + * ---------------------------------------------------------------------------- + */ +static const struct tegra194_cbb_aperture t194_scenoc_apert_lookup[] = { + { 0x0, 0x16, 0x0, 0, 0xb400000, 0, 0xb400000 }, + { 0x0, 0x16, 0x1, 0, 0xbc00000, 1, 0xbc00000 }, + { 0x0, 0x0, 0x0, 0, 0xb000000, 0, 0x0 }, + { 0x0, 0x0, 0x1, 0, 0xb800000, 1, 0x0 }, + { 0x0, 0x1, 0x0, 0, 0x20de0000, 3, 0xe0000 }, + { 0x0, 0x1, 0x1, 0, 0x210e0000, 7, 0xe0000 }, + { 0x0, 0x1, 0x2, 0, 0x20dc0000, 2, 0xc0000 }, + { 0x0, 0x1, 0x3, 0, 0x210c0000, 6, 0xc0000 }, + { 0x0, 0x1, 0x4, 0, 0x20d80000, 1, 0x80000 }, + { 0x0, 0x1, 0x5, 0, 0x21080000, 5, 0x80000 }, + { 0x0, 0x1, 0x6, 0, 0x20d00000, 0, 0x0 }, + { 0x0, 0x1, 0x7, 0, 0x21000000, 4, 0x0 }, + { 0x0, 0x2, 0x0, 0, 0xb040000, 0, 0x0 }, + { 0x0, 0x2, 0x1, 0, 0xb840000, 1, 0x0 }, + { 0x0, 0x3, 0x0, 0, 0xb230000, 0, 0x0 }, + { 0x0, 0x3, 0x1, 0, 0xba30000, 1, 0x0 }, + { 0x0, 0x4, 0x0, 0, 0xb050000, 0, 0x0 }, + { 0x0, 0x4, 0x1, 0, 0xb850000, 1, 0x0 }, + { 0x0, 0x5, 0x0, 0, 0xb060000, 0, 0x0 }, + { 0x0, 0x5, 0x1, 0, 0xb070000, 1, 0x10000 }, + { 0x0, 0x5, 0x2, 0, 0xb080000, 2, 0x20000 }, + { 0x0, 0x5, 0x3, 0, 0xb090000, 3, 0x30000 }, + { 0x0, 0x5, 0x4, 0, 0xb0a0000, 4, 0x40000 }, + { 0x0, 0x5, 0x5, 0, 0xb0b0000, 5, 0x50000 }, + { 0x0, 0x5, 0x6, 0, 0xb0c0000, 6, 0x60000 }, + { 0x0, 0x5, 0x7, 0, 0xb0d0000, 7, 0x70000 }, + { 0x0, 0x5, 0x8, 0, 0xb0e0000, 8, 0x80000 }, + { 0x0, 0x5, 0x9, 0, 0xb860000, 9, 0x0 }, + { 0x0, 0x5, 0xa, 0, 0xb870000, 10, 0x10000 }, + { 0x0, 0x5, 0xb, 0, 0xb880000, 11, 0x20000 }, + { 0x0, 0x5, 0xc, 0, 0xb890000, 12, 0x30000 }, + { 0x0, 0x5, 0xd, 0, 0xb8a0000, 13, 0x40000 }, + { 0x0, 0x5, 0xe, 0, 0xb8b0000, 14, 0x50000 }, + { 0x0, 0x5, 0xf, 0, 0xb8c0000, 15, 0x60000 }, + { 0x0, 0x5, 0x10, 0, 0xb8d0000, 16, 0x70000 }, + { 0x0, 0x5, 0x11, 0, 0xb8e0000, 17, 0x80000 }, + { 0x0, 0x6, 0x0, 0, 0xb650000, 0, 0x0 }, + { 0x0, 0x6, 0x1, 0, 0xbe50000, 1, 0x0 }, + { 0x0, 0x7, 0x0, 0, 0x20df0000, 0, 0x0 }, + { 0x0, 0x7, 0x1, 0, 0x210f0000, 1, 0x0 }, + { 0x0, 0x8, 0x0, 0, 0xb3e0000, 0, 0x0 }, + { 0x0, 0x8, 0x1, 0, 0xbbe0000, 1, 0x0 }, + { 0x0, 0x9, 0x0, 0, 0xb3d0000, 0, 0x0 }, + { 0x0, 0x9, 0x1, 0, 0xbbd0000, 1, 0x0 }, + { 0x0, 0xA, 0x0, 0, 0xb1e0000, 0, 0x0 }, + { 0x0, 0xA, 0x1, 0, 0xb9e0000, 1, 0x0 }, + { 0x0, 0xB, 0x0, 0, 0xb150000, 0, 0x0 }, + { 0x0, 0xB, 0x1, 0, 0xb160000, 1, 0x10000 }, + { 0x0, 0xB, 0x2, 0, 0xb170000, 2, 0x20000 }, + { 0x0, 0xB, 0x3, 0, 0xb180000, 3, 0x30000 }, + { 0x0, 0xB, 0x4, 0, 0xb190000, 4, 0x40000 }, + { 0x0, 0xB, 0x5, 0, 0xb1a0000, 5, 0x50000 }, + { 0x0, 0xB, 0x6, 0, 0xb1b0000, 6, 0x60000 }, + { 0x0, 0xB, 0x7, 0, 0xb1c0000, 7, 0x70000 }, + { 0x0, 0xB, 0x8, 0, 0xb1d0000, 8, 0x80000 }, + { 0x0, 0xB, 0x9, 0, 0xb950000, 9, 0x0 }, + { 0x0, 0xB, 0xa, 0, 0xb960000, 10, 0x10000 }, + { 0x0, 0xB, 0xb, 0, 0xb970000, 11, 0x20000 }, + { 0x0, 0xB, 0xc, 0, 0xb980000, 12, 0x30000 }, + { 0x0, 0xB, 0xd, 0, 0xb990000, 13, 0x40000 }, + { 0x0, 0xB, 0xe, 0, 0xb9a0000, 14, 0x50000 }, + { 0x0, 0xB, 0xf, 0, 0xb9b0000, 15, 0x60000 }, + { 0x0, 0xB, 0x10, 0, 0xb9c0000, 16, 0x70000 }, + { 0x0, 0xB, 0x11, 0, 0xb9d0000, 17, 0x80000 }, + { 0x0, 0xC, 0x0, 0, 0xb660000, 0, 0x0 }, + { 0x0, 0xC, 0x1, 0, 0xbe60000, 1, 0x0 }, + { 0x0, 0xD, 0x0, 0, 0xb1f0000, 0, 0x0 }, + { 0x0, 0xD, 0x1, 0, 0xb200000, 1, 0x10000 }, + { 0x0, 0xD, 0x2, 0, 0xb210000, 2, 0x20000 }, + { 0x0, 0xD, 0x3, 0, 0xb220000, 3, 0x30000 }, + { 0x0, 0xD, 0x4, 0, 0xb9f0000, 4, 0x0 }, + { 0x0, 0xD, 0x5, 0, 0xba00000, 5, 0x10000 }, + { 0x0, 0xD, 0x6, 0, 0xba10000, 6, 0x20000 }, + { 0x0, 0xD, 0x7, 0, 0xba20000, 7, 0x30000 }, + { 0x0, 0xE, 0x0, 0, 0xb0f0000, 0, 0x0 }, + { 0x0, 0xE, 0x1, 0, 0xb100000, 1, 0x10000 }, + { 0x0, 0xE, 0x2, 0, 0xb110000, 2, 0x20000 }, + { 0x0, 0xE, 0x3, 0, 0xb120000, 3, 0x30000 }, + { 0x0, 0xE, 0x4, 0, 0xb130000, 4, 0x40000 }, + { 0x0, 0xE, 0x5, 0, 0xb140000, 5, 0x50000 }, + { 0x0, 0xE, 0x6, 0, 0xb8f0000, 6, 0x0 }, + { 0x0, 0xE, 0x7, 0, 0xb900000, 7, 0x10000 }, + { 0x0, 0xE, 0x8, 0, 0xb910000, 8, 0x20000 }, + { 0x0, 0xE, 0x9, 0, 0xb920000, 9, 0x30000 }, + { 0x0, 0xE, 0xa, 0, 0xb930000, 10, 0x40000 }, + { 0x0, 0xE, 0xb, 0, 0xb940000, 11, 0x50000 }, + { 0x0, 0x10, 0x0, 0, 0xb240000, 0, 0x0 }, + { 0x0, 0x10, 0x1, 0, 0xba40000, 1, 0x0 }, + { 0x0, 0x11, 0x0, 0, 0xb020000, 0, 0x0 }, + { 0x0, 0x11, 0x1, 0, 0xb820000, 1, 0x0 }, + { 0x0, 0x12, 0x0, 0, 0xb030000, 0, 0x0 }, + { 0x0, 0x12, 0x1, 0, 0xb830000, 1, 0x0 }, + { 0x0, 0x17, 0x0, 0, 0xb640000, 0, 0x0 }, + { 0x0, 0x17, 0x1, 0, 0xbe40000, 1, 0x0 }, + { 0x0, 0x18, 0x0, 0, 0xb600000, 0, 0x0 }, + { 0x0, 0x18, 0x1, 0, 0xbe00000, 1, 0x0 }, + { 0x0, 0x18, 0x2, 0, 0x0, 0, 0x0 }, + { 0x0, 0x18, 0x3, 0, 0x0, 0, 0x0 }, + { 0x1, 0x13, 0x0, 0, 0x40000000, 0, 0x40000000 }, + { 0x1, 0x13, 0x1, 1, 0x80000000, 1, 0x80000000 }, + { 0x1, 0x13, 0x2, 0, 0x0, 0, 0x0 }, + { 0x2, 0x15, 0x0, 0, 0x20c00000, 8, 0x20c00000 }, + { 0x2, 0x15, 0x1, 0, 0x21100000, 22, 0x21100000 }, + { 0x2, 0x15, 0x2, 0, 0x20e00000, 9, 0x20e00000 }, + { 0x2, 0x15, 0x3, 0, 0x21200000, 23, 0x21200000 }, + { 0x2, 0x15, 0x4, 0, 0x20800000, 7, 0x20800000 }, + { 0x2, 0x15, 0x5, 0, 0x21400000, 24, 0x21400000 }, + { 0x2, 0x15, 0x6, 0, 0xb000000, 18, 0xb000000 }, + { 0x2, 0x15, 0x7, 0, 0xb800000, 3, 0xb800000 }, + { 0x2, 0x15, 0x8, 0, 0x20000000, 6, 0x20000000 }, + { 0x2, 0x15, 0x9, 0, 0x21800000, 25, 0x21800000 }, + { 0x2, 0x15, 0xa, 0, 0xa000000, 2, 0xa000000 }, + { 0x2, 0x15, 0xb, 0, 0xa000000, 17, 0xa000000 }, + { 0x2, 0x15, 0xc, 0, 0x20000000, 21, 0x20000000 }, + { 0x2, 0x15, 0xd, 0, 0x21000000, 10, 0x21000000 }, + { 0x2, 0x15, 0xe, 0, 0x8000000, 1, 0x8000000 }, + { 0x2, 0x15, 0xf, 0, 0x8000000, 16, 0x8000000 }, + { 0x2, 0x15, 0x10, 0, 0x22000000, 11, 0x22000000 }, + { 0x2, 0x15, 0x11, 0, 0x22000000, 26, 0x22000000 }, + { 0x2, 0x15, 0x12, 0, 0xc000000, 4, 0xc000000 }, + { 0x2, 0x15, 0x13, 0, 0xc000000, 19, 0xc000000 }, + { 0x2, 0x15, 0x14, 0, 0x24000000, 12, 0x24000000 }, + { 0x2, 0x15, 0x15, 0, 0x24000000, 27, 0x24000000 }, + { 0x2, 0x15, 0x16, 0, 0x0, 0, 0x0 }, + { 0x2, 0x15, 0x17, 0, 0x0, 15, 0x0 }, + { 0x2, 0x15, 0x18, 0, 0x28000000, 13, 0x28000000 }, + { 0x2, 0x15, 0x19, 0, 0x28000000, 28, 0x28000000 }, + { 0x2, 0x15, 0x1a, 0, 0x10000000, 5, 0x10000000 }, + { 0x2, 0x15, 0x1b, 0, 0x10000000, 20, 0x10000000 }, + { 0x2, 0x15, 0x1c, 0, 0x30000000, 14, 0x30000000 }, + { 0x2, 0x15, 0x1d, 0, 0x30000000, 29, 0x30000000 }, + { 0x2, 0x0, 0x0, 0, 0xb000000, 0, 0x0 }, + { 0x2, 0x0, 0x1, 0, 0xb800000, 1, 0x0 }, + { 0x2, 0x1, 0x0, 0, 0x20de0000, 3, 0xe0000 }, + { 0x2, 0x1, 0x1, 0, 0x210e0000, 7, 0xe0000 }, + { 0x2, 0x1, 0x2, 0, 0x20dc0000, 2, 0xc0000 }, + { 0x2, 0x1, 0x3, 0, 0x210c0000, 6, 0xc0000 }, + { 0x2, 0x1, 0x4, 0, 0x20d80000, 1, 0x80000 }, + { 0x2, 0x1, 0x5, 0, 0x21080000, 5, 0x80000 }, + { 0x2, 0x1, 0x6, 0, 0x20d00000, 0, 0x0 }, + { 0x2, 0x1, 0x7, 0, 0x21000000, 4, 0x0 }, + { 0x2, 0x2, 0x0, 0, 0xb040000, 0, 0x0 }, + { 0x2, 0x2, 0x1, 0, 0xb840000, 1, 0x0 }, + { 0x2, 0x3, 0x0, 0, 0xb230000, 0, 0x0 }, + { 0x2, 0x3, 0x1, 0, 0xba30000, 1, 0x0 }, + { 0x2, 0x4, 0x0, 0, 0xb050000, 0, 0x0 }, + { 0x2, 0x4, 0x1, 0, 0xb850000, 1, 0x0 }, + { 0x2, 0x5, 0x0, 0, 0xb060000, 0, 0x0 }, + { 0x2, 0x5, 0x1, 0, 0xb070000, 1, 0x10000 }, + { 0x2, 0x5, 0x2, 0, 0xb080000, 2, 0x20000 }, + { 0x2, 0x5, 0x3, 0, 0xb090000, 3, 0x30000 }, + { 0x2, 0x5, 0x4, 0, 0xb0a0000, 4, 0x40000 }, + { 0x2, 0x5, 0x5, 0, 0xb0b0000, 5, 0x50000 }, + { 0x2, 0x5, 0x6, 0, 0xb0c0000, 6, 0x60000 }, + { 0x2, 0x5, 0x7, 0, 0xb0d0000, 7, 0x70000 }, + { 0x2, 0x5, 0x8, 0, 0xb0e0000, 8, 0x80000 }, + { 0x2, 0x5, 0x9, 0, 0xb860000, 9, 0x0 }, + { 0x2, 0x5, 0xa, 0, 0xb870000, 10, 0x10000 }, + { 0x2, 0x5, 0xb, 0, 0xb880000, 11, 0x20000 }, + { 0x2, 0x5, 0xc, 0, 0xb890000, 12, 0x30000 }, + { 0x2, 0x5, 0xd, 0, 0xb8a0000, 13, 0x40000 }, + { 0x2, 0x5, 0xe, 0, 0xb8b0000, 14, 0x50000 }, + { 0x2, 0x5, 0xf, 0, 0xb8c0000, 15, 0x60000 }, + { 0x2, 0x5, 0x10, 0, 0xb8d0000, 16, 0x70000 }, + { 0x2, 0x5, 0x11, 0, 0xb8e0000, 17, 0x80000 }, + { 0x2, 0x6, 0x0, 0, 0xb650000, 0, 0x0 }, + { 0x2, 0x6, 0x1, 0, 0xbe50000, 1, 0x0 }, + { 0x2, 0x7, 0x0, 0, 0x20df0000, 0, 0x0 }, + { 0x2, 0x7, 0x1, 0, 0x210f0000, 1, 0x0 }, + { 0x2, 0x8, 0x0, 0, 0xb3e0000, 0, 0x0 }, + { 0x2, 0x8, 0x1, 0, 0xbbe0000, 1, 0x0 }, + { 0x2, 0x9, 0x0, 0, 0xb3d0000, 0, 0x0 }, + { 0x2, 0x9, 0x1, 0, 0xbbd0000, 1, 0x0 }, + { 0x2, 0xA, 0x0, 0, 0xb1e0000, 0, 0x0 }, + { 0x2, 0xA, 0x1, 0, 0xb9e0000, 1, 0x0 }, + { 0x2, 0xB, 0x0, 0, 0xb150000, 0, 0x0 }, + { 0x2, 0xB, 0x1, 0, 0xb160000, 1, 0x10000 }, + { 0x2, 0xB, 0x2, 0, 0xb170000, 2, 0x20000 }, + { 0x2, 0xB, 0x3, 0, 0xb180000, 3, 0x30000 }, + { 0x2, 0xB, 0x4, 0, 0xb190000, 4, 0x40000 }, + { 0x2, 0xB, 0x5, 0, 0xb1a0000, 5, 0x50000 }, + { 0x2, 0xB, 0x6, 0, 0xb1b0000, 6, 0x60000 }, + { 0x2, 0xB, 0x7, 0, 0xb1c0000, 7, 0x70000 }, + { 0x2, 0xB, 0x8, 0, 0xb1d0000, 8, 0x80000 }, + { 0x2, 0xB, 0x9, 0, 0xb950000, 9, 0x0 }, + { 0x2, 0xB, 0xa, 0, 0xb960000, 10, 0x10000 }, + { 0x2, 0xB, 0xb, 0, 0xb970000, 11, 0x20000 }, + { 0x2, 0xB, 0xc, 0, 0xb980000, 12, 0x30000 }, + { 0x2, 0xB, 0xd, 0, 0xb990000, 13, 0x40000 }, + { 0x2, 0xB, 0xe, 0, 0xb9a0000, 14, 0x50000 }, + { 0x2, 0xB, 0xf, 0, 0xb9b0000, 15, 0x60000 }, + { 0x2, 0xB, 0x10, 0, 0xb9c0000, 16, 0x70000 }, + { 0x2, 0xB, 0x11, 0, 0xb9d0000, 17, 0x80000 }, + { 0x2, 0xC, 0x0, 0, 0xb660000, 0, 0x0 }, + { 0x2, 0xC, 0x1, 0, 0xbe60000, 1, 0x0 }, + { 0x2, 0xD, 0x0, 0, 0xb1f0000, 0, 0x0 }, + { 0x2, 0xD, 0x1, 0, 0xb200000, 1, 0x10000 }, + { 0x2, 0xD, 0x2, 0, 0xb210000, 2, 0x20000 }, + { 0x2, 0xD, 0x3, 0, 0xb220000, 3, 0x30000 }, + { 0x2, 0xD, 0x4, 0, 0xb9f0000, 4, 0x0 }, + { 0x2, 0xD, 0x5, 0, 0xba00000, 5, 0x10000 }, + { 0x2, 0xD, 0x6, 0, 0xba10000, 6, 0x20000 }, + { 0x2, 0xD, 0x7, 0, 0xba20000, 7, 0x30000 }, + { 0x2, 0xE, 0x0, 0, 0xb0f0000, 0, 0x0 }, + { 0x2, 0xE, 0x1, 0, 0xb100000, 1, 0x10000 }, + { 0x2, 0xE, 0x2, 0, 0xb110000, 2, 0x20000 }, + { 0x2, 0xE, 0x3, 0, 0xb120000, 3, 0x30000 }, + { 0x2, 0xE, 0x4, 0, 0xb130000, 4, 0x40000 }, + { 0x2, 0xE, 0x5, 0, 0xb140000, 5, 0x50000 }, + { 0x2, 0xE, 0x6, 0, 0xb8f0000, 6, 0x0 }, + { 0x2, 0xE, 0x7, 0, 0xb900000, 7, 0x10000 }, + { 0x2, 0xE, 0x8, 0, 0xb910000, 8, 0x20000 }, + { 0x2, 0xE, 0x9, 0, 0xb920000, 9, 0x30000 }, + { 0x2, 0xE, 0xa, 0, 0xb930000, 10, 0x40000 }, + { 0x2, 0xE, 0xb, 0, 0xb940000, 11, 0x50000 }, + { 0x2, 0x10, 0x0, 0, 0xb240000, 0, 0x0 }, + { 0x2, 0x10, 0x1, 0, 0xba40000, 1, 0x0 }, + { 0x2, 0x11, 0x0, 0, 0xb020000, 0, 0x0 }, + { 0x2, 0x11, 0x1, 0, 0xb820000, 1, 0x0 }, + { 0x2, 0x12, 0x0, 0, 0xb030000, 0, 0x0 }, + { 0x2, 0x12, 0x1, 0, 0xb830000, 1, 0x0 }, + { 0x2, 0x17, 0x0, 0, 0xb640000, 0, 0x0 }, + { 0x2, 0x17, 0x1, 0, 0xbe40000, 1, 0x0 }, + { 0x2, 0x18, 0x0, 0, 0xb600000, 0, 0x0 }, + { 0x2, 0x18, 0x1, 0, 0xbe00000, 1, 0x0 }, + { 0x2, 0x18, 0x2, 0, 0x0, 0, 0x0 }, + { 0x2, 0x18, 0x3, 0, 0x0, 0, 0x0 }, + { 0x3, 0x14, 0x0, 0, 0x40000000, 0, 0x40000000 }, + { 0x3, 0x14, 0x1, 1, 0x80000000, 1, 0x80000000 }, + { 0x3, 0x16, 0x0, 2, 0xb400000, 0, 0xb400000 }, + { 0x3, 0x16, 0x1, 2, 0xbc00000, 1, 0xbc00000 }, + { 0x3, 0x16, 0x2, 0, 0x0, 0, 0x0 }, + { 0x3, 0x16, 0x3, 0, 0x0, 0, 0x0 }, + { 0x4, 0x15, 0x0, 0, 0x20c00000, 8, 0x20c00000 }, + { 0x4, 0x15, 0x1, 0, 0x21100000, 22, 0x21100000 }, + { 0x4, 0x15, 0x2, 0, 0x20e00000, 9, 0x20e00000 }, + { 0x4, 0x15, 0x3, 0, 0x21200000, 23, 0x21200000 }, + { 0x4, 0x15, 0x4, 0, 0x20800000, 7, 0x20800000 }, + { 0x4, 0x15, 0x5, 0, 0x21400000, 24, 0x21400000 }, + { 0x4, 0x15, 0x6, 0, 0xb000000, 18, 0xb000000 }, + { 0x4, 0x15, 0x7, 0, 0xb800000, 3, 0xb800000 }, + { 0x4, 0x15, 0x8, 0, 0x20000000, 6, 0x20000000 }, + { 0x4, 0x15, 0x9, 0, 0x21800000, 25, 0x21800000 }, + { 0x4, 0x15, 0xa, 0, 0xa000000, 2, 0xa000000 }, + { 0x4, 0x15, 0xb, 0, 0xa000000, 17, 0xa000000 }, + { 0x4, 0x15, 0xc, 0, 0x20000000, 21, 0x20000000 }, + { 0x4, 0x15, 0xd, 0, 0x21000000, 10, 0x21000000 }, + { 0x4, 0x15, 0xe, 0, 0x8000000, 1, 0x8000000 }, + { 0x4, 0x15, 0xf, 0, 0x8000000, 16, 0x8000000 }, + { 0x4, 0x15, 0x10, 0, 0x22000000, 11, 0x22000000 }, + { 0x4, 0x15, 0x11, 0, 0x22000000, 26, 0x22000000 }, + { 0x4, 0x15, 0x12, 0, 0xc000000, 4, 0xc000000 }, + { 0x4, 0x15, 0x13, 0, 0xc000000, 19, 0xc000000 }, + { 0x4, 0x15, 0x14, 0, 0x24000000, 12, 0x24000000 }, + { 0x4, 0x15, 0x15, 0, 0x24000000, 27, 0x24000000 }, + { 0x4, 0x15, 0x16, 0, 0x0, 0, 0x0 }, + { 0x4, 0x15, 0x17, 0, 0x0, 15, 0x0 }, + { 0x4, 0x15, 0x18, 0, 0x28000000, 13, 0x28000000 }, + { 0x4, 0x15, 0x19, 0, 0x28000000, 28, 0x28000000 }, + { 0x4, 0x15, 0x1a, 0, 0x10000000, 5, 0x10000000 }, + { 0x4, 0x15, 0x1b, 0, 0x10000000, 20, 0x10000000 }, + { 0x4, 0x15, 0x1c, 0, 0x30000000, 14, 0x30000000 }, + { 0x4, 0x15, 0x1d, 0, 0x30000000, 29, 0x30000000 }, + { 0x4, 0x0, 0x0, 0, 0xb000000, 0, 0x0 }, + { 0x4, 0x0, 0x1, 0, 0xb800000, 1, 0x0 }, + { 0x4, 0x1, 0x0, 0, 0x20de0000, 3, 0xe0000 }, + { 0x4, 0x1, 0x1, 0, 0x210e0000, 7, 0xe0000 }, + { 0x4, 0x1, 0x2, 0, 0x20dc0000, 2, 0xc0000 }, + { 0x4, 0x1, 0x3, 0, 0x210c0000, 6, 0xc0000 }, + { 0x4, 0x1, 0x4, 0, 0x20d80000, 1, 0x80000 }, + { 0x4, 0x1, 0x5, 0, 0x21080000, 5, 0x80000 }, + { 0x4, 0x1, 0x6, 0, 0x20d00000, 0, 0x0 }, + { 0x4, 0x1, 0x7, 0, 0x21000000, 4, 0x0 }, + { 0x4, 0x2, 0x0, 0, 0xb040000, 0, 0x0 }, + { 0x4, 0x2, 0x1, 0, 0xb840000, 1, 0x0 }, + { 0x4, 0x3, 0x0, 0, 0xb230000, 0, 0x0 }, + { 0x4, 0x3, 0x1, 0, 0xba30000, 1, 0x0 }, + { 0x4, 0x4, 0x0, 0, 0xb050000, 0, 0x0 }, + { 0x4, 0x4, 0x1, 0, 0xb850000, 1, 0x0 }, + { 0x4, 0x5, 0x0, 0, 0xb060000, 0, 0x0 }, + { 0x4, 0x5, 0x1, 0, 0xb070000, 1, 0x10000 }, + { 0x4, 0x5, 0x2, 0, 0xb080000, 2, 0x20000 }, + { 0x4, 0x5, 0x3, 0, 0xb090000, 3, 0x30000 }, + { 0x4, 0x5, 0x4, 0, 0xb0a0000, 4, 0x40000 }, + { 0x4, 0x5, 0x5, 0, 0xb0b0000, 5, 0x50000 }, + { 0x4, 0x5, 0x6, 0, 0xb0c0000, 6, 0x60000 }, + { 0x4, 0x5, 0x7, 0, 0xb0d0000, 7, 0x70000 }, + { 0x4, 0x5, 0x8, 0, 0xb0e0000, 8, 0x80000 }, + { 0x4, 0x5, 0x9, 0, 0xb860000, 9, 0x0 }, + { 0x4, 0x5, 0xa, 0, 0xb870000, 10, 0x10000 }, + { 0x4, 0x5, 0xb, 0, 0xb880000, 11, 0x20000 }, + { 0x4, 0x5, 0xc, 0, 0xb890000, 12, 0x30000 }, + { 0x4, 0x5, 0xd, 0, 0xb8a0000, 13, 0x40000 }, + { 0x4, 0x5, 0xe, 0, 0xb8b0000, 14, 0x50000 }, + { 0x4, 0x5, 0xf, 0, 0xb8c0000, 15, 0x60000 }, + { 0x4, 0x5, 0x10, 0, 0xb8d0000, 16, 0x70000 }, + { 0x4, 0x5, 0x11, 0, 0xb8e0000, 17, 0x80000 }, + { 0x4, 0x6, 0x0, 0, 0xb650000, 0, 0x0 }, + { 0x4, 0x6, 0x1, 0, 0xbe50000, 1, 0x0 }, + { 0x4, 0x7, 0x0, 0, 0x20df0000, 0, 0x0 }, + { 0x4, 0x7, 0x1, 0, 0x210f0000, 1, 0x0 }, + { 0x4, 0x8, 0x0, 0, 0xb3e0000, 0, 0x0 }, + { 0x4, 0x8, 0x1, 0, 0xbbe0000, 1, 0x0 }, + { 0x4, 0x9, 0x0, 0, 0xb3d0000, 0, 0x0 }, + { 0x4, 0x9, 0x1, 0, 0xbbd0000, 1, 0x0 }, + { 0x4, 0xA, 0x0, 0, 0xb1e0000, 0, 0x0 }, + { 0x4, 0xA, 0x1, 0, 0xb9e0000, 1, 0x0 }, + { 0x4, 0xB, 0x0, 0, 0xb150000, 0, 0x0 }, + { 0x4, 0xB, 0x1, 0, 0xb160000, 1, 0x10000 }, + { 0x4, 0xB, 0x2, 0, 0xb170000, 2, 0x20000 }, + { 0x4, 0xB, 0x3, 0, 0xb180000, 3, 0x30000 }, + { 0x4, 0xB, 0x4, 0, 0xb190000, 4, 0x40000 }, + { 0x4, 0xB, 0x5, 0, 0xb1a0000, 5, 0x50000 }, + { 0x4, 0xB, 0x6, 0, 0xb1b0000, 6, 0x60000 }, + { 0x4, 0xB, 0x7, 0, 0xb1c0000, 7, 0x70000 }, + { 0x4, 0xB, 0x8, 0, 0xb1d0000, 8, 0x80000 }, + { 0x4, 0xB, 0x9, 0, 0xb950000, 9, 0x0 }, + { 0x4, 0xB, 0xa, 0, 0xb960000, 10, 0x10000 }, + { 0x4, 0xB, 0xb, 0, 0xb970000, 11, 0x20000 }, + { 0x4, 0xB, 0xc, 0, 0xb980000, 12, 0x30000 }, + { 0x4, 0xB, 0xd, 0, 0xb990000, 13, 0x40000 }, + { 0x4, 0xB, 0xe, 0, 0xb9a0000, 14, 0x50000 }, + { 0x4, 0xB, 0xf, 0, 0xb9b0000, 15, 0x60000 }, + { 0x4, 0xB, 0x10, 0, 0xb9c0000, 16, 0x70000 }, + { 0x4, 0xB, 0x11, 0, 0xb9d0000, 17, 0x80000 }, + { 0x4, 0xC, 0x0, 0, 0xb660000, 0, 0x0 }, + { 0x4, 0xC, 0x1, 0, 0xbe60000, 1, 0x0 }, + { 0x4, 0xD, 0x0, 0, 0xb1f0000, 0, 0x0 }, + { 0x4, 0xD, 0x1, 0, 0xb200000, 1, 0x10000 }, + { 0x4, 0xD, 0x2, 0, 0xb210000, 2, 0x20000 }, + { 0x4, 0xD, 0x3, 0, 0xb220000, 3, 0x30000 }, + { 0x4, 0xD, 0x4, 0, 0xb9f0000, 4, 0x0 }, + { 0x4, 0xD, 0x5, 0, 0xba00000, 5, 0x10000 }, + { 0x4, 0xD, 0x6, 0, 0xba10000, 6, 0x20000 }, + { 0x4, 0xD, 0x7, 0, 0xba20000, 7, 0x30000 }, + { 0x4, 0xE, 0x0, 0, 0xb0f0000, 0, 0x0 }, + { 0x4, 0xE, 0x1, 0, 0xb100000, 1, 0x10000 }, + { 0x4, 0xE, 0x2, 0, 0xb110000, 2, 0x20000 }, + { 0x4, 0xE, 0x3, 0, 0xb120000, 3, 0x30000 }, + { 0x4, 0xE, 0x4, 0, 0xb130000, 4, 0x40000 }, + { 0x4, 0xE, 0x5, 0, 0xb140000, 5, 0x50000 }, + { 0x4, 0xE, 0x6, 0, 0xb8f0000, 6, 0x0 }, + { 0x4, 0xE, 0x7, 0, 0xb900000, 7, 0x10000 }, + { 0x4, 0xE, 0x8, 0, 0xb910000, 8, 0x20000 }, + { 0x4, 0xE, 0x9, 0, 0xb920000, 9, 0x30000 }, + { 0x4, 0xE, 0xa, 0, 0xb930000, 10, 0x40000 }, + { 0x4, 0xE, 0xb, 0, 0xb940000, 11, 0x50000 }, + { 0x4, 0x10, 0x0, 0, 0xb240000, 0, 0x0 }, + { 0x4, 0x10, 0x1, 0, 0xba40000, 1, 0x0 }, + { 0x4, 0x11, 0x0, 0, 0xb020000, 0, 0x0 }, + { 0x4, 0x11, 0x1, 0, 0xb820000, 1, 0x0 }, + { 0x4, 0x12, 0x0, 0, 0xb030000, 0, 0x0 }, + { 0x4, 0x12, 0x1, 0, 0xb830000, 1, 0x0 }, + { 0x4, 0x17, 0x0, 0, 0xb640000, 0, 0x0 }, + { 0x4, 0x17, 0x1, 0, 0xbe40000, 1, 0x0 }, + { 0x4, 0x18, 0x0, 0, 0xb600000, 0, 0x0 }, + { 0x4, 0x18, 0x1, 0, 0xbe00000, 1, 0x0 }, + { 0x4, 0x18, 0x2, 0, 0x0, 0, 0x0 }, + { 0x4, 0x18, 0x3, 0, 0x0, 0, 0x0 } +}; + +static void cbbcentralnoc_parse_routeid(struct tegra194_cbb_aperture *info, u64 routeid) +{ + info->initflow = FIELD_GET(CBB_NOC_INITFLOW, routeid); + info->targflow = FIELD_GET(CBB_NOC_TARGFLOW, routeid); + info->targ_subrange = FIELD_GET(CBB_NOC_TARG_SUBRANGE, routeid); + info->seqid = FIELD_GET(CBB_NOC_SEQID, routeid); +} + +static void bpmpnoc_parse_routeid(struct tegra194_cbb_aperture *info, u64 routeid) +{ + info->initflow = FIELD_GET(BPMP_NOC_INITFLOW, routeid); + info->targflow = FIELD_GET(BPMP_NOC_TARGFLOW, routeid); + info->targ_subrange = FIELD_GET(BPMP_NOC_TARG_SUBRANGE, routeid); + info->seqid = FIELD_GET(BPMP_NOC_SEQID, routeid); +} + +static void aonnoc_parse_routeid(struct tegra194_cbb_aperture *info, u64 routeid) +{ + info->initflow = FIELD_GET(AON_NOC_INITFLOW, routeid); + info->targflow = FIELD_GET(AON_NOC_TARGFLOW, routeid); + info->targ_subrange = FIELD_GET(AON_NOC_TARG_SUBRANGE, routeid); + info->seqid = FIELD_GET(AON_NOC_SEQID, routeid); +} + +static void scenoc_parse_routeid(struct tegra194_cbb_aperture *info, u64 routeid) +{ + info->initflow = FIELD_GET(SCE_NOC_INITFLOW, routeid); + info->targflow = FIELD_GET(SCE_NOC_TARGFLOW, routeid); + info->targ_subrange = FIELD_GET(SCE_NOC_TARG_SUBRANGE, routeid); + info->seqid = FIELD_GET(SCE_NOC_SEQID, routeid); +} + +static void cbbcentralnoc_parse_userbits(struct tegra194_cbb_userbits *usrbits, u32 elog_5) +{ + usrbits->axcache = FIELD_GET(CBB_NOC_AXCACHE, elog_5); + usrbits->non_mod = FIELD_GET(CBB_NOC_NON_MOD, elog_5); + usrbits->axprot = FIELD_GET(CBB_NOC_AXPROT, elog_5); + usrbits->falconsec = FIELD_GET(CBB_NOC_FALCONSEC, elog_5); + usrbits->grpsec = FIELD_GET(CBB_NOC_GRPSEC, elog_5); + usrbits->vqc = FIELD_GET(CBB_NOC_VQC, elog_5); + usrbits->mstr_id = FIELD_GET(CBB_NOC_MSTR_ID, elog_5) - 1; + usrbits->axi_id = FIELD_GET(CBB_NOC_AXI_ID, elog_5); +} + +static void clusternoc_parse_userbits(struct tegra194_cbb_userbits *usrbits, u32 elog_5) +{ + usrbits->axcache = FIELD_GET(CLUSTER_NOC_AXCACHE, elog_5); + usrbits->axprot = FIELD_GET(CLUSTER_NOC_AXCACHE, elog_5); + usrbits->falconsec = FIELD_GET(CLUSTER_NOC_FALCONSEC, elog_5); + usrbits->grpsec = FIELD_GET(CLUSTER_NOC_GRPSEC, elog_5); + usrbits->vqc = FIELD_GET(CLUSTER_NOC_VQC, elog_5); + usrbits->mstr_id = FIELD_GET(CLUSTER_NOC_MSTR_ID, elog_5) - 1; +} + +static void tegra194_cbb_faulten(struct tegra_cbb *cbb) +{ + void __iomem *addr = ((struct tegra_cbb_errlog_record *)cbb->err_rec)->vaddr; + + writel(1, addr + ERRLOGGER_0_FAULTEN_0); + writel(1, addr + ERRLOGGER_1_FAULTEN_0); + writel(1, addr + ERRLOGGER_2_FAULTEN_0); +} + +static void tegra194_cbb_stallen(struct tegra_cbb *cbb) +{ + void __iomem *addr = ((struct tegra_cbb_errlog_record *)cbb->err_rec)->vaddr; + + writel(1, addr + ERRLOGGER_0_STALLEN_0); + writel(1, addr + ERRLOGGER_1_STALLEN_0); + writel(1, addr + ERRLOGGER_2_STALLEN_0); +} + +static void tegra194_cbb_errclr(struct tegra_cbb *cbb) +{ + void __iomem *addr = ((struct tegra_cbb_errlog_record *)cbb->err_rec)->vaddr; + + writel(1, addr + ERRLOGGER_0_ERRCLR_0); + writel(1, addr + ERRLOGGER_1_ERRCLR_0); + writel(1, addr + ERRLOGGER_2_ERRCLR_0); + dsb(sy); +} + +static u32 tegra194_cbb_errvld(struct tegra_cbb *cbb) +{ + void __iomem *addr = ((struct tegra_cbb_errlog_record *)cbb->err_rec)->vaddr; + u32 value = 0; + + value = readl(addr + ERRLOGGER_0_ERRVLD_0); + value |= (readl(addr + ERRLOGGER_1_ERRVLD_0) << 1); + value |= (readl(addr + ERRLOGGER_2_ERRVLD_0) << 2); + + dsb(sy); + return value; +} + +static u32 tegra194_axi2apb_errstatus(void __iomem *addr) +{ + u32 value = 0; + + value = readl(addr + DMAAPB_X_RAW_INTERRUPT_STATUS); + writel(0xFFFFFFFF, addr + DMAAPB_X_RAW_INTERRUPT_STATUS); + return value; +} + +static bool tegra194_axi2apb_err(struct seq_file *file, int bridge, u32 status) +{ + size_t max = ARRAY_SIZE(t194_axi2apb_err); + bool is_fatal = true; + int j = 0; + + for (j = 0; j < max; j++) { + if (status & (1 << j)) { + tegra_cbb_print_err(file, "\t AXI2APB_%d bridge error: %s\n", + bridge + 1, t194_axi2apb_err[j]); + if (strstr(t194_axi2apb_err[j], "Firewall")) + is_fatal = false; + } + } + return is_fatal; +} + +/* + * Fetch InitlocalAddress from NOC Aperture lookup table + * using Targflow, Targsubrange + */ +static u32 get_init_localaddress(const struct tegra194_cbb_aperture *info, + const struct tegra194_cbb_aperture *aper, int max) +{ + int t_f = 0, t_sr = 0; + u32 i_locaddr = 0; + int targflow = info->targflow; + int targ_subrange = info->targ_subrange; + + for (t_f = 0; t_f < max; t_f++) { + if (aper[t_f].targflow == targflow) { + t_sr = t_f; + do { + if (aper[t_sr].targ_subrange == targ_subrange) { + i_locaddr = aper[t_sr].init_localaddress; + return i_locaddr; + } + if (t_sr >= max) + return 0; + t_sr++; + } while (aper[t_sr].targflow == aper[t_sr - 1].targflow); + t_f = t_sr; + } + } + + return i_locaddr; +} + +static void print_errlog5(struct seq_file *file, struct tegra_cbb_errlog_record *errlog) +{ + struct tegra194_cbb_userbits userbits; + u32 errlog5 = errlog->errlog5; + + errlog->noc_parse_userbits(&userbits, errlog5); + if (!strcmp(errlog->name, "cbb-noc")) { + tegra_cbb_print_err(file, "\t Non-Modify\t\t: 0x%x\n", userbits.non_mod); + tegra_cbb_print_err(file, "\t AXI ID\t\t: 0x%x\n", userbits.axi_id); + } + + tegra_cbb_print_err(file, "\t Master ID\t\t: %s\n", + errlog->cbb_master_id[userbits.mstr_id]); + tegra_cbb_print_err(file, "\t Security Group(GRPSEC): 0x%x\n", userbits.grpsec); + tegra_cbb_print_cache(file, userbits.axcache); + tegra_cbb_print_prot(file, userbits.axprot); + tegra_cbb_print_err(file, "\t FALCONSEC\t\t: 0x%x\n", userbits.falconsec); + tegra_cbb_print_err(file, "\t Virtual Queuing Channel(VQC): 0x%x\n", userbits.vqc); +} + +/* + * Fetch Base Address/InitlocalAddress from NOC aperture lookup table + * using TargFlow & Targ_subRange extracted from RouteId. + * Perform address reconstruction as below: + * Address = Base Address + (ErrLog3+ErrLog4) + */ +static void +print_errlog3_4(struct seq_file *file, u32 errlog3, u32 errlog4, + const struct tegra194_cbb_aperture *trans_info, + const struct tegra194_cbb_aperture *noc_aperture, int max) +{ + u64 addr = 0; + + addr = errlog4; + addr = (addr << 32) | errlog3; + + /* + * if errlog4[7]="1", then it's a joker entry. + * joker entry is a rare phenomenon and address is not reliable. + * debug should be done using the routeid information alone. + */ + if (errlog4 & 0x80) + tegra_cbb_print_err(file, "\t debug using routeid alone as below" + " address is a joker entry and notreliable"); + + addr += get_init_localaddress(trans_info, noc_aperture, max); + + tegra_cbb_print_err(file, "\t Address accessed\t: 0x%llx\n", addr); +} + +/* + * Get RouteId from ErrLog1+ErrLog2 registers and fetch values of + * InitFlow, TargFlow, Targ_subRange and SeqId values from RouteId + */ +static void +print_errlog1_2(struct seq_file *file, struct tegra_cbb_errlog_record *errlog, + struct tegra194_cbb_aperture *info) +{ + u64 routeid = 0; + u32 seqid = 0; + + routeid = errlog->errlog2; + routeid = (routeid << 32) | errlog->errlog1; + tegra_cbb_print_err(file, "\t RouteId\t\t: 0x%llx\n", routeid); + + errlog->noc_parse_routeid(info, routeid); + + tegra_cbb_print_err(file, "\t InitFlow\t\t: %s\n", + errlog->noc_routeid_initflow[info->initflow]); + + tegra_cbb_print_err(file, "\t Targflow\t\t: %s\n", + errlog->noc_routeid_targflow[info->targflow]); + + tegra_cbb_print_err(file, "\t TargSubRange\t\t: %d\n", info->targ_subrange); + tegra_cbb_print_err(file, "\t SeqId\t\t\t: %d\n", seqid); +} + +/* + * Print transcation type, error code and description from ErrLog0 for all + * errors. For NOC slave errors, all relevant error info is printed using + * ErrLog0 only. But additional information is printed for errors from + * APB slaves because for them: + * - All errors are logged as SLV(slave) errors due to APB having only single + * bit pslverr to report all errors. + * - Exact cause is printed by reading DMAAPB_X_RAW_INTERRUPT_STATUS register. + * - The driver prints information showing AXI2APB bridge and exact error + * only if there is error in any AXI2APB slave. + * - There is still no way to disambiguate a DEC error from SLV error type. + */ +static bool print_errlog0(struct seq_file *file, + struct tegra_cbb_errlog_record *errlog) +{ + struct tegra194_cbb_packet_header hdr; + bool is_fatal = true; + + hdr.lock = errlog->errlog0 & 0x1; + hdr.opc = FIELD_GET(CBB_ERR_OPC, errlog->errlog0); + hdr.errcode = FIELD_GET(CBB_ERR_ERRCODE, errlog->errlog0); + hdr.len1 = FIELD_GET(CBB_ERR_LEN1, errlog->errlog0); + hdr.format = (errlog->errlog0 >> 31); + + tegra_cbb_print_err(file, "\t Transaction Type\t: %s\n", + t194_cbb_trantype[hdr.opc]); + tegra_cbb_print_err(file, "\t Error Code\t\t: %s\n", + t194_noc_errors[hdr.errcode].errcode); + tegra_cbb_print_err(file, "\t Error Source\t\t: %s\n", + t194_noc_errors[hdr.errcode].src); + tegra_cbb_print_err(file, "\t Error Description\t: %s\n", + t194_noc_errors[hdr.errcode].type); + /* + * Donot crash system for errors which are only notifications + * to indicate a transaction was not allowed to be attempted. + */ + + if (!strcmp(t194_noc_errors[hdr.errcode].errcode, "SEC") || + !strcmp(t194_noc_errors[hdr.errcode].errcode, "DEC") || + !strcmp(t194_noc_errors[hdr.errcode].errcode, "UNS") || + !strcmp(t194_noc_errors[hdr.errcode].errcode, "DISC") + ) + is_fatal = false; + else if (!strcmp(t194_noc_errors[hdr.errcode].errcode, "SLV") && + errlog->is_ax2apb_bridge_connected) { + int i = 0; + u32 status = 0; + + /* For all SLV errors, read DMAAPB_X_RAW_INTERRUPT_STATUS + * register to get error status for all AXI2APB bridges. + * Print bridge details if a bit is set in a bridge's + * status register due to error in a APB slave connected + * to that bridge. For other NOC slaves, none of the status + * register will be set. + */ + + for (i = 0; i < errlog->apb_bridge_cnt; i++) { + status = tegra194_axi2apb_errstatus(errlog->axi2abp_bases[i]); + + if (status) + is_fatal = tegra194_axi2apb_err(file, i, status); + } + } + tegra_cbb_print_err(file, "\t Packet header Lock\t: %d\n", hdr.lock); + tegra_cbb_print_err(file, "\t Packet header Len1\t: %d\n", hdr.len1); + if (hdr.format) + tegra_cbb_print_err(file, "\t NOC protocol version\t: %s\n", + "version >= 2.7"); + else + tegra_cbb_print_err(file, "\t NOC protocol version\t: %s\n", + "version < 2.7"); + return is_fatal; +} + +/* + * Print debug information about failed transaction using + * ErrLog registers of error loggger having ErrVld set + */ +static bool print_errloggerX_info(struct seq_file *file, + struct tegra_cbb_errlog_record *errlog, + int errloggerX) +{ + struct tegra194_cbb_aperture info = {0,}; + bool is_fatal = true; + + tegra_cbb_print_err(file, "\tError Logger\t\t: %d\n", errloggerX); + if (errloggerX == 0) { + errlog->errlog0 = readl(errlog->vaddr + ERRLOGGER_0_ERRLOG0_0); + errlog->errlog1 = readl(errlog->vaddr + ERRLOGGER_0_ERRLOG1_0); + errlog->errlog2 = readl(errlog->vaddr + ERRLOGGER_0_RSVD_00_0); + errlog->errlog3 = readl(errlog->vaddr + ERRLOGGER_0_ERRLOG3_0); + errlog->errlog4 = readl(errlog->vaddr + ERRLOGGER_0_ERRLOG4_0); + errlog->errlog5 = readl(errlog->vaddr + ERRLOGGER_0_ERRLOG5_0); + } else if (errloggerX == 1) { + errlog->errlog0 = readl(errlog->vaddr + ERRLOGGER_1_ERRLOG0_0); + errlog->errlog1 = readl(errlog->vaddr + ERRLOGGER_1_ERRLOG1_0); + errlog->errlog2 = readl(errlog->vaddr + ERRLOGGER_1_RSVD_00_0); + errlog->errlog3 = readl(errlog->vaddr + ERRLOGGER_1_ERRLOG3_0); + errlog->errlog4 = readl(errlog->vaddr + ERRLOGGER_1_ERRLOG4_0); + errlog->errlog5 = readl(errlog->vaddr + ERRLOGGER_1_ERRLOG5_0); + } else if (errloggerX == 2) { + errlog->errlog0 = readl(errlog->vaddr + ERRLOGGER_2_ERRLOG0_0); + errlog->errlog1 = readl(errlog->vaddr + ERRLOGGER_2_ERRLOG1_0); + errlog->errlog2 = readl(errlog->vaddr + ERRLOGGER_2_RSVD_00_0); + errlog->errlog3 = readl(errlog->vaddr + ERRLOGGER_2_ERRLOG3_0); + errlog->errlog4 = readl(errlog->vaddr + ERRLOGGER_2_ERRLOG4_0); + errlog->errlog5 = readl(errlog->vaddr + ERRLOGGER_2_ERRLOG5_0); + } + + tegra_cbb_print_err(file, "\tErrLog0\t\t\t: 0x%x\n", errlog->errlog0); + is_fatal = print_errlog0(file, errlog); + + tegra_cbb_print_err(file, "\tErrLog1\t\t\t: 0x%x\n", errlog->errlog1); + tegra_cbb_print_err(file, "\tErrLog2\t\t\t: 0x%x\n", errlog->errlog2); + print_errlog1_2(file, errlog, &info); + + tegra_cbb_print_err(file, "\tErrLog3\t\t\t: 0x%x\n", errlog->errlog3); + tegra_cbb_print_err(file, "\tErrLog4\t\t\t: 0x%x\n", errlog->errlog4); + print_errlog3_4(file, errlog->errlog3, errlog->errlog4, + &info, errlog->noc_aperture, errlog->max_aperture); + + tegra_cbb_print_err(file, "\tErrLog5\t\t\t: 0x%x\n", errlog->errlog5); + if (errlog->errlog5) + print_errlog5(file, errlog); + return is_fatal; +} + +static bool print_errlog(struct seq_file *file, struct tegra_cbb *cbb, + struct tegra_cbb_errlog_record *errlog, u32 errvld) +{ + bool is_fatal = true; + + pr_crit("**************************************\n"); + pr_crit("CPU:%d, Error:%s\n", smp_processor_id(), errlog->name); + + if (errvld & 0x1) + is_fatal = print_errloggerX_info(file, errlog, 0); + else if (errvld & 0x2) + is_fatal = print_errloggerX_info(file, errlog, 1); + else if (errvld & 0x4) + is_fatal = print_errloggerX_info(file, errlog, 2); + + tegra_cbb_errclr(cbb); + tegra_cbb_print_err(file, "\t**************************************\n"); + return is_fatal; +} + +#ifdef CONFIG_DEBUG_FS +static DEFINE_MUTEX(cbb_err_mutex); + +static int tegra194_cbb_err_show(struct tegra_cbb *cbb, struct seq_file *file, void *data) +{ + struct tegra_cbb_errlog_record *errlog; + u32 errvld = 0; + + mutex_lock(&cbb_err_mutex); + + list_for_each_entry(errlog, &cbb_noc_list, node) { + cbb = errlog->cbb; + errvld = tegra_cbb_errvld(cbb); + if (errvld) + print_errlog(file, cbb, errlog, errvld); + } + + mutex_unlock(&cbb_err_mutex); + return 0; +} +#endif + +/* + * Handler for CBB errors from different initiators + */ +static irqreturn_t tegra194_cbb_err_isr(int irq, void *data) +{ + bool is_inband_err = false, is_fatal = false; + struct tegra_cbb_errlog_record *errlog; + struct tegra_cbb *cbb = data; + unsigned int errvld = 0; + unsigned long flags; + u8 mstr_id = 0; + + spin_lock_irqsave(&cbb_noc_lock, flags); + + list_for_each_entry(errlog, &cbb_noc_list, node) { + errvld = tegra_cbb_errvld(cbb); + + if (errvld && ((irq == errlog->sec_irq) || + (irq == errlog->nonsec_irq))) { + tegra_cbb_print_err(NULL, "CPU:%d, Error:%s@0x%llx,irq=%d\n", + smp_processor_id(), errlog->name, + errlog->start, irq); + + is_fatal = print_errlog(NULL, cbb, errlog, errvld); + + mstr_id = FIELD_GET(USRBITS_MSTR_ID, errlog->errlog5) - 1; + /* + * If illegal request is from CCPLEX(0x1) + * initiator then call BUG() to crash system. + */ + if ((mstr_id == 0x1) && errlog->erd_mask_inband_err) + is_inband_err = 1; + } + } + spin_unlock_irqrestore(&cbb_noc_lock, flags); + + if (is_inband_err) { + if (is_fatal) + BUG(); + else + WARN(true, "Warning due to CBB Error\n"); + } + + return IRQ_HANDLED; +} + +/* + * Register handler for CBB_NONSECURE & CBB_SECURE interrupts + * for reporting CBB errors + */ +static int tegra194_cbb_intr_en(struct tegra_cbb *cbb) +{ + struct platform_device *pdev = cbb->pdev; + int sec_irq, nonsec_irq; + int err = 0; + + sec_irq = ((struct tegra_cbb_errlog_record *)cbb->err_rec)->sec_irq; + nonsec_irq = ((struct tegra_cbb_errlog_record *)cbb->err_rec)->nonsec_irq; + if (sec_irq) { + err = devm_request_irq(&pdev->dev, sec_irq, tegra194_cbb_err_isr, + 0, dev_name(&pdev->dev), cbb); + if (err) { + dev_err(&pdev->dev, "%s: Unable to register (%d) interrupt\n", + __func__, sec_irq); + goto isr_err_free_sec_irq; + } + } + if (nonsec_irq) { + err = devm_request_irq(&pdev->dev, nonsec_irq, tegra194_cbb_err_isr, + 0, dev_name(&pdev->dev), cbb); + if (err) { + dev_err(&pdev->dev, "%s: Unable to register (%d) interrupt\n", + __func__, nonsec_irq); + goto isr_err_free_nonsec_irq; + } + } + + return 0; + +isr_err_free_nonsec_irq: + if (nonsec_irq) + free_irq(nonsec_irq, pdev); +isr_err_free_sec_irq: + if (sec_irq) + free_irq(sec_irq, pdev); + + return err; +} + +static void tegra194_cbb_err_en(struct tegra_cbb *cbb) +{ + /* + * Set “StallEn=1” to enable queuing of error packets till + * first is served & cleared + */ + tegra_cbb_stallen(cbb); + + /* set “FaultEn=1” to enable error reporting signal “Fault” */ + tegra_cbb_faulten(cbb); +} + +static struct tegra_cbb_err_ops tegra194_cbb_errlogger_ops = { + .errvld = tegra194_cbb_errvld, + .errclr = tegra194_cbb_errclr, + .faulten = tegra194_cbb_faulten, + .stallen = tegra194_cbb_stallen, + .cbb_err_enable = tegra194_cbb_err_en, + .cbb_intr_enable = tegra194_cbb_intr_en, +#ifdef CONFIG_DEBUG_FS + .cbb_err_debugfs_show = tegra194_cbb_err_show, +#endif +}; + +static struct tegra_cbb_noc_data tegra194_cbb_central_noc_data = { + .name = "cbb-noc", + .erd_mask_inband_err = true, + .cbb_master_id = t194_master_id, + .noc_aperture = t194_cbbcentralnoc_apert_lookup, + .max_aperture = ARRAY_SIZE(t194_cbbcentralnoc_apert_lookup), + .noc_routeid_initflow = t194_cbbcentralnoc_routeid_initflow, + .noc_routeid_targflow = t194_cbbcentralnoc_routeid_targflow, + .noc_parse_routeid = cbbcentralnoc_parse_routeid, + .noc_parse_userbits = cbbcentralnoc_parse_userbits +}; + +static struct tegra_cbb_noc_data tegra194_aon_noc_data = { + .name = "aon-noc", + .erd_mask_inband_err = false, + .cbb_master_id = t194_master_id, + .noc_aperture = t194_aonnoc_aperture_lookup, + .max_aperture = ARRAY_SIZE(t194_aonnoc_aperture_lookup), + .noc_routeid_initflow = t194_aonnoc_routeid_initflow, + .noc_routeid_targflow = t194_aonnoc_routeid_targflow, + .noc_parse_routeid = aonnoc_parse_routeid, + .noc_parse_userbits = clusternoc_parse_userbits +}; + +static struct tegra_cbb_noc_data tegra194_bpmp_noc_data = { + .name = "bpmp-noc", + .erd_mask_inband_err = false, + .cbb_master_id = t194_master_id, + .noc_aperture = t194_bpmpnoc_apert_lookup, + .max_aperture = ARRAY_SIZE(t194_bpmpnoc_apert_lookup), + .noc_routeid_initflow = t194_bpmpnoc_routeid_initflow, + .noc_routeid_targflow = t194_bpmpnoc_routeid_targflow, + .noc_parse_routeid = bpmpnoc_parse_routeid, + .noc_parse_userbits = clusternoc_parse_userbits +}; + +static struct tegra_cbb_noc_data tegra194_rce_noc_data = { + .name = "rce-noc", + .erd_mask_inband_err = false, + .cbb_master_id = t194_master_id, + .noc_aperture = t194_scenoc_apert_lookup, + .max_aperture = ARRAY_SIZE(t194_scenoc_apert_lookup), + .noc_routeid_initflow = t194_scenoc_routeid_initflow, + .noc_routeid_targflow = t194_scenoc_routeid_targflow, + .noc_parse_routeid = scenoc_parse_routeid, + .noc_parse_userbits = clusternoc_parse_userbits +}; + +static struct tegra_cbb_noc_data tegra194_sce_noc_data = { + .name = "sce-noc", + .erd_mask_inband_err = false, + .cbb_master_id = t194_master_id, + .noc_aperture = t194_scenoc_apert_lookup, + .max_aperture = ARRAY_SIZE(t194_scenoc_apert_lookup), + .noc_routeid_initflow = t194_scenoc_routeid_initflow, + .noc_routeid_targflow = t194_scenoc_routeid_targflow, + .noc_parse_routeid = scenoc_parse_routeid, + .noc_parse_userbits = clusternoc_parse_userbits +}; + +static const struct of_device_id tegra194_cbb_match[] = { + {.compatible = "nvidia,tegra194-cbb-noc", + .data = &tegra194_cbb_central_noc_data}, + {.compatible = "nvidia,tegra194-aon-noc", + .data = &tegra194_aon_noc_data}, + {.compatible = "nvidia,tegra194-bpmp-noc", + .data = &tegra194_bpmp_noc_data}, + {.compatible = "nvidia,tegra194-rce-noc", + .data = &tegra194_rce_noc_data}, + {.compatible = "nvidia,tegra194-sce-noc", + .data = &tegra194_sce_noc_data}, + {}, +}; +MODULE_DEVICE_TABLE(of, tegra194_cbb_match); + +static int +tegra194_cbb_get_axi2apb_data(struct platform_device *pdev, struct device_node *np, + int *apb_bridge_cnt, void __iomem ***bases) +{ + static void __iomem **axi2apb_bases; + int i = 0; + + if (axi2apb_bases) { + *bases = axi2apb_bases; + return 0; + } + + *apb_bridge_cnt = (of_property_count_elems_of_size(np, "reg", sizeof(u32))) / 4; + + axi2apb_bases = devm_kzalloc(&pdev->dev, sizeof(void *) * (*apb_bridge_cnt), GFP_KERNEL); + if (!axi2apb_bases) + return -ENOMEM; + + for (i = 0; i < *apb_bridge_cnt; i++) { + void __iomem *base = of_iomap(np, i); + + if (!base) { + dev_err(&pdev->dev, "failed to map axi2apb range\n"); + return -ENOENT; + } + axi2apb_bases[i] = base; + } + *bases = axi2apb_bases; + + return 0; +} + +static int +tegra194_cbb_errlogger_init(const struct tegra_cbb_noc_data *pdata, + struct tegra_cbb *cbb, struct resource *res_base) +{ + struct platform_device *pdev = cbb->pdev; + struct tegra_cbb_errlog_record *errlog; + struct device_node *np = NULL; + unsigned long flags = 0; + int err = 0; + + errlog = (struct tegra_cbb_errlog_record *)cbb->err_rec; + errlog->vaddr = devm_ioremap_resource(&pdev->dev, res_base); + if (IS_ERR(errlog->vaddr)) + return -EINVAL; + + errlog->name = pdata->name; + errlog->start = res_base->start; + errlog->erd_mask_inband_err = pdata->erd_mask_inband_err; + errlog->cbb_master_id = pdata->cbb_master_id; + errlog->noc_aperture = pdata->noc_aperture; + errlog->max_aperture = pdata->max_aperture; + errlog->noc_routeid_initflow = pdata->noc_routeid_initflow; + errlog->noc_routeid_targflow = pdata->noc_routeid_targflow; + errlog->noc_parse_routeid = pdata->noc_parse_routeid; + errlog->noc_parse_userbits = pdata->noc_parse_userbits; + errlog->cbb = cbb; + + np = of_parse_phandle(pdev->dev.of_node, "nvidia,axi2apb", 0); + if (np) { + errlog->is_ax2apb_bridge_connected = 1; + dev_info(&pdev->dev, "axi2apb bridge info present\n"); + + err = tegra194_cbb_get_axi2apb_data(pdev, np, + &(errlog->apb_bridge_cnt), + &(errlog->axi2abp_bases)); + if (err) { + dev_err(&pdev->dev, "axi2apb bridge read failed\n"); + return err; + } + } + + err = tegra_cbb_err_getirq(pdev, &errlog->nonsec_irq, &errlog->sec_irq); + if (err) + return err; + + cbb->ops = &tegra194_cbb_errlogger_ops; + + spin_lock_irqsave(&cbb_noc_lock, flags); + list_add(&errlog->node, &cbb_noc_list); + spin_unlock_irqrestore(&cbb_noc_lock, flags); + + return 0; +}; + +static int tegra194_cbb_probe(struct platform_device *pdev) +{ + struct tegra_cbb_errlog_record *errlog = NULL; + const struct tegra_cbb_noc_data *pdata; + struct resource *res_base; + struct tegra_cbb *cbb; + int err = 0; + + pdata = of_device_get_match_data(&pdev->dev); + if (!pdata) { + dev_err(&pdev->dev, "No device match found\n"); + return -EINVAL; + } + + if (pdata->erd_mask_inband_err) { + /* + * Set Error Response Disable(ERD) bit to mask SError/inband + * error and only trigger interrupts for illegal access from + * CCPLEX initiator. + */ + err = tegra194_miscreg_mask_serror(); + if (err) { + dev_err(&pdev->dev, "couldn't mask inband errors\n"); + return err; + } + } + + res_base = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res_base) { + dev_err(&pdev->dev, "Could not find base address"); + return -ENOENT; + } + + cbb = devm_kzalloc(&pdev->dev, sizeof(*cbb), GFP_KERNEL); + if (!cbb) + return -ENOMEM; + + errlog = devm_kzalloc(&pdev->dev, sizeof(*errlog), GFP_KERNEL); + if (!errlog) + return -ENOMEM; + + cbb->err_rec = errlog; + cbb->pdev = pdev; + err = tegra194_cbb_errlogger_init(pdata, cbb, res_base); + if (err) { + dev_err(&pdev->dev, "cbberr init for soc failing\n"); + return err; + } + + platform_set_drvdata(pdev, cbb); + + return tegra_cbb_register_isr_enaberr(cbb); +} + +static int tegra194_cbb_remove(struct platform_device *pdev) +{ + struct tegra_cbb_errlog_record *errlog, *el_noc, *temp_el; + struct tegra_cbb *cbb; + unsigned long flags; + + cbb = platform_get_drvdata(pdev); + if (!cbb) + return -EINVAL; + + errlog = (struct tegra_cbb_errlog_record *)cbb->err_rec; + + spin_lock_irqsave(&cbb_noc_lock, flags); + list_for_each_entry_safe(el_noc, temp_el, &cbb_noc_list, node) { + if (errlog->start == el_noc->start) { + list_del(&el_noc->node); + break; + } + } + spin_unlock_irqrestore(&cbb_noc_lock, flags); + + return 0; +} + +#ifdef CONFIG_PM_SLEEP +static int tegra194_cbb_resume_noirq(struct device *dev) +{ + struct tegra_cbb *cbb = dev_get_drvdata(dev); + struct tegra_cbb_errlog_record *errlog; + + errlog = (struct tegra_cbb_errlog_record *)cbb->err_rec; + + if (!errlog) + return -EINVAL; + + tegra194_cbb_err_en(cbb); + dsb(sy); + + dev_info(dev, "%s resumed\n", errlog->name); + return 0; +} + +static const struct dev_pm_ops tegra194_cbb_pm = { + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(NULL, tegra194_cbb_resume_noirq) +}; +#endif + +static struct platform_driver tegra194_cbb_driver = { + .probe = tegra194_cbb_probe, + .remove = tegra194_cbb_remove, + .driver = { + .owner = THIS_MODULE, + .name = "tegra19x-cbb", + .of_match_table = of_match_ptr(tegra194_cbb_match), +#ifdef CONFIG_PM_SLEEP + .pm = &tegra194_cbb_pm, +#endif + }, +}; + +static int __init tegra194_cbb_init(void) +{ + return platform_driver_register(&tegra194_cbb_driver); +} + +static void __exit tegra194_cbb_exit(void) +{ + platform_driver_unregister(&tegra194_cbb_driver); +} + +pure_initcall(tegra194_cbb_init); +module_exit(tegra194_cbb_exit); + +MODULE_AUTHOR("Sumit Gupta "); +MODULE_DESCRIPTION("Control Backbone error handling driver for Tegra194"); +MODULE_LICENSE("GPL v2"); diff --git a/include/soc/tegra/tegra-cbb.h b/include/soc/tegra/tegra-cbb.h new file mode 100644 index 000000000000..a9ddc6d53aee --- /dev/null +++ b/include/soc/tegra/tegra-cbb.h @@ -0,0 +1,43 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved + */ + +#ifndef __TEGRA_CBBERR_H +#define __TEGRA_CBBERR_H + +struct tegra_noc_errors { + char *errcode; + char *src; + char *type; +}; + +struct tegra_cbb { + struct tegra_cbb_err_ops *ops; + struct platform_device *pdev; + void *err_rec; +}; + +struct tegra_cbb_err_ops { + int (*cbb_err_debugfs_show)(struct tegra_cbb *cbb, struct seq_file *s, void *v); + int (*cbb_intr_enable)(struct tegra_cbb *cbb); + void (*cbb_err_enable)(struct tegra_cbb *cbb); + void (*faulten)(struct tegra_cbb *cbb); + void (*stallen)(struct tegra_cbb *cbb); + void (*errclr)(struct tegra_cbb *cbb); + u32 (*errvld)(struct tegra_cbb *cbb); +}; + +int tegra_cbb_err_getirq(struct platform_device *pdev, int *nonsec_irq, int *sec_irq); +__printf(2, 3) void tegra_cbb_print_err(struct seq_file *file, const char *fmt, ...); + +void tegra_cbb_print_cache(struct seq_file *file, u32 cache); +void tegra_cbb_print_prot(struct seq_file *file, u32 prot); +int tegra_cbb_register_isr_enaberr(struct tegra_cbb *cbb); + +void tegra_cbb_faulten(struct tegra_cbb *cbb); +void tegra_cbb_stallen(struct tegra_cbb *cbb); +void tegra_cbb_errclr(struct tegra_cbb *cbb); +u32 tegra_cbb_errvld(struct tegra_cbb *cbb); + +#endif /* __TEGRA_CBBERR_H */ diff --git a/include/soc/tegra/tegra194-cbb.h b/include/soc/tegra/tegra194-cbb.h new file mode 100644 index 000000000000..4b0dec239954 --- /dev/null +++ b/include/soc/tegra/tegra194-cbb.h @@ -0,0 +1,158 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved + */ + +#define ERRLOGGER_0_ID_COREID_0 0x00000000 +#define ERRLOGGER_0_ID_REVISIONID_0 0x00000004 +#define ERRLOGGER_0_FAULTEN_0 0x00000008 +#define ERRLOGGER_0_ERRVLD_0 0x0000000c +#define ERRLOGGER_0_ERRCLR_0 0x00000010 +#define ERRLOGGER_0_ERRLOG0_0 0x00000014 +#define ERRLOGGER_0_ERRLOG1_0 0x00000018 +#define ERRLOGGER_0_RSVD_00_0 0x0000001c +#define ERRLOGGER_0_ERRLOG3_0 0x00000020 +#define ERRLOGGER_0_ERRLOG4_0 0x00000024 +#define ERRLOGGER_0_ERRLOG5_0 0x00000028 +#define ERRLOGGER_0_STALLEN_0 0x00000038 + +#define ERRLOGGER_1_ID_COREID_0 0x00000080 +#define ERRLOGGER_1_ID_REVISIONID_0 0x00000084 +#define ERRLOGGER_1_FAULTEN_0 0x00000088 +#define ERRLOGGER_1_ERRVLD_0 0x0000008c +#define ERRLOGGER_1_ERRCLR_0 0x00000090 +#define ERRLOGGER_1_ERRLOG0_0 0x00000094 +#define ERRLOGGER_1_ERRLOG1_0 0x00000098 +#define ERRLOGGER_1_RSVD_00_0 0x0000009c +#define ERRLOGGER_1_ERRLOG3_0 0x000000A0 +#define ERRLOGGER_1_ERRLOG4_0 0x000000A4 +#define ERRLOGGER_1_ERRLOG5_0 0x000000A8 +#define ERRLOGGER_1_STALLEN_0 0x000000b8 + +#define ERRLOGGER_2_ID_COREID_0 0x00000100 +#define ERRLOGGER_2_ID_REVISIONID_0 0x00000104 +#define ERRLOGGER_2_FAULTEN_0 0x00000108 +#define ERRLOGGER_2_ERRVLD_0 0x0000010c +#define ERRLOGGER_2_ERRCLR_0 0x00000110 +#define ERRLOGGER_2_ERRLOG0_0 0x00000114 +#define ERRLOGGER_2_ERRLOG1_0 0x00000118 +#define ERRLOGGER_2_RSVD_00_0 0x0000011c +#define ERRLOGGER_2_ERRLOG3_0 0x00000120 +#define ERRLOGGER_2_ERRLOG4_0 0x00000124 +#define ERRLOGGER_2_ERRLOG5_0 0x00000128 +#define ERRLOGGER_2_STALLEN_0 0x00000138 + + +#define CBB_NOC_INITFLOW GENMASK(23, 20) +#define CBB_NOC_TARGFLOW GENMASK(19, 16) +#define CBB_NOC_TARG_SUBRANGE GENMASK(15, 9) +#define CBB_NOC_SEQID GENMASK(8, 0) + +#define BPMP_NOC_INITFLOW GENMASK(20, 18) +#define BPMP_NOC_TARGFLOW GENMASK(17, 13) +#define BPMP_NOC_TARG_SUBRANGE GENMASK(12, 9) +#define BPMP_NOC_SEQID GENMASK(8, 0) + +#define AON_NOC_INITFLOW GENMASK(22, 21) +#define AON_NOC_TARGFLOW GENMASK(20, 15) +#define AON_NOC_TARG_SUBRANGE GENMASK(14, 9) +#define AON_NOC_SEQID GENMASK(8, 0) + +#define SCE_NOC_INITFLOW GENMASK(21, 19) +#define SCE_NOC_TARGFLOW GENMASK(18, 14) +#define SCE_NOC_TARG_SUBRANGE GENMASK(13, 9) +#define SCE_NOC_SEQID GENMASK(8, 0) + +#define CBB_NOC_AXCACHE GENMASK(3, 0) +#define CBB_NOC_NON_MOD GENMASK(4, 4) +#define CBB_NOC_AXPROT GENMASK(7, 5) +#define CBB_NOC_FALCONSEC GENMASK(9, 8) +#define CBB_NOC_GRPSEC GENMASK(16, 10) +#define CBB_NOC_VQC GENMASK(18, 17) +#define CBB_NOC_MSTR_ID GENMASK(22, 19) +#define CBB_NOC_AXI_ID GENMASK(30, 23) + +#define CLUSTER_NOC_AXCACHE GENMASK(3, 0) +#define CLUSTER_NOC_AXPROT GENMASK(6, 4) +#define CLUSTER_NOC_FALCONSEC GENMASK(8, 7) +#define CLUSTER_NOC_GRPSEC GENMASK(15, 9) +#define CLUSTER_NOC_VQC GENMASK(17, 16) +#define CLUSTER_NOC_MSTR_ID GENMASK(21, 18) + +#define USRBITS_MSTR_ID GENMASK(21, 18) + +#define CBB_ERR_OPC GENMASK(4, 1) +#define CBB_ERR_ERRCODE GENMASK(10, 8) +#define CBB_ERR_LEN1 GENMASK(27, 16) + +#define DMAAPB_X_RAW_INTERRUPT_STATUS 0x2ec + +struct tegra194_cbb_packet_header { + bool lock; // [0] + u8 opc; // [4:1] + u8 errcode;// [10:8]= RD, RDW, RDL, RDX, WR, WRW, WRC, PRE, URG + u16 len1; // [27:16] + bool format; // [31] = 1 -> FlexNoC versions 2.7 & above +}; + +struct tegra194_cbb_aperture { + u8 initflow; + u8 targflow; + u8 targ_subrange; + u8 init_mapping; + u32 init_localaddress; + u8 targ_mapping; + u32 targ_localaddress; + u16 seqid; +}; + +struct tegra194_cbb_userbits { + u8 axcache; + u8 non_mod; + u8 axprot; + u8 falconsec; + u8 grpsec; + u8 vqc; + u8 mstr_id; + u8 axi_id; +}; + +struct tegra_cbb_noc_data { + char *name; + bool erd_mask_inband_err; + const char **cbb_master_id; + int max_aperture; + const struct tegra194_cbb_aperture *noc_aperture; + char **noc_routeid_initflow; + char **noc_routeid_targflow; + void (*noc_parse_routeid)(struct tegra194_cbb_aperture *info, u64 routeid); + void (*noc_parse_userbits)(struct tegra194_cbb_userbits *usrbits, u32 elog_5); +}; + +struct tegra_cbb_errlog_record { + struct list_head node; + char *name; + phys_addr_t start; + void __iomem *vaddr; + int num_intr; + int sec_irq; + int nonsec_irq; + u32 errlog0; + u32 errlog1; + u32 errlog2; + u32 errlog3; + u32 errlog4; + u32 errlog5; + int apb_bridge_cnt; + void __iomem **axi2abp_bases; + bool is_ax2apb_bridge_connected; + bool erd_mask_inband_err; + const char **cbb_master_id; + struct tegra_cbb *cbb; + int max_aperture; + const struct tegra194_cbb_aperture *noc_aperture; + char **noc_routeid_initflow; + char **noc_routeid_targflow; + void (*noc_parse_routeid)(struct tegra194_cbb_aperture *info, u64 routeid); + void (*noc_parse_userbits)(struct tegra194_cbb_userbits *usrbits, u32 elog_5); +}; From patchwork Tue Dec 21 12:51:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 526684 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AAA9C433EF for ; Tue, 21 Dec 2021 12:52:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237878AbhLUMwC (ORCPT ); Tue, 21 Dec 2021 07:52:02 -0500 Received: from mail-bn8nam08on2066.outbound.protection.outlook.com ([40.107.100.66]:56673 "EHLO NAM04-BN8-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237852AbhLUMvz (ORCPT ); Tue, 21 Dec 2021 07:51:55 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gpm/bDdRcTd4YT/GUljacMzm1wQNkCNp8EvhgZ6U28LWF2bpFwZkMtQRay0IOTscXM/knK7GbnTOUI+qpMXQynVnV3F4H32FIUMI5mWMbCAeIz1gXuvU4egoqQGdMZNMIyXvMem7Gx0sVxrbhSZCbVW4SFltNE/g+cRQDfiKd/YtY/mWPqRv+mB4y1991VqsDUs04dfSA97m3z/DSJaxRe6bjcBwBEy2c6zFlXeieFRkERTepP9sNKXawDm2YaA48oK/fXOM8OPcWsP1E8sqN6VCbT79z+676qhI+YMV6Tidlt867AG5jti7HUwC4zThMqT3NCSnh13iByuWOhBx5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WSQXp5ThuFj1j+mZaSkxXTOkNfLy9gmSxSr6+YpQs0A=; b=FcCJ0b5J3giQXHGx+IiQFZmmdG+Mo5ZD7FMJTLD1B85QBD2cOGBMwL5NaHjjGgNuhQzNUz44S/MmBporZwGBvuZja2q0uRwl7GBIZXz5haZGDqSJStSkbWznWRyriVQUzIswHoUxc27mH1HAPS4Oj53dmvAYySrsl8f3PL3/iHXJH6+Fl1eXZwQCttC4U42HHRpojT78RF0lcUi9+4VOsAzGMK/3+V0Z01xX/MN7PekPROmgao65nzbwsst5v2d0VhFN7/a6Sid6KrlJzkearHtP04+NJSdqhrPb6PeUvlnedIrvUdpkSjxbi+LTDbLhglAXG14kPLhwAuGqYKxzPw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.235) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WSQXp5ThuFj1j+mZaSkxXTOkNfLy9gmSxSr6+YpQs0A=; b=Q4z+kfPMTAvUs4JxeN1dZvmlUm6Q/C7XcsSkqihLvxoGQDIY4MuHTxlE95Wrsg2gNnUcQ6CxmVe6NW/0bxQ0fchfZOvBJmJVJLtedu2kPI4d0+Lb5rzcR92qiyVdaFyGY3TiHRhKp1O9QNXOMoGJYW72Hkj2tiy2+5eMR8pDBibR7v1YLQFglY+vxtoSgm2hxRww+yRycPh1V9fSqw1AfL0nCAAEA1d0DoKhzmPhWunReS+MkNmNF7jbHBoIRLgegpaJsuR8NsWBVpFOilvezWiqYl8cw3lI05Ujn9KdVAGU+lj8lhR3oebpRRJX5qpgtGKQOkWhmIPmzDVsrLRCDA== Received: from MWHPR2001CA0023.namprd20.prod.outlook.com (2603:10b6:301:15::33) by MWHPR12MB1869.namprd12.prod.outlook.com (2603:10b6:300:111::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.20; Tue, 21 Dec 2021 12:51:51 +0000 Received: from CO1NAM11FT060.eop-nam11.prod.protection.outlook.com (2603:10b6:301:15:cafe::5f) by MWHPR2001CA0023.outlook.office365.com (2603:10b6:301:15::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.15 via Frontend Transport; Tue, 21 Dec 2021 12:51:51 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.235) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.235 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.235; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.235) by CO1NAM11FT060.mail.protection.outlook.com (10.13.175.132) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4801.14 via Frontend Transport; Tue, 21 Dec 2021 12:51:51 +0000 Received: from HQMAIL111.nvidia.com (172.20.187.18) by DRHQMAIL107.nvidia.com (10.27.9.16) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Dec 2021 12:51:49 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL111.nvidia.com (172.20.187.18) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Dec 2021 12:51:49 +0000 Received: from sumitg-l4t.nvidia.com (172.20.187.6) by mail.nvidia.com (172.20.187.12) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 21 Dec 2021 12:51:46 +0000 From: Sumit Gupta To: , , , , , CC: , , , , Subject: [Patch v3 7/9] arm64: tegra: Add node for CBB2.0 in Tegra234 SOC Date: Tue, 21 Dec 2021 18:21:15 +0530 Message-ID: <20211221125117.6545-8-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211221125117.6545-1-sumitg@nvidia.com> References: <20211221125117.6545-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 96577fa8-5c35-4348-84fc-08d9c480a8e8 X-MS-TrafficTypeDiagnostic: MWHPR12MB1869:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:2000; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H4IMrCCvE7rd7zS3w2bh7gSskMIE1wp97fDE3QilpT3seDyU9L7w8yuWR0hyLPuhIA5hc28eYrw2EYZ4oz8xgxBk+lXR9gibd59NHktDTSQxNIW5wSsj2S9aiAwCFxba5aT/C+EwVAF4ndrG1vdBk9W9Va+ZKkcEX+7TlkXPkOS/Hxrm9klyijcYpKR/7HYNa8q4cuLg9iKyTSyOZQD9qpvEILxUyM3E3O1LMVp+33/KpIla+KfSxLaGhg8NTf25OXAeotyE8Wfz4pJnKSI5MCO7po2aLb+Q5wkNj02k66qyhOa9kz9oYdLzaMpkrAXxor1LRUZTD+CGvCyTlKLoB/mUAqCU+EbfMkltdGChbpxRIqqocN3V0gGWQBp8i5D7s01ErFRXXs9ODIzqa/jyxkREd4OJIkFFADijrMsqiBFFnV3vy+sd6r4ghrmvdJEOg3BXWxcs8Ybvuvls1W41PL9OnJrzbRDQO9ZejZuLIYn9a51N3DFMUm6SWizI0EH/zsE7POPzJyGKAtUK7A6wjF4g2Hy9mLGeQLTYMkw+xkt9LI2xXsidtUTG6rDdDpyQydsn5WGbcauArqdRvQi0h/qi+cR5zurDqiELGV1tJ9ZA4B2TTF0owkdt9HIZkQb2hbdpE7jJI2KzbiZALmdSULeWLRZAGlbKctH8fqFHw792vYs3XJ5X002Xmmu/6iFw4q7pjScbCez/LZz726AHnCobzGC0sIoBijo0LrA1ItVwIjtQjmZBWbFFkZCoPN6TvCGVGd3kb3HJh9F88SUAHne1HqAzdVgc4LGRV1/6QSafGfuW/VGf4ALtSECow86lvtzRGvjS/NUFkN+8k6sKeg== X-Forefront-Antispam-Report: CIP:12.22.5.235; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(36840700001)(46966006)(40470700002)(356005)(36756003)(70206006)(34020700004)(1076003)(5660300002)(47076005)(40460700001)(336012)(508600001)(26005)(110136005)(70586007)(8936002)(86362001)(2906002)(4326008)(2616005)(36860700001)(6666004)(54906003)(7696005)(82310400004)(107886003)(81166007)(316002)(426003)(186003)(8676002)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2021 12:51:51.7054 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 96577fa8-5c35-4348-84fc-08d9c480a8e8 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.235]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT060.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1869 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Control Backbone(CBB) version 2.0 is used in Tegra234 SOC. Adding nodes to enable handling of errors from different CBB 2.0 based fabrics in Tegra234 SOC. Signed-off-by: Sumit Gupta --- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 42 ++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/arch/arm64/boot/dts/nvidia/tegra234.dtsi b/arch/arm64/boot/dts/nvidia/tegra234.dtsi index f0efb3a62804..400403343529 100644 --- a/arch/arm64/boot/dts/nvidia/tegra234.dtsi +++ b/arch/arm64/boot/dts/nvidia/tegra234.dtsi @@ -73,6 +73,20 @@ #mbox-cells = <2>; }; + sce-fabric@b600000 { + compatible = "nvidia,tegra234-sce-fabric"; + reg = <0xb600000 0x40000>; + interrupts = ; + status = "okay"; + }; + + rce-fabric@be00000 { + compatible = "nvidia,tegra234-rce-fabric"; + reg = <0xbe00000 0x40000>; + interrupts = ; + status = "okay"; + }; + hsp_aon: hsp@c150000 { compatible = "nvidia,tegra234-hsp", "nvidia,tegra194-hsp"; reg = <0x0c150000 0x90000>; @@ -109,6 +123,27 @@ interrupt-controller; }; + aon-fabric@c600000 { + compatible = "nvidia,tegra234-aon-fabric"; + reg = <0xc600000 0x40000>; + interrupts = ; + status = "okay"; + }; + + bpmp-fabric@d600000 { + compatible = "nvidia,tegra234-bpmp-fabric"; + reg = <0xd600000 0x40000>; + interrupts = ; + status = "okay"; + }; + + dce-fabric@de00000 { + compatible = "nvidia,tegra234-sce-fabric"; + reg = <0xde00000 0x40000>; + interrupts = ; + status = "okay"; + }; + gic: interrupt-controller@f400000 { compatible = "arm,gic-v3"; reg = <0x0f400000 0x010000>, /* GICD */ @@ -120,6 +155,13 @@ #interrupt-cells = <3>; interrupt-controller; }; + + cbb-fabric@0x13a00000 { + compatible = "nvidia,tegra234-cbb-fabric"; + reg = <0x13a00000 0x400000>; + interrupts = ; + status = "okay"; + }; }; sysram@40000000 { From patchwork Tue Dec 21 12:51:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Gupta X-Patchwork-Id: 526683 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CDA27C433F5 for ; Tue, 21 Dec 2021 12:52:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237890AbhLUMwD (ORCPT ); Tue, 21 Dec 2021 07:52:03 -0500 Received: from mail-co1nam11on2077.outbound.protection.outlook.com ([40.107.220.77]:54368 "EHLO NAM11-CO1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S237888AbhLUMv5 (ORCPT ); Tue, 21 Dec 2021 07:51:57 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CP3ayU7Zv0fK++PFamNIVrBlLnE0NYrpGkYsY6Rc2T2t/jWRIWqdqhMe++T9DQZF0x1y7ha5snPW6mvQKa+5iAlO98lBdrxbfCcdnJZED4gwrizFvrvjazovCJ81Fnc3kI7rhpPrpKQY5gQZKQzhdFlY5PSO01ivdVz3vN/Hh58aVOmAW2Eo6S24V8S6GD+nhBtRObpHd1CCKI2DVgO8TquGUfTO7AJYbf0fu6HLQMBCEqEvHpho2VLDLnXf6nSQ1JAglvT2WcOhxvGqBTuVbRWTQ1eBy4St2TRbgRQtOD5YTYWlEgSqI1VIT8yKx7ADk/3SknEeEonaAa87vVV17g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1ZXaf5NxtB2/NUxx4azpkK7xhcVZv+viyfdUXcKIMBM=; b=mLosWY6OOTkwvrwUW2+XWSuIwmF7nEXel6OTAIrBfPx1LTkB7OouplFMElwIrvmWoJ3cxqXCVlZtV3qdeW8lS/kvaWhHQvhOLI5fOYmR9HEA4nyRxqpOK8jMQ7VsmFqC5AZxMZZKwjSjf0mDi15T6gCW94jpjSoO0G4AQSHz9/biB81cg3Mn1gYLGBXbaH8LYL/x021Xmg7gbpMUbOJ0KwW5YDRs3El0xe804P0uQi1EDspN9H18j22HLYIMrn75TrFZsU174JB/gMMcSI/DAQgPAnAByRTRYueopVNBe+7VADJCjVVswfiOe2l2r6l5menWIPkatUfMF3/zt+C09w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 12.22.5.238) smtp.rcpttodomain=vger.kernel.org smtp.mailfrom=nvidia.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1ZXaf5NxtB2/NUxx4azpkK7xhcVZv+viyfdUXcKIMBM=; b=rokEKbk3ZqsV+R4opvljrnEszcdYn/2AjsP3vJQCFB0oy8cfknAoSjsuprwf+GOZy+XsL6EXoluToz0BaM5tYtLxJqP6lXyim6QC04p9lVgUX7GR1k/W/7MNMjgVzCNO/zSvrlXFkvj5VKNkuwex9hFdja3IlBPIIqVS4kDVL+2gXoH6RNKxcdTNzovT0qH54iDIDn+mM82fv/YyhX++2I22uNcofYkPTGHran/yxX4nQOxtW3rWmtFJMXHBcs5ev8jKY6JgiElQTfFy719FZy5vvIKQNnIiQnTSWy0+HHJf0fWvLrcuXiLbLDZaz09vybuEX/BWCBqR2ahoE4voqQ== Received: from MW4PR03CA0266.namprd03.prod.outlook.com (2603:10b6:303:b4::31) by BL0PR12MB5537.namprd12.prod.outlook.com (2603:10b6:208:1cc::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.14; Tue, 21 Dec 2021 12:51:54 +0000 Received: from CO1NAM11FT028.eop-nam11.prod.protection.outlook.com (2603:10b6:303:b4:cafe::17) by MW4PR03CA0266.outlook.office365.com (2603:10b6:303:b4::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4801.14 via Frontend Transport; Tue, 21 Dec 2021 12:51:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 12.22.5.238) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 12.22.5.238 as permitted sender) receiver=protection.outlook.com; client-ip=12.22.5.238; helo=mail.nvidia.com; Received: from mail.nvidia.com (12.22.5.238) by CO1NAM11FT028.mail.protection.outlook.com (10.13.175.214) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.4801.14 via Frontend Transport; Tue, 21 Dec 2021 12:51:53 +0000 Received: from HQMAIL107.nvidia.com (172.20.187.13) by DRHQMAIL105.nvidia.com (10.27.9.14) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Dec 2021 12:51:53 +0000 Received: from HQMAIL105.nvidia.com (172.20.187.12) by HQMAIL107.nvidia.com (172.20.187.13) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 21 Dec 2021 12:51:52 +0000 Received: from sumitg-l4t.nvidia.com (172.20.187.6) by mail.nvidia.com (172.20.187.12) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 21 Dec 2021 12:51:49 +0000 From: Sumit Gupta To: , , , , , CC: , , , , Subject: [Patch v3 8/9] soc: tegra: cbb: Add driver for Tegra234 CBB2.0 Date: Tue, 21 Dec 2021 18:21:16 +0530 Message-ID: <20211221125117.6545-9-sumitg@nvidia.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211221125117.6545-1-sumitg@nvidia.com> References: <20211221125117.6545-1-sumitg@nvidia.com> X-NVConfidentiality: public MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 187dd5dd-3d07-41ff-4ef5-08d9c480aa2c X-MS-TrafficTypeDiagnostic: BL0PR12MB5537:EE_ X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:162; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: rlllp9dcs4lzeyPxTHNSJsp77joU0eujEWNXMTNBoPPOwt7Ijq6XoNLMdNjYd6og7s+2frpFX0xV0cu2j5pN8GDGRsG/oeB12LwItz/KRY57v9wL7mn9dVQoC1wvA1w8lIR4Zz4jBVRuJnr8hcD/wTy1ZXv+9BJFcaWLmV8DEX/s/jNQmb/PbrR/7Z8RhlPonm5sqxSEmeMARkyhYS4Cj7QxhDCW1bBkigd38qe4UTZqV4YZqG0chGl+6M6hBemykggy25jnp3Vr4keCkemP64QgqWgmYYkclQj9CelFMqROcdZuXstgL2YoXMkyio4nND2sWg7gmJyb7PxX6LwPlL3ky/6QVceyz0jwIv4LLgkg+y7dbeDYK01oYxDfwONWneJqllCC+mxVeJ5rZPeE3jtoLn+CFmTvapq7a/gYrbyMn3KckmXOezctcZHGwo62MHni5VDakFa77Rj2MyDDUKNDYSk0jYhvKQKmxixg221um+C8OZHIpU1pqiN1HtOpYuFH+9abp3EaM2fctboNRK0vkrJ+fUo3tZolnnDhfZMHv1C5JSdskx087DBeNZXII+9Chr3B/47Okx3oQurByH+nMOhlQzD+tQSrkSyILZc/i/XLLCCo9gpLUf+HeQM2ZtUtkJefwVqezJtYuwPbGCcyMge0DpNFKpJQ4g3r5mgC3AVVWfg8Bs5TYtd+p0B/6Bh15XE+FKgDBwSAB2PiEvc0BFvIZ/wW5oQ6nEqPgVg5HXaljUbglMTYzHIO1Al/pmiyo3cdOLZGXoU8ThyVLeha5gbhzbIY5cWR8KzftUzorEYEdO/s7lZy/EyZY5ixDb1ZD0dq3izBKEzymRPNoQ== X-Forefront-Antispam-Report: CIP:12.22.5.238; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:mail.nvidia.com; PTR:InfoNoRecords; CAT:NONE; SFS:(4636009)(40470700002)(46966006)(36840700001)(5660300002)(6666004)(36860700001)(4326008)(40460700001)(26005)(107886003)(336012)(110136005)(82310400004)(83380400001)(316002)(54906003)(8936002)(86362001)(508600001)(70206006)(70586007)(30864003)(356005)(2616005)(47076005)(34020700004)(186003)(36756003)(81166007)(8676002)(7696005)(1076003)(2906002)(426003)(36900700001); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2021 12:51:53.8017 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 187dd5dd-3d07-41ff-4ef5-08d9c480aa2c X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[12.22.5.238]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1NAM11FT028.eop-nam11.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BL0PR12MB5537 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Adding driver to handle errors from CBB version 2.0 which is used in Tegra234 SOC. The driver prints debug information about failed transaction on receiving interrupt from Error Notifier. Error notifier collates the interrupts from various Error Monitor blocks and presents a single interrupt to the SOC Interrupt Controller. For timeout errors, the driver also does the lookup to find timedout clients and prints client id. The IP's who want to reset if there is a timeout will have to call BPMP from the client IP's driver. BPMP firmware will also clear the timeout bit after resetting the IP so that next transactions are send to them after reset. Signed-off-by: Sumit Gupta --- drivers/soc/tegra/Kconfig | 2 +- drivers/soc/tegra/cbb/Makefile | 1 + drivers/soc/tegra/cbb/tegra234-cbb.c | 741 +++++++++++++++++++++++++++ include/soc/tegra/tegra234-cbb.h | 342 +++++++++++++ 4 files changed, 1085 insertions(+), 1 deletion(-) create mode 100644 drivers/soc/tegra/cbb/tegra234-cbb.c create mode 100644 include/soc/tegra/tegra234-cbb.h diff --git a/drivers/soc/tegra/Kconfig b/drivers/soc/tegra/Kconfig index 0520b9744ec4..f0cf6a33cb5b 100644 --- a/drivers/soc/tegra/Kconfig +++ b/drivers/soc/tegra/Kconfig @@ -164,7 +164,7 @@ config SOC_TEGRA30_VOLTAGE_COUPLER config SOC_TEGRA_CBB tristate "Tegra driver to handle error from CBB" - depends on ARCH_TEGRA_194_SOC + depends on ARCH_TEGRA_194_SOC || ARCH_TEGRA_234_SOC default y help Support for handling error from Tegra Control Backbone(CBB). diff --git a/drivers/soc/tegra/cbb/Makefile b/drivers/soc/tegra/cbb/Makefile index 3f9ff6575628..71877d20651f 100644 --- a/drivers/soc/tegra/cbb/Makefile +++ b/drivers/soc/tegra/cbb/Makefile @@ -5,4 +5,5 @@ ifdef CONFIG_SOC_TEGRA_CBB obj-y += tegra-cbb.o obj-$(CONFIG_ARCH_TEGRA_194_SOC) += tegra194-cbb.o +obj-$(CONFIG_ARCH_TEGRA_234_SOC) += tegra234-cbb.o endif diff --git a/drivers/soc/tegra/cbb/tegra234-cbb.c b/drivers/soc/tegra/cbb/tegra234-cbb.c new file mode 100644 index 000000000000..56069eb8dc2b --- /dev/null +++ b/drivers/soc/tegra/cbb/tegra234-cbb.c @@ -0,0 +1,741 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved + * + * The driver handles Error's from Control Backbone(CBB) version 2.0. + * generated due to illegal accesses. The driver prints debug information + * about failed transaction on receiving interrupt from Error Notifier. + * Error types supported by CBB2.0 are: + * UNSUPPORTED_ERR, PWRDOWN_ERR, TIMEOUT_ERR, FIREWALL_ERR, DECODE_ERR, + * SLAVE_ERR + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static LIST_HEAD(cbb_errmon_list); +static DEFINE_SPINLOCK(cbb_errmon_lock); + +static void tegra234_cbb_errmon_faulten(struct tegra_cbb *cbb) +{ + struct tegra_cbb_errmon_record *errmon; + void __iomem *addr; + + errmon = (struct tegra_cbb_errmon_record *)cbb->err_rec; + + addr = errmon->vaddr + errmon->err_notifier_base; + writel(0x1FF, addr + FABRIC_EN_CFG_INTERRUPT_ENABLE_0_0); + dsb(sy); +} + +static void tegra234_cbb_errmon_errclr(struct tegra_cbb *cbb) +{ + void __iomem *addr; + + addr = ((struct tegra_cbb_errmon_record *)cbb->err_rec)->addr_errmon; + + writel(0x3F, addr + FABRIC_MN_MASTER_ERR_STATUS_0); + dsb(sy); +} + +static u32 tegra234_cbb_errmon_errvld(struct tegra_cbb *cbb) +{ + struct tegra_cbb_errmon_record *errmon; + void __iomem *addr; + u32 errvld; + + errmon = (struct tegra_cbb_errmon_record *)cbb->err_rec; + + addr = errmon->vaddr + errmon->err_notifier_base; + errvld = readl(addr + FABRIC_EN_CFG_STATUS_0_0); + dsb(sy); + + return errvld; +} + +static void tegra234_cbb_mn_mask_serror(struct tegra_cbb *cbb) +{ + struct tegra_cbb_errmon_record *errmon; + void __iomem *erd_mask; + + errmon = (struct tegra_cbb_errmon_record *)cbb->err_rec; + + erd_mask = errmon->vaddr + errmon->off_mask_erd; + writel(0x1, erd_mask); + dsb(sy); +} + +u32 tegra234_cbb_readl(unsigned long offset) +{ + struct tegra_cbb_errmon_record *errmon; + bool flag = 0; + u32 val = 0; + + if (offset > 0x3FFFFF) { + pr_err("%s: wrong offset value\n", __func__); + return 0; + } + + list_for_each_entry(errmon, &cbb_errmon_list, node) { + if (strstr(errmon->name, "cbb")) { + val = readl(errmon->vaddr + offset); + flag = true; + break; + } + } + if (!flag) + pr_err("%s: cbb fabric not initialized\n", __func__); + + return val; +} +EXPORT_SYMBOL(tegra234_cbb_readl); + +void tegra234_cbb_writel(unsigned long offset, u32 val) +{ + struct tegra_cbb_errmon_record *errmon; + bool flag = 0; + + if (offset > 0x3FFFFF) { + pr_err("%s: wrong offset value\n", __func__); + return; + } + + list_for_each_entry(errmon, &cbb_errmon_list, node) { + if (strstr(errmon->name, "cbb")) { + writel(val, errmon->vaddr + offset); + flag = true; + break; + } + } + if (!flag) + pr_err("%s: cbb fabric not initialized\n", __func__); +} +EXPORT_SYMBOL(tegra234_cbb_writel); + +static u32 tegra234_cbb_get_tmo_slv(void __iomem *addr) +{ + u32 timeout; + + timeout = readl(addr); + return timeout; +} + +static void tegra234_cbb_tmo_slv(struct seq_file *file, char *slv_name, + void __iomem *addr, u32 tmo_status) +{ + tegra_cbb_print_err(file, "\t %s : 0x%x\n", slv_name, tmo_status); +} + +static void tegra234_cbb_lookup_apbslv(struct seq_file *file, char *slave_name, u64 addr) +{ + unsigned int blkno_tmo_status, tmo_status; + unsigned int reset_client, client_id; + char slv_name[40]; + int block_num = 0; + + tmo_status = tegra234_cbb_get_tmo_slv((void __iomem *)addr); + if (tmo_status) + tegra_cbb_print_err(file, "\t %s_BLOCK_TMO_STATUS : 0x%x\n", + slave_name, tmo_status); + + while (tmo_status) { + if (!(tmo_status & BIT(0))) + goto next_iter; + + addr = addr + APB_BLOCK_NUM_TMO_OFFSET + (block_num * 4); + blkno_tmo_status = tegra234_cbb_get_tmo_slv((void __iomem *)addr); + reset_client = blkno_tmo_status; + + if (blkno_tmo_status) { + client_id = 1; + while (blkno_tmo_status) { + if (blkno_tmo_status & 0x1) { + if (reset_client != 0xffffffff) + reset_client &= client_id; + + sprintf(slv_name, "%s_BLOCK%d_TMO", slave_name, block_num); + + tegra234_cbb_tmo_slv(file, slv_name, (void __iomem *)addr, + reset_client); + } + blkno_tmo_status >>= 1; + client_id <<= 1; + } + } +next_iter: + tmo_status >>= 1; + block_num++; + } +} + +static void tegra234_lookup_slave_timeout(struct seq_file *file, + struct tegra_cbb_errmon_record *errmon, + u8 slave_id, u8 fab_id) +{ + struct tegra_sn_addr_map *sn_lookup = errmon->sn_addr_map; + void __iomem *base_addr = errmon->vaddr; + unsigned int tmo_status; + char slv_name[40]; + int i = slave_id; + u64 addr = 0; + + /* + * 1) Get slave node name and address mapping using slave_id. + * 2) Check if the timed out slave node is APB or AXI. + * 3) If AXI, then print timeout register and reset axi slave + * using _SN_<>_SLV_TIMEOUT_STATUS_0_0 register. + * 4) If APB, then perform an additional lookup to find the client + * which timed out. + * a) Get block number from the index of set bit in + * _SN_AXI2APB_<>_BLOCK_TMO_STATUS_0 register. + * b) Get address of register repective to block number i.e. + * _SN_AXI2APB_<>_BLOCK_TMO_0. + * c) Read the register in above step to get client_id which + * timed out as per the set bits. + * d) Reset the timedout client and print details. + * e) Goto step-a till all bits are set. + */ + + addr = (u64)base_addr + sn_lookup[i].off_slave; + + if (strstr(sn_lookup[i].slave_name, "AXI2APB")) { + addr = addr + APB_BLOCK_TMO_STATUS_0; + tegra234_cbb_lookup_apbslv(file, sn_lookup[i].slave_name, addr); + } else { + addr = addr + AXI_SLV_TIMEOUT_STATUS_0_0; + + tmo_status = tegra234_cbb_get_tmo_slv((void __iomem *)addr); + if (tmo_status) { + sprintf(slv_name, "%s_SLV_TIMEOUT_STATUS", sn_lookup[i].slave_name); + tegra234_cbb_tmo_slv(file, slv_name, (void __iomem *)addr, tmo_status); + } + } +} + +static void print_errmon_err(struct seq_file *file, struct tegra_cbb_errmon_record *errmon, + unsigned int em_err_status, unsigned int em_overflow_status) +{ + int err_type = 0; + + if (em_err_status & (em_err_status - 1)) + tegra_cbb_print_err(file, "\t Multiple type of errors reported\n"); + + while (em_err_status) { + if (em_err_status & 0x1) + tegra_cbb_print_err(file, "\t Error Code\t\t: %s\n", + t234_errmon_errors[err_type].errcode); + em_err_status >>= 1; + err_type++; + } + + err_type = 0; + while (em_overflow_status) { + if (em_overflow_status & 0x1) + tegra_cbb_print_err(file, "\t Overflow\t\t: Multiple %s\n", + t234_errmon_errors[err_type].errcode); + em_overflow_status >>= 1; + err_type++; + } +} + +static void print_errlog_err(struct seq_file *file, struct tegra_cbb_errmon_record *errmon) +{ + u8 cache_type = 0, prot_type = 0, burst_length = 0; + u8 mstr_id = 0, grpsec = 0, vqc = 0, falconsec = 0; + u8 beat_size = 0, access_type = 0, access_id = 0; + u8 slave_id = 0, fab_id = 0, burst_type = 0; + char fabric_name[20]; + + mstr_id = FIELD_GET(FAB_EM_EL_MSTRID, errmon->mn_user_bits); + vqc = FIELD_GET(FAB_EM_EL_VQC, errmon->mn_user_bits); + grpsec = FIELD_GET(FAB_EM_EL_GRPSEC, errmon->mn_user_bits); + falconsec = FIELD_GET(FAB_EM_EL_FALCONSEC, errmon->mn_user_bits); + + fab_id = FIELD_GET(FAB_EM_EL_FABID, errmon->mn_attr2); + slave_id = FIELD_GET(FAB_EM_EL_SLAVEID, errmon->mn_attr2); + + access_id = FIELD_GET(FAB_EM_EL_ACCESSID, errmon->mn_attr1); + + cache_type = FIELD_GET(FAB_EM_EL_AXCACHE, errmon->mn_attr0); + prot_type = FIELD_GET(FAB_EM_EL_AXPROT, errmon->mn_attr0); + burst_length = FIELD_GET(FAB_EM_EL_BURSTLENGTH, errmon->mn_attr0); + burst_type = FIELD_GET(FAB_EM_EL_BURSTTYPE, errmon->mn_attr0); + beat_size = FIELD_GET(FAB_EM_EL_BEATSIZE, errmon->mn_attr0); + access_type = FIELD_GET(FAB_EM_EL_ACCESSTYPE, errmon->mn_attr0); + + tegra_cbb_print_err(file, "\n"); + tegra_cbb_print_err(file, "\t Error Code\t\t: %s\n", + t234_errmon_errors[errmon->err_type].errcode); + + tegra_cbb_print_err(file, "\t MASTER_ID\t\t: %s\n", errmon->tegra_cbb_master_id[mstr_id]); + tegra_cbb_print_err(file, "\t Address\t\t: 0x%llx\n", (u64)errmon->addr_access); + + tegra_cbb_print_cache(file, cache_type); + tegra_cbb_print_prot(file, prot_type); + + tegra_cbb_print_err(file, "\t Access_Type\t\t: %s", (access_type) ? "Write\n" : "Read\n"); + tegra_cbb_print_err(file, "\t Access_ID\t\t: 0x%x", access_id); + + if (fab_id == PSC_FAB_ID) + strcpy(fabric_name, "psc-fabric"); + else if (fab_id == FSI_FAB_ID) + strcpy(fabric_name, "fsi-fabric"); + else + strcpy(fabric_name, errmon->name); + + tegra_cbb_print_err(file, "\t Fabric\t\t: %s\n", fabric_name); + tegra_cbb_print_err(file, "\t Slave_Id\t\t: 0x%x\n", slave_id); + tegra_cbb_print_err(file, "\t Burst_length\t\t: 0x%x\n", burst_length); + tegra_cbb_print_err(file, "\t Burst_type\t\t: 0x%x\n", burst_type); + tegra_cbb_print_err(file, "\t Beat_size\t\t: 0x%x\n", beat_size); + tegra_cbb_print_err(file, "\t VQC\t\t\t: 0x%x\n", vqc); + tegra_cbb_print_err(file, "\t GRPSEC\t\t: 0x%x\n", grpsec); + tegra_cbb_print_err(file, "\t FALCONSEC\t\t: 0x%x\n", falconsec); + + if ((fab_id == PSC_FAB_ID) || (fab_id == FSI_FAB_ID)) + return; + + if (!strcmp(errmon->noc_errors[errmon->err_type].errcode, "TIMEOUT_ERR")) { + tegra234_lookup_slave_timeout(file, errmon, slave_id, fab_id); + return; + } + tegra_cbb_print_err(file, "\t Slave\t\t\t: %s\n", + errmon->sn_addr_map[slave_id].slave_name); +} + +static int print_errmonX_info(struct seq_file *file, struct tegra_cbb_errmon_record *errmon) +{ + unsigned int em_overflow_status = 0; + unsigned int em_err_status = 0; + unsigned int el_err_status = 0; + u64 addr = 0; + + errmon->err_type = 0; + + em_err_status = readl(errmon->addr_errmon + + FABRIC_MN_MASTER_ERR_STATUS_0); + if (!em_err_status) { + pr_err("Error Notifier received a spurious notification\n"); + BUG(); + } + + if (em_err_status == 0xFFFFFFFF) { + pr_err("CBB registers returning all 1's which is invalid\n"); + return -EINVAL; + } + + /*get overflow flag*/ + em_overflow_status = readl(errmon->addr_errmon + + FABRIC_MN_MASTER_ERR_OVERFLOW_STATUS_0); + + print_errmon_err(file, errmon, em_err_status, em_overflow_status); + + el_err_status = readl(errmon->addr_errmon + FABRIC_MN_MASTER_LOG_ERR_STATUS_0); + if (!el_err_status) { + pr_info("Error Monitor doesn't have Error Logger\n"); + return -EINVAL; + } + + while (el_err_status) { + if (el_err_status & BIT(0)) { + addr = readl(errmon->addr_errmon + + FABRIC_MN_MASTER_LOG_ADDR_HIGH_0); + addr = (addr << 32) | + readl(errmon->addr_errmon + + FABRIC_MN_MASTER_LOG_ADDR_LOW_0); + errmon->addr_access = (void __iomem *)addr; + + errmon->mn_attr0 = readl(errmon->addr_errmon + + FABRIC_MN_MASTER_LOG_ATTRIBUTES0_0); + + errmon->mn_attr1 = readl(errmon->addr_errmon + + FABRIC_MN_MASTER_LOG_ATTRIBUTES1_0); + + errmon->mn_attr2 = readl(errmon->addr_errmon + + FABRIC_MN_MASTER_LOG_ATTRIBUTES2_0); + + errmon->mn_user_bits = readl(errmon->addr_errmon + + FABRIC_MN_MASTER_LOG_USER_BITS0_0); + + print_errlog_err(file, errmon); + } + errmon->err_type++; + el_err_status >>= 1; + } + return 0; +} + +static int print_err_notifier(struct seq_file *file, struct tegra_cbb *cbb, + struct tegra_cbb_errmon_record *errmon, int err_notifier_sts) +{ + u64 em_addr_offset = 0; + u64 em_phys_addr = 0; + int errmon_no = 1; + int ret = 0; + + pr_crit("**************************************\n"); + pr_crit("CPU:%d, Error:%s, Errmon:%d\n", smp_processor_id(), + errmon->name, err_notifier_sts); + + while (err_notifier_sts) { + if (err_notifier_sts & BIT(0)) { + writel(errmon_no, errmon->vaddr + errmon->err_notifier_base + + FABRIC_EN_CFG_ADDR_INDEX_0_0); + + em_phys_addr = readl(errmon->vaddr + errmon->err_notifier_base + + FABRIC_EN_CFG_ADDR_HI_0); + em_phys_addr = (em_phys_addr << 32) | + readl(errmon->vaddr + errmon->err_notifier_base + + FABRIC_EN_CFG_ADDR_LOW_0); + + em_addr_offset = em_phys_addr - errmon->start; + errmon->addr_errmon = (void __iomem *)(errmon->vaddr + em_addr_offset); + + errmon->errmon_no = errmon_no; + + ret = print_errmonX_info(file, errmon); + tegra234_cbb_errmon_errclr(cbb); + if (ret) + return ret; + } + err_notifier_sts >>= 1; + errmon_no <<= 1; + } + + tegra_cbb_print_err(file, "\t**************************************\n"); + return 0; +} + +#ifdef CONFIG_DEBUG_FS +static DEFINE_MUTEX(cbb_err_mutex); + +static int tegra234_cbb_err_show(struct tegra_cbb *cbb, struct seq_file *file, void *data) +{ + struct tegra_cbb_errmon_record *errmon; + unsigned int errvld = 0; + int ret = 0; + + mutex_lock(&cbb_err_mutex); + + list_for_each_entry(errmon, &cbb_errmon_list, node) { + cbb = errmon->cbb; + errvld = tegra_cbb_errvld(cbb); + if (errvld) { + ret = print_err_notifier(file, cbb, errmon, errvld); + if (ret) + goto en_show_exit; + } + } + +en_show_exit: + mutex_unlock(&cbb_err_mutex); + return ret; +} +#endif + +/* + * Handler for CBB errors + */ +static irqreturn_t tegra234_cbb_err_isr(int irq, void *data) +{ + struct tegra_cbb_errmon_record *errmon; + struct tegra_cbb *cbb = data; + bool is_inband_err = 0; + unsigned long flags; + u32 errvld = 0; + u8 mstr_id = 0; + int ret = 0; + + spin_lock_irqsave(&cbb_errmon_lock, flags); + + list_for_each_entry(errmon, &cbb_errmon_list, node) { + errvld = tegra_cbb_errvld(cbb); + + if (errvld && (irq == errmon->sec_irq)) { + tegra_cbb_print_err(NULL, "CPU:%d, Error:%s@0x%llx, irq=%d\n", + smp_processor_id(), errmon->name, + errmon->start, irq); + + ret = print_err_notifier(NULL, cbb, errmon, errvld); + if (ret) + goto en_isr_exit; + + mstr_id = FIELD_GET(USRBITS_MSTR_ID, errmon->mn_user_bits); + + /* If illegal request is from CCPLEX(id:0x1) + * master then call BUG() to crash system. + */ + if ((mstr_id == 0x1) && errmon->erd_mask_inband_err) + is_inband_err = 1; + } + } +en_isr_exit: + spin_unlock_irqrestore(&cbb_errmon_lock, flags); + + WARN_ON(is_inband_err); + + return IRQ_HANDLED; +} + +/* + * Register handler for CBB_SECURE interrupt for reporting errors + */ +static int tegra234_cbb_intr_en(struct tegra_cbb *cbb) +{ + struct platform_device *pdev = cbb->pdev; + int sec_irq; + int err = 0; + + sec_irq = ((struct tegra_cbb_errmon_record *)cbb->err_rec)->sec_irq; + + if (sec_irq) { + err = devm_request_irq(&pdev->dev, sec_irq, tegra234_cbb_err_isr, + 0, dev_name(&pdev->dev), cbb); + if (err) { + dev_err(&pdev->dev, "%s: Unable to register (%d) interrupt\n", + __func__, sec_irq); + goto isr_err_free_sec_irq; + } + } + return 0; + +isr_err_free_sec_irq: + free_irq(sec_irq, pdev); + + return err; +} + +static void tegra234_cbb_err_en(struct tegra_cbb *cbb) +{ + tegra_cbb_faulten(cbb); +} + +static struct tegra_cbb_err_ops tegra234_cbb_errmon_ops = { + .errvld = tegra234_cbb_errmon_errvld, + .errclr = tegra234_cbb_errmon_errclr, + .faulten = tegra234_cbb_errmon_faulten, + .cbb_err_enable = tegra234_cbb_err_en, + .cbb_intr_enable = tegra234_cbb_intr_en, +#ifdef CONFIG_DEBUG_FS + .cbb_err_debugfs_show = tegra234_cbb_err_show +#endif +}; + +static struct tegra_cbb_fabric_data tegra234_aon_fab_data = { + .name = "aon-fabric", + .tegra_cbb_master_id = t234_master_id, + .sn_addr_map = t234_aon_sn_lookup, + .noc_errors = t234_errmon_errors, + .err_notifier_base = 0x17000 +}; + +static struct tegra_cbb_fabric_data tegra234_bpmp_fab_data = { + .name = "bpmp-fabric", + .tegra_cbb_master_id = t234_master_id, + .sn_addr_map = t234_bpmp_sn_lookup, + .noc_errors = t234_errmon_errors, + .err_notifier_base = 0x19000 +}; + +static struct tegra_cbb_fabric_data tegra234_cbb_fab_data = { + .name = "cbb-fabric", + .tegra_cbb_master_id = t234_master_id, + .sn_addr_map = t234_cbb_sn_lookup, + .noc_errors = t234_errmon_errors, + .err_notifier_base = 0x60000, + .off_mask_erd = 0x3a004 +}; + +static struct tegra_cbb_fabric_data tegra234_dce_fab_data = { + .name = "dce-fabric", + .tegra_cbb_master_id = t234_master_id, + .sn_addr_map = t234_dce_sn_lookup, + .noc_errors = t234_errmon_errors, + .err_notifier_base = 0x19000 +}; + +static struct tegra_cbb_fabric_data tegra234_rce_fab_data = { + .name = "rce-fabric", + .tegra_cbb_master_id = t234_master_id, + .sn_addr_map = t234_rce_sn_lookup, + .noc_errors = t234_errmon_errors, + .err_notifier_base = 0x19000 +}; + +static struct tegra_cbb_fabric_data tegra234_sce_fab_data = { + .name = "sce-fabric", + .tegra_cbb_master_id = t234_master_id, + .sn_addr_map = t234_sce_sn_lookup, + .noc_errors = t234_errmon_errors, + .err_notifier_base = 0x19000 +}; + +static const struct of_device_id tegra234_cbb_dt_ids[] = { + {.compatible = "nvidia,tegra234-cbb-fabric", + .data = &tegra234_cbb_fab_data}, + {.compatible = "nvidia,tegra234-aon-fabric", + .data = &tegra234_aon_fab_data}, + {.compatible = "nvidia,tegra234-bpmp-fabric", + .data = &tegra234_bpmp_fab_data}, + {.compatible = "nvidia,tegra234-dce-fabric", + .data = &tegra234_dce_fab_data}, + {.compatible = "nvidia,tegra234-rce-fabric", + .data = &tegra234_rce_fab_data}, + {.compatible = "nvidia,tegra234-sce-fabric", + .data = &tegra234_sce_fab_data}, + {}, +}; +MODULE_DEVICE_TABLE(of, tegra234_cbb_dt_ids); + +static int +tegra234_cbb_errmon_init(const struct tegra_cbb_fabric_data *pdata, + struct tegra_cbb *cbb, struct resource *res_base) +{ + struct platform_device *pdev = cbb->pdev; + struct tegra_cbb_errmon_record *errmon; + unsigned long flags = 0; + int err = 0; + + errmon = (struct tegra_cbb_errmon_record *)cbb->err_rec; + errmon->vaddr = devm_ioremap_resource(&pdev->dev, res_base); + if (IS_ERR(errmon->vaddr)) + return -EINVAL; + + errmon->name = pdata->name; + errmon->start = res_base->start; + errmon->tegra_cbb_master_id = pdata->tegra_cbb_master_id; + errmon->err_notifier_base = pdata->err_notifier_base; + errmon->off_mask_erd = pdata->off_mask_erd; + errmon->sn_addr_map = pdata->sn_addr_map; + errmon->noc_errors = pdata->noc_errors; + errmon->cbb = cbb; + + if (errmon->off_mask_erd) + errmon->erd_mask_inband_err = 1; + + err = tegra_cbb_err_getirq(pdev, NULL, &errmon->sec_irq); + if (err) + return err; + + cbb->ops = &tegra234_cbb_errmon_ops; + + spin_lock_irqsave(&cbb_errmon_lock, flags); + list_add(&errmon->node, &cbb_errmon_list); + spin_unlock_irqrestore(&cbb_errmon_lock, flags); + + return 0; +}; + +static int tegra234_cbb_probe(struct platform_device *pdev) +{ + struct tegra_cbb_errmon_record *errmon = NULL; + const struct tegra_cbb_fabric_data *pdata = NULL; + struct resource *res_base = NULL; + struct tegra_cbb *cbb; + int err = 0; + + pdata = of_device_get_match_data(&pdev->dev); + if (!pdata) { + dev_err(&pdev->dev, "No device match found\n"); + return -EINVAL; + } + + res_base = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res_base) { + dev_err(&pdev->dev, "Could not find base address"); + return -ENOENT; + } + + cbb = devm_kzalloc(&pdev->dev, sizeof(*cbb), GFP_KERNEL); + if (!cbb) + return -ENOMEM; + + errmon = devm_kzalloc(&pdev->dev, sizeof(*errmon), GFP_KERNEL); + if (!errmon) + return -ENOMEM; + + cbb->err_rec = errmon; + cbb->pdev = pdev; + err = tegra234_cbb_errmon_init(pdata, cbb, res_base); + if (err) { + dev_err(&pdev->dev, "cbberr init for soc failing\n"); + return err; + } + + /* set ERD bit to mask SError and generate interrupt to report error */ + if (errmon->erd_mask_inband_err) + tegra234_cbb_mn_mask_serror(cbb); + + return tegra_cbb_register_isr_enaberr(cbb); +} + +static int tegra234_cbb_remove(struct platform_device *pdev) +{ + return 0; +} + +#ifdef CONFIG_PM_SLEEP +static int tegra234_cbb_resume_noirq(struct device *dev) +{ + struct tegra_cbb *cbb = dev_get_drvdata(dev); + struct tegra_cbb_errmon_record *errmon; + + errmon = (struct tegra_cbb_errmon_record *)cbb->err_rec; + + if (!errmon) + return -EINVAL; + + tegra234_cbb_err_en(cbb); + + dev_info(dev, "%s resumed\n", errmon->name); + return 0; +} + +static const struct dev_pm_ops tegra234_cbb_pm = { + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(NULL, tegra234_cbb_resume_noirq) +}; +#endif + +static struct platform_driver tegra234_cbb_driver = { + .probe = tegra234_cbb_probe, + .remove = tegra234_cbb_remove, + .driver = { + .owner = THIS_MODULE, + .name = "tegra234-cbb", + .of_match_table = of_match_ptr(tegra234_cbb_dt_ids), +#ifdef CONFIG_PM_SLEEP + .pm = &tegra234_cbb_pm, +#endif + }, +}; + +static int __init tegra234_cbb_init(void) +{ + return platform_driver_register(&tegra234_cbb_driver); +} + +static void __exit tegra234_cbb_exit(void) +{ + platform_driver_unregister(&tegra234_cbb_driver); +} + +pure_initcall(tegra234_cbb_init); +module_exit(tegra234_cbb_exit); + +MODULE_LICENSE("GPL v2"); +MODULE_DESCRIPTION("Control Backbone 2.0 error handling driver for Tegra234"); diff --git a/include/soc/tegra/tegra234-cbb.h b/include/soc/tegra/tegra234-cbb.h new file mode 100644 index 000000000000..8c3ff758c845 --- /dev/null +++ b/include/soc/tegra/tegra234-cbb.h @@ -0,0 +1,342 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved + */ + +#define FABRIC_EN_CFG_INTERRUPT_ENABLE_0_0 0x0 +#define FABRIC_EN_CFG_STATUS_0_0 0x40 +#define FABRIC_EN_CFG_ADDR_INDEX_0_0 0x60 +#define FABRIC_EN_CFG_ADDR_LOW_0 0x80 +#define FABRIC_EN_CFG_ADDR_HI_0 0x84 + +#define FABRIC_MN_MASTER_ERR_EN_0 0x200 +#define FABRIC_MN_MASTER_ERR_FORCE_0 0x204 +#define FABRIC_MN_MASTER_ERR_STATUS_0 0x208 +#define FABRIC_MN_MASTER_ERR_OVERFLOW_STATUS_0 0x20c + +#define FABRIC_MN_MASTER_LOG_ERR_STATUS_0 0x300 +#define FABRIC_MN_MASTER_LOG_ADDR_LOW_0 0x304 +#define FABRIC_MN_MASTER_LOG_ADDR_HIGH_0 0x308 +#define FABRIC_MN_MASTER_LOG_ATTRIBUTES0_0 0x30c +#define FABRIC_MN_MASTER_LOG_ATTRIBUTES1_0 0x310 +#define FABRIC_MN_MASTER_LOG_ATTRIBUTES2_0 0x314 +#define FABRIC_MN_MASTER_LOG_USER_BITS0_0 0x318 + +#define AXI_SLV_TIMEOUT_STATUS_0_0 0x8 +#define APB_BLOCK_TMO_STATUS_0 0xC00 +#define APB_BLOCK_NUM_TMO_OFFSET 0x20 + +#define FAB_EM_EL_MSTRID GENMASK(29, 24) +#define FAB_EM_EL_VQC GENMASK(17, 16) +#define FAB_EM_EL_GRPSEC GENMASK(14, 8) +#define FAB_EM_EL_FALCONSEC GENMASK(1, 0) + +#define FAB_EM_EL_FABID GENMASK(20, 16) +#define FAB_EM_EL_SLAVEID GENMASK(7, 0) + +#define FAB_EM_EL_ACCESSID GENMASK(7, 0) + +#define FAB_EM_EL_AXCACHE GENMASK(27, 24) +#define FAB_EM_EL_AXPROT GENMASK(22, 20) +#define FAB_EM_EL_BURSTLENGTH GENMASK(19, 12) +#define FAB_EM_EL_BURSTTYPE GENMASK(9, 8) +#define FAB_EM_EL_BEATSIZE GENMASK(6, 4) +#define FAB_EM_EL_ACCESSTYPE GENMASK(0, 0) + +#define USRBITS_MSTR_ID GENMASK(29, 24) + +enum tegra_cbb_fabric_ids { + CBB_FAB_ID, + SCE_FAB_ID, + RCE_FAB_ID, + DCE_FAB_ID, + AON_FAB_ID, + PSC_FAB_ID, + BPMP_FAB_ID, + FSI_FAB_ID, + MAX_FAB_ID, +}; + +struct tegra_sn_addr_map { + char *slave_name; + u32 off_slave; +}; + +struct tegra_cbb_fabric_data { + char *name; + phys_addr_t off_mask_erd; + bool erd_mask_inband_err; + char **tegra_cbb_master_id; + phys_addr_t err_notifier_base; + struct tegra_noc_errors *noc_errors; + struct tegra_sn_addr_map *sn_addr_map; +}; + +struct tegra_cbb_errmon_record { + struct list_head node; + char *name; + int errmon_no; + int err_type; + phys_addr_t start; + phys_addr_t err_notifier_base; + int num_intr; + int sec_irq; + void __iomem *vaddr; + void __iomem *addr_errmon; + void __iomem *addr_access; + u32 mn_attr0; + u32 mn_attr1; + u32 mn_attr2; + u32 mn_user_bits; + phys_addr_t off_mask_erd; + bool erd_mask_inband_err; + struct tegra_cbb *cbb; + char **tegra_cbb_master_id; + struct tegra_noc_errors *noc_errors; + struct tegra_sn_addr_map *sn_addr_map; +}; + +u32 tegra234_cbb_readl(unsigned long offset); +void tegra234_cbb_writel(unsigned long offset, u32 val); + +static char *t234_master_id[] = { + "TZ", /* 0x0 */ + "CCPLEX", /* 0x1 */ + "CCPMU", /* 0x2 */ + "BPMP_FW", /* 0x3 */ + "AON", /* 0x4 */ + "SCE", /* 0x5 */ + "GPCDMA_P", /* 0x6 */ + "TSECA_NONSECURE", /* 0x7 */ + "TSECA_LIGHTSECURE", /* 0x8 */ + "TSECA_HEAVYSECURE", /* 0x9 */ + "CORESIGHT", /* 0xA */ + "APE", /* 0xB */ + "PEATRANS", /* 0xC */ + "JTAGM_DFT", /* 0xD */ + "RCE", /* 0xE */ + "DCE", /* 0xF */ + "PSC_FW_USER", /* 0x10 */ + "PSC_FW_SUPERVISOR", /* 0x11 */ + "PSC_FW_MACHINE", /* 0x12 */ + "PSC_BOOT", /* 0x13 */ + "BPMP_BOOT", /* 0x14 */ + "NVDEC_NONSECURE", /* 0x15 */ + "NVDEC_LIGHTSECURE", /* 0x16 */ + "NVDEC_HEAVYSECURE", /* 0x17 */ + "CBB_INTERNAL", /* 0x18 */ + "RSVD" /* 0x3F */ +}; + +static struct tegra_noc_errors t234_errmon_errors[] = { + {.errcode = "SLAVE_ERR", + .type = "Slave being accessed responded with an error" + }, + {.errcode = "DECODE_ERR", + .type = "Attempt to access an address hole" + }, + {.errcode = "FIREWALL_ERR", + .type = "Attempt to access a region which is firewall protected" + }, + {.errcode = "TIMEOUT_ERR", + .type = "No response returned by slave" + }, + {.errcode = "PWRDOWN_ERR", + .type = "Attempt to access a portion of fabric that is powered down" + }, + {.errcode = "UNSUPPORTED_ERR", + .type = "Attempt to access a slave through an unsupported access" + } +}; + +#define AON_SN_AXI2APB_1 0x00000 +#define AON_SN_AST1_T 0x14000 +#define AON_SN_CBB_T 0x15000 +#define AON_SN_CPU_T 0x16000 + +#define BPMP_SN_AXI2APB_1 0x00000 +#define BPMP_SN_AST0_T 0x15000 +#define BPMP_SN_AST1_T 0x16000 +#define BPMP_SN_CBB_T 0x17000 +#define BPMP_SN_CPU_T 0x18000 + +#define DCE_SN_AXI2APB_1 0x00000 +#define DCE_SN_AST0_T 0x15000 +#define DCE_SN_AST1_T 0x16000 +#define DCE_SN_CPU_T 0x18000 + +#define RCE_SN_AXI2APB_1 0x00000 +#define RCE_SN_AST0_T 0x15000 +#define RCE_SN_AST1_T 0x16000 +#define RCE_SN_CPU_T 0x18000 + +#define SCE_SN_AXI2APB_1 0x00000 +#define SCE_SN_AST0_T 0x15000 +#define SCE_SN_AST1_T 0x16000 +#define SCE_SN_CBB_T 0x17000 +#define SCE_SN_CPU_T 0x18000 + +#define CBB_SN_AON_SLAVE 0x40000 +#define CBB_SN_BPMP_SLAVE 0x41000 +#define CBB_SN_CBB_CENTRAL 0x42000 +#define CBB_SN_HOST1X 0x43000 +#define CBB_SN_STM 0x44000 +#define CBB_SN_FSI_SLAVE 0x45000 +#define CBB_SN_PSC_SLAVE 0x46000 +#define CBB_SN_PCIE_C1 0x47000 +#define CBB_SN_PCIE_C2 0x48000 +#define CBB_SN_PCIE_C3 0x49000 +#define CBB_SN_PCIE_C0 0x4A000 +#define CBB_SN_PCIE_C4 0x4B000 +#define CBB_SN_GPU 0x4C000 +#define CBB_SN_SMMU0 0x4D000 +#define CBB_SN_SMMU1 0x4E000 +#define CBB_SN_SMMU2 0x4F000 +#define CBB_SN_SMMU3 0x50000 +#define CBB_SN_SMMU4 0x51000 +#define CBB_SN_PCIE_C10 0x52000 +#define CBB_SN_PCIE_C7 0x53000 +#define CBB_SN_PCIE_C8 0x54000 +#define CBB_SN_PCIE_C9 0x55000 +#define CBB_SN_PCIE_C5 0x56000 +#define CBB_SN_PCIE_C6 0x57000 +#define CBB_SN_DCE_SLAVE 0x58000 +#define CBB_SN_RCE_SLAVE 0x59000 +#define CBB_SN_SCE_SLAVE 0x5A000 +#define CBB_SN_AXI2APB_1 0x70000 +#define CBB_SN_AXI2APB_10 0x71000 +#define CBB_SN_AXI2APB_11 0x72000 +#define CBB_SN_AXI2APB_12 0x73000 +#define CBB_SN_AXI2APB_13 0x74000 +#define CBB_SN_AXI2APB_14 0x75000 +#define CBB_SN_AXI2APB_15 0x76000 +#define CBB_SN_AXI2APB_16 0x77000 +#define CBB_SN_AXI2APB_17 0x78000 +#define CBB_SN_AXI2APB_18 0x79000 +#define CBB_SN_AXI2APB_19 0x7A000 +#define CBB_SN_AXI2APB_2 0x7B000 +#define CBB_SN_AXI2APB_20 0x7C000 +#define CBB_SN_AXI2APB_21 0x7D000 +#define CBB_SN_AXI2APB_22 0x7E000 +#define CBB_SN_AXI2APB_23 0x7F000 +#define CBB_SN_AXI2APB_25 0x80000 +#define CBB_SN_AXI2APB_26 0x81000 +#define CBB_SN_AXI2APB_27 0x82000 +#define CBB_SN_AXI2APB_28 0x83000 +#define CBB_SN_AXI2APB_29 0x84000 +#define CBB_SN_AXI2APB_30 0x85000 +#define CBB_SN_AXI2APB_31 0x86000 +#define CBB_SN_AXI2APB_32 0x87000 +#define CBB_SN_AXI2APB_33 0x88000 +#define CBB_SN_AXI2APB_34 0x89000 +#define CBB_SN_AXI2APB_35 0x92000 +#define CBB_SN_AXI2APB_4 0x8B000 +#define CBB_SN_AXI2APB_5 0x8C000 +#define CBB_SN_AXI2APB_6 0x8D000 +#define CBB_SN_AXI2APB_7 0x8E000 +#define CBB_SN_AXI2APB_8 0x8F000 +#define CBB_SN_AXI2APB_9 0x90000 +#define CBB_SN_AXI2APB_3 0x91000 + +#define SLAVE_LOOKUP(sn) #sn, sn + +static struct tegra_sn_addr_map t234_aon_sn_lookup[] = { + { SLAVE_LOOKUP(AON_SN_AXI2APB_1) }, + { SLAVE_LOOKUP(AON_SN_AST1_T) }, + { SLAVE_LOOKUP(AON_SN_CBB_T) }, + { SLAVE_LOOKUP(AON_SN_CPU_T) } +}; + +static struct tegra_sn_addr_map t234_bpmp_sn_lookup[] = { + { SLAVE_LOOKUP(BPMP_SN_AXI2APB_1) }, + { SLAVE_LOOKUP(BPMP_SN_AST0_T) }, + { SLAVE_LOOKUP(BPMP_SN_AST1_T) }, + { SLAVE_LOOKUP(BPMP_SN_CBB_T) }, + { SLAVE_LOOKUP(BPMP_SN_CPU_T) }, +}; + +static struct tegra_sn_addr_map t234_sce_sn_lookup[] = { + { SLAVE_LOOKUP(SCE_SN_AXI2APB_1) }, + { SLAVE_LOOKUP(SCE_SN_AST0_T) }, + { SLAVE_LOOKUP(SCE_SN_AST1_T) }, + { SLAVE_LOOKUP(SCE_SN_CBB_T) }, + { SLAVE_LOOKUP(SCE_SN_CPU_T) } +}; + +static struct tegra_sn_addr_map t234_dce_sn_lookup[] = { + { SLAVE_LOOKUP(DCE_SN_AXI2APB_1) }, + { SLAVE_LOOKUP(DCE_SN_AST0_T) }, + { SLAVE_LOOKUP(DCE_SN_AST1_T) }, + { SLAVE_LOOKUP(DCE_SN_CPU_T) } +}; + +static struct tegra_sn_addr_map t234_rce_sn_lookup[] = { + { SLAVE_LOOKUP(RCE_SN_AXI2APB_1) }, + { SLAVE_LOOKUP(RCE_SN_AST0_T) }, + { SLAVE_LOOKUP(RCE_SN_AST1_T) }, + { SLAVE_LOOKUP(RCE_SN_CPU_T) } +}; + +static struct tegra_sn_addr_map t234_cbb_sn_lookup[] = { + { SLAVE_LOOKUP(CBB_SN_AON_SLAVE) }, + { SLAVE_LOOKUP(CBB_SN_BPMP_SLAVE) }, + { SLAVE_LOOKUP(CBB_SN_CBB_CENTRAL) }, + { SLAVE_LOOKUP(CBB_SN_HOST1X) }, + { SLAVE_LOOKUP(CBB_SN_STM) }, + { SLAVE_LOOKUP(CBB_SN_FSI_SLAVE) }, + { SLAVE_LOOKUP(CBB_SN_PSC_SLAVE) }, + { SLAVE_LOOKUP(CBB_SN_PCIE_C1) }, + { SLAVE_LOOKUP(CBB_SN_PCIE_C2) }, + { SLAVE_LOOKUP(CBB_SN_PCIE_C3) }, + { SLAVE_LOOKUP(CBB_SN_PCIE_C0) }, + { SLAVE_LOOKUP(CBB_SN_PCIE_C4) }, + { SLAVE_LOOKUP(CBB_SN_GPU) }, + { SLAVE_LOOKUP(CBB_SN_SMMU0) }, + { SLAVE_LOOKUP(CBB_SN_SMMU1) }, + { SLAVE_LOOKUP(CBB_SN_SMMU2) }, + { SLAVE_LOOKUP(CBB_SN_SMMU3) }, + { SLAVE_LOOKUP(CBB_SN_SMMU4) }, + { SLAVE_LOOKUP(CBB_SN_PCIE_C10) }, + { SLAVE_LOOKUP(CBB_SN_PCIE_C7) }, + { SLAVE_LOOKUP(CBB_SN_PCIE_C8) }, + { SLAVE_LOOKUP(CBB_SN_PCIE_C9) }, + { SLAVE_LOOKUP(CBB_SN_PCIE_C5) }, + { SLAVE_LOOKUP(CBB_SN_PCIE_C6) }, + { SLAVE_LOOKUP(CBB_SN_DCE_SLAVE) }, + { SLAVE_LOOKUP(CBB_SN_RCE_SLAVE) }, + { SLAVE_LOOKUP(CBB_SN_SCE_SLAVE) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_1) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_10) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_11) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_12) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_13) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_14) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_15) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_16) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_17) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_18) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_19) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_2) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_20) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_21) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_22) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_23) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_25) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_26) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_27) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_28) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_29) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_30) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_31) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_32) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_33) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_34) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_35) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_4) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_5) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_6) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_7) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_8) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_9) }, + { SLAVE_LOOKUP(CBB_SN_AXI2APB_3) } +};