From patchwork Tue Dec 29 10:31:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Zhang X-Patchwork-Id: 59050 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2198479lbb; Tue, 29 Dec 2015 02:39:15 -0800 (PST) X-Received: by 10.140.109.247 with SMTP id l110mr20729403qgf.52.1451385555269; Tue, 29 Dec 2015 02:39:15 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id f185si69505407qkb.71.2015.12.29.02.39.14; Tue, 29 Dec 2015 02:39:15 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) client-ip=54.225.227.206; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.225.227.206 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dkim=neutral (body hash did not verify) header.i=@linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id D5F75615C0; Tue, 29 Dec 2015 10:39:14 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=DNiCUAJB; dkim-adsp=none (unprotected policy); dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,T_DKIM_INVALID,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id EAFBD61702; Tue, 29 Dec 2015 10:33:58 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 603B8616E8; Tue, 29 Dec 2015 10:33:52 +0000 (UTC) Received: from mail-pf0-f182.google.com (mail-pf0-f182.google.com [209.85.192.182]) by lists.linaro.org (Postfix) with ESMTPS id 9CFC9616EB for ; Tue, 29 Dec 2015 10:31:57 +0000 (UTC) Received: by mail-pf0-f182.google.com with SMTP id 65so81257139pff.3 for ; Tue, 29 Dec 2015 02:31:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PWAsVTLVaSbX6eqWNGEFmsm6R5rck5jAWqRnwUxGMEE=; b=DNiCUAJBIE7+I8PPLBZL7UhDEDQzcDNdKguu1PNodWfGVsUeFpOLnX1OCVRpRn9HR5 amQsLKRSeFsdddc6wO6Re8jibRFWzBrLkp6iUDcx4ufcHDwBi7HhO7lFHHxq/X/0U1pv Ub0wCHB5ykIhUZdMjO0JJJ19pJVz9g+uSoVjM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PWAsVTLVaSbX6eqWNGEFmsm6R5rck5jAWqRnwUxGMEE=; b=Ji8V37nazrX+GR2Xr7+fbdL/LNWnh4iZ/DOtu8LvIRC36j1IKf+fCsiwXaKOn+Kwnf fAGmJq9/+Lx9i8+ESSJQOwJCGsbNBXOeKyxKjT/ukG7rtPIerwT6QLXyeumz/0RXZeNY isNhmi9XdxltH2/N7y7PidlDVBWSYaBgk76tVxBGW2TK0tHuaDGbtMp7D4WJrvUb0ssm mp5j/WNtiESz+0dBocSYu6S3iz6b9k6f1NFU+Klz0/NhzwmupDOJS4vZWOHLdaGbItUE So74HnsHfVWTxcbYzOZmqg3NJBb3WWhceJzaHQ9qWfWIkbybrN2k5nCPGqsMAh2fql+/ WN6Q== X-Gm-Message-State: ALoCoQnSV2lc7Bw7PWGAz7hcTMnZTFfatipg+FNDq2yP3CJ8uKgQaGuxeivKtViL9YBO/+QKTW96jiocYaocd/ld3T238xxC2g== X-Received: by 10.98.42.75 with SMTP id q72mr86591234pfq.10.1451385117028; Tue, 29 Dec 2015 02:31:57 -0800 (PST) Received: from ubuntu1504.ap.freescale.net (gate-zmy3.freescale.com. [192.88.167.1]) by smtp.gmail.com with ESMTPSA id 7sm82291757pfb.62.2015.12.29.02.31.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Dec 2015 02:31:56 -0800 (PST) From: hongbo.zhang@linaro.org To: lng-odp@lists.linaro.org Date: Tue, 29 Dec 2015 18:31:21 +0800 Message-Id: <1451385082-8364-11-git-send-email-hongbo.zhang@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1451385082-8364-1-git-send-email-hongbo.zhang@linaro.org> References: <1451385082-8364-1-git-send-email-hongbo.zhang@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v3 API-NEXT 10/11] linux-generic: sysinfo: apply per-CPU implementation to MIPS X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Hongbo Zhang When per-CPU framework was introduced, it was only implemented on x86, for other platforms, only the model_str[0] and cpu_hz[0] are set to pass compile, this patch set all values for model_str[] and cpu_hz[] on the MIPS platform. Signed-off-by: Hongbo Zhang --- .../linux-generic/arch/mips64/odp_sysinfo_parse.c | 24 ++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c index 3415516..9490e01 100644 --- a/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/mips64/odp_sysinfo_parse.c @@ -15,14 +15,18 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo) double mhz = 0.0; int model = 0; int count = 2; + int id = 0; strcpy(sysinfo->cpu_arch_str, "octeon"); - while (fgets(str, sizeof(str), file) != NULL && count > 0) { + while (fgets(str, sizeof(str), file) != NULL && id < MAX_CPU_NUMBER) { if (!mhz) { pos = strstr(str, "BogoMIPS"); if (pos) { sscanf(pos, "BogoMIPS : %lf", &mhz); + /* bogomips seems to be 2x freq */ + sysinfo->cpu_hz[id] = \ + (uint64_t)(mhz * 1000000.0 / 2.0); count--; } } @@ -33,18 +37,22 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo) if (pos) { int len; pos = strchr(str, ':'); - strncpy(sysinfo->model_str[0], pos + 2, - sizeof(sysinfo->model_str[0])); - len = strlen(sysinfo->model_str[0]); - sysinfo->model_str[0][len - 1] = 0; + strncpy(sysinfo->model_str[id], pos + 2, + sizeof(sysinfo->model_str[id])); + len = strlen(sysinfo->model_str[id]); + sysinfo->model_str[id][len - 1] = 0; model = 1; count--; } } - } - /* bogomips seems to be 2x freq */ - sysinfo->cpu_hz[0] = (uint64_t)(mhz * 1000000.0 / 2.0); + if (count == 0) { + mhz = 0.0; + model = 0; + count = 2; + id++; + } + } return 0; }