Skip to content

Commit e4e6e8f

Browse files
cris-masudeep-holla
authored andcommitted
firmware: arm_scmi: Add optional flags to extended names helper
Some recently added SCMI protocols needs an additional flags parameter to be able to properly configure the command used to query the extended name of a resource. Modify extended_name_get helper accordingly. Signed-off-by: Cristian Marussi <cristian.marussi@arm.com> Link: https://lore.kernel.org/r/20231114145449.3136412-1-cristian.marussi@arm.com Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
1 parent 619bc6e commit e4e6e8f

9 files changed

Lines changed: 18 additions & 12 deletions

File tree

drivers/firmware/arm_scmi/clock.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ static int scmi_clock_attributes_get(const struct scmi_protocol_handle *ph,
318318
if (!ret && PROTOCOL_REV_MAJOR(version) >= 0x2) {
319319
if (SUPPORTS_EXTENDED_NAMES(attributes))
320320
ph->hops->extended_name_get(ph, CLOCK_NAME_GET, clk_id,
321-
clk->name,
321+
NULL, clk->name,
322322
SCMI_MAX_STR_SIZE);
323323

324324
if (SUPPORTS_RATE_CHANGED_NOTIF(attributes))

drivers/firmware/arm_scmi/driver.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1438,26 +1438,30 @@ struct scmi_msg_resp_domain_name_get {
14381438
* @ph: A protocol handle reference.
14391439
* @cmd_id: The specific command ID to use.
14401440
* @res_id: The specific resource ID to use.
1441+
* @flags: A pointer to specific flags to use, if any.
14411442
* @name: A pointer to the preallocated area where the retrieved name will be
14421443
* stored as a NULL terminated string.
14431444
* @len: The len in bytes of the @name char array.
14441445
*
14451446
* Return: 0 on Succcess
14461447
*/
14471448
static int scmi_common_extended_name_get(const struct scmi_protocol_handle *ph,
1448-
u8 cmd_id, u32 res_id, char *name,
1449-
size_t len)
1449+
u8 cmd_id, u32 res_id, u32 *flags,
1450+
char *name, size_t len)
14501451
{
14511452
int ret;
1453+
size_t txlen;
14521454
struct scmi_xfer *t;
14531455
struct scmi_msg_resp_domain_name_get *resp;
14541456

1455-
ret = ph->xops->xfer_get_init(ph, cmd_id, sizeof(res_id),
1456-
sizeof(*resp), &t);
1457+
txlen = !flags ? sizeof(res_id) : sizeof(res_id) + sizeof(*flags);
1458+
ret = ph->xops->xfer_get_init(ph, cmd_id, txlen, sizeof(*resp), &t);
14571459
if (ret)
14581460
goto out;
14591461

14601462
put_unaligned_le32(res_id, t->tx.buf);
1463+
if (flags)
1464+
put_unaligned_le32(*flags, t->tx.buf + sizeof(res_id));
14611465
resp = t->rx.buf;
14621466

14631467
ret = ph->xops->do_xfer(ph, t);

drivers/firmware/arm_scmi/perf.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ scmi_perf_domain_attributes_get(const struct scmi_protocol_handle *ph,
288288
if (!ret && PROTOCOL_REV_MAJOR(version) >= 0x3 &&
289289
SUPPORTS_EXTENDED_NAMES(flags))
290290
ph->hops->extended_name_get(ph, PERF_DOMAIN_NAME_GET,
291-
dom_info->id, dom_info->info.name,
291+
dom_info->id, NULL, dom_info->info.name,
292292
SCMI_MAX_STR_SIZE);
293293

294294
if (dom_info->level_indexing_mode) {

drivers/firmware/arm_scmi/power.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ scmi_power_domain_attributes_get(const struct scmi_protocol_handle *ph,
133133
if (!ret && PROTOCOL_REV_MAJOR(version) >= 0x3 &&
134134
SUPPORTS_EXTENDED_NAMES(flags)) {
135135
ph->hops->extended_name_get(ph, POWER_DOMAIN_NAME_GET,
136-
domain, dom_info->name,
136+
domain, NULL, dom_info->name,
137137
SCMI_MAX_STR_SIZE);
138138
}
139139

drivers/firmware/arm_scmi/powercap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ scmi_powercap_domain_attributes_get(const struct scmi_protocol_handle *ph,
270270
*/
271271
if (!ret && SUPPORTS_EXTENDED_NAMES(flags))
272272
ph->hops->extended_name_get(ph, POWERCAP_DOMAIN_NAME_GET,
273-
domain, dom_info->name,
273+
domain, NULL, dom_info->name,
274274
SCMI_MAX_STR_SIZE);
275275

276276
return ret;

drivers/firmware/arm_scmi/protocols.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ struct scmi_fc_info {
256256
*/
257257
struct scmi_proto_helpers_ops {
258258
int (*extended_name_get)(const struct scmi_protocol_handle *ph,
259-
u8 cmd_id, u32 res_id, char *name, size_t len);
259+
u8 cmd_id, u32 res_id, u32 *flags, char *name,
260+
size_t len);
260261
void *(*iter_response_init)(const struct scmi_protocol_handle *ph,
261262
struct scmi_iterator_ops *ops,
262263
unsigned int max_resources, u8 msg_id,

drivers/firmware/arm_scmi/reset.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ scmi_reset_domain_attributes_get(const struct scmi_protocol_handle *ph,
128128
if (!ret && PROTOCOL_REV_MAJOR(version) >= 0x3 &&
129129
SUPPORTS_EXTENDED_NAMES(attributes))
130130
ph->hops->extended_name_get(ph, RESET_DOMAIN_NAME_GET, domain,
131-
dom_info->name, SCMI_MAX_STR_SIZE);
131+
NULL, dom_info->name,
132+
SCMI_MAX_STR_SIZE);
132133

133134
return ret;
134135
}

drivers/firmware/arm_scmi/sensors.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ iter_sens_descr_process_response(const struct scmi_protocol_handle *ph,
644644
if (PROTOCOL_REV_MAJOR(si->version) >= 0x3 &&
645645
SUPPORTS_EXTENDED_NAMES(attrl))
646646
ph->hops->extended_name_get(ph, SENSOR_NAME_GET, s->id,
647-
s->name, SCMI_MAX_STR_SIZE);
647+
NULL, s->name, SCMI_MAX_STR_SIZE);
648648

649649
if (s->extended_scalar_attrs) {
650650
s->sensor_power = le32_to_cpu(sdesc->power);

drivers/firmware/arm_scmi/voltage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ static int scmi_voltage_descriptors_get(const struct scmi_protocol_handle *ph,
242242
if (SUPPORTS_EXTENDED_NAMES(attributes))
243243
ph->hops->extended_name_get(ph,
244244
VOLTAGE_DOMAIN_NAME_GET,
245-
v->id, v->name,
245+
v->id, NULL, v->name,
246246
SCMI_MAX_STR_SIZE);
247247
if (SUPPORTS_ASYNC_LEVEL_SET(attributes))
248248
v->async_level_set = true;

0 commit comments

Comments
 (0)