qemu-block
[Top][All Lists]
Advanced

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

Re: [RFC PATCH 17/17] hw/sd: Subtract bootarea size from blk


From: Philippe Mathieu-Daudé
Subject: Re: [RFC PATCH 17/17] hw/sd: Subtract bootarea size from blk
Date: Mon, 9 May 2022 23:22:27 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.9.0

Hi Joel,

On 18/3/22 14:28, Cédric Le Goater wrote:
From: Joel Stanley <joel@jms.id.au>

The userdata size is derived from the file the user passes on the
command line, but we must take into account the boot areas.

Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
  hw/sd/sd.c | 6 ++++++
  1 file changed, 6 insertions(+)

@@ -655,6 +656,11 @@ static void sd_reset(DeviceState *dev)
      }
      size = sect << 9;
+ if (sc->bootpart_offset) {
+        unsigned int boot_capacity = sd->ext_csd[EXT_CSD_BOOT_MULT] << 17;

What about adding a tiny helper?

static unsigned sd_boot_capacity_bytes(SDState *sd)
{
    return sd->ext_csd[EXT_CSD_BOOT_MULT] << 18;
}

+        size -= boot_capacity * 2;
+    }
+
      sect = sd_addr_to_wpnum(size) + 1;
sd->state = sd_idle_state;




reply via email to

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