summaryrefslogtreecommitdiffstats
path: root/hw/ide.c
diff options
context:
space:
mode:
authorths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-06 16:26:14 +0000
committerths <ths@c046a42c-6fe2-441c-8c8c-71466251a162>2007-06-06 16:26:14 +0000
commitafcc3cdfc4f6291ae6cb803339c794029bf6c99a (patch)
treef1ad98fd3d24e8c53421dfc7dd7bee7d9a854fa1 /hw/ide.c
parentb6dc7ebbeaa46d54414de6e5ee86fd4a173ff273 (diff)
downloadhqemu-afcc3cdfc4f6291ae6cb803339c794029bf6c99a.zip
hqemu-afcc3cdfc4f6291ae6cb803339c794029bf6c99a.tar.gz
Use the correct PCI IDs for Malta.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2945 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'hw/ide.c')
-rw-r--r--hw/ide.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/hw/ide.c b/hw/ide.c
index 03875ce..c4fabe6 100644
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -376,6 +376,7 @@ typedef struct IDEState {
#define IDE_TYPE_PIIX3 0
#define IDE_TYPE_CMD646 1
+#define IDE_TYPE_PIIX4 2
/* CMD646 specific */
#define MRDMODE 0x71
@@ -2875,6 +2876,44 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
register_savevm("ide", 0, 1, pci_ide_save, pci_ide_load, d);
}
+/* hd_table must contain 4 block drivers */
+/* NOTE: for the PIIX4, the IRQs and IOports are hardcoded */
+void pci_piix4_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn,
+ qemu_irq *pic)
+{
+ PCIIDEState *d;
+ uint8_t *pci_conf;
+
+ /* register a function 1 of PIIX4 */
+ d = (PCIIDEState *)pci_register_device(bus, "PIIX4 IDE",
+ sizeof(PCIIDEState),
+ devfn,
+ NULL, NULL);
+ d->type = IDE_TYPE_PIIX4;
+
+ pci_conf = d->dev.config;
+ pci_conf[0x00] = 0x86; // Intel
+ pci_conf[0x01] = 0x80;
+ pci_conf[0x02] = 0x11;
+ pci_conf[0x03] = 0x71;
+ pci_conf[0x09] = 0x80; // legacy ATA mode
+ pci_conf[0x0a] = 0x01; // class_sub = PCI_IDE
+ pci_conf[0x0b] = 0x01; // class_base = PCI_mass_storage
+ pci_conf[0x0e] = 0x00; // header_type
+
+ piix3_reset(d);
+
+ pci_register_io_region((PCIDevice *)d, 4, 0x10,
+ PCI_ADDRESS_SPACE_IO, bmdma_map);
+
+ ide_init2(&d->ide_if[0], hd_table[0], hd_table[1], pic[14]);
+ ide_init2(&d->ide_if[2], hd_table[2], hd_table[3], pic[15]);
+ ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6);
+ ide_init_ioport(&d->ide_if[2], 0x170, 0x376);
+
+ register_savevm("ide", 0, 1, pci_ide_save, pci_ide_load, d);
+}
+
/***********************************************************/
/* MacIO based PowerPC IDE */
OpenPOWER on IntegriCloud