qemu-riscv
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/4] device_tree: add qemu_fdt_setprop_reg64_map helper


From: Alistair Francis
Subject: Re: [PATCH 1/4] device_tree: add qemu_fdt_setprop_reg64_map helper
Date: Mon, 20 Jun 2022 16:41:28 +1000

On Sun, Jun 19, 2022 at 6:15 AM Ben Dooks <qemu@ben.fluff.org> wrote:
>
> Add a macro qemu_fdt_setprop_reg64_map() to set the given
> node's reg property directly from the memory map entry
> to avoid open coding of the following:
>
>     qemu_fdt_setprop_cells(fdt, nodename, "reg",
>         0x0, memmap[SIFIVE_U_DEV_OTP].base,
>         0x0, memmap[SIFIVE_U_DEV_OTP].size);
>
> Signed-off-by: Ben Dooks <qemu@ben.fluff.org>
> --
> v2:
> - changed qemu_fdt_setprop_reg64 to qemu_fdt_setprop_reg64_map
> ---
>  include/sysemu/device_tree.h | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/include/sysemu/device_tree.h b/include/sysemu/device_tree.h
> index ef060a9759..79ce009a22 100644
> --- a/include/sysemu/device_tree.h
> +++ b/include/sysemu/device_tree.h
> @@ -135,6 +135,21 @@ int qemu_fdt_add_path(void *fdt, const char *path);
>                           sizeof(qdt_tmp));                                   
>  \
>      } while (0)
>
> +/**
> + * qemu_fdt_setprop_reg64_map:
> + * @fdt: the device tree path
> + * @node_path: node to set property on
> + * @map: the map entry to set the reg from
> + *
> + * A helper tp set the 'reg' node on the specified node from the given map

A helper to

Otherwise:

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>

Alistair

> + * entry.
> + */
> +#define qemu_fdt_setprop_reg64_map(fdt, path, map)              \
> +    qemu_fdt_setprop_cells(fdt, path, "reg",                    \
> +                           (map)->base >> 32, (map)->base,      \
> +                           (map)->size >> 32, (map)->size)
> +
> +
>  void qemu_fdt_dumpdtb(void *fdt, int size);
>
>  /**
> --
> 2.35.1
>
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]