[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-arm] [Qemu-devel] [PATCH v6 2/8] device_tree: introduce load_d
From: |
Rob Herring |
Subject: |
Re: [Qemu-arm] [Qemu-devel] [PATCH v6 2/8] device_tree: introduce load_device_tree_from_sysfs |
Date: |
Mon, 1 Feb 2016 10:15:19 -0600 |
On Mon, Feb 1, 2016 at 7:51 AM, Eric Auger <address@hidden> wrote:
> This function returns the host device tree blob from sysfs
> (/proc/device-tree). It uses a recursive function inspired
> from dtc read_fstree.
>
> Signed-off-by: Eric Auger <address@hidden>
>
> ---
> v5 -> v6:
> - fix some spelling mistakes
> - error_report + exit replaced by error_setg
> - const char *parent_node;
> - use g_strdup_printf instead of g_strjoin
> - add a doc comment for load_device_tree_from_sysfs
> v1 -> v2:
> - do not implement/expose read_fstree and load_device_tree_from_sysfs
> if CONFIG_LINUX is not defined (lstat is not implemeted in mingw)
> - correct indentation in read_fstree
> - use /proc/device-tree symlink instead of /sys/firmware/devicetree/base
> path (kernel.org/doc/Documentation/ABI/testing/sysfs-firmware-ofw)
> - use g_file_get_contents in read_fstree
> - introduce SYSFS_DT_BASEDIR macro and use strlen
> - exit on error in load_device_tree_from_sysfs
> - user error_setg
>
> RFC -> v1:
> - remove runtime dependency on dtc binary and introduce read_fstree
> ---
> device_tree.c | 99
> ++++++++++++++++++++++++++++++++++++++++++++
> include/sysemu/device_tree.h | 8 ++++
> 2 files changed, 107 insertions(+)
>
> diff --git a/device_tree.c b/device_tree.c
> index a9f5f8e..3797182 100644
> --- a/device_tree.c
> +++ b/device_tree.c
> @@ -17,6 +17,9 @@
> #include <fcntl.h>
> #include <unistd.h>
> #include <stdlib.h>
> +#ifdef CONFIG_LINUX
> +#include <dirent.h>
> +#endif
>
> #include "qemu-common.h"
> #include "qemu/error-report.h"
> @@ -117,6 +120,102 @@ fail:
> return NULL;
> }
>
> +#ifdef CONFIG_LINUX
> +
> +#define SYSFS_DT_BASEDIR "/proc/device-tree"
Use the sysfs path (/sys/firmware/device-tree/ IIRC) as this is just a
symlink to sysfs and /proc is considered the legacy path.
Rob
[Qemu-arm] [PATCH v6 1/8] hw/vfio/platform: amd-xgbe device, Eric Auger, 2016/02/01
[Qemu-arm] [PATCH v6 4/8] device_tree: qemu_fdt_getprop converted to use the error API, Eric Auger, 2016/02/01
[Qemu-arm] [PATCH v6 3/8] device_tree: introduce qemu_fdt_node_path, Eric Auger, 2016/02/01
[Qemu-arm] [PATCH v6 5/8] device_tree: qemu_fdt_getprop_cell converted to use the error API, Eric Auger, 2016/02/01
[Qemu-arm] [PATCH v6 6/8] hw/arm/sysbus-fdt: helpers for clock node generation, Eric Auger, 2016/02/01