[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 03/15] pflash_cfi01: Log use of flawed "write to
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH v4 03/15] pflash_cfi01: Log use of flawed "write to buffer" |
Date: |
Fri, 8 Mar 2019 10:45:58 +0100 |
Our implementation of "write to buffer" (command 0xE8) is flawed.
LOG_UNIMP its use, and add some FIXME comments.
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
---
hw/block/pflash_cfi01.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
index e6d933a06d..d381f14e3c 100644
--- a/hw/block/pflash_cfi01.c
+++ b/hw/block/pflash_cfi01.c
@@ -502,6 +502,10 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset,
break;
case 0xe8: /* Write to buffer */
DPRINTF("%s: Write to buffer\n", __func__);
+ /* FIXME should save @offset, @width for case 1+ */
+ qemu_log_mask(LOG_UNIMP,
+ "%s: Write to buffer emulation is flawed\n",
+ __func__);
pfl->status |= 0x80; /* Ready! */
break;
case 0xf0: /* Probe for AMD flash */
@@ -545,6 +549,7 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset,
/* Mask writeblock size based on device width, or bank width if
* device width not specified.
*/
+ /* FIXME check @offset, @width */
if (pfl->device_width) {
value = extract32(value, 0, pfl->device_width * 8);
} else {
@@ -582,7 +587,13 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset,
case 2:
switch (pfl->cmd) {
case 0xe8: /* Block write */
+ /* FIXME check @offset, @width */
if (!pfl->ro) {
+ /*
+ * FIXME writing straight to memory is *wrong*. We
+ * should write to a buffer, and flush it to memory
+ * only on confirm command (see below).
+ */
pflash_data_write(pfl, offset, value, width, be);
} else {
pfl->status |= 0x10; /* Programming error */
@@ -598,6 +609,7 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset,
pfl->wcycle++;
if (!pfl->ro) {
/* Flush the entire write buffer onto backing storage. */
+ /* FIXME premature! */
pflash_update(pfl, offset & mask, pfl->writeblock_size);
} else {
pfl->status |= 0x10; /* Programming error */
@@ -614,6 +626,7 @@ static void pflash_write(PFlashCFI01 *pfl, hwaddr offset,
switch (pfl->cmd) {
case 0xe8: /* Block write */
if (cmd == 0xd0) {
+ /* FIXME this is where we should write out the buffer */
pfl->wcycle = 0;
pfl->status |= 0x80;
} else {
--
2.17.2
- [Qemu-devel] [PATCH v4 00/15] pflash: Fixes and cleanups, Markus Armbruster, 2019/03/08
- [Qemu-devel] [PATCH v4 02/15] pflash_cfi01: Do not exit() on guest aborting "write to buffer", Markus Armbruster, 2019/03/08
- [Qemu-devel] [PATCH v4 10/15] mips_malta: Delete disabled, broken DEBUG_BOARD_INIT code, Markus Armbruster, 2019/03/08
- [Qemu-devel] [PATCH v4 07/15] ppc405_boards: Delete stale, disabled DEBUG_BOARD_INIT code, Markus Armbruster, 2019/03/08
- [Qemu-devel] [PATCH v4 09/15] r2d: Fix flash memory size, sector size, width, device ID, Markus Armbruster, 2019/03/08
- [Qemu-devel] [PATCH v4 11/15] hw/mips/malta: Remove fl_sectors variable, Markus Armbruster, 2019/03/08
- [Qemu-devel] [PATCH v4 03/15] pflash_cfi01: Log use of flawed "write to buffer",
Markus Armbruster <=
- [Qemu-devel] [PATCH v4 01/15] pflash: Rename pflash_t to PFlashCFI01, PFlashCFI02, Markus Armbruster, 2019/03/08
- [Qemu-devel] [PATCH v4 06/15] sam460ex: Don't size flash memory to match backing image, Markus Armbruster, 2019/03/08
- [Qemu-devel] [PATCH v4 08/15] ppc405_boards: Don't size flash memory to match backing image, Markus Armbruster, 2019/03/08
- [Qemu-devel] [PATCH v4 05/15] hw: Use PFLASH_CFI0{1, 2} and TYPE_PFLASH_CFI0{1, 2}, Markus Armbruster, 2019/03/08
- [Qemu-devel] [PATCH v4 13/15] mips_malta: Clean up definition of flash memory size somewhat, Markus Armbruster, 2019/03/08
- [Qemu-devel] [PATCH v4 12/15] hw/mips/malta: Restrict 'bios_size' variable scope, Markus Armbruster, 2019/03/08
- [Qemu-devel] [PATCH v4 14/15] pflash: Clean up after commit 368a354f02b, part 1, Markus Armbruster, 2019/03/08
- [Qemu-devel] [PATCH v4 04/15] pflash: Rename *CFI_PFLASH* to *PFLASH_CFI*, Markus Armbruster, 2019/03/08