SGI Techpubs Library

Linux  »  Books  »  Developer  »  
Linux Device Driver Programmer's Guide,Porting to SGI Altix Systems
(document number: 007-4520-007 / published: 2008-09-24)    table of contents  |  additional info  |  download
find in page

Chapter 6. PCI/PCI-X Configuration Space

Each PCI/PCI-X device has 256 bytes of configuration address space. Sixty-four bytes of this area are standardized as shown in Figure 6-1. For more details regarding these registers, see PCI-X System Architecture or PCI System Architecture.

Figure 6-1. PCI-X Configuration Space

PCI-X Configuration Space

On SGI Altix systems, the following registers in the PCI configuration space should not be used directly by device drivers:

  • Base address registers. These register values are not usable on the CPU as PIO addresses.

  • Expansion ROM base address registers. SGI Altix systems do not support loading and executing basic input/output systems (BIOS) code resident in PCI ROM. This register is not initialized. Drivers should ensure that all initialization is performed in the driver.

  • Interrupt Line. On legacy systems, this is the IRQ. SGI Altix systems support IRQs greater than 8 bits (greater than 256 IRQs). The interrupt line value is not used on SGI Altix systems.

Device drivers have to use the addresses and values provided in the pci_dev structure. For methods of programmatically finding your device pci_dev information, see Chapter 5, “Finding Your PCI Device”.

You can read and write PCI/PCI-X configuration space for your device by using the following PCI configuration space routines:

/usr/include/linux/pci.h:

        int pci_read_config_byte(struct pci_dev *dev,int where,u8 *ptr);
        
        int pci_read_config_word(struct pci_dev *dev,int where,u16 *ptr);

        int pci_read_config_dword(struct pci_dev *dev,int where, u32 *ptr);

        int pci_write_config_byte (struct pci_dev *dev,int where, u8 val);

        int pci_write_config_word (struct pci_dev *dev,int where, u16 val);

        int pci_write_config_word (struct pci_dev *, int where, u32 val);

        int pci_write_config_dword (struct pci_dev *dev,int where, u32 val);

Variables are as follows:
Variable 

Description

*dev 

Pointer to your device pci_dev structure

where 

Byte offset into the PCI configuration space of your device

*ptr 

Address of the location to store the byte read

val 

Value to write into the PCI configuration space of your device

Linux Device Driver Programmer's Guide,Porting to SGI Altix Systems
(document number: 007-4520-007 / published: 2008-09-24)    table of contents  |  additional info  |  download

    Front Matter
    New Features in This Guide
    About This Guide
    Chapter 1. Introduction
    Chapter 2. Architecture
    Chapter 3. PCI-X Device Attachment
    Chapter 4. PCI System Initialization
    Chapter 5. Finding Your PCI Device
    Chapter 6. PCI/PCI-X Configuration Space
    Chapter 7. PCI-X I/O and Memory Resources
    Chapter 8. PCI-X Interrupt Mechanism
    Chapter 9. PCI-X Direct Memory Access (DMA)
    Chapter 10. Device Driver Memory Usage
    Chapter 11. Time Management
    Chapter 12. Building Linux Kernels and Modules
    Appendix A. Memory Operation Ordering on SGI Altix Systems
    Index


home/search | what's new | help