Discussion:
how to disable a pci device irq?
(too old to reply)
octavio
2008-04-28 12:22:26 UTC
Permalink
My problem is exposed here:
http://www.osdev.org/phpBB2/viewtopic.php?t=16897
in resume, there are 2 devices that use the same irq but there is no
driver for the second,so i need to prevent this device from generating
irqs for ever.
Is there a generic way to disable a pci device irq?
Rod Pemberton
2008-04-29 02:26:42 UTC
Permalink
Post by octavio
http://www.osdev.org/phpBB2/viewtopic.php?t=16897
in resume, there are 2 devices that use the same irq but there is no
driver for the second,so i need to prevent this device from generating
irqs for ever.
Do you have some method to detect when the first device generates the irq?

when_in_irq6
if first_device generated irq6
do irq6 routine for first device
else
do generic irq6 for everthing else (e.g., clear EOI)
Post by octavio
Is there a generic way to disable a pci device irq?
?
Post by octavio
http://www.osdev.org/phpBB2/viewtopic.php?t=16897
Personally, I'm suspicious of some of the answers there, but I can't
confirm that they're invalid at this point in time.
Post by octavio
on OSDev: "Hello My OS freezes when i enable irq6" ... "pci sound card"
... "pluged[sic] in a given pci slot"

If you put a different type of PCI card into that slot, do you still see
the irq problem?

Can you change the slot or change the irq with your BIOS or on with a
jumper on the card? Switching slot's, changing irq's on the card or in the
BIOS was common prior to "Plug-N-Play" to solve irq conflicts.
Post by octavio
on OSDev: " don´t have a driver for this sound card "
Why do you have a sound card installed for an OS that doesn't (yet)
support it?
Post by octavio
on OSDev: "Yes i ack the master pic but the computer freezes."
Could you post your code for the ack? Maybe there's a bug somewhere
around there that someone will notice...


Rod Pemberton
Maxim S. Shatskih
2008-04-29 03:02:28 UTC
Permalink
Proper PCI device should never generate IRQs till the driver will init it.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
***@storagecraft.com
http://www.storagecraft.com
Post by Rod Pemberton
Post by octavio
http://www.osdev.org/phpBB2/viewtopic.php?t=16897
in resume, there are 2 devices that use the same irq but there is no
driver for the second,so i need to prevent this device from generating
irqs for ever.
Do you have some method to detect when the first device generates the irq?
when_in_irq6
if first_device generated irq6
do irq6 routine for first device
else
do generic irq6 for everthing else (e.g., clear EOI)
Post by octavio
Is there a generic way to disable a pci device irq?
?
Post by octavio
http://www.osdev.org/phpBB2/viewtopic.php?t=16897
Personally, I'm suspicious of some of the answers there, but I can't
confirm that they're invalid at this point in time.
Post by octavio
on OSDev: "Hello My OS freezes when i enable irq6" ... "pci sound card"
... "pluged[sic] in a given pci slot"
If you put a different type of PCI card into that slot, do you still see
the irq problem?
Can you change the slot or change the irq with your BIOS or on with a
jumper on the card? Switching slot's, changing irq's on the card or in the
BIOS was common prior to "Plug-N-Play" to solve irq conflicts.
Post by octavio
on OSDev: " don´t have a driver for this sound card "
Why do you have a sound card installed for an OS that doesn't (yet)
support it?
Post by octavio
on OSDev: "Yes i ack the master pic but the computer freezes."
Could you post your code for the ack? Maybe there's a bug somewhere
around there that someone will notice...
Rod Pemberton
Brendan
2008-04-29 04:58:15 UTC
Permalink
Hi,
Post by Rod Pemberton
Post by octavio
http://www.osdev.org/phpBB2/viewtopic.php?t=16897
in resume, there are 2 devices that use the same irq but there is no
driver for the second,so i need to prevent this device from generating
irqs for ever.
Do you have some method to detect when the first device generates the irq?
when_in_irq6
if first_device generated irq6
do irq6 routine for first device
else
do generic irq6 for everthing else (e.g., clear EOI)
This would cause a flood of IRQs because PCI IRQs are level triggered
- as soon as the PIC receives the EOI it'll send another IRQ6 to the
CPU because the device's IRQ line will still be active.
Post by Rod Pemberton
Post by octavio
Is there a generic way to disable a pci device irq?
Note: From memory (I'll have a look later when I have time) there is a
generic way to disable the entire PCI device (write zero to the Device
Control Register in PCI configuration space), however the
documentation doesn't explicitly state that any of the bits in the
Device Control Register effect IRQs (only memory, IO space and special
cycles are explicitly mentioned IIRC). Also AFAIK, "completely
disabled" is the default state for PCI devices (except for things the
BIOS uses, like the first video card and perhaps the IDE/SATA/ATAPI or
SCSI controller).
Post by Rod Pemberton
Post by octavio
http://www.osdev.org/phpBB2/viewtopic.php?t=16897
Personally, I'm suspicious of some of the answers there, but I can't
confirm that they're invalid at this point in time.
Maxim is (mostly) correct: "Proper PCI device should never generate
IRQs till the driver will init it. ".

I'm wondering if the IRQ comes from the floppy drive controller (which
is usually IRQ 6) or the PCI device that does have a device driver.


