qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ramon Aerne <raemaerne@gmail.com>
To: qemu-devel@nongnu.org
Cc: qemu-block@nongnu.org, alistair@alistair23.me, kwolf@redhat.com,
	hreitz@redhat.com
Subject: [PATCH] block: m25p80: fix dummy byte count read from spansion cfg register
Date: Tue,  8 Nov 2022 18:06:39 +0100	[thread overview]
Message-ID: <20221108170639.714-1-raemaerne@gmail.com> (raw)

Spansion nor-flash stores the dummy read count in bits in a config register.
This is currently read and used as the byte count which is wrong.

This patch fixes this bit to byte conversion without warning about
unsupported configurations (such as bits % 8 != 0)

Signed-off-by: Ramon Aerne <raemaerne@gmail.com>
---
 hw/block/m25p80.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hw/block/m25p80.c b/hw/block/m25p80.c
index 02adc87..cf10b11 100644
--- a/hw/block/m25p80.c
+++ b/hw/block/m25p80.c
@@ -981,7 +981,7 @@ static void decode_fast_read_cmd(Flash *s)
         s->needed_bytes += extract32(s->spansion_cr2v,
                                     SPANSION_DUMMY_CLK_POS,
                                     SPANSION_DUMMY_CLK_LEN
-                                    );
+                                    ) / 8;
         break;
     case MAN_ISSI:
         /*
@@ -1017,7 +1017,7 @@ static void decode_dio_read_cmd(Flash *s)
         s->needed_bytes += extract32(s->spansion_cr2v,
                                     SPANSION_DUMMY_CLK_POS,
                                     SPANSION_DUMMY_CLK_LEN
-                                    );
+                                    ) / 8;
         break;
     case MAN_NUMONYX:
         s->needed_bytes += numonyx_extract_cfg_num_dummies(s);
@@ -1067,7 +1067,7 @@ static void decode_qio_read_cmd(Flash *s)
         s->needed_bytes += extract32(s->spansion_cr2v,
                                     SPANSION_DUMMY_CLK_POS,
                                     SPANSION_DUMMY_CLK_LEN
-                                    );
+                                    ) / 8;
         break;
     case MAN_NUMONYX:
         s->needed_bytes += numonyx_extract_cfg_num_dummies(s);
-- 
2.25.1



                 reply	other threads:[~2022-11-08 17:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20221108170639.714-1-raemaerne@gmail.com \
    --to=raemaerne@gmail.com \
    --cc=alistair@alistair23.me \
    --cc=hreitz@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.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).