9. IRQ IO ADDR

What is an IRQ-Address ?

9.1 Device Addresses: IRQ IO_ADDR MEM_ADDR
9.2 Memory Addresses
9.3 IO address
9.4 cat /proc/ioports
9.5 IRQ - Interrupt ReQuest lines.
9.6 IRQ - cat /proc/interrupts

9.1

Device Addresses: IRQ IO_ADDR MEM_ADDR

These are three independent types of address. MEM_ADDR (either ROM or buffer space) is in the same domain as your 16 Mb RAM.

The following sections describe them, along with typical reports from system utilities (ie the /proc directory).

9.2

Memory Addresses

As well as your 16 MB RAM, you have several ROMS that contain programs.

Memory usually holds programs or data. Certain regions of the PC's first megabyte, are 'reserved' for different functions. Cards with programs installed on ROMS make the ROMS 'appear' at a specific address. Often you can configure that address (ie an 8K block of addresses).

The different cards must have different addresses for their ROMS and data buffers. The Video BIOS is the easiest, as everyone agrees on vague standards.

Linux will use its own device driver, and not the one on ROM. So shadowing won't help Linux, but it will help DOS. Windows uses it's own driver.

The Video BIOS tells DOS how to drive the video hardware. It's on the card, and usually installs at a well known address. If you do a lot of work in DOS, you may wish to set SHADOW BIOS ON that area of memory, so that the system BIOS copies the ROM into RAM memory at boot time. This is much faster than accessing the ISA bus. However (1) this reduces the pool of memory (available above the 1MB mark), (2) Linux and Windows don't use the card BIOS's (except for booting), and VLB/PCI card speeds are almost as fast as main board memory. In the BIOS CMOS setup, I switch BIOS shadow OFF everywhere.

DATA BUFFER memory, appears on Ethernet cards and other devices that do INPUT. Either the CPU or the CARD may write to this memory, so the CPU must NOT assume that it hasn't changed since last time it did an access. You must set CACHING off on these areas.

You must tell DOS-EMM386 to avoid all these areas in C:\\config.sys:

device=emm386 noems x=d000-d7ff x=dc00-dfff

Note that DOS uses a 4 digit hex number, whilst Linux uses a 5 digit hex number. This is because DOS is using 8086 SEGMENT addresses, which are shifted by 4 bits (one hex digit).

9.3

IO address

IO_ADDR_RANGE (eg starting at 0x320), is a smaller range of addresses of hardware IO registers (eg to control UARTS or motors). You have to make sure that no two cards have overlapping address RANGES (but no-one tells you how big each range is!). When you install a card you will have to tell the DOS driver where it is, or help the Linux driver find it sooner

This example only applies to my external Panasonic CDROM which has a Matsushita interface card, with strange IO address settings. You probably have an EIDE CDROM, and would not do this at all!.

C:\\config.sys

	device=C:\\ETC\\CDdriver.sys /P:320

/etc/lilo.conf

	append="sbpcd=0x320,LaserMate"

9.4

cat /proc/ioports

This is the list of io port addresses, that different drivers have reserved. That means that the device was found, and these figures are probably exactly right, maybe with omissions.

0000-001f : dma1
0020-003f : pic1
0040-005f : timer
0060-006f : keyboard
0070-007f : rtc
0080-009f : dma page reg
00a0-00bf : pic2
00c0-00df : dma2
00f0-00ff : npu
0170-0177 : ide1
01f0-01f7 : ide0
02f8-02ff : serial(set)
0300-031f : NE2000
0376-0376 : ide1
03c0-03df : vga+
03e8-03ef : serial(set)
03f0-03f5 : floppy
03f6-03f6 : ide0
03f7-03f7 : floppy DIR
03f8-03ff : serial(set)

NOTE: you have to be running Linux, for cat /proc/ioports to work! First you have to plan what it will look like. It's also how you know that the modem card's serial UART was detected.

9.5

IRQ - Interrupt ReQuest lines.

There are very few of these, and again each must be unique. Often cards are programmable by DOS or Linux (or their own driver.sys), to take a specified IRQ. Often there will be a 'pre-reserved' IRQ address line for that type of device. These should be listed in your board docs eg:


0	timer
1	keyboard
2	-cascade- from IRQ8 to IRQ15
3	COM2
4	COM1
5	LPT2		<- Internal Modem
6	FLOPPY
7	LPT1		<- Parallel Port
8	CLOCK	
9	-FREE-
10	-FREE-		<- WD80x3 (Ethernet)
11	-FREE-		<- BUSLOGIC  || Adaptec
12	-FREE-		<- NE2000
13	FPU
14	IDE-CTRL-1
15	IDE-CTRL-2	-FREE-

	see logfile: /var/adm/messages 

9.6

IRQ - cat /proc/interrupts

These are the values currently in use by the kernel. Hopefully the device is using the same values.

interrupts may be currently "un-loaded", eg lp.o hasn't been used for 15 minutes, so kerneld has unloaded it, and IRQ 7 isn't really free, because lp might want it back. (see tunelp).

 0:   255599   timer
 1:     5629   keyboard
 2:        0   cascade
 				# COM2 never used - but still reserved (-ish)
 4:    10674 + serial		# COM1 mouse used 
 5:      105 + serial		# internal modem card
 8:        0 + rtc
12:        1   NE2000
13:        1   math error	# kernel used an error to test it
14:    24060 + ide0
15:     4777 + ide1

AFTER you have set up a working machine, you may be able to re-arrange how the IRQ's are allocated. Linux can SHARE IRQ's between devices. eg COM ports can share IRQ's, because the driver looks to see which UART actually generated the interrupt. This will depend on your devices and drivers (and patience). NOTE that the UARTS must be on the same card. An internal modem card, must have it's own IRQ (5).

IRQ's on the ISA bus, CANNOT be shared by different CARDS (unless you are extremely lucky). They can be shared within the same CARD (or motherboard).

Linux can drive two EIDE cards, giving 4 EIDE cables and 8 EIDE drives. You may need to find a free IRQ, or take one away from the printer (making it a polled driver), or get the printer to share the EIDE Cards IRQ (is this possible?) if it is a multi-function card.