ISA: Difference between revisions

[unchecked revision][unchecked revision]
Content deleted Content added
m Heading issue
m edits to conflicts information
 
(22 intermediate revisions by 2 users not shown)
Line 11:
* I/O port addresses
Managing these resources becomes the responsibility of the operating system. Fortunately, Microsoft has created a standard called [[Plug-and-Play]] (PnP) that helps with this. Not all ISA cards support it, however, so some luck is required in that the person building the system has set the correct jumpers.
 
== Decode Problems ==
 
The ISA bus can support x86 16-bit port addresses, but many older ISA cards only support 10-bit address decode. This presents a major problem that can lead to conflict. When the processor tries to access a certain resource on the ISA bus, it will signal all ISA devices in the hopes that only one responds. If a card can only handle ten of the address bits, it can respond to IOR and IOW signals when it should not be, because it does not see the upper bits.
 
So if a device is located at port 100H, that 10-bit address with every possible combination for the upper 6 bits will map to the same device (e.g port 0xFF00). To make this totally impossible, one can simply restrict PnP port addresses to be within the 1024-byte range to make such conflicts impossible, though this would be a limitation. It is also important to note that PCI uses 0CF8-0xCFF, which is above the 10-bit range and cannot be reassigned. Built-in devices reported by the PnP BIOS such as the PCI host bridge should the address range with the top 6 bits masked out. This way, ISA cards cannot be configured in a conflicting manner.
 
Conflicts are not restricted to IO and should apply to memory too, but any mainboard with an ISA bus and more than 16MB of RAM will probably be smart enough to check addresses before sending them to the ISA bus. They may check IO port addresses too, but it is always best to verify rather than trust 90's era hardware that sometimes had dubious standard compliance.
 
The decode of legacy devices like the LPT, COM, etc. that are typically embedded in the mainboard are probably 16-bit on PnP boards, but checking with the BIOS is the only way to be sure.
 
= ISA Plug-and-Play Overview =
The following is a general overview of the ISA Plug-and-play specification. The goal of this section is to clarify the documentation as there are many forward references to the appendices. See the original document (ISA PnP 1.0A) for more authoritative information (including timeouts). There are three 8-bit ports specified by the ISA PnP standard that are used for accessing configuration spaces.
 
The original ISA bus, or more specifically, the 16-bit PC/AT bus used static non-sharable resource assignments and had no isolation between cards. There was no way to program it from software. A number of bussesbuses appeared on the PC market such as VLB, PCI, and EISA. These architectures were incompatible with the original design. Plug-and-play ISA was introduced to get around the original limitations while maintaining compatibility and improving user friendliness. The following is a general overview of the ISA Plug-and-play specification. The goal of this section is to clarify the documentation as there are many forward references to the appendices. See the original document (ISA PnP 1.0A) for more authoritative information (including timeouts).
== Purpose and "Is it worth it?" ==
 
ProgrammersDevelopers looking for robust support for the 1990's generation of hardware may want to add plug-and-play ISA support.
 
== I/O Ports and Initiation ==
The original ISA bus, or more specifically, the 16-bit PC/AT bus used static non-sharable resource assignments and had no isolation between cards. There was no way to program it from software. A number of busses appeared on the PC market such as VLB, PCI, and EISA. These architectures were incompatible with the original design. Plug-and-play ISA was introduced to get around the original limitations while maintaining compatibility and improving user friendliness.
 
There are three 8-bit ports specified by the ISA PnP standard that are used for accessing configuration spaces.
Programmers looking for robust support for the 1990's generation of hardware may want to add plug-and-play ISA support.
 
{| class="wikitable" style="margin:left"
Line 33 ⟶ 44:
|}
 
'''Note: ISAEach of these ports generally use 12-bit decode (PnP 1.0A 7) but some cards support only 10-bit addresses'''
 
The ADDRESS port is an 8-bit port that takes two bytes. The first byte send is the CSN, or card select number. The second is the offset in the configuration space. The address is the same as the printer status, but ports are bidirectional on PCs.
Line 62 ⟶ 73:
AMD recommends (PCnet-ISA II 3) disabling interrupts while performing the IO operation to prevent anything else from interfering (as shown above). No other ports should be accessed. Although not mentioned in the original specification, it is also recommended by AMD to '''send it twice''' in case the key is not received the first time.
 
== Isolation Protocoland (PnP 3.3.2)CSNs ==
Before doing anything with ISA cards, the number of CSNs should be obtained using the PnP BIOS. CSNs are always sequential and start from one (zero represents unidentified cards).
 
The specification details isolation of cards. BIOS is supposed to perform this procedure. The term "plug-and-play software" in the specification may refer to the OS and firmware. On startup, the BIOS will send the initiation key, perform the serial isolation procedure, and take the cards out of isolation or configuration mode and have them ''wait for key''. Each card is assigned a sequential handle starting from 1 called a CSN. The number of CSNs that the BIOS assigned, as well as the READ_DATA port that the BIOS decided can be found with PnP function 40h.
 
Despite the BIOS performing isolation itself, the PnP BIOS specification says that the OS should not rely on the BIOS at all and do it again.
 
