diff options
author | j_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-04-24 06:52:59 +0000 |
---|---|---|
committer | j_mayer <j_mayer@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-04-24 06:52:59 +0000 |
commit | 86f55663bd3926abba1d37e0440503a89ed2900f (patch) | |
tree | 07b07caabf83a2f106d895b8533c52decd86be01 /vl.c | |
parent | 35cdaad645d7a97e67690582feb1fc3a050c92ad (diff) | |
download | hqemu-86f55663bd3926abba1d37e0440503a89ed2900f.zip hqemu-86f55663bd3926abba1d37e0440503a89ed2900f.tar.gz |
Add -pflash option to register parallel flash bloc devices.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2719 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'vl.c')
-rw-r--r-- | vl.c | 34 |
1 files changed, 33 insertions, 1 deletions
@@ -138,6 +138,7 @@ IOPortWriteFunc *ioport_write_table[3][MAX_IOPORTS]; /* Note: bs_table[MAX_DISKS] is a dummy block driver if none available to store the VM snapshots */ BlockDriverState *bs_table[MAX_DISKS + 1], *fd_table[MAX_FD]; +BlockDriverState *pflash_table[MAX_PFLASH]; BlockDriverState *sd_bdrv; /* point to the block driver where the snapshots are managed */ BlockDriverState *bs_snapshots; @@ -6366,6 +6367,7 @@ void help(void) "-hdc/-hdd file use 'file' as IDE hard disk 2/3 image\n" "-cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)\n" "-sd file use 'file' as SecureDigital card image\n" + "-pflash file use 'file' as a parallel flash image\n" "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n" "-snapshot write to temporary files instead of disk image files\n" #ifdef CONFIG_SDL @@ -6504,6 +6506,7 @@ enum { QEMU_OPTION_hdd, QEMU_OPTION_cdrom, QEMU_OPTION_sd, + QEMU_OPTION_pflash, QEMU_OPTION_boot, QEMU_OPTION_snapshot, #ifdef TARGET_I386 @@ -6583,6 +6586,7 @@ const QEMUOption qemu_options[] = { { "hdd", HAS_ARG, QEMU_OPTION_hdd }, { "cdrom", HAS_ARG, QEMU_OPTION_cdrom }, { "sd", HAS_ARG, QEMU_OPTION_sd }, + { "pflash", HAS_ARG, QEMU_OPTION_pflash }, { "boot", HAS_ARG, QEMU_OPTION_boot }, { "snapshot", 0, QEMU_OPTION_snapshot }, #ifdef TARGET_I386 @@ -6867,10 +6871,11 @@ int main(int argc, char **argv) int use_gdbstub; const char *gdbstub_port; #endif - int i, cdrom_index; + int i, cdrom_index, pflash_index; int snapshot, linux_boot; const char *initrd_filename; const char *hd_filename[MAX_DISKS], *fd_filename[MAX_FD]; + const char *pflash_filename[MAX_PFLASH]; const char *sd_filename; const char *kernel_filename, *kernel_cmdline; DisplayState *ds = &display_state; @@ -6932,6 +6937,9 @@ int main(int argc, char **argv) fd_filename[i] = NULL; for(i = 0; i < MAX_DISKS; i++) hd_filename[i] = NULL; + for(i = 0; i < MAX_PFLASH; i++) + pflash_filename[i] = NULL; + pflash_index = 0; sd_filename = NULL; ram_size = DEFAULT_RAM_SIZE * 1024 * 1024; vga_ram_size = VGA_RAM_SIZE; @@ -7054,6 +7062,13 @@ int main(int argc, char **argv) case QEMU_OPTION_sd: sd_filename = optarg; break; + case QEMU_OPTION_pflash: + if (pflash_index >= MAX_PFLASH) { + fprintf(stderr, "qemu: too many parallel flash images\n"); + exit(1); + } + pflash_filename[pflash_index++] = optarg; + break; case QEMU_OPTION_snapshot: snapshot = 1; break; @@ -7563,6 +7578,23 @@ int main(int argc, char **argv) } } + /* Open the virtual parallel flash bloc devices */ + for(i = 0; i < MAX_PFLASH; i++) { + if (pflash_filename[i]) { + if (!pflash_table[i]) { + char buf[64]; + snprintf(buf, sizeof(buf), "fl%c", i + 'a'); + pflash_table[i] = bdrv_new(buf); + } + if (bdrv_open(pflash_table[i], pflash_filename[i], + snapshot ? BDRV_O_SNAPSHOT : 0) < 0) { + fprintf(stderr, "qemu: could not open flash image '%s'\n", + pflash_filename[i]); + exit(1); + } + } + } + sd_bdrv = bdrv_new ("sd"); /* FIXME: This isn't really a floppy, but it's a reasonable approximation. */ |