Skip to contentSkip to conversation

hw/pflash_cfi02.c: Fix CFI devsize

PATCH RESEND New Peter Korsgaard 1 participant 1 message Aug 15, 2006

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 hw/pflash_cfi02.c: Fix CFI devsize

[RESEND]

The devsize member of the CFI structure should contain log2(size), not log2(size) + 1 according to the CFI spec. This little patch fixes that.

Index: hw/pflash_cfi02.c
===================================================================
RCS file: /sources/qemu/qemu/hw/pflash_cfi02.c,v
retrieving revision 1.3

pflash_cfi02.c +1 -1
diff -u -5 -p -r1.3 pflash_cfi02.c
@@ -602,11 +602,11 @@ pflash_t *pflash_register (target_ulong 
     /* Max timeout for block erase */
     pfl->cfi_table[0x25] = 0x0A;
     /* Max timeout for chip erase */
     pfl->cfi_table[0x26] = 0x0D;
     /* Device size */
-    pfl->cfi_table[0x27] = ctz32(total_len) + 1;
+    pfl->cfi_table[0x27] = ctz32(total_len);
     /* Flash device interface (8 & 16 bits) */
     pfl->cfi_table[0x28] = 0x02;
     pfl->cfi_table[0x29] = 0x00;
     /* Max number of bytes in multi-bytes write */
     pfl->cfi_table[0x2A] = 0x05;
Signature · 1 line
Bye, Peter Korsgaard