== Card Control Space ==
Line 78 ⟶ 93:
| 0x02 || Config Control || See below for spec
|-
| 0x03 || Wake[CSN] |-| Writing here wakes that CSN
|-
| 0x04 || Resource Data|| Reading fetches the next byte
Line 86 ⟶ 101:
| 0x06 || Card Select Number || The CSN, can be changed
|-
| 0x07 || Logical Device || Selects a logical device, read-only zero if none
|-
| 0x08-1F||Card reserved || ~
Line 98 ⟶ 113:
 
=== Configuring READ_DATA ===
The Set READ_DATA portregister (also referred to as RD_DATA) is an 8-bit value that relocates the READ_DATA port to the range specified above. This value is practically shifted left by three and or'ed with "11" in binary (Page 15) to create a 10-bit address slanted by 3. The value written to this register would be:
 
Set_READ_DATA = (PhysicalPort & 0x3F8) >> 3 /* Make sure first bits are 11 */
Line 106 ⟶ 121:
 
=== Resource Data ===
 
Resource data is read from the dedicated register.
Resource data is read from the dedicated register for the logical device selected. Bit zero of the status register must be polled until it is one before reading the resource data. The resource data register is READ ONLY. This resource data is not to be confused with the resource configuration registers in the card control space. It defines what resources the card '''is able''' to use. If a fully PnP card uses any memory address range, the static resource entry will be 0x00000000-0xFFFFFFFF (AFAIK), and the same applies to ports, DMA, and IRQs. If only one DMA or IRQ is implemented, that device must use it. For IO ports, the tag can be a fixed descriptor or regular one. If the tag is a fixed descriptor, the old 10-bit ISA decode is used for that range.
 
The PnP ISA specification allows for 32-bit data and addresses. This is definitely not used by any ISA cards because the ISA bus is 16-bit and only supports 24-bit addresses. Despite this, the OS should support this by indirection for consistency.
 
The PnP BIOS uses the same format for reporting devices connected to the mainboard.
 
== Logical Device Local Control ==
 
The logical card control registers are found at 0x30-0x3F. This space is present on all cards, even if they do not have any logical devices. Selecting the logical device swaps out this space. To check if the card is multi-function, write a value other than zero to the logical device register and try to write it back. If a read of LDS still generates a zero, the device has no functions. Otherwise, write back the original value (zero i.g.).
 
=== Activation ===
Line 116 ⟶ 136:
The activate register turns on the card or the logical device belonging to that card when the first bit is on. If there are no resources for a card, the OS will have to disable the card by setting the register to zero (the user should be notified). IO range check should be disabled while activating.
 
== Resource Configuration ==
== Isolation Protocol (PnP 3.3.2) ==
 
The resource data is stored in the logical card space. The memory information starts at 0x40 or 0x76 and is seen at Table A-3. Memory descriptors are four bytes for 24-bit addressing and nine for 32-bit. The specifics are detailed in A.3.1.
Directly after the initiation key has been sent and all cards have been switched from ''wait for key'' to ''sleep'' mode, the isolation protocol must be performed. It is at this point where the READ_DATA port should be assigned.
 
== Supporting ISA PnP ==
When the initiation key is sent, all cards are placed in sleep mode. The Wake[CSN] command is used to place cards in ''config'' mode. If the parameter is zero, all cards are placed in ''isolation'' mode instead. The system software must try to set the READ_DATA port address and read 72 bytes from it, and check each pair of reads for 0x55 and 0xAA. If this sequence is not detected and there is a checksum mismatch (TODO: more info), '''the port is in conflict and must be reassigned'''. If the OS cannot find a place to put the READ_DATA port, PnP software is to assume there are no plug-and-play ISA cards installed on the system, so no further work is needed.
 
PnP ISA devices can suport varrying levels of configurability. For example, a card that implements a parallel port may only be configurable to three standard addresses for PC compatibility. The static resource data mentioned previously reports what data a device supports, but not necessarily what it will use.
== Resource Configuration ==
 
The plug-and-play management code of the OS must be able to handle every possible bus, and combinations of buses, as some computers have PCI and ISA. Reserving resources should be supported so that less-so or non-configurable devices can work.
{| class="wikitable" style="margin:left"
|+ Config Control Register
|-
! Index !! Purpose
|-
| 0 || Reset all logical devices
|-
| 2 || Reset CSN to zero
|}
 
The following specifics of ISA PnP must be implemented in the operating system:
Toggling bits in the CCR will perform several commands. The bits are reset once the task is performed.
* Memory address ranges supported
* IO port ranges
* IRQs
* Address and port decode
* Data width (8/16/32-bit)
 
[[Category:Buses]]
Line 140 ⟶ 157:
 
=External Links=
*[http://www.osdever.net/documents/PNP-ISA-v1.0a.pdf Tutorial on how to enable PCnet-ISA II PnP]
PCnet-ISA II programming guide. This has some useful information on PnP.
*[https://www.amd.com/system/files/TechDocs/PCnet-ISA_II.pdf#:~:text=The%20Initiation%20Key%20places%20the%20PCnet- PnP ISA%20II%20Plug,the%20Plug%20and%20Play%20auto-configuration%20ports%20are%20enabled. Specification]