PCI & ISA Slot Computers by EVS Computers
Stay ahead with the world's most comprehensive technology and business learning platform.
With Safari, you learn the way you learn best.
Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.
PCI Drivers While introduced the lowest levels of hardware control, this chapter provides an overview of the higher-level bus architectures.
A bus is made up of both an electrical interface and a programming interface.
In this chapter, we deal with the programming interface.
This chapter covers a number of bus architectures.
However, the primary focus is on the kernel functions that access Peripheral Component Interconnect PCI peripherals, because these days the PCI bus is the most commonly used peripheral bus on desktops and bigger computers.
The bus is the one that is best supported by the kernel.
ISA is still common for electronic hobbyists and is described later, although it is pretty much a bare-metal kind of bus, and there isn't much to say in addition to what is covered in and.
The PCI Interface Although many computer users think of PCI as a way of laying out electrical wires, it is actually a complete set of specifications defining how different parts of a computer should interact.
The PCI specification covers most issues related to computer interfaces.
We are not going to cover it all here; in this section, we are mainly concerned with how a PCI driver can find its hardware and gain access to it.
The probing techniques discussed in and can be used with PCI devices, but the specification offers an alternative that is preferable to probing.
The PCI architecture was designed as a replacement for the ISA standard, with three main goals: to get better performance when transferring data between the computer and its peripherals, to be as platform independent as possible, and to simplify adding and removing peripherals to the system.
The PCI bus achieves better performance by using a higher clock rate than ISA; its clock runs at 25 or 33 MHz its actual rate being a factor of the system clockand 66-MHz and even 133-MHz implementations have recently been deployed as well.
Moreover, it is equipped with a 32-bit data bus, and a 64-bit extension has been included in the specification.
Platform independence is often a goal in the design of a computer bus, and it's an especially important feature of PCI, because the PC world has always been dominated by processor-specific interface standards.
PCI is currently used extensively on IA-32, Alpha, PowerPC, SPARC64, and IA-64 systems, and some other platforms as well.
What is most relevant to the driver writer, however, is PCI's support for autodetection of interface boards.
PCI devices are jumperless unlike most older peripherals and are automatically configured at boot time.
Then, the device driver must be able to access configuration information in the device in order to complete initialization.
This happens without the source to perform any probing.
PCI Addressing Each PCI peripheral is identified by a bus number, a device number, and a function number.
The PCI specification permits a single system to host up to 256 buses, but because 256 buses are not sufficient for many large systems, Linux now supports PCI domains.
Each PCI domain can host up to 256 buses.
Each bus hosts up to 32 devices, and each device can be a multifunction board such as an audio device with an accompanying CD-ROM drive with a maximum of eight functions.
Therefore, each function can be identified at hardware level by a 16-bit address, or key.
Most recent workstations feature at least two PCI buses.
Plugging more than one bus in a single system is accomplished by means of bridgesspecial-purpose PCI peripherals whose task is joining two buses.
The overall layout of a PCI system is a tree where each bus is connected to an upper-layer bus, up to bus 0 at the root of the tree.
The CardBus PC-card system is also connected to the PCI system via bridges.
A typical PCI system is represented inwhere the various bridges are highlighted.
The sysfs representation of PCI devices also shows this addressing scheme, with the addition of the PCI domain information.
Taking the VGA video controller as an example, 0x00a0 means 0000:00:14.
The first samsung tv sd card slot address spaces are shared by all the devices on the same PCI bus i.
The configuration space, on the other hand, exploits geographical addressing.
Configuration queries address only one slot at a time, so they never collide.
Configuration transactions, on the other hand, are performed by calling specific kernel functions to access configuration registers.
With regard to interrupts, every PCI slot has four interrupt pins, and each device function can use one of them without being concerned about how those pins are routed to the CPU.
Such routing is the responsibility of the computer platform and is implemented outside of the PCI bus.
Since the PCI specification requires interrupt lines to be shareable, even a processor with a limited number of IRQ lines, such as the x86, can host many PCI interface boards each with four interrupt pins.
Addresses are supposed to be unique to one device, but software may erroneously configure two devices to the same address, making it impossible to access either one.
But this problem never occurs unless a driver is willingly playing with registers it shouldn't touch.
That is, the firmware initializes PCI hardware at system boot, mapping each region to a different address to avoid collisions.
After reading the configuration registers, the driver can safely access its hardware.
The PCI configuration space consists of 256 bytes for each device function except for PCI Express devices, which have 4 KB of configuration space for each functionand the layout of the configuration registers is standardized.
Four bytes of the configuration space hold a unique function ID, so the driver can identify its device by looking for the specific ID for that peripheral.
It should be clear from this description that the main innovation of the PCI interface standard over ISA is the configuration address space.
Therefore, in addition to the usual driver code, a PCI driver needs the ability to access the configuration space, in order to save itself from risky probing tasks.
For the remainder of this chapter, we use the word device to refer to a device function, because each function in a multifunction board acts as an independent entity.
When we refer to a device, we mean the tuple "domain number, bus number, device number, and function number.
When power is applied to a PCI device, the hardware remains inactive.
In other words, the device responds only to configuration transactions.
Fortunately, every PCI motherboard is equipped with PCI-aware firmware, called the BIOS, One signal multiple slots, or PROM, depending on the platform.
The firmware offers access to the device configuration address space by reading and writing registers in the PCI controller.
At system boot, the firmware or the Linux kernel, if so configured performs configuration transactions with every PCI peripheral in order to allocate a safe place for each address region it offers.
The driver can change this default assignment, but it never needs to do that.
The former is a text file with hexadecimal device information, and the latter are binary files that report a snapshot of the configuration registers of each device, one file per device.
The file irq shows the current IRQ assigned to this PCI device, and the file resource shows the current memory resources allocated by this device.
Configuration Registers and Initialization In this section, we look at the configuration registers that PCI devices contain.
All PCI devices feature at least a 256-byte address space.
The first 64 bytes are standardized, while the rest are device dependent.
The standardized PCI configuration registers As the figure shows, some of the PCI configuration registers are required and some are optional.
Every PCI device must contain meaningful values in the required registers, whereas the contents of the optional registers depend on the actual capabilities of the peripheral.
The optional fields are not used unless the contents of the required fields indicate that they are valid.
Thus, the required fields assert the board's capabilities, including whether the other fields are usable.
It's interesting to note that the PCI registers are always little-endian.
Although the standard is designed to be architecture independent, the PCI designers sometimes show a slight bias toward the PC environment.
The driver writer should be careful about byte ordering when accessing multibyte configuration registers; code that works on the PC might not work on other platforms.
The Linux developers have taken care of the byte-ordering problem see the next section,but the issue must be kept in mind.
If you ever need to convert data from host order to PCI order or vice versa, you can resort to the functions defined inintroduced inknowing that PCI byte order is little-endian.
Describing all the configuration items is beyond the scope of this book.
Usually, the technical documentation released with each device describes the supported registers.
What we're interested in is how a driver can look for its device and how it can access the device's configuration space.
Three or five PCI registers identify a device: vendorID, deviceID, and class are the three that are always used.
Every PCI manufacturer assigns proper values to these read-only registers, and the driver can use them to look for the device.
Additionally, the fields subsystem vendorID and subsystem deviceID are sometimes set by the vendor to further differentiate similar devices.
Let's look at these registers in more detail: vendorID This 16-bit register identifies a hardware manufacturer.
For instance, every Intel device is marked with the same vendor number, 0x8086.
There is a global registry of such numbers, maintained by the PCI Special Interest Group, and manufacturers must apply to have a unique number assigned to them.
This ID is usually paired with the vendor ID to make a unique 32-bit identifier for a hardware device.
We use the word signature to refer to the vendor and device ID pair.
A device driver usually relies on the signature to identify its device; you can find what value to look for in the hardware manual for the target device.
The class register is a 16-bit value whose top 8 bits identify the "base class" or group.
For example, "ethernet" and "token ring" are two classes belonging to the "network" group, while the "serial" and "parallel" classes belong to the "communication" group.
Some drivers can support several similar devices, each of them featuring a different signature but all belonging to the same class; these drivers can rely on the class register to identify their peripherals, as shown later.
If the chip is a generic interface chip to a local onboard bus, it is often used in several completely different roles, and the driver must identify the actual device it is talking with.
The subsystem identifiers are used to this just click for source isa slot pin configuration these different identifiers, a PCI driver can tell the kernel what kind of devices it supports.
The different classes of PCI devices a VGA controller is one example are described in the PCI specification.
After depmod completes, all PCI devices that are supported by modules in the kernel are listed, along with their module names, in that file.
When the kernel tells the hotplug system that a new PCI device has been found, the hotplug system uses the modules.
This structure consists of a number of function callbacks and variables that describe the PCI driver to the PCI core.
It must be unique among all PCI drivers in the kernel and is normally set to the same name as the module name of the driver.
If the driver does not want to claim the device, or an error occurs, it should return a negative error value.
More details about this function follow later in this chapter.
More details about this function follow later in this chapter.
The suspend state is passed in the state variable.
This function is optional; a driver does not have to provide it.
It is always called after suspend has been called.
This function is optional; a driver does not have to provide it.
It does not return the number of devices that were bound to the driver or an error number if no devices were bound to the driver.
This is a change from kernels prior to the 2.
It is helpful if drivers can be loaded before the device appears, to reduce the time it takes to initialize a device.
This is very useful if a new device is being used that the kernel doesn't know about just yet.
If a driver was not allowed to load until a device was present in the system, this interface would not be able to work.
Instead, they would either walk the list of PCI devices in the system by hand, or they would call a function that could search for a specific PCI device.
The ability to walk the list of PCI devices in the system within a driver has been removed from the 2.
This prevents the structure from disappearing without isa slot pin configuration notice and ensures that the kernel does not oops.
The from argument is used to get hold of multiple devices with the same signature; the argument should point to the last device that has been found, so that the search can continue instead of restarting from the head of the list.
To find the first device, from is specified as NULL.
If no further device is found, NULL is returned.
If it is, a warning is printed out to the system log.
This function can not be called from interrupt context.
If it is, a warning is printed out to the system log.
If a device is found that matches, its reference count is incremented and a pointer to it is returned.
All of these functions can not be called from interrupt context.
If they are, a warning is printed out to the system log.
This happens, for example, with CardBus devices which have been made completely equivalent to PCI at the driver level.
Accessing the Configuration Space After the driver has detected the device, it usually needs to read from or write to the three address spaces: memory, port, and configuration.
Because the microprocessor has no way to access the configuration space directly, the computer vendor has to provide a way to do it.
To access configuration space, the CPU must write and read registers in the PCI controller, but the exact implementation is vendor dependent and not relevant to this discussion, because Linux offers a standard interface to access the configuration space.
As far as the driver is concerned, the configuration space can be accessed through 8-bit, 16-bit, or 32-bit data transfers.
The where argument is the byte offset from the beginning of the configuration space.
The value fetched from the configuration space is returned through the val pointer, and the return value of the functions is an error code.
The word and dword functions convert the value just read from little-endian to the native byte order of the processor, so you need not deal with byte ordering.
The device is identified by dev as usual, and the value being written is passed as val.
The word and dword functions convert the value to little-endian before writing to the peripheral device.
source of the previous functions are implemented as inline functions that really call the following functions.
Peripherals that map their control registers to a memory address range declare that range as nonprefetchable, whereas something like video memory on PCI boards is prefetchable.
It is possible for one device to offer both 32-bit regions and 64-bit regions.
The region is selected by the integer bar the base address registerranging from 0-5 inclusive.
Note that this is the last usable address, not the first address after the region.
Resource flags are used to define some features of the individual resource.
The latter flag is never set for PCI resources.
PCI Interrupts As far as interrupts are concerned, PCI is easy to handle.
By the time Linux boots, the computer's firmware has already assigned a unique interrupt number to the device, and the driver just needs to use it.
This allows for as many as 256 interrupt lines, but the actual limit depends on the CPU being used.
Thus, PCI-specific code for dealing with interrupts just needs to read the configuration byte to obtain the interrupt number that is saved in a local variable, as shown in the following code.
Beyond that, the information in applies.
A PCI connector has four interrupt pins, and peripheral boards can use any or all of them.
Each pin is individually routed to the motherboard's interrupt controller, so interrupts can be shared without any electrical problems.
The interrupt controller is then responsible for mapping the interrupt wires pins to the processor's hardware; this platform-dependent operation is left to the controller in order to achieve platform independence in the bus itself.
It's worth remembering that each device board can host up to eight devices; each device uses a single interrupt pin and reports it in its own configuration register.
Different devices on the same device board can use different interrupt pins or share the same one.
When the computer is booted, the firmware scans its PCI devices and sets the register for each device according to how the interrupt pin is routed for its PCI slot.
The value is assigned by the firmware, because only the firmware knows how the motherboard routes the different interrupt pins to the processor.
Interestingly, recent versions of the Linux kernel under some circumstances can assign interrupt lines without resorting to the BIOS.
Hardware Abstractions We complete the discussion of PCI by taking a quick look at how the system handles the plethora of PCI controllers available on the marketplace.
This is just an informational section, meant to show the curious reader how the object-oriented layout of the kernel extends down to the lowest mesin slot heat />The mechanism used to implement hardware abstraction is the usual structure containing methods.
It's a powerful technique that adds just the minimal overhead of dereferencing a pointer to the normal overhead of a function call.
The two functions that act on the PCI configuration space have more overhead than dereferencing a pointer; they use cascading ultimate grill thrills slot due to the high object-orientedness of the code, but the overhead is not an issue in operations that are performed quite rarely and never in speed-critical paths.
Implementing hardware abstraction via "hardware operations" data structures is typical in the Linux kernel.
It is defined in and takes care of everything that may change across different Alpha-based computers.
A Look Back: ISA The ISA bus is quite old in design and is a notoriously poor performer, but it still holds a good part of the market for extension devices.
If speed is not important and you want to support old motherboards, an ISA implementation is preferable to PCI.
An additional advantage of this old standard is that if you are an electronic hobbyist, you can easily build your own ISA devices, something definitely not possible with PCI.
On the other hand, a great disadvantage of ISA is that it's tightly bound to the PC architecture; the interface bus has all the limitations of the 80286 processor and causes endless pain to system programmers.
The other great problem with the ISA design inherited from the original IBM PC is the lack of geographical addressing, which has led to many problems and lengthy unplug-rejumper-plug-test cycles to add new devices.
It's interesting to note that even the oldest Apple II computers were already exploiting geographical addressing, and they featured jumperless expansion boards.
Despite its great disadvantages, ISA is still used in several unexpected places.
For example, the VR41xx series of MIPS processors used in several palmtops features an ISA-compatible expansion bus, strange as it seems.
The reason behind these unexpected uses of ISA is the extreme low cost of some legacy hardware, such as 8390-based Ethernet cards, so a CPU with ISA electrical signaling can easily exploit the awful, but cheap, PC devices.
This limits the usable address space to 1024 ports, because any address in the range 1 KB to 64 KB is mistaken for a low address by any device that decodes only the low address lines.
Some peripherals circumvent this limitation by mapping only one port into the low kilobyte and using the high address lines to select between different device registers.
For example, a device mapped at 0x340 can safely use port 0x740, 0xB40, and so on.
The 640-KB to 1-MB range is used by the PC BIOS, by VGA-compatible video boards, and by various other devices, leaving little space available for new devices.
Memory at 15 MB, on the other hand, is not directly supported by Linux, and hacking the kernel to support it is a waste of programming time nowadays.
The third resource available to ISA device boards is interrupt lines.
A limited number of interrupt lines is routed to the ISA bus, and they are shared by all the interface boards.
As a result, if devices aren't properly configured, they can find themselves using the same interrupt lines.
Although the original ISA specification doesn't allow interrupt sharing across devices, most device boards allow it.
ISA Programming As far as programming is concerned, there's no specific aid in the kernel or the BIOS to ease access to ISA devices like there is, for example, for PCI.
The Plug-and-Play Specification Some new ISA device boards follow peculiar design rules and require a special initialization sequence intended to simplify installation and configuration of add-on interface boards.
retro slot car racing specification for the design of these boards is called plug and play PnP and consists of a isa slot pin configuration rule set for building and configuring jumperless ISA devices.
In short, the goal of PnP is to obtain the same flexibility found in PCI devices without changing the underlying electrical interface the ISA bus.
To this end, the specs define a set of device-independent configuration registers and a way to geographically address the interface boards, even though the physical bus doesn't carry per-board geographical wiring—every ISA signal line connects to every available slot.
Geographical addressing works by assigning a small integer, called the card select number CSNto each PnP peripheral in the computer.
Each PnP device features a unique serial identifier, 64 bits wide, that is hardwired into the peripheral board.
CSN assignment uses the unique serial number to identify the PnP devices.
But the CSNs can be assigned safely only at boot time, which requires the BIOS to be PnP aware.
For this reason, old computers require the user to obtain and insert a specific configuration diskette, even if the device is PnP capable.
Interface boards following the PnP specs are complicated at the hardware level.
They are much more elaborate than PCI boards and require complex software.
It's much better to install PCI devices whenever possible and enjoy the new technology instead.
Both are standard in PC-class single-board computers.
The practical advantage of these buses is that they allow circuit boards to be stacked vertically using a plug-and-socket kind of connector on one side of the device.
Other PC Buses PCI and ISA are the most commonly used peripheral interfaces in the PC world, but they aren't the only ones.
Here's a summary of the features of other buses found in the PC market.
At the hardware level, Micro Channel has more features than ISA.
It supports multimaster DMA, 32-bit address and data lines, shared interrupt lines, and geographical addressing to access per-board configuration registers.
Such registers are called Programmable Option Select POSbut they don't have all the features of the PCI registers.
Linux support for Micro Channel includes functions that are exported to modules.
EISA The Extended ISA EISA bus is a 32-bit extension to ISA, with a compatible interface connector; ISA device boards can be plugged into an EISA connector.
The additional wires are routed under the ISA contacts.
Like PCI isa slot pin configuration MCA, the EISA bus is designed to host jumperless devices, and it has the same features as MCA: 32-bit address and data lines, multimaster DMA, and shared interrupt lines.
EISA devices are configured by software, but they don't need any particular operating system support.
EISA drivers already exist in the Linux kernel for Ethernet devices and SCSI controllers.
Both symbols are defined in.
The kernel has full EISA support for devices with sysfs and resource management functionality.
VLB Another extension to ISA is the VESA Local Bus VLB interface bus, go here extends the ISA connectors by adding a third lengthwise slot.
A device can just plug into this extra connector without plugging in the two associated ISA connectorsbecause the VLB slot duplicates all important signals from the ISA connectors.
Such "standalone" VLB peripherals not using the ISA slot are rare, because most devices need to reach the back panel so that their external connectors are available.
The VESA bus is much more limited in its capabilities than the EISA, MCA, and PCI buses and is disappearing from the market.
No special kernel support exists for VLB.
However, both the Lance Ethernet driver and the IDE disk driver in Linux 2.
SBus While most computers nowadays are equipped with a PCI or ISA interface bus, most older SPARC-based workstations use SBus to connect their peripherals.
SBus is quite an advanced design, although it has been around for a long time.
In other words, you can't plug additional RAM into SBus slots RAM expansion boards have long been forgotten even in the ISA world, and PCI does not support them either.
This optimization is meant to simplify the design of both hardware devices and system software, at the expense of some additional complexity in the motherboard.
The motherboard is responsible for decoding the virtual addresses and mapping them to physical addresses.
This requires attaching an MMU memory management unit to the bus; the chipset in visit web page of the task is called IOMMU.
Although somehow more complex than using physical addresses on the interface bus, this design is greatly simplified by the fact that SPARC processors have always been designed by keeping the MMU core separate from the CPU core either physically or at least conceptually.
Actually, this design choice is shared by other smart processor designs and is beneficial overall.
Another feature of this bus is that device boards exploit massive geographical addressing, so there's no need to implement an address decoder in every peripheral or to article source with address conflicts.
SBus peripherals use the Forth language in their PROMs to initialize themselves.
Forth was chosen because the interpreter is lightweight and, therefore, can be easily implemented in the firmware of any computer system.
This was a great step to support multi-platform devices; it's a completely different world from the PC-centric ISA stuff we were used to.
However, it didn't succeed for a variety of commercial reasons.
Although current kernel versions offer quite full-featured support for SBus devices, the bus is used so little nowadays that it's not worth covering in detail here.
NuBus Another interesting, but nearly forgotten, interface bus is NuBus.
It is found on older Mac computers those with the M68k family of CPUs.
All of the bus is memory-mapped like everything with the M68kand the devices are only geographically addressed.
This is good just click for source typical of Apple, as the much older Apple II already had a similar bus layout.
What is bad is that it's almost impossible to find documentation on NuBus, due to the close-everything policy Apple https://indonesiaairsoft.com/slot/thunderstruck-slot-mobile.html always followed with its Mac computers and unlike the previous Apple II, whose source code and schematics were available at little cost.
External Buses One of the most recent entries in the field of interface buses is the whole class of external buses.
This includes USB, FireWire, and IEEE1284 parallel-port-based external bus.
Conceptually, these buses are neither full-featured interface buses like PCI is nor dumb communication channels like the serial ports are.
It's hard to classify the software that is needed to exploit their features, as it's usually split into two levels: the driver for the hardware controller like drivers for PCI SCSI adaptors or PCI controllers introduced in the and the driver for the specific "client" device like sd.
All PCI drivers must define this.
The return value is NULL if none is found.
The return value is NULL if none is found.
Although the Linux kernel takes care of byte ordering, the programmer must be careful about byte ordering when assembling multibyte values from individual bytes.
The PCI bus is little-endian.
A list is included in the file pci.
The kernel version of this file will not be included in future kernel series.
The bits are defined in.
If, on the other hand, the device uses a pull-up resistor to the inactive logic level, sharing is possible.
This is the norm nowadays.
However, there's still a potential risk of losing interrupt events since ISA interrupts are edge triggered instead of level triggered.
Edge-triggered interrupts are easier to implement in hardware but don't lend themselves to safe sharing.
With Safari, you learn the way you learn best.
Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.
Tested for legacy ISA Slot Card
Chapter 4 PIN Assignments and Cable Wiring ... Locate an available 16-bit ISA expansion slot. Remove the. Locate an available 32-bit PCI expansion slot.
And not so happens))))
I can speak much on this theme.
Willingly I accept. The question is interesting, I too will take part in discussion.
I think it already was discussed.