]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hw/block/pflash_cfi02: Use chip erase time specified in the CFI table
authorStephen Checkoway <stephen.checkoway@oberlin.edu>
Fri, 26 Apr 2019 16:26:24 +0000 (12:26 -0400)
committerPhilippe Mathieu-Daudé <philmd@redhat.com>
Tue, 2 Jul 2019 00:34:55 +0000 (02:34 +0200)
When erasing the chip, use the typical time specified in the CFI table
rather than arbitrarily selecting 5 seconds.

Since the currently unconfigurable value set in the table is 12, this
means a chip erase takes 4096 ms so this isn't a big change in behavior.

Signed-off-by: Stephen Checkoway <stephen.checkoway@oberlin.edu>
Message-Id: <20190426162624.55977-11-stephen.checkoway@oberlin.edu>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
hw/block/pflash_cfi02.c

index a3665da3b8efd1cdbbd066d5b26078a6129544d9..b2d37c33bb524a2d8a319f2bfde34caa7b238d58 100644 (file)
@@ -617,9 +617,9 @@ static void pflash_write(void *opaque, hwaddr offset, uint64_t value,
                 pflash_update(pfl, 0, pfl->chip_len);
             }
             set_dq7(pfl, 0x00);
-            /* Let's wait 5 seconds before chip erase is done */
+            /* Wait the time specified at CFI address 0x22. */
             timer_mod(&pfl->timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
-                      (NANOSECONDS_PER_SECOND * 5));
+                      (1ULL << pfl->cfi_table[0x22]) * SCALE_MS);
             break;
         case 0x30:
             /* Sector erase */