[Skiboot] [RESEND PATCH v1 07/11]ibm-fsp/firenze: Nest PowerBus unit support
Madhavan Srinivasan
maddy at linux.vnet.ibm.com
Thu Jul 16 13:34:07 AEST 2015
On Thursday 16 July 2015 07:24 AM, Joel Stanley wrote:
> On Sun, 2015-07-05 at 22:25 +0530, Madhavan Srinivasan wrote:
>> diff --git a/hw/nest.c b/hw/nest.c
>> index 2d5a331..bc87ec0 100644
>> --- a/hw/nest.c
>> +++ b/hw/nest.c
>> @@ -98,6 +98,59 @@ int dt_create_ima_chip_mcs_type( struct dt_node *ima,
>> return 0;
>> }
>>
>> +int dt_create_ima_chip_powerbus_event(struct dt_node *ima,
>> + u32 offset, const char *name)
>> +{
>> + char ev_name[MAX_NAME_SIZE];
>> + const char *unit = "MiB", *scale = "4.883e-4";
>> +
>> + /* PowerBus BW DT for Internal/External BW */
>> + memset((void *)ev_name, '\0', MAX_NAME_SIZE);
>> + snprintf(ev_name, MAX_NAME_SIZE, name);
> No need to memset, snprintf will add a trailing null for you.
>
>> + dt_add_property_cells(ima, ev_name, offset);
>> +
>> + /* Unit for the Event */
>> + memset((void *)ev_name, '\0', MAX_NAME_SIZE);
>> + snprintf(ev_name, MAX_NAME_SIZE, "unit.%s.unit", name);
> Again.
>
>> + dt_add_property_string(ima, ev_name, unit);
>> +
>> + /* Scale for the Event */
>> + memset((void *)ev_name, '\0', MAX_NAME_SIZE);
>> + snprintf(ev_name, MAX_NAME_SIZE, "scale.%s.scale", name);
> Again.
Ok. Will remove the memset.
>> + dt_add_property_string(ima, ev_name, scale);
>> +
>> + return 0;
>> +}
More information about the Skiboot
mailing list