Cheers,

Brendan
Rod Pemberton
2008-04-29 07:56:58 UTC
Permalink
Post by Brendan
Post by Rod Pemberton
Post by octavio
http://www.osdev.org/phpBB2/viewtopic.php?t=16897
in resume, there are 2 devices that use the same irq but there is no
driver for the second,so i need to prevent this device from generating
irqs for ever.
Do you have some method to detect when the first device generates the irq?
when_in_irq6
if first_device generated irq6
do irq6 routine for first device
else
do generic irq6 for everthing else (e.g., clear EOI)
This would cause a flood of IRQs because PCI IRQs are level triggered
- as soon as the PIC receives the EOI it'll send another IRQ6 to the
CPU because the device's IRQ line will still be active.
Interesting...

You seem to be saying that the clearing the EOI via a PIC won't clear the
IRQ for a PCI device. Yes?

If so, how do you clear the IRQ for a PCI device? APIC? (No, can't be that
since not all cpu's and MB's support it...)

FYI, the reason I said I find it "Interesting..." is that nearly every
device on the highly integrated motherboard I'm developing my OS on is PCI
and I haven't done squat for PCI. So, far my PIC's, IRQ's, etc. all work...
Do I have PCI trouble looming ahead?

Also, I think both you and OSDev posters are misusing the term "level
triggered"...
"level triggered" - high and low logic ("levels") are detected and an
action will be taken ("triggered") if the correct level is detected (usually
high)
"edge triggered" - low to high or high to low logic transitions ("edges")
are detected and an action will be taken ("triggered") if the correct
transition is detected (usually low to high)

(E.g., levels are the two horizontals on a squarewave and edges are the two
verticals on a squarewave.)
Post by Brendan
I'm wondering if the IRQ comes from the floppy drive controller (which
is usually IRQ 6) or the PCI device that does have a device driver.
I'm wondering if he has a bug (especially since he hasn't posted any
code...), or higher priority interrupt not being serviced properly (i.e.,
enabled timer or mouse IRQ but has no EOI code?).


Rod Pemberton
Brendan
2008-04-29 10:36:03 UTC
Permalink
Hi,
Post by Rod Pemberton
Post by Brendan
This would cause a flood of IRQs because PCI IRQs are level triggered
- as soon as the PIC receives the EOI it'll send another IRQ6 to the
CPU because the device's IRQ line will still be active.
Interesting...
You seem to be saying that the clearing the EOI via a PIC won't clear the
IRQ for a PCI device. Yes?
Yes.


Note: For the following, I can't remember if level triggered (for PCI)
is active low or active high, or if "edge triggered" (for ISA) is
detected on a rising edge or on a falling edge. There's a 50% chance
I've got the polarities around the wrong way in each case, but this
shouldn't effect the point I'm trying to make and I just got home from
work (I'm too lazy to look it up at the moment)...
Post by Rod Pemberton
If so, how do you clear the IRQ for a PCI device? APIC? (No, can't be that
since not all cpu's and MB's support it...)
The same as you do for ISA devices - clear the condition that is
causing the interrupt. For some simple examples, for a "byte received"
IRQ from the serial port you must read the byte from the serial port,
for a "byte received" IRQ from the PS/2 controller you must read the
byte from the PS/2 controller, for a RTC/CMOS periodic IRQ you need to
read the status register, etc. Almost all devices are like this
(except for the PIT, which is too simple to care).

One reason you may not have noticed is that ISA devices are edge
triggered. When the device wants to generate an IRQ it's "IRQ output"
line changes (e.g. from low to high) and the PIC notices the change in
state. Now, if you send an EOI to the PIC while the device's "IRQ
output" line is still in the "high" state, then there is no edge for
the PIC to notice, and there is no IRQ flood. The other reason you may
not have noticed is that ISA devices (usually) don't share IRQ lines,
and usually the thing you need to do to clear a device's IRQ output is
something you need to do anyway (e.g. for a keyboard device driver to
work you know you need to get a received byte, so you write code to
get the received byte without caring if this action is necessary to
clear the IRQ condition or not).

The problem with edge triggered IRQ's is that you can't tell if 2 or
more devices (that are sharing the same IRQ line) generate IRQs at the
same time. To get around this problem, if edge triggered IRQs are
shared, you need to check all devices that are sharing the IRQ line
every time the IRQ occurs. This is "crappy" for 2 reasons. First, it
can be more efficient to only check one device. For example, if a high
speed ethernet card generates lots of IRQs and shares an IRQ line with
a USB controller that isn't even being used, then it'd be more
efficient to check if the ethernet card generated the IRQ first and
only check if the USB card generated the IRQ if you know the ethernet
card didn't.

Secondly (and most importantly), it's usually impossible to check if 2
or more devices generated the same IRQ without introducing major
problems with race conditions. For example, an USB controller could
generate an IRQ, and the OS could check if the ethernet card generated
the IRQ (it didn't) and then check if the USB controller generated the
IRQ (it did), but the ethernet card could generate it's own IRQ before
the first EOI is sent. In this case the IRQ line is still in the same
state (no second rising edge for "edge triggered" to detect), no
second IRQ is sent and you miss the second IRQ (and the ethernet
driver stops working because it waits forever for it's IRQ to be
handled). For the same example, using level triggered interrupts, you
send the EOI after handling the USB controller's IRQ and the IRQ line
will still be at the "high" state (because of the ethernet card), so
the PIC sends a new IRQ to the CPU (no IRQ is lost).

Note: This is why edge triggered interrupts are not (normally) shared,
and also why it can be complicated to reliably handle serial ports
(which typically do share edge triggered IRQ lines when there's 3 or
more serial ports).

Of course the PIC doesn't know how many devices are connected to each
(level triggered) IRQ line - it just knows that the line is still
"high", so if you don't handle the device's IRQ the PIC just keeps
sending IRQs to the CPU.
Post by Rod Pemberton
FYI, the reason I said I find it "Interesting..." is that nearly every
device on the highly integrated motherboard I'm developing my OS on is PCI
and I haven't done squat for PCI. So, far my PIC's, IRQ's, etc. all work...
What sort of devices are you handling, and are they all in "ISA
compatability" mode?

Again, Maxim is (mostly) correct. PCI devices are normally in their
default "disabled/ignore everything" state and will not generate an
IRQ without being asked to generate an IRQ. This isn't always the case
though - e.g. PCI devices emulating legacy ISA devices, and PCI
devices that are/were being used by the BIOS (however, even though
these devices aren't in their default "disabled/ignore everything"
state they still usually won't generate an IRQ without being asked to
generate an IRQ).
Post by Rod Pemberton
Post by Brendan
I'm wondering if the IRQ comes from the floppy drive controller (which
is usually IRQ 6) or the PCI device that does have a device driver.
I'm wondering if he has a bug (especially since he hasn't posted any
code...), or higher priority interrupt not being serviced properly (i.e.,
enabled timer or mouse IRQ but has no EOI code?).
My Magic 8-Ball says "Reply hazy, try again"... :-)


