From patchwork Tue Sep 24 21:54:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13811256 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011005.outbound.protection.outlook.com [52.101.65.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A3255149E1A for ; Tue, 24 Sep 2024 21:54:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.5 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727214887; cv=fail; b=ePJ0kTJRTzn3Z9bSpva+HvKzC4w7kZlfex5poO+rR/ur/cxOYDzRn0Diukqz6Ws0CM1znGrA8WzjeqI4EBvalqXAGvUnX05CQM1DlvlVu/k1Z9CA45BPaZvDeGvXcwCdLB3SmVFoR7S7m7dR64D0mMjYogxZmpraf+Weg/waXvM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727214887; c=relaxed/simple; bh=z4KaswFJYOePVkot3vtaaDaA7AqrHslIbrV1jsqJ4FY=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=FNT7NYyQFdOiwgFOKr5b3gwdOesoGl62syTaACZE583gM7cWVphoUQ6dqxMKL5O9gMVZJe3BoKhNoZfQ5H3HN3RfoWds7BrpWjn7XS3we+ORwHh3sX7Bycwm9GzkdyM2Jkp3exwBLzpMKXtEJVJbbOmG0XWhT6qZ3OyMuF3Ut2A= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=KbzyCQnl; arc=fail smtp.client-ip=52.101.65.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="KbzyCQnl" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Mj8Yv/z4E3zqjOAuoGRoMqjUDo/qFdEc6bLpx/iACevm5Y+PdCRQdVBdNvsyNor2E80HnXXJwCQ4FXEfMGncLiVF2LOK21oSaewAtKEj5BRLwXMk2VjO7GxX7xpRoOCgkr316fvjJlnG4ZpaXMEDetdZhKI4y2nLgBaChLglEx1/yFEH7a8XK/8yWX4euyWp4mbfjWHeSVpreAOowKjJmTmO9Y/qaVkrrUZt6ZKIJpYi34igbmfp2/78DU06G6/XAWrzYRDbpnTVSRt/s/NdJWfe7AGM8yXsxU2ZsFT6zFSukuCVd415lu5ql2uC4xYte9W3rC1xIlc16qMiU/NcXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=xN+yv2c3XxYPdVprLkTMIJC2lil7IeASvtS18gALS4Y=; b=qtQRcafNdsa9Zm+2my51dUzVw0yUkly9WnBqjCkzxc7o5dQfWruu/wG5r8R0IY6yk03Wsp8FZfXT+BKs5n0H6dx5ZpOHZQrmPRpffBM+4EUaBFlO/xkmhSxn6C9OyHuDR93aRQyP8cIKb2D70ayDNMRscJKGfQy+PXotaYU2QWzpaCRuD4oxTXEvc0CDpZrnBnDAergql3Ij4NWKJXenkyGlT10f7zsvbY75YsiMyv+4yEevBYqchhjZC7eMNzd53DW5uGldIJ8ub91HZkv/clrk9nI7qL51ahWnT1LT3FIh8b/l7wRW89G8tpPy4XhoWk6UftxvisO7OxxR0iP1Rw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xN+yv2c3XxYPdVprLkTMIJC2lil7IeASvtS18gALS4Y=; b=KbzyCQnl5Hel+ULqZ0oiNzOjbv9nLvmMwHUNs6t629xoS75POgdzHOUTqd4geb/wQLdB/X6CFldR0nHhaxAwlO/lxvdOGeWTKk1fWqqFWTJa1Wtn9Jr46/mXCbr1uHXdrX5J5ETpfOpfGG8I2/J3XH8ZToDNwgQUZUd7bXXT6oMFfHShPyFGOVO2id0btoZsmeWonomjaBX7yO8BbqzgWOj50FSLUMRBAjjO4xP2c4vt4ahGUdHtwB5jU5T3Mx0+P8fmud0wJ5mufXm4WkueSClZxsWNjq6MCwjdqFqyj3SETCJVi+oWxNjqnp1Fll++xNnB48r5tgjnC9f/nNHhAg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by AM8PR04MB7953.eurprd04.prod.outlook.com (2603:10a6:20b:246::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.27; Tue, 24 Sep 2024 21:54:44 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.7982.022; Tue, 24 Sep 2024 21:54:44 +0000 From: Frank Li Date: Tue, 24 Sep 2024 17:54:19 -0400 Subject: [PATCH 1/3] of: address: Add helper function to get untranslated 'ranges' information Message-Id: <20240924-pci_fixup_addr-v1-1-57d14a91ec4f@nxp.com> References: <20240924-pci_fixup_addr-v1-0-57d14a91ec4f@nxp.com> In-Reply-To: <20240924-pci_fixup_addr-v1-0-57d14a91ec4f@nxp.com> To: Rob Herring , Saravana Kannan , Jingoo Han , Manivannan Sadhasivam , Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Richard Zhu , Lucas Stach , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, imx@lists.linux.dev, Frank Li X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1727214875; l=7228; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=z4KaswFJYOePVkot3vtaaDaA7AqrHslIbrV1jsqJ4FY=; b=vdiTM/i9IXmSRCY8OIRTUgBORXi6IhsA05iSjV+r0f+Wjozi/1DoExUY+j0YsF1uqcc+hkwLw 6C4E/T7BV8qCN04UWEcJ6uE0zamT8VHdNbcjkGH8qQDqRW/+HNUG3p4 X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY5PR20CA0023.namprd20.prod.outlook.com (2603:10b6:a03:1f4::36) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM8PR04MB7953:EE_ X-MS-Office365-Filtering-Correlation-Id: 520c3e4d-4506-48af-5e15-08dcdce37fec X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|7416014|376014|52116014|366016|1800799024|38350700014|921020; X-Microsoft-Antispam-Message-Info: =?utf-8?q?LWkDbHoaCY7szP8o5V1lzoZ6ptXILR/?= =?utf-8?q?0x6kPbc+D2HMwxBKoNKEtQV2mwOKAXaqvSuJc9XUwP8nwFEsQDT2irPPw9DZV/SF1?= =?utf-8?q?2H/tXwivFg8uDd1hMLbi6/PFCFHWUZ0SZ2C+oG3/eL6cucfUAXuJdtSEBN9dv0yWf?= =?utf-8?q?VgW8qb+eihHKrUcN2+ITp4MptOV/+HmHb/goHEyx6tuSG3I7ollyNFQdTtdeWQoIO?= =?utf-8?q?Fww3eYvfL2SrR7MEbB1lLgEa3FnJCQlg/+HcV8UQ2mJMrlDjpe/dvMpv230LkyfG4?= =?utf-8?q?sZT/gUr/+8pgUDNl+tWICQMvq6VKeTI7GQ7bypHHQk1iU2XIB+nARn0+yomCVmJJw?= =?utf-8?q?HFRpOOqGwU0RpTJuMfBVqT5th/GnQODkiH1IAYSpzAG5gCWTLdzwDnnuJCzE6dwJ+?= =?utf-8?q?T1N3B2dPpVBs+CmfVIagBY482D5d69EH0CRDIWoN3L6I3RC5W+/feDUUOZ4y3/RhP?= =?utf-8?q?zFSHZyBjDTFcZAcdsoTckoapjnFG8aJTeyvh+wmSUHZ88Dovpv+QlBHwJkNk9uLxP?= =?utf-8?q?d1A9rpXqbGuKIPlYccj09qbH1MLayvOjXovk4xM+eT7iGNv7JruRck6/IP5m5wGRB?= =?utf-8?q?1yxHyiMrQcxgPiR12E1250M3eOLLlfNmasgUEEVtTdQHRA2KnF3RtUQNrMW49teSl?= =?utf-8?q?xaPckirSf1Sb6pbHAw4r62JdW7FYD/7XWqyaCCbFJHj5Wr8VO3dX1PXKeqYwu2kWM?= =?utf-8?q?MYs2NteOhtPo2IDbokw42J7sRKC9TwgGukQolI5SsLW1p1RbOqfKAzcgqOvWW17Sr?= =?utf-8?q?zSLH0V61H+7rkHSdLZMT5ARF9YC7XWBHpQzT11+qZGQiHkNCcAc9NrGr9+bFiEPE8?= =?utf-8?q?/8JZ5Cj3C166UJi8QPsXZDfKP1QtrBlRtHyJRUsvA2UaudFVYPhtgXjimLLs7ruRX?= =?utf-8?q?nAFqOOjQLmESGpWIpa0HkLRwIF3hi8vGsU4NyN2upzZFpjpJk5lJW4GiATCLykqsw?= =?utf-8?q?sGYxnIk20L699y9DrkoarVpzX9C2JknaoCYglAINKuRrFlRvR+kams+5kUNOsQB8Y?= =?utf-8?q?B/DPwCT+yPw8xlqOgLAb+Z9irs7vrkP1FeoZAqqfqExusR4HwrzsLg3QF8GOvEROn?= =?utf-8?q?lL5w5NQttwpIzi3IxEGWcY1kysE5+GxQav0zUnyoHk8uV8jhhwx1zblO9v1NuNK+S?= =?utf-8?q?nVwbQEO1oLqJ1z9OltYOGWq3bZuzT5mcWbDJ1qsSgMkmLetvBY3RHK1d5oDOnMYze?= =?utf-8?q?i6drkzwBJ0QTy8GK0A9IHfuxcXaGGf2wY10VdFSqY8kzklWWSc4H7yGzGrhC/HgY7?= =?utf-8?q?ccJ3zmqqUou+kRzsFT+Flbwc64kDre164C4BO5cmHDj9BGE53GGFELz+JRdIsHDUs?= =?utf-8?q?H1dgipfFW1wjMcmBCHXIsIr37v/nya6nEe5+1UJLoXdN5WExpYcp+jA=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(7416014)(376014)(52116014)(366016)(1800799024)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?jX+ioKuI2aOR/tN57yg1xhxwb8fr?= =?utf-8?q?suVqQgUnY2UzW5tzCZXZ8zdlnrRou3guKCC8hO/+ZRall9TuZgWyIZ75cIlsLRRCo?= =?utf-8?q?2avuBaEqa/Z0GVvTyF5oM48rmvbJy0JSMMNEWUEhU+TR35VSDIMZivOOQVzFkE/ia?= =?utf-8?q?WugcXti0EeqXC0+2Pedz0qUhHZEp/L8ExSQ6F2jVWSVlQgTz4/tP/zkfYl2wb0Oxf?= =?utf-8?q?oK5cGiGMd+5dh8yN1MkobOlhzKKy86iSWfArW55uqGOwV3+bzZk5doycXXKb8wsYM?= =?utf-8?q?xIigDIZ/9umTYZoweLT4tQxlHBCDSipKgtjblDabvNSMcKjtfhWXd3fmzFzDsCdw6?= =?utf-8?q?xrliy2EIT5FZFmRzmaqLxx/Iue+GIZj/Z814Kkn06qdljdtQLRDAJF8F6ygKCdI7N?= =?utf-8?q?+O6C2BX+AG46TUM6UifMlotogFvlkrWi/Iy1RWXDpAX4L0gREIwJZ+uMUW+kEgkvZ?= =?utf-8?q?QLEJlBr8eSCxUWyZePwxT93i7FvEuFTbYuKgXwSVZguq9uDNVLIyDRDv+kXqOwBQG?= =?utf-8?q?Y7oQjvDuLlAbpc10DVFzGWAKlz3XiBRpHg+2yC+ykxbHsdlrX0w0rXPeJVcdv8D4I?= =?utf-8?q?CjgTrTpSNWuZVWD2DHQJZA/S2ld5B/acOuKfYa9nsywyVAGiSjooKpCBtrI6lgsDA?= =?utf-8?q?ROXafT5KsmPV7EMsCYJ9jmXJnF7aKn1m1Tu607e727alXIqFlLBxbS8nbE15YkiPg?= =?utf-8?q?ZJtYLIUlTqh677P/b47f+diIu1kyFAwO+Q323KaQGudcbg9U516oBqdFoKwn0aa/x?= =?utf-8?q?wTcqoI1xQN0wYPnAuJe8Y9xu0jvlYoXjKc3jFG/aKSanjODLZWP9RPM0cAC5aTcva?= =?utf-8?q?Vzgw3u41hDFhPcpc2NXVpD8LZEZtbAUMgSFYLFmI7LmNyYYngtIZ3e8rK9QzSgpON?= =?utf-8?q?XmOAyuKJeozKBpH79yOM+LnxVpXxPzXyl+bTFtk1grD0K3jV35OJse1Z1Ma5+lQJu?= =?utf-8?q?Y+2yZ0zI+K+vK84Dx/yyHyXCrNgyTrswRzkHZ1w46vMonX9p7uPi8zbuF+8Btdm0O?= =?utf-8?q?eMc3mP/7SZn22CE0W5ODAr42/4pE9TcruLCUHaI1HyjIBPInX7lPgQh8UtZUXIcNi?= =?utf-8?q?JVKi9lniS2quUBtrIVj7yiR7Ws13plAp53UFRxt7ixKH5WAYl8zYhzNiOgtVuEMJT?= =?utf-8?q?csJGmBscjEYIaSgdytwgHyI55Jym3b8vOW0s6dH/hooLUU45OOYLZSV2ETZ9RI5/Q?= =?utf-8?q?IwfXZ1chqH6cviLm8wm4+Ytqg4fc61aWT6bgUz5OWzbpt429Fs7Xvpjp0y0daRJos?= =?utf-8?q?7E7ecabjg03R9ULF4exj/Sl7CePloCQKdX8m3eSJnNWeW7ESvxog04j+Wl2kog8cm?= =?utf-8?q?T8F+s6FEQYmVlW/sPBVH29fA3rOb1bPPQZrGf0wO/AU99TdckMSFoaJIM0AM4jTLF?= =?utf-8?q?HZEQ9c9/H2BWUKBswlcQiOLKK+3+MeLJDJtgplNbRaEmi/xQNVSGhzNiu9Jlya0+0?= =?utf-8?q?1UnfbVGkf+UKbhLz8ouJ+iAUvJ+XbLma8VfRqEB4JnXwe724LRFjvvcI=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 520c3e4d-4506-48af-5e15-08dcdce37fec X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Sep 2024 21:54:44.2479 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xlH/YPmN1kfSyRt+S4CqWKmm0g+BCZJihXm89zcF51eYFl4LBlP1FP11v8GfzYgsKdkI7IYT5kMYkntPnlUC8Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7953 Introduce `for_each_of_range_untranslate()` to retrieve untranslated CPU address information, similar to `of_property_read_reg()`. This is required for hardware like i.MX8QXP to configure the PCIe controller ATU and eliminate the need for workaround address fixups in drivers. Currently, many drivers use hardcoded CPU addresses for fixups, but this information is already described in the Device Tree. With correct hardware descriptions, such fixups can be removed. ┌─────────┐ ┌────────────┐ ┌─────┐ │ │ IA: 0x8ff0_0000 │ │ │ CPU ├───►│ BUS ├─────────────────┐ │ PCI │ └─────┘ │ │ IA: 0x8ff8_0000 │ │ │ CPU Addr │ Fabric ├─────────────┐ │ │ Controller │ 0x7000_0000 │ │ │ │ │ │ │ │ │ │ │ │ PCI Addr │ │ │ └──► CfgSpace ─┼────────────► │ ├─────────┐ │ │ │ 0 │ │ │ │ │ │ └─────────┘ │ └──────► IOSpace ─┼────────────► │ │ │ 0 │ │ │ └──────────► MemSpace ─┼────────────► IA: 0x8000_0000 │ │ 0x8000_0000 └────────────┘ bus@5f000000 { compatible = "simple-bus"; #address-cells = <1>; #size-cells = <1>; ranges = <0x5f000000 0x0 0x5f000000 0x21000000>, <0x80000000 0x0 0x70000000 0x10000000>; pcieb: pcie@5f010000 { compatible = "fsl,imx8q-pcie"; reg = <0x5f010000 0x10000>, <0x8ff00000 0x80000>; reg-names = "dbi", "config"; #address-cells = <3>; #size-cells = <2>; device_type = "pci"; bus-range = <0x00 0xff>; ranges = <0x81000000 0 0x00000000 0x8ff80000 0 0x00010000>, <0x82000000 0 0x80000000 0x80000000 0 0x0ff00000>; ... }; }; Currently all function related 'range' return CPU address. THe new help function for_each_of_range_untranslate() can get above diagram IA address informaiton. Signed-off-by: Frank Li --- drivers/of/address.c | 33 +++++++++++++++++++++++---------- include/linux/of_address.h | 9 ++++++++- 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/drivers/of/address.c b/drivers/of/address.c index 286f0c161e332..09c73936e573f 100644 --- a/drivers/of/address.c +++ b/drivers/of/address.c @@ -787,8 +787,9 @@ int of_pci_dma_range_parser_init(struct of_pci_range_parser *parser, EXPORT_SYMBOL_GPL(of_pci_dma_range_parser_init); #define of_dma_range_parser_init of_pci_dma_range_parser_init -struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, - struct of_pci_range *range) +struct of_pci_range *of_pci_range_parser_one_common(struct of_pci_range_parser *parser, + struct of_pci_range *range, + bool translate) { int na = parser->na; int ns = parser->ns; @@ -806,11 +807,13 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, range->bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na); if (parser->dma) - range->cpu_addr = of_translate_dma_address(parser->node, - parser->range + na); + range->cpu_addr = translate ? of_translate_dma_address(parser->node, + parser->range + na) : + of_read_number(parser->range + na, parser->pna); else - range->cpu_addr = of_translate_address(parser->node, - parser->range + na); + range->cpu_addr = translate ? of_translate_address(parser->node, + parser->range + na) : + of_read_number(parser->range + na, parser->pna); range->size = of_read_number(parser->range + parser->pna + na, ns); parser->range += np; @@ -823,11 +826,13 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, flags = parser->bus->get_flags(parser->range); bus_addr = of_read_number(parser->range + busflag_na, na - busflag_na); if (parser->dma) - cpu_addr = of_translate_dma_address(parser->node, - parser->range + na); + cpu_addr = translate ? of_translate_dma_address(parser->node, + parser->range + na) : + of_read_number(parser->range + np, np); else - cpu_addr = of_translate_address(parser->node, - parser->range + na); + cpu_addr = translate ? of_translate_address(parser->node, + parser->range + na) : + of_read_number(parser->range + np, np); size = of_read_number(parser->range + parser->pna + na, ns); if (flags != range->flags) @@ -842,6 +847,14 @@ struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, return range; } +EXPORT_SYMBOL_GPL(of_pci_range_parser_one_common); + +struct of_pci_range *of_pci_range_parser_one(struct of_pci_range_parser *parser, + struct of_pci_range *range) +{ + return of_pci_range_parser_one_common(parser, range, true); +} + EXPORT_SYMBOL_GPL(of_pci_range_parser_one); static u64 of_translate_ioport(struct device_node *dev, const __be32 *in_addr, diff --git a/include/linux/of_address.h b/include/linux/of_address.h index 26a19daf0d092..692aae853217a 100644 --- a/include/linux/of_address.h +++ b/include/linux/of_address.h @@ -32,8 +32,11 @@ struct of_pci_range { #define of_range of_pci_range #define for_each_of_pci_range(parser, range) \ - for (; of_pci_range_parser_one(parser, range);) + for (; of_pci_range_parser_one_common(parser, range, true);) +#define for_each_of_pci_range_untranslate(parser, range) \ + for (; of_pci_range_parser_one_common(parser, range, false);) #define for_each_of_range for_each_of_pci_range +#define for_each_of_range_untranslate for_each_of_pci_range_untranslate /* * of_range_count - Get the number of "ranges" or "dma-ranges" entries @@ -78,6 +81,10 @@ extern int of_pci_range_parser_init(struct of_pci_range_parser *parser, struct device_node *node); extern int of_pci_dma_range_parser_init(struct of_pci_range_parser *parser, struct device_node *node); +extern struct of_pci_range *of_pci_range_parser_one_common( + struct of_pci_range_parser *parser, + struct of_pci_range *range, + bool translate); extern struct of_pci_range *of_pci_range_parser_one( struct of_pci_range_parser *parser, struct of_pci_range *range);