"wolfgang kern" <
now...@never.at> wrote in message
news:l92fia$8r1$1...@newsreader2.utanet.at...
>
> James Harris wrote:
> [about IRQ from HD(s)]
>
> Yeah,
> there once were a standard for
> master/slave IDE_0 use IRQ_0E and
> master/slave IDE_1 use IRQ_0F. (or opposite ? either way...)
>
> But now when I look at my old present PC then I find already
> connected five HDs plus one DVD which all can be programmed
> and be used in native SATA (IDE-mode) regardless is they show
> advanced featurs like NativeJobCollections ...
I remember one PC which had quite a high number of devices on each of the
sharable interrupts - at least the BIOS set it up that way when it was set
for a non-PnP OS. There are many permutations but it is possible that an OS
may have to run on a machine which has many devices sharing a disk
interrupt - disks and other things.
...
> I just ignore them by INT_ACK+IRET.
You mean you ignore those interrupts and so ignore the devices? Or do you
poll those devices separately outside the interrupt mechanism?
> Of course we can define each device an IRQ-line within the APIC
> (apart from legacy or PCI-told numbering), but why would someone
> want an HW-interrupt for timing things we know in advance anyway?
Once we get to APIC handling and, even worse, PCI interrupt routing things
can become a lot more complex. At the moment I am just thinking of how to
handle the earliest machines which predate PCI and use only the ATA system.
The idea is that that should work on any AT or later compatible.
Current thought:
1. For PIO (which seems to be the only option on machines which predate PCI)
check the status register's DRQ bit. This bit apparently indicates that the
current drive wants to read or write via its data port. Timing could be an
issue in that something else may have triggered the interrupt but by the
time the ISR starts running the disk has also asserted its INTRQ state.
However, even if that happened I think it would still be OK to service the
drive and clear its interrupt state just as if the drive had been the first
to trigger the interrupt condition. The originally-asserting device could
also be serviced before returning to the interrupted task.
2. For DMA disk access, AIUI, PCI has to be present to provide the DMA
facilities needed so in this case the driver code would be sure to have PCI
available and so could work with its indicators (as Marven Lee mentioned) to
recognise that disk activity was the cause of an interrupt.
Bottom line is that the most basic and most universal approach seems to be
to read and write using PIO, to handle one request to a disk controller at a
time, and to examine the DRQ bit to find out whether a drive needs service.
Does that sound about right?
I don't like the idea of carrying out a 256-word PIO transfer in an ISR (and
that's just for one sector) but it seems to be unavoidable. Leaving the
sector to be transferred after the interrupt has been acknowledged and the
ISR has returned might be possible but seems dangerous. On the other hand,
not acknowledging the interrupt in the ISR (and relying on the fact that AT
IRQs are edge triggered) seems that it would be unreliable.
So I am left with carrying out the 256-word transfer in the ISR. Best I can
think of in order to avoid impacting the response time of other interrupts
is to make the normal disk interrupts (14 and 15) the lowest priority. Then
at least devices on other IRQs will be able to interrupt the PIO transfers
... I think.
AIUI this should be possible as long as higher priority devices can
interrupt the CPU. For that, ISTM that I would have to avoid sending EOI to
the PICs and yet would have to reenable CPU interrupts. So the service
routine would have the following outline.
service routine:
;save registers etc
...
sti ;enable CPU interrupts while we handle this ISR
...
;If needed carry out PIO transfer
...
;End of service routine
cli
mov al, 0x20
out 0x00a0, al
out 0x0020, al
... ;restore registers
iret
The idea is that the CPUs interrupts will be enabled and that the PICs will
allow higher priority interrupts for most of the ISR. The CPU's interrupts
will be disabled only where needed. Disabling them just prior to sending the
EOIs is so that at that point we can be sure the ISR will continue to
completion.
Incidentally, normal interrupt prioritisation would not make it possible to
have IRQs 14 and 15 as lowest priority. The normal sequence is, from memory,
highest to lowest,
0 1 8 9 10 11 12 13 14 15 3 4 5 6 7
However, I prefer starting the interrupt priorities with IRQ 3 so that the
low speed devices especially serial ports get handled first. They may be the
most sensitive to interrupt latency so should have highest priority. With
the above thoughts on IRQs 14 and 15 that would make my preferred sequence,
highest to lowest,
3 4 5 6 7 0 1 8 9 10 11 12 13 14 15
It has been quiet in aod recently hasn't it!
James