qemu_put signedness fixes, by Andre Przywara.
[qemu] / hw / pflash_cfi01.c
index 22bf025..745f5e5 100644 (file)
  * It does not implement much more ...
  */
 
-#include "vl.h"
+#include "hw.h"
+#include "flash.h"
+#include "block.h"
+#include "qemu-timer.h"
 
 #define PFLASH_BUG(fmt, args...) \
 do { \
@@ -350,6 +353,8 @@ static void pflash_write (pflash_t *pfl, target_ulong offset, uint32_t value,
 
             pfl->counter--;
             break;
+        default:
+            goto error_flash;
         }
         return;
     case 3: /* Confirm mode */
@@ -358,11 +363,14 @@ static void pflash_write (pflash_t *pfl, target_ulong offset, uint32_t value,
             if (cmd == 0xd0) {
                 pfl->wcycle = 0;
                 pfl->status |= 0x80;
-                break;
             } else {
                 DPRINTF("%s: unknown command for \"write block\"\n", __func__);
                 PFLASH_BUG("Write block confirm");
+                goto reset_flash;
             }
+            break;
+        default:
+            goto error_flash;
         }
         return;
     default:
@@ -475,11 +483,11 @@ static int ctz32 (uint32_t n)
     return ret;
 }
 
-pflash_t *pflash_register (target_phys_addr_t base, ram_addr_t off,
-                           BlockDriverState *bs,
-                           target_ulong sector_len, int nb_blocs, int width,
-                           uint16_t id0, uint16_t id1,
-                           uint16_t id2, uint16_t id3)
+pflash_t *pflash_cfi01_register(target_phys_addr_t base, ram_addr_t off,
+                                BlockDriverState *bs, target_ulong sector_len,
+                                int nb_blocs, int width,
+                                uint16_t id0, uint16_t id1,
+                                uint16_t id2, uint16_t id3)
 {
     pflash_t *pfl;
     target_long total_len;