Revision 544c4be6

b/hw/ide.c
2590 2590
    pci_conf[0x20] = 0x01; /* BMIBA: 20-23h */
2591 2591
}
2592 2592

  
2593
void pci_piix_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn)
2594
{
2595
    PCIIDEState *d;
2596
    uint8_t *pci_conf;
2597
    
2598
    /* register a function 1 of PIIX */
2599
    d = (PCIIDEState *)pci_register_device(bus, "PIIX IDE", 
2600
                                           sizeof(PCIIDEState),
2601
                                           devfn,
2602
                                           NULL, NULL);
2603
    d->type = IDE_TYPE_PIIX3;
2604

  
2605
    pci_conf = d->dev.config;
2606
    pci_conf[0x00] = 0x86; // Intel
2607
    pci_conf[0x01] = 0x80;
2608
    pci_conf[0x02] = 0x30;
2609
    pci_conf[0x03] = 0x12;
2610
    pci_conf[0x08] = 0x02; // Step A1
2611
    pci_conf[0x09] = 0x80; // legacy ATA mode
2612
    pci_conf[0x0a] = 0x01; // class_sub = PCI_IDE
2613
    pci_conf[0x0b] = 0x01; // class_base = PCI_mass_storage
2614
    pci_conf[0x0e] = 0x00; // header_type
2615

  
2616
    piix3_reset(d);
2617

  
2618
    pci_register_io_region((PCIDevice *)d, 4, 0x10, 
2619
                           PCI_ADDRESS_SPACE_IO, bmdma_map);
2620

  
2621
    ide_init2(&d->ide_if[0], hd_table[0], hd_table[1],
2622
              pic_set_irq_new, isa_pic, 14);
2623
    ide_init2(&d->ide_if[2], hd_table[2], hd_table[3],
2624
              pic_set_irq_new, isa_pic, 15);
2625
    ide_init_ioport(&d->ide_if[0], 0x1f0, 0x3f6);
2626
    ide_init_ioport(&d->ide_if[2], 0x170, 0x376);
2627

  
2628
    register_savevm("ide", 0, 1, pci_ide_save, pci_ide_load, d);
2629
}
2630

  
2631 2593
/* hd_table must contain 4 block drivers */
2632 2594
/* NOTE: for the PIIX3, the IRQs and IOports are hardcoded */
2633 2595
void pci_piix3_ide_init(PCIBus *bus, BlockDriverState **hd_table, int devfn)

Also available in: Unified diff