From patchwork Tue Dec 29 09:12:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongbo Zhang X-Patchwork-Id: 59040 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2166764lbb; Tue, 29 Dec 2015 01:13:41 -0800 (PST) X-Received: by 10.55.221.130 with SMTP id u2mr20802657qku.59.1451380421525; Tue, 29 Dec 2015 01:13:41 -0800 (PST) Return-Path: Received: from lists.linaro.org (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTP id a130si69132541qhc.107.2015.12.29.01.13.41; Tue, 29 Dec 2015 01:13:41 -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 1A892616E5; Tue, 29 Dec 2015 09:13:41 +0000 (UTC) Authentication-Results: lists.linaro.org; dkim=fail reason="verification failed; unprotected key" header.d=linaro.org header.i=@linaro.org header.b=ML+7jdl0; 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 47D72616E4; Tue, 29 Dec 2015 09:13:15 +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 9A9A2616E7; Tue, 29 Dec 2015 09:13:10 +0000 (UTC) Received: from mail-pf0-f174.google.com (mail-pf0-f174.google.com [209.85.192.174]) by lists.linaro.org (Postfix) with ESMTPS id C82176164A for ; Tue, 29 Dec 2015 09:13:05 +0000 (UTC) Received: by mail-pf0-f174.google.com with SMTP id q63so89125475pfb.0 for ; Tue, 29 Dec 2015 01:13:05 -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=9pExNeZa/JcnRMWn+0CFwUU7rQAl9GhfM4eQXJftDYw=; b=ML+7jdl0RvnShjHgdJmba3IuwCFkyLXRFmj6uszbQPGxCL+xMs3obTNmP7/rqbgyG5 xKPCRit4Ya8Tada95og/KeoKgBib8ykH9V5UoCfnio0HhKpBQTVf7or0Zl30Q5GX3EiY TLRoHmFIMiUpS9kGVzwqjT7096VDvFjtDeMrM= 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=9pExNeZa/JcnRMWn+0CFwUU7rQAl9GhfM4eQXJftDYw=; b=dSqbxQAAm585XyTTyhezumKgbo6iP1kAFKDv96L0piLYH5uT186vCdBPgs/Ky0rdja ilVCEUC1Aw5OgIjAKuMRS/+H5fMnJVgqF8X/n/DVUWKQ9AorWl1U1qxacktU7FxaAusN ZluS3nh8k/JmpREyV5HJOfZoDQ5I1fi1fEyMtQhH5FSB7cMpCStaG5Z+2UrBw4Rb+Txm 5h5zlKscabOklJxLQ4R47sM9q7WBECFmIMjTL3UDgGH4FcuB2O0Vwh5jiqiZmqlF9ICr LtKrlS4hkTSRwTuhOV5/cg//P5zHhe3Qc12JaJ2ix2UuWggdTwCdN1CXgcTbDBO5I9wE 5D+w== X-Gm-Message-State: ALoCoQlLalxsnRcnG5/Eg3zjZNNNq5IP9JlOoVUEcA8YCTc94twcwqR5nrNiX7YRjUu+0uUOKVqCDDl5cX+Kab8SAfSjn4hD1w== X-Received: by 10.98.18.11 with SMTP id a11mr83683587pfj.7.1451380385111; Tue, 29 Dec 2015 01:13:05 -0800 (PST) Received: from ubuntu1504.ap.freescale.net (gate-zmy3.freescale.com. [192.88.167.1]) by smtp.gmail.com with ESMTPSA id y84sm40884591pfi.93.2015.12.29.01.13.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 29 Dec 2015 01:13:04 -0800 (PST) From: hongbo.zhang@linaro.org To: lng-odp@lists.linaro.org Date: Tue, 29 Dec 2015 17:12:53 +0800 Message-Id: <1451380373-7759-2-git-send-email-hongbo.zhang@linaro.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1451380373-7759-1-git-send-email-hongbo.zhang@linaro.org> References: <1451379388-7533-1> <1451380373-7759-1-git-send-email-hongbo.zhang@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v2 API-NEXT 11/11] linux-generic: sysinfo: apply per-CPU implementation to PowerPC 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 PowerPC platform. Signed-off-by: Hongbo Zhang --- .../linux-generic/arch/powerpc/odp_sysinfo_parse.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c index 5f4e69d..2baed1e 100644 --- a/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c +++ b/platform/linux-generic/arch/powerpc/odp_sysinfo_parse.c @@ -15,14 +15,17 @@ 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, "powerpc"); - 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, "clock"); if (pos) { sscanf(pos, "clock : %lf", &mhz); + sysinfo->cpu_hz[id] = \ + (uint64_t)(mhz * 1000000.0); count--; } } @@ -34,16 +37,21 @@ int odp_cpuinfo_parser(FILE *file, odp_system_info_t *sysinfo) 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--; } } - sysinfo->cpu_hz[0] = (uint64_t)(mhz * 1000000.0); + if (count == 0) { + mhz = 0.0; + model = 0; + count = 2; + id++; + } } return 0;