From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JnT2P-0008PC-TT for qemu-devel@nongnu.org; Sun, 20 Apr 2008 02:28:33 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JnT2P-0008Nw-4G for qemu-devel@nongnu.org; Sun, 20 Apr 2008 02:28:33 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JnT2P-0008Ni-0v for qemu-devel@nongnu.org; Sun, 20 Apr 2008 02:28:33 -0400 Received: from savannah.gnu.org ([199.232.41.3] helo=sv.gnu.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JnT2O-0008OU-Pw for qemu-devel@nongnu.org; Sun, 20 Apr 2008 02:28:32 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.63) (envelope-from ) id 1JnT2M-0003Cu-EV for qemu-devel@nongnu.org; Sun, 20 Apr 2008 06:28:31 +0000 Received: from ths by cvs.savannah.gnu.org with local (Exim 4.63) (envelope-from ) id 1JnT2L-0003Cm-UP for qemu-devel@nongnu.org; Sun, 20 Apr 2008 06:28:30 +0000 MIME-Version: 1.0 Errors-To: ths Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Thiemo Seufer Message-Id: Date: Sun, 20 Apr 2008 06:28:30 +0000 Subject: [Qemu-devel] [4224] Flash support for mips r4k pseudo-machine, by Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Revision: 4224 http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=4224 Author: ths Date: 2008-04-20 06:28:28 +0000 (Sun, 20 Apr 2008) Log Message: ----------- Flash support for mips r4k pseudo-machine, by Jean-Christophe Plagniol-Villard. Modified Paths: -------------- trunk/hw/mips_r4k.c Modified: trunk/hw/mips_r4k.c =================================================================== --- trunk/hw/mips_r4k.c 2008-04-20 03:40:20 UTC (rev 4223) +++ trunk/hw/mips_r4k.c 2008-04-20 06:28:28 UTC (rev 4224) @@ -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 @@ 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 @@ 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);