Skip to contentSkip to conversation

hw/pflash_cfi01: add "0xf0" to select and deselect read mode

PATCH In review Liming Wang 2 participants 4 messages Mar 20, 2012 – Mar 21, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 hw/pflash_cfi01: add "0xf0" to select and deselect read mode

In CFI Specification, "0xff" and "0xf0" are both the data to select and deselect read mode, so add "0xf0" here.

Linux guest os often uses "0xf0" to select read mode, which leads qemu printing "pflash_write: Unimplemented flash cmd sequence (offset 00000000, wcycle 0x0 cmd 0x0 value 0xf0)". This patch fixes this mistake.

---
 hw/pflash_cfi01.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
hw/pflash_cfi01.c +3 -2
index b03f623..2e6fa71 100644
@@ -313,7 +313,8 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset,
             DPRINTF("%s: Write to buffer\n", __func__);
             pfl->status |= 0x80; /* Ready! */
             break;
-        case 0xff: /* Read array mode */
+        case 0xf0: /* Read array mode */
+        case 0xff:
             DPRINTF("%s: Read array mode\n", __func__);
             goto reset_flash;
         default:
@@ -367,7 +368,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset,
             }
             break;
         case 0x98:
-            if (cmd == 0xff) {
+            if (cmd == 0xff || cmd == 0xf0) {
                 goto reset_flash;
             } else {
                 DPRINTF("%s: leaving query mode\n", __func__);
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 2/2 hw/pflash_cfi01: change print method to avoid complaint

Linux guest os often writes invalid cmd data to reset into read mode, which leads many qemu complaint. Here we place all the debug message into macro PFLASH_DEBUG. We can turn on the all debug info by define PFLASH_DEBUG if we want to debug pflash_cfi01.

---
 hw/pflash_cfi01.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
hw/pflash_cfi01.c +1 -1
index 2e6fa71..4e39ea6 100644
@@ -433,7 +433,7 @@ static void pflash_write(pflash_t *pfl, target_phys_addr_t offset,
     return;
 
  error_flash:
-    printf("%s: Unimplemented flash cmd sequence "
+    DPRINTF("%s: Unimplemented flash cmd sequence "
            "(offset " TARGET_FMT_plx ", wcycle 0x%x cmd 0x%x value 0x%x)\n",
            __func__, offset, pfl->wcycle, pfl->cmd, value);
 
Signature · 1 line
1.7.0.4
#2 lore raw

Re: [Qemu-devel] [PATCH 2/2] hw/pflash_cfi01: change print method to avoid complaint

Am 20.03.2012 15:48, schrieb Liming Wang:

Quoted 18 lines

Linux guest os often writes invalid cmd data to reset into read mode, which leads many qemu complaint. Here we place all the debug message into macro PFLASH_DEBUG. We can turn on the all debug info by define PFLASH_DEBUG if we want to debug pflash_cfi01.

---
hw/pflash_cfi01.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
hw/pflash_cfi01.c +0 -0
index 2e6fa71..4e39ea6 100644
@@ -433,7 +433,7 @@ static void pflash_write(pflash_t *pfl, 
 target_phys_addr_t offset,
 return;
 
Quoted 5 lines

error_flash:
- printf("%s: Unimplemented flash cmd sequence "
+ DPRINTF("%s: Unimplemented flash cmd sequence " "(offset " TARGET_FMT_plx ", wcycle 0x%x cmd 0x%x value 0x%x)\n", __func__, offset, pfl->wcycle, pfl->cmd, value);

Using the trace mechanism of QEMU might be better here than DPRINTF It allows users to enable trace messages without recompilation. See docs/tracing.txt for details.

I personally like this special printf statement, because it shows me since several years that there _are_ flash command sequences which should be implemented (just boot MIPS Malta with Linux). Maybe one day I'll fix them. With DPRINTF, I'll never again get a reminder.

Regards,
Stefan Weil

author
#3 lore raw

Re: [Qemu-devel] [PATCH 2/2] hw/pflash_cfi01: change print method to avoid complaint

Quoted 19 lines · Stefan Weil

Am 20.03.2012 15:48, schrieb Liming Wang:

Quoted 18 lines

Linux guest os often writes invalid cmd data to reset into read mode, which leads many qemu complaint. Here we place all the debug message into macro PFLASH_DEBUG. We can turn on the all debug info by define PFLASH_DEBUG if we want to debug pflash_cfi01.

---
hw/pflash_cfi01.c | 2 +-

1 files changed, 1 insertions(+), 1 deletions(-)
hw/pflash_cfi01.c +0 -0
index 2e6fa71..4e39ea6 100644
@@ -433,7 +433,7 @@ static void pflash_write(pflash_t *pfl,
 target_phys_addr_t offset,
 return;
 
Quoted 9 lines
Quoted 5 lines

error_flash:
- printf("%s: Unimplemented flash cmd sequence "
+ DPRINTF("%s: Unimplemented flash cmd sequence " "(offset " TARGET_FMT_plx ", wcycle 0x%x cmd 0x%x value 0x%x)\n", __func__, offset, pfl->wcycle, pfl->cmd, value);

Using the trace mechanism of QEMU might be better here than DPRINTF It allows users to enable trace messages without recompilation. See docs/tracing.txt for details.

Agree, I'm also using that.

Quoted 2 lines

I personally like this special printf statement, because it shows me

If we want to reserve it, also don't expect anonying complaint by Linux, I suggest to skip special cmds that not used in pflash_cfi01, such as 0xaa, 0x55. How do you think so?

Quoted 2 lines

since several years that there _are_ flash command sequences which should be implemented (just boot MIPS Malta with Linux). Maybe one day I'll fix

Do you remeber what issues the command sequences, by bootloader or Linux? I fixed one Unimplemented flash cmd sequence in my first patch, it prints:
"pflash_write: Unimplemented flash cmd sequence (offset 00000000, wcycle 0x0 cmd 0x0 value 0xf0)"

Quoted 1 line

them. With DPRINTF, I'll never again get a reminder.

If I can reproduce that, I may help to fix them.

Thanks
Liming Wang

Quoted 4 lines

Regards,
Stefan Weil