Revision 1f56e32a hw/ide/core.c

b/hw/ide/core.c
1592 1592
    bus->dma->ops->reset(bus->dma);
1593 1593
}
1594 1594

  
1595
int ide_init_drive(IDEState *s, BlockDriverState *bs,
1595
int ide_init_drive(IDEState *s, BlockDriverState *bs, IDEDriveKind kind,
1596 1596
                   const char *version, const char *serial)
1597 1597
{
1598 1598
    int cylinders, heads, secs;
1599 1599
    uint64_t nb_sectors;
1600 1600

  
1601 1601
    s->bs = bs;
1602
    s->drive_kind = kind;
1603

  
1602 1604
    bdrv_get_geometry(bs, &nb_sectors);
1603 1605
    bdrv_guess_geometry(bs, &cylinders, &heads, &secs);
1604 1606
    if (cylinders < 1 || cylinders > 16383) {
......
1623 1625
    s->smart_autosave = 1;
1624 1626
    s->smart_errors = 0;
1625 1627
    s->smart_selftest_count = 0;
1626
    if (bdrv_get_type_hint(bs) == BDRV_TYPE_CDROM) {
1627
        s->drive_kind = IDE_CD;
1628
    if (kind == IDE_CD) {
1628 1629
        bdrv_set_change_cb(bs, cdrom_change_cb, s);
1629 1630
        bs->buffer_alignment = 2048;
1630 1631
    } else {
......
1729 1730
        dinfo = i == 0 ? hd0 : hd1;
1730 1731
        ide_init1(bus, i);
1731 1732
        if (dinfo) {
1732
            if (ide_init_drive(&bus->ifs[i], dinfo->bdrv, NULL,
1733
            if (ide_init_drive(&bus->ifs[i], dinfo->bdrv,
1734
                               bdrv_get_type_hint(dinfo->bdrv) == BDRV_TYPE_CDROM ? IDE_CD : IDE_HD,
1735
                               NULL,
1733 1736
                               *dinfo->serial ? dinfo->serial : NULL) < 0) {
1734 1737
                error_report("Can't set up IDE drive %s", dinfo->id);
1735 1738
                exit(1);

Also available in: Unified diff