Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp2260548pxm; Fri, 4 Mar 2022 12:33:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJwEjNPn5EVWjamdM4Ad9NRfKy1TjxhREekZkU7g8+GlLiC1XfCYMasFid8m3AF8j8l4mCqb X-Received: by 2002:a17:90b:3b46:b0:1bf:b1f:588f with SMTP id ot6-20020a17090b3b4600b001bf0b1f588fmr421989pjb.182.1646425984149; Fri, 04 Mar 2022 12:33:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646425984; cv=none; d=google.com; s=arc-20160816; b=oQl/Gn8GeXIxxfkT3Ac7TGTxxclRc5aGZJeRdtkdiBbVW/h0NJyiv0llSTBo62QhZq Hxm0gXjAUI9HLNLVa0tBSLWdrfRnlpPg2VSeHWclMz2bEr5Elw08i5mDoLR8DG3Ra5iI 2q8K2HtMkej6zh/qpWh0dX3fVf8T8k04/CF1Tjy5ihs1nM84FJSG0bKbMepu5zWAbaOh FWMQ94AEvsR/NclRco/NYfIu/AdBujVYCqxQwMqJusTeuQFqorbd15uYcjNV2hJFC/C9 MPIhr5Ql2F0M+DKaBbRIa3vgH8qWZdbtMengxMDEEn4m3hLeXtAXeKz8suSxT+YcHBU3 2NGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=iLn7XmY4uLLtm7deNr+fx8KAi0WcrSVNop2nuPaTw5Y=; b=pOokL0HemwjY+/QU75+HIU2Y+7/hqoOfFYeasRutg0aliGoBQ8DxnMXf4qG0CYUWzx 1ss14+o9GRGl0gwMFXtusMCu6twKfSQbhgQq7TwvzV4JrlzFIuKE1XIaG0ffX+gDIjJ1 sIY7KNwJjKV/VqNIfxAZbsy496Vg073sT4BeWBbchAN25J6wPzN+zQ9WwhU3xgPl80Sg Vx9yCT6obVre5RyIO8zMxzVgAOQSWegCI/kQWPguxcRmLHN5hP1ulHQHdWINuaw3Bd3m uz/8SGUC5BHTG72BG3pn41nTc4qCnQu3exILiyM7zRGQipLVieCiD6QpKfKxYeNCoK9p PWkw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x41-20020a056a0018a900b004f6ce4d0ee7si871914pfh.19.2022.03.04.12.33.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 12:33:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id D00A22C508D; Fri, 4 Mar 2022 11:37:00 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241039AbiCDRUd (ORCPT + 99 others); Fri, 4 Mar 2022 12:20:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241025AbiCDRU0 (ORCPT ); Fri, 4 Mar 2022 12:20:26 -0500 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4911E14F2A0 for ; Fri, 4 Mar 2022 09:19:35 -0800 (PST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 194A81424; Fri, 4 Mar 2022 09:19:35 -0800 (PST) Received: from e121896.arm.com (unknown [10.57.42.166]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 76A283F73D; Fri, 4 Mar 2022 09:19:33 -0800 (PST) From: James Clark To: suzuki.poulose@arm.com, coresight@lists.linaro.org, mike.leach@linaro.org, anshuman.khandual@arm.com Cc: mathieu.poirier@linaro.org, leo.yan@linaro.com, James Clark , Leo Yan , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 05/15] coresight: etm4x: Cleanup TRCIDR5 register accesses Date: Fri, 4 Mar 2022 17:19:02 +0000 Message-Id: <20220304171913.2292458-6-james.clark@arm.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20220304171913.2292458-1-james.clark@arm.com> References: <20220304171913.2292458-1-james.clark@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a no-op change for style and consistency and has no effect on the binary output by the compiler. In sysreg.h fields are defined as the register name followed by the field name and then _MASK. This allows for grepping for fields by name rather than using magic numbers. Signed-off-by: James Clark --- .../hwtracing/coresight/coresight-etm4x-core.c | 18 ++++++------------ drivers/hwtracing/coresight/coresight-etm4x.h | 7 +++++++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c index c52ab7f29f41..3f4263117570 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c @@ -1188,26 +1188,20 @@ static void etm4_init_arch_data(void *info) etmidr5 = etm4x_relaxed_read32(csa, TRCIDR5); /* NUMEXTIN, bits[8:0] number of external inputs implemented */ - drvdata->nr_ext_inp = BMVAL(etmidr5, 0, 8); + drvdata->nr_ext_inp = FIELD_GET(TRCIDR5_NUMEXTIN_MASK, etmidr5); /* TRACEIDSIZE, bits[21:16] indicates the trace ID width */ - drvdata->trcid_size = BMVAL(etmidr5, 16, 21); + drvdata->trcid_size = FIELD_GET(TRCIDR5_TRACEIDSIZE_MASK, etmidr5); /* ATBTRIG, bit[22] implementation can support ATB triggers? */ - if (BMVAL(etmidr5, 22, 22)) - drvdata->atbtrig = true; - else - drvdata->atbtrig = false; + drvdata->atbtrig = !!(etmidr5 & TRCIDR5_ATBTRIG); /* * LPOVERRIDE, bit[23] implementation supports * low-power state override */ - if (BMVAL(etmidr5, 23, 23) && (!drvdata->skip_power_up)) - drvdata->lpoverride = true; - else - drvdata->lpoverride = false; + drvdata->lpoverride = (etmidr5 & TRCIDR5_LPOVERRIDE) && (!drvdata->skip_power_up); /* NUMSEQSTATE, bits[27:25] number of sequencer states implemented */ - drvdata->nrseqstate = BMVAL(etmidr5, 25, 27); + drvdata->nrseqstate = FIELD_GET(TRCIDR5_NUMSEQSTATE_MASK, etmidr5); /* NUMCNTR, bits[30:28] number of counters available for tracing */ - drvdata->nr_cntr = BMVAL(etmidr5, 28, 30); + drvdata->nr_cntr = FIELD_GET(TRCIDR5_NUMCNTR_MASK, etmidr5); etm4_cs_lock(drvdata, csa); cpu_detect_trace_filtering(drvdata); } diff --git a/drivers/hwtracing/coresight/coresight-etm4x.h b/drivers/hwtracing/coresight/coresight-etm4x.h index c9c5fd655196..3b604cde668b 100644 --- a/drivers/hwtracing/coresight/coresight-etm4x.h +++ b/drivers/hwtracing/coresight/coresight-etm4x.h @@ -165,6 +165,13 @@ #define TRCIDR4_NUMCIDC_MASK GENMASK(27, 24) #define TRCIDR4_NUMVMIDC_MASK GENMASK(31, 28) +#define TRCIDR5_NUMEXTIN_MASK GENMASK(8, 0) +#define TRCIDR5_TRACEIDSIZE_MASK GENMASK(21, 16) +#define TRCIDR5_ATBTRIG BIT(22) +#define TRCIDR5_LPOVERRIDE BIT(23) +#define TRCIDR5_NUMSEQSTATE_MASK GENMASK(27, 25) +#define TRCIDR5_NUMCNTR_MASK GENMASK(30, 28) + /* * System instructions to access ETM registers. * See ETMv4.4 spec ARM IHI0064F section 4.3.6 System instructions -- 2.28.0