[Qemu-devel] [PATCH v2 09/25] sdcard: use G_BYTE from cutils

Philippe Mathieu-Daudé posted 25 patches 7 years, 9 months ago
[Qemu-devel] [PATCH v2 09/25] sdcard: use G_BYTE from cutils
Posted by Philippe Mathieu-Daudé 7 years, 9 months ago
code is now easier to read.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 hw/sd/sd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hw/sd/sd.c b/hw/sd/sd.c
index 1f209b8199..d4aa7b4a92 100644
--- a/hw/sd/sd.c
+++ b/hw/sd/sd.c
@@ -38,6 +38,7 @@
 #include "hw/sd/sdcard_legacy.h"
 #include "qapi/error.h"
 #include "qemu/bitmap.h"
+#include "qemu/cutils.h"
 #include "hw/qdev-properties.h"
 #include "qemu/error-report.h"
 #include "qemu/timer.h"
@@ -369,7 +370,7 @@ static void sd_reset_csd(SDState *sd, uint64_t size)
     uint32_t sectsize = (1 << (SECTOR_SHIFT + 1)) - 1;
     uint32_t wpsize = (1 << (WPGROUP_SHIFT + 1)) - 1;
 
-    if (size <= 0x40000000) {	/* Standard Capacity SD */
+    if (size <= 1 * G_BYTE /* FIXME 2GB? */) { /* Standard Capacity SD */
         sd->csd[0] = 0x00;	/* CSD structure */
         sd->csd[1] = 0x26;	/* Data read access-time-1 */
         sd->csd[2] = 0x00;	/* Data read access-time-2 */
-- 
2.15.1


Re: [Qemu-devel] [PATCH v2 09/25] sdcard: use G_BYTE from cutils
Posted by Alistair Francis 7 years, 9 months ago
On Wed, Jan 3, 2018 at 1:24 PM, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
> code is now easier to read.
>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>

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

Alistair

> ---
>  hw/sd/sd.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/hw/sd/sd.c b/hw/sd/sd.c
> index 1f209b8199..d4aa7b4a92 100644
> --- a/hw/sd/sd.c
> +++ b/hw/sd/sd.c
> @@ -38,6 +38,7 @@
>  #include "hw/sd/sdcard_legacy.h"
>  #include "qapi/error.h"
>  #include "qemu/bitmap.h"
> +#include "qemu/cutils.h"
>  #include "hw/qdev-properties.h"
>  #include "qemu/error-report.h"
>  #include "qemu/timer.h"
> @@ -369,7 +370,7 @@ static void sd_reset_csd(SDState *sd, uint64_t size)
>      uint32_t sectsize = (1 << (SECTOR_SHIFT + 1)) - 1;
>      uint32_t wpsize = (1 << (WPGROUP_SHIFT + 1)) - 1;
>
> -    if (size <= 0x40000000) {  /* Standard Capacity SD */
> +    if (size <= 1 * G_BYTE /* FIXME 2GB? */) { /* Standard Capacity SD */
>          sd->csd[0] = 0x00;     /* CSD structure */
>          sd->csd[1] = 0x26;     /* Data read access-time-1 */
>          sd->csd[2] = 0x00;     /* Data read access-time-2 */
> --
> 2.15.1
>
>