FROMLIST: firmware: arm_scmi: add helper to access revision area memory

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 <cristian.marussi@arm.com>

Bug: 171409184
Link: https://lore.kernel.org/linux-arm-kernel/20210202221555.41167-1-cristian.marussi@arm.com/
Change-Id: Ic1d9a6c0b7940abfc7e370c0d955aae83c449c6a
Signed-off-by: Rishabh Bhatnagar <quic_rishabhb@quicinc.com>
This commit is contained in:
Cristian Marussi
2021-02-02 22:15:28 +00:00
committed by Todd Kjos
parent a3433ea580
commit f4423d3944
2 changed files with 21 additions and 0 deletions

View File

@@ -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);

View File

@@ -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.