From patchwork Mon May 22 09:39:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 24443 X-Patchwork-Delegate: ferruh.yigit@amd.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 8EDAD7CE7; Mon, 22 May 2017 11:40:50 +0200 (CEST) Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0041.outbound.protection.outlook.com [104.47.34.41]) by dpdk.org (Postfix) with ESMTP id DF6977CAC for ; Mon, 22 May 2017 11:40:20 +0200 (CEST) Received: from BN6PR03CA0082.namprd03.prod.outlook.com (10.164.122.148) by BN3PR0301MB0899.namprd03.prod.outlook.com (10.160.156.141) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14; Mon, 22 May 2017 09:40:19 +0000 Received: from BN1AFFO11FD011.protection.gbl (2a01:111:f400:7c10::109) by BN6PR03CA0082.outlook.office365.com (2603:10b6:405:6f::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1101.14 via Frontend Transport; Mon, 22 May 2017 09:40:18 +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 BN1AFFO11FD011.mail.protection.outlook.com (10.58.52.71) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1075.5 via Frontend Transport; Mon, 22 May 2017 09:40:18 +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 v4M9dk4D031538; Mon, 22 May 2017 02:40:16 -0700 From: Hemant Agrawal To: CC: , Date: Mon, 22 May 2017 15:09:27 +0530 Message-ID: <1495445969-29199-19-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1495445969-29199-1-git-send-email-hemant.agrawal@nxp.com> References: <1494851864-26029-1-git-send-email-hemant.agrawal@nxp.com> <1495445969-29199-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131399196185857076; (91ab9b29-cfa4-454e-5278-08d120cd25b8); () X-Forefront-Antispam-Report: CIP:192.88.168.50; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(336005)(39450400003)(39860400002)(39380400002)(39400400002)(39840400002)(39410400002)(39850400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(9170700003)(2351001)(86362001)(189998001)(50226002)(47776003)(77096006)(5660300001)(54906002)(106466001)(50986999)(76176999)(38730400002)(8656002)(6916009)(8676002)(6666003)(110136004)(33646002)(36756003)(2950100002)(105606002)(53936002)(81166006)(4326008)(305945005)(8936002)(85426001)(104016004)(2906002)(50466002)(560934005)(48376002)(5003940100001)(498600001)(356003)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0301MB0899; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1AFFO11FD011; 1:V2iShGO6U+o16oJl9XXFieIThlPEAla/yZNcD8S0trt2adeOTfwLwhR3a8Czy+HZgD3oYuNFQQfTHlAyIghtPJrgneApd+5eTjcbVQ1wQ6feYOx1wUQO6SIsn44WefqA92pqNLBCnh37EJPilqDssQHNol/aexZeoGvov/5lLQtrGyB+YKKAMx8cvVxPTXpu18ZkFlNBYpbczH0zJCPtqvHfFYWYaGvabm2cxoulc3O6qMsXUq9SKwGtEsh1e7BSk1S/LeyV8bAYfXFptQhLVDKVoEQiMfYDEaSL5VP18uV5otM9p9XXNPNyfca85QES+Lz7enY2XO4rLnBTK5OCTnrRQ2CkSuIgXmiLrgILc9QAUrriYztLS0EHa41mwOKb+nt/c61HrTVez1ynBhXUlg3pfJFbtdNAxaR5xzE5fqfCluC4ZilbjC31ZXVMkvPaR9wry43fzbPJ6aVBxC40vqJIBLUCo5Mpm0BpUPuBQj07FMGTVQ9sPYf6YADlVHsCGbBcX1tLD+dkRZfZjTGiHRyeLPQG35ukm7L4Cv3/+Xp7f5eRMTdYcwDRVgX7s/MlODNN54LLAruiAzGiZrmNgZKF5snmsuxXQCNch+pGIdc6dMoffaJTNiwqALrMRm3o3JF3np2yFxcX4vFvwyTxRWC6whbBscNMIb3DB3JoP5agaqe9ebCImcOl/etrl+kECDyp6yyF8KZqxt56emPliwe2lerJSjOiforRkRiNPjH5anPprZEBM18HTnQk6dgxDhfGD5twwNYRCM4P+b6LVw== MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN3PR0301MB0899: X-MS-Office365-Filtering-Correlation-Id: f59b85f9-d2a7-428d-aad5-08d4a0f68ee2 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:BN3PR0301MB0899; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB0899; 3:6NqqOXv3a/KYpr40Eu8x8uv/Jae23+P8fOlNnL3O+71311sp09twi+ahnk2ftZMIkgmpWbr5KJGkfGZU0SyutlH3KX7dHHAHKLNu2u//yhzuxLEGbgqM+0aeQtLLUgrEtruw49JorXyWV9r5vZbVo1XAMr7r+n4kuhBmk1tGC1cKpt5DyivEdHLIE7VZaZTtSdy+1oFviLa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Exchange-Antispam-Report-Test: UriScan:(185117386973197)(275809806118684); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095135)(601004)(2401047)(5005006)(13017025)(13024025)(13023025)(8121501046)(13015025)(13018025)(93006095)(93001095)(10201501046)(3002001)(6055026)(6096035)(20161123563025)(20161123556025)(20161123561025)(20161123559100)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123565025); SRVR:BN3PR0301MB0899; BCL:0; PCL:0; RULEID:(400006); SRVR:BN3PR0301MB0899; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0301MB0899; 4:HmFccpolFKPfOw6HwLW2len5BbvTcA1vrdDZryAT?= t6rkXcdwGSQCcZGZUTytOze6Nf1Iy5GDm3sufNIW+T5Rmg7J2dcIO6padmTjeC2XfHo80l2KPnHKseSJx6VlAZXWIyghy4IcvqDveen/G80sxYzEB3FJtRyrBxa35OnISYirPw+b7QQEQFEU5yZLjs1MraszPnxUcGTdS4Xsg3KQHzPjmKkm5bK0BkKXvCkvqPGnQHdvmnO+XFa5d/zv/o/30OltNS/uZPuuzK6seXqxTl/NC+xP60EZJQ89GTxgsJBovGTxhPCIbPF7kFk0MMKj0dtuYFH3DkbFmXpMl1VeRbZCiO0AwjOuRXflLZ7DWzMNEnVDUsmDsLh/J35Q83b7po1BAtC4Zl+9Ttac0BiBEgU6mku5obBnhnNBVOa8Mc700CzkbjZuHKFu1kl2wtKyY0H9Vytv538W2R62dzkpHo1MYBcO9QEvWwoC7zKvLSWhi91GJRzgiOs+8g6eCzha298UCZ09R1SoCDPJFnKf/zAFvcW5JpiaqKycqO3Iy1ryfKJDAFXzOiZmXx6g9h1m4JB1slIuzz1hRw0ol/rzBBMWyXCA2lg/Iu27j8lJ0mfSpjWAezjAk/tNs7S5sIoBhhu/7wfUq3SYDoIUcpC0f2Y3zdQr6ZOUOK5aroo3DWeeXB/FFBkz7B49QYof+Op/3rpHOSCy7O6q83pvS1iEoN5KxL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NVxJHP6aieaEI3DW3pYg0gu8pNvL7C+EgUEhaIl2tj; 5:ZDQo3+aVrFZRUUpnqKTJLLbPw56QZx28PY3O20z9rTwPAhvPx8LGi195Vi7Nopr2MlkNCYU5CNyA86VievZClFce6fe8W6Qmhafw/aw902Ji3QP32pIAwfc7j/vG2WOWrpe8fouafdW1pf4lzcxZslAr9p+5X1tVs2hQycmxbph+53XjeVILWJJwS9X+VxD7; 24:MMBYAg1/1I882CqDIF+BY0nit4CurTxohn53auzzH6uNF5a3r5yLlLfkqtfhI3a54Dn7rLLr8bcQ3dgI5oGbVKMhltZZrfCEDtAszvQKUdM= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN3PR0301MB0899; 7:jywtIr2wC/gCWa1X9qdinZpoaiS9UJVsDK4/53mbYEqdBs8pO7Ngu/6DcUPulcCIBmrsOyjmK2rU5riNdzILF2OQnGuKtgdPsm1KB/5I6WBB30KMjQd4AJnbW4kl/Q17dkzN5oMFYA+XTfg4nScLfCFg+s2htdLp9cirnMnqJrF9AEU7aWdZUmpI+cMMDRg5MOO+iCPiVJ46KkOuP6hOA9XSF/NVzq2sct8QoEPEcJD+JqhO1P8B/Mtgiuohyh9RItPHmsGA7WCaH5GRep1v2D59rPUwNnuTOilm/YNzYRJKA/72mcB+w2irgX9HezHkmv76IKeBSvIB5N8inksOeg== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2017 09:40:18.3985 (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: BN3PR0301MB0899 Subject: [dpdk-dev] [PATCH v3 18/20] bus/fslmc: add support to detect soc version 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" This is required to configure the stashing destination based on the cluster size. Signed-off-by: Hemant Agrawal --- drivers/bus/fslmc/Makefile | 1 + drivers/bus/fslmc/mc/dpmng.c | 81 +++++++++++++++++++++++ drivers/bus/fslmc/mc/fsl_dpmng.h | 99 +++++++++++++++++++++++++++++ drivers/bus/fslmc/mc/fsl_dpmng_cmd.h | 54 ++++++++++++++++ drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 23 ++++++- drivers/bus/fslmc/rte_bus_fslmc_version.map | 2 + 6 files changed, 258 insertions(+), 2 deletions(-) create mode 100644 drivers/bus/fslmc/mc/dpmng.c create mode 100644 drivers/bus/fslmc/mc/fsl_dpmng.h create mode 100644 drivers/bus/fslmc/mc/fsl_dpmng_cmd.h diff --git a/drivers/bus/fslmc/Makefile b/drivers/bus/fslmc/Makefile index 973d279..7d9f4b6 100644 --- a/drivers/bus/fslmc/Makefile +++ b/drivers/bus/fslmc/Makefile @@ -63,6 +63,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += \ qbman/qbman_portal.c SRCS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += \ + mc/dpmng.c \ mc/dpbp.c \ mc/dpio.c \ mc/mc_sys.c diff --git a/drivers/bus/fslmc/mc/dpmng.c b/drivers/bus/fslmc/mc/dpmng.c new file mode 100644 index 0000000..7fe1787 --- /dev/null +++ b/drivers/bus/fslmc/mc/dpmng.c @@ -0,0 +1,81 @@ +/* Copyright 2013-2015 Freescale Semiconductor Inc. + * + * 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 mc_get_version(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + struct mc_version *mc_ver_info) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_VERSION, + cmd_flags, + 0); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPMNG_RSP_GET_VERSION(cmd, mc_ver_info); + + return 0; +} + +int mc_get_soc_version(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + struct mc_soc_version *mc_platform_info) +{ + struct mc_command cmd = { 0 }; + int err; + + /* prepare command */ + cmd.header = mc_encode_cmd_header(DPMNG_CMDID_GET_SOC_VERSION, + cmd_flags, + 0); + + /* send command to mc*/ + err = mc_send_command(mc_io, &cmd); + if (err) + return err; + + /* retrieve response parameters */ + DPMNG_RSP_GET_SOC_VERSION(cmd, mc_platform_info); + + return 0; +} diff --git a/drivers/bus/fslmc/mc/fsl_dpmng.h b/drivers/bus/fslmc/mc/fsl_dpmng.h new file mode 100644 index 0000000..7dbc825 --- /dev/null +++ b/drivers/bus/fslmc/mc/fsl_dpmng.h @@ -0,0 +1,99 @@ +/* Copyright 2013-2015 Freescale Semiconductor Inc. + * + * 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_DPMNG_H +#define __FSL_DPMNG_H + +/* Management Complex General API + * Contains general API for the Management Complex firmware + */ + +struct fsl_mc_io; + +/** + * Management Complex firmware version information + */ +#define MC_VER_MAJOR 10 +#define MC_VER_MINOR 1 + +/** + * struct mc_versoin + * @major: Major version number: incremented on API compatibility changes + * @minor: Minor version number: incremented on API additions (that are + * backward compatible); reset when major version is incremented + * @revision: Internal revision number: incremented on implementation changes + * and/or bug fixes that have no impact on API + */ +struct mc_version { + uint32_t major; + uint32_t minor; + uint32_t revision; +}; + +/** + * struct mc_platform + * @svr: system version (content of platform SVR register) + * @pvr: processor version (content of platform PVR register) + */ +struct mc_soc_version { + uint32_t svr; + uint32_t pvr; +}; + +/** + * mc_get_version() - Retrieves the Management Complex firmware + * version information + * @mc_io: Pointer to opaque I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @mc_ver_info: Returned version information structure + * + * Return: '0' on Success; Error code otherwise. + */ +int mc_get_version(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + struct mc_version *mc_ver_info); + +/** + * mc_get_soc_version() - Retrieves the Management Complex firmware + * version information + * @mc_io: Pointer to opaque I/O object + * @cmd_flags: Command flags; one or more of 'MC_CMD_FLAG_' + * @mc_platform_info: Returned version information structure. The structure + * contains the values of SVR and PVR registers. Please consult platform + * specific reference manual for detailed information. + * + * Return: '0' on Success; Error code otherwise. + */ +int mc_get_soc_version(struct fsl_mc_io *mc_io, + uint32_t cmd_flags, + struct mc_soc_version *mc_platform_info); + +#endif /* __FSL_DPMNG_H */ diff --git a/drivers/bus/fslmc/mc/fsl_dpmng_cmd.h b/drivers/bus/fslmc/mc/fsl_dpmng_cmd.h new file mode 100644 index 0000000..e5ebc11 --- /dev/null +++ b/drivers/bus/fslmc/mc/fsl_dpmng_cmd.h @@ -0,0 +1,54 @@ +/* Copyright 2013-2016 Freescale Semiconductor Inc. + * + * 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_DPMNG_CMD_H +#define __FSL_DPMNG_CMD_H + +/* Command IDs */ +#define DPMNG_CMDID_GET_VERSION 0x8311 +#define DPMNG_CMDID_GET_SOC_VERSION 0x8321 + +/* cmd, param, offset, width, type, arg_name */ +#define DPMNG_RSP_GET_VERSION(cmd, mc_ver_info) \ +do { \ + MC_RSP_OP(cmd, 0, 0, 32, uint32_t, mc_ver_info->revision); \ + MC_RSP_OP(cmd, 0, 32, 32, uint32_t, mc_ver_info->major); \ + MC_RSP_OP(cmd, 1, 0, 32, uint32_t, mc_ver_info->minor); \ +} while (0) + +/* cmd, param, offset, width, type, arg_name */ +#define DPMNG_RSP_GET_SOC_VERSION(cmd, mc_soc_version) \ +do { \ + MC_RSP_OP(cmd, 0, 0, 32, uint32_t, mc_soc_version->svr); \ + MC_RSP_OP(cmd, 0, 32, 32, uint32_t, mc_soc_version->pvr); \ +} while (0) + +#endif /* __FSL_DPMNG_CMD_H */ diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c index 62c03a2..9008fed 100644 --- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c @@ -61,6 +61,7 @@ #include #include "dpaa2_hw_pvt.h" #include "dpaa2_hw_dpio.h" +#include #define NUM_HOST_CPUS RTE_MAX_LCORE @@ -78,6 +79,10 @@ static int dpaa2_core_cluster_base = 0x04; static int dpaa2_cluster_sz = 2; +#define SVR_LS1080A 0x87030000 +#define SVR_LS2080A 0x87010000 +#define SVR_LS2088A 0x87090000 + /* For LS208X platform There are four clusters with following mapping: * Cluster 1 (ID = x04) : CPU0, CPU1; * Cluster 2 (ID = x05) : CPU2, CPU3; @@ -179,6 +184,22 @@ { int sdest; int cpu_id, ret; + static int first_time; + + /* find the SoC type for the first time */ + if (!first_time) { + struct mc_soc_version mc_plat_info = {0}; + + if (mc_get_soc_version(dpio_dev->dpio, + CMD_PRI_LOW, &mc_plat_info)) { + PMD_INIT_LOG(ERR, "\tmc_get_soc_version failed\n"); + } else if ((mc_plat_info.svr & 0xffff0000) == SVR_LS1080A) { + dpaa2_core_cluster_base = 0x02; + dpaa2_cluster_sz = 4; + PMD_INIT_LOG(DEBUG, "\tLS108x (A53) Platform Detected"); + } + first_time = 1; + } /* Set the Stashing Destination */ cpu_id = rte_lcore_id(); @@ -191,8 +212,6 @@ } /* Set the STASH Destination depending on Current CPU ID. * Valid values of SDEST are 4,5,6,7. Where, - * CPU 0-1 will have SDEST 4 - * CPU 2-3 will have SDEST 5.....and so on. */ sdest = dpaa2_core_cluster_sdest(cpu_id); diff --git a/drivers/bus/fslmc/rte_bus_fslmc_version.map b/drivers/bus/fslmc/rte_bus_fslmc_version.map index a4bb343..43f3354 100644 --- a/drivers/bus/fslmc/rte_bus_fslmc_version.map +++ b/drivers/bus/fslmc/rte_bus_fslmc_version.map @@ -53,6 +53,8 @@ DPDK_17.05 { DPDK_17.08 { global: + mc_get_soc_version; + mc_get_version; qbman_result_SCN_state_in_mem; rte_global_active_dqs_list;