PS2 mouse and keyboard separation (Paul Brook)
[qemu] / hw / ide.c
index 93e0192..28ed5ab 100644 (file)
--- a/hw/ide.c
+++ b/hw/ide.c
@@ -1118,10 +1118,16 @@ static int cdrom_read_toc_raw(IDEState *s, uint8_t *buf, int msf,
     *q++ = 0; /* min */
     *q++ = 0; /* sec */
     *q++ = 0; /* frame */
-    *q++ = 0; 
-    *q++ = 0; 
-    *q++ = 0; 
-    *q++ = 0; 
+    if (msf) {
+        *q++ = 0; 
+        lba_to_msf(q, 0);
+        q += 3;
+    } else {
+        *q++ = 0; 
+        *q++ = 0; 
+        *q++ = 0; 
+        *q++ = 0; 
+    }
 
     len = q - buf;
     cpu_to_ube16(buf, len - 2);
@@ -1488,11 +1494,6 @@ static void ide_ioport_write(void *opaque, uint32_t addr, uint32_t val)
         unit = (val >> 4) & 1;
         s = ide_if + unit;
         ide_if->cur_drive = s;
-#ifdef TARGET_PPC
-        /* XXX: currently a workaround for Darwin/PPC. Need to check
-           the IDE spec to see if it is correct */
-        ide_set_signature(s);
-#endif
         break;
     default:
     case 7:
@@ -2008,7 +2009,7 @@ void isa_ide_init(int iobase, int iobase2, int irq,
     if (!ide_state)
         return;
     
-    ide_init2(ide_state, hd0, hd1, pic_set_irq_new, NULL, irq);
+    ide_init2(ide_state, hd0, hd1, pic_set_irq_new, isa_pic, irq);
     ide_init_ioport(ide_state, iobase, iobase2);
 }
 
@@ -2329,6 +2330,7 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table)
     pci_conf[0x01] = 0x80;
     pci_conf[0x02] = 0x10;
     pci_conf[0x03] = 0x70;
+    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
@@ -2337,9 +2339,9 @@ void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table)
                            PCI_ADDRESS_SPACE_IO, bmdma_map);
 
     ide_init2(&d->ide_if[0], hd_table[0], hd_table[1],
-              pic_set_irq_new, NULL, 14);
+              pic_set_irq_new, isa_pic, 14);
     ide_init2(&d->ide_if[2], hd_table[2], hd_table[3],
-              pic_set_irq_new, NULL, 15);
+              pic_set_irq_new, isa_pic, 15);
     ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6);
     ide_init_ioport(&d->ide_if[2], 0x170, 0x376);
 }