Commit 96d30e4801dd31b0fbbee4ac8977937ce0ec116f
1 parent
2f67a0d5
Revert -disk patch, as requested by Fabrice. The general idea of this
patch is sound, but the implementation is just too ugly. git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2309 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
5 changed files
with
56 additions
and
378 deletions
hw/pc.c
| @@ -705,21 +705,23 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device, | @@ -705,21 +705,23 @@ static void pc_init1(int ram_size, int vga_ram_size, int boot_device, | ||
| 705 | if (i440fx_state) { | 705 | if (i440fx_state) { |
| 706 | i440fx_init_memory_mappings(i440fx_state); | 706 | i440fx_init_memory_mappings(i440fx_state); |
| 707 | } | 707 | } |
| 708 | +#if 0 | ||
| 709 | + /* ??? Need to figure out some way for the user to | ||
| 710 | + specify SCSI devices. */ | ||
| 708 | if (pci_enabled) { | 711 | if (pci_enabled) { |
| 709 | void *scsi; | 712 | void *scsi; |
| 710 | - | ||
| 711 | - if (scsi_hba_lsi > 0) { | ||
| 712 | - if (!(scsi = lsi_scsi_init(pci_bus, -1))) { | ||
| 713 | - exit(1); | ||
| 714 | - } | ||
| 715 | - for(i = 0; i < MAX_SCSI_DISKS; i++) { | ||
| 716 | - if (scsi_disks_info[i].adapter == SCSI_LSI_53C895A && | ||
| 717 | - scsi_disks_info[i].device_type != SCSI_NONE) { | ||
| 718 | - lsi_scsi_attach(scsi, bs_scsi_table[i], scsi_disks_info[i].id); | ||
| 719 | - } | ||
| 720 | - } | ||
| 721 | - } | 713 | + BlockDriverState *bdrv; |
| 714 | + | ||
| 715 | + scsi = lsi_scsi_init(pci_bus, -1); | ||
| 716 | + bdrv = bdrv_new("scsidisk"); | ||
| 717 | + bdrv_open(bdrv, "scsi_disk.img", 0); | ||
| 718 | + lsi_scsi_attach(scsi, bdrv, -1); | ||
| 719 | + bdrv = bdrv_new("scsicd"); | ||
| 720 | + bdrv_open(bdrv, "scsi_cd.iso", 0); | ||
| 721 | + bdrv_set_type_hint(bdrv, BDRV_TYPE_CDROM); | ||
| 722 | + lsi_scsi_attach(scsi, bdrv, -1); | ||
| 722 | } | 723 | } |
| 724 | +#endif | ||
| 723 | } | 725 | } |
| 724 | 726 | ||
| 725 | static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device, | 727 | static void pc_init_pci(int ram_size, int vga_ram_size, int boot_device, |
hw/sun4m.c
| @@ -262,12 +262,6 @@ static void sun4m_init(int ram_size, int vga_ram_size, int boot_device, | @@ -262,12 +262,6 @@ static void sun4m_init(int ram_size, int vga_ram_size, int boot_device, | ||
| 262 | slavio_serial_init(PHYS_JJ_SER, PHYS_JJ_SER_IRQ, serial_hds[1], serial_hds[0]); | 262 | slavio_serial_init(PHYS_JJ_SER, PHYS_JJ_SER_IRQ, serial_hds[1], serial_hds[0]); |
| 263 | fdctrl_init(PHYS_JJ_FLOPPY_IRQ, 0, 1, PHYS_JJ_FDC, fd_table); | 263 | fdctrl_init(PHYS_JJ_FLOPPY_IRQ, 0, 1, PHYS_JJ_FDC, fd_table); |
| 264 | main_esp = esp_init(bs_table, PHYS_JJ_ESP, dma); | 264 | main_esp = esp_init(bs_table, PHYS_JJ_ESP, dma); |
| 265 | - for (i = 0; i < MAX_SCSI_DISKS; i++) { | ||
| 266 | - if (scsi_disks_info[i].adapter == SCSI_ESP && | ||
| 267 | - scsi_disks_info[i].device_type != SCSI_NONE) { | ||
| 268 | - esp_scsi_attach(main_esp, bs_scsi_table[i], scsi_disks_info[i].id); | ||
| 269 | - } | ||
| 270 | - } | ||
| 271 | slavio_misc = slavio_misc_init(PHYS_JJ_SLAVIO, PHYS_JJ_ME_IRQ); | 265 | slavio_misc = slavio_misc_init(PHYS_JJ_SLAVIO, PHYS_JJ_ME_IRQ); |
| 272 | cs_init(PHYS_JJ_CS, PHYS_JJ_CS_IRQ, slavio_intctl); | 266 | cs_init(PHYS_JJ_CS, PHYS_JJ_CS_IRQ, slavio_intctl); |
| 273 | sparc32_dma_set_reset_data(dma, main_esp, main_lance); | 267 | sparc32_dma_set_reset_data(dma, main_esp, main_lance); |
qemu-doc.texi
| @@ -223,12 +223,6 @@ using @file{/dev/cdrom} as filename (@pxref{host_drives}). | @@ -223,12 +223,6 @@ using @file{/dev/cdrom} as filename (@pxref{host_drives}). | ||
| 223 | Boot on floppy (a), hard disk (c), CD-ROM (d), or Etherboot (n). Hard disk boot | 223 | Boot on floppy (a), hard disk (c), CD-ROM (d), or Etherboot (n). Hard disk boot |
| 224 | is the default. | 224 | is the default. |
| 225 | 225 | ||
| 226 | -@item -disk ide,img=file[,hdx=a..dd][,type=disk|cdrom] | ||
| 227 | -Use @var{file} as the IDE disk/CD-ROM image. The defaults are: hdx=a,type=disk | ||
| 228 | - | ||
| 229 | -@item -disk scsi,img=file[,sdx=a..g][,type=disk|cdrom][,id=n] | ||
| 230 | -Use @var{file} as the SCSI disk/CD-ROM image. The defaults are: sdx=a,type=disk,id='auto assign' | ||
| 231 | - | ||
| 232 | @item -snapshot | 226 | @item -snapshot |
| 233 | Write to temporary files instead of disk image files. In this case, | 227 | Write to temporary files instead of disk image files. In this case, |
| 234 | the raw disk image you use is not written back. You can however force | 228 | the raw disk image you use is not written back. You can however force |
vl.c
| @@ -114,8 +114,6 @@ | @@ -114,8 +114,6 @@ | ||
| 114 | /* XXX: use a two level table to limit memory usage */ | 114 | /* XXX: use a two level table to limit memory usage */ |
| 115 | #define MAX_IOPORTS 65536 | 115 | #define MAX_IOPORTS 65536 |
| 116 | 116 | ||
| 117 | -#define DISK_OPTIONS_SIZE 256 | ||
| 118 | - | ||
| 119 | const char *bios_dir = CONFIG_QEMU_SHAREDIR; | 117 | const char *bios_dir = CONFIG_QEMU_SHAREDIR; |
| 120 | char phys_ram_file[1024]; | 118 | char phys_ram_file[1024]; |
| 121 | void *ioport_opaque[MAX_IOPORTS]; | 119 | void *ioport_opaque[MAX_IOPORTS]; |
| @@ -126,9 +124,6 @@ IOPortWriteFunc *ioport_write_table[3][MAX_IOPORTS]; | @@ -126,9 +124,6 @@ IOPortWriteFunc *ioport_write_table[3][MAX_IOPORTS]; | ||
| 126 | BlockDriverState *bs_table[MAX_DISKS + 1], *fd_table[MAX_FD]; | 124 | BlockDriverState *bs_table[MAX_DISKS + 1], *fd_table[MAX_FD]; |
| 127 | /* point to the block driver where the snapshots are managed */ | 125 | /* point to the block driver where the snapshots are managed */ |
| 128 | BlockDriverState *bs_snapshots; | 126 | BlockDriverState *bs_snapshots; |
| 129 | -BlockDriverState *bs_scsi_table[MAX_SCSI_DISKS]; | ||
| 130 | -SCSIDiskInfo scsi_disks_info[MAX_SCSI_DISKS]; | ||
| 131 | -int scsi_hba_lsi; /* Count of scsi disks/cdrom using this lsi adapter */ | ||
| 132 | int vga_ram_size; | 127 | int vga_ram_size; |
| 133 | int bios_size; | 128 | int bios_size; |
| 134 | static DisplayState display_state; | 129 | static DisplayState display_state; |
| @@ -3983,178 +3978,6 @@ void do_info_network(void) | @@ -3983,178 +3978,6 @@ void do_info_network(void) | ||
| 3983 | } | 3978 | } |
| 3984 | } | 3979 | } |
| 3985 | 3980 | ||
| 3986 | -/* Parse IDE and SCSI disk options */ | ||
| 3987 | -static int disk_options_init(int num_ide_disks, | ||
| 3988 | - char ide_disk_options[][DISK_OPTIONS_SIZE], | ||
| 3989 | - int snapshot, | ||
| 3990 | - int num_scsi_disks, | ||
| 3991 | - char scsi_disk_options[][DISK_OPTIONS_SIZE], | ||
| 3992 | - int cdrom_index, | ||
| 3993 | - int cyls, | ||
| 3994 | - int heads, | ||
| 3995 | - int secs, | ||
| 3996 | - int translation) | ||
| 3997 | -{ | ||
| 3998 | - char buf[256]; | ||
| 3999 | - char dev_name[64]; | ||
| 4000 | - int id, i, j; | ||
| 4001 | - int cdrom_device; | ||
| 4002 | - int ide_cdrom_created = 0; | ||
| 4003 | - int scsi_index; | ||
| 4004 | - scsi_host_adapters temp_adapter; | ||
| 4005 | - | ||
| 4006 | - /* Process any IDE disks/cdroms */ | ||
| 4007 | - for (i=0; i< num_ide_disks; i++) { | ||
| 4008 | - for (j=0; j<MAX_DISKS; j++) { | ||
| 4009 | - if (ide_disk_options[j][0] == '\0') | ||
| 4010 | - continue; | ||
| 4011 | - | ||
| 4012 | - if (get_param_value(buf, sizeof(buf),"type",ide_disk_options[j])) { | ||
| 4013 | - if (!strcmp(buf, "disk")) { | ||
| 4014 | - cdrom_device = 0; | ||
| 4015 | - } else if (!strcmp(buf, "cdrom")) { | ||
| 4016 | - cdrom_device = 1; | ||
| 4017 | - ide_cdrom_created = 1; | ||
| 4018 | - } else { | ||
| 4019 | - fprintf(stderr, "qemu: invalid IDE disk type= value: %s\n", buf); | ||
| 4020 | - return -1; | ||
| 4021 | - } | ||
| 4022 | - } else { | ||
| 4023 | - cdrom_device = 0; | ||
| 4024 | - } | ||
| 4025 | - | ||
| 4026 | - if (cdrom_device) { | ||
| 4027 | - snprintf(dev_name, sizeof(dev_name), "cdrom%c", i + '0'); | ||
| 4028 | - } else { | ||
| 4029 | - snprintf(dev_name, sizeof(dev_name), "hd%c", i + 'a'); | ||
| 4030 | - } | ||
| 4031 | - | ||
| 4032 | - if (!(get_param_value(buf, sizeof(buf),"img",ide_disk_options[j]))) { | ||
| 4033 | - fprintf(stderr, "qemu: missing IDE disk img= value.\n"); | ||
| 4034 | - return -1; | ||
| 4035 | - } | ||
| 4036 | - | ||
| 4037 | - if (!(bs_table[i] = bdrv_new(dev_name))) { | ||
| 4038 | - fprintf(stderr, "qemu: unable to create new block device for:%s\n",dev_name); | ||
| 4039 | - return -1; | ||
| 4040 | - } | ||
| 4041 | - | ||
| 4042 | - if (cdrom_device) { | ||
| 4043 | - bdrv_set_type_hint(bs_table[i], BDRV_TYPE_CDROM); | ||
| 4044 | - } | ||
| 4045 | - | ||
| 4046 | - if (bdrv_open(bs_table[i], buf, snapshot ? BDRV_O_SNAPSHOT : 0) < 0) { | ||
| 4047 | - fprintf(stderr, "qemu: could not open hard disk image: '%s'\n", | ||
| 4048 | - buf); | ||
| 4049 | - return -1; | ||
| 4050 | - } | ||
| 4051 | - if (i == 0 && cyls != 0) { | ||
| 4052 | - bdrv_set_geometry_hint(bs_table[i], cyls, heads, secs); | ||
| 4053 | - bdrv_set_translation_hint(bs_table[i], translation); | ||
| 4054 | - } | ||
| 4055 | - ide_disk_options[j][0] = '\0'; | ||
| 4056 | - | ||
| 4057 | - if (i == cdrom_index) { | ||
| 4058 | - cdrom_index = -1; | ||
| 4059 | - } | ||
| 4060 | - break; /* finished with this IDE device*/ | ||
| 4061 | - } | ||
| 4062 | - } | ||
| 4063 | - | ||
| 4064 | - if (cdrom_index >= 0 && (!ide_cdrom_created)) { | ||
| 4065 | - bs_table[cdrom_index] = bdrv_new("cdrom"); | ||
| 4066 | - bdrv_set_type_hint(bs_table[cdrom_index], BDRV_TYPE_CDROM); | ||
| 4067 | - } | ||
| 4068 | - | ||
| 4069 | - for(i = 0; i < num_scsi_disks; i++) { | ||
| 4070 | - | ||
| 4071 | -#if !defined(TARGET_SPARC) || defined(TARGET_SPARC64) | ||
| 4072 | - temp_adapter = SCSI_LSI_53C895A; | ||
| 4073 | - scsi_hba_lsi++; | ||
| 4074 | -#else | ||
| 4075 | - temp_adapter = SCSI_ESP; | ||
| 4076 | -#endif | ||
| 4077 | - | ||
| 4078 | - /*Check for sdx= parameter */ | ||
| 4079 | - if (get_param_value(buf, sizeof(buf), "sdx", scsi_disk_options[i])) { | ||
| 4080 | - if (buf[0] >= 'a' && buf[0] <= 'g') { | ||
| 4081 | - scsi_index = buf[0] - 'a'; | ||
| 4082 | - } else{ | ||
| 4083 | - fprintf(stderr, "qemu: sdx= option for SCSI must be one letter from a-g. %s \n",buf); | ||
| 4084 | - exit(1); | ||
| 4085 | - } | ||
| 4086 | - } else { | ||
| 4087 | - scsi_index = 0; | ||
| 4088 | - } | ||
| 4089 | - | ||
| 4090 | - /* Check for SCSI id specified. */ | ||
| 4091 | - if (get_param_value(buf, sizeof(buf),"id",scsi_disk_options[i])) { | ||
| 4092 | - id = strtol(buf, NULL, 0); | ||
| 4093 | - if (id < 0 || id > 6) { | ||
| 4094 | - fprintf(stderr, "qemu: SCSI id must be from 0-6: %d\n", id); | ||
| 4095 | - return -1; | ||
| 4096 | - } | ||
| 4097 | - /* Check if id already used */ | ||
| 4098 | - for(j = 0; j < MAX_SCSI_DISKS; j++) { | ||
| 4099 | - if (scsi_disks_info[j].device_type != SCSI_NONE && | ||
| 4100 | - j != i && | ||
| 4101 | - scsi_disks_info[j].adapter == temp_adapter && | ||
| 4102 | - scsi_disks_info[j].id == id ) { | ||
| 4103 | - fprintf(stderr, "qemu: SCSI id already used: %u\n", id); | ||
| 4104 | - return -1; | ||
| 4105 | - } | ||
| 4106 | - } | ||
| 4107 | - } else { | ||
| 4108 | - id = -1; | ||
| 4109 | - } | ||
| 4110 | - scsi_disks_info[i].adapter = temp_adapter; | ||
| 4111 | - scsi_disks_info[i].id = id; | ||
| 4112 | - | ||
| 4113 | - if (get_param_value(buf, sizeof(buf),"type",scsi_disk_options[i])) { | ||
| 4114 | - if (!strcmp(buf, "disk")) { | ||
| 4115 | - cdrom_device = 0; | ||
| 4116 | - } else if (!strcmp(buf, "cdrom")) { | ||
| 4117 | - cdrom_device = 1; | ||
| 4118 | - } else { | ||
| 4119 | - fprintf(stderr, "qemu: invalid SCSI disk type= value: %s\n", buf); | ||
| 4120 | - return -1; | ||
| 4121 | - } | ||
| 4122 | - } else { | ||
| 4123 | - cdrom_device = 0; | ||
| 4124 | - } | ||
| 4125 | - | ||
| 4126 | - if (cdrom_device) { | ||
| 4127 | - snprintf(dev_name, sizeof(buf), "cdrom%c", scsi_index + '0'); | ||
| 4128 | - scsi_disks_info[scsi_index].device_type = SCSI_CDROM; | ||
| 4129 | - } else { | ||
| 4130 | - snprintf(dev_name, sizeof(buf), "sd%c", scsi_index + 'a'); | ||
| 4131 | - scsi_disks_info[scsi_index].device_type = SCSI_DISK; | ||
| 4132 | - } | ||
| 4133 | - | ||
| 4134 | - if (!(bs_scsi_table[scsi_index] = bdrv_new(dev_name))) { | ||
| 4135 | - fprintf(stderr, "qemu: unable to create new block device for:%s\n",dev_name); | ||
| 4136 | - return -1; | ||
| 4137 | - } | ||
| 4138 | - | ||
| 4139 | - /* Get image filename from options and then try to open it */ | ||
| 4140 | - if (get_param_value(buf, sizeof(buf),"img",scsi_disk_options[i])) { | ||
| 4141 | - if (bdrv_open(bs_scsi_table[scsi_index], buf, 0) < 0) { | ||
| 4142 | - fprintf(stderr, "qemu: could not open SCSI disk image img='%s'\n",buf); | ||
| 4143 | - return -1; | ||
| 4144 | - } | ||
| 4145 | - } else { | ||
| 4146 | - fprintf(stderr, "qemu: SCSI disk image not specified for sd%c \n", i + 'a'); | ||
| 4147 | - return -1; | ||
| 4148 | - } | ||
| 4149 | - if (cdrom_device) { | ||
| 4150 | - bdrv_set_type_hint(bs_scsi_table[scsi_index], BDRV_TYPE_CDROM); | ||
| 4151 | - } | ||
| 4152 | - } | ||
| 4153 | - | ||
| 4154 | - return 0; | ||
| 4155 | -} | ||
| 4156 | - | ||
| 4157 | - | ||
| 4158 | /***********************************************************/ | 3981 | /***********************************************************/ |
| 4159 | /* USB devices */ | 3982 | /* USB devices */ |
| 4160 | 3983 | ||
| @@ -6263,10 +6086,6 @@ void help(void) | @@ -6263,10 +6086,6 @@ void help(void) | ||
| 6263 | "-hdc/-hdd file use 'file' as IDE hard disk 2/3 image\n" | 6086 | "-hdc/-hdd file use 'file' as IDE hard disk 2/3 image\n" |
| 6264 | "-cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)\n" | 6087 | "-cdrom file use 'file' as IDE cdrom image (cdrom is ide1 master)\n" |
| 6265 | "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n" | 6088 | "-boot [a|c|d|n] boot on floppy (a), hard disk (c), CD-ROM (d), or network (n)\n" |
| 6266 | - "-disk ide,img=file[,hdx=a..dd][,type=disk|cdrom] \n" | ||
| 6267 | - " defaults are: hdx=a,type=disk \n" | ||
| 6268 | - "-disk scsi,img=file[,sdx=a..g][,type=disk|cdrom][,id=n] \n" | ||
| 6269 | - " defaults are: sdx=a,type=disk,id='auto assign' \n" | ||
| 6270 | "-snapshot write to temporary files instead of disk image files\n" | 6089 | "-snapshot write to temporary files instead of disk image files\n" |
| 6271 | #ifdef CONFIG_SDL | 6090 | #ifdef CONFIG_SDL |
| 6272 | "-no-quit disable SDL window close capability\n" | 6091 | "-no-quit disable SDL window close capability\n" |
| @@ -6448,7 +6267,6 @@ enum { | @@ -6448,7 +6267,6 @@ enum { | ||
| 6448 | QEMU_OPTION_no_acpi, | 6267 | QEMU_OPTION_no_acpi, |
| 6449 | QEMU_OPTION_no_reboot, | 6268 | QEMU_OPTION_no_reboot, |
| 6450 | QEMU_OPTION_daemonize, | 6269 | QEMU_OPTION_daemonize, |
| 6451 | - QEMU_OPTION_disk, | ||
| 6452 | QEMU_OPTION_option_rom, | 6270 | QEMU_OPTION_option_rom, |
| 6453 | }; | 6271 | }; |
| 6454 | 6272 | ||
| @@ -6524,8 +6342,7 @@ const QEMUOption qemu_options[] = { | @@ -6524,8 +6342,7 @@ const QEMUOption qemu_options[] = { | ||
| 6524 | { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice }, | 6342 | { "usbdevice", HAS_ARG, QEMU_OPTION_usbdevice }, |
| 6525 | { "smp", HAS_ARG, QEMU_OPTION_smp }, | 6343 | { "smp", HAS_ARG, QEMU_OPTION_smp }, |
| 6526 | { "vnc", HAS_ARG, QEMU_OPTION_vnc }, | 6344 | { "vnc", HAS_ARG, QEMU_OPTION_vnc }, |
| 6527 | - { "disk", HAS_ARG, QEMU_OPTION_disk }, | ||
| 6528 | - | 6345 | + |
| 6529 | /* temporary options */ | 6346 | /* temporary options */ |
| 6530 | { "usb", 0, QEMU_OPTION_usb }, | 6347 | { "usb", 0, QEMU_OPTION_usb }, |
| 6531 | { "cirrusvga", 0, QEMU_OPTION_cirrusvga }, | 6348 | { "cirrusvga", 0, QEMU_OPTION_cirrusvga }, |
| @@ -6744,11 +6561,7 @@ int main(int argc, char **argv) | @@ -6744,11 +6561,7 @@ int main(int argc, char **argv) | ||
| 6744 | int i, cdrom_index; | 6561 | int i, cdrom_index; |
| 6745 | int snapshot, linux_boot; | 6562 | int snapshot, linux_boot; |
| 6746 | const char *initrd_filename; | 6563 | const char *initrd_filename; |
| 6747 | - const char *fd_filename[MAX_FD]; | ||
| 6748 | - char scsi_options[MAX_SCSI_DISKS] [DISK_OPTIONS_SIZE]; | ||
| 6749 | - char ide_options[MAX_DISKS] [DISK_OPTIONS_SIZE]; | ||
| 6750 | - int num_ide_disks; | ||
| 6751 | - int num_scsi_disks; | 6564 | + const char *hd_filename[MAX_DISKS], *fd_filename[MAX_FD]; |
| 6752 | const char *kernel_filename, *kernel_cmdline; | 6565 | const char *kernel_filename, *kernel_cmdline; |
| 6753 | DisplayState *ds = &display_state; | 6566 | DisplayState *ds = &display_state; |
| 6754 | int cyls, heads, secs, translation; | 6567 | int cyls, heads, secs, translation; |
| @@ -6803,19 +6616,10 @@ int main(int argc, char **argv) | @@ -6803,19 +6616,10 @@ int main(int argc, char **argv) | ||
| 6803 | register_machines(); | 6616 | register_machines(); |
| 6804 | machine = first_machine; | 6617 | machine = first_machine; |
| 6805 | initrd_filename = NULL; | 6618 | initrd_filename = NULL; |
| 6806 | - for(i = 0; i < MAX_SCSI_DISKS; i++) { | ||
| 6807 | - scsi_disks_info[i].device_type = SCSI_NONE; | ||
| 6808 | - bs_scsi_table[i] = NULL; | ||
| 6809 | - } | ||
| 6810 | - | ||
| 6811 | - num_ide_disks = 0; | ||
| 6812 | - num_scsi_disks = 0; | ||
| 6813 | - | ||
| 6814 | for(i = 0; i < MAX_FD; i++) | 6619 | for(i = 0; i < MAX_FD; i++) |
| 6815 | fd_filename[i] = NULL; | 6620 | fd_filename[i] = NULL; |
| 6816 | - for(i = 0; i < MAX_DISKS; i++) { | ||
| 6817 | - ide_options[i][0] = '\0'; | ||
| 6818 | - } | 6621 | + for(i = 0; i < MAX_DISKS; i++) |
| 6622 | + hd_filename[i] = NULL; | ||
| 6819 | ram_size = DEFAULT_RAM_SIZE * 1024 * 1024; | 6623 | ram_size = DEFAULT_RAM_SIZE * 1024 * 1024; |
| 6820 | vga_ram_size = VGA_RAM_SIZE; | 6624 | vga_ram_size = VGA_RAM_SIZE; |
| 6821 | bios_size = BIOS_SIZE; | 6625 | bios_size = BIOS_SIZE; |
| @@ -6859,16 +6663,7 @@ int main(int argc, char **argv) | @@ -6859,16 +6663,7 @@ int main(int argc, char **argv) | ||
| 6859 | break; | 6663 | break; |
| 6860 | r = argv[optind]; | 6664 | r = argv[optind]; |
| 6861 | if (r[0] != '-') { | 6665 | if (r[0] != '-') { |
| 6862 | - | ||
| 6863 | - /* Build new disk IDE syntax string */ | ||
| 6864 | - pstrcpy(ide_options[0], | ||
| 6865 | - 14, | ||
| 6866 | - "hdx=a,img="); | ||
| 6867 | - /*Add on image filename */ | ||
| 6868 | - pstrcpy(&(ide_options[0][13]), | ||
| 6869 | - sizeof(ide_options[0])-13, | ||
| 6870 | - argv[optind++]); | ||
| 6871 | - num_ide_disks++; | 6666 | + hd_filename[0] = argv[optind++]; |
| 6872 | } else { | 6667 | } else { |
| 6873 | const QEMUOption *popt; | 6668 | const QEMUOption *popt; |
| 6874 | 6669 | ||
| @@ -6918,75 +6713,10 @@ int main(int argc, char **argv) | @@ -6918,75 +6713,10 @@ int main(int argc, char **argv) | ||
| 6918 | case QEMU_OPTION_hdd: | 6713 | case QEMU_OPTION_hdd: |
| 6919 | { | 6714 | { |
| 6920 | int hd_index; | 6715 | int hd_index; |
| 6921 | - const char newIDE_DiskSyntax [][10] = { | ||
| 6922 | - "hdx=a,img=", "hdx=b,img=", "hdx=c,img=", "hdx=d,img=" }; | ||
| 6923 | - | ||
| 6924 | hd_index = popt->index - QEMU_OPTION_hda; | 6716 | hd_index = popt->index - QEMU_OPTION_hda; |
| 6925 | - if (num_ide_disks >= MAX_DISKS) { | ||
| 6926 | - fprintf(stderr, "qemu: too many IDE disks defined.\n"); | ||
| 6927 | - exit(1); | ||
| 6928 | - } | ||
| 6929 | - /* Build new disk IDE syntax string */ | ||
| 6930 | - pstrcpy(ide_options[hd_index], | ||
| 6931 | - 11, | ||
| 6932 | - newIDE_DiskSyntax[hd_index]); | ||
| 6933 | - /* Add on image filename */ | ||
| 6934 | - pstrcpy(&(ide_options[hd_index][10]), | ||
| 6935 | - sizeof(ide_options[0])-10, | ||
| 6936 | - optarg); | ||
| 6937 | - num_ide_disks++; | ||
| 6938 | - } | ||
| 6939 | - break; | ||
| 6940 | - case QEMU_OPTION_disk: /*Combined IDE and SCSI, for disk and CDROM */ | ||
| 6941 | - { | ||
| 6942 | - const char *p_input_char; | ||
| 6943 | - char *p_output_string; | ||
| 6944 | - char device[64]; | ||
| 6945 | - int disk_index; | ||
| 6946 | - | ||
| 6947 | - p_input_char = optarg; | ||
| 6948 | - p_output_string = device; | ||
| 6949 | - while (*p_input_char != '\0' && *p_input_char != ',') { | ||
| 6950 | - if ((p_output_string - device) < sizeof(device) - 1) | ||
| 6951 | - *p_output_string++ = *p_input_char; | ||
| 6952 | - p_input_char++; | ||
| 6953 | - } | ||
| 6954 | - *p_output_string = '\0'; | ||
| 6955 | - if (*p_input_char == ',') | ||
| 6956 | - p_input_char++; | ||
| 6957 | - | ||
| 6958 | - if (!strcmp(device, "scsi")) { | ||
| 6959 | - if (num_scsi_disks >= MAX_SCSI_DISKS) { | ||
| 6960 | - fprintf(stderr, "qemu: too many SCSI disks defined.\n"); | ||
| 6961 | - exit(1); | ||
| 6962 | - } | ||
| 6963 | - pstrcpy(scsi_options[num_scsi_disks], | ||
| 6964 | - sizeof(scsi_options[0]), | ||
| 6965 | - p_input_char); | ||
| 6966 | - num_scsi_disks++; | ||
| 6967 | - } else if (!strcmp(device,"ide")) { | ||
| 6968 | - if (num_ide_disks >= MAX_DISKS) { | ||
| 6969 | - fprintf(stderr, "qemu: too many IDE disks/cdroms defined.\n"); | ||
| 6970 | - exit(1); | ||
| 6971 | - } | ||
| 6972 | - disk_index = 0; /* default is hda */ | ||
| 6973 | - if (get_param_value(device, sizeof(device),"hdx",p_input_char)) { | ||
| 6974 | - if (device[0] >= 'a' && device[0] <= 'd') { | ||
| 6975 | - disk_index = device[0] - 'a'; | ||
| 6976 | - } else { | ||
| 6977 | - fprintf(stderr, "qemu: invalid IDE disk hdx= value: %s\n", device); | ||
| 6978 | - return -1; | ||
| 6979 | - } | ||
| 6980 | - } | ||
| 6981 | - else disk_index=0; | ||
| 6982 | - pstrcpy(ide_options[disk_index], | ||
| 6983 | - sizeof(ide_options[0]), | ||
| 6984 | - p_input_char); | ||
| 6985 | - num_ide_disks++; | ||
| 6986 | - } else { | ||
| 6987 | - fprintf(stderr, "qemu: -disk option must specify IDE or SCSI: %s \n",device); | ||
| 6988 | - exit(1); | ||
| 6989 | - } | 6717 | + hd_filename[hd_index] = optarg; |
| 6718 | + if (hd_index == cdrom_index) | ||
| 6719 | + cdrom_index = -1; | ||
| 6990 | } | 6720 | } |
| 6991 | break; | 6721 | break; |
| 6992 | case QEMU_OPTION_snapshot: | 6722 | case QEMU_OPTION_snapshot: |
| @@ -7040,46 +6770,9 @@ int main(int argc, char **argv) | @@ -7040,46 +6770,9 @@ int main(int argc, char **argv) | ||
| 7040 | kernel_cmdline = optarg; | 6770 | kernel_cmdline = optarg; |
| 7041 | break; | 6771 | break; |
| 7042 | case QEMU_OPTION_cdrom: | 6772 | case QEMU_OPTION_cdrom: |
| 7043 | -#if !defined(TARGET_SPARC) || defined(TARGET_SPARC64) | ||
| 7044 | - /* Assume boot cdrom is IDE */ | ||
| 7045 | - { | ||
| 7046 | - char buf[22]; | ||
| 7047 | - if (num_ide_disks >= MAX_DISKS) { | ||
| 7048 | - fprintf(stderr, "qemu: too many IDE disks/cdroms defined.\n"); | ||
| 7049 | - exit(1); | ||
| 7050 | - } | ||
| 7051 | - snprintf(buf, sizeof(buf), "type=cdrom,hdx=%c,img=", cdrom_index + 'a'); | ||
| 7052 | - /* Build new disk IDE syntax string */ | ||
| 7053 | - pstrcpy(ide_options[cdrom_index], | ||
| 7054 | - 22, | ||
| 7055 | - buf); | ||
| 7056 | - /* Add on image filename */ | ||
| 7057 | - pstrcpy(&(ide_options[cdrom_index][21]), | ||
| 7058 | - sizeof(ide_options[0])-21, | ||
| 7059 | - optarg); | ||
| 7060 | - num_ide_disks++; | ||
| 7061 | - } | ||
| 7062 | -#else | ||
| 7063 | - /* Assume boot cdrom is SCSI */ | ||
| 7064 | - { | ||
| 7065 | - char buf[27]; | ||
| 7066 | - if (num_scsi_disks >= MAX_SCSI_DISKS) { | ||
| 7067 | - fprintf(stderr, "qemu: too many SCSI disks/cdroms defined.\n"); | ||
| 7068 | - exit(1); | ||
| 7069 | - } | ||
| 7070 | - snprintf(buf, sizeof(buf), "type=cdrom,sdx=%c,id=%d,img=", | ||
| 7071 | - num_scsi_disks + 'a', num_scsi_disks + 2); | ||
| 7072 | - /* Build new disk SCSI syntax string */ | ||
| 7073 | - pstrcpy(scsi_options[num_scsi_disks], | ||
| 7074 | - 27, | ||
| 7075 | - buf); | ||
| 7076 | - /* Add on image filename */ | ||
| 7077 | - pstrcpy(&(scsi_options[num_scsi_disks][26]), | ||
| 7078 | - sizeof(scsi_options[0])-26, | ||
| 7079 | - optarg); | ||
| 7080 | - num_scsi_disks++; | 6773 | + if (cdrom_index >= 0) { |
| 6774 | + hd_filename[cdrom_index] = optarg; | ||
| 7081 | } | 6775 | } |
| 7082 | -#endif | ||
| 7083 | break; | 6776 | break; |
| 7084 | case QEMU_OPTION_boot: | 6777 | case QEMU_OPTION_boot: |
| 7085 | boot_device = optarg[0]; | 6778 | boot_device = optarg[0]; |
| @@ -7376,11 +7069,19 @@ int main(int argc, char **argv) | @@ -7376,11 +7069,19 @@ int main(int argc, char **argv) | ||
| 7376 | linux_boot = (kernel_filename != NULL); | 7069 | linux_boot = (kernel_filename != NULL); |
| 7377 | 7070 | ||
| 7378 | if (!linux_boot && | 7071 | if (!linux_boot && |
| 7379 | - num_ide_disks == 0 && | ||
| 7380 | - num_scsi_disks == 0 && | 7072 | + hd_filename[0] == '\0' && |
| 7073 | + (cdrom_index >= 0 && hd_filename[cdrom_index] == '\0') && | ||
| 7381 | fd_filename[0] == '\0') | 7074 | fd_filename[0] == '\0') |
| 7382 | help(); | 7075 | help(); |
| 7383 | 7076 | ||
| 7077 | + /* boot to floppy or the default cd if no hard disk defined yet */ | ||
| 7078 | + if (hd_filename[0] == '\0' && boot_device == 'c') { | ||
| 7079 | + if (fd_filename[0] != '\0') | ||
| 7080 | + boot_device = 'a'; | ||
| 7081 | + else | ||
| 7082 | + boot_device = 'd'; | ||
| 7083 | + } | ||
| 7084 | + | ||
| 7384 | setvbuf(stdout, NULL, _IOLBF, 0); | 7085 | setvbuf(stdout, NULL, _IOLBF, 0); |
| 7385 | 7086 | ||
| 7386 | init_timers(); | 7087 | init_timers(); |
| @@ -7446,22 +7147,31 @@ int main(int argc, char **argv) | @@ -7446,22 +7147,31 @@ int main(int argc, char **argv) | ||
| 7446 | exit(1); | 7147 | exit(1); |
| 7447 | } | 7148 | } |
| 7448 | 7149 | ||
| 7150 | + /* we always create the cdrom drive, even if no disk is there */ | ||
| 7449 | bdrv_init(); | 7151 | bdrv_init(); |
| 7450 | - | ||
| 7451 | - /* open the virtual block devices, disks or CDRoms */ | ||
| 7452 | - if (disk_options_init(num_ide_disks,ide_options,snapshot, | ||
| 7453 | - num_scsi_disks,scsi_options, | ||
| 7454 | - cdrom_index, | ||
| 7455 | - cyls, heads, secs, translation)){ | ||
| 7456 | - exit(1); | 7152 | + if (cdrom_index >= 0) { |
| 7153 | + bs_table[cdrom_index] = bdrv_new("cdrom"); | ||
| 7154 | + bdrv_set_type_hint(bs_table[cdrom_index], BDRV_TYPE_CDROM); | ||
| 7457 | } | 7155 | } |
| 7458 | 7156 | ||
| 7459 | - /* boot to floppy or default cd if no hard disk */ | ||
| 7460 | - if (num_ide_disks == 0 && boot_device == 'c') { | ||
| 7461 | - if (fd_filename[0] != '\0') | ||
| 7462 | - boot_device = 'a'; | ||
| 7463 | - else | ||
| 7464 | - boot_device = 'd'; | 7157 | + /* open the virtual block devices */ |
| 7158 | + for(i = 0; i < MAX_DISKS; i++) { | ||
| 7159 | + if (hd_filename[i]) { | ||
| 7160 | + if (!bs_table[i]) { | ||
| 7161 | + char buf[64]; | ||
| 7162 | + snprintf(buf, sizeof(buf), "hd%c", i + 'a'); | ||
| 7163 | + bs_table[i] = bdrv_new(buf); | ||
| 7164 | + } | ||
| 7165 | + if (bdrv_open(bs_table[i], hd_filename[i], snapshot ? BDRV_O_SNAPSHOT : 0) < 0) { | ||
| 7166 | + fprintf(stderr, "qemu: could not open hard disk image '%s'\n", | ||
| 7167 | + hd_filename[i]); | ||
| 7168 | + exit(1); | ||
| 7169 | + } | ||
| 7170 | + if (i == 0 && cyls != 0) { | ||
| 7171 | + bdrv_set_geometry_hint(bs_table[i], cyls, heads, secs); | ||
| 7172 | + bdrv_set_translation_hint(bs_table[i], translation); | ||
| 7173 | + } | ||
| 7174 | + } | ||
| 7465 | } | 7175 | } |
| 7466 | 7176 | ||
| 7467 | /* we always create at least one floppy disk */ | 7177 | /* we always create at least one floppy disk */ |
vl.h
| @@ -1252,31 +1252,9 @@ int scsi_write_data(SCSIDevice *s, uint32_t tag); | @@ -1252,31 +1252,9 @@ int scsi_write_data(SCSIDevice *s, uint32_t tag); | ||
| 1252 | void scsi_cancel_io(SCSIDevice *s, uint32_t tag); | 1252 | void scsi_cancel_io(SCSIDevice *s, uint32_t tag); |
| 1253 | uint8_t *scsi_get_buf(SCSIDevice *s, uint32_t tag); | 1253 | uint8_t *scsi_get_buf(SCSIDevice *s, uint32_t tag); |
| 1254 | 1254 | ||
| 1255 | -enum scsi_host_adapters { | ||
| 1256 | - SCSI_LSI_53C895A, | ||
| 1257 | - SCSI_ESP | ||
| 1258 | -}; | ||
| 1259 | -enum scsi_devices { | ||
| 1260 | - SCSI_CDROM, | ||
| 1261 | - SCSI_DISK, | ||
| 1262 | - SCSI_NONE | ||
| 1263 | -}; | ||
| 1264 | -typedef enum scsi_host_adapters scsi_host_adapters; | ||
| 1265 | -typedef enum scsi_devices scsi_devices; | ||
| 1266 | -typedef struct SCSIDiskInfo { | ||
| 1267 | - scsi_host_adapters adapter; | ||
| 1268 | - int id; | ||
| 1269 | - scsi_devices device_type; | ||
| 1270 | -} SCSIDiskInfo; | ||
| 1271 | - | ||
| 1272 | -#define MAX_SCSI_DISKS 7 | ||
| 1273 | -extern BlockDriverState *bs_scsi_table[MAX_SCSI_DISKS]; | ||
| 1274 | -extern SCSIDiskInfo scsi_disks_info[MAX_SCSI_DISKS]; | ||
| 1275 | - | ||
| 1276 | /* lsi53c895a.c */ | 1255 | /* lsi53c895a.c */ |
| 1277 | void lsi_scsi_attach(void *opaque, BlockDriverState *bd, int id); | 1256 | void lsi_scsi_attach(void *opaque, BlockDriverState *bd, int id); |
| 1278 | void *lsi_scsi_init(PCIBus *bus, int devfn); | 1257 | void *lsi_scsi_init(PCIBus *bus, int devfn); |
| 1279 | -extern int scsi_hba_lsi; // Count of scsi disks/cdrom using this lsi adapter | ||
| 1280 | 1258 | ||
| 1281 | /* integratorcp.c */ | 1259 | /* integratorcp.c */ |
| 1282 | extern QEMUMachine integratorcp926_machine; | 1260 | extern QEMUMachine integratorcp926_machine; |