From patchwork Mon May 15 12:37:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hemant Agrawal X-Patchwork-Id: 24314 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 D0A2F7CF8; Mon, 15 May 2017 14:38:52 +0200 (CEST) Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0046.outbound.protection.outlook.com [104.47.38.46]) by dpdk.org (Postfix) with ESMTP id 023657CA3 for ; Mon, 15 May 2017 14:38:34 +0200 (CEST) Received: from DM5PR03CA0012.namprd03.prod.outlook.com (2603:10b6:3:118::22) by BL2PR03MB161.namprd03.prod.outlook.com (2a01:111:e400:c0d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1084.16; Mon, 15 May 2017 12:38:33 +0000 Received: from BL2FFO11FD030.protection.gbl (2a01:111:f400:7c09::100) 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.1084.16 via Frontend Transport; Mon, 15 May 2017 12:38:33 +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 BL2FFO11FD030.mail.protection.outlook.com (10.173.161.40) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1075.5 via Frontend Transport; Mon, 15 May 2017 12:38:32 +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 v4FCbxO7003970; Mon, 15 May 2017 05:38:31 -0700 From: Hemant Agrawal To: CC: , Date: Mon, 15 May 2017 18:07:42 +0530 Message-ID: <1494851864-26029-20-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1494851864-26029-1-git-send-email-hemant.agrawal@nxp.com> References: <1492607395-5922-1-git-send-email-hemant.agrawal@nxp.com> <1494851864-26029-1-git-send-email-hemant.agrawal@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131393255130390595; (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)(39860400002)(39450400003)(39840400002)(39380400002)(39410400002)(39400400002)(39850400002)(2980300002)(1110001)(1109001)(339900001)(199003)(189002)(9170700003)(305945005)(8656002)(53936002)(33646002)(54906002)(47776003)(48376002)(106466001)(50466002)(2351001)(4326008)(36756003)(77096006)(105606002)(356003)(189998001)(8676002)(5660300001)(81166006)(85426001)(68736007)(86362001)(560934005)(104016004)(5003940100001)(2906002)(2950100002)(6666003)(76176999)(110136004)(6916009)(38730400002)(498600001)(50226002)(50986999)(8936002)(2004002); DIR:OUT; SFP:1101; SCL:1; SRVR:BL2PR03MB161; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; MLV:ovrnspm; A:1; MX:1; PTR:InfoDomainNonexistent; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BL2FFO11FD030; 1:gety4O89I/0WgXZyBqStBHJ5K6LPf842NO7TI4SwTuTJ7blFF+PQBX9PXJhHN600OnBE7pHlQHQ+ixGav+6XDNNUGhXCc1IOIC8dwQNTAIAyCaVfu2r0k8f2k3DJGunEaQiM8q1cSwyJtjb08TcY+CmIpcq2XuYJqJaJ/pt7vQ//ytPfzgruCvKLmcQD+8zQZeLfXxToqNINEaYgAe5sJUc6TFUyn1vPbOvgRa8CbreEc5dxEdZaL+7hbfUQJoQz9VBVzfukN0XyX9LKR0Cz7gbdXSCfnaCVlOdfdlLPt97/N5NWZzQELGPx8+a+wC1WfzkioIZUHMkPy1ACB4jY8UU1CAKH/eQh+8zGJ3UKNMRRY0Htc4H2/WeZkkSRfLb/DCjpBYQ6qrfT5yuHd4QUGEDaIRlJIOpczXY/yUcqVLrZz+7QjukXmyEzjpdoU55xTFOzUAW9lbKg8QvzyOCAHHICmbRGiWoVGwBK4Sqln2ZseiWVtcBSbQOm9Ejjf7O4LhWKZ0Vk9z7lhcQXvYr1GfBm4x6QJ8vRZtAfHf232ALlznfYdH3vrMQ7S/tqN/PLoGq1pnrkkM2Dup5mwI0Vq32i2dNdAZ+8oRBJAKHxRsd+IIKGn8onUE0Xu2o0wijM2/30rLvbN3/MPO+X7gevd4Fy+Lboo5l2er/owWNMcTiSEYlC58euZALf6078l8dj0FFwe/Nbnb8qc285YKkxTh6LG6qY8F+WsP8/W/ygj0I5T7KY4IfeNv3IXHX3mtZRDGm7VrSgZBvot30tTyGufQ== MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: acae7ce4-bbe8-4fd6-7eef-08d49b8f4c62 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131430075)(201703131517081); SRVR:BL2PR03MB161; X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB161; 3:58vR1qX4j5XTIykwC8ZMVAF7PnmMxLTuUHK4w+1X/TmFZ09S8dcVR+jwsPGGk+2rtSTmbcEJsXPf4RbpWpiU6js/b1vXbc8JUaR2z0OWj1joqDsHMW51uCfyvHZSsjLWFfPC6QS41HZDTIscoidxSuFEX2kXiex4k3XDVKS22Kh4A/idfGKo/XAgnxHsu/ram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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)(13018025)(13023025)(8121501046)(5005006)(13024025)(13015025)(13017025)(93006095)(93001095)(3002001)(10201501046)(6055026)(6096035)(20161123565025)(20161123561025)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123559100)(20161123563025)(20161123556025); SRVR:BL2PR03MB161; BCL:0; PCL:0; RULEID:(400006); SRVR:BL2PR03MB161; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BL2PR03MB161; 4:fH6KH427iIxeA2WJOGKZ/nvNENTExGCAykezk3wAPBP?= rGVGY0H8UuWVqNsDcBV/bOdXmFSK5igtUCBAB49QXjpuvvwdntczXuurqXbe3moYOV7Sb3HWveYNO9crEik1SBWAeAKK/V0L70L0w8haM9VyLtV0WqI7GNhz/XRfRRj84HoJibQb4cAUciX3ZDkUItu6J1tbOKteeMsBD3bD37qkhks94vAXWzMkLrdjWTQhU7RyUMnxeZXYb6TVU4PJL60SS1N8Wqw7HNvkAGu9x39pjHur+2sNTF9fOepMnaULWMEwOxXS9UadUZzJX5QsWhlCodsEr1mhxBqGk2DeO6f/NOlC6aoCFdF9vAwtJV+Fg7zsFuZWXNwQXDz9/YMM5G/9JbsGefExZeWJu64pDLDXV51tfOcvyjXS4GPe0CdAjBtZXGtLrvmrW3y2/O7uvPUCtpPXAftXwYResoyxHSEzrb0oi70JlcZd2g3Nv94ZPKLZG06sqnShkanGAAh/5s62u4TKThpEJm1fgTvheMiYod8QLfufykwnnabUMplg2GaVmQTaxrRlrsMO49guq/WIRt7ZFe9CZJzvSdSxKdlQQSxLf/p1iRnLsSblxfz5IKp37dLiqOsp8FKGDWPuWRF+0efvQhAjqnAnys/b3HURIILFGLqLTfmW5+THKIhzPoqXWX4ws/8QjbWNdvHsfmuK8PwAwPM6nf6f6lv3rBqx6wIYK0rRkyg7goPeBxSNbOUNiM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1+jRIeypnDUmjhDI7wJty51vah8L7DwG0h1ZqjhDxVmwzGJcvIX71KGiNthO7fWOpJtuD7ge05JQ==; 5:ubTVFlWyTSHOVzdSYItFlek9IVDtHcB2SsnFwOya8/w0R7Vqjign3WNy6faNEX3giIP2TZ4Yp/TrMA6hgOA59VsWRtsFiOq3uUpvYaJqoNAhSiqHjc1nGHq5Ibo7q98AybPewiZz4PKFVQxoxVLDDg/pQB5CKeIr/bw14/E2KS06JX3drSPcqL8wsYVNEbLk; 24:kzh0zE3fXYgeid86kQOZj1+yXEQs1fMNwEFaA+dmX34fyW/vOL/n4qfB2Kd6740Soz+D5c8nkWeuheMr3OsWEHUQWfKO6NtSbEn++U8hV5A= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BL2PR03MB161; 7:gPkGb0R6wwPzzLEVAjd9NFu1lup6GIIrVIAhT79NQcpPAUhB4DnDyXebxGvLUQZ3dI1heOKcr+lrNBnsV902hLlHcE1WEKqOG6KWgn6quDIh05KfhEdqyZk0HfTFA/XYCH4LRc/lG/xdkaH9dovq66suM5nFIYUy5ocSlEp52lYyqBQ2ZbffXj/07vGTyWvCtLDm1Bqkbk5YgY66O8VFvA5p8BeQKOxGoQHMwrDYm61fM322b2zS5930BA54HS8qb+BHUYpqNXAh2bgyngOq0I6OBYPWUinPJl8YpCG5fhfEKK/qwcRRNiGVyBkkIqnfLlsAh9FHIeTqrt0k5ljuew== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 May 2017 12:38:32.8674 (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: BL2PR03MB161 Subject: [dpdk-dev] [PATCH v2 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 73b1808..530da5d 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 6e7b94d..6cde94f 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; local: *;