Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932767AbcLPAE1 (ORCPT ); Thu, 15 Dec 2016 19:04:27 -0500 Received: from mail-sn1nam01on0065.outbound.protection.outlook.com ([104.47.32.65]:26786 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932670AbcLPAEW (ORCPT ); Thu, 15 Dec 2016 19:04:22 -0500 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;nxp.com; dkim=none (message not signed) header.d=none; X-IncomingTopHeaderMarker: OriginalChecksum:;UpperCasedChecksum:;SizeAsReceived:961;Count:10 From: Stuart Yoder To: CC: , , , , , , , , , , Roy Pledge , Stuart Yoder Subject: [PATCH v4 4/8] bus: fsl-mc: dpio: add global dpaa2 definitions Date: Thu, 15 Dec 2016 17:56:22 -0600 Message-ID: <1481846186-7783-5-git-send-email-stuart.yoder@nxp.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1481846186-7783-1-git-send-email-stuart.yoder@nxp.com> References: <1481846186-7783-1-git-send-email-stuart.yoder@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131263202597240634;(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)(7916002)(39840400002)(39450400003)(39380400002)(39860400002)(39400400002)(39850400002)(39410400002)(2980300002)(1110001)(1109001)(339900001)(189002)(199003)(4326007)(81166006)(8936002)(105606002)(81156014)(97736004)(33646002)(106466001)(5003940100001)(5660300001)(2351001)(8676002)(189998001)(85426001)(7416002)(2950100002)(626004)(6666003)(47776003)(6916009)(110136003)(50986999)(48376002)(8666005)(86362001)(50466002)(68736007)(76176999)(92566002)(38730400001)(36756003)(77096006)(50226002)(305945005)(356003)(104016004)(2906002)(7059030)(2004002);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR0301MB0746;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BN1BFFO11FD034;1:wZeCj07RpsAJB4clRbikkUzP90iu1ehVJHaIX+VBvNq7xk+pPPuYQrSozS5loUmofz1+UditxIudzO5YP6uAWitH2bYzkAPRHW4HU68kddq38Cc3QspoVqpHrs8Q6uP3Da6LOUl6dWBvvC/8wcfbsH4bCbxrMrfrohNugu6EB1knJt73NsMywTGjTcRQPlPVoHSgR9DWBB1B8sWwORUYLhvLriCu3A6dDLo3Pt+IVzac1KUodCKYCta9vNkJAyl+WysvnbF7aSqdoSwZXOkNire1aBJ83HIdXjhSew32wobJt7gQWLuuYJqzCabTTMkpzLYqWrlS8x+VDL6hY8+2B3+WIiJeXYVcDusrrUb8bC2Tzn3RMrhcrfXMe1U6vDsrm4O/3hJGXYvfoLLbdISEgBwDG0TlFidVPRGB99D9VZspz6fskMFBW1w9mRSmSq8s5FhNPnmhz5SrA9MoahHAV+cY23egVzcImM903WITQlMVBsJk69H0KmapAWLGkdcdy7yJm6JOaMRumrcwEbWRMq38n8rg47cW+yt2/J3M+OnljoIAygehaVkuM05mEfSbMpAyR6SDS6IIDJZNt2ucE9orLN4ZpgUfW9qLxRzJoK6zKcT3uDEjCETKhzKxGxw/OFbwa4tMmjmNuiHfPzy4s3reFlZa9hAOFL6BSNb9LCtH9PTntkzHkME6on+DqaYLc/z7ssZ9NHTvXmuEiHq//gDxwyP698KbaRE5+lKCZrQ= MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: abd662ab-2c13-4db3-1dd9-08d425471558 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR0301MB0746; X-Microsoft-Exchange-Diagnostics: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PTNPWJ8cHQAzP8WAJ+PNR4b0o+eCHfviHZAmlFtdqUf+lE9+hOM8YvL3OvlZCUoRKRdFvTM+XRArXLck1zu69hlnC+38ffoVVLihmZqIDGhlz61uYcAUTJlzHUCFJN7S9QbXxtEnxtb2tXEMwhlz7WZcgATJpnWzMXt+eUMUcIDhg31l90= X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB0746;31:TZCA6vId6kk7LculA0mvD2k0IBTl1O9ts8rSRvBFoL9xqEodyC5k0QpvtqBNXsUO7Kkw5Y0+8wdsoHzJFrBNM/l32RoH5WpHqe+HhymBs5ORrUt6nZw4KMxnf7CEFB4Ei4d6HuyDh6SrYT+qDXiU9J0B0P0FHAhzNXsXU4vrnUzyIqPNFFjoPWOcFPyvhrOKPRgNQ93NyvLeqPMnwhJ7rnGmz/Oh15kj1H6uRMCXsG3mTqD4jNJnU1UZzfeN3fx8RZOYZGuYLnO9zO6FLqFM3Sa00izpjuUsc3+zpBVXWoI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6095060)(601004)(2401047)(8121501046)(5005006)(13017025)(13018025)(13015025)(13024025)(13023025)(10201501046)(3002001)(6055026)(6096035)(20161123561025)(20161123565025)(20161123556025)(20161123563025)(20161123559025);SRVR:CY1PR0301MB0746;BCL:0;PCL:0;RULEID:(400006);SRVR:CY1PR0301MB0746; X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB0746;4:Ai25LqcXfBis9LHHfKS9ixWBnpa46+LJXZ0gQXsH9CJctLF2Kvb8G8hziO4Ce4bnzR8v0L/WJhgSqDjB6PJzrx+6h5/CmsieRgg6bcy+oq8p3zVgf802S6UvA8a+G/G5kEk6rFyg24owtEZluIrb1BiRevz4cUygMA9dFpDXW4xoP1ETP9lKFip5NaXK08pa/KBNNqgEsemMSpK/uCDc0HjN489ICvd7blo21ZHmpll6iQ2PUmGAb+ILee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rvIvPSzEShHA02flywVplUwtVi?= =?us-ascii?Q?mPHNUMrUkfgf6o9fYRZMEayM=3D?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB0746;6:b1zGa8WN1s7eCkdp1sBxu+A7NjsKx0jCVa1NOD2ptKVX5D/uDCcFQ1TIZoMfu6JP+gCAbsSpvTMU6TZHtuGzZW8q5wsLLwO37CLJq8Lj/JvPgT6VZEa10/LRqqCoSmd8t60y+ltKzNeMuyQ40xWoW90Xfk3LyspqkVBHd6433ND4xojUJo3zW3KNiFXDVsoBMKok9D3hXe3QjozpRWPwbhvf4RLv56XipI7wdPzfVn+2NsIb6MvJN21aWuIazTpulPHlKTD3fQNMeOkxFxaEGh1v31a6PQLGzOpzqsVU4CzbDIQiKpzFdrfOSD3XDYioI6hMPRI3qI09R8oXUGNumOck3lGcGbol5vbmDzRXY/C3fM6hAs+Pse7a1Fx62L4j0rgoK97Omo9yutCPZVh4gmF3DUvriNi2iiZiCTvQNSVq3Wx9ZsPnnR01q0J6PxCl;5:ssfWalW1PjiJLGgmUJTpzxoejGwCMRMJmoUZJ4aQWZxo2g22U7bqDTNyrEe92HnyVTRuTK8W/T/2wpV7LEwhHchHdCyIaoWr4c1opbJSJgvYNIlH27Xb6R2k+8xH0uHk/g9zaCRJNBLdtAK32WJCI0rqQ2PbxvK+Vy/tCCkpt1OB48iTdmXW7H1tA4q8x8v9;24:Ffg893iGO7kfNaOEaopLMpLfFqubhMvVWwxnJqqfjBHhBJE0sSc+ckkw5OSao63im6A+gZztOmia3qMgiEbxxWNvpQxzjKpv4h8DHoe/5rE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;CY1PR0301MB0746;7:k1FTix5n2lEyiKkGJAfXrelpbHvWxTeB1KeGIiglSCNYaKLf37n+IE4Frgf1SThmWh0Z/HdT4M+bTHKxc7jbeLv9kLCi6eTuOx64SfouvcPfXpkGG0icALHsQj25R6b+LpvkMQZ7f1uY7TukQip2Ak5z/8WpxR38fLBlesQg4fxK0nh6kiptwHNHyOFUwfvkHNrzqPrwWWJBWYNCFZMLMmusVEzqnehAZG1mx7u4cJJApjiA6Z/3cTDNOJiCAjesK4eJ0EE2oOFrxs5LBNmpAzABSF1puvThKm3FOZN1lbH56EP10jBh5rb57RN1DBlHrL42LX4L0mfPl2ENaPr95FsQP5oDR+w+ztCYz1iAzH9KnspIJw0HqvAMv9Sg4vGJ+qqqoQewDfyefZHPFL3Cyo/SfY0KurD2jhNbGuMARmA+3/3kFJCmbHwuvjqYB/O3FuMoDtKz0Eb5iAewz6JGKQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Dec 2016 00:04:14.4512 (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: CY1PR0301MB0746 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 6646 Lines: 230 From: Roy Pledge Create header for global dpaa2 definitions. Add definitions for dequeue results. Signed-off-by: Roy Pledge Signed-off-by: Stuart Yoder --- Notes: -v4 -adjust file location to be in drivers/staging -whitespace/alignment cleanup, make dpaa2_dq_is_pull_complete() return bool, fix spelling typo -updated copyright drivers/staging/fsl-mc/include/dpaa2-global.h | 202 ++++++++++++++++++++++++++ 1 file changed, 202 insertions(+) create mode 100644 drivers/staging/fsl-mc/include/dpaa2-global.h diff --git a/drivers/staging/fsl-mc/include/dpaa2-global.h b/drivers/staging/fsl-mc/include/dpaa2-global.h new file mode 100644 index 0000000..0326447 --- /dev/null +++ b/drivers/staging/fsl-mc/include/dpaa2-global.h @@ -0,0 +1,202 @@ +/* + * Copyright 2014-2016 Freescale Semiconductor Inc. + * Copyright 2016 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 Freescale Semiconductor nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * 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 Freescale Semiconductor ``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 Freescale Semiconductor 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 __FSL_DPAA2_GLOBAL_H +#define __FSL_DPAA2_GLOBAL_H + +#include +#include +#include "dpaa2-fd.h" + +struct dpaa2_dq { + union { + struct common { + u8 verb; + u8 reserved[63]; + } common; + struct dq { + u8 verb; + u8 stat; + __le16 seqnum; + __le16 oprid; + u8 reserved; + u8 tok; + __le32 fqid; + u32 reserved2; + __le32 fq_byte_cnt; + __le32 fq_frm_cnt; + __le64 fqd_ctx; + u8 fd[32]; + } dq; + struct scn { + u8 verb; + u8 stat; + u8 state; + u8 reserved; + __le32 rid_tok; + __le64 ctx; + } scn; + }; +}; + +/* Parsing frame dequeue results */ +/* FQ empty */ +#define DPAA2_DQ_STAT_FQEMPTY 0x80 +/* FQ held active */ +#define DPAA2_DQ_STAT_HELDACTIVE 0x40 +/* FQ force eligible */ +#define DPAA2_DQ_STAT_FORCEELIGIBLE 0x20 +/* valid frame */ +#define DPAA2_DQ_STAT_VALIDFRAME 0x10 +/* FQ ODP enable */ +#define DPAA2_DQ_STAT_ODPVALID 0x04 +/* volatile dequeue */ +#define DPAA2_DQ_STAT_VOLATILE 0x02 +/* volatile dequeue command is expired */ +#define DPAA2_DQ_STAT_EXPIRED 0x01 + +#define DQ_FQID_MASK 0x00FFFFFF +#define DQ_FRAME_COUNT_MASK 0x00FFFFFF + +/** + * dpaa2_dq_flags() - Get the stat field of dequeue response + * @dq: the dequeue result. + */ +static inline u32 dpaa2_dq_flags(const struct dpaa2_dq *dq) +{ + return dq->dq.stat; +} + +/** + * dpaa2_dq_is_pull() - Check whether the dq response is from a pull + * command. + * @dq: the dequeue result + * + * Return 1 for volatile(pull) dequeue, 0 for static dequeue. + */ +static inline int dpaa2_dq_is_pull(const struct dpaa2_dq *dq) +{ + return (int)(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_VOLATILE); +} + +/** + * dpaa2_dq_is_pull_complete() - Check whether the pull command is completed. + * @dq: the dequeue result + * + * Return boolean. + */ +static inline bool dpaa2_dq_is_pull_complete(const struct dpaa2_dq *dq) +{ + return !!(dpaa2_dq_flags(dq) & DPAA2_DQ_STAT_EXPIRED); +} + +/** + * dpaa2_dq_seqnum() - Get the seqnum field in dequeue response + * @dq: the dequeue result + * + * seqnum is valid only if VALIDFRAME flag is TRUE + * + * Return seqnum. + */ +static inline u16 dpaa2_dq_seqnum(const struct dpaa2_dq *dq) +{ + return le16_to_cpu(dq->dq.seqnum); +} + +/** + * dpaa2_dq_odpid() - Get the odpid field in dequeue response + * @dq: the dequeue result + * + * odpid is valid only if ODPVALID flag is TRUE. + * + * Return odpid. + */ +static inline u16 dpaa2_dq_odpid(const struct dpaa2_dq *dq) +{ + return le16_to_cpu(dq->dq.oprid); +} + +/** + * dpaa2_dq_fqid() - Get the fqid in dequeue response + * @dq: the dequeue result + * + * Return fqid. + */ +static inline u32 dpaa2_dq_fqid(const struct dpaa2_dq *dq) +{ + return le32_to_cpu(dq->dq.fqid) & DQ_FQID_MASK; +} + +/** + * dpaa2_dq_byte_count() - Get the byte count in dequeue response + * @dq: the dequeue result + * + * Return the byte count remaining in the FQ. + */ +static inline u32 dpaa2_dq_byte_count(const struct dpaa2_dq *dq) +{ + return le32_to_cpu(dq->dq.fq_byte_cnt); +} + +/** + * dpaa2_dq_frame_count() - Get the frame count in dequeue response + * @dq: the dequeue result + * + * Return the frame count remaining in the FQ. + */ +static inline u32 dpaa2_dq_frame_count(const struct dpaa2_dq *dq) +{ + return le32_to_cpu(dq->dq.fq_frm_cnt) & DQ_FRAME_COUNT_MASK; +} + +/** + * dpaa2_dq_fd_ctx() - Get the frame queue context in dequeue response + * @dq: the dequeue result + * + * Return the frame queue context. + */ +static inline u64 dpaa2_dq_fqd_ctx(const struct dpaa2_dq *dq) +{ + return le64_to_cpu(dq->dq.fqd_ctx); +} + +/** + * dpaa2_dq_fd() - Get the frame descriptor in dequeue response + * @dq: the dequeue result + * + * Return the frame descriptor. + */ +static inline const struct dpaa2_fd *dpaa2_dq_fd(const struct dpaa2_dq *dq) +{ + return (const struct dpaa2_fd *)&dq->dq.fd[0]; +} + +#endif /* __FSL_DPAA2_GLOBAL_H */ -- 1.9.0