Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JiyTB-0002ed-O3 for qemu-devel@nongnu.org; Mon, 07 Apr 2008 17:01:37 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JiyTA-0002e3-ON for qemu-devel@nongnu.org; Mon, 07 Apr 2008 17:01:37 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JiyTA-0002dy-Gy for qemu-devel@nongnu.org; Mon, 07 Apr 2008 17:01:36 -0400 Received: from hall.aurel32.net ([88.191.38.19]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JiyT9-0005QR-OI for qemu-devel@nongnu.org; Mon, 07 Apr 2008 17:01:36 -0400 Date: Mon, 7 Apr 2008 23:01:30 +0200 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] MIPS_R4K: add optionnal 4MB cfi flash and allow to boot from it Message-ID: <20080407210130.GA13774@volta.aurel32.net> References: <1207029431-15790-1-git-send-email-plagnioj@jcrosoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1207029431-15790-1-git-send-email-plagnioj@jcrosoft.com> 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 Cc: Jean-Christophe PLAGNIOL-VILLARD On Tue, Apr 01, 2008 at 07:57:11AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote: > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD > > 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); 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. -- .''`. Aurelien Jarno | GPG: 1024D/F1BCDB73 : :' : Debian developer | Electrical Engineer `. `' aurel32@debian.org | aurelien@aurel32.net `- people.debian.org/~aurel32 | www.aurel32.net