[comp.sys.ibm.pc.hardware] IRQ 2 on AT-class machines

rreiner@yunexus.YorkU.CA (Richard Reiner) (05/01/91)

I've seen the documentation for several cards claim that IRQ 2 must
not be used for expansion cards on AT-class machines, as it is
reserved for something or other (they never say what).

However, all the reference works I have on hand (including one of the
Norton books, Ralf Brown's interrupt list, and some motherboard
reference guides) indicate that the only use of IRQ2 (which is really
remapped to IRQ 9 on the AT bus, since the real IRQ 2 is used for the
cascade between the PICs) in AT-class machines is for VGA and EGA
cards to indicate sync, a feature which is almost never used and which
is disabled by default on almost all VGAs and EGAs, thus leaving IRQ 9
free.

So what's the truth here?  

Thanks,

//richard

scjones@thor.sdrc.com (Larry Jones) (05/02/91)

In article <22603@yunexus.YorkU.CA>, rreiner@yunexus.YorkU.CA (Richard Reiner) writes:
> I've seen the documentation for several cards claim that IRQ 2 must
> not be used for expansion cards on AT-class machines, as it is
> reserved for something or other (they never say what).
> 
> So what's the truth here?  

The truth is that many people are very confused and so you souldn't
believe everything you read (except for this definitive article ;-).

When IBM designed the AT, they doubled the number of interrupts by
adding a second interrupt controller (PIC) which is cascaded to
IRQ-2 on the original PIC.  What that means is that when one of
the new interrupts (IRQ-8 - 15) occurs, the second PIC raises the
IRQ-2 signal on the first PIC which then raises the CPU's
interrupt signal.  Since IRQ-2 was thus used internally, they
connected the bus line that was connected to IRQ-2 on the PC to
IRQ-9.  Many people miss this particular subterfuge and assume
that since IRQ-2 is used as a cascade you can't connect anything
to the IRQ-2 bus line.  This is incorrect.

