hw/block/pflash_cfi02: Open-code pflash_register_memory(rom=false)
authorPhilippe Mathieu-Daudé <philmd@redhat.com>
Tue, 9 Mar 2021 23:18:56 +0000 (00:18 +0100)
committerPhilippe Mathieu-Daudé <philmd@redhat.com>
Thu, 18 Mar 2021 10:16:31 +0000 (11:16 +0100)
There is only one call to pflash_register_memory() with
rom_mode == false. As we want to modify pflash_register_memory()
in the next patch, open-code this trivial function in place for
the 'rom_mode == false' case.

Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: David Edmondson <david.edmondson@oracle.com>
Message-Id: <20210310170528.1184868-6-philmd@redhat.com>

hw/block/pflash_cfi02.c

index 0eb868ecd3dcba3cf4873454e31d4caa4cc3da2d..897b7333222f34553416d99184255f84ee471689 100644 (file)
@@ -467,8 +467,10 @@ static void pflash_write(void *opaque, hwaddr offset, uint64_t value,
     switch (pfl->wcycle) {
     case 0:
         /* Set the device in I/O access mode if required */
-        if (pfl->rom_mode)
-            pflash_register_memory(pfl, 0);
+        if (pfl->rom_mode) {
+            pfl->rom_mode = false;
+            memory_region_rom_device_set_romd(&pfl->orig_mem, false);
+        }
         pfl->read_counter = 0;
         /* We're in read mode */
     check_unlock0: