Skip to contentSkip to conversation

MIPS_R4K: add optionnal 4MB cfi flash and allow to boot from it

PATCH In review Jean-Christophe PLAGNIOL-VILLARD 3 participants 5 messages Apr 1, 2008 – Apr 20, 2008

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS_R4K: add optionnal 4MB cfi flash and allow to boot from it

hw/mips_r4k.c +13 -1
index 63bd158..fca5651 100644
@@ -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);
Signature · 1 line
1.5.4.1
#1 lore raw
Quoted 31 lines · Jean-Christophe PLAGNIOL-VILLARD
hw/mips_r4k.c +6 -1
index 63bd158..fca5651 100644
@@ -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);

hw/mips_r4k.c void mips_r4k_init (int ram_size, int vga_ram_size, · line 215

Quoted 10 lines
hw/mips_r4k.c +7 -0
+        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);

Applied, but please note that the MIPS Qemu support has been removed from the kernel in version 2.6.25, so the same probably will probably happen sooner or later to the mips_r4k machine. It is probably not safe to base developments on that.

Signature · 4 lines
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#2 lore raw
Quoted 7 lines · Aurelien Jarno
Quoted 2 lines · Jean-Christophe PLAGNIOL-VILLARD

Applied, but please note that the MIPS Qemu support has been removed from the kernel in version 2.6.25, so the same probably will probably happen sooner or later to the mips_r4k machine. It is probably not safe to base developments on that.

Thanks,
I've dicuss about it with Robin Randhawa by mail.
Actualy we do not have the Malta board present in U-Boot. We will also remove the MIPS Qemu support from U-Boot when the Malta board will be present. If you could wait to remove the mips_r4k machine until it. It will be helpfull for us.

Best Regards,
J.
U-Boot Maintainer

#3 lore raw
In reply to Aurelien Jarno
Quoted 17 lines · Aurelien Jarno

hw/mips_r4k.c void mips_r4k_init (int ram_size, int vga_ram_size, · line 215

Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
hw/mips_r4k.c +7 -0
+        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);

Applied, but please note that the MIPS Qemu support has been removed from the kernel in version 2.6.25, so the same probably will probably happen sooner or later to the mips_r4k machine. It is probably not safe to base developments on that.

Hi,
I've download the last svn trunk, but I do not found this patch. Could you keep me in touch about it?

Best Regards,
J.

Quoted 7 lines
Signature · 5 lines
-- 
  .''`.  Aurelien Jarno	            | GPG: 1024D/F1BCDB73
 : :' :  Debian developer           | Electrical Engineer
 `. `'   [email protected]         | [email protected]
   `-    people.debian.org/~aurel32 | www.aurel32.net
#4 lore raw
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 17 lines · Aurelien Jarno

hw/mips_r4k.c void mips_r4k_init (int ram_size, int vga_ram_size, · line 215

Quoted 11 lines · Jean-Christophe PLAGNIOL-VILLARD
hw/mips_r4k.c +7 -0
+        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);

Applied, but please note that the MIPS Qemu support has been removed from the kernel in version 2.6.25, so the same probably will probably happen sooner or later to the mips_r4k machine. It is probably not safe to base developments on that.

Quoted 3 lines

Hi,
I've download the last svn trunk, but I do not found this patch. Could you keep me in touch about it?

I commited the patch.

Thiemo