Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1106002pxu; Wed, 6 Jan 2021 12:25:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyIGI+qP/c12oawitGbdRnAf+iK/Ns0r1Nb6GBqZjwXTOJ4XfRTz4dlBFlJZex1mhzu8VyB X-Received: by 2002:a50:d604:: with SMTP id x4mr5136412edi.64.1609964706331; Wed, 06 Jan 2021 12:25:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609964706; cv=none; d=google.com; s=arc-20160816; b=ZMy18ynIPbt7Gm77aR+g8KbDfmzrl46xeKm1ysMYTbRJ88bpz3LE3NMKO3HH1Rl0hS cuFwBVc8+bN5SwoGbnlR8+VrrCum1JmrCIZMTxesSfLBNU8lGy0VTPVRHrVQhqRg6zuH VfEYlSHFSq4KHJ1Em/fJakc0Hrq/fKqCvBUxYWtiMo0Vh/bNUv+MF6tTOOzFYUoHjW0N 440CIu7i8L/t3da8HkXIDMUnXCNF61ide3NmYoCdBXupCoEKWWBWUgmZZ8pS01oCeJ7l 0PJVTGGDdnUDbfIj8NPH1kNGPF63R6boxDqZOW4Z4zDdUd77Nl2rDq95cjxtM9E+PV2o IzDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=IpM9sZTuM+HyAQwXWgc4Y3HZsZvaKY9UPSaPT0c+v2w=; b=t59k4sf18EwkQi+6Mu+9kVfVhSVohgGlajlmnztDnC0Sdm39DXX0zLEQ5gnjvYl0Zy xGmBP6SQpP/gUx45T+r1PB+MNbUOK5DZuhXM5m0cJK1UElqafmoYWPFAyBff4f1ztxP5 rvdgizpXmKUV+sSH9RZfJe9NABmEwmJVeNWAnrCPmQzXj5UFoYlWZrchaiKKwvUupeGq CfWJ3LWVIHtKy5xfuKfspZQaywDJNZ3K8YYlGYSj1vcSc8Gi1iuHBSrI/DNcUn5N7amO g8TR1BWNficPAqZDArI4foy0o8NoKQb2vARSVjhj+xvoK4Sb7iwTFeIIcTSPXr9dZ3F3 lWKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id rp28si1266230ejb.10.2021.01.06.12.24.42; Wed, 06 Jan 2021 12:25:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727323AbhAFUS1 (ORCPT + 99 others); Wed, 6 Jan 2021 15:18:27 -0500 Received: from foss.arm.com ([217.140.110.172]:46970 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726763AbhAFUS1 (ORCPT ); Wed, 6 Jan 2021 15:18:27 -0500 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 5B5211474; Wed, 6 Jan 2021 12:17:15 -0800 (PST) Received: from e120937-lin.home (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 58BD73F719; Wed, 6 Jan 2021 12:17:13 -0800 (PST) From: Cristian Marussi To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: sudeep.holla@arm.com, lukasz.luba@arm.com, james.quinlan@broadcom.com, Jonathan.Cameron@Huawei.com, f.fainelli@gmail.com, etienne.carriere@linaro.org, thara.gopinath@linaro.org, vincent.guittot@linaro.org, souvik.chakravarty@arm.com, cristian.marussi@arm.com Subject: [PATCH v4 10/37] firmware: arm_scmi: add helper to access revision area memory Date: Wed, 6 Jan 2021 20:15:43 +0000 Message-Id: <20210106201610.26538-11-cristian.marussi@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210106201610.26538-1-cristian.marussi@arm.com> References: <20210106201610.26538-1-cristian.marussi@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add an helper to grab, from a protocol handle, the handle common memory area allocated to store SCMI version data which is exposed on sysfs. Such helper will be needed by SCMI Base protocol initialization once it will be moved to new protocol handles scheme. Signed-off-by: Cristian Marussi --- drivers/firmware/arm_scmi/common.h | 2 ++ drivers/firmware/arm_scmi/driver.c | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/firmware/arm_scmi/common.h b/drivers/firmware/arm_scmi/common.h index 10ac5a6daf10..428bfba40dfd 100644 --- a/drivers/firmware/arm_scmi/common.h +++ b/drivers/firmware/arm_scmi/common.h @@ -215,6 +215,8 @@ struct scmi_xfer_ops { struct scmi_xfer *xfer); }; +struct scmi_revision_info * +scmi_get_revision_area(const struct scmi_protocol_handle *ph); int scmi_handle_put(const struct scmi_handle *handle); struct scmi_handle *scmi_handle_get(struct device *dev); void scmi_set_handle(struct scmi_device *scmi_dev); diff --git a/drivers/firmware/arm_scmi/driver.c b/drivers/firmware/arm_scmi/driver.c index d1357640bf07..b936cf47cd7d 100644 --- a/drivers/firmware/arm_scmi/driver.c +++ b/drivers/firmware/arm_scmi/driver.c @@ -698,6 +698,25 @@ static const struct scmi_xfer_ops xfer_ops = { .xfer_put = xfer_put, }; +/** + * scmi_get_revision_area - Retrieve version memory area. + * + * @ph: A reference to the protocol handle. + * + * A helper to grab the version memory area reference during SCMI Base protocol + * initialization. + * + * Return: A reference to the version memory area associated to the SCMI + * instance underlying this protocol handle. + */ +struct scmi_revision_info * +scmi_get_revision_area(const struct scmi_protocol_handle *ph) +{ + const struct scmi_protocol_instance *pi = ph_to_pi(ph); + + return pi->handle->version; +} + /** * scmi_get_protocol_instance - Protocol initialization helper. * @handle: A reference to the SCMI platform instance. -- 2.17.1