From patchwork Tue Jun 17 17:55:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Taras Kondratiuk X-Patchwork-Id: 32095 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f198.google.com (mail-ie0-f198.google.com [209.85.223.198]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 28D1620C81 for ; Tue, 17 Jun 2014 17:56:29 +0000 (UTC) Received: by mail-ie0-f198.google.com with SMTP id y20sf44008394ier.5 for ; Tue, 17 Jun 2014 10:56:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:subject:precedence:list-id:list-unsubscribe:list-archive :list-post:list-help:list-subscribe:mime-version:errors-to:sender :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=xxrd3sEihvwnZkjfZ07dSBR07eGxbP0u4cTt87Z6uxM=; b=lZLzZE8HPxC+tCYHs/PU+ZxtSwWt8DfaiNPF4CW89JGaTkZeR0UqZVK1k66VGr4t7n +PANBCzuEs3uFaAyxCgoR07BAP52okIaHScnJlG0sMlC9oV+f7R/SinWABp4DBJUoEFd DBhlpLRmkUWfVGYf754gYjNlo0LqGopEkzK2VchM30aJ4aEQ/0gwXDhshyNoapJDZwV0 lTopWGncOm2aVDzo2613JFE+MzsRXWHJkNqlTsvb5opCPo0NbVTLieR5K1wFaM6QT3l0 olIqW8Rpo1F2ydWdjKr02xCvhLPYg5axTrFfgjSJVozr4LjDODZoHIh2prXoNBdg+ZnH g6Ww== X-Gm-Message-State: ALoCoQkucLvAfSJ3fgq+9Q/DJwp+9gB+Y5RBgCfTVdV30u3wsOwJeVZ1G20IUNPChBpO4ZNthjk1 X-Received: by 10.182.181.35 with SMTP id dt3mr4046226obc.9.1403027788671; Tue, 17 Jun 2014 10:56:28 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.83.227 with SMTP id j90ls187741qgd.47.gmail; Tue, 17 Jun 2014 10:56:28 -0700 (PDT) X-Received: by 10.58.219.166 with SMTP id pp6mr23589164vec.1.1403027788539; Tue, 17 Jun 2014 10:56:28 -0700 (PDT) Received: from mail-vc0-f178.google.com (mail-vc0-f178.google.com [209.85.220.178]) by mx.google.com with ESMTPS id ys16si5763053vdc.32.2014.06.17.10.56.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Jun 2014 10:56:28 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) client-ip=209.85.220.178; Received: by mail-vc0-f178.google.com with SMTP id ij19so6720421vcb.23 for ; Tue, 17 Jun 2014 10:56:28 -0700 (PDT) X-Received: by 10.220.167.2 with SMTP id o2mr23131023vcy.8.1403027788470; Tue, 17 Jun 2014 10:56:28 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.54.6 with SMTP id vs6csp227580vcb; Tue, 17 Jun 2014 10:56:28 -0700 (PDT) X-Received: by 10.140.100.210 with SMTP id s76mr5179948qge.93.1403027787980; Tue, 17 Jun 2014 10:56:27 -0700 (PDT) Received: from ip-10-141-164-156.ec2.internal (lists.linaro.org. [54.225.227.206]) by mx.google.com with ESMTPS id o6si14735274qgo.11.2014.06.17.10.56.27 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 17 Jun 2014 10:56:27 -0700 (PDT) Received-SPF: none (google.com: lng-odp-bounces@lists.linaro.org does not designate permitted sender hosts) client-ip=54.225.227.206; Received: from localhost ([127.0.0.1] helo=ip-10-141-164-156.ec2.internal) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Wwxam-0004tT-5x; Tue, 17 Jun 2014 17:54:44 +0000 Received: from mail-lb0-f180.google.com ([209.85.217.180]) by ip-10-141-164-156.ec2.internal with esmtp (Exim 4.76) (envelope-from ) id 1Wwxa4-0004nB-TI for lng-odp@lists.linaro.org; Tue, 17 Jun 2014 17:54:01 +0000 Received: by mail-lb0-f180.google.com with SMTP id w7so2276099lbi.25 for ; Tue, 17 Jun 2014 10:55:37 -0700 (PDT) X-Received: by 10.112.97.146 with SMTP id ea18mr2416004lbb.67.1403027737879; Tue, 17 Jun 2014 10:55:37 -0700 (PDT) Received: from localhost.localdomain (176-241-155-136-dynamic.retail.datagroup.ua. [176.241.155.136]) by mx.google.com with ESMTPSA id d3sm11646351lbw.2.2014.06.17.10.55.36 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 17 Jun 2014 10:55:37 -0700 (PDT) From: Taras Kondratiuk To: lng-odp@lists.linaro.org Date: Tue, 17 Jun 2014 20:55:12 +0300 Message-Id: <1403027720-9738-11-git-send-email-taras.kondratiuk@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1403027720-9738-1-git-send-email-taras.kondratiuk@linaro.org> References: <1403027720-9738-1-git-send-email-taras.kondratiuk@linaro.org> X-Topics: patch Subject: [lng-odp] [PATCH v2 10/18] Split out platform-specific part of odp_coremask.h X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: 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-bounces@lists.linaro.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: taras.kondratiuk@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.178 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Signed-off-by: Taras Kondratiuk --- include/odp_coremask.h | 48 +++-------- platform/linux-generic/include/plat/odp_coremask.h | 91 ++++++++++++++++++++ 2 files changed, 101 insertions(+), 38 deletions(-) create mode 100644 platform/linux-generic/include/plat/odp_coremask.h diff --git a/include/odp_coremask.h b/include/odp_coremask.h index 141cb6a..e577acf 100644 --- a/include/odp_coremask.h +++ b/include/odp_coremask.h @@ -18,23 +18,13 @@ extern "C" { #endif - - #include - -/** @internal */ -#define ODP_COREMASK_SIZE_U64 1 +#include /** * Core mask - * - * Don't access directly, use access functions. */ -typedef struct odp_coremask_t { - uint64_t _u64[ODP_COREMASK_SIZE_U64]; /**< @private Mask*/ - -} odp_coremask_t; - +typedef plat_odp_coremask_t odp_coremask_t; /** @@ -86,10 +76,7 @@ void odp_coremask_from_u64(const uint64_t *u64, int num, odp_coremask_t *mask); * Clear entire mask * @param mask Core mask to flush with zero value */ -static inline void odp_coremask_zero(odp_coremask_t *mask) -{ - mask->_u64[0] = 0; -} +void odp_coremask_zero(odp_coremask_t *mask); /** * Add core to mask @@ -120,8 +107,6 @@ int odp_coremask_isset(int core, const odp_coremask_t *mask); */ int odp_coremask_count(const odp_coremask_t *mask); - - /** * Logical AND over two source masks. * @@ -129,11 +114,8 @@ int odp_coremask_count(const odp_coremask_t *mask); * @param src1 Source mask 1 * @param src2 Source mask 2 */ -static inline void odp_coremask_and(odp_coremask_t *dest, odp_coremask_t *src1, - odp_coremask_t *src2) -{ - dest->_u64[0] = src1->_u64[0] & src2->_u64[0]; -} +void odp_coremask_and(odp_coremask_t *dest, odp_coremask_t *src1, + odp_coremask_t *src2); /** * Logical OR over two source masks. @@ -142,11 +124,8 @@ static inline void odp_coremask_and(odp_coremask_t *dest, odp_coremask_t *src1, * @param src1 Source mask 1 * @param src2 Source mask 2 */ -static inline void odp_coremask_or(odp_coremask_t *dest, odp_coremask_t *src1, - odp_coremask_t *src2) -{ - dest->_u64[0] = src1->_u64[0] | src2->_u64[0]; -} +void odp_coremask_or(odp_coremask_t *dest, odp_coremask_t *src1, + odp_coremask_t *src2); /** * Logical XOR over two source masks. @@ -155,20 +134,13 @@ static inline void odp_coremask_or(odp_coremask_t *dest, odp_coremask_t *src1, * @param src1 Source mask 1 * @param src2 Source mask 2 */ -static inline void odp_coremask_xor(odp_coremask_t *dest, odp_coremask_t *src1, - odp_coremask_t *src2) -{ - dest->_u64[0] = src1->_u64[0] ^ src2->_u64[0]; -} +void odp_coremask_xor(odp_coremask_t *dest, odp_coremask_t *src1, + odp_coremask_t *src2); /** * Test if two masks contain the same cores */ -static inline int odp_coremask_equal(odp_coremask_t *mask1, - odp_coremask_t *mask2) -{ - return (mask1->_u64[0] == mask2->_u64[0]); -} +int odp_coremask_equal(odp_coremask_t *mask1, odp_coremask_t *mask2); #ifdef __cplusplus } diff --git a/platform/linux-generic/include/plat/odp_coremask.h b/platform/linux-generic/include/plat/odp_coremask.h new file mode 100644 index 0000000..594a75f --- /dev/null +++ b/platform/linux-generic/include/plat/odp_coremask.h @@ -0,0 +1,91 @@ +/* Copyright (c) 2013, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + + +/** + * @file + * + * ODP core masks and enumeration + */ + +#ifndef ODP_COREMASK_H_ +#error This file should be included only into corresponding top level header +#else + +/** @internal */ +#define ODP_COREMASK_SIZE_U64 1 + +/** + * Core mask + * + * Don't access directly, use access functions. + */ +typedef struct plat_odp_coremask_t { + uint64_t _u64[ODP_COREMASK_SIZE_U64]; /**< @private Mask*/ + +} plat_odp_coremask_t; + +/** + * Clear entire mask + * @param mask Core mask to flush with zero value + */ +static inline void odp_coremask_zero(plat_odp_coremask_t *mask) +{ + mask->_u64[0] = 0; +} + +/** + * Logical AND over two source masks. + * + * @param dest Destination mask, can be one of the source masks + * @param src1 Source mask 1 + * @param src2 Source mask 2 + */ +static inline void odp_coremask_and(plat_odp_coremask_t *dest, + plat_odp_coremask_t *src1, + plat_odp_coremask_t *src2) +{ + dest->_u64[0] = src1->_u64[0] & src2->_u64[0]; +} + +/** + * Logical OR over two source masks. + * + * @param dest Destination mask, can be one of the source masks + * @param src1 Source mask 1 + * @param src2 Source mask 2 + */ +static inline void odp_coremask_or(plat_odp_coremask_t *dest, + plat_odp_coremask_t *src1, + plat_odp_coremask_t *src2) +{ + dest->_u64[0] = src1->_u64[0] | src2->_u64[0]; +} + +/** + * Logical XOR over two source masks. + * + * @param dest Destination mask, can be one of the source masks + * @param src1 Source mask 1 + * @param src2 Source mask 2 + */ +static inline void odp_coremask_xor(plat_odp_coremask_t *dest, + plat_odp_coremask_t *src1, + plat_odp_coremask_t *src2) +{ + dest->_u64[0] = src1->_u64[0] ^ src2->_u64[0]; +} + +/** + * Test if two masks contain the same cores + */ +static inline int odp_coremask_equal(plat_odp_coremask_t *mask1, + plat_odp_coremask_t *mask2) +{ + return (mask1->_u64[0] == mask2->_u64[0]); +} + +#endif