qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] MIPS_R4K: add optionnal 4MB cfi flash and allow to boot from it
@ 2008-04-01  5:57 Jean-Christophe PLAGNIOL-VILLARD
  2008-04-07 21:01 ` Aurelien Jarno
  0 siblings, 1 reply; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-04-01  5:57 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jean-Christophe PLAGNIOL-VILLARD

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c
index 63bd158..fca5651 100644
--- a/hw/mips_r4k.c
+++ b/hw/mips_r4k.c
@@ -14,6 +14,7 @@
 #include "net.h"
 #include "sysemu.h"
 #include "boards.h"
+#include "flash.h"
 
 #ifdef TARGET_WORDS_BIGENDIAN
 #define BIOS_FILENAME "mips_bios.bin"
@@ -144,6 +145,7 @@ static void main_cpu_reset(void *opaque)
         load_kernel (env);
 }
 
+static const int sector_len = 32 * 1024;
 static
 void mips_r4k_init (int ram_size, int vga_ram_size,
                     const char *boot_device, DisplayState *ds,
@@ -197,7 +199,17 @@ void mips_r4k_init (int ram_size, int vga_ram_size,
     if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) {
 	cpu_register_physical_memory(0x1fc00000,
 				     BIOS_SIZE, bios_offset | IO_MEM_ROM);
-    } else {
+    } else if ((index = drive_get_index(IF_PFLASH, 0, 0)) > -1) {
+        uint32_t mips_rom = 0x00400000;
+        cpu_register_physical_memory(0x1fc00000, mips_rom,
+	                     qemu_ram_alloc(mips_rom) | IO_MEM_ROM);
+        if (!pflash_cfi01_register(0x1fc00000, qemu_ram_alloc(mips_rom),
+            drives_table[index].bdrv, sector_len, mips_rom / sector_len,
+            4, 0, 0, 0, 0)) {
+            fprintf(stderr, "qemu: Error registering flash memory.\n");
+	}
+    }
+    else {
 	/* not fatal */
         fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n",
 		buf);
-- 
1.5.4.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread
* [Qemu-devel] [PATCH] MIPS_R4K: add optionnal 4MB cfi flash and allow to boot from it
@ 2008-02-26 17:11 Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 6+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2008-02-26 17:11 UTC (permalink / raw)
  To: qemu-devel; +Cc: Jean-Christophe PLAGNIOL-VILLARD

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>

diff --git a/hw/mips_r4k.c b/hw/mips_r4k.c
index 63bd158..fca5651 100644
--- a/hw/mips_r4k.c
+++ b/hw/mips_r4k.c
@@ -14,6 +14,7 @@
 #include "net.h"
 #include "sysemu.h"
 #include "boards.h"
+#include "flash.h"
 
 #ifdef TARGET_WORDS_BIGENDIAN
 #define BIOS_FILENAME "mips_bios.bin"
@@ -144,6 +145,7 @@ static void main_cpu_reset(void *opaque)
         load_kernel (env);
 }
 
+static const int sector_len = 32 * 1024;
 static
 void mips_r4k_init (int ram_size, int vga_ram_size,
                     const char *boot_device, DisplayState *ds,
@@ -197,7 +199,17 @@ void mips_r4k_init (int ram_size, int vga_ram_size,
     if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) {
 	cpu_register_physical_memory(0x1fc00000,
 				     BIOS_SIZE, bios_offset | IO_MEM_ROM);
-    } else {
+    } else if ((index = drive_get_index(IF_PFLASH, 0, 0)) > -1) {
+        uint32_t mips_rom = 0x00400000;
+        cpu_register_physical_memory(0x1fc00000, mips_rom,
+	                     qemu_ram_alloc(mips_rom) | IO_MEM_ROM);
+        if (!pflash_cfi01_register(0x1fc00000, qemu_ram_alloc(mips_rom),
+            drives_table[index].bdrv, sector_len, mips_rom / sector_len,
+            4, 0, 0, 0, 0)) {
+            fprintf(stderr, "qemu: Error registering flash memory.\n");
+	}
+    }
+    else {
 	/* not fatal */
         fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n",
 		buf);
-- 
1.5.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-04-20  6:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-01  5:57 [Qemu-devel] [PATCH] MIPS_R4K: add optionnal 4MB cfi flash and allow to boot from it Jean-Christophe PLAGNIOL-VILLARD
2008-04-07 21:01 ` Aurelien Jarno
2008-04-10  8:21   ` Jean-Christophe PLAGNIOL-VILLARD
2008-04-20  4:21   ` Jean-Christophe PLAGNIOL-VILLARD
2008-04-20  6:29     ` Thiemo Seufer
  -- strict thread matches above, loose matches on Subject: below --
2008-02-26 17:11 Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).