summaryrefslogtreecommitdiff
path: root/hw/sun4m.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-12-02 04:51:10 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-12-02 04:51:10 +0000
commite4bcb14c79fb63a35aef3eb39e02c16c19b8b28d (patch)
tree06bee4b9dbf4c7b50e20c9996924d7d132cdfec2 /hw/sun4m.c
parent7233b355571ad2a8e7aec7eb19db5f530e81f052 (diff)
downloadqemu-e4bcb14c79fb63a35aef3eb39e02c16c19b8b28d.tar.gz
qemu-e4bcb14c79fb63a35aef3eb39e02c16c19b8b28d.tar.bz2
qemu-e4bcb14c79fb63a35aef3eb39e02c16c19b8b28d.zip
Add -drive parameter, by Laurent Vivier.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@3759 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/sun4m.c')
-rw-r--r--hw/sun4m.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/hw/sun4m.c b/hw/sun4m.c
index 1f78ff8935..428519a5a5 100644
--- a/hw/sun4m.c
+++ b/hw/sun4m.c
@@ -338,6 +338,8 @@ static void sun4m_hw_init(const struct hwdef *hwdef, int RAM_size,
unsigned long prom_offset, kernel_size;
int ret;
char buf[1024];
+ BlockDriverState *fd[MAX_FD];
+ int index;
/* init CPUs */
if (!cpu_model)
@@ -440,16 +442,29 @@ static void sun4m_hw_init(const struct hwdef *hwdef, int RAM_size,
slavio_serial_init(hwdef->serial_base, slavio_irq[hwdef->ser_irq],
serial_hds[1], serial_hds[0]);
- if (hwdef->fd_base != (target_phys_addr_t)-1)
- sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd_table);
+ if (hwdef->fd_base != (target_phys_addr_t)-1) {
+ /* there is zero or one floppy drive */
+ fd[1] = fd[0] = NULL;
+ index = drive_get_index(IF_FLOPPY, 0, 0);
+ if (index != -1)
+ fd[0] = drives_table[index].bdrv;
- main_esp = esp_init(bs_table, hwdef->esp_base, espdma, *espdma_irq,
+ sun4m_fdctrl_init(slavio_irq[hwdef->fd_irq], hwdef->fd_base, fd);
+ }
+
+ if (drive_get_max_bus(IF_SCSI) > 0) {
+ fprintf(stderr, "qemu: too many SCSI bus\n");
+ exit(1);
+ }
+
+ main_esp = esp_init(hwdef->esp_base, espdma, *espdma_irq,
esp_reset);
- for (i = 0; i < MAX_DISKS; i++) {
- if (bs_table[i]) {
- esp_scsi_attach(main_esp, bs_table[i], i);
- }
+ for (i = 0; i < ESP_MAX_DEVS; i++) {
+ index = drive_get_index(IF_SCSI, 0, i);
+ if (index == -1)
+ continue;
+ esp_scsi_attach(main_esp, drives_table[index].bdrv, i);
}
slavio_misc = slavio_misc_init(hwdef->slavio_base, hwdef->power_base,