qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Francis <alistair23@gmail.com>
To: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
Cc: "Kevin Wolf" <kwolf@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Thomas Huth" <thuth@redhat.com>,
	"Vladimir Sementsov-Ogievskiy" <vsementsov@virtuozzo.com>,
	"Vincent Palatin" <vpalatin@chromium.org>,
	"Edgar E. Iglesias" <edgar.iglesias@xilinx.com>,
	Qemu-block <qemu-block@nongnu.org>,
	"qemu-devel@nongnu.org Developers" <qemu-devel@nongnu.org>,
	"Markus Armbruster" <armbru@redhat.com>,
	"Max Reitz" <mreitz@redhat.com>,
	"Sai Pavan Boddu" <saipava@xilinx.com>,
	"Luc Michel" <luc.michel@greensocs.com>,
	"Alistair Francis" <alistair.francis@wdc.com>,
	"Joel Stanley" <joel@jms.id.au>,
	"Stefan Hajnoczi" <stefanha@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"Cédric Le Goater" <clg@kaod.org>
Subject: Re: [RFC PATCH 12/15] sd: emmc: Support boot area in emmc image
Date: Fri, 12 Feb 2021 14:16:45 -0800	[thread overview]
Message-ID: <CAKmqyKPG1RrxeN=SCWOdoTOYJS3C8V6no9ydVEa9GS9-2dZnMg@mail.gmail.com> (raw)
In-Reply-To: <1613031446-22154-13-git-send-email-sai.pavan.boddu@xilinx.com>

On Thu, Feb 11, 2021 at 12:15 AM Sai Pavan Boddu
<sai.pavan.boddu@xilinx.com> wrote:
>
> From: Joel Stanley <joel@jms.id.au>
>
> This assumes a specially constructued image:
>
>   dd if=/dev/zero of=mmc-bootarea.img count=2 bs=1M
>   dd if=u-boot-spl.bin of=mmc-bootarea.img conv=notrunc
>   dd if=u-boot.bin of=mmc-bootarea.img conv=notrunc count=64 bs=1K
>   cat mmc-bootarea.img obmc-phosphor-image.wic > mmc.img
>   truncate --size 16GB mmc.img
>   truncate --size 128MB mmc-bootarea.img

Could we document this somewhere user accessible?

Alistair

