ISA bus and SLOW_DOWN_IO

Richard B. Johnson (root@analogic.com)
Sat, 24 May 1997 23:59:12 -0400 (EDT)


In the following session, MS-DOS debug is used to read and write
using the port at 0x80. Note that what is written, will be read back.
Therefore, it is NOT an "unused" port. Further, everything written to
any port address of 0xffff and below will appear on the ISA bus.
Unfortunately, due to poor design, most boards do not decode all
the address bits. This means that you could access a board without
intending to do so. I don't have the IBM "bible" here, but I believe
that the port at 0x80 is the first DMA page register. If so, it
is hardly an "unused" port. The early IBM design used DMA Channel 0
to do dummy DMA cycles for RAM refresh, therefore this port may
be available for use but....

C:\>debug
-
-i 80 ; Read port 80 (hex)
00 ; Nothing, if no port, would read FF
-o 80 aa ; Write 0xaa to port 0x80
-i 80 ; Read port 0x80
AA ; It was latched by a real port and can be read back.
-o 80 55 ; Write 0x55 to port 0x80
-i 80 ; Read port 0x80
55 ; It was latched by a real port and can be read back.
-q ; Exit debug
C:\>

The ISA bus is an Asynchronous bus originally designed to support
a communications board and a video board. Technically, it looks like
a capacitor. It does not comprise a terminated transmission line.

For the purposes that the ISA bus grew into, it is broken. Note
that the first IBM-PC was NOT designed as a PC. It was designed to
be used as a "smart terminal" for the IBM System 3. A few development
machines were made with floppies so that code could be written and
tested on the target machine before being committed to PROM. Osborne
and others first recognized that the result was everything needed to
make a PC superior to the CP/M 8080 and Z80 machines that existed
at the time. From this (and many court battles) the IBM/PC was born.

As the number of peripherals has increased, and the bus operation
speed has increased, the problems with edge reflections has also
increased. The result being that different buses were designed, first
the VESA Local-bus and then the PCI bus. Port addresses above 0xffff
appear ONLY on the PCI bus. This allows one to use port I/O and still
keep the high-speed signals off the ISA bus.

Writing to port 0x80 every time a read or write to another port is
performed, such as is done with the "__SLOW_DOWN_IO" macros is counter
productive. If you don't think so, the following experiment will help
get my point across.

(1) Tune a radio to some place where you hear interference from your
computer while doing some I/O (tar your fs to a tape). If you have
an ISA Ethernet card, ftp the kernel across the network. Note the
strength of the interference.

(2) Temporarily convert the macro in linux/include/asm/io.h to a
null macro and recompile the kernel. Just add comment characters
around the definition starting at __asm__.

(3) Reboot, using the new kernel, and repeat the experiment. The
amount of interference you hear will be dramatically reduced. Every
write to port 0x80 produces at least four high-frequency edges that
bounce up and down the ISA bus until they die out from electromagnetic
radiation (what you hear on the radio). It doesn't matter that the
device that responds to the IO R/W is on the motherboard. All the
activity must also exist on the ISA bus.

Now, using the "old fashoned" pause method of:

jmp foo
foo:

Is not too effective because with high-speed CPUs and built-in caches,
you will not waste enough time. However, accessing RAM is predictable
because PC class RAM access times will not get much faster than 60 ns.

I suggest that the macro be changed to:

pusha
popa

This will access the stack with a known number of processor clocks plus
read/write access time. These accesses are not on the ISA bus.

Sorry to get "carried away" on this, but as they say.. "I do this for
a living..."

Cheers,
Dick Johnson
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Richard B. Johnson
Project Engineer
Analogic Corporation
Voice : (508) 977-3000 ext. 3754
Fax : (508) 532-6097
Modem : (508) 977-6870
Ftp : ftp@boneserver.analogic.com
Email : rjohnson@analogic.com, johnson@analogic.com
Penguin : Linux version 2.1.40 on an i586 machine (66.15 BogoMips).
Warning : I read unsolicited mail for $350.00 per hour. Supply billing address.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-