From patchwork Wed Apr 19 15:37:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Akhil Goyal X-Patchwork-Id: 23751 X-Patchwork-Delegate: pablo.de.lara.guarch@intel.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 258CA69C6; Wed, 19 Apr 2017 17:38:32 +0200 (CEST) Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-sn1nam01on0068.outbound.protection.outlook.com [104.47.32.68]) by dpdk.org (Postfix) with ESMTP id 96419567F for ; Wed, 19 Apr 2017 17:38:15 +0200 (CEST) Received: from DM2PR03CA0005.namprd03.prod.outlook.com (10.141.96.15) by CY1PR03MB2284.namprd03.prod.outlook.com (10.166.207.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Wed, 19 Apr 2017 15:38:13 +0000 Received: from BN1AFFO11FD033.protection.gbl (2a01:111:f400:7c10::157) by DM2PR03CA0005.outlook.office365.com (2a01:111:e400:2428::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1047.13 via Frontend Transport; Wed, 19 Apr 2017 15:38:13 +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 BN1AFFO11FD033.mail.protection.outlook.com (10.58.52.246) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1019.14 via Frontend Transport; Wed, 19 Apr 2017 15:38:12 +0000 Received: from bf-netperf1.ap.freescale.net (bf-netperf1.ap.freescale.net [10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id v3JFbvDT023764; Wed, 19 Apr 2017 08:38:11 -0700 From: To: CC: , , Date: Wed, 19 Apr 2017 21:07:41 +0530 Message-ID: <1492616268-6307-7-git-send-email-akhil.goyal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1492616268-6307-1-git-send-email-akhil.goyal@nxp.com> References: <20170410123108.26305-1-akhil.goyal@nxp.com> <1492616268-6307-1-git-send-email-akhil.goyal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131370898930891456; (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)(39400400002)(39410400002)(39850400002)(39380400002)(39860400002)(39450400003)(39840400002)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(45074003)(9170700003)(2950100002)(6916009)(8936002)(53946003)(48376002)(33646002)(2351001)(104016004)(5660300001)(50466002)(50226002)(53936002)(6666003)(81166006)(105606002)(38730400002)(36756003)(106466001)(85426001)(110136004)(189998001)(8676002)(2906002)(305945005)(2876002)(8656002)(5003940100001)(54906002)(86152003)(76176999)(356003)(86362001)(50986999)(47776003)(4326008)(77096006)(2004002)(559001)(579004); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR03MB2284; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD033; 1:ulpCCZrzj0bifwQ/fUxQXH1iXwbBHa76MIv+Ga9s0d6/eXxZPiN6bTxTXx2AB+fcXeYmMckAmvq94VmZNQZmS7yD8fTkNO8fFObnc588e7vO1SSUR3uQVZ48Y6AJeNwdQNCJqAXLO6ab6CzGD4ABXrDB989lGx68SQVceuVh/Lx1bsvThwZFW0Rtngjwpb/Xjz0b37stbzZuOiol5Vq70cgeALVtZynj+1d1rm4PuGJBw2elTa3QmMyDSxUVEFNicIkJex0oNcszrk7CdnnXiLGe19zrPKaDIzm4gpF/Fz0upw9EAmbxh3zEoKpQeq7I+4NJwnoTMjUiKHDFkanx5fUowNv7HA1JnsjYaWE33M9daYNAIdByyvvJPgpRP9gcpvG59RqEJBv5YfSWD5T8lEy8Vw2b0CQWWjYHVMEQcO3xJiLViXBLACUNYKMnAEW6/LHT/E2SlM07MVwSKqwQ61OPpDN7d5u7ke2/7WyM4KT2cPo4kK2EoFbIqVwR/DFzAZ60iBeCWqZmfpEb+uqLG+Mr9KVqAnxmWgvAcrO2YpkNyqsjHL+eUDl1CzJGZtUsm44J+gAj1KrtgDwhfz3E0KFsxvnOmQasw4pNlF+ENTI5D4yOSwcV1lHRuRTaDMGInYEhLDt+ysiSoRveDN2n0IrCdNpvsW6lg1gzbPpruoXhzObcBQFdBBSvRpYe1bZUo6l90A7F44ZmIw7ezkdIvJ4WEINgJlszbPRER0x+8Hsi0U3UtvBHSgn64tiyJUAW9k5UHTUTh2l62tpicGLqVw== MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 566ffb7d-0e20-41f9-1960-08d4873a170e X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:CY1PR03MB2284; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2284; 3:YR9NSBZfBy5DacLIV/dAi7hN4Wg3SsIMYeNbyrBimqKF5N5m5jdYJFOgCAsizqdXpClmHEn6Hx56l5UFMcFJ4xNf8VYQ6K5d38JEKsSd3u2rPMhCedQGW6+4OhmUixa2hCrQDEiPhJvfhu5UNHzJ3i/bbvbMl6SyePGWunPg4J0mNCgeRcBPrIh913Yqw0UxNXZSo9Px5rgHiSRq8tHJJ66IOefBPfxJ20RqTcq2uqCMeAYPkZG5yf7L9JMQyQt9Gm2OW3We73Ajxg7cjYal2VZcHbrKnnp02PPJxv0nn5sAjdl4glZv1gAncNyOyXkKiVv5Wd2v76Y+3p/8aS2Ok8xUIdSNsb8i5vPe5B04m+CowM+SxNihuGrRyccycnu3kJh3lBv9gd3vRIsJCS60UMN7lZUCaVEfezG5d60Om9oZGsw6mLIhpXjvPip44J9z; 25:SOdxJZipfQkMZGgVJKyvwCrvd//9OY6nj9lKxan8SB/7WXxn21aXspW6f2pWKy3b3UeRMovJmz8ejhDsXFvl7TUjHV56rvSvzyHVHD5fYXwNHYJka28euuskb6M+t079KdzUstAP6RQJbMEKfylkZqBtBOu0qCE89YFG4TEin0yIMScFPxJiyCHyPz+jCkwR2k2IKIIWd3qn8VoLyfZRR7KzILhIFbkeaVapDf3cGXPR+4zMx4FrMMZ+CjAlblQhi3DkoXCAtpB9oSqlAjv2fXpAfotv5rxwHhJHk7ZPIrPl5u9OLxVjX5/aP0CSRD23Yz8zrQy97TCR+PDcmfwn3J1lykXdkO7lNjEmMDCWEI5KG1xluesYxEWW0J11ipsJUzBB+CT9/17paYZkKtP14Qu3Yblr6ij7RkGNSs+/vHeaC/aKiThPYxSyCpq8qzJqk9lwTDnUOz7K0P9E1UHgBw== X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2284; 31:luWyXJhxLHlH/ctLTFCYKjoXyKUBTpMT8wFzgaU01nZZx0DILdZBt10caD0JHr4hL7XJEfjxrIvnkAyYCCJpeBm6sYlowd6CAOd5/Mk5NkK/6OQNwmMJBjLFuY76tU+SvTeLTpjWmgVaZwZvP1zgKkDlJCrp2hNCQNiqgsuvfog2xnj6ikz3yYXgoPlY3h0Y2rJce1I+ZhlSZ202COTceKaVeTixRZGL5EoTsMX9Zpy4V2MT0oGp/tjH2ezr3C4bCiKjuOXrVDoWgj/3sfyKyw== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(13017025)(5005006)(8121501046)(13024025)(13023025)(13015025)(13018025)(93006095)(93001095)(3002001)(10201501046)(6055026)(6096035)(20161123565025)(20161123563025)(20161123556025)(20161123561025)(201703131430075)(201703131433075)(201703131448075)(201703161259150); SRVR:CY1PR03MB2284; BCL:0; PCL:0; RULEID:(400006); SRVR:CY1PR03MB2284; X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2284; 4:B4ewrli4lEtQiHxl7Rpp8LuXanFB8fid+6lT/3mRSB59FMYgQkvnb3v7pO1YAK18sFAoZs9KUQLc6pO5FbCKVL1p4GEbbemTU5igGdHnxCQSMwJ7K6SxlItmjDeIPNfnRwjEtvWUJZJmo6YrM34fcPgQQn28nUwzDeBFN7F8qyXQDBynabUTxnfZaLsHYd0GTWjv8eI3EKA+lbsp8pzd0abvh+psNirPOtwsrTee57suweKZkd2Nza+dFEU1ccCexKF9h1GEW/zXc1bT073R/bDrxQaSz2YFygodEwPj3mvrntKW780+NbHOLUlbiLmgbm5kChev0f5D9D8O8xTBEgHMlDZcFPfHh6jsyMAH9eOtcCBYVw/kaWz6TwERglSaA9E5Oz/E14NtRDnKf2bFDwdHxROIq0aHM1gWqr7gSXdvwsGJO1NV9m86gFf4OCm7xKzjDKY43Jof3SVaDOgrij8N5ru/uHPIDp1L0E7Bp8BQWlxY4vWjaeE43oOXeHITknsp33iJYI1+zlYPGb65f7iWyXZtA6zZZY4Ny+ESoDeAEOru0LYQuTK9wSxKy46iYMfOe82pzStXsLsoc7AHJ5MigxGfnr2zdOhpzNWoJhxodf7jm1bNx5FXU7pQ+M1r0zd0NDwzMTgn6+XjsBL1FXJDDypxiERBjvP7IDfFcqkXvADrzGr1Wv/l44N54KWdXtevWZvS8JKGOEgUJLO0HhvpbC1GZiY8HilC+z0vkk6UaUarqESbxEIk3BUhezl4y2n+aVW1J1obW9La2yXsPRdO9HEKHw+FsFScVysP/MXLcyKUKFgZFTVOliL+QHmDVf0ZcwKxRicl0G5ub9o5JGuiPMxOXo7qEZSj+B8urlqEGeEt/qfd1o3rx+O9IbeTwxxlZaEnGFn97+2FeoRY423Iv8Yx1jLQjnGfcL3CGQQ= X-Forefront-PRVS: 028256169F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; CY1PR03MB2284; 23:qtmkzK5wOqZY+xm7f3FXyA7CWYSdDqau4An1lVLX7?= UGBZnRNsGkWr+Ea9EkrakN/SQWzBg/VjfpjeSWNC5vpB3uesMpq9LpZkmAh2KNJkOQD8ecbwp0X5ZLedZiITjN04W8pUlLRJCchuxGmRYgTw9NvTrcrofGhDWF5/U1ypSiA7PhvafAOA9mgNlp37hBoFe+jKaEgDuH3MlUNfgm5Kb560Md7LcwLlo70EptsH8dmNYAm2UovinPJGka4kPW+CAlk+71JdVdchMjsdOyGEeAS3Qbx+T+fQERFWwk+gt2KOOCVFaaHHsOOVEuK0dTMG7ZgQPrOS0CshMQHZFavlxL2PzJZ4U3HIgTxHCJ3EhuNdDpbbUnDWDuKeNbNNqQIuW9SiPpOMfgEMi9WTq7j9EGCC4qcoz6qnk4h0Gq10H/uHbgzmMpl6BfWgF8snnOUP7vY70Y/3UIU05b5OWq7Meh2IPifipx8qvwKnL6cATdIhy1M3F57H89pkBS65AlsrUXLGEChvr3Isl3NXjjnz1voiCAn9mjY+zjDHjQ3s/mYb3PEgVv+l02PJmqaIcZQoF6T6xKTe+ddabofoQ8JtJra1Igbyh+VM+6it+IpLygDNhoVhNX3UVqKD4xmt0Qf4aeXAviQM7HZzmkV9+o+b3DVEeoNnGQ+zXIV8b/QeQAQqC1oY3EtqNfHOiLfTJQnbDFXNX4kMOHSKX/1pqATjrf+n5AgHGx6TPKG2cU1VYzJvAjkjsg0yf8lEPnPJpLnV8ViswuEG8Mgnx/j+EmcB72hhS9/EhzcVYy0deVHil3B9aU9l/gfSyYBnKmeIl6xsyScHSc5ueZt7QXpIrvcXzR2EZHnuMUThty5xHP+QHVJa6W7rLmTtAJkAGNR7oMq7lhcEuQndFv9nG5Pgk6KGETPpnFIboxd9e2Xv6SwPkn45EvMklBrKfl4Tjq2eUfMheJWWT1PyrD9xy+8bg08HlBJ64gZMp7SmacDfAW4O80ZK/7TU/9B15xSC8yChPcD3UIIpvIPnglnhNlwtf708Z4SI4tbG0d+cqK0cfW9SfEkDgd4TXA2d7SM0dBtxXGIqCH54Vn+8BT7FkEA6zm3o138Wq9rOC3VguTW2W4hUr054QM9c18U6FRMUdPG29R5XGclTv5fEBLOaoMTwESjX5a6cZxF/X4VptH7nHLetg9YMVplW+Id81sBwXQWECkFRWuM2/Sqv7JCdlJIDp+5xUtSUsS1JQ3GVbcjXrq6O7ZJch3wrWyDwoBrqzPQEAsL5vp71Y6eVp22NF52/Bk2iN5WAygZaxzUTwMDdpHTp1XYEjTvMcgNxt7d03wZDeaC6rXYNepePjR/rrDlU2U8aQ== X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2284; 6:p2MDhlfpybiVwP5M+2IZKyFFxI7NQd4moMADh5LWVh9TXrpJnXfvt2x2F1edmrwqWT85z7/hppqEeNEZfFzDGdDalEAtP4vnNM0dfhRNlhdWqqkc1Omu+awLQVNna8HyQMKAfiX1UQQHoDA/1sR926gKUgo6Letil5d3aj2G/n1VWOiRW84EQjt/OMegWnc+8NlvV1Zy5a/pZf/QkOfCfk7sFRQbVErV00lYO5burux4iOvYE2wXDt/oy9RY39nPpB3OIKLGG6YZsHf3RlnKL7fN2k3RXQWg7Y2UCElhPhDfxJFJB94+45MvHGDQCC1uQzRQgLLMqQn7Za9bAN1Rb2FswR06efKSnBI8DtjpxYGAaQ+1oysS2gSlp7Vzz+11EbtymVZIIHTHgnqE5CS2T4PcGqaF61/Fjqu35Qqk5owTmRq5zdONV8yEZ0hjp/dl10F27gE/4nllJ8A5qoT6ZMooNtcTxQPuKnjkXh9M+pNj+SDacNnWYURv1P6F0vvV; 5:xNsyyYmlQ7nDzjhqaK9bacVzNNfwYwzDoQr4br48yEuC5Tp4vmOgtKu/qwnhOlePK6HbyRKssyOPTcPKI0zF9MWA5ZAnTsFuFHFgsdIm3m/X/JuNqAVdl97wOVUWQJXVrsaJJ146eAY9TI+oBgk6MwR79tkGzdg8KEVLtKelsmUyrjzKz8HwbPp/f98ufm00; 24:5Z6wwO24f93peVtQVWe/H/4nJ0/GIvQigxsF21R38MFVVXtdPeddMMl9VWPpAUPcqIKJCS5d3PBlbfrwmu+aLXlRAn8uJEn6Nz+qQ2YK2VE= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR03MB2284; 7:vR2sLlIzF9kO/JN1PXu/RRz2o3Zm/3WLTXL+F7iv29HqhOimLNTGEd8JhZbTxevymexmXumn9vR+k71MepQZn9MzVWQvHc2qDRdauXZ8oULfJSoZc6q5ESv7zc27JeYAGbA2XNVQEGNsz1llc/tHPByWxBOSOzI0USXkPkiu2Kj+wHUN/D0nPxMPb9mJfGzl1FwINy1xHZgQGVVgaxBNUybfxoup0Mm5cJK5z7t4PkcI24uNws2hafFH5PrTqqgzMKWmBj4IX8qtrQspJEkMivuGmcmiP8EzIL/r6pvPOATAQl+BoqAsvCKzpO9AGrHfV4RCh/u7YUQwN/sXsyhl6w== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Apr 2017 15:38:12.8863 (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: CY1PR03MB2284 Subject: [dpdk-dev] [PATCH v8 06/13] crypto/dpaa2_sec: add mc dpseci object support 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Akhil Goyal add support for dpseci object in MC driver. DPSECI represent a crypto object in DPAA2. Signed-off-by: Cristian Sovaiala Signed-off-by: Akhil Goyal --- drivers/crypto/dpaa2_sec/Makefile | 2 + drivers/crypto/dpaa2_sec/mc/dpseci.c | 551 ++++++++++++++++++++ drivers/crypto/dpaa2_sec/mc/fsl_dpseci.h | 739 +++++++++++++++++++++++++++ drivers/crypto/dpaa2_sec/mc/fsl_dpseci_cmd.h | 249 +++++++++ 4 files changed, 1541 insertions(+) create mode 100644 drivers/crypto/dpaa2_sec/mc/dpseci.c create mode 100644 drivers/crypto/dpaa2_sec/mc/fsl_dpseci.h create mode 100644 drivers/crypto/dpaa2_sec/mc/fsl_dpseci_cmd.h diff --git a/drivers/crypto/dpaa2_sec/Makefile b/drivers/crypto/dpaa2_sec/Makefile index b9c808e..11c7c78 100644 --- a/drivers/crypto/dpaa2_sec/Makefile +++ b/drivers/crypto/dpaa2_sec/Makefile @@ -47,6 +47,7 @@ endif CFLAGS += -D _GNU_SOURCE CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec/ +CFLAGS += -I$(RTE_SDK)/drivers/crypto/dpaa2_sec/mc CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/ CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/qbman/include CFLAGS += -I$(RTE_SDK)/drivers/bus/fslmc/mc @@ -62,6 +63,7 @@ LIBABIVER := 1 # library source files SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += dpaa2_sec_dpseci.c +SRCS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += mc/dpseci.c # library dependencies DEPDIRS-$(CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC) += lib/librte_eal diff --git a/drivers/crypto/dpaa2_sec/mc/dpseci.c b/drivers/crypto/dpaa2_sec/mc/dpseci.c new file mode 100644 index 0000000..a3eaa26 --- /dev/null +++ b/drivers/crypto/dpaa2_sec/mc/dpseci.c @@ -0,0 +1,551 @@ +/* Copyright 2013-2016 Freescale Semiconductor Inc. + * Copyright (c) 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 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. + * + * + * 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 +#include +#include + +int +dpseci_open(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + int dpseci_id, + uint16_t *token) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_OPEN, + cmd_flags, + 0); + DPSECI_CMD_OPEN(cmd, dpseci_id); + + /* send command to mc */ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + *token = MC_CMD_HDR_READ_TOKEN(cmd.header); + + return 0; +} + +int +dpseci_close(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_CLOSE, + cmd_flags, + token); + + /* send command to mc */ + return mc_send_command(mc_io, &cmd); +} + +int +dpseci_create(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + const struct dpseci_cfg *cfg, + uint32_t *obj_id) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_CREATE, + cmd_flags, + dprc_token); + DPSECI_CMD_CREATE(cmd, cfg); + + /* send command to mc */ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + CMD_CREATE_RSP_GET_OBJ_ID_PARAM0(cmd, *obj_id); + + return 0; +} + +int +dpseci_destroy(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + uint32_t object_id) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_DESTROY, + cmd_flags, + dprc_token); + /* set object id to destroy */ + CMD_DESTROY_SET_OBJ_ID_PARAM0(cmd, object_id); + /* send command to mc */ + return mc_send_command(mc_io, &cmd); +} + +int +dpseci_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_ENABLE, + cmd_flags, + token); + + /* send command to mc */ + return mc_send_command(mc_io, &cmd); +} + +int +dpseci_disable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_DISABLE, + cmd_flags, + token); + + /* send command to mc */ + return mc_send_command(mc_io, &cmd); +} + +int +dpseci_is_enabled(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + int *en) +{ + struct mc_command cmd = { 0 }; + int err; + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_IS_ENABLED, + cmd_flags, + token); + + /* send command to mc */ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPSECI_RSP_IS_ENABLED(cmd, *en); + + return 0; +} + +int +dpseci_reset(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_RESET, + cmd_flags, + token); + + /* send command to mc */ + return mc_send_command(mc_io, &cmd); +} + +int +dpseci_get_irq(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + int *type, + struct dpseci_irq_cfg *irq_cfg) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_IRQ, + cmd_flags, + token); + DPSECI_CMD_GET_IRQ(cmd, irq_index); + + /* send command to mc */ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPSECI_RSP_GET_IRQ(cmd, *type, irq_cfg); + + return 0; +} + +int +dpseci_set_irq(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + struct dpseci_irq_cfg *irq_cfg) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_SET_IRQ, + cmd_flags, + token); + DPSECI_CMD_SET_IRQ(cmd, irq_index, irq_cfg); + + /* send command to mc */ + return mc_send_command(mc_io, &cmd); +} + +int +dpseci_get_irq_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint8_t *en) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_IRQ_ENABLE, + cmd_flags, + token); + DPSECI_CMD_GET_IRQ_ENABLE(cmd, irq_index); + + /* send command to mc */ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPSECI_RSP_GET_IRQ_ENABLE(cmd, *en); + + return 0; +} + +int +dpseci_set_irq_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint8_t en) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_SET_IRQ_ENABLE, + cmd_flags, + token); + DPSECI_CMD_SET_IRQ_ENABLE(cmd, irq_index, en); + + /* send command to mc */ + return mc_send_command(mc_io, &cmd); +} + +int +dpseci_get_irq_mask(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint32_t *mask) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_IRQ_MASK, + cmd_flags, + token); + DPSECI_CMD_GET_IRQ_MASK(cmd, irq_index); + + /* send command to mc */ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPSECI_RSP_GET_IRQ_MASK(cmd, *mask); + + return 0; +} + +int +dpseci_set_irq_mask(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint32_t mask) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_SET_IRQ_MASK, + cmd_flags, + token); + DPSECI_CMD_SET_IRQ_MASK(cmd, irq_index, mask); + + /* send command to mc */ + return mc_send_command(mc_io, &cmd); +} + +int +dpseci_get_irq_status(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint32_t *status) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_IRQ_STATUS, + cmd_flags, + token); + DPSECI_CMD_GET_IRQ_STATUS(cmd, irq_index, *status); + + /* send command to mc */ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPSECI_RSP_GET_IRQ_STATUS(cmd, *status); + + return 0; +} + +int +dpseci_clear_irq_status(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint32_t status) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_CLEAR_IRQ_STATUS, + cmd_flags, + token); + DPSECI_CMD_CLEAR_IRQ_STATUS(cmd, irq_index, status); + + /* send command to mc */ + return mc_send_command(mc_io, &cmd); +} + +int +dpseci_get_attributes(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpseci_attr *attr) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_ATTR, + cmd_flags, + token); + + /* send command to mc */ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPSECI_RSP_GET_ATTR(cmd, attr); + + return 0; +} + +int +dpseci_set_rx_queue(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t queue, + const struct dpseci_rx_queue_cfg *cfg) +{ + struct mc_command cmd = { 0 }; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_SET_RX_QUEUE, + cmd_flags, + token); + DPSECI_CMD_SET_RX_QUEUE(cmd, queue, cfg); + + /* send command to mc */ + return mc_send_command(mc_io, &cmd); +} + +int +dpseci_get_rx_queue(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t queue, + struct dpseci_rx_queue_attr *attr) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_RX_QUEUE, + cmd_flags, + token); + DPSECI_CMD_GET_RX_QUEUE(cmd, queue); + + /* send command to mc */ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPSECI_RSP_GET_RX_QUEUE(cmd, attr); + + return 0; +} + +int +dpseci_get_tx_queue(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t queue, + struct dpseci_tx_queue_attr *attr) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_TX_QUEUE, + cmd_flags, + token); + DPSECI_CMD_GET_TX_QUEUE(cmd, queue); + + /* send command to mc */ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPSECI_RSP_GET_TX_QUEUE(cmd, attr); + + return 0; +} + +int +dpseci_get_sec_attr(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpseci_sec_attr *attr) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_SEC_ATTR, + cmd_flags, + token); + + /* send command to mc */ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPSECI_RSP_GET_SEC_ATTR(cmd, attr); + + return 0; +} + +int +dpseci_get_sec_counters(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpseci_sec_counters *counters) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_SEC_COUNTERS, + cmd_flags, + token); + + /* send command to mc */ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPSECI_RSP_GET_SEC_COUNTERS(cmd, counters); + + return 0; +} + +int +dpseci_get_api_version(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t *major_ver, + uint16_t *minor_ver) +{ + struct mc_command cmd = { 0 }; + int err; + + cmd.header = mc_encode_cmd_header(DPSECI_CMDID_GET_API_VERSION, + cmd_flags, + 0); + + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + DPSECI_RSP_GET_API_VERSION(cmd, *major_ver, *minor_ver); + + return 0; +} diff --git a/drivers/crypto/dpaa2_sec/mc/fsl_dpseci.h b/drivers/crypto/dpaa2_sec/mc/fsl_dpseci.h new file mode 100644 index 0000000..c31b46e --- /dev/null +++ b/drivers/crypto/dpaa2_sec/mc/fsl_dpseci.h @@ -0,0 +1,739 @@ +/* Copyright 2013-2016 Freescale Semiconductor Inc. + * Copyright (c) 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 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. + * + * + * 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 __FSL_DPSECI_H +#define __FSL_DPSECI_H + +/* Data Path SEC Interface API + * Contains initialization APIs and runtime control APIs for DPSECI + */ + +struct fsl_mc_io; + +/** + * General DPSECI macros + */ + +/** + * Maximum number of Tx/Rx priorities per DPSECI object + */ +#define DPSECI_PRIO_NUM 8 + +/** + * All queues considered; see dpseci_set_rx_queue() + */ +#define DPSECI_ALL_QUEUES (uint8_t)(-1) + +/** + * dpseci_open() - Open a control session for the specified object + * This function can be used to open a control session for an + * already created object; an object may have been declared in + * the DPL or by calling the dpseci_create() function. + * This function returns a unique authentication token, + * associated with the specific object ID and the specific MC + * portal; this token must be used in all subsequent commands for + * this specific object. + * + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param dpseci_id DPSECI unique ID + * @param token Returned token; use in subsequent API calls + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_open(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + int dpseci_id, + uint16_t *token); + +/** + * dpseci_close() - Close the control session of the object + * After this function is called, no further operations are + * allowed on the object without opening a new control session. + * + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_close(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * struct dpseci_cfg - Structure representing DPSECI configuration + */ +struct dpseci_cfg { + uint8_t num_tx_queues; /* num of queues towards the SEC */ + uint8_t num_rx_queues; /* num of queues back from the SEC */ + uint8_t priorities[DPSECI_PRIO_NUM]; + /**< Priorities for the SEC hardware processing; + * each place in the array is the priority of the tx queue + * towards the SEC, + * valid priorities are configured with values 1-8; + */ +}; + +/** + * dpseci_create() - Create the DPSECI object + * Create the DPSECI object, allocate required resources and + * perform required initialization. + * + * The object can be created either by declaring it in the + * DPL file, or by calling this function. + * + * The function accepts an authentication token of a parent + * container that this object should be assigned to. The token + * can be '0' so the object will be assigned to the default container. + * The newly created object can be opened with the returned + * object id and using the container's associated tokens and MC portals. + * + * @param mc_io Pointer to MC portal's I/O object + * @param dprc_token Parent container token; '0' for default container + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param cfg Configuration structure + * @param obj_id returned object id + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_create(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + const struct dpseci_cfg *cfg, + uint32_t *obj_id); + +/** + * dpseci_destroy() - Destroy the DPSECI object and release all its resources. + * The function accepts the authentication token of the parent container that + * created the object (not the one that currently owns the object). The object + * is searched within parent using the provided 'object_id'. + * All tokens to the object must be closed before calling destroy. + * + * @param mc_io Pointer to MC portal's I/O object + * @param dprc_token Parent container token; '0' for default container + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param object_id The object id; it must be a valid id within the + * container that created this object; + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_destroy(struct fsl_mc_io *mc_io, + uint16_t dprc_token, + uint32_t cmd_flags, + uint32_t object_id); + +/** + * dpseci_enable() - Enable the DPSECI, allow sending and receiving frames. + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * dpseci_disable() - Disable the DPSECI, stop sending and receiving frames. + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_disable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * dpseci_is_enabled() - Check if the DPSECI is enabled. + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param en Returns '1' if object is enabled; '0' otherwise + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_is_enabled(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + int *en); + +/** + * dpseci_reset() - Reset the DPSECI, returns the object to initial state. + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_reset(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token); + +/** + * struct dpseci_irq_cfg - IRQ configuration + */ +struct dpseci_irq_cfg { + uint64_t addr; + /* Address that must be written to signal a message-based interrupt */ + uint32_t val; + /* Value to write into irq_addr address */ + int irq_num; + /* A user defined number associated with this IRQ */ +}; + +/** + * dpseci_set_irq() - Set IRQ information for the DPSECI to trigger an interrupt + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param irq_index Identifies the interrupt index to configure + * @param irq_cfg IRQ configuration + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_set_irq(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + struct dpseci_irq_cfg *irq_cfg); + +/** + * dpseci_get_irq() - Get IRQ information from the DPSECI + * + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param irq_index The interrupt index to configure + * @param type Interrupt type: 0 represents message interrupt + * type (both irq_addr and irq_val are valid) + * @param irq_cfg IRQ attributes + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_get_irq(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + int *type, + struct dpseci_irq_cfg *irq_cfg); + +/** + * dpseci_set_irq_enable() - Set overall interrupt state. + * Allows GPP software to control when interrupts are generated. + * Each interrupt can have up to 32 causes. The enable/disable control's the + * overall interrupt state. if the interrupt is disabled no causes will cause + * an interrupt + * + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param irq_index The interrupt index to configure + * @param en Interrupt state - enable = 1, disable = 0 + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_set_irq_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint8_t en); + +/** + * dpseci_get_irq_enable() - Get overall interrupt state + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param irq_index The interrupt index to configure + * @param en Returned Interrupt state - enable = 1, + * disable = 0 + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_get_irq_enable(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint8_t *en); + +/** + * dpseci_set_irq_mask() - Set interrupt mask. + * Every interrupt can have up to 32 causes and the interrupt model supports + * masking/unmasking each cause independently + * + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param irq_index The interrupt index to configure + * @param mask event mask to trigger interrupt; + * each bit: + * 0 = ignore event + * 1 = consider event for asserting IRQ + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_set_irq_mask(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint32_t mask); + +/** + * dpseci_get_irq_mask() - Get interrupt mask. + * Every interrupt can have up to 32 causes and the interrupt model supports + * masking/unmasking each cause independently + * + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param irq_index The interrupt index to configure + * @param mask Returned event mask to trigger interrupt + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_get_irq_mask(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint32_t *mask); + +/** + * dpseci_get_irq_status() - Get the current status of any pending interrupts + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param irq_index The interrupt index to configure + * @param status Returned interrupts status - one bit per cause: + * 0 = no interrupt pending + * 1 = interrupt pending + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_get_irq_status(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint32_t *status); + +/** + * dpseci_clear_irq_status() - Clear a pending interrupt's status + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param irq_index The interrupt index to configure + * @param status bits to clear (W1C) - one bit per cause: + * 0 = don't change + * 1 = clear status bit + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_clear_irq_status(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t irq_index, + uint32_t status); + +/** + * struct dpseci_attr - Structure representing DPSECI attributes + * @param id: DPSECI object ID + * @param num_tx_queues: number of queues towards the SEC + * @param num_rx_queues: number of queues back from the SEC + */ +struct dpseci_attr { + int id; /* DPSECI object ID */ + uint8_t num_tx_queues; /* number of queues towards the SEC */ + uint8_t num_rx_queues; /* number of queues back from the SEC */ +}; + +/** + * dpseci_get_attributes() - Retrieve DPSECI attributes. + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param attr Returned object's attributes + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_get_attributes(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpseci_attr *attr); + +/** + * enum dpseci_dest - DPSECI destination types + * @DPSECI_DEST_NONE: Unassigned destination; The queue is set in parked mode + * and does not generate FQDAN notifications; user is expected to + * dequeue from the queue based on polling or other user-defined + * method + * @DPSECI_DEST_DPIO: The queue is set in schedule mode and generates FQDAN + * notifications to the specified DPIO; user is expected to dequeue + * from the queue only after notification is received + * @DPSECI_DEST_DPCON: The queue is set in schedule mode and does not generate + * FQDAN notifications, but is connected to the specified DPCON + * object; user is expected to dequeue from the DPCON channel + */ +enum dpseci_dest { + DPSECI_DEST_NONE = 0, + DPSECI_DEST_DPIO = 1, + DPSECI_DEST_DPCON = 2 +}; + +/** + * struct dpseci_dest_cfg - Structure representing DPSECI destination parameters + */ +struct dpseci_dest_cfg { + enum dpseci_dest dest_type; /* Destination type */ + int dest_id; + /* Either DPIO ID or DPCON ID, depending on the destination type */ + uint8_t priority; + /* Priority selection within the DPIO or DPCON channel; valid values + * are 0-1 or 0-7, depending on the number of priorities in that + * channel; not relevant for 'DPSECI_DEST_NONE' option + */ +}; + +/** + * DPSECI queue modification options + */ + +/** + * Select to modify the user's context associated with the queue + */ +#define DPSECI_QUEUE_OPT_USER_CTX 0x00000001 + +/** + * Select to modify the queue's destination + */ +#define DPSECI_QUEUE_OPT_DEST 0x00000002 + +/** + * Select to modify the queue's order preservation + */ +#define DPSECI_QUEUE_OPT_ORDER_PRESERVATION 0x00000004 + +/** + * struct dpseci_rx_queue_cfg - DPSECI RX queue configuration + */ +struct dpseci_rx_queue_cfg { + uint32_t options; + /* Flags representing the suggested modifications to the queue; + * Use any combination of 'DPSECI_QUEUE_OPT_' flags + */ + int order_preservation_en; + /* order preservation configuration for the rx queue + * valid only if 'DPSECI_QUEUE_OPT_ORDER_PRESERVATION' is contained in + * 'options' + */ + uint64_t user_ctx; + /* User context value provided in the frame descriptor of each + * dequeued frame; + * valid only if 'DPSECI_QUEUE_OPT_USER_CTX' is contained in 'options' + */ + struct dpseci_dest_cfg dest_cfg; + /* Queue destination parameters; + * valid only if 'DPSECI_QUEUE_OPT_DEST' is contained in 'options' + */ +}; + +/** + * dpseci_set_rx_queue() - Set Rx queue configuration + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param queue Select the queue relative to number of + * priorities configured at DPSECI creation; use + * DPSECI_ALL_QUEUES to configure all Rx queues + * identically. + * @param cfg Rx queue configuration + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_set_rx_queue(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t queue, + const struct dpseci_rx_queue_cfg *cfg); + +/** + * struct dpseci_rx_queue_attr - Structure representing attributes of Rx queues + */ +struct dpseci_rx_queue_attr { + uint64_t user_ctx; + /* User context value provided in the frame descriptor of + * each dequeued frame + */ + int order_preservation_en; + /* Status of the order preservation configuration on the queue */ + struct dpseci_dest_cfg dest_cfg; + /* Queue destination configuration */ + uint32_t fqid; + /* Virtual FQID value to be used for dequeue operations */ +}; + +/** + * dpseci_get_rx_queue() - Retrieve Rx queue attributes. + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param queue Select the queue relative to number of + * priorities configured at DPSECI creation + * @param attr Returned Rx queue attributes + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_get_rx_queue(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t queue, + struct dpseci_rx_queue_attr *attr); + +/** + * struct dpseci_tx_queue_attr - Structure representing attributes of Tx queues + */ +struct dpseci_tx_queue_attr { + uint32_t fqid; + /* Virtual FQID to be used for sending frames to SEC hardware */ + uint8_t priority; + /* SEC hardware processing priority for the queue */ +}; + +/** + * dpseci_get_tx_queue() - Retrieve Tx queue attributes. + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param queue Select the queue relative to number of + * priorities configured at DPSECI creation + * @param attr Returned Tx queue attributes + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_get_tx_queue(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + uint8_t queue, + struct dpseci_tx_queue_attr *attr); + +/** + * struct dpseci_sec_attr - Structure representing attributes of the SEC + * hardware accelerator + */ + +struct dpseci_sec_attr { + uint16_t ip_id; /* ID for SEC */ + uint8_t major_rev; /* Major revision number for SEC */ + uint8_t minor_rev; /* Minor revision number for SEC */ + uint8_t era; /* SEC Era */ + uint8_t deco_num; + /* The number of copies of the DECO that are implemented in + * this version of SEC + */ + uint8_t zuc_auth_acc_num; + /* The number of copies of ZUCA that are implemented in this + * version of SEC + */ + uint8_t zuc_enc_acc_num; + /* The number of copies of ZUCE that are implemented in this + * version of SEC + */ + uint8_t snow_f8_acc_num; + /* The number of copies of the SNOW-f8 module that are + * implemented in this version of SEC + */ + uint8_t snow_f9_acc_num; + /* The number of copies of the SNOW-f9 module that are + * implemented in this version of SEC + */ + uint8_t crc_acc_num; + /* The number of copies of the CRC module that are implemented + * in this version of SEC + */ + uint8_t pk_acc_num; + /* The number of copies of the Public Key module that are + * implemented in this version of SEC + */ + uint8_t kasumi_acc_num; + /* The number of copies of the Kasumi module that are + * implemented in this version of SEC + */ + uint8_t rng_acc_num; + /* The number of copies of the Random Number Generator that are + * implemented in this version of SEC + */ + uint8_t md_acc_num; + /* The number of copies of the MDHA (Hashing module) that are + * implemented in this version of SEC + */ + uint8_t arc4_acc_num; + /* The number of copies of the ARC4 module that are implemented + * in this version of SEC + */ + uint8_t des_acc_num; + /* The number of copies of the DES module that are implemented + * in this version of SEC + */ + uint8_t aes_acc_num; + /* The number of copies of the AES module that are implemented + * in this version of SEC + */ +}; + +/** + * dpseci_get_sec_attr() - Retrieve SEC accelerator attributes. + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param attr Returned SEC attributes + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_get_sec_attr(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpseci_sec_attr *attr); + +/** + * struct dpseci_sec_counters - Structure representing global SEC counters and + * not per dpseci counters + */ +struct dpseci_sec_counters { + uint64_t dequeued_requests; /* Number of Requests Dequeued */ + uint64_t ob_enc_requests; /* Number of Outbound Encrypt Requests */ + uint64_t ib_dec_requests; /* Number of Inbound Decrypt Requests */ + uint64_t ob_enc_bytes; /* Number of Outbound Bytes Encrypted */ + uint64_t ob_prot_bytes; /* Number of Outbound Bytes Protected */ + uint64_t ib_dec_bytes; /* Number of Inbound Bytes Decrypted */ + uint64_t ib_valid_bytes; /* Number of Inbound Bytes Validated */ +}; + +/** + * dpseci_get_sec_counters() - Retrieve SEC accelerator counters. + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param token Token of DPSECI object + * @param counters Returned SEC counters + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_get_sec_counters(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t token, + struct dpseci_sec_counters *counters); + +/** + * dpseci_get_api_version() - Get Data Path SEC Interface API version + * @param mc_io Pointer to MC portal's I/O object + * @param cmd_flags Command flags; one or more of 'MC_CMD_FLAG_' + * @param major_ver Major version of data path sec API + * @param minor_ver Minor version of data path sec API + * + * @return: + * - Return '0' on Success. + * - Return Error code otherwise. + */ +int +dpseci_get_api_version(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + uint16_t *major_ver, + uint16_t *minor_ver); + +#endif /* __FSL_DPSECI_H */ diff --git a/drivers/crypto/dpaa2_sec/mc/fsl_dpseci_cmd.h b/drivers/crypto/dpaa2_sec/mc/fsl_dpseci_cmd.h new file mode 100644 index 0000000..8ee9a5a --- /dev/null +++ b/drivers/crypto/dpaa2_sec/mc/fsl_dpseci_cmd.h @@ -0,0 +1,249 @@ +/* Copyright 2013-2016 Freescale Semiconductor Inc. + * Copyright (c) 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 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. + * + * + * 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 _FSL_DPSECI_CMD_H +#define _FSL_DPSECI_CMD_H + +/* DPSECI Version */ +#define DPSECI_VER_MAJOR 5 +#define DPSECI_VER_MINOR 0 + +/* Command IDs */ +#define DPSECI_CMDID_CLOSE ((0x800 << 4) | (0x1)) +#define DPSECI_CMDID_OPEN ((0x809 << 4) | (0x1)) +#define DPSECI_CMDID_CREATE ((0x909 << 4) | (0x1)) +#define DPSECI_CMDID_DESTROY ((0x989 << 4) | (0x1)) +#define DPSECI_CMDID_GET_API_VERSION ((0xa09 << 4) | (0x1)) + +#define DPSECI_CMDID_ENABLE ((0x002 << 4) | (0x1)) +#define DPSECI_CMDID_DISABLE ((0x003 << 4) | (0x1)) +#define DPSECI_CMDID_GET_ATTR ((0x004 << 4) | (0x1)) +#define DPSECI_CMDID_RESET ((0x005 << 4) | (0x1)) +#define DPSECI_CMDID_IS_ENABLED ((0x006 << 4) | (0x1)) + +#define DPSECI_CMDID_SET_IRQ ((0x010 << 4) | (0x1)) +#define DPSECI_CMDID_GET_IRQ ((0x011 << 4) | (0x1)) +#define DPSECI_CMDID_SET_IRQ_ENABLE ((0x012 << 4) | (0x1)) +#define DPSECI_CMDID_GET_IRQ_ENABLE ((0x013 << 4) | (0x1)) +#define DPSECI_CMDID_SET_IRQ_MASK ((0x014 << 4) | (0x1)) +#define DPSECI_CMDID_GET_IRQ_MASK ((0x015 << 4) | (0x1)) +#define DPSECI_CMDID_GET_IRQ_STATUS ((0x016 << 4) | (0x1)) +#define DPSECI_CMDID_CLEAR_IRQ_STATUS ((0x017 << 4) | (0x1)) + +#define DPSECI_CMDID_SET_RX_QUEUE ((0x194 << 4) | (0x1)) +#define DPSECI_CMDID_GET_RX_QUEUE ((0x196 << 4) | (0x1)) +#define DPSECI_CMDID_GET_TX_QUEUE ((0x197 << 4) | (0x1)) +#define DPSECI_CMDID_GET_SEC_ATTR ((0x198 << 4) | (0x1)) +#define DPSECI_CMDID_GET_SEC_COUNTERS ((0x199 << 4) | (0x1)) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_CMD_OPEN(cmd, dpseci_id) \ + MC_CMD_OP(cmd, 0, 0, 32, int, dpseci_id) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_CMD_CREATE(cmd, cfg) \ +do { \ + MC_CMD_OP(cmd, 0, 0, 8, uint8_t, cfg->priorities[0]);\ + MC_CMD_OP(cmd, 0, 8, 8, uint8_t, cfg->priorities[1]);\ + MC_CMD_OP(cmd, 0, 16, 8, uint8_t, cfg->priorities[2]);\ + MC_CMD_OP(cmd, 0, 24, 8, uint8_t, cfg->priorities[3]);\ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->priorities[4]);\ + MC_CMD_OP(cmd, 0, 40, 8, uint8_t, cfg->priorities[5]);\ + MC_CMD_OP(cmd, 0, 48, 8, uint8_t, cfg->priorities[6]);\ + MC_CMD_OP(cmd, 0, 56, 8, uint8_t, cfg->priorities[7]);\ + MC_CMD_OP(cmd, 1, 0, 8, uint8_t, cfg->num_tx_queues);\ + MC_CMD_OP(cmd, 1, 8, 8, uint8_t, cfg->num_rx_queues);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_RSP_IS_ENABLED(cmd, en) \ + MC_RSP_OP(cmd, 0, 0, 1, int, en) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_CMD_SET_IRQ(cmd, irq_index, irq_cfg) \ +do { \ + MC_CMD_OP(cmd, 0, 0, 8, uint8_t, irq_index);\ + MC_CMD_OP(cmd, 0, 32, 32, uint32_t, irq_cfg->val);\ + MC_CMD_OP(cmd, 1, 0, 64, uint64_t, irq_cfg->addr);\ + MC_CMD_OP(cmd, 2, 0, 32, int, irq_cfg->irq_num); \ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_CMD_GET_IRQ(cmd, irq_index) \ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_RSP_GET_IRQ(cmd, type, irq_cfg) \ +do { \ + MC_RSP_OP(cmd, 0, 0, 32, uint32_t, irq_cfg->val); \ + MC_RSP_OP(cmd, 1, 0, 64, uint64_t, irq_cfg->addr);\ + MC_RSP_OP(cmd, 2, 0, 32, int, irq_cfg->irq_num); \ + MC_RSP_OP(cmd, 2, 32, 32, int, type); \ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_CMD_SET_IRQ_ENABLE(cmd, irq_index, enable_state) \ +do { \ + MC_CMD_OP(cmd, 0, 0, 8, uint8_t, enable_state); \ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index); \ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_CMD_GET_IRQ_ENABLE(cmd, irq_index) \ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_RSP_GET_IRQ_ENABLE(cmd, enable_state) \ + MC_RSP_OP(cmd, 0, 0, 8, uint8_t, enable_state) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_CMD_SET_IRQ_MASK(cmd, irq_index, mask) \ +do { \ + MC_CMD_OP(cmd, 0, 0, 32, uint32_t, mask); \ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index); \ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_CMD_GET_IRQ_MASK(cmd, irq_index) \ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_RSP_GET_IRQ_MASK(cmd, mask) \ + MC_RSP_OP(cmd, 0, 0, 32, uint32_t, mask) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_CMD_GET_IRQ_STATUS(cmd, irq_index, status) \ +do { \ + MC_CMD_OP(cmd, 0, 0, 32, uint32_t, status);\ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_RSP_GET_IRQ_STATUS(cmd, status) \ + MC_RSP_OP(cmd, 0, 0, 32, uint32_t, status) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_CMD_CLEAR_IRQ_STATUS(cmd, irq_index, status) \ +do { \ + MC_CMD_OP(cmd, 0, 0, 32, uint32_t, status); \ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, irq_index); \ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_RSP_GET_ATTR(cmd, attr) \ +do { \ + MC_RSP_OP(cmd, 0, 0, 32, int, attr->id); \ + MC_RSP_OP(cmd, 1, 0, 8, uint8_t, attr->num_tx_queues); \ + MC_RSP_OP(cmd, 1, 8, 8, uint8_t, attr->num_rx_queues); \ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_CMD_SET_RX_QUEUE(cmd, queue, cfg) \ +do { \ + MC_CMD_OP(cmd, 0, 0, 32, int, cfg->dest_cfg.dest_id); \ + MC_CMD_OP(cmd, 0, 32, 8, uint8_t, cfg->dest_cfg.priority); \ + MC_CMD_OP(cmd, 0, 40, 8, uint8_t, queue); \ + MC_CMD_OP(cmd, 0, 48, 4, enum dpseci_dest, cfg->dest_cfg.dest_type); \ + MC_CMD_OP(cmd, 1, 0, 64, uint64_t, cfg->user_ctx); \ + MC_CMD_OP(cmd, 2, 0, 32, uint32_t, cfg->options);\ + MC_CMD_OP(cmd, 2, 32, 1, int, cfg->order_preservation_en);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_CMD_GET_RX_QUEUE(cmd, queue) \ + MC_CMD_OP(cmd, 0, 40, 8, uint8_t, queue) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_RSP_GET_RX_QUEUE(cmd, attr) \ +do { \ + MC_RSP_OP(cmd, 0, 0, 32, int, attr->dest_cfg.dest_id);\ + MC_RSP_OP(cmd, 0, 32, 8, uint8_t, attr->dest_cfg.priority);\ + MC_RSP_OP(cmd, 0, 48, 4, enum dpseci_dest, attr->dest_cfg.dest_type);\ + MC_RSP_OP(cmd, 1, 0, 8, uint64_t, attr->user_ctx);\ + MC_RSP_OP(cmd, 2, 0, 32, uint32_t, attr->fqid);\ + MC_RSP_OP(cmd, 2, 32, 1, int, attr->order_preservation_en);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_CMD_GET_TX_QUEUE(cmd, queue) \ + MC_CMD_OP(cmd, 0, 40, 8, uint8_t, queue) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_RSP_GET_TX_QUEUE(cmd, attr) \ +do { \ + MC_RSP_OP(cmd, 0, 32, 32, uint32_t, attr->fqid);\ + MC_RSP_OP(cmd, 1, 0, 8, uint8_t, attr->priority);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_RSP_GET_SEC_ATTR(cmd, attr) \ +do { \ + MC_RSP_OP(cmd, 0, 0, 16, uint16_t, attr->ip_id);\ + MC_RSP_OP(cmd, 0, 16, 8, uint8_t, attr->major_rev);\ + MC_RSP_OP(cmd, 0, 24, 8, uint8_t, attr->minor_rev);\ + MC_RSP_OP(cmd, 0, 32, 8, uint8_t, attr->era);\ + MC_RSP_OP(cmd, 1, 0, 8, uint8_t, attr->deco_num);\ + MC_RSP_OP(cmd, 1, 8, 8, uint8_t, attr->zuc_auth_acc_num);\ + MC_RSP_OP(cmd, 1, 16, 8, uint8_t, attr->zuc_enc_acc_num);\ + MC_RSP_OP(cmd, 1, 32, 8, uint8_t, attr->snow_f8_acc_num);\ + MC_RSP_OP(cmd, 1, 40, 8, uint8_t, attr->snow_f9_acc_num);\ + MC_RSP_OP(cmd, 1, 48, 8, uint8_t, attr->crc_acc_num);\ + MC_RSP_OP(cmd, 2, 0, 8, uint8_t, attr->pk_acc_num);\ + MC_RSP_OP(cmd, 2, 8, 8, uint8_t, attr->kasumi_acc_num);\ + MC_RSP_OP(cmd, 2, 16, 8, uint8_t, attr->rng_acc_num);\ + MC_RSP_OP(cmd, 2, 32, 8, uint8_t, attr->md_acc_num);\ + MC_RSP_OP(cmd, 2, 40, 8, uint8_t, attr->arc4_acc_num);\ + MC_RSP_OP(cmd, 2, 48, 8, uint8_t, attr->des_acc_num);\ + MC_RSP_OP(cmd, 2, 56, 8, uint8_t, attr->aes_acc_num);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_RSP_GET_SEC_COUNTERS(cmd, counters) \ +do { \ + MC_RSP_OP(cmd, 0, 0, 64, uint64_t, counters->dequeued_requests);\ + MC_RSP_OP(cmd, 1, 0, 64, uint64_t, counters->ob_enc_requests);\ + MC_RSP_OP(cmd, 2, 0, 64, uint64_t, counters->ib_dec_requests);\ + MC_RSP_OP(cmd, 3, 0, 64, uint64_t, counters->ob_enc_bytes);\ + MC_RSP_OP(cmd, 4, 0, 64, uint64_t, counters->ob_prot_bytes);\ + MC_RSP_OP(cmd, 5, 0, 64, uint64_t, counters->ib_dec_bytes);\ + MC_RSP_OP(cmd, 6, 0, 64, uint64_t, counters->ib_valid_bytes);\ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPSECI_RSP_GET_API_VERSION(cmd, major, minor) \ +do { \ + MC_RSP_OP(cmd, 0, 0, 16, uint16_t, major);\ + MC_RSP_OP(cmd, 0, 16, 16, uint16_t, minor);\ +} while (0) + +#endif /* _FSL_DPSECI_CMD_H */