From: Francesco Lavra <francescolavra.fl@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Subject: Re: [PATCH] add fdt prerequisites for arm64 UEFI Linux loader
Date: Tue, 17 Dec 2013 10:27:12 +0100 [thread overview]
Message-ID: <52B018F0.6030409@gmail.com> (raw)
In-Reply-To: <20131216135210.GU22356@rocoto.smurfnet.nu>
On 12/16/2013 02:52 PM, Leif Lindholm wrote:
> diff --git a/grub-core/lib/fdt.c b/grub-core/lib/fdt.c
> index 9f34dc7..fb13672 100644
> --- a/grub-core/lib/fdt.c
> +++ b/grub-core/lib/fdt.c
> @@ -423,3 +423,31 @@ int grub_fdt_set_prop (void *fdt, unsigned int nodeoffset, const char *name,
> grub_memcpy (prop + 3, val, len);
> return 0;
> }
> +
> +int
> +grub_fdt_create_empty_tree (void *fdt, unsigned int size)
> +{
> + struct grub_fdt_empty_tree *et;
> +
> + if (size < GRUB_FDT_EMPTY_TREE_SZ)
> + return -1;
> +
> + grub_memset (fdt, 0, size);
> + et = fdt;
> +
> + et->empty_node.node_end = grub_cpu_to_be32 (FDT_END);
> + et->empty_node.prop_end = grub_cpu_to_be32 (FDT_END_NODE);
> + et->empty_node.prop_start = grub_cpu_to_be32 (FDT_BEGIN_NODE);
> + ((struct grub_fdt_empty_tree *) fdt)->header.off_mem_rsvmap =
> + grub_cpu_to_be32 (ALIGN_UP (sizeof (grub_fdt_header_t), 8));
> +
> + grub_fdt_set_off_dt_strings (fdt, sizeof (*et));
> + grub_fdt_set_off_dt_struct (fdt, sizeof (grub_fdt_header_t) + 16);
I would write the offset as sizeof (et->header) + sizeof (et->empty_rsvmap)
> + grub_fdt_set_version (fdt, FDT_SUPPORTED_VERSION);
> + grub_fdt_set_last_comp_version (fdt, FDT_SUPPORTED_VERSION);
> + grub_fdt_set_size_dt_struct (fdt, sizeof (et->empty_node));
> + grub_fdt_set_totalsize (fdt, size);
> + grub_fdt_set_magic (fdt, FDT_MAGIC);
> +
> + return 0;
> +}
> diff --git a/include/grub/fdt.h b/include/grub/fdt.h
> index 2ad0536..bbc88ec 100644
> --- a/include/grub/fdt.h
> +++ b/include/grub/fdt.h
> @@ -36,6 +36,19 @@ typedef struct {
> grub_uint32_t size_dt_struct;
> } grub_fdt_header_t;
>
> +struct grub_fdt_empty_tree {
> + grub_fdt_header_t header;
> + grub_uint64_t empty_rsvmap[2];
> + struct {
> + grub_uint32_t prop_start;
> + grub_uint8_t name[1];
> + grub_uint32_t prop_end;
> + grub_uint32_t node_end;
> + } empty_node;
Field names don't reflect their actual meaning: I would rename them as:
struct {
grub_uint32_t node_start;
grub_uint8_t name[1];
grub_uint32_t node_end;
grub_uint32_t tree_end;
} empty_tree;
--
Francesco
next prev parent reply other threads:[~2013-12-17 9:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-16 13:52 [PATCH] add fdt prerequisites for arm64 UEFI Linux loader Leif Lindholm
2013-12-16 21:17 ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-12-18 15:56 ` Leif Lindholm
2013-12-17 9:27 ` Francesco Lavra [this message]
2013-12-18 15:53 ` Leif Lindholm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52B018F0.6030409@gmail.com \
--to=francescolavra.fl@gmail.com \
--cc=grub-devel@gnu.org \
--cc=leif.lindholm@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).