mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
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
This commit is contained in:
parent
35cdaad645
commit
86f55663bd
2 changed files with 35 additions and 1 deletions
34
vl.c
34
vl.c
|
@ -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. */
|
||||
|
|
2
vl.h
2
vl.h
|
@ -1459,6 +1459,8 @@ int sh7750_register_io_device(struct SH7750State *s,
|
|||
int tc58128_init(struct SH7750State *s, char *zone1, char *zone2);
|
||||
|
||||
/* NOR flash devices */
|
||||
#define MAX_PFLASH 4
|
||||
extern BlockDriverState *pflash_table[MAX_PFLASH];
|
||||
typedef struct pflash_t pflash_t;
|
||||
|
||||
pflash_t *pflash_register (target_ulong base, ram_addr_t off,
|
||||
|
|
Loading…
Reference in a new issue