Cheers,

Brendan
octavio
2008-04-29 13:59:40 UTC
Permalink
I have trown this sound card ,it is probably damaged ,sometimes do not
works on windows.
Post by Rod Pemberton
If you put a different type of PCI card into that slot, do you still see
the irq problem?
no
Post by Rod Pemberton
Why do you have a sound card installed for an OS that doesn't
(yet)
Post by Rod Pemberton
support it?
there are more Oses installed on this computer ,and it would be stupid
a OS that requires that the user retires some hardware to work.
Post by Rod Pemberton
Could you post your code for the ack? Maybe there's a bug somewhere
around there that someone will notice
#int_26 ;floppy irq 6
pusha
al=20h out 20h,al or b[floppy_status],1 ;here is the ack
# xor eax,eax xchg eax,[floppy_handler]
jmp int_l
#int_27 or d[ints],80h iret
#int_2b pusha ah=4 jmp >1
#int_2a pusha ah=3 jmp >1
#int_2e pusha ah=0 jmp >1
#int_2f pusha ah=1
# al=20h out 0A0h,al out 020h,al eax=ah eax=[eax*4+c_ide]
#int_l ;para procesar las irqs una detras de otra y no anidadas
;sin desactivar las otras irqs
;eax= offset of func ptr
{
cld test eax jz l2
ecx=[irq_index] cmp cl,ch jne alist
#l1 sti call [eax] cli
eax=[irq_index] cmp al,ah je l2
eax=al eax=[irq_list+eax] b[irq_index]+=4 jmp l1
#alist b[irq_index+1]+=4 ecx=ch [irq_list+ecx]=eax
#l2 popa iret
}

full sources are on my web page:
http://octavio.vega.fernandez.googlepages.com/octaos
all disk images include the sources.
Brendan
2008-04-30 03:45:54 UTC
Permalink
Hi,
Post by octavio
#int_26 ;floppy irq 6
Is the floppy controller a standard (ISA) floppy drive controller (not
some sort of rare PCI floppy controller card or PCI multi-IO card),
that uses an edge triggered IRQ; and is the sound card a standard PCI
sound card that uses a level triggered IRQ?

If this is the case, then it's likely that your BIOS settings are very
badly configured - go into your BIOS setup screen and you'll probably
see something that allows you to change PCI IRQ routing (e.g. "PCIA#,
PCIB#, PCIC#, PCID#) and change them all to "auto" or find the one
that's being routed to IRQ 6 and make sure it's routed to an IRQ that
isn't used by *any* ISA device (even if you end up with several PCI
IRQs being routed to the same PIC input).

In general, it's a very bad idea to have more than one ISA/edge
triggered device using a PIC input, and an *extremely* bad idea to
have edge triggered IRQs and level triggered IRQs sharing a PIC input
(and yes, I'd be very surprised if any version of Windows doesn't
complain about it, e.g. by showing a yellow triangle in "Device
Manager" for all devices using that IRQ and mentioning resource
conflicts in each device's description).

Note: standard ISA devices include the PIT (IRQ 0), the PS/2
controller (IRQ 1), the PIC cascade (IRQ 2), the serial ports (IRQs 3
and 4), the floppy drive controller (IRQ 6), the parallel port (IRQ
7), the RTC/CMOS (IRQ8), the legacy FPU error (IRQ 13) and the IDE/ATA/
ATAPI/SATA disk drive controllers (IRQs 14 and 15). This means that
(for a typical motherboard) PCI IRQs should only ever be routed to
IRQs 5, 9, 10, 11 and 12 (although, for IRQs 3, 4, 6, 14 and 15 it is
possible for PCI to use these IRQs if (and only if) the corresponding
device isn't present, which includes disabled onboard devices).


Cheers,

Brendan
Rod Pemberton
2008-04-30 09:14:16 UTC
Permalink
Post by Brendan
In general, it's a very bad idea to have more than one ISA/edge
triggered device using a PIC input, and an *extremely* bad idea to
have edge triggered IRQs and level triggered IRQs sharing a PIC input
(and yes, I'd be very surprised if any version of Windows doesn't
complain about it, e.g. by showing a yellow triangle in "Device
Manager" for all devices using that IRQ and mentioning resource
conflicts in each device's description).
Read the part of my other post about the devices in my system - a third of
the IRQ's have multiple devices... No problems for old Windows.
Post by Brendan
Note: standard ISA devices include the PIT (IRQ 0), the PS/2
controller (IRQ 1), the PIC cascade (IRQ 2), the serial ports (IRQs 3
and 4), the floppy drive controller (IRQ 6), the parallel port (IRQ
7), the RTC/CMOS (IRQ8), the legacy FPU error (IRQ 13) and the IDE/ATA/
ATAPI/SATA disk drive controllers (IRQs 14 and 15). This means that
(for a typical motherboard) PCI IRQs should only ever be routed to
IRQs 5, 9, 10, 11 and 12 (although, for IRQs 3, 4, 6, 14 and 15 it is
possible for PCI to use these IRQs if (and only if) the corresponding
device isn't present, which includes disabled onboard devices).
Not bad, but that need slights adjustment...
"PCI IRQs should only ever be routed to IRQs 5, 9, 10, 11 and 12" - add 15
if no 15
"although, for IRQs 3, 4, 6, 14 and 15 it is possible for PCI to use these
IRQs" - add 7 if no 7 or disabled

If I disable the parallel port, 3 devices are on IRQ 7 (including Ethernet).
If I enable it, they are reassigned to IRQ 9.

Although an older PC (haven't assembled my new one yet... :-) ), I can
disable serial, parallel, modem, ethernet, which adds/removes IRQ's. I can
specifically remove/change the IRQ for USB, video, modem. IRQ 5 and 15 are
always free. 3, 4 and 9 are free depending on which devices are enabled.


Rod Pemberton
octavio
2008-04-30 10:33:32 UTC
Permalink
Now i can't reproduce the bug,but perhaps the bios asigned irq6
because the floppy unit was not connected.
And my floppy detection routine enables irq6 ,is there a simple method
to detect the presence of floppy hardware without using irqs?
Rod Pemberton
2008-04-30 08:49:01 UTC
Permalink
Post by Brendan
Post by Rod Pemberton
If so, how do you clear the IRQ for a PCI device? APIC? (No, can't be that
since not all cpu's and MB's support it...)
The same as you do for ISA devices - clear the condition that is
causing the interrupt. For some simple examples, for a "byte received"
IRQ from the serial port you must read the byte from the serial port,
for a "byte received" IRQ from the PS/2 controller you must read the
byte from the PS/2 controller, for a RTC/CMOS periodic IRQ you need to
read the status register, etc. Almost all devices are like this
(except for the PIT, which is too simple to care).
One reason you may not have noticed is that ISA devices are edge
triggered. When the device wants to generate an IRQ it's "IRQ output"
line changes (e.g. from low to high) and the PIC notices the change in
state. Now, if you send an EOI to the PIC while the device's "IRQ
output" line is still in the "high" state, then there is no edge for
the PIC to notice,
I clear the EOI prior to "clearing the condition" in my OS. By your
reasoning, my OS shouldn't work at all...
Post by Brendan
and there is no IRQ flood.
I'm not seeing an "IRQ flood". (more below)
Post by Brendan
The other reason you may
not have noticed is that ISA devices (usually) don't share IRQ lines,
and usually the thing you need to do to clear a device's IRQ output is
something you need to do anyway (e.g. for a keyboard device driver to
work you know you need to get a received byte, so you write code to
get the received byte without caring if this action is necessary to
clear the IRQ condition or not).
Hmm, now you're trying to tell me non-PCI devices will retrigger IRQ's ("IRQ
flood") if I didn't "clear the condition" even though I cleared the EOI...
I have to check this out.

If I disable the read from the keyboard controller in my mouse routine and I
leave the clear EOI for the mouse routine and I then move the mouse,
according to you I should get infinite IRQ 12's (i.e., "IRQ flood") since I
didn't "clear the device", correct? I'm not seeing that with my OS. What I
get is a _single_ IRQ 12. Then, _all_ IRQ's are blocked - just as if the
mouse routine were missing the EOI.

You're correct if what you were trying to say is that I didn't notice that
both an EOI and some "clearing of the device" were required to release an
IRQ.
Post by Brendan
The problem with edge triggered IRQ's is that you can't tell if 2 or
more devices (that are sharing the same IRQ line) generate IRQs at the
same time. To get around this problem, if edge triggered IRQs are
shared, you need to check all devices that are sharing the IRQ line
every time the IRQ occurs. This is "crappy" for 2 reasons. First, it
can be more efficient to only check one device. For example, if a high
speed ethernet card generates lots of IRQs and shares an IRQ line with
a USB controller that isn't even being used, then it'd be more
efficient to check if the ethernet card generated the IRQ first and
only check if the USB card generated the IRQ if you know the ethernet
card didn't.
Secondly (and most importantly), it's usually impossible to check if 2
or more devices generated the same IRQ without introducing major
problems with race conditions. For example, an USB controller could
generate an IRQ, and the OS could check if the ethernet card generated
the IRQ (it didn't) and then check if the USB controller generated the
IRQ (it did), but the ethernet card could generate it's own IRQ before
the first EOI is sent. In this case the IRQ line is still in the same
state (no second rising edge for "edge triggered" to detect), no
second IRQ is sent and you miss the second IRQ (and the ethernet
driver stops working because it waits forever for it's IRQ to be
handled). For the same example, using level triggered interrupts, you
send the EOI after handling the USB controller's IRQ and the IRQ line
will still be at the "high" state (because of the ethernet card), so
the PIC sends a new IRQ to the CPU (no IRQ is lost).
Note: This is why edge triggered interrupts are not (normally) shared,
I'll have to quote you: "My Magic 8-Ball says 'Reply hazy, try again'...
:-)"

On an ISA PC, you couldn't always eliminate IRQ conflicts due to the limited
IRQ jumpers each ISA card had. So, multiple devices had to be on the same
IRQ. PnP may have helped resolved IRQ conflicts by reassigning IRQ's, but
it didn't eliminate sharing of IRQ's. If you think it does, how do you
explain that the non-ISA PnP PC this is being posted from has:

19 IRQ devices
2 IRQ's that are free
8 IRQ's with a single device
4 IRQ's with two devices
1 IRQ with three devices

As you can see, many of the IRQ's are shared. But, conflicts between "heavy
usage" devices like modems, printer port, sound card, etc. have been
eliminated. Each of them has been assigned on it's own IRQ.
Post by Brendan
and also why it can be complicated to reliably handle serial ports
(which typically do share edge triggered IRQ lines when there's 3 or
more serial ports).
Of course the PIC doesn't know how many devices are connected to each
(level triggered) IRQ line
Did you mean edge triggered? If not, who programmed the PIC for level
triggered? ISA requires edge triggered, AFAIK.
Post by Brendan
- it just knows that the line is still
"high", so if you don't handle the device's IRQ the PIC just keeps
sending IRQs to the CPU.
Well, I'm not seeing that. Maybe my modifications to my OS weren't quite
correct. I'm not sure. All, I'm seeing is a single IRQ which blocks.


Rod Pemberton
Brendan
2008-04-30 17:22:44 UTC
Permalink
Hi,
Post by Rod Pemberton
Post by Brendan
The other reason you may
not have noticed is that ISA devices (usually) don't share IRQ lines,
and usually the thing you need to do to clear a device's IRQ output is
something you need to do anyway (e.g. for a keyboard device driver to
work you know you need to get a received byte, so you write code to
get the received byte without caring if this action is necessary to
clear the IRQ condition or not).
Hmm, now you're trying to tell me non-PCI devices will retrigger IRQ's ("IRQ
flood") if I didn't "clear the condition" even though I cleared the EOI...
I have to check this out.
No (not sure how you got that idea from my previous post - maybe you
should have re-read my previous post before replying?)...
Post by Rod Pemberton
If you think it does, how do you
19 IRQ devices
2 IRQ's that are free
8 IRQ's with a single device
4 IRQ's with two devices
1 IRQ with three devices
As you can see, many of the IRQ's are shared. But, conflicts between "heavy
usage" devices like modems, printer port, sound card, etc. have been
eliminated. Each of them has been assigned on it's own IRQ.
This is easy to explain - most of these IRQs are level-triggered PCI
IRQs. It's not my fault if you don't know the difference between PCI
and ISA....

If my guess is right, the only "edge-triggered ISA" IRQ sharing is
probably between the first serial port (which you know is a serial
port) and the third serial port (which you probably think is a modem).


Cheers,

Brendan
Rod Pemberton
2008-05-02 08:05:59 UTC
Permalink
Post by Brendan
Post by Rod Pemberton
Post by Brendan
The other reason you may
not have noticed is that ISA devices (usually) don't share IRQ lines,
and usually the thing you need to do to clear a device's IRQ output is
something you need to do anyway (e.g. for a keyboard device driver to
work you know you need to get a received byte, so you write code to
get the received byte without caring if this action is necessary to
clear the IRQ condition or not).
Hmm, now you're trying to tell me non-PCI devices will retrigger IRQ's ("IRQ
flood") if I didn't "clear the condition" even though I cleared the EOI...
I have to check this out.
No (not sure how you got that idea from my previous post - maybe you
should have re-read my previous post before replying?)...
(missing context: prior paragraph by Brendan - not reinserted.)

Maybe you need to reread your post. Especially this part:

"Now, if you send an EOI to the PIC while the device's "IRQ
output" line is still in the "high" state, then there is no edge for
the PIC to notice, and there is no IRQ flood."

Work out not just the states you presented in that sentence, but the
opposite states as well.

(I.e., your statement also states that there will be an "IRQ flood" if there
is an "edge for the PIC to notice" if "the device's 'IRQ output' line" isn't
"still in the 'high' state"... Which is where my statements come from.)
Post by Brendan
Post by Rod Pemberton
PnP may have helped resolved IRQ conflicts by reassigning IRQ's, but
it didn't eliminate sharing of IRQ's.
...
Post by Brendan
Post by Rod Pemberton
If you think it does, how do you
19 IRQ devices
2 IRQ's that are free
8 IRQ's with a single device
4 IRQ's with two devices
1 IRQ with three devices
As you can see, many of the IRQ's are shared. But, conflicts between "heavy
usage" devices like modems, printer port, sound card, etc. have been
eliminated. Each of them has been assigned on it's own IRQ.
This is easy to explain - most of these IRQs are level-triggered PCI
IRQs.
When you described the sharing interrupts earlier, you completely ignored
PCI IRQ's using "sharing an IRQ" as synonymous for an "IRQ conflict." Now
you state the opposite. It's not my fault that you can't or don't or don't
always distinquish between PCI and ISA IRQ's or between a "sharing an IRQ"
and having an "IRQ conflict" when describing IRQ's. Reread your prior
posts. Write down what you stated in outline form. Is what you're posting
actually what you thought you posted? I suspect that it isn't.


Rod Pemberton
Brendan
2008-05-02 19:48:49 UTC
Permalink
Hi,
Post by Rod Pemberton
Reread your prior
posts. Write down what you stated in outline form. Is what you're posting
actually what you thought you posted? I suspect that it isn't.
I reread my previous posts. I didn't remove all the details from the
post (to put it into outline form) as the details are important. It is
exactly what I thought I posted, and still seems both concise and
accurate to me.

My words are hopefully helpful, but if they aren't it doesn't matter
much (it's not like I'm being paid, and it's easy enough to find the
datasheets, etc instead). However, I've *always* got better things to
do than petty bickering, so I'm happy to let others form their own
opinion from my previous posts without spending more time trying to
defend/explain what I wrote.


Cheers,

Brendan
Rod Pemberton
2008-05-06 10:09:41 UTC
Permalink
Post by Brendan
However, I've *always* got better things to
do than petty bickering, so I'm happy to let others form their own
opinion from my previous posts without spending more time trying to
defend/explain what I wrote.
Am I not allowed to question the statements Brendan "The Great"? How am I
supposed to accept what you wrote? By faith? When something you post is
questionable, confusing, incomplete, and possibly incorrect, you're going to
spend time defending or explaining what you wrote. Don't you think you
should expect that?

Although you seem to be blaming me for the bickering, it was initiated by
you when when I pointed out a working contradiction to your explanation.
You had and opportunity to respond to the contradiction, or figure out what
was wrong with your statements, but chose to ignore the contradiction
becoming hostile. If you aren't interested in the truth and logic in a
programming forum, why'd you bother posting? You can choose to run instead
defending or explaining yourself, but that won't help you or anyone else get
to the truth.


Rod Pemberton
Brendan
2008-05-07 02:52:21 UTC
Permalink
Hi,
Post by Rod Pemberton
Post by Brendan
However, I've *always* got better things to
do than petty bickering, so I'm happy to let others form their own
opinion from my previous posts without spending more time trying to
defend/explain what I wrote.
Am I not allowed to question the statements Brendan "The Great"?
Yes, within reason.
Post by Rod Pemberton
How am I
supposed to accept what you wrote? By faith? When something you post is
questionable, confusing, incomplete, and possibly incorrect, you're going to
spend time defending or explaining what you wrote. Don't you think you
should expect that?
When something I wrote is questionable, confusing, incomplete, and
possibly incorrect, then I should expect to clarify. However, IMHO
none of what I wrote was questionable, confusing, incomplete, or
possibly incorrect *except* that I may have the polarities around the
wrong way (which was mentioned in the note, and explained as
inconsequential for the point/s I was making).
Post by Rod Pemberton
Although you seem to be blaming me for the bickering, it was initiated by
you when when I pointed out a working contradiction to your explanation.
You *attempted* to point out a working contradiction to my
explanation. I still can't find that contradiction. I assumed you
didn't read my explanation very well, and felt like wasting my time
because you didn't read my explanation very well.

Here's a quick summary:

Brendan: You can't send an EOI to a level-triggered device without
handling the cause of the IRQ in the device (you'll just get
continuous IRQs)
Rod: I tried this on an edge-triggered device and didn't get
continuous IRQs, so you're wrong!
Brendan: Re-read my original post
Red: Yeah - well my Dad is bigger than your Dad
Brendan: I haven't got time for this...
Red: What? I can't even complain about how wrong I am?
Brendan: Here's a quick summary....

Or how about:
Brendan: Edge-triggered IRQs shouldn't be shared
Rod: But my computer has lots of level triggered IRQs that are shared,
so you're wrong!
Brendan: ?
Post by Rod Pemberton
You had and opportunity to respond to the contradiction, or figure out what
was wrong with your statements, but chose to ignore the contradiction
becoming hostile.
I work around 60 hours per week, which includes shift-work. Eating,
sleeping, doing laundry, shopping, etc all take time, and I have very
little time left to work on my own OS project.

Today, I had the opportunity to spend my lunch break eating lunch, or
to write some long overdue code, or to do something else that's
actually useful. I wrote this reply instead.


Cheers,

Brendan
Rod Pemberton
2008-06-04 15:06:59 UTC
Permalink
Post by Brendan
Post by Rod Pemberton
Although you seem to be blaming me for the bickering, it was initiated by
you when when I pointed out a working contradiction to your explanation.
You *attempted* to point out a working contradiction to my
explanation. I still can't find that contradiction.
It was clearly stated.
Post by Brendan
I assumed you
didn't read my explanation very well,
That's an incorrect assumption. I just reread the entire thread. I came to
the same conclusion as previously.
Post by Brendan
and felt like wasting my time
because you didn't read my explanation very well.
I don't believe I'm the one failing to comprehend here. Perhaps now that
this thread has had time to rest, your mind will be clearer.
Post by Brendan
Brendan: You can't send an EOI to a level-triggered device without
handling the cause of the IRQ in the device (you'll just get
continuous IRQs)
Try again:

BT> One reason you may not have noticed is that ISA devices are edge
BT> triggered. When the device wants to generate an IRQ it's "IRQ output"
BT> line changes (e.g. from low to high) and the PIC notices the change in
BT> state. Now, if you send an EOI to the PIC while the device's "IRQ
BT> output" line is still in the "high" state, then there is no edge for
BT> the PIC to notice,

E.g., Brendan: You can't send an EOI to an edge-triggered device _prior to_
handling the cause of the IRQ in the device.
Post by Brendan
Brendan: Edge-triggered IRQs shouldn't be shared
Try again:

BT> ... ISA devices (usually) don't share IRQ lines,

E.g., Brendan: ISA (e.g., non-PCI, edge-triggered) IRQs aren't (usually)
shared.
Post by Brendan
<works long hours>
I wrote this reply instead.
That was your choice. Accept responsibility for it. I reject your attempt
to project your bitterness onto me.

Perhaps your lack extensive work hours contributed to your lack of
comprehension here... As I believe I said to you earlier in the thread,
your written statements are (radically) different from what you actually
stated. Your misunderstanding of the conversation above confirms that for
me.


Rod Pemberton
Brendan
2008-06-06 04:15:30 UTC
Permalink
Hi,
Post by Rod Pemberton
Post by Brendan
Brendan: You can't send an EOI to a level-triggered device without
handling the cause of the IRQ in the device (you'll just get
continuous IRQs)
The paragraph above talks about level trigged IRQs.
Post by Rod Pemberton
BT> One reason you may not have noticed is that ISA devices are edge
BT> triggered. When the device wants to generate an IRQ it's "IRQ output"
BT> line changes (e.g. from low to high) and the PIC notices the change in
BT> state. Now, if you send an EOI to the PIC while the device's "IRQ
BT> output" line is still in the "high" state, then there is no edge for
BT> the PIC to notice,
This paragraph talks about edge trigged IRQs (not level triggered IRQs
like the preceding paragraph), so things said in the preceding
paragraph (e.g. "continuous IRQs") don't contradict things said in the
above paragraph (e.g. "no edge for the PIC to notice").

I'm not sure if these paragraphs were quoted for a reason or not (but
just in case you quoted them to show a contradiction in my previous
statements I thought I'd point out that they're saying different
things about different IRQ types).

Just for fun, see if you can find any paragraph I wrote that does
contradict any other paragraph I wrote. If you can, label them clearly
(so I know which quoted paragraphs contradict) and try again...
Post by Rod Pemberton
E.g., Brendan: You can't send an EOI to an edge-triggered device _prior to_
handling the cause of the IRQ in the device.
I didn't say that - you could send the EOI for an edge-triggered
device and then clear the cause of the IRQ in the device (as long as
the IRQ isn't shared when it shouldn't be, and as long as the device
does need the cause of the IRQ to be cleared - AFAIK the PIT timer is
the only edge-triggered device that doesn't), and you won't get
subsequent IRQs from the device (after you send the EOI but before you
clear the cause of the IRQ in the device) because there won't be a
rising edge for the PIC to notice (which is entirely different
behavior to level-triggered IRQs).
Post by Rod Pemberton
That was your choice. Accept responsibility for it. I reject your attempt
to project your bitterness onto me.
It's not bitterness - it's frustration at your repeated claims of
contradictions that you've been unable to sufficiently show. Again; If
you can find a contradiction, quote my paragraphs and label them
clearly. Otherwise it's probably wise to refrain from wasting more of
your time (and mine).


Cheers,

Brendan
Rod Pemberton
2008-06-06 09:30:07 UTC
Permalink
Post by Brendan
It's not bitterness -
it's frustration
Your problem... And, one you created...

I reject your frustration too. Accept responsibility for your emotions.
Your continued expression of them without any real cause exhibits your
irresponsibility. Don't you think so? They have nothing whatsoever to do
with me, the conversation, or the facts at hand - only you.
Post by Brendan
your repeated claims of
contradictions that you've been unable to sufficiently show.
I clearly pointed out and proved the contradictions. They were exactly as
you stated - all quoted with relevant context. You seem to have problems
with expression, comprehension, and/or logic. I showed where you stated
falsehoods - intentionally or not, misunderstood terminology, contradicted
prior statements, and interpreted your own statements as expressing
something radically different than what was originally stated.
Post by Brendan
If
you can find a contradiction
Do you not read?...
Post by Brendan
quote my paragraphs and label them
clearly.
Sigh, that was done too... So, why do you project your self-image as a lost
cause, thick-headed, or mildly retarded?
Post by Brendan
Otherwise it's probably wise to
refrain from wasting more of
your time (and mine).
I agree, but for this reason: your rejection of the truth and inability or
unwillingness to identify and correct your mistakes is now wasting
everyone's time.


Rod Pemberton
Brendan
2008-06-06 11:50:11 UTC
Permalink
Hi,
Post by Rod Pemberton
I clearly pointed out and proved the contradictions. They were exactly as
you stated - all quoted with relevant context.
Can *anybody* who reads this newsgroup (except Rob, whom I've given up
on) find these alleged contradictions?


Thanks,

Brendan













You seem to have problems
Post by Rod Pemberton
with expression, comprehension, and/or logic. I showed where you stated
falsehoods - intentionally or not, misunderstood terminology, contradicted
prior statements, and interpreted your own statements as expressing
something radically different than what was originally stated.
Post by Brendan
If
you can find a contradiction
Do you not read?...
Post by Brendan
quote my paragraphs and label them
clearly.
Sigh, that was done too... So, why do you project your self-image as a lost
cause, thick-headed, or mildly retarded?
Post by Brendan
Otherwise it's probably wise to
refrain from wasting more of
your time (and mine).
I agree, but for this reason: your rejection of the truth and inability or
unwillingness to identify and correct your mistakes is now wasting
everyone's time.
Rod Pemberton
James Harris
2008-06-06 19:02:13 UTC
Permalink
On 6 Jun, 12:50, Brendan <***@gmail.com> wrote:

...
Post by Brendan
Post by Rod Pemberton
I clearly pointed out and proved the contradictions. They were exactly as
you stated - all quoted with relevant context.
Can *anybody* who reads this newsgroup (except Rob, whom I've given up
on) find these alleged contradictions?
I can't say I've really been following ... but I haven't noticed any.
Wolfgang Kern
2008-06-07 12:43:51 UTC
Permalink
Post by James Harris
...
Post by Brendan
Post by Rod Pemberton
I clearly pointed out and proved the contradictions.
They were exactly as you stated - all quoted with relevant context.
Can *anybody* who reads this newsgroup (except Rob, whom I've given up
on) find these alleged contradictions?
I can't say I've really been following ... but I haven't noticed any.
Same for me. I started to read this thread 'diagonally' (tm:Rene)
when the discussion became a "Caesars Beard" issue :)

Exact terminology isn't always that easy and it may lead to confusion
and misunderstanding when similar looking terms mean different things.

Rod seem to have a special sense for things like this, so I always
take his claims about contradictions serious, even with a smile ... ;)

__
wolfgang
Ciaran Keating
2008-06-07 13:22:47 UTC
Permalink
Post by Brendan
Can *anybody* who reads this newsgroup (except Rob, whom I've given up
on) find these alleged contradictions?
Couldn't be bothered, Brendan ;-)
--
Ciaran Keating
Amadan Technologies
Maxim S. Shatskih
2008-05-01 08:37:30 UTC
Permalink
Post by Rod Pemberton
If I disable the read from the keyboard controller in my mouse routine and I
leave the clear EOI for the mouse routine and I then move the mouse,
according to you I should get infinite IRQ 12's (i.e., "IRQ flood") since I
didn't "clear the device", correct?
No, this is true for PCI level interrupts only.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
***@storagecraft.com
http://www.storagecraft.com
Maxim S. Shatskih
2008-05-01 08:34:17 UTC
Permalink
Post by Brendan
Secondly (and most importantly), it's usually impossible to check if 2
or more devices generated the same IRQ without introducing major
problems with race conditions. For example, an USB controller could
generate an IRQ, and the OS could check if the ethernet card generated
the IRQ (it didn't) and then check if the USB controller generated the
IRQ (it did), but the ethernet card could generate it's own IRQ before
the first EOI is sent. In this case the IRQ line is still in the same
state (no second rising edge for "edge triggered" to detect),
Exactly so, that's why edge-triggered interrupts are _not sharable at all_, and
attempts to share them are all fragile hackery which cannot work 100% reliably
even in theory.

Not so with PCI level-triggered interrupts which are designed for sharing.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
***@storagecraft.com
http://www.storagecraft.com
Maxim S. Shatskih
2008-05-01 08:31:15 UTC
Permalink
Post by Rod Pemberton
If so, how do you clear the IRQ for a PCI device? APIC?
In a device-specific way. No generic ways.
Post by Rod Pemberton
"level triggered" - high and low logic ("levels") are detected and an
action will be taken ("triggered") if the correct level is detected (usually
high)
"edge triggered" - low to high or high to low logic transitions ("edges")
are detected and an action will be taken ("triggered") if the correct
transition is detected (usually low to high)
Also, level-triggered PCI interrupts are sharable using open collector (wire
OR) circuit.

(A)PIC will generate the interrupt again and again till _all_ gates on an open
collector PCI INT# line will be closed.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
***@storagecraft.com
http://www.storagecraft.com
Loading...