[v6] powerpc/powernv: add hdat attribute to sysfs

Andrew Donnellan andrew.donnellan at au1.ibm.com
Wed Mar 22 16:11:06 AEDT 2017


On 22/03/17 10:53, Matt Brown wrote:
> The HDAT data area is consumed by skiboot and turned into a device-tree.
> In some cases we would like to look directly at the HDAT, so this patch
> adds a sysfs node to allow it to be viewed.  This is not possible through
> /dev/mem as it is reserved memory which is stopped by the /dev/mem filter.
>
> Signed-off-by: Matt Brown <matthew.brown.dev at gmail.com>
> ---
> Changelog
>
> v6
> 	- attribute names are stored locally, removing potential null pointer errors
> 	- added of_node_put for the corresponding of_find_node
> 	- folded exports node creation into opal_export_attr()
> 	- fixed kzalloc flags to GFP_KERNEL
> 	- fixed struct array indexing
> 	- fixed error message
> ---
>  arch/powerpc/platforms/powernv/opal.c | 84 +++++++++++++++++++++++++++++++++++
>  1 file changed, 84 insertions(+)
>
> diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
> index 2822935..953537e 100644
> --- a/arch/powerpc/platforms/powernv/opal.c
> +++ b/arch/powerpc/platforms/powernv/opal.c
> @@ -604,6 +604,87 @@ static void opal_export_symmap(void)
>  		pr_warn("Error %d creating OPAL symbols file\n", rc);
>  }
>
> +static ssize_t export_attr_read(struct file *fp, struct kobject *kobj,
> +			     struct bin_attribute *bin_attr, char *buf,
> +			     loff_t off, size_t count)
> +{
> +	return memory_read_from_buffer(buf, count, &off, bin_attr->private,
> +				       bin_attr->size);
> +}
> +
> +static struct bin_attribute *exported_attrs;
> +static char **attr_name;

Can these be moved inside opal_export_attrs()?


-- 
Andrew Donnellan              OzLabs, ADL Canberra
andrew.donnellan at au1.ibm.com  IBM Australia Limited



More information about the Linuxppc-dev mailing list