diff options
author | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-12-02 04:51:10 +0000 |
---|---|---|
committer | ths <ths@c046a42c-6fe2-441c-8c8c-71466251a162> | 2007-12-02 04:51:10 +0000 |
commit | e4bcb14c79fb63a35aef3eb39e02c16c19b8b28d (patch) | |
tree | 06bee4b9dbf4c7b50e20c9996924d7d132cdfec2 /hw/mips_malta.c | |
parent | 7233b355571ad2a8e7aec7eb19db5f530e81f052 (diff) |
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/mips_malta.c')
-rw-r--r-- | hw/mips_malta.c | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/hw/mips_malta.c b/hw/mips_malta.c index ac6800f65f..6af5e52dc4 100644 --- a/hw/mips_malta.c +++ b/hw/mips_malta.c @@ -53,6 +53,8 @@ #define ENVP_NB_ENTRIES 16 #define ENVP_ENTRY_SIZE 256 +#define MAX_IDE_BUS 2 + extern FILE *logfile; typedef struct { @@ -776,6 +778,9 @@ void mips_malta_init (int ram_size, int vga_ram_size, uint8_t *eeprom_buf; i2c_bus *smbus; int i; + int index; + BlockDriverState *hd[MAX_IDE_BUS * MAX_IDE_DEVS]; + BlockDriverState *fd[MAX_FD]; /* init CPUs */ if (cpu_model == NULL) { @@ -862,8 +867,22 @@ void mips_malta_init (int ram_size, int vga_ram_size, pci_bus = pci_gt64120_init(i8259); /* Southbridge */ + + if (drive_get_max_bus(IF_IDE) >= MAX_IDE_BUS) { + fprintf(stderr, "qemu: too many IDE bus\n"); + exit(1); + } + + for(i = 0; i < MAX_IDE_BUS * MAX_IDE_DEVS; i++) { + index = drive_get_index(IF_IDE, i / MAX_IDE_DEVS, i % MAX_IDE_DEVS); + if (index != -1) + hd[i] = drives_table[index].bdrv; + else + hd[i] = NULL; + } + piix4_devfn = piix4_init(pci_bus, 80); - pci_piix4_ide_init(pci_bus, bs_table, piix4_devfn + 1, i8259); + pci_piix4_ide_init(pci_bus, hd, piix4_devfn + 1, i8259); usb_uhci_piix4_init(pci_bus, piix4_devfn + 2); smbus = piix4_pm_init(pci_bus, piix4_devfn + 3, 0x1100); eeprom_buf = qemu_mallocz(8 * 256); /* XXX: make this persistent */ @@ -883,7 +902,14 @@ void mips_malta_init (int ram_size, int vga_ram_size, serial_init(0x2f8, i8259[3], serial_hds[1]); if (parallel_hds[0]) parallel_init(0x378, i8259[7], parallel_hds[0]); - floppy_controller = fdctrl_init(i8259[6], 2, 0, 0x3f0, fd_table); + for(i = 0; i < MAX_FD; i++) { + index = drive_get_index(IF_FLOPPY, 0, i); + if (index != -1) + fd[i] = drives_table[index].bdrv; + else + fd[i] = NULL; + } + floppy_controller = fdctrl_init(i8259[6], 2, 0, 0x3f0, fd); /* Sound card */ #ifdef HAS_AUDIO |