Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in ATA/IDE Driver with multiple harddrives #136

Open
erkraft opened this issue Dec 12, 2017 · 0 comments
Open

Bug in ATA/IDE Driver with multiple harddrives #136

erkraft opened this issue Dec 12, 2017 · 0 comments

Comments

@erkraft
Copy link

erkraft commented Dec 12, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant