From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0054.outbound.protection.outlook.com [104.47.34.54]) by dpdk.org (Postfix) with ESMTP id ABF84FA40 for ; Sun, 4 Dec 2016 13:44:20 +0100 (CET) Received: from BLUPR0301CA0020.namprd03.prod.outlook.com (10.162.113.158) by SN1PR0301MB1583.namprd03.prod.outlook.com (10.162.130.17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.747.13; Sun, 4 Dec 2016 12:44:18 +0000 Received: from BN1BFFO11FD046.protection.gbl (2a01:111:f400:7c10::1:193) by BLUPR0301CA0020.outlook.office365.com (2a01:111:e400:5259::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.761.9 via Frontend Transport; Sun, 4 Dec 2016 12:44: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;nxp.com; dkim=none (message not signed) header.d=none; 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 BN1BFFO11FD046.mail.protection.outlook.com (10.58.145.1) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.734.4 via Frontend Transport; Sun, 4 Dec 2016 12:44:18 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:720; Count:10 Received: from bf-netperf1.idc ([10.232.134.28]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id uB4ChXbJ032240; Sun, 4 Dec 2016 05:44:15 -0700 From: Hemant Agrawal To: CC: , , , Hemant Agrawal Date: Sun, 4 Dec 2016 23:47:11 +0530 Message-ID: <1480875447-23680-17-git-send-email-hemant.agrawal@nxp.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> References: <1480875447-23680-1-git-send-email-hemant.agrawal@nxp.com> X-IncomingHeaderCount: 10 X-EOPAttributedMessage: 0 X-Matching-Connectors: 131253290588403328; (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)(7916002)(2980300002)(1109001)(1110001)(336004)(339900001)(199003)(189002)(48376002)(50466002)(47776003)(356003)(106466001)(105606002)(2351001)(626004)(33646002)(8676002)(85426001)(305945005)(92566002)(97736004)(8666005)(189998001)(7846002)(76176999)(50986999)(8936002)(50226002)(104016004)(5003940100001)(86362001)(36756003)(81156014)(81166006)(4326007)(68736007)(6666003)(2950100002)(2906002)(6916009)(110136003)(77096006)(39400400001)(39410400001)(39380400001)(39450400002)(38730400001)(5660300001)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR0301MB1583; H:tx30smr01.am.freescale.net; FPR:; SPF:Fail; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN1BFFO11FD046; 1:oQ3lp6YHHHy7WMXdy7ftBfIbZN+RgrZTI4/ZtDNUzIgXK2UAzMXEjsrJxcM+XjkxzAGiVNwZst1N1WpkL1RH4BoO8C63oRCSqCCAufb3OhXLfY8XrCVIYSCGKy5x3/3BBNFD2Wp9arAqXUXIosvZUpGX+WEXGxjiRb5MhiS5HYppN3sapYkGuHJbob7Q/AZAljCEE4bBlogdqYLjhnPz28aAvKmqVJBRRiFgqTnniDq1QX0EnkKa0Dx3Ks4v/Q6g9fqKE5JhoyU/1JlixSt8ZSvFX4y+3o7XuZirroEcPZslRjrR5uyiRpLD9/V0cDFRZq3mLrFO0r0cm+I5dfvt9RFL8TTXGd0/yWymB2+XF3bG8AolwG4Z/On5Gi+k0EeD44GXSxHCXqWgeP3PlwDe1idEsIDcBQOtKr5cK60yhN1kBWwAUn9lAzRv3fsKz0EdSQo2Ee+U5mp8m0HpwaDWZCGLMxdndEhsO+sFpmWuHCQqGBw0g+fyVblOEFtpWtRQweug1iGgCnScJsWq8lciT1FOPLgu9xOZcF8py6MJX/fZzIjbdBfSif49IL5GiJRWw5YyGzKIzvfp3ex/XasrMBpnc39g0zVV/M39/FhDxpSbsCelIEVbU2WRWz0Pj+LYE0U6OVpYKKpdsfTjN0thiyLveQU64FYhgVuJt614VJL3Xt5EA7bwCF71r8x/ESD+VQqYz4UqYkxoWfYKcE0qTE5YVGPEz0ZtAxm7YB2iYRSeUuNaKeJMTFipgPfTu8k9olousYk5LaEdsGzh+Qjmbg== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 7dd89f10-cc30-4847-0a29-08d41c434381 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:SN1PR0301MB1583; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1583; 3:xKooPbky72Pjv6qCY1L3jgid+sYv50o5x056kFIHrBKh+J6lU+KO5NYVHK3gKrppiZjI4LdDxUQkN5CDz+9Pg6uJ22svDoUYsKTuJvdtwbnmwVEv3ivmGUkatbaiQCYuhnO72SZkPUt9s/TJbLvO5tjlRPgM9QqZ20q/bdClmgzJ1WFhfXVYDGhwwuc8LJJ3Za3QdbtFl2WMeOY/0A/5DO1n71lt5snURGsgyQeLtieQRnHmPpexf0CP+TkvBu2xyUe9HShY/k770m8Pev5Bag7krSDVWYCUwIZaz+B/EBqaSFUKy/jPXKwEGkgTGakuL5KjgxJlCU2V91VIihJk05ClYzH2oRZNEMP4fJhH5F10MYl8lHFVg+bUTjj8MAQw; 25:5sCP+FgtqFudTisuid8KeJfsu7WX6oEd/vUPfOUGG87wUldLYMmrdCH5obWOn98T12Z4V1+ejoh/E/qT+hb+mUaAfNdnIDF11e6MFFnJ0wl5C/hpEgtf4T85nb5kQNduc1XdQG8cIb4G4PqhBM7OEhqtk3S7ZDxF+tR7vWjgctu779XCDRROuz15u9MBS9mLvlHre3rEkhS932ZgdsgLy0G8eLs0sctkMdZrUlBeIrYoSuDLTdIasfrJpHUh106N/7JK7qpgNI3uJ6xcEbR35Nk+EWHNyk7GOuhJ659jr8cpsfWYnygH7AiZOjmdUc3xL0e4efCzHj6B6rBCnW263NkRoPLXe4/9fKux+B0aJwIqWHFCcdgun+lVfCqODz+M4mVyCvg7TBSmVmLvReZwf6aG30XtHjw96fsJEZtHxw2Jv5lUmEJtZUosUQHtm0O4sVTEvpzmi/ColMVKOTm+Hw== X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1583; 31:Zfr/ds3NdUnNqV/HJXVYglDO+e3MF+NixkhoAyShkZYnsug7gn1IKACChnlQKpbM6zbEQbR1sC8R88fy7A5UUdBUoeXPIQ/YOem5H4EPUytaElCDwZQ37aloLqeZVi2Ecc6q7Oj4u0KIWXrR1yg9EdaXWiMPUU6GAkUSBeTY/zQ26q0PiLyupp32gqQ03MjkLc9/idsvXo3rWm8ijYJlWUcZvCahpKC629ZT+2pur9yoRdVpDClt37NUC+UFI5BPcY/oOMlCvsNOlh0lVpsWwIm9S4wzJe5OBCWL87Ve8Ac= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6095060)(601004)(2401047)(13017025)(13023025)(13015025)(13024025)(13018025)(8121501046)(5005006)(10201501046)(3002001)(6055026)(6096035)(20161123565025)(20161123561025)(20161123559025)(20161123556025)(20161123563025); SRVR:SN1PR0301MB1583; BCL:0; PCL:0; RULEID:(400006); SRVR:SN1PR0301MB1583; X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1583; 4:f65YGn3v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u86rqFggZz9CNRmvz1VtVsCyA6+q/JvhSgR01zuJMJURw/?= =?us-ascii?Q?We0R3gS/nt8G79teOHMFKIXuwlnhwZtRhWwP2ZAxV8Fezt0KyWTagWtDcSLQ?= =?us-ascii?Q?A/UVIYNvUG/2cv8jiG1SCEtcsawdlzAJkgKWUwDXqhPoZK/kCQFXqCZAdeQ?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1583; 6:zlhQCVmk0HHlHDx0E2/9g6AoqpPo3OPoyuS4xxarSUZzdPuKyFzgspZupJbYB/rPpGv1/ZHFu+TRlqg2rtG1tRa62Kzuav69BiLsCClVgduY7hq98NJ4fLvBG882EyWKtdcX8aX08T7G8cVknslOR7L56rF3LuEsow35MOYvS3TM+6LfBf3lHJ6EmzIXpcwtjICqkc9gETt67jQBCRu4BwAXYyWt2pKf+Jl8XPgNzB98ZZI1y6SvUxWZjpKC1rZNxWukV/z8frr+Rdp+GM+NuS5OJiray3yQB4c0l59Knt+SLQNLGsV0nlKj4mGXVwXFWSde8sO4cFKwLkk+N7nHJzrCUHf2dif9gKniVL38TCAxbh5DZDYwa1gZ7cybmpme5PvJcdYSMUPNKJXS34IO8ZG5Fe7z2CmjVA/T2nQXXWOvmWI3okOttzH08Y07Q54j; 5:hnlXjdlQQxi67cQ/BFfXhgkJwTAw11OysSIKWxRWQaOEp4Xh0qhQwALWaLFSeeH0X1/+OxEWFtiJ2jg539YO51y1pbsLRdAJUteQF0hidrzP6rNpmAqMhvfsE4Fd1wRyqP7u1PNrPC46j4SCUcOTy37Jwaah6JfwknabKb3KakSD7TKtFhi9deAehbO6hQVo; 24:+QGpGS4qu+BgRRtR7OsT4wOaz7ExgQemS2P9BirhX3SPb8ZKVm+/F9fTw/jtd6/8bSQKKDQWcoSL0CkHp94nHQl0JbK6cfa4jkq9MCvnZGU= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR0301MB1583; 7:vueO8zwA9A2N5lb4F0EJa8P98YiNPeIpq1/HBbB3g1y2hkUk1Wwxn1Aue0LNpBCkb5dVPE+yjlls3yLWbNKvAjXPKWkOjuj6yCDQPlFzHsr1w76Wa+HHfOdoehIiZ9lecK/TlSyCdxt7nBZdb5VwIcwHGfiiPxx+zNO21OhOdhTx+HkdNVCDBwZ3M0sFzECmzauvGunwyid/E2htW7BhgePt0KOq1WVZMrFsijw1LEIOfr0l/OQ0YrmR04W+v+g8iItfu9i68J5zzEsGPZpROO/j4VacNsYG0pzBeyCzy2b7cl6hzmyzxxH5x6Uji7tO+uPyQVvn2fQ6f40mtoQdEcwcTnjyOBNCYn0CQhP24K3IEdm0nGdJ7/Te5/ScitJlkDcU7vS+1CohB9Ekm1jdvcld7vb58kMInCgmkTfP3B+VW0V9XqpOXfrfGywLP0Kc1JMq+VZm2oVISDX7yBSkxQ== X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2016 12:44:18.5127 (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: SN1PR0301MB1583 Subject: [dpdk-dev] [PATCH 16/32] net/dpaa2: dpio add support to check SOC type X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 04 Dec 2016 12:44:21 -0000 Signed-off-by: Hemant Agrawal --- drivers/net/dpaa2/base/dpaa2_hw_dpio.c | 74 ++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/drivers/net/dpaa2/base/dpaa2_hw_dpio.c b/drivers/net/dpaa2/base/dpaa2_hw_dpio.c index 9c6eb96..3b8f87d 100644 --- a/drivers/net/dpaa2/base/dpaa2_hw_dpio.c +++ b/drivers/net/dpaa2/base/dpaa2_hw_dpio.c @@ -70,6 +70,18 @@ static struct dpio_device_list *dpio_dev_list; /*!< DPIO device list */ static uint32_t io_space_count; +#define ARM_CORTEX_A53 0xD03 +#define ARM_CORTEX_A57 0xD07 +#define ARM_CORTEX_A72 0xD08 + +static int dpaa2_soc_core = ARM_CORTEX_A72; + +#define NXP_LS2085 1 +#define NXP_LS2088 2 +#define NXP_LS1088 3 + +static int dpaa2_soc_family = NXP_LS2088; + /*Stashing Macros default for LS208x*/ static int dpaa2_core_cluster_base = 0x04; static int dpaa2_cluster_sz = 2; @@ -101,6 +113,58 @@ return dpaa2_core_cluster_base + x; } +static int cpuinfo_arm(FILE *file) +{ + char str[128], *pos; + int part = -1; + + #define ARM_CORTEX_A53_INFO "Cortex-A53" + #define ARM_CORTEX_A57_INFO "Cortex-A57" + #define ARM_CORTEX_A72_INFO "Cortex-A72" + + while (fgets(str, sizeof(str), file) != NULL) { + if (part >= 0) + break; + pos = strstr(str, "CPU part"); + if (pos != NULL) { + pos = strchr(pos, ':'); + if (pos != NULL) + sscanf(++pos, "%x", &part); + } + } + + dpaa2_soc_core = part; + if (part == ARM_CORTEX_A53) { + dpaa2_soc_family = NXP_LS1088; + printf("\n########## Detected NXP LS108x with %s\n", + ARM_CORTEX_A53_INFO); + } else if (part == ARM_CORTEX_A57) { + dpaa2_soc_family = NXP_LS2085; + printf("\n########## Detected NXP LS208x Rev1.0 with %s\n", + ARM_CORTEX_A57_INFO); + } else if (part == ARM_CORTEX_A72) { + dpaa2_soc_family = NXP_LS2088; + printf("\n########## Detected NXP LS208x with %s\n", + ARM_CORTEX_A72_INFO); + } + return 0; +} + +static void +check_cpu_part(void) +{ + FILE *stream; + + stream = fopen("/proc/cpuinfo", "r"); + if (!stream) { + PMD_INIT_LOG(WARNING, "Unable to open /proc/cpuinfo\n"); + return; + } + cpuinfo_arm(stream); + + fclose(stream); +} + static int configure_dpio_qbman_swp(struct dpaa2_dpio_dev *dpio_dev) { @@ -326,6 +390,16 @@ static inline struct dpaa2_dpio_dev *dpaa2_get_qbman_swp(void) { struct dpaa2_dpio_dev *dpio_dev; struct vfio_region_info reg_info = { .argsz = sizeof(reg_info)}; + static int first_time; + + if (!first_time) { + check_cpu_part(); + if (dpaa2_soc_family == NXP_LS1088) { + dpaa2_core_cluster_base = 0x02; + dpaa2_cluster_sz = 4; + } + first_time = 1; + } if (obj_info->num_regions < NUM_DPIO_REGIONS) { PMD_INIT_LOG(ERR, "ERROR, Not sufficient number " -- 1.9.1