Device Drivers: PCI Functions

Described here are the functions that kernel-loaded drivers can use to get information about devices that are attached to the PCI bus. For more information on the PCI bus, refer to the PCI specification:

  • PCI Local Bus Specification, revision 2.1, June 1, 1995, PCI Special Interest Group, PO Box 14070, Portland OR 97214, (800) 433-5177 or (503) 797-4207


    get_nth_pci_info(), pci_info

    Declared in: be/drivers/PCI.h

    
          long get_nth_pci_info(long index, pci_info *info)
    
          typdef struct {...} pci_info

    get_nth_pci_info() returns a pci_info structure for the index'th PCI device currently attached to the computer. Indices begin at 0; there are no gaps in the list.

    The pci_info structure contains some common fields and a device-specific header:

    Field Meaning
    ushort vendor_id An identifier for the manufacturer of the device.
    ushort device_id An identifier for the device, assigned by the vendor.
    uchar bus The bus the device is on.
    uchar device The bus-relative device number.
    uchar function The function number in the device.
    uchar revision A device-specific version number, assigned by the vendor.
    uchar class_api The type of register-level interface to the device (the lower byte of the class code field).
    uchar class_sub The type of function the device performs (the middle byte of the class code field).
    uchar class_base The broadly-defined device type (the upper byte of the class code field).
    uchar line_size The size of the system cache line, in units of 32 bit words.
    uchar latency The latency timer for the PCI bus master.
    uchar bist The contents of the register for the built-in self test.
    uchar header_type The header type.
    union u A device-specific header structure.

    The definition of the structures that the u union points to is given in be/drivers/PCI.h. Currently, there are two structures, one for You'll also find a number of constants that you can use to test various fields of a pci_info structure.


    read_pci_config(), write_pci_config()

    Declared in: <drivers/PCI.h>

    
          long read_pci_config(uchar bus, uchar device, uchar function, 
             long offset, long size)
    
          void write_pci_config(uchar bus, uchar device, uchar function, 
             long offset, long size, long value)

    These functions read from and write to the PCI configuration register space.






    The Be Book, in lovely HTML, for BeOS Release 3.

    Copyright © 1998 Be, Inc. All rights reserved.

    Last modified March 27, 1998.