Re: ISA I/O port programming question...

Matt Cross (mcross@sw.stratus.com)
Mon, 13 Jan 1997 12:24:06 -0500


Date: Sun, 12 Jan 1997 20:27:08 -0500 (EST)
From: Robert Erlich <erlichr@interlog.com>

I am adapting a servo motor controller board to the ISA buss. (it was
originally designed for the New Micros NMIS microcontroller family) I
would like to place it in an I/O space far away from my other periphs.;
ie. 65535 >= port >=1024.

Neat! Do you mean a servo motor like an R/C servo, or some other kind
of servo? Will this board be available to the general public
(i.e. me)?

What is the magic of I/O ports below 0x3FF on the ISA buss? Some texts I
have read state that only the first 10 bits of the I/O address are decoded
onto the ISA buss. Is this true? Do addresses that
are higher wrap around? Are the address lines available to create
hardware that decodes to a >=1024 I/O address? If not, what happens if I
outb(0x400, 0xXX)? All these questions....

Here's the deal. x86 processors can generate I/O accesses from
0x00000 to 0x10003 (well, most). But forget about those silly high
addresses (above 0xFFFF).

The original IBM PC motherboard devices only decoded 10 bit for I/O
accesses, effectively limiting the I/O space to 0x000 to 0x3FF. A lot
of card manufacturers at the time also did the same thing. This meant
you could see every device at 64 different addresses.

However, when the AT came out, all on-board devices did full 16-bit
decode. IBM specified that the range from 0x00 to 0xFF is reserved
for motherboard devices, and 0x100 to 0x3FF is available for expansion
devices. Since backwards compatibility rules over all, having a
device that aliases to the addresses 0x100 to 0x3FF when only the
lower 10 bits are decoded is bad; you _may_ conflict with a device
that only decodes 10 bits.

If you want to use an address above 0x3FF, you must make sure it
aliases to the 0x000 to 0x0FF range when only 10 bits are decoded.
0x400 to 0x4FF are valid, as are 0x800 to 0x8FF, 0xC00 to 0xCFF, etc.

As an aside, this is why the PCI specification says PCI devices should
not ask for more than 256 bytes of contiguous IO space.

-Matt

-- 
Matthew E. Cross                              E-Mail: mcross@sw.stratus.com
Software Engineer                              Phone: 508-460-2926
Stratus Computer, Inc.                           Fax: 508-460-0397