>
> Signed-off-by: Joel Stanley <joel@jms.id.au>
> [clg: - changes on the definition names ]
> Signed-off-by: Cédric Le Goater <clg@kaod.org>
> [spb: use data_start property to access right emmc partition,
>       Clean up PARTITION_ENABLE support as incomplete,
>       Fix commit message to be generic.]
> Signed-off-by: Sai Pavan Boddu <sai.pavan.boddu@xilinx.com>
> ---
>  hw/sd/sd.c | 40 ++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 40 insertions(+)
>
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index 54fba7b..55c1104 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -1045,6 +1045,34 @@ static void sd_lock_command(SDState *sd)
>          sd->card_status &= ~CARD_IS_LOCKED;
>  }
>
> +/*
> + * This requires a disk image that has two boot partitions inserted at the
> + * beginning of it. The size of the boot partitions are configured in the
> + * ext_csd structure, which is hardcoded in qemu. They are currently set to
> + * 1MB each.
> + */
> +static uint32_t sd_bootpart_offset(SDState *sd)
> +{
> +    unsigned int access = sd->ext_csd[EXT_CSD_PART_CONFIG] &
> +        EXT_CSD_PART_CONFIG_ACC_MASK;
> +    unsigned int boot_capacity = sd->ext_csd[EXT_CSD_BOOT_MULT] << 17;
> +
> +    if (!sd->emmc) {
> +        return 0;
> +    }
> +
> +    switch (access) {
> +    case EXT_CSD_PART_CONFIG_ACC_DEFAULT:
> +        return boot_capacity * 2;
> +    case EXT_CSD_PART_CONFIG_ACC_BOOT0:
> +        return 0;
> +    case EXT_CSD_PART_CONFIG_ACC_BOOT0 + 1:
> +        return boot_capacity * 1;
> +    default:
> +         g_assert_not_reached();
> +    }
> +}
> +
>  static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
>  {
>      uint32_t rca = 0x0000;
> @@ -1360,6 +1388,9 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
>                  return sd_r1;
>              }
>
> +            if (sd->emmc) {
> +                addr += sd_bootpart_offset(sd);
> +            }
>              sd->state = sd_sendingdata_state;
>              sd->data_start = addr;
>              sd->data_offset = 0;
> @@ -1379,6 +1410,9 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
>                  return sd_r1;
>              }
>
> +            if (sd->emmc) {
> +                addr += sd_bootpart_offset(sd);
> +            }
>              sd->state = sd_sendingdata_state;
>              sd->data_start = addr;
>              sd->data_offset = 0;
> @@ -1435,6 +1469,9 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
>                  return sd_r1;
>              }
>
> +            if (sd->emmc) {
> +                addr += sd_bootpart_offset(sd);
> +            }
>              sd->state = sd_receivingdata_state;
>              sd->data_start = addr;
>              sd->data_offset = 0;
> @@ -1465,6 +1502,9 @@ static sd_rsp_type_t sd_normal_command(SDState *sd, SDRequest req)
>                  return sd_r1;
>              }
>
> +            if (sd->emmc) {
> +                addr += sd_bootpart_offset(sd);
> +            }
>              sd->state = sd_receivingdata_state;
>              sd->data_start = addr;
>              sd->data_offset = 0;
> --
> 2.7.4
>
>


  reply	other threads:[~2021-02-12 22:20 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-11  8:17 [RFC PATCH 00/15] eMMC support Sai Pavan Boddu
2021-02-11  8:17 ` [RFC PATCH 01/15] block: add eMMC block device type Sai Pavan Boddu
2021-02-12 21:29   ` Alistair Francis
2021-02-11  8:17 ` [RFC PATCH 02/15] sd: add eMMC support Sai Pavan Boddu
2021-02-13 13:18   ` Luc Michel
2021-02-11  8:17 ` [RFC PATCH 03/15] sd: emmc: Dont not update CARD_CAPACITY for eMMC cards Sai Pavan Boddu
2021-02-12 21:34   ` Alistair Francis
2021-02-11  8:17 ` [RFC PATCH 04/15] sd: emmc: Update CMD1 definition for eMMC Sai Pavan Boddu
2021-02-12 22:06   ` Alistair Francis
2021-02-11  8:17 ` [RFC PATCH 05/15] sd: emmc: support idle state in CMD2 Sai Pavan Boddu
2021-02-12 22:07   ` Alistair Francis
2021-02-11  8:17 ` [RFC PATCH 06/15] sd: emmc: Add mmc switch function support Sai Pavan Boddu
2021-02-11  8:17 ` [RFC PATCH 07/15] sd: emmc: add CMD21 tuning sequence Sai Pavan Boddu
2021-02-11  8:17 ` [RFC PATCH 08/15] sd: emmc: Make ACMD41 illegal for mmc Sai Pavan Boddu
2021-02-11  8:17 ` [RFC PATCH 09/15] sd: emmc: Add support for emmc erase Sai Pavan Boddu
2021-02-12 22:08   ` Alistair Francis
2021-02-16 10:03     ` Sai Pavan Boddu
2021-02-11  8:17 ` [RFC PATCH 10/15] sd: emmc: Update CID structure for eMMC Sai Pavan Boddu
2021-02-12 22:10   ` Alistair Francis
2021-02-16 10:51     ` Sai Pavan Boddu
2021-02-11  8:17 ` [RFC PATCH 11/15] sd: emmc: Add Extended CSD register definitions Sai Pavan Boddu
2021-02-13 12:56   ` Luc Michel
2021-02-16 11:11     ` Sai Pavan Boddu
2021-02-22  9:38       ` Cédric Le Goater
2021-02-11  8:17 ` [RFC PATCH 12/15] sd: emmc: Support boot area in emmc image Sai Pavan Boddu
2021-02-12 22:16   ` Alistair Francis [this message]
2021-02-11  8:17 ` [RFC PATCH 13/15] sd: emmc: Subtract bootarea size from blk Sai Pavan Boddu
2021-02-12 22:11   ` Alistair Francis
2021-02-11  8:17 ` [RFC PATCH 14/15] sd: sdhci: Support eMMC devices Sai Pavan Boddu
2021-02-12 22:12   ` Alistair Francis
2021-02-11  8:17 ` [RFC PATCH 15/15] arm: xlnx-versal: Add emmc to versal Sai Pavan Boddu
2021-02-12 21:37   ` Alistair Francis
2021-02-13  7:25     ` Edgar E. Iglesias

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='CAKmqyKPG1RrxeN=SCWOdoTOYJS3C8V6no9ydVEa9GS9-2dZnMg@mail.gmail.com' \
    --to=alistair23@gmail.com \
    --cc=alistair.francis@wdc.com \
    --cc=armbru@redhat.com \
    --cc=clg@kaod.org \
    --cc=dgilbert@redhat.com \
    --cc=edgar.iglesias@xilinx.com \
    --cc=joel@jms.id.au \
    --cc=kwolf@redhat.com \
    --cc=luc.michel@greensocs.com \
    --cc=mreitz@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=sai.pavan.boddu@xilinx.com \
    --cc=saipava@xilinx.com \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.com \
    --cc=vpalatin@chromium.org \
    --cc=vsementsov@virtuozzo.com \
    /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).