So, the bottom line is that the IRQ-2 bus line is definitely
available for whatever you want to use it for.  The most commonly
defined use is video retrace, but you can't count on it so noone
actually uses it as far as I know.  As long as your video card
can be persuaded to not use it (which is frequently the case --
most don't use it by default), you can use it for anything you
want.  There is one small gotcha, though.  You need to tell the
driver to use IRQ-9 rather than IRQ-2 since that's what you're
really doing.  Processing an interrupt from the second PIC is a
little different than processing an interrupt from the first PIC,
though, and not all drivers support the second PIC.  Hopefully,
this shouldn't be much of a problem any more since the AT has
been around for quite a while now and everyone has had more than
enough time to update their driver code.
----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH  45150-2789  513-576-2070
Domain: scjones@sdrc.com             Path: uunet!sdrc!scjones
Nobody knows how to pamper like a Mom. -- Calvin

john@jwt.UUCP (John Temples) (05/04/91)

In article <160@thor.sdrc.com> scjones@thor.sdrc.com (Larry Jones) writes:
>There is one small gotcha, though.  You need to tell the driver to
>use IRQ-9 rather than IRQ-2 since that's what you're really doing.

Well, not always.  I was just playing around with an Everex Magic I/O
card the last couple of days.  In the manual, it tells you that you can
configure the serial ports to use IRQ 2.  But when you look at the
silkscreen on the board, you see it's labeled as IRQ 9.  Now, when I
use the board under UNIX, I tell the driver to use IRQ 9, and it works
fine.  Yet when I bring up Procomm under DOS, it won't even let me
enter 9 as the IRQ -- I have to enter 2.  So it seems there's still
some confusion in the hardware/software market over this.
-- 
John W. Temples -- john@jwt.UUCP (uunet!jwt!john)

hpa@casbah.acns.nwu.edu (H. Peter Anvin) (05/04/91)

In article <3WC+R0F@jwt.UUCP> john@jwt.UUCP (John Temples) writes:
[that sometimes you have to specify "IRQ 9" and sometimes "IRQ 2" when
using this particular interrupt line on the AT.  The line is strictly
speaking IRQ 9 but it is often used as a substitute for IRQ 2 which is used
for chaining the secondary interrupt controller carrying IRQ 8-15 to the
primary carrying IRQ 0-7 and therefore is lost.]

The AT BIOS is part of the reason: the default interrupt handler for IRQ 9
(INT 49h I think) is just a jump to INT 09h, which is where the IRQ 2
handler should have been if IRQ 2 hadn't been used for chaining and thus is
unavailable.

Only 16-bit cards can use IRQ 8-15, with the exception of IRQ 9 which is
carried in the 8-bit part of the ISA bus in the position for IRQ 2.

DISCLAIMER: I think this is right.  The information I have gotten on this
is contradicting, to say the least.  (And much of it has been clearly
wrong).
-- 
IDENTITY:   Anvin, H. Peter           STATUS:    Student
INTERNET:   hpa@casbah.acns.nwu.edu   FIDONET:   1:115/989.4
HAM RADIO:  N9ITP, SM4TKN             RBBSNET:   8:970/101.4
EDITOR OF:  The Stillwaters BBS List  TEACHING:  Swedish

li@mrcnext.cso.uiuc.edu (hans li) (05/04/91)

On AT class machines irq 2 is used for daisy chaining disk drives.  
IRQ 9 is supposed to be used for networks and other cards.  If you're
running multiple drives, do not use irq 2.

rreiner@yunexus.YorkU.CA (Richard Reiner) (05/04/91)

li@mrcnext.cso.uiuc.edu (hans li) writes:

>On AT class machines irq 2 is used for daisy chaining disk drives.  

What is your source for this information?  What drive controllers do
you claim do this?  I've never seen any.  Besides, you must mean IRQ9:
see below.

>IRQ 9 is supposed to be used for networks and other cards.

Although true, this contradicts the above, since IRQ2 does not appear
on the AT bus, its place having been taken by IRQ9.  The physical IRQ2
on PIC1 is used as the cascade from PIC2, and for nothing else.  Talk
about "what IRQ2 is used for on the AT bus" is really about "the IRQ
line that takes the place on the bus of IRQ2," namely IRQ9.  So these
two things, the line takng the place of IRQ2, and IRQ9, cannot have
dfferent uses, since they are one and the same, i.e. IRQ9.

john@jwt.UUCP (John Temples) (05/05/91)

In article <li.673350356@mrcnext.cso.uiuc.edu> li@mrcnext.cso.uiuc.edu (hans li) writes:
>On AT class machines irq 2 is used for daisy chaining disk drives.  

Daisy chaining disk drives?  I've used IRQ 2 with no problems on
systems with two hard drives.  I believe the disk controller uses IRQ
14 on an AT, regardless of the number of drives attached.
-- 
John W. Temples -- john@jwt.UUCP (uunet!jwt!john)

li@mrcnext.cso.uiuc.edu (hans li) (05/05/91)

nope, irq 2 is used for the cascade interrupt, usually if you're running
MULTIPLE controllers.

rreiner@yunexus.YorkU.CA (Richard Reiner) (05/05/91)

li@mrcnext.cso.uiuc.edu (hans li) writes:

>nope, irq 2 is used for the cascade interrupt, usually if you're running
>MULTIPLE controllers.

Look here: several of us have disputed this claim, and asked you for
evidence.  Merely repeating your apparently erroneous assertion is bad
manners.

From what you say this time, I think I see what your confusion is: the
cascade interrupt is between the two PICs (the interrupt controllers),
not between hd controllers.

//richard

john@jwt.UUCP (John Temples) (05/07/91)

In article <li.673438213@mrcnext.cso.uiuc.edu> li@mrcnext.cso.uiuc.edu (hans li) writes:
>nope, irq 2 is used for the cascade interrupt, usually if you're running
>MULTIPLE controllers.

Your original posting said multiple drives, not multiple controllers.
But I've still never heard of such a thing.  Cascading interrupt
controllers, yes, but cascading hard disk controllers?
-- 
John W. Temples -- john@jwt.UUCP (uunet!jwt!john)

bich@hpsciz.sc.hp.com (Bich Tran) (05/08/91)

The second one is true: on AT class, IRQ2 is used to cascade the first
interrupt controller to the second one, so AT can handle more thatn just 7 IRQs
Since IRQ2 is re-mapped to IRQ9, software must redirect any IRQ2 request (XT
card) to IRQ9.
Hope this help,
bic

dj@ctron.com (DJ Delorie) (05/10/91)

In article <13340001@hpsciz.sc.hp.com>, bich@hpsciz.sc.hp.com (Bich Tran) writes:
> The second one is true: on AT class, IRQ2 is used to cascade the first
> interrupt controller to the second one, so AT can handle more thatn
> just 7 IRQs Since IRQ2 is re-mapped to IRQ9, software must redirect
> any IRQ2 request (XT card) to IRQ9.

Not quite true.  On an AT, vector 2 (IRQ2 on XT) is used to cascade
the slave interrupt controller (IRQ8-IRQ15).  To make the system
backward compatible, they did two things:

1. The IRQ2 line on the AT-bus is really connected to IRQ9 on the
controller chip (vector 1 on slave).

2. The BIOS redirects interrupts on int 71h (IRQ9) to int 0Ah (IRQ2),
after clearing the slave's status.

Thus, from an application program's point of view, nothing has
changed, not even the hardware.  They unmask IRQ2, service IRQ2
interrupts, and clear IRQ2 events.

DJ
dj@ctron.com