From: lawson@netsun.mdc.com (Jim Lawson)
Newsgroups: alt.cd-rom,comp.sys.ibm.pc.hardware
Subject: Re: IRQ2=trouble ?
Date: 2 Sep 92 20:56:47 GMT
Reply-To: Lawson%ssdvax.decnet@lbgwy.mdc.com
Organization: MDSSC-SSD
X-Newsreader: Tin 1.1 PL5

Subject: Re: IRQ2=trouble ?
Newsgroups: alt.cd-rom,comp.sys.ibm.pc.hardware
>I recently installed a Sony cd-rom and am using IRQ2 for the interface
>card. When I checked (before cd-rom install) the IRQ status on my 386
>is shows IRQ2 as a "cascade".
>So far, it's been working perfectly. What is "cascade" and am I going to
>be getting in trouble later ?

Here are the replys I've recieved:

You shouldn't have any problems.  Just don't install something else
as IRQ9, because that's what IRQ2 cascades to.  And make sure that
your VGA card doesn't have a jumper set to use IRQ 2, it is a feature
for backward-compatibility with some older games that used IRQ2 to
blank the screen (or something like that).

 Nope. Should work fine. In the AT/386/486 etc, there is a second 8259A 
interrupt controller, called a slave, while the first one is configured as
a master. The master handles IRQ0 through IRQ7 and the slave handles IRQ8 
through IRQ15. Simple so far. Now; the IRQ_OUT from the master goes to the
processor, and the IRQ_OUT from the slave goes to the IRQ2 pin of the master.
(ie IRQ8 through IRQ15 is cascaded through IRQ2). When the master receives
an interrupt acknowledge for IRQ2, instead of putting an interrupt vector
on the bus, it tells the slave to output a vector. OK, so what about IRQ2; if
the slave uses it, how can your?. Well, the pin on the card connector that was
used for IRQ2 in the XT, is now IRQ9 in the later machines. What your BIOS
does when it gets an IRQ9 is to then go and vector through where the IRQ2
vector is. ie IRQ9 "pretends" to be IRQ2. Confused??. Well think of it this 
way. For most practical purposes IRQ9 dos not exist, and what you have are 
IRQ0 to IRQ8 and IRQ10 to IRQ15 (though some are used by the system and not
available to you). 

The original PC supported only 8 IRQs on a single Intel 8259 interrupt
controller chip.  When they added more on the AT, they added a second
interrupt controller that "cascades" through the first to actually yank
on the interrupt line to the CPU.  The second channel on the original
controller is used for this purpose.  The IRQ 2 line on the bus actually
shows up to software in the computer as IRQ 9.  Most software takes this
into account and hides it from the user so as not to confuse people.

   Everything's fine.  Cascade refers to the fact that the second 8259
PIC chip is linked to the first 8259 PIC chip at IRQ 2.  Hardware IRQ 2
is mapped to IRQ 9 by your computer so that way, you can still have
the double 8259 PIC chips functioning properly, and still use IRQ 2.
In order words, there are really 2 IRQ 2's in your computer, one real
and one vitual.

 Cascade refers to the fact that the IRQ handling chip for IRQ 8-15 is cascaded
through IRQ 2...   If any of those IRQ's are issued at the same time as
IRQ 2, you are going to see a crash.

I believe so.  Use of IRQ2 effectively eliminates access to interrupts
IRQ 08 through 0F (hex, 8-15 decimal).  Any devices operating concurrently
with the drive will have problems if they use IRQ 08-0F.
 
No problems - all that's happening is that the second, slave, PIC
(interrupt controller) uses IRQ 2 to activate the interrupt line on
the master PIC.  This arrangement is called a cascade.  Note that
original PC class machines (before the PC AT), had one PIC, and that
IRQ 2 was a legitimate IRQ level.

In AT class machines, what Sony calls IRQ 2 actually goes to IRQ 9 on
the slave interrupt controller.  The BIOS will redirect IRQ 9 to the
ISR for IRQ 2; smart software will detect dual PICs and not have the
BIOS overhead.


(sigh) probably. We *all* get in trouble later, don't we? :)
Ok - what's "cascade"? Well, we start with the 8088/8086 chip; it had
one input harware interrupt line (INT). The system designers of the
wanted to have 8 interrupt lines on the bus (name IRQ0..IRQ7); so, they
put in a Peripheral Interrupt Controller (PIC), the intel 8259, that
takes in the 8 line, prioritizes them, and notifies the CPU (via the
single INT pin) when one of them has triggered. The 8259 also tells the
CPU which one it was (uses the data bus, but who cares?)

With the advent of the PC/AT, the IBM designers wanted more IRQs (didn't
we all!) so they put in a second 8259, and wired IRQ8..IRQF to this
second 8259. Well and good, but where does the second 8259 get an INT
pin to use? It uses IRQ2 on the first 8259: a cascade! (Truth be told,
intel designed this in, not IBM - it's the 8259 cascade mode.)

So, when IRQ8..IRQF trigger, the second 8259 tugs on IRQ2, and the first
8259 tugs on the CPU's INT line, passing on the cascaded IRQ number.

If nobody else in your computer every uses IRQ8..IRQF, you're fine; if
they do - you got a problem! You can resolve it by juggling what goes on
what IRQ and so forth, but I'd wait until I had to add something to the
system before I started moving things. Until it's broke, don't fix it!

When you think about these things, remember that the IRQ lines do NOT
map to the same-numbered software interrupts! IRQ0 maps into INT8, as I
recall, and so forth. Check reference material (Norton guides, PC Tech
Ref, something like that) for specifics.

--
Jim Lawson	Lawson%ssdvax.decnet@lbgwy.mdc.com
		Alt:	Lawson@netsun.mdc.com or Lawson@mdcbbs.com

Opinions/Comments expressed here are my own and no one elses !!
Newsgroups: alt.cd-rom