Skip to contentSkip to conversation

mainstone: Make providing flash images non-mandatory

PATCH Applied Guenter Roeck 3 participants 3 messages Feb 17, 2020 – Feb 18, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mainstone: Make providing flash images non-mandatory

Up to now, the mainstone machine only boots if two flash images are provided. This is not really necessary; the machine can boot from initrd or from SD without it. At the same time, having to provide dummy flash images is a nuisance and does not add any real value. Make it optional.

---
 hw/arm/mainstone.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
hw/arm/mainstone.c +1 -10
index b01ce3ce08..6e64dfab50 100644
@@ -138,19 +138,10 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
     /* There are two 32MiB flash devices on the board */
     for (i = 0; i < 2; i ++) {
         dinfo = drive_get(IF_PFLASH, 0, i);
-        if (!dinfo) {
-            if (qtest_enabled()) {
-                break;
-            }
-            error_report("Two flash images must be given with the "
-                         "'pflash' parameter");
-            exit(1);
-        }
-
         if (!pflash_cfi01_register(mainstone_flash_base[i],
                                    i ? "mainstone.flash1" : "mainstone.flash0",
                                    MAINSTONE_FLASH,
-                                   blk_by_legacy_dinfo(dinfo),
+                                   dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
                                    sector_len, 4, 0, 0, 0, 0, be)) {
             error_report("Error registering flash memory");
             exit(1);
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 26 lines · Guenter Roeck

Up to now, the mainstone machine only boots if two flash images are provided. This is not really necessary; the machine can boot from initrd or from SD without it. At the same time, having to provide dummy flash images is a nuisance and does not add any real value. Make it optional.

---
  hw/arm/mainstone.c | 11 +----------
  1 file changed, 1 insertion(+), 10 deletions(-)
hw/arm/mainstone.c +0 -7
index b01ce3ce08..6e64dfab50 100644
@@ -138,19 +138,10 @@ static void mainstone_common_init(MemoryRegion *address_space_mem,
      /* There are two 32MiB flash devices on the board */
      for (i = 0; i < 2; i ++) {
          dinfo = drive_get(IF_PFLASH, 0, i);
-        if (!dinfo) {
-            if (qtest_enabled()) {
-                break;
-            }
-            error_report("Two flash images must be given with the "
-                         "'pflash' parameter");
-            exit(1);

hw/arm/mainstone.c static void mainstone_common_init(MemoryRegion *address_space_mem, · line 147

Quoted 10 lines
hw/arm/mainstone.c +1 -3
-        }
-
          if (!pflash_cfi01_register(mainstone_flash_base[i],
                                     i ? "mainstone.flash1" : "mainstone.flash0",
                                     MAINSTONE_FLASH,
-                                   blk_by_legacy_dinfo(dinfo),
+                                   dinfo ? blk_by_legacy_dinfo(dinfo) : NULL,
                                     sector_len, 4, 0, 0, 0, 0, be)) {
              error_report("Error registering flash memory");
              exit(1);
#2 lore raw
In reply to Guenter Roeck
Quoted 10 lines · Guenter Roeck

Up to now, the mainstone machine only boots if two flash images are provided. This is not really necessary; the machine can boot from initrd or from SD without it. At the same time, having to provide dummy flash images is a nuisance and does not add any real value. Make it optional.

---
 hw/arm/mainstone.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

Applied to target-arm.next, thanks.

-- PMM