public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Thirupathaiah Annapureddy <thiruan@linux.microsoft.com>
To: u-boot@lists.denx.de
Subject: [PATCH v4 1/1] cmd: gpt: add eMMC and GPT support
Date: Wed, 4 Nov 2020 15:18:47 -0800	[thread overview]
Message-ID: <0e8808bd-58ea-5fb0-e6b4-a66f21c111eb@linux.microsoft.com> (raw)
In-Reply-To: <20200723120038.5915-1-rayagonda.kokatanur@broadcom.com>



On 7/23/2020 5:00 AM, Rayagonda Kokatanur wrote:
> From: Corneliu Doban <cdoban@broadcom.com>
> 
> Add eMMC and GPT support.
> - GPT partition list and command to create the GPT added to u-boot
>   environment
> - eMMC boot commands added to u-boot environment
> - new gpt commands (enumarate and setenv) that are used by broadcom
>   update scripts and boot commands
> - eMMC specific u-boot configurations with environment saved in eMMC
>   and GPT support
> 
> Signed-off-by: Corneliu Doban <cdoban@broadcom.com>
> Signed-off-by: Rayagonda Kokatanur <rayagonda.kokatanur@broadcom.com>
> ---
> Changes from v3:
>  -Address review comments from Simon Glass,
>   Return -ve number instead of 1 upon failure,
>   Use shorter variable name,
>   Modified code to avoid buffer overflow,
>   Use if (!strcmp(...)) instead of if (strcmp(...) == 0)
> 
> Changes from v2:
>  -Address review comments from Simon Glass,
>   Check for return value of part_driver_get_count(),
>   Don't check return value of part_driver_get(),
>   Rewrite part_driver_get() and rename to part_driver_get_first(),
>   Use env_set_ulong() whereever applicable, 
> 
>  -Address review comments from Michael Nazzareno Trimarchi,
>   Add new function to set all env vriables,
> 
> Changes from v1:
>  -Address review comments from Simon Glass,
>   Correct function comments,
>   Check for return value,
>   Add helper function in part.h
> 
>  cmd/gpt.c      | 161 +++++++++++++++++++++++++++++++++++++++++++++++++
>  include/part.h |  29 +++++++++
>  2 files changed, 190 insertions(+)
> 
> diff --git a/cmd/gpt.c b/cmd/gpt.c
> index df759416c8..2626992e59 100644
> --- a/cmd/gpt.c
> +++ b/cmd/gpt.c

> +
> +/**
> + * gpt_setenv_part_variables() - setup partition environmental variables
> + *
> + * Setup the gpt_partition_name, gpt_partition_entry, gpt_partition_addr
> + * and gpt_partition_size environment variables.
> + *
> + * @pinfo: pointer to disk partition
> + * @i: partition entry
> + *
> + * @Return: '0' on success and -ENOENT on failure
> + */
> +static int gpt_setenv_part_variables(struct disk_partition *pinfo, int i)
> +{
> +	int ret;
> +
> +	ret = env_set_ulong("gpt_partition_addr", pinfo->start);
> +	if (ret)
> +		goto fail;
You should use env_set_hex() instead of env_set_ulong() for following reasons:
1. commands (ex: mmc read/write etc.) that use gpt_partition_addr and
gpt_partition_size expect them to be in hex values.
2. maintain compatibility with existing usage in the upstream code base
https://gitlab.denx.de/u-boot/u-boot/-/blob/master/include/configs/bcm_ns3.h
ex:
	"gpt setenv mmc ${sd_device_number} ${fit_image};"\
	"mmc read ${fit_image_loadaddr} ${gpt_partition_addr} "\

> +
> +	ret = env_set_ulong("gpt_partition_size", pinfo->size);
> +	if (ret)
> +		goto fail;
You should use env_set_hex() instead of env_set_ulong() for same above reasons.

Best Regards,
Thiru

      parent reply	other threads:[~2020-11-04 23:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-23 12:00 [PATCH v4 1/1] cmd: gpt: add eMMC and GPT support Rayagonda Kokatanur
2020-07-28 18:58 ` Simon Glass
2020-11-04 23:18 ` Thirupathaiah Annapureddy [this message]

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=0e8808bd-58ea-5fb0-e6b4-a66f21c111eb@linux.microsoft.com \
    --to=thiruan@linux.microsoft.com \
    --cc=u-boot@lists.denx.de \
    /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