From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0072.outbound.protection.outlook.com [104.47.34.72]) by dpdk.org (Postfix) with ESMTP id 02EC0532C for ; Fri, 16 Jun 2017 07:32:38 +0200 (CEST) Received: from MWHPR03CA0044.namprd03.prod.outlook.com (10.174.173.161) by BY2PR0301MB0597.namprd03.prod.outlook.com (10.160.124.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1157.12; Fri, 16 Jun 2017 05:32:36 +0000 Received: from BL2FFO11FD027.protection.gbl (2a01:111:f400:7c09::115) by MWHPR03CA0044.outlook.office365.com (2603:10b6:301:3b::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1178.14 via Frontend Transport; Fri, 16 Jun 2017 05:32:36 +0000 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; Received-SPF: Fail (protection.outlook.com: domain of nxp.com does not designate 192.88.168.50 as permitted sender) receiver=protection.outlook.com; client-ip=192.88.168.50; helo=tx30smr01.am.freescale.net; Received: from tx30smr01.am.freescale.net (192.88.168.50) by BL2FFO11FD027.mail.protection.outlook.com (10.173.161.106) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1157.12 via Frontend Transport; Fri, 16 Jun 2017 05:32:35 +0000 Received: from Tophie.ap.freescale.net ([10.232.14.39]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v5G5WNF4001003; Thu, 15 Jun 2017 22:32:33 -0700 From: Shreyansh Jain To: CC: , Date: Fri, 16 Jun 2017 11:10:35 +0530 Message-ID: <1497591668-3320-6-git-send-email-shreyansh.jain@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1497591668-3320-1-git-send-email-shreyansh.jain@nxp.com> References: <1497591668-3320-1-git-send-email-shreyansh.jain@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131420647558095078; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39450400003)(39860400002)(39840400002)(39400400002)(39850400002)(39380400002)(39410400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(9170700003)(85426001)(77096006)(356003)(2950100002)(8676002)(53936002)(81166006)(8936002)(50466002)(110136004)(6916009)(33646002)(50226002)(4326008)(305945005)(105606002)(38730400002)(104016004)(86362001)(2906002)(36756003)(5660300001)(50986999)(498600001)(2351001)(48376002)(76176999)(5003940100001)(47776003)(54906002)(189998001)(8656002)(106466001)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR0301MB0597; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD027; 1:3yi6ebaA9RQbEgzcM94m7ZAxC3HGxMAX5kBhFg2sxAICttDcFLWy6fLaaJhHMpAbJJ1g8oyIHJLpkf5818jVJBMIDE/dS/AnU4O31odiJ1Mq1DcPFfXVDRSPqLnS97KlPSSq6q7uzorPIfmsjq9SMqw/MOrqTMyN20SwphBqN99fG1tAmAvoPQ79YgRkDnj3EO6sGRhDHWGxyX0xM4+Pm6loVUWAPqtB6v0f+wOPMSYwUnnkRZ68lnpJIskC/x9C3DH6SoKymP36Yr8Zqj+h/WELhIkTNSbqRAHFpXLj3XiPVhnwovOD+BlsQiSFAl61NDK88RbLIq18nBXIxfr94DuIE9fp/DocqzpxHko1K1JUC6jQT3cU2YKHVLwkhUdfKA8XXlJQXw46r5cH3Iy9v9DdQxOSaOtdkBy25g6Il1yCyEo7IFh6ZkLPnb7qZef45RzxyngDmUkO4mN0ODpDHELzvd21gIDB+0dd339kXkyyO7a92OAgoHhOHad5uNCXozT4I7IRukyskPziBbAomKFtTQfWBP01VdwgvFbe2KlytbgVIGBVeyUT6ISM4G9A1rsTV8ZajlhMFTBZ2sowYQoR7vtSiuXHkDCZBiNYUOPLcFBCIB6SJmt/1t1m8zQQvlQLK4yooAvut6BuMzBfvyQpsKbjWEnenApzWQ0oAxfONVKKf45O1ZZ/PGHEAcLq7p1baBIxSz4A5xVFOcM4Wt3PBUk0EmMCxxV2ttEmJiQ= MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY2PR0301MB0597: X-MS-Office365-Filtering-Correlation-Id: 85ef90f7-fd03-4534-20e6-08d4b4791851 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:BY2PR0301MB0597; X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0597; 3:XtFtPB7hH27LvlpIuqr9U7dMpiUtvjLkY+Unz/mrlgaVqq3wM7vw0jMPNzZLX2XipRasPch9QgRc4IZgg6PfEb/JiN+q4pApriIGcW2AM2MMtu/wAIC+WfCibNRUy5yzTfLiBkxf7objyszkOFtUvwGjc4NLfP5OyWMbd92iLtvxnfeF1qKZix1BTcmNqTWKBXLejW1ehe6HASSpUaooahjlKZ/VQn2THUZlK83PB35+Cu7WSjlYlMWyJ37gZ6knnpb2TCJoATblbVdp/LKrww/snh+mpf4DMENLLl7OD3/GrWNVV9LgQaqTG9dJ1k0V2gx67C06naImv9QabfJHy7K56qCXbIKbsFPloxVrd1bHrKMLz34+uyzLZ7hvxkMDArO640bWlhE9kCp9KL/uK6jsvXrip/FCOJ0jMAqg/+BSpYSX/wiF9ADLhiQWiOXl; 25:K2VHudoVASSS8p6rKoWNwEbk0e6rdu9BF2iPiMZgJBfOzEKhuR/5QAyXVigup4PEghzFeq8d4nTXXUHA+i+jfiXct4Qna4If/39gSOr4SvYnkBzWri43L5C7X0uSQz+pxXoxq5iyeelI/GHusvkLUxGDvEZKRL1KTHG86yT5B99SqZwSibbYw2cmkX9JGitatB7aEEQ718DAEQE0G0YA6Fl+fGnQySJ6KkETQf78R530M5d0CpjrpOhfSsE81qH9kb4WmSqzXYZ0WDuPOrIr/kvPVa4jrYWrbFefgV0du0IuWAaO4KFa4e1Me7eYzl2tCNCglep7dKmzjAp1foj7N3W4UWoPZOwEOtfmVeg/I60x0AjE/K+e4cx3VjzYawcaI66LyQkEdFkhP2QtzUljyo50XRRlo71nBS5CtOy8iIxS46D11DIKhhk+f2uNHftD19dawvEsVnQrAPzQnjgu6vBWoV2K0VnM/VvM4srwnKU= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0597; 31:dc5lSSrpsCgq0VOLRRMp0/mR/FLcOn/A05wFgRTCIiwQWSqYIDvN4COVz7bGzImo4UZ7rp88GraORTYZdRsXjrxOWZSD6ZZpIUIe9G0Zp/2emtnN9ioK2z8CYJKus2bdya5DDKUS14e77Zaak71SDlBnw7R9t/hVvASreLAIrCQfm8cfSj/cLVjg3zvAS03LHzV4LR84dXUaoN0lJd2xOmOc4iOUNUeSqfmscVtBWLqUqY1GjawySjcTXRMFwtPR X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6095135)(601004)(2401047)(13016025)(8121501046)(5005006)(13018025)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6096035)(20161123565025)(20161123563025)(201703131430075)(201703131441075)(201703131448075)(201703131433075)(201703161259150)(20161123559100)(20161123556025)(20161123561025)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:BY2PR0301MB0597; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:BY2PR0301MB0597; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0301MB0597; 4:dVcV86u4bCYfRJ+cBEGAMDG9nOHGNJHy9fA4RRVQ?= =?us-ascii?Q?i7W7qkERcA2ZaYK0vFT0OtqJRUMqPmBPQwZRsATvcmyDrLpZAU2b8VuWYW3a?= =?us-ascii?Q?pPYAN023T9GDqD0eUA44qh4P331tPuoFsyHZuD0foSaHZavYSLwtcDG1/GXF?= =?us-ascii?Q?ngTXGDSDCstLtOS+UZwArVCWnZsEnlNFaOa8z+CISV8cMJ2SVNsgKFgJJu1Y?= =?us-ascii?Q?t9KJjFLw6EI2gvBGE9InTEGz8YxuM24mkgVIY9kKoxqk6xFrrRPt7xxZsK08?= =?us-ascii?Q?R7Fu1hyiaahCsNBAPpHrLgvJFaOaE0vM/cos4qruLrn3iqidCr3Elrnjvh1A?= =?us-ascii?Q?2hqt3fItuRt6BthLczSkGPadwIhkGs+foipsNCdTM15WCT4EmgGXSXFZPWdn?= =?us-ascii?Q?GIGXfmhlaBfLkk0hHRp01QU9lV8xJ++O6Ul8Fp1VU3pl5vMmyUS1LdZi5l8u?= =?us-ascii?Q?QBBENshoeADDD4VBYQb4xFtQn3eJ1Ij43NiS0MGj5rKXIIq2CPH3fwmxnMCy?= =?us-ascii?Q?9Ta0BQQWXVC6w/uIP4fATsKXUQpLlSmSKVN8ltxiH9sWzDg7NqAQPqklvbf7?= =?us-ascii?Q?y5eh3EDqslQ0QKaxw8/5Uu8kJbqdc/LiJjtsd/SXJXvYzvpS//09igSFKLQH?= =?us-ascii?Q?A9jdAYIv8WH3EMiOwRxWzNznR2+h22ZrBH0yHlWPgQiZBiXvbhNuKLVVJX+q?= =?us-ascii?Q?x7VIX7p+8kgH5R9KBU2WbyhdO6mmpiJ/X4+M81vhw5e1T750YFaErNK6RR4q?= =?us-ascii?Q?k7JlK3xLQHgy7dUoRmvk2sKCWEMj6gN+wecqsJTzEI04MJjZxVmwapWvs1+n?= =?us-ascii?Q?Js4U19v8VCYPrbBol3beaVqMrc1Nm4eSpJJMOsAFoErA7+f61l2IsCt4tRig?= =?us-ascii?Q?4o9fBpfITkbqoTClpRF7XkdXvhGyGk9ZjUgTUaV/A9Y7qniQeISmG3rB9nZv?= =?us-ascii?Q?/id5nU2YOukoqKuVyKM/69vSDilDNhiKbd//YAGcjOYkDzo5wxhJAWJLYrw2?= =?us-ascii?Q?aEWAF82s48PcllnykCVZGN02YP+jGMSZ+vBsvhV09HVBLJUA83yRW/XuQBuy?= =?us-ascii?Q?G16k6XY1U0S0OdIq4ZJkV89a6Ey5OAgKHoZ3OY9e9zqK14G/Nl5rqba9Qh3R?= =?us-ascii?Q?kn8QYe1Oov6hsNUfcAku+knh6FZLG7q2qJ2W0ccVUhYdRXWS1iDGBk/jE4Fi?= =?us-ascii?Q?Wlg6elEtPciror5OJkjTrHxd8WIhxFT9b9BJiQHSuUWTUC4Bjbm1jTYtHZCs?= =?us-ascii?Q?lqTG2ncLDFC2RlntBWg=3D?= X-Forefront-PRVS: 0340850FCD X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0301MB0597; 23:m5U36sQYFkPdmlu1Kc3EZE7iNJHnZyZGtbDQy2W?= =?us-ascii?Q?BUmm1z+HOs/mxvmuODqrR4mCmG6HcshgQPp2+aP0qssVRYNO4PVEGYB8vUBS?= =?us-ascii?Q?Tt8vbZtDe68Qhr3jrHuJ39TorOQo3lPNR7k3L99neb2QeXud7pIlNO0WnRoI?= =?us-ascii?Q?H18N0zUx3NkInqO6gbfDfL3fLTBHJrCu8ONl4puvzm/GrcCpQzk+FE6hJNfm?= =?us-ascii?Q?a4mzfS/h4xlnLonOUvln5JMaItjnrDeoMim3E5rkzW5oRsJ8LI9euE6+e/JU?= =?us-ascii?Q?6sILlufR3w5TmZATRUcBXkOxP6q0zgFGgihccXZaR/xEq08G7xnobpXGx0E6?= =?us-ascii?Q?OeAeXf4eAz3M0a1DOBAJ6q+7mEtWEuYCf66aM2iZiLNhoFnB9ifzB9VN7D/b?= =?us-ascii?Q?h2pZHmVxO5MZPXOsI8GCZwPMlmrlaqKggPLA3+hWdVJ6uuoJwE4fZokHF3Kd?= =?us-ascii?Q?y+/q8CoeXz6hLlXj62DGdFpAVcYpaUbj7KH020jA4Al1LPrE9cqBEJNP/IaT?= =?us-ascii?Q?ifM9RGqCQIhYxbJSMGCZ53SFvg1tTPaZyfezw7gf8yypRnWwZKZHDN2vggyl?= =?us-ascii?Q?S8xI/oFD9A3qIBpBHlUaznE41wIdwUqv5QdA/Psz+KJ2oS8L2ITWo0v5o0gB?= =?us-ascii?Q?MpOsPzHfjGQhA+J4uC44/3tB7PbbHuu0Kopp0PkAPrwwm6CUb6ln9d7ugofg?= =?us-ascii?Q?N/aohVv9pMEVL540iu8VhVtQ3iBbl5hURZyRLghZcnZmr/bwsrDvOxPgduV3?= =?us-ascii?Q?VfyATeSxHxu91D2Rd0TilYSO3OD2behveTEQlaK3eanbeBU5Pmbnue/cw3it?= =?us-ascii?Q?1EMaDw2cVSpDY1pCq1tqP+hRhN7FxIDt54c4l0ed0X+XbJ4kyeVk8MNgSspX?= =?us-ascii?Q?sl1rSnniYyvsd42JQ8iBbhCudMhVdaMzOr2gptHoVzj5YHOVfW79jMPLfnuS?= =?us-ascii?Q?1Z8oVJ3QNRrbowgam82gx7uqX3j+ueEInn8cReEeo5KQVnQF5sgk681WEMHD?= =?us-ascii?Q?Op3mZqRJqBCt+1mJIe57MkzXf0lNXtgN0K239KNijzaXtPV8PyZRIN6gIfsd?= =?us-ascii?Q?8173M8LSg+UCkS4h/4YHcXBu+EsW84LTAxOpt1D+6MkW9c3qzXz2bhOziqQu?= =?us-ascii?Q?wFkbTy6bOdxZXez4vAbpX5Lsj7+e8Pwv+sPTbGYfZ7EHtnj+TMBcQC/UkQvX?= =?us-ascii?Q?gXAON1WRKizkyxa7Lg2/yI+v32mDZEK7Ya0rbodcE9Txm1xrFHIeVzAaAMv6?= =?us-ascii?Q?g+TIJD28y2Eac5/I2RUs=3D?= X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BY2PR0301MB0597; 6:Q8ZR8NSe3XojXRcLMxsQMbi8Ej8kGBL0y0vVM06N?= =?us-ascii?Q?3bmY6BMittalirmM04x7bobEh9i/8M8lJOFmvERPsXG9dSgTwQqK4lNNofad?= =?us-ascii?Q?auPtsbZmQI2YJLkPtqHjpfuXXwU105Yw8eanv4j8V4D/gSd/DB1WPb+TiG2g?= =?us-ascii?Q?+cpi3OjL8mDWrcs6KM5oCagmcNiJ4LOsv7NmPHmjYKHfhyEBd5/OChZd8MCD?= =?us-ascii?Q?wV61wRiJAqWrA3bTEFtFjiRjUJ/4gYFuwDqI1cLp64ryoYY/8Da/C1TsM9lb?= =?us-ascii?Q?3DAOYS+o+1iqPs2g2eL3oDxIfig/ocw2Js3T2SNrlzINWLtSXFolFJP6G8pv?= =?us-ascii?Q?GzBlkJ82qd6owXdJTwWpfyj7YK/kbYM4r5n9gbNtnLDzj8qkzyJY+nMxXHe/?= =?us-ascii?Q?7DCXGbhTWV2lBUDXFlgFWkijj3jx/6qmdBCbtgGcbeNtBB8n7RS7ETPxVljq?= =?us-ascii?Q?VKKQu2BqcdRG+lxDIIwVPUhtP7Sl1aqP069IBUFZwIYyruZOAJvgN3RkOZOv?= =?us-ascii?Q?5k6EO5AeEgPO5NC4VuuR1TGXEUOYeOq76U8H2/pLEZYA0XRXdAV5uJHMsjRj?= =?us-ascii?Q?uiJqy2NbuN1uFzAdSVh05kB6Ldfade0u6Zs2/pvmcXM708NATWMUlXZXSPhm?= =?us-ascii?Q?OVlhVxRA2VJnxaWxUPtb2y9gHqVd4sCz7j71aKzd2sOPr5eA/5AERSEp226x?= =?us-ascii?Q?RczI2uHar/QAbL9m58gYft1LNla5hkXJhIrZXjQoF+9GFvUs9mBBlLr13fg7?= =?us-ascii?Q?HTyh4Td2nNEtJzSbmaV6nxkhyDLU+Q85ZHbQEUuaaD4iwVvGAtnlFel86tlC?= =?us-ascii?Q?LKPcGNwl6OzpMy1kyHqfMxNSwkmCVTdB30GWBgWVCl+6imP5hnwG9bFQ/lcB?= =?us-ascii?Q?qTAVT1a/MIqRupYt2sPzuoLoMsFHVLVwdFPowv9DQmEEcoDE5a2sbosIvMlV?= =?us-ascii?Q?6i67SBR4LdJr7N7Puy0ZPM8E0hW0+fxAaw6RXWBwzQ=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0597; 5:JbxZ3aL8PP5Jjp2edWtdeRmZdXBEEYnFhSE6Or7t80gfm6ezhhor2VNLcsfU4NlJk2IFzdNFHbTaHCHBhoaaMMaDtHVxauaxSiXYE4Eytfs2hVADYxsWEteagRjS8zxgTR/hoQdXjfj+ivNTcvs5FWZuiH67yEAMopmIpeKn878p5LkC5kufOJxOAjUZUdkGMo93wXa8ff04UodMhPXNXBoFtC6Q6cBr2mVg7FQMMWH+WUcYTGPHlrH8AL1ahe9rAHL4JlA8R7e5ozcY52jfXNKRIJANy/mreXd1JHlnEJEtqHtEi0xJn/ghRdUpKhz05Wruizri0L7zXnPflTSnDsfpbC+g+bZi2xis8f8EnnKHi0V9sC6PepCECjZLsdlR12RvfrHXebnUJjphEmxUGFGcY5P+XmrPvt8/btyAXp33jHPBgivVwGfMuR8J3SEgN+s/ehvXQuQ/fFo3Abrj89UWBegcb9Kz/QCPDD2pAYrWh32Yh0Db8JGLE8tYjxIcsYe/3NwU1BaHZT1w1Q/QRw==; 24:nMYH+Z7QRLmK1oOSc6527qOUBCIKkjVsti/3bFxbHyGFMUo7XSHpDtjyZpm3hFenkWlgR3+MEXXk5lBcLX1t8Me7njYNxhNFxxiWv/MSvWs= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BY2PR0301MB0597; 7:+uxIbU6q+GGrIpPnvtDw8GlRXEPX66YIjy/cRYBRHdOb0z2oJUDYPtzvKQ0SpoCrQYWo4MInHvYsctlh2JGgj7x6Q+p07d4iGIvr+wYj2ghS5Mlfk/Qji/dRkHA5jO/wQpHED+h7xsMaYPZ83j/qA7nXiij2jaB3abmfntrxQyUUuaA92GXGvvoqcvB6dBAZwSZpBf599y1KGw0xRMW89d1oLZY9ujG7Kgc3FrWg6683VWCf5JdErrPbvcBSKUg7udpF5zJVh2jm7tmlIwzLXGA+7VqHND9gYxEbFhtY9+hpSedCRBGaX5jNTkLV9i4CvpVylFtIAT9lOxMAoDx/wXPs7YOe3b83kUPiWZ2J0GH2kIi5kL+f2LpZIeovZCdIXo9ie3b8NuPAWCfpJwJ7XGoS/OB7Qth3joKnyiEHNIeu4lV5Kp+0FtTfeh2P5mxUQFS2xZyshO6pu1khT4CY47xcKDCzwxy4h9bx9RebpfePnDRswrh8tbPczBRCm2xyCvJ6jXxat/P6AZFsvwsLdRqAEBqve97KC+BIPcEwOgrEl8X6FYTl7MTKhc8ojacLbVvd8UlK/un5Mqwj6zXvJIoxZ/vLLUzz0QHkSDKa6cMspItwPkrOgbshmD6OgFVpio1E4gEzjpjhbZJkpFNngr9MG18FdoESA8wH9CiR7BvYWsfjzMap1Nh+dUkd6Qnhi0k4NftMX4kqAD7CKueLqMRgDJHksf0dcTGRnqAsBBtOhd4oGrt7S8apciwWhfswAD9rublyUcK42NUposs5NGCuQcAkixvLWiZFrJ+Y0L0= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2017 05:32:35.6379 (UTC) X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e; Ip=[192.88.168.50]; Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR0301MB0597 Subject: [dpdk-dev] [PATCH 05/38] bus/dpaa: add OF parser for device scanning X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Jun 2017 05:32:39 -0000 This layer is used by Bus driver's scan function. Devices are parsed using OF parser and added to DPAA device list. Signed-off-by: Geoff Thorpe Signed-off-by: Shreyansh Jain --- drivers/bus/dpaa/Makefile | 7 + drivers/bus/dpaa/base/fman/of.c | 576 ++++++++++++++++++++++++++++++++++++++++ drivers/bus/dpaa/include/of.h | 191 +++++++++++++ 3 files changed, 774 insertions(+) create mode 100644 drivers/bus/dpaa/base/fman/of.c create mode 100644 drivers/bus/dpaa/include/of.h diff --git a/drivers/bus/dpaa/Makefile b/drivers/bus/dpaa/Makefile index f44f3c4..cc685d1 100644 --- a/drivers/bus/dpaa/Makefile +++ b/drivers/bus/dpaa/Makefile @@ -45,7 +45,12 @@ CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) endif +CFLAGS +=-Wno-pointer-arith +CFLAGS +=-Wno-cast-qual +CFLAGS += -D _GNU_SOURCE + CFLAGS += -I$(RTE_BUS_DPAA)/ +CFLAGS += -I$(RTE_BUS_DPAA)/include CFLAGS += -I$(RTE_SDK)/lib/librte_eal/linuxapp/eal CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common/include @@ -59,5 +64,7 @@ LIBABIVER := 1 SRCS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += \ dpaa_bus.c +SRCS-$(CONFIG_RTE_LIBRTE_DPAA_BUS) += \ + base/fman/of.c \ include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/bus/dpaa/base/fman/of.c b/drivers/bus/dpaa/base/fman/of.c new file mode 100644 index 0000000..6cc3987 --- /dev/null +++ b/drivers/bus/dpaa/base/fman/of.c @@ -0,0 +1,576 @@ +/*- + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * BSD LICENSE + * + * Copyright 2010-2016 Freescale Semiconductor Inc. + * Copyright 2017 NXP. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * GPL LICENSE SUMMARY + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include + +static int alive; +static struct dt_dir root_dir; +static const char *base_dir; +static COMPAT_LIST_HEAD(linear); + +static int +of_open_dir(const char *relative_path, struct dirent ***d) +{ + int ret; + char full_path[PATH_MAX]; + + snprintf(full_path, PATH_MAX, "%s/%s", base_dir, relative_path); + ret = scandir(full_path, d, 0, versionsort); + if (ret < 0) + DPAA_BUS_LOG(ERR, "Failed to open directory %s", + full_path); + return ret; +} + +static void +of_close_dir(struct dirent **d, int num) +{ + while (num--) + free(d[num]); + free(d); +} + +static int +of_open_file(const char *relative_path) +{ + int ret; + char full_path[PATH_MAX]; + + snprintf(full_path, PATH_MAX, "%s/%s", base_dir, relative_path); + ret = open(full_path, O_RDONLY); + if (ret < 0) + DPAA_BUS_LOG(ERR, "Failed to open directory %s", + full_path); + return ret; +} + +static void +process_file(struct dirent *dent, struct dt_dir *parent) +{ + int fd; + struct dt_file *f = malloc(sizeof(*f)); + + if (!f) { + DPAA_BUS_LOG(DEBUG, "Unable to allocate memory for file node"); + return; + } + f->node.is_file = 1; + snprintf(f->node.node.name, NAME_MAX, "%s", dent->d_name); + snprintf(f->node.node.full_name, PATH_MAX, "%s/%s", + parent->node.node.full_name, dent->d_name); + f->parent = parent; + fd = of_open_file(f->node.node.full_name); + if (fd < 0) { + DPAA_BUS_LOG(DEBUG, "Unable to open file node"); + free(f); + return; + } + f->len = read(fd, f->buf, OF_FILE_BUF_MAX); + close(fd); + if (f->len < 0) { + DPAA_BUS_LOG(DEBUG, "Unable to read file node"); + free(f); + return; + } + list_add_tail(&f->node.list, &parent->files); +} + +static const struct dt_dir * +node2dir(const struct device_node *n) +{ + struct dt_node *dn = container_of((struct device_node *)n, + struct dt_node, node); + const struct dt_dir *d = container_of(dn, struct dt_dir, node); + + assert(!dn->is_file); + return d; +} + +/* process_dir() calls iterate_dir(), but the latter will also call the former + * when recursing into sub-directories, so a predeclaration is needed. + */ +static int process_dir(const char *relative_path, struct dt_dir *dt); + +static int +iterate_dir(struct dirent **d, int num, struct dt_dir *dt) +{ + int loop; + /* Iterate the directory contents */ + for (loop = 0; loop < num; loop++) { + struct dt_dir *subdir; + int ret; + /* Ignore dot files of all types (especially "..") */ + if (d[loop]->d_name[0] == '.') + continue; + switch (d[loop]->d_type) { + case DT_REG: + process_file(d[loop], dt); + break; + case DT_DIR: + subdir = malloc(sizeof(*subdir)); + if (!subdir) { + perror("malloc"); + return -ENOMEM; + } + snprintf(subdir->node.node.name, NAME_MAX, "%s", + d[loop]->d_name); + snprintf(subdir->node.node.full_name, PATH_MAX, + "%s/%s", dt->node.node.full_name, + d[loop]->d_name); + subdir->parent = dt; + ret = process_dir(subdir->node.node.full_name, subdir); + if (ret) + return ret; + list_add_tail(&subdir->node.list, &dt->subdirs); + break; + default: + DPAA_BUS_LOG(DEBUG, "Ignoring invalid dt entry %s/%s", + dt->node.node.full_name, d[loop]->d_name); + } + } + return 0; +} + +static int +process_dir(const char *relative_path, struct dt_dir *dt) +{ + struct dirent **d; + int ret, num; + + dt->node.is_file = 0; + INIT_LIST_HEAD(&dt->subdirs); + INIT_LIST_HEAD(&dt->files); + ret = of_open_dir(relative_path, &d); + if (ret < 0) + return ret; + num = ret; + ret = iterate_dir(d, num, dt); + of_close_dir(d, num); + return (ret < 0) ? ret : 0; +} + +static void +linear_dir(struct dt_dir *d) +{ + struct dt_file *f; + struct dt_dir *dd; + + d->compatible = NULL; + d->status = NULL; + d->lphandle = NULL; + d->a_cells = NULL; + d->s_cells = NULL; + d->reg = NULL; + list_for_each_entry(f, &d->files, node.list) { + if (!strcmp(f->node.node.name, "compatible")) { + if (d->compatible) + DPAA_BUS_LOG(DEBUG, "Duplicate compatible in" + " %s", d->node.node.full_name); + d->compatible = f; + } else if (!strcmp(f->node.node.name, "status")) { + if (d->status) + DPAA_BUS_LOG(DEBUG, "Duplicate status in %s", + d->node.node.full_name); + d->status = f; + } else if (!strcmp(f->node.node.name, "linux,phandle")) { + if (d->lphandle) + DPAA_BUS_LOG(DEBUG, "Duplicate lphandle in %s", + d->node.node.full_name); + d->lphandle = f; + } else if (!strcmp(f->node.node.name, "#address-cells")) { + if (d->a_cells) + DPAA_BUS_LOG(DEBUG, "Duplicate a_cells in %s", + d->node.node.full_name); + d->a_cells = f; + } else if (!strcmp(f->node.node.name, "#size-cells")) { + if (d->s_cells) + DPAA_BUS_LOG(DEBUG, "Duplicate s_cells in %s", + d->node.node.full_name); + d->s_cells = f; + } else if (!strcmp(f->node.node.name, "reg")) { + if (d->reg) + DPAA_BUS_LOG(DEBUG, "Duplicate reg in %s", + d->node.node.full_name); + d->reg = f; + } + } + + list_for_each_entry(dd, &d->subdirs, node.list) { + list_add_tail(&dd->linear, &linear); + linear_dir(dd); + } +} + +int +of_init_path(const char *dt_path) +{ + int ret; + + base_dir = dt_path; + + /* This needs to be singleton initialization */ + DPAA_BUS_WARN(alive, "Double-init of device-tree driver!"); + + /* Prepare root node (the remaining fields are set in process_dir()) */ + root_dir.node.node.name[0] = '\0'; + root_dir.node.node.full_name[0] = '\0'; + INIT_LIST_HEAD(&root_dir.node.list); + root_dir.parent = NULL; + + /* Kick things off... */ + ret = process_dir("", &root_dir); + if (ret) { + DPAA_BUS_LOG(ERR, "Unable to parse device tree"); + return ret; + } + + /* Now make a flat, linear list of directories */ + linear_dir(&root_dir); + alive = 1; + return 0; +} + +static void +destroy_dir(struct dt_dir *d) +{ + struct dt_file *f, *tmpf; + struct dt_dir *dd, *tmpd; + + list_for_each_entry_safe(f, tmpf, &d->files, node.list) { + list_del(&f->node.list); + free(f); + } + list_for_each_entry_safe(dd, tmpd, &d->subdirs, node.list) { + destroy_dir(dd); + list_del(&dd->node.list); + free(dd); + } +} + +void +of_finish(void) +{ + DPAA_BUS_WARN(!alive, "Double-finish of device-tree driver!"); + + destroy_dir(&root_dir); + INIT_LIST_HEAD(&linear); + alive = 0; +} + +static const struct dt_dir * +next_linear(const struct dt_dir *f) +{ + if (f->linear.next == &linear) + return NULL; + return list_entry(f->linear.next, struct dt_dir, linear); +} + +static int +check_compatible(const struct dt_file *f, const char *compatible) +{ + const char *c = (char *)f->buf; + unsigned int len, remains = f->len; + + while (remains) { + len = strlen(c); + if (!strcmp(c, compatible)) + return 1; + + if (remains < len + 1) + break; + + c += (len + 1); + remains -= (len + 1); + } + return 0; +} + +const struct device_node * +of_find_compatible_node(const struct device_node *from, + const char *type __always_unused, + const char *compatible) +{ + const struct dt_dir *d; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + + if (list_empty(&linear)) + return NULL; + if (!from) + d = list_entry(linear.next, struct dt_dir, linear); + else + d = node2dir(from); + for (d = next_linear(d); d && (!d->compatible || + !check_compatible(d->compatible, + compatible)); + d = next_linear(d)) + ; + if (d) + return &d->node.node; + return NULL; +} + +const void * +of_get_property(const struct device_node *from, const char *name, + size_t *lenp) +{ + const struct dt_dir *d; + const struct dt_file *f; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + + d = node2dir(from); + list_for_each_entry(f, &d->files, node.list) + if (!strcmp(f->node.node.name, name)) { + if (lenp) + *lenp = f->len; + return f->buf; + } + return NULL; +} + +bool +of_device_is_available(const struct device_node *dev_node) +{ + const struct dt_dir *d; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + d = node2dir(dev_node); + if (!d->status) + return true; + if (!strcmp((char *)d->status->buf, "okay")) + return true; + if (!strcmp((char *)d->status->buf, "ok")) + return true; + return false; +} + +const struct device_node * +of_find_node_by_phandle(phandle ph) +{ + const struct dt_dir *d; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + list_for_each_entry(d, &linear, linear) + if (d->lphandle && (d->lphandle->len == 4) && + !memcmp(d->lphandle->buf, &ph, 4)) + return &d->node.node; + return NULL; +} + +const struct device_node * +of_get_parent(const struct device_node *dev_node) +{ + const struct dt_dir *d; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + + if (!dev_node) + return NULL; + d = node2dir(dev_node); + if (!d->parent) + return NULL; + return &d->parent->node.node; +} + +const struct device_node * +of_get_next_child(const struct device_node *dev_node, + const struct device_node *prev) +{ + const struct dt_dir *p, *c; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + + if (!dev_node) + return NULL; + p = node2dir(dev_node); + if (prev) { + c = node2dir(prev); + DPAA_BUS_WARN((c->parent != p), "Parent/child mismatch"); + if (c->parent != p) + return NULL; + if (c->node.list.next == &p->subdirs) + /* prev was the last child */ + return NULL; + c = list_entry(c->node.list.next, struct dt_dir, node.list); + return &c->node.node; + } + /* Return first child */ + if (list_empty(&p->subdirs)) + return NULL; + c = list_entry(p->subdirs.next, struct dt_dir, node.list); + return &c->node.node; +} + +uint32_t +of_n_addr_cells(const struct device_node *dev_node) +{ + const struct dt_dir *d; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised"); + if (!dev_node) + return OF_DEFAULT_NA; + d = node2dir(dev_node); + while ((d = d->parent)) + if (d->a_cells) { + unsigned char *buf = + (unsigned char *)&d->a_cells->buf[0]; + assert(d->a_cells->len == 4); + return ((uint32_t)buf[0] << 24) | + ((uint32_t)buf[1] << 16) | + ((uint32_t)buf[2] << 8) | + (uint32_t)buf[3]; + } + return OF_DEFAULT_NA; +} + +uint32_t +of_n_size_cells(const struct device_node *dev_node) +{ + const struct dt_dir *d; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + if (!dev_node) + return OF_DEFAULT_NA; + d = node2dir(dev_node); + while ((d = d->parent)) + if (d->s_cells) { + unsigned char *buf = + (unsigned char *)&d->s_cells->buf[0]; + assert(d->s_cells->len == 4); + return ((uint32_t)buf[0] << 24) | + ((uint32_t)buf[1] << 16) | + ((uint32_t)buf[2] << 8) | + (uint32_t)buf[3]; + } + return OF_DEFAULT_NS; +} + +const uint32_t * +of_get_address(const struct device_node *dev_node, size_t idx, + uint64_t *size, uint32_t *flags __rte_unused) +{ + const struct dt_dir *d; + const unsigned char *buf; + uint32_t na = of_n_addr_cells(dev_node); + uint32_t ns = of_n_size_cells(dev_node); + + if (!dev_node) + d = &root_dir; + else + d = node2dir(dev_node); + if (!d->reg) + return NULL; + assert(d->reg->len % ((na + ns) * 4) == 0); + assert(d->reg->len / ((na + ns) * 4) > (unsigned int) idx); + buf = (const unsigned char *)&d->reg->buf[0]; + buf += (na + ns) * idx * 4; + if (size) + for (*size = 0; ns > 0; ns--, na++) + *size = (*size << 32) + + (((uint32_t)buf[4 * na] << 24) | + ((uint32_t)buf[4 * na + 1] << 16) | + ((uint32_t)buf[4 * na + 2] << 8) | + (uint32_t)buf[4 * na + 3]); + return (const uint32_t *)buf; +} + +uint64_t +of_translate_address(const struct device_node *dev_node, + const uint32_t *addr) +{ + uint64_t phys_addr, tmp_addr; + const struct device_node *parent; + const uint32_t *ranges; + size_t rlen; + uint32_t na, pna; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + assert(dev_node != NULL); + + na = of_n_addr_cells(dev_node); + phys_addr = of_read_number(addr, na); + + dev_node = of_get_parent(dev_node); + if (!dev_node) + return 0; + else if (node2dir(dev_node) == &root_dir) + return phys_addr; + + do { + pna = of_n_addr_cells(dev_node); + parent = of_get_parent(dev_node); + if (!parent) + return 0; + + ranges = of_get_property(dev_node, "ranges", &rlen); + /* "ranges" property is missing. Translation breaks */ + if (!ranges) + return 0; + /* "ranges" property is empty. Do 1:1 translation */ + else if (rlen == 0) + continue; + else + tmp_addr = of_read_number(ranges + na, pna); + + na = pna; + dev_node = parent; + phys_addr += tmp_addr; + } while (node2dir(parent) != &root_dir); + + return phys_addr; +} + +bool +of_device_is_compatible(const struct device_node *dev_node, + const char *compatible) +{ + const struct dt_dir *d; + + DPAA_BUS_WARN(!alive, "Device-tree driver not initialised!"); + if (!dev_node) + d = &root_dir; + else + d = node2dir(dev_node); + if (d->compatible && check_compatible(d->compatible, compatible)) + return true; + return false; +} diff --git a/drivers/bus/dpaa/include/of.h b/drivers/bus/dpaa/include/of.h new file mode 100644 index 0000000..e422a53 --- /dev/null +++ b/drivers/bus/dpaa/include/of.h @@ -0,0 +1,191 @@ +/*- + * This file is provided under a dual BSD/GPLv2 license. When using or + * redistributing this file, you may do so under either license. + * + * BSD LICENSE + * + * Copyright 2010-2016 Freescale Semiconductor, Inc. + * Copyright 2017 NXP. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the above-listed copyright holders nor the + * names of any contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * GPL LICENSE SUMMARY + * + * ALTERNATIVELY, this software may be distributed under the terms of the + * GNU General Public License ("GPL") as published by the Free Software + * Foundation, either version 2 of that License or (at your option) any + * later version. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef __OF_H +#define __OF_H + +#include + +#ifndef OF_INIT_DEFAULT_PATH +#define OF_INIT_DEFAULT_PATH "/proc/device-tree" +#endif + +#define OF_DEFAULT_NA 1 +#define OF_DEFAULT_NS 1 + +#define OF_FILE_BUF_MAX 256 + +/** + * Layout of Device Tree: + * dt_dir + * |- dt_dir + * | |- dt_dir + * | | |- dt_dir + * | | | |- dt_file + * | | | ``- dt_file + * | | ``- dt_file + * | `-dt_file` + * ``- dt_file + * + * +------------------+ + * |dt_dir | + * |+----------------+| + * ||dt_node || + * ||+--------------+|| + * |||device_node ||| + * ||+--------------+|| + * || list_dt_nodes || + * |+----------------+| + * | list of subdir | + * | list of files | + * +------------------+ + */ + +/** + * Device description on of a device node in device tree. + */ +struct device_node { + char name[NAME_MAX]; + char full_name[PATH_MAX]; +}; + +/** + * List of device nodes available in a device tree layout + */ +struct dt_node { + struct device_node node; /**< Property of node */ + int is_file; /**< FALSE==dir, TRUE==file */ + struct list_head list; /**< Nodes within a parent subdir */ +}; + +/** + * Types we use to represent directories and files + */ +struct dt_file; +struct dt_dir { + struct dt_node node; + struct list_head subdirs; + struct list_head files; + struct list_head linear; + struct dt_dir *parent; + struct dt_file *compatible; + struct dt_file *status; + struct dt_file *lphandle; + struct dt_file *a_cells; + struct dt_file *s_cells; + struct dt_file *reg; +}; + +struct dt_file { + struct dt_node node; + struct dt_dir *parent; + ssize_t len; + uint64_t buf[OF_FILE_BUF_MAX >> 3]; /** ASDF: Why? */ +}; + +const struct device_node *of_find_compatible_node( + const struct device_node *from, + const char *type __always_unused, + const char *compatible) + __attribute__((nonnull(3))); + +#define for_each_compatible_node(dev_node, type, compatible) \ + for (dev_node = of_find_compatible_node(NULL, type, compatible); \ + dev_node != NULL; \ + dev_node = of_find_compatible_node(dev_node, type, compatible)) + +const void *of_get_property(const struct device_node *from, const char *name, + size_t *lenp) __attribute__((nonnull(2))); +bool of_device_is_available(const struct device_node *dev_node); + +const struct device_node *of_find_node_by_phandle(phandle ph); + +const struct device_node *of_get_parent(const struct device_node *dev_node); + +const struct device_node *of_get_next_child(const struct device_node *dev_node, + const struct device_node *prev); + +#define for_each_child_node(parent, child) \ + for (child = of_get_next_child(parent, NULL); child != NULL; \ + child = of_get_next_child(parent, child)) + +uint32_t of_n_addr_cells(const struct device_node *dev_node); +uint32_t of_n_size_cells(const struct device_node *dev_node); + +const uint32_t *of_get_address(const struct device_node *dev_node, size_t idx, + uint64_t *size, uint32_t *flags); + +uint64_t of_translate_address(const struct device_node *dev_node, + const u32 *addr) __attribute__((nonnull)); + +bool of_device_is_compatible(const struct device_node *dev_node, + const char *compatible); + +/* of_init() must be called prior to initialisation or use of any driver + * subsystem that is device-tree-dependent. Eg. Qman/Bman, config layers, etc. + * The path should usually be "/proc/device-tree". + */ +int of_init_path(const char *dt_path); + +/* of_finish() allows a controlled tear-down of the device-tree layer, eg. if a + * full reload is desired without a process exit. + */ +void of_finish(void); + +/* Use of this wrapper is recommended. */ +static inline int of_init(void) +{ + return of_init_path(OF_INIT_DEFAULT_PATH); +} + +/* Read a numeric property according to its size and return it as a 64-bit + * value. + */ +static inline uint64_t of_read_number(const __be32 *cell, int size) +{ + uint64_t r = 0; + + while (size--) + r = (r << 32) | be32toh(*(cell++)); + return r; +} + +#endif /* __OF_H */ -- 2.7.4