From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM03-CO1-obe.outbound.protection.outlook.com (mail-co1nam03on0073.outbound.protection.outlook.com [104.47.40.73]) by dpdk.org (Postfix) with ESMTP id 456F1532C for ; Fri, 16 Jun 2017 07:32:37 +0200 (CEST) Received: from DM5PR03CA0012.namprd03.prod.outlook.com (10.175.104.22) by CY1PR0301MB1194.namprd03.prod.outlook.com (10.160.165.25) 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:34 +0000 Received: from BN1AFFO11FD034.protection.gbl (2a01:111:f400:7c10::150) by DM5PR03CA0012.outlook.office365.com (2603:10b6:3:118::22) 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:34 +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 BN1AFFO11FD034.mail.protection.outlook.com (10.58.52.158) 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:33 +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 v5G5WNF3001003; Thu, 15 Jun 2017 22:32:31 -0700 From: Shreyansh Jain To: CC: , Date: Fri, 16 Jun 2017 11:10:34 +0530 Message-ID: <1497591668-3320-5-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: 131420647539550261; (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)(39410400002)(39450400003)(39840400002)(39400400002)(39850400002)(39380400002)(39860400002)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(9170700003)(104016004)(2950100002)(8656002)(6916009)(36756003)(305945005)(53936002)(189998001)(110136004)(38730400002)(77096006)(4326008)(85426001)(5003940100001)(575784001)(86362001)(76176999)(50986999)(8676002)(356003)(81166006)(47776003)(106466001)(50466002)(498600001)(2351001)(50226002)(33646002)(54906002)(105606002)(5660300001)(48376002)(8936002)(2906002)(2004002)(473944003); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR0301MB1194; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; MX:1; A:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD034; 1:Yd6nKJG4uGJphUAtZvXWfhEojOPO2pcFMe2JxGe069Lim2oDyQ1saUKUwhz1G2gENOY0RTmP+BXg2XDzp37xffLsvNoWQt7bwC63bLcfuPfGxLOvzXV2M99OTNKeT+YDKrlhNv+3DBSMo+XQf3yaat58c0In4WhqGaFaLArA9yhyTQZQgybFMTr0AvJOGOXFrc2Om7uNeOGxtSv6e9EsQcjERg6c7nv8jfn+5Gv6IIHJwJlEMsY1PbYgS5FV+IxvKMkRJxkSUCyz37nG7Osfegz8ZzU0r0l1MZt4w/J96grcC68YgrgDH+oziZGQNpJin6tk36XhrjvJYkAnYSIuZ9R2JSWgVtRKtftaLdrxjfZN9Fmr3wfnXK+Pdl7b7UcmDwLE2YyMQJHBb53apJMy2PTxVNtfJxiKbS4TrWSwIBonuqIF3JqznNsfMZ1irjQ08UxuKnqxT0eWvy4EBn6H1wFeDTstyODwpfr9oB4lMq/K5n4JL8f/rjobAm5DYi72wUlkeyLxvTH4iXJ/asc5Fs7LfhwEHIUl072JDnI/ye3nscrS6GIfzJNeCwJd4eHvleFnBrLvIhJN89Z42Tv1lrk6tgNbDkKbOwEJ+y7LfVaTSPdKkggKzO+ilo8zeXeyX+knOB5fTfqg4+fJryM63Mv5/GwN6Jn6zD/5of+k1EAfS+1zXCUMWLqXMLaBLHSdjddjfvhzW/YppAzoKK9ZGPOx9kIV6AIqkoDW7l92xUg= MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY1PR0301MB1194: X-MS-Office365-Filtering-Correlation-Id: c3b53e8b-c4f7-4de6-c6d3-08d4b4791733 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:CY1PR0301MB1194; X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1194; 3:7gBZeZw63prr/9Vr2FMpxQ8av2loea0dujUZxHESyLexiwCenCxB1MAEEtsHmhy65ajNdryrgIuSVJTE924gft7kqI/Vl66q+Rfj1rgalYALHg5l3J+hiORK8a3QeGfjA51tQkDIaNxF9rgvHiB8k0pakPvq0qyuvmbRfZrHeFmfqsbPzuEeNOPy0RRlt8AgflF9S21a2KfFL1KuUbwXPYuKTtuKW99jEI7XdQXKkNSsvR0FGwv9K6vBgRYDaE6fsmEhCLQZpz/nXd2040nayBDD2TCp2MjSDHUOREcFYBU0DXCCUYVeSuL4WU3dMe/VFMIrayICpmE4kukwvdWSYKgMhqFcHBPkeNYiZLiqBmy4/p6HN1j5z6dWuldC0M+HikoPTfjQ1FC+kghScQNtJ7BDu20QDAt5bpZs+5d2vtNljL0VwBrlMz1q2MszCpNy; 25:zxyirw5aAvAyIcKcpxwvkm6adMVslw8wanZuSn4Zb/UITljR7x3KPZCqO930de0K48h8bj0sHY8HJCLZDT3JdB9GaFGH2wOvwdcLXB1IWmTcDryfTFbixI2CSY9bmxqM+lT7V8fE94DlLty1RCfqtNvQKnmQkbKvVeT2o7V8SDvc8J252TObOEnju0vzqnqoaegy4Z0vnGR1YbKq/CEzVNsV7l2hytF4fGin57tpOQszb0DYbv/XTcH1NOOivZxw0a9z8bvjPqSEs/9sUV3HWkdC/N8xowxhzonCDtBce8PM661ZmY6FQdiSyGWTQT37Rnuw897qXzBYRG7dkp+6ztxl1V7bys8nSDTIll257/evyt7et03ixTzHH68YAIwNjydECsfWsyZYPaE5NGWidTIo6dMjsRNhKywOYlEC4JQ0bA2fSjZqsGlh7FIrhdJEubX150R3/CTwGP1BjOYtcRpSN5ZVzM0W4TvNCJjNCZY= X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1194; 31:ZaP9qwoDvJI+RoqTx8nhbOscl4gITJwAmMDMyqUWnSp0lO01t+PFdbCMnWJlPxl5OufwNujwhrC35oCKXpEu4IMVq9zTwygKey8yHmR4lVdJdJKhUo/+ucPbvkSxKQDbHncGzuCf2P1nSdcOPWWzIso8zXNAB7v6PCU0/mDfikVfw6TpKb6ztse7DJUaDJOc4Gd10307WasMpBEfdUqGDCdN/eNfYPF5nfx4vu5+W3NqBJbajRMAcBzTOaW/IFaP 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)(5005006)(13016025)(8121501046)(13018025)(10201501046)(3002001)(100000703101)(100105400095)(93006095)(93001095)(6055026)(6096035)(20161123556025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123565025)(20161123563025)(20161123559100)(20161123561025)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:CY1PR0301MB1194; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(400006)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:CY1PR0301MB1194; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1194; 4:+FTkVbFsA3TdI3GBIULcDtj9a0az+qcOlyq8t2pw?= =?us-ascii?Q?SV4lqB5Jn0a4XhhnD9Kd5me/uqjTCORMrL86Vq42h+mdi4dBlTuopBEXNA31?= =?us-ascii?Q?mvo+9eRrppdgEamafUuqdG3lhrpI+qnqFWKWc0vQhsEiW82p5SO4fZF5Ptjp?= =?us-ascii?Q?E/un2zLtNENkXfLWeDfiqjyyaS0ae5ZqY/gunYNToUfdV37uvQKO7fIk06UD?= =?us-ascii?Q?qyh/u4DNQYbnTWrcJJk1A2Hyg2dtlVZuiQ9yGVNIMRTEBsfwAW8osDoMhJCc?= =?us-ascii?Q?cIdbzE8C6mlj0zf9/MpWqt2KIDwlNHk1cu5O253F4BmDdvBduW0eLHm8L/hL?= =?us-ascii?Q?/qZ15ZzK4eR/EgMvJM7N5esXtiOybXj98cuT0E5PoM3J+KShWxulBYmuoWHS?= =?us-ascii?Q?x1ia/b5mG9NdWHjRdCESHHlEIvfAHa3LYGiZOQZfO2J3GIslxhq4AHvWILI7?= =?us-ascii?Q?ycRcUOgmNF52VrVFS27V8OZN7UCpCZtMXRjFsYsiUP5xDs/kRZ6HwO6RZMQL?= =?us-ascii?Q?cpPCCKHdLKNX+42iP0GPssDhbUpVfz80aGT0DvQ3xoBu+UwXvbhacZq6K2u3?= =?us-ascii?Q?/CFDp0R8YYUnvBm6LpEEknZKc4YngmzcuV80hYXSk5BuxT48HT/aPdDU6CkA?= =?us-ascii?Q?5HGZW0ofe6fg9MltvQq9By0fDqjFih+KzytC7SRUbWxc6B/DeJsGCHiwUzf1?= =?us-ascii?Q?ztlW6c6nGEzkK7Ipm0qeIbGzy8dX96WuQr7sYUbLfo76PjEVcofm4VZXMHyO?= =?us-ascii?Q?RHpTCXbFiCcMvJGuYAReZrC+TWerXJYMPr4xiAm6poEtIXCP1mzZS+uXRY6U?= =?us-ascii?Q?N5XzF5gGRRQ8BRkL3Eb880V9M4Oqf5VgM+SWlxAxvR8EJZ/N46JtOZpTp5xT?= =?us-ascii?Q?H0nGXmlG2nvcIZybmMnIAkWaJQQq2Vfk7AjBClHZPUd6ca3QXp74asmm9d4z?= =?us-ascii?Q?sNMzIPsbkIF0wtpJHpHD3hfH/F8ILENfH9R9G8iad/qQbNkxdNS01ADWFHZV?= =?us-ascii?Q?MkQoZuq4p6ytf6xWIevPzSw5abF6RzjtdgOig+KRp9pbSRX1wzz2swXAfvLT?= =?us-ascii?Q?VdiOaf0syx9Jll6hJqDfBAKOCampZiHOeCBtX4Bvuf8S+UDVesdLQx5t1O9i?= =?us-ascii?Q?eUGXASYtwYfP9eF0yQWSHZl88aCPVc0DS2e4hyeQswKZUutvo5VmRNn3459u?= =?us-ascii?Q?WMvEpUKi+WWCU6H+8/SJGat//E+uSEdq2oCxL7tR8J0Q/eFWJPCaxZ6YlhfH?= =?us-ascii?Q?8NwZpOdJ4UezWfcbxqpfax84uHOrofVDMWW23duX?= X-Forefront-PRVS: 0340850FCD X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR0301MB1194; 23:jltaZ9W1po4f3BH4nOkSPH65WKE5bCdZjsLeyI6?= =?us-ascii?Q?55Kq93hbQGXmvdZwva3qaNljH3uH/S7Dmb/orgz/R28eanIIiGurBS7kEqLE?= =?us-ascii?Q?vgj/yr9X0CnUvkzUOnDkgHlnsJgP2+bd41Hpz3vH+HuXcZyjDwnDuQ+7rvFQ?= =?us-ascii?Q?VakWW4g4lVB1/RH5V8dqFkIqW99SrJS7ScFpcqhznCYORnIIV6wbEuGn5m5f?= =?us-ascii?Q?OCOemoWzACnn5Yq3fFTTl8PQmT/JK9JowwIf2yzWtANqQs82xTqPbXMUQfnT?= =?us-ascii?Q?dml4Z2MKshuhPWnMtm5aVFaUa5uru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wouEddJ0KjqLHOOSltiek6NMT2I3y4GX2ybBoBjD1a/SWGzm7FyXCGVxl3UL6Kwk6IxWI3FSHQUztTHEt+dOh4RBAD61kmAwfC/Rg32W9I2TzAvy3QnwkirlD86qnnvsm5W6f8Xa2ihZE3TTndAukUEbX4wG4MaY04LSXiX4d1/8NRiuL4av+x8djCOX5i2j3K8Dy6F1JtR7WbXGuVnzvZ3nlc+gshpOpWWYUA==; 24:82U5f9djDK3QagKPWh97hJi9maVJsP2uihEHoOuVzghgiRlNp7fxeY4EUdvMG2G6zfjw5B15Y/+HSXus1SPZjtDmQuUdlPQIor9GHutMPR8= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR0301MB1194; 7:BrWwDWFbAWg3pKySxPsqi2M9cmU+gYKmMOyiMG2igooOh1Ks36w06QdckHs+lEOG4ekj2fkj2Xl3CHLG+oZ/7QNdazG4Ya0GU//COg34lagzQPyvFYJcWeSr++TNpO5usKpxElfmhK5bp66Ii5CiR1/eV2WYb+zibTV9Qi0h9D0ObBIOnb1AuzjKOTQgUG3JWiaO1QbsjR6Ma968EOSwiFTDZ7JegwI7dhDTctxruuRV734STlgZiEHP4icQtvxgTbHQ8FVPUpnDAEKg9a+ZRUQo2Kx+bQBfivKRLgxpZD6ZgtJwJYIfM/ngLuEQvPxukF7YvHhgBpPhZYYhfm4KVw== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jun 2017 05:32:33.7522 (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: CY1PR0301MB1194 Subject: [dpdk-dev] [PATCH 04/38] bus/dpaa: add compatibility and helper macros 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:38 -0000 From: Hemant Agrawal Linked list, bit operations and compatibility macros. Signed-off-by: Geoff Thorpe Signed-off-by: Hemant Agrawal --- drivers/bus/dpaa/include/compat.h | 330 +++++++++++++++++++++++++++++++++++ drivers/bus/dpaa/include/dpaa_bits.h | 65 +++++++ drivers/bus/dpaa/include/dpaa_list.h | 101 +++++++++++ 3 files changed, 496 insertions(+) create mode 100644 drivers/bus/dpaa/include/compat.h create mode 100644 drivers/bus/dpaa/include/dpaa_bits.h create mode 100644 drivers/bus/dpaa/include/dpaa_list.h diff --git a/drivers/bus/dpaa/include/compat.h b/drivers/bus/dpaa/include/compat.h new file mode 100644 index 0000000..ce6136e --- /dev/null +++ b/drivers/bus/dpaa/include/compat.h @@ -0,0 +1,330 @@ +/*- + * 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 2011 Freescale Semiconductor, Inc. + * 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 __COMPAT_H +#define __COMPAT_H + +#include + +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* The following definitions are primarily to allow the single-source driver + * interfaces to be included by arbitrary program code. Ie. for interfaces that + * are also available in kernel-space, these definitions provide compatibility + * with certain attributes and types used in those interfaces. + */ + +/* Required compiler attributes */ +#define __maybe_unused __rte_unused +#define __always_unused __rte_unused +#define __packed __rte_packed +#define noinline __attribute__((noinline)) + +#define L1_CACHE_BYTES 64 +#define ____cacheline_aligned __attribute__((aligned(L1_CACHE_BYTES))) +#define __stringify_1(x) #x +#define __stringify(x) __stringify_1(x) + +#ifdef ARRAY_SIZE +#undef ARRAY_SIZE +#endif +#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) + +/* Debugging */ +#define prflush(fmt, args...) \ + do { \ + printf(fmt, ##args); \ + fflush(stdout); \ + } while (0) + +#define pr_crit(fmt, args...) prflush("CRIT:" fmt, ##args) +#define pr_err(fmt, args...) prflush("ERR:" fmt, ##args) +#define pr_warn(fmt, args...) prflush("WARN:" fmt, ##args) +#define pr_info(fmt, args...) prflush(fmt, ##args) + +#define ASSERT(x) do {\ + if (!(x)) \ + rte_panic("DPAA: x"); \ +} while (0) +#define BUG_ON(x) ASSERT(!(x)) + +/* Required types */ +typedef uint8_t u8; +typedef uint16_t u16; +typedef uint32_t u32; +typedef uint64_t u64; +typedef uint64_t dma_addr_t; +typedef cpu_set_t cpumask_t; +typedef uint32_t phandle; +typedef uint32_t gfp_t; +typedef uint32_t irqreturn_t; + +#define IRQ_HANDLED 0 +#define request_irq qbman_request_irq +#define free_irq qbman_free_irq + +#define __iomem +#define GFP_KERNEL 0 +#define __raw_readb(p) (*(const volatile unsigned char *)(p)) +#define __raw_readl(p) (*(const volatile unsigned int *)(p)) +#define __raw_writel(v, p) {*(volatile unsigned int *)(p) = (v); } + +/* SMP stuff */ +#define DEFINE_PER_CPU(t, x) __thread t per_cpu__##x +#define get_cpu_var(x) per_cpu__##x +/* to be used as an upper-limit only */ +#define NR_CPUS 64 + +/* Waitqueue stuff */ +typedef struct { } wait_queue_head_t; +#define DECLARE_WAIT_QUEUE_HEAD(x) int dummy_##x __always_unused +#define wake_up(x) do { } while (0) + +/* I/O operations */ +static inline u32 in_be32(volatile void *__p) +{ + volatile u32 *p = __p; + return rte_be_to_cpu_32(*p); +} + +static inline void out_be32(volatile void *__p, u32 val) +{ + volatile u32 *p = __p; + *p = rte_cpu_to_be_32(val); +} + +#define dcbt_ro(p) __builtin_prefetch(p, 0) +#define dcbt_rw(p) __builtin_prefetch(p, 1) + +#define dcbz(p) { asm volatile("dc zva, %0" : : "r" (p) : "memory"); } +#define dcbz_64(p) dcbz(p) +#define hwsync() rte_rmb() +#define lwsync() rte_wmb() +#define dcbf(p) { asm volatile("dc cvac, %0" : : "r"(p) : "memory"); } +#define dcbf_64(p) dcbf(p) +#define dccivac(p) { asm volatile("dc civac, %0" : : "r"(p) : "memory"); } + +#define dcbit_ro(p) \ + do { \ + dccivac(p); \ + asm volatile("prfm pldl1keep, [%0, #64]" : : "r" (p)); \ + } while (0) + +#define barrier() { asm volatile ("" : : : "memory"); } +#define cpu_relax barrier + +static inline uint64_t mfatb(void) +{ + uint64_t ret, ret_new, timeout = 200; + + asm volatile ("mrs %0, cntvct_el0" : "=r" (ret)); + asm volatile ("mrs %0, cntvct_el0" : "=r" (ret_new)); + while (ret != ret_new && timeout--) { + ret = ret_new; + asm volatile ("mrs %0, cntvct_el0" : "=r" (ret_new)); + } + BUG_ON(!timeout && (ret != ret_new)); + return ret * 64; +} + +/* Spin for a few cycles without bothering the bus */ +static inline void cpu_spin(int cycles) +{ + uint64_t now = mfatb(); + + while (mfatb() < (now + cycles)) + ; +} + +/* Qman/Bman API inlines and macros; */ +#ifdef lower_32_bits +#undef lower_32_bits +#endif +#define lower_32_bits(x) ((u32)(x)) + +#ifdef upper_32_bits +#undef upper_32_bits +#endif +#define upper_32_bits(x) ((u32)(((x) >> 16) >> 16)) + +#define cpu_to_be64(d) rte_cpu_to_be_64(d) +#define cpu_to_be32(d) rte_cpu_to_be_32(d) +#define cpu_to_be16(d) rte_cpu_to_be_16(d) + +#define be64_to_cpu(d) rte_be_to_cpu_64(d) +#define be32_to_cpu(d) rte_be_to_cpu_32(d) +#define be16_to_cpu(d) rte_be_to_cpu_16(d) + +#define cpu_to_be48(x) rte_cpu_to_be_48(x) +#define be48_to_cpu(x) rte_be_to_cpu_48(x) + +#define cpu_to_be40(x) rte_cpu_to_be_40(x) +#define be40_to_cpu(x) rte_be_to_cpu_40(x) + +#define cpu_to_be24(x) rte_cpu_to_be_24(x) +#define be24_to_cpu(x) rte_be_to_cpu_24(x) + +/* When copying aligned words or shorts, try to avoid memcpy() */ +/* memcpy() stuff - when you know alignments in advance */ +#define CONFIG_TRY_BETTER_MEMCPY + +#ifdef CONFIG_TRY_BETTER_MEMCPY +static inline void copy_words(void *dest, const void *src, size_t sz) +{ + u32 *__dest = dest; + const u32 *__src = src; + size_t __sz = sz >> 2; + + BUG_ON((unsigned long)dest & 0x3); + BUG_ON((unsigned long)src & 0x3); + BUG_ON(sz & 0x3); + while (__sz--) + *(__dest++) = *(__src++); +} + +static inline void copy_shorts(void *dest, const void *src, size_t sz) +{ + u16 *__dest = dest; + const u16 *__src = src; + size_t __sz = sz >> 1; + + BUG_ON((unsigned long)dest & 0x1); + BUG_ON((unsigned long)src & 0x1); + BUG_ON(sz & 0x1); + while (__sz--) + *(__dest++) = *(__src++); +} + +static inline void copy_bytes(void *dest, const void *src, size_t sz) +{ + u8 *__dest = dest; + const u8 *__src = src; + + while (sz--) + *(__dest++) = *(__src++); +} +#else +#define copy_words memcpy +#define copy_shorts memcpy +#define copy_bytes memcpy +#endif + +/* Allocator stuff */ +#define kmalloc(sz, t) malloc(sz) +#define vmalloc(sz) malloc(sz) +#define kfree(p) { if (p) free(p); } +static inline void *kzalloc(size_t sz, gfp_t __foo __rte_unused) +{ + void *ptr = malloc(sz); + + if (ptr) + memset(ptr, 0, sz); + return ptr; +} + +static inline unsigned long get_zeroed_page(gfp_t __foo __rte_unused) +{ + void *p; + + if (posix_memalign(&p, 4096, 4096)) + return 0; + memset(p, 0, 4096); + return (unsigned long)p; +} + +/* Spinlock stuff */ +#define spinlock_t rte_spinlock_t +#define __SPIN_LOCK_UNLOCKED(x) RTE_SPINLOCK_INITIALIZER +#define DEFINE_SPINLOCK(x) spinlock_t x = __SPIN_LOCK_UNLOCKED(x) +#define spin_lock_init(x) rte_spinlock_init(x) +#define spin_lock_destroy(x) +#define spin_lock(x) rte_spinlock_lock(x) +#define spin_unlock(x) rte_spinlock_unlock(x) +#define spin_lock_irq(x) spin_lock(x) +#define spin_unlock_irq(x) spin_unlock(x) +#define spin_lock_irqsave(x, f) spin_lock_irq(x) +#define spin_unlock_irqrestore(x, f) spin_unlock_irq(x) + +#define atomic_t rte_atomic32_t +#define atomic_read(v) rte_atomic32_read(v) +#define atomic_set(v, i) rte_atomic32_set(v, i) + +#define atomic_inc(v) rte_atomic32_add(v, 1) +#define atomic_dec(v) rte_atomic32_sub(v, 1) + +#define atomic_inc_and_test(v) rte_atomic32_inc_and_test(v) +#define atomic_dec_and_test(v) rte_atomic32_dec_and_test(v) + +#define atomic_inc_return(v) rte_atomic32_add_return(v, 1) +#define atomic_dec_return(v) rte_atomic32_sub_return(v, 1) +#define atomic_sub_and_test(i, v) (rte_atomic32_sub_return(v, i) == 0) + +#include +#include + +#endif /* __COMPAT_H */ diff --git a/drivers/bus/dpaa/include/dpaa_bits.h b/drivers/bus/dpaa/include/dpaa_bits.h new file mode 100644 index 0000000..e29019b --- /dev/null +++ b/drivers/bus/dpaa/include/dpaa_bits.h @@ -0,0 +1,65 @@ +/*- + * BSD LICENSE + * + * 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 NXP nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 + * OWNER 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 __DPAA_BITS_H +#define __DPAA_BITS_H + +/* Bitfield stuff. */ +#define BITS_PER_ULONG (sizeof(unsigned long) << 3) +#define SHIFT_PER_ULONG (((1 << 5) == BITS_PER_ULONG) ? 5 : 6) +#define BITS_MASK(idx) (1UL << ((idx) & (BITS_PER_ULONG - 1))) +#define BITS_IDX(idx) ((idx) >> SHIFT_PER_ULONG) + +static inline void dpaa_set_bits(unsigned long mask, + volatile unsigned long *p) +{ + *p |= mask; +} + +static inline void dpaa_set_bit(int idx, volatile unsigned long *bits) +{ + dpaa_set_bits(BITS_MASK(idx), bits + BITS_IDX(idx)); +} + +static inline void dpaa_clear_bits(unsigned long mask, + volatile unsigned long *p) +{ + *p &= ~mask; +} + +static inline void dpaa_clear_bit(int idx, + volatile unsigned long *bits) +{ + dpaa_clear_bits(BITS_MASK(idx), bits + BITS_IDX(idx)); +} + +#endif /* __DPAA_BITS_H */ diff --git a/drivers/bus/dpaa/include/dpaa_list.h b/drivers/bus/dpaa/include/dpaa_list.h new file mode 100644 index 0000000..7ad0f14 --- /dev/null +++ b/drivers/bus/dpaa/include/dpaa_list.h @@ -0,0 +1,101 @@ +/*- + * BSD LICENSE + * + * 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 NXP nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * 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 + * OWNER 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 __DPAA_LIST_H +#define __DPAA_LIST_H + +/****************/ +/* Linked-lists */ +/****************/ + +struct list_head { + struct list_head *prev; + struct list_head *next; +}; + +#define COMPAT_LIST_HEAD(n) \ +struct list_head n = { \ + .prev = &n, \ + .next = &n \ +} + +#define INIT_LIST_HEAD(p) \ +do { \ + struct list_head *__p298 = (p); \ + __p298->next = __p298; \ + __p298->prev = __p298->next; \ +} while (0) +#define list_entry(node, type, member) \ + (type *)((void *)node - offsetof(type, member)) +#define list_empty(p) \ +({ \ + const struct list_head *__p298 = (p); \ + ((__p298->next == __p298) && (__p298->prev == __p298)); \ +}) +#define list_add(p, l) \ +do { \ + struct list_head *__p298 = (p); \ + struct list_head *__l298 = (l); \ + __p298->next = __l298->next; \ + __p298->prev = __l298; \ + __l298->next->prev = __p298; \ + __l298->next = __p298; \ +} while (0) +#define list_add_tail(p, l) \ +do { \ + struct list_head *__p298 = (p); \ + struct list_head *__l298 = (l); \ + __p298->prev = __l298->prev; \ + __p298->next = __l298; \ + __l298->prev->next = __p298; \ + __l298->prev = __p298; \ +} while (0) +#define list_for_each(i, l) \ + for (i = (l)->next; i != (l); i = i->next) +#define list_for_each_safe(i, j, l) \ + for (i = (l)->next, j = i->next; i != (l); \ + i = j, j = i->next) +#define list_for_each_entry(i, l, name) \ + for (i = list_entry((l)->next, typeof(*i), name); &i->name != (l); \ + i = list_entry(i->name.next, typeof(*i), name)) +#define list_for_each_entry_safe(i, j, l, name) \ + for (i = list_entry((l)->next, typeof(*i), name), \ + j = list_entry(i->name.next, typeof(*j), name); \ + &i->name != (l); \ + i = j, j = list_entry(j->name.next, typeof(*j), name)) +#define list_del(i) \ +do { \ + (i)->next->prev = (i)->prev; \ + (i)->prev->next = (i)->next; \ +} while (0) + +#endif /* __DPAA_LIST_H */ -- 2.7.4