Commit b305b5ba18d459eaa0ddf782921ff64f82ff4a2c
1 parent
eb69b50a
Flash support for mips r4k pseudo-machine, by
Jean-Christophe Plagniol-Villard. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4224 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
13 additions
and
1 deletions
hw/mips_r4k.c
@@ -14,6 +14,7 @@ | @@ -14,6 +14,7 @@ | ||
14 | #include "net.h" | 14 | #include "net.h" |
15 | #include "sysemu.h" | 15 | #include "sysemu.h" |
16 | #include "boards.h" | 16 | #include "boards.h" |
17 | +#include "flash.h" | ||
17 | 18 | ||
18 | #ifdef TARGET_WORDS_BIGENDIAN | 19 | #ifdef TARGET_WORDS_BIGENDIAN |
19 | #define BIOS_FILENAME "mips_bios.bin" | 20 | #define BIOS_FILENAME "mips_bios.bin" |
@@ -144,6 +145,7 @@ static void main_cpu_reset(void *opaque) | @@ -144,6 +145,7 @@ static void main_cpu_reset(void *opaque) | ||
144 | load_kernel (env); | 145 | load_kernel (env); |
145 | } | 146 | } |
146 | 147 | ||
148 | +static const int sector_len = 32 * 1024; | ||
147 | static | 149 | static |
148 | void mips_r4k_init (int ram_size, int vga_ram_size, | 150 | void mips_r4k_init (int ram_size, int vga_ram_size, |
149 | const char *boot_device, DisplayState *ds, | 151 | const char *boot_device, DisplayState *ds, |
@@ -197,7 +199,17 @@ void mips_r4k_init (int ram_size, int vga_ram_size, | @@ -197,7 +199,17 @@ void mips_r4k_init (int ram_size, int vga_ram_size, | ||
197 | if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) { | 199 | if ((bios_size > 0) && (bios_size <= BIOS_SIZE)) { |
198 | cpu_register_physical_memory(0x1fc00000, | 200 | cpu_register_physical_memory(0x1fc00000, |
199 | BIOS_SIZE, bios_offset | IO_MEM_ROM); | 201 | BIOS_SIZE, bios_offset | IO_MEM_ROM); |
200 | - } else { | 202 | + } else if ((index = drive_get_index(IF_PFLASH, 0, 0)) > -1) { |
203 | + uint32_t mips_rom = 0x00400000; | ||
204 | + cpu_register_physical_memory(0x1fc00000, mips_rom, | ||
205 | + qemu_ram_alloc(mips_rom) | IO_MEM_ROM); | ||
206 | + if (!pflash_cfi01_register(0x1fc00000, qemu_ram_alloc(mips_rom), | ||
207 | + drives_table[index].bdrv, sector_len, mips_rom / sector_len, | ||
208 | + 4, 0, 0, 0, 0)) { | ||
209 | + fprintf(stderr, "qemu: Error registering flash memory.\n"); | ||
210 | + } | ||
211 | + } | ||
212 | + else { | ||
201 | /* not fatal */ | 213 | /* not fatal */ |
202 | fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n", | 214 | fprintf(stderr, "qemu: Warning, could not load MIPS bios '%s'\n", |
203 | buf); | 215 | buf); |