Skip to content

Bug in ATA/IDE Driver with multiple harddrives #136

@erkraft

Description

@erkraft

There is an bug in the ATA/IDE Driver in combination with multiple harddrives: It seems that for new drives no PIO operation is possible (because no IRQ is fired). The problem is that each IDE channel (in our case (standard QEMU configuration) we have an primary and secondary IDE channel) supports 2 drives. But the crucial point is that each IDE channel has one IRQ (so for disk 0 and disk 1 in both cases IRQ 14 is fired , the same applies to disk 2 and disk 3 in which case IRQ 15 is fired). In the current Implementation every new device is handled like it would get an whole IDE channel for its own. The interrupts for the 3rd and 4th drive in SWEB (IRQ11 and IRQ9) would in reality be fired by the 3rd and 4th IDE channel which we simple doesn't have.

To partially fix this the ata_irqs array in IDEDriver would have to be changed to

uint8 ata_irqs[4] =
 {
 14, 14, 15, 15
 };

Now at least it's possible to use 1 drive on each channel (but it breaks the system if 2 drives on one channel are used), but that doesn't fix the whole problem because we create for each device an own ATADriver Object, instead for each ide channel (and therefore for 2 drives) a driver should be created, therefore the ATADriver class has to be changed because in there also the drive and sector numbers of the drive are stored (now 2 drives should be supported for each ATADriver).

I also thought there could be a problem now with distinguishing which drive is meant when an IRQ is fired, but apparently according to the standard at least until ATA3 all operation have to be serialized anyway. But that could become a problem with the currently deployed time out check when we wait for the busy flag to be cleared.......

References
ATA Principles
ATA Standard

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions