How to change PCI interrupts?

We are trying to duplicate an experiment setup which uses QNX 6.1 and I am having some problems with the new computer. I am mostly a software guy, I don’t know much about hardware but I believe the problem is about some interrupts clashing.

The problem is when the PCI card is initialized and some FIFO open is attempted over the network with another QNX machine, the network goes down. The same cards and programs works fine with the current computers. I tested the new card with the old computers and it works fine. I tested the FIFO part without the PCI initialization and the network stays alive. I tested the card initalization without the FIFO part and again there are no problems.

So I believe it is an interrupt issue since sometimes it doesn’t occur and its timing (when the network goes down) is not definite, changes from run to run.

Unfortunately the BIOS of the motherboard we have does not allow specifying Interrupts per PCI slot. You can only select which ones to exclude to be used by the PCI devices. I tried changing slots of the ethernet card and the PCI card and tried allowing different sets of interrupts to be used by the PCI devices but to no avail. I can make these two having different interrupts but there is generally a sharing with other devices. I disable as much staff as possible from the BIOS but pci -v stil shows other devices like an built-in LAN device.

So I was wondering firstly if this looks like an interrupt problem as I suspect. If it is, is there a way to change the BIOS assigned interrupts of the PCI card and the ethernet card to some unused interrupts afterwards. Can one utilize pci-bios, pci_config_read, pci_config_write for this? Or will it help using pci_detach_device on the other devices that use the same interrupts? The help files doesn’t say much about these.

Thanks a lot for any suggestions/help. I am stuck with this issue for the last 8 days and I have to do many other things before I leave my current job next month.

I’ll post some more information below.

iZzeT

PCI card:

Vendor ID      = 124bh, GreenSpring Computers

Ethernet card is the 3Com one below:

Current pci -v:

PCI version    = 2.10

Class          = Bridge (Host/PCI)
Vendor ID      = 10deh, Nvidia Corporation
Device ID      = 1e0h, Unknown Unknown
PCI index      = 0h
Class Codes    = 060000h
Revision ID    = c1h
Bus number     = 0
Device number  = 0
Function num   = 0
Status Reg     = b0h
Command Reg    = 6h
Header type    = 0h Multi-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 0h
Cache Line Size= 0h
Subsystem Vendor ID = 1043h
Subsystem ID        = 80ach
Max Lat        = 0ns
Min Gnt        = 0ns
PCI Int Pin    = NC
Interrupt line = 0
Capabilities Pointer = 40h
Capability ID        = 2h
Capabilities         = 30h - 1f00421bh
Capability ID        = 8h
Capabilities         = 2001h - 80880020h

Class          = Memory (RAM)
Vendor ID      = 10deh, Nvidia Corporation
Device ID      = 1ebh, Unknown Unknown
PCI index      = 0h
Class Codes    = 050000h
Revision ID    = c1h
Bus number     = 0
Device number  = 0
Function num   = 1
Status Reg     = 20h
Command Reg    = 0h
Header type    = 0h Multi-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 0h
Cache Line Size= 0h
Subsystem Vendor ID = 1043h
Subsystem ID        = 80ach
Max Lat        = 0ns
Min Gnt        = 0ns
PCI Int Pin    = NC
Interrupt line = no connection

Class          = Memory (RAM)
Vendor ID      = 10deh, Nvidia Corporation
Device ID      = 1eeh, Unknown Unknown
PCI index      = 0h
Class Codes    = 050000h
Revision ID    = c1h
Bus number     = 0
Device number  = 0
Function num   = 2
Status Reg     = 20h
Command Reg    = 0h
Header type    = 0h Multi-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 0h
Cache Line Size= 0h
Subsystem Vendor ID = 1043h
Subsystem ID        = 80ach
Max Lat        = 0ns
Min Gnt        = 0ns
PCI Int Pin    = NC
Interrupt line = no connection

Class          = Memory (RAM)
Vendor ID      = 10deh, Nvidia Corporation
Device ID      = 1edh, Unknown Unknown
PCI index      = 0h
Class Codes    = 050000h
Revision ID    = c1h
Bus number     = 0
Device number  = 0
Function num   = 3
Status Reg     = 20h
Command Reg    = 0h
Header type    = 0h Multi-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 0h
Cache Line Size= 0h
Subsystem Vendor ID = 1043h
Subsystem ID        = 80ach
Max Lat        = 0ns
Min Gnt        = 0ns
PCI Int Pin    = NC
Interrupt line = 0

Class          = Memory (RAM)
Vendor ID      = 10deh, Nvidia Corporation
Device ID      = 1ech, Unknown Unknown
PCI index      = 0h
Class Codes    = 050000h
Revision ID    = c1h
Bus number     = 0
Device number  = 0
Function num   = 4
Status Reg     = 20h
Command Reg    = 0h
Header type    = 0h Multi-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 0h
Cache Line Size= 0h
Subsystem Vendor ID = 1043h
Subsystem ID        = 80ach
Max Lat        = 0ns
Min Gnt        = 0ns
PCI Int Pin    = NC
Interrupt line = no connection

Class          = Memory (RAM)
Vendor ID      = 10deh, Nvidia Corporation
Device ID      = 1efh, Unknown Unknown
PCI index      = 0h
Class Codes    = 050000h
Revision ID    = c1h
Bus number     = 0
Device number  = 0
Function num   = 5
Status Reg     = 20h
Command Reg    = 0h
Header type    = 0h Multi-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 0h
Cache Line Size= 0h
Subsystem Vendor ID = 1043h
Subsystem ID        = 80ach
Max Lat        = 0ns
Min Gnt        = 0ns
PCI Int Pin    = NC
Interrupt line = no connection

Class          = Bridge (PCI/ISA)
Vendor ID      = 10deh, Nvidia Corporation
Device ID      = 60h, Unknown Unknown
PCI index      = 0h
Class Codes    = 060100h
Revision ID    = a4h
Bus number     = 0
Device number  = 1
Function num   = 0
Status Reg     = b0h
Command Reg    = fh
Header type    = 0h Multi-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 0h
Cache Line Size= 0h
Subsystem Vendor ID = 1043h
Subsystem ID        = 80adh
Max Lat        = 0ns
Min Gnt        = 0ns
PCI Int Pin    = NC
Interrupt line = 0
Capabilities Pointer = 48h
Capability ID        = 8h
Capabilities         = 1e1h - 8880060h

Class          = Serial Bus (SMBus)
Vendor ID      = 10deh, Nvidia Corporation
Device ID      = 64h, Unknown Unknown
PCI index      = 0h
Class Codes    = 0c0500h
Revision ID    = a2h
Bus number     = 0
Device number  = 1
Function num   = 1
Status Reg     = b0h
Command Reg    = 1h
Header type    = 0h Multi-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 0h
Cache Line Size= 0h
PCI IO Address  = e000h length 32 enabled
Subsystem Vendor ID = 1043h
Subsystem ID        = c11h
Max Lat        = 1ns
Min Gnt        = 3ns
PCI Int Pin    = INT A
Interrupt line = 7
Capabilities Pointer = 44h
Capability ID        = 1h
Capabilities         = c002h - 0h

Class          = Bridge (PCI/PCI)
Vendor ID      = 10deh, Nvidia Corporation
Device ID      = 6ch, Unknown Unknown
PCI index      = 0h
Class Codes    = 060400h
Revision ID    = a3h
Bus number     = 0
Device number  = 8
Function num   = 0
Status Reg     = a0h
Command Reg    = 107h
Header type    = 1h Single-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 0h
Cache Line Size= 0h
Primary Bus Number       = 0h
Secondary Bus Number     = 1h
Subordinate Bus Number   = 1h
Secondary Latency Timer  = 20h
I/O Base                 = a0h
I/O Limit                = b0h
Secondary Status         = a280h
Memory Base              = e000h
Memory Limit             = e7f0h
Prefetchable Memory Base = fff0h
Prefetchable Memory Limit= 0h
Prefetchable Base Upper 32 Bits  = 0h
Prefetchable Limit Upper 32 Bits = 0h
I/O Base Upper 16 Bits   = ffffh
I/O Limit Upper 16 Bits  = ffffh
Bridge Control           = 1026ns
PCI Int Pin              = NC
Interrupt line           = 0

Class          = Mass Storage (IDE)
Vendor ID      = 10deh, Nvidia Corporation
Device ID      = 65h, Unknown Unknown
PCI index      = 0h
Class Codes    = 01018ah
Revision ID    = a2h
Bus number     = 0
Device number  = 9
Function num   = 0
Status Reg     = b0h
Command Reg    = 5h
Header type    = 0h Single-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 0h
Cache Line Size= 0h
PCI IO Address  = f000h length 16 enabled
Subsystem Vendor ID = 1043h
Subsystem ID        = c11h
Max Lat        = 1ns
Min Gnt        = 3ns
PCI Int Pin    = NC
Interrupt line = 0
Capabilities Pointer = 44h
Capability ID        = 1h
Capabilities         = 2h - 0h

Class          = Bridge (PCI/PCI)
Vendor ID      = 10deh, Nvidia Corporation
Device ID      = 1e8h, Unknown Unknown
PCI index      = 0h
Class Codes    = 060400h
Revision ID    = c1h
Bus number     = 0
Device number  = 30
Function num   = 0
Status Reg     = 220h
Command Reg    = 107h
Header type    = 1h Single-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 20h
Cache Line Size= 0h
Primary Bus Number       = 0h
Secondary Bus Number     = 2h
Subordinate Bus Number   = 2h
Secondary Latency Timer  = 20h
I/O Base                 = d0h
I/O Limit                = d0h
Secondary Status         = 2220h
Memory Base              = ec00h
Memory Limit             = edf0h
Prefetchable Memory Base = d000h
Prefetchable Memory Limit= dff0h
Prefetchable Base Upper 32 Bits  = 0h
Prefetchable Limit Upper 32 Bits = 0h
I/O Base Upper 16 Bits   = ffffh
I/O Limit Upper 16 Bits  = ffffh
Bridge Control           = 10ns
PCI Int Pin              = NC
Interrupt line           = 0

Class          = Network (Ethernet)
Vendor ID      = 11abh, Galileo Technology Ltd.
Device ID      = 4320h, Unknown Unknown
PCI index      = 0h
Class Codes    = 020000h
Revision ID    = 13h
Bus number     = 1
Device number  = 4
Function num   = 0
Status Reg     = 2b0h
Command Reg    = 7h
Header type    = 0h Single-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 20h
Cache Line Size= 8h un-cacheable
PCI Mem Address = e5000000h 32bit length 16384 enabled
PCI IO Address  = a000h length 256 enabled
Subsystem Vendor ID = 1043h
Subsystem ID        = 811ah
Max Lat        = 31ns
Min Gnt        = 23ns
PCI Int Pin    = INT A
Interrupt line = 7
Capabilities Pointer = 48h
Capability ID        = 1h
Capabilities         = fe02h - c002e00h
Capability ID        = 3h
Capabilities         = 8000h - 0h

Class          = Network (Ethernet)
Vendor ID      = 10b7h, 3Com Corporation
Device ID      = 9055h, 3C905B-TX Fast Etherlink 10/100 PCI TX NIC
PCI index      = 0h
Class Codes    = 020000h
Revision ID    = 30h
Bus number     = 1
Device number  = 7
Function num   = 0
Status Reg     = 210h
Command Reg    = 7h
Header type    = 0h Single-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 20h
Cache Line Size= 8h un-cacheable
PCI IO Address  = a400h length 128 enabled
PCI Mem Address = e5005000h 32bit length 128 enabled
Subsystem Vendor ID = 10b7h
Subsystem ID        = 9055h
PCI Expansion ROM = e0000000h length 131072 disabled
Max Lat        = 10ns
Min Gnt        = 10ns
PCI Int Pin    = INT A
Interrupt line = 7
Capabilities Pointer = dch
Capability ID        = 1h
Capabilities         = 7601h - 0h

Class          = Bridge (Unknown)
Vendor ID      = 124bh, GreenSpring Computers
Device ID      = 40h, Unknown Unknown
PCI index      = 0h
Class Codes    = 068000h
Revision ID    = bh
Bus number     = 1
Device number  = 8
Function num   = 0
Status Reg     = 280h
Command Reg    = 7h
Header type    = 0h Single-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 20h
Cache Line Size= 8h un-cacheable
Subsystem Vendor ID = 124bh
Subsystem ID        = 9080h
Max Lat        = 0ns
Min Gnt        = 0ns
PCI Int Pin    = INT A
Interrupt line = 11

Class          = Mass Storage (RAID)
Vendor ID      = 1095h, CMD Technology Inc.
Device ID      = 3112h, Unknown Unknown
PCI index      = 0h
Class Codes    = 010400h
Revision ID    = 2h
Bus number     = 1
Device number  = 11
Function num   = 0
Status Reg     = 2b0h
Command Reg    = 7h
Header type    = 0h Single-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 20h
Cache Line Size= 8h un-cacheable
PCI IO Address  = ac00h length 8 enabled
PCI IO Address  = b000h length 4 enabled
PCI IO Address  = b400h length 8 enabled
PCI IO Address  = b800h length 4 enabled
PCI IO Address  = bc00h length 16 enabled
PCI Mem Address = e5006000h 32bit length 512 enabled
Subsystem Vendor ID = 1095h
Subsystem ID        = 6112h
Max Lat        = 0ns
Min Gnt        = 0ns
PCI Int Pin    = INT A
Interrupt line = 11
Capabilities Pointer = 60h
Capability ID        = 1h
Capabilities         = 622h - 64004000h

Class          = Display (VGA)
Vendor ID      = 1002h, ATI Technologies
Device ID      = 5964h, Unknown Unknown
PCI index      = 0h
Class Codes    = 030000h
Revision ID    = 1h
Bus number     = 2
Device number  = 0
Function num   = 0
Status Reg     = 2b0h
Command Reg    = 6h
Header type    = 0h Multi-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 20h
Cache Line Size= 8h un-cacheable
PCI Mem Address = d0000000h prefetchable 32bit length 134217728 enabled
PCI IO Address  = d000h length 256 disabled
PCI Mem Address = ed000000h 32bit length 65536 enabled
Subsystem Vendor ID = 1043h
Subsystem ID        = c008h
PCI Expansion ROM = ec000000h length 131072 disabled
Max Lat        = 0ns
Min Gnt        = 8ns
PCI Int Pin    = INT A
Interrupt line = 7
Capabilities Pointer = 58h
Capability ID        = 2h
Capabilities         = 30h - ff00021bh
Capability ID        = 1h
Capabilities         = 602h - 0h

Class          = Display (Unknown)
Vendor ID      = 1002h, ATI Technologies
Device ID      = 5d44h, Unknown Unknown
PCI index      = 0h
Class Codes    = 038000h
Revision ID    = 1h
Bus number     = 2
Device number  = 0
Function num   = 1
Status Reg     = 2b0h
Command Reg    = 0h
Header type    = 0h Single-function
BIST           = 0h Build-in-self-test not supported
Latency Timer  = 20h
Cache Line Size= 8h un-cacheable
PCI Mem Address = 0h prefetchable 32bit length 134217728 disabled
Subsystem Vendor ID = 1043h
Subsystem ID        = c009h
Max Lat        = 0ns
Min Gnt        = 8ns
PCI Int Pin    = NC
Interrupt line = no connection
Capabilities Pointer = 50h
Capability ID        = 1h
Capabilities         = 602h - 0h

Card initialization code snippet (written by the previous programmer so I don’t have much info how it works, I was just using it until now):

CardGreenSpringPCI40A :: CardGreenSpringPCI40A()
: disableInterruptsOnDestruct(true)
{

  PCIDevice::setVendorID( 0x124b );
  PCIDevice::setDeviceID( 0x40 );
  PCIDevice::queryFromConfigurationSpace();

  int64_t ba;
  std::cerr << "GreenSpring PCI40A\n"
  std::cerr.setf( std::ios::hex, std::ios::basefield );

  for ( int i = 0; i < 5; i++ ) {
    ba = PCIDevice::getBaseAddress(i);
    std::cerr << "  Base address " << i << ": " << (long)ba << "\n"
  }

  std::cerr.setf( std::ios::dec, std::ios::basefield );

  std::cerr << "  Interrupt Line: " << PCIDevice::getInterruptLine() << \n"

  initialize();

}

void CardGreenSpringPCI40A :: initialize() {

  std::cerr << "Initializing PCI40A.\n"

  IPBaseAddress = PCIDevice::getBaseAddress(2);
  PLXBaseAddress = PCIDevice::getBaseAddress(0);

  MappedPhysicalMemoryArray< uint8_t, 1 > mem8;
  MappedPhysicalMemoryArray< uint32_t, 1 > mem32;

  pCNTL0 = mem8.mapAddress( IPBaseAddress + Def::CNTL0_OFFSET );
  pCNTL1 = mem8.mapAddress( IPBaseAddress + Def::CNTL1_OFFSET );
  pCNTL2 = mem8.mapAddress( IPBaseAddress + Def::CNTL2_OFFSET );
  pDMACSR0 = mem8.mapAddress( PLXBaseAddress + Def::DMACSR0_OFFSET );
  pDMACSR1 = mem8.mapAddress( PLXBaseAddress + Def::DMACSR1_OFFSET );
  pIntControl = mem32.mapAddress( PLXBaseAddress + Def::ICSR_OFFSET );
  pDMAMODE0 = mem32.mapAddress( PLXBaseAddress + Def::DMAMODE0_OFFSET );
  pDMAMODE1 = mem32.mapAddress( PLXBaseAddress + Def::DMAMODE1_OFFSET );
}

//////////////////// NEW PCIDevice (maybe errors)
// errors fixed 9-12-01

PCIDevice::PCIDevice ()
: vendorID(0),
  deviceID(0),
  deviceIndex(0)
{};

void PCIDevice::setVendorDeviceIndex( unsigned int vid, unsigned int did, int di = 0 ) {
  vendorID = vid;
  deviceID = did;
  deviceIndex = di;
  query();   // use default PCI query function
}

void PCIDevice::setDeviceID( unsigned int did ) {
  deviceID = did;
}

void PCIDevice::setVendorID( unsigned int vid ) {
  vendorID = vid;
}

void PCIDevice::setIndexNumber( unsigned int di ) {
  deviceIndex = di;
}

void PCIDevice::queryFromConfigurationSpace() {

  std::cerr << "Executing query from configuration space.\n"

  int pciHandle;
  struct pci_dev_info deviceInfo;
  void* deviceHandle;
  deviceHandle = NULL;
  pciHandle = pci_attach( 0 );
  if (pciHandle == 0) {
    std::cerr << "Failed to start PCI service. (PCIDevice::query())\n"
    exit(0);
  }

  std::cerr.setf( std::ios::hex, std::ios::basefield );
  std::cerr << "Vendor ID = " << vendorID << "\n"
  std::cerr << "Device ID = " << deviceID << "\n"
  std::cerr << "Device Index = " << deviceIndex << "\n"
  std::cerr.setf( std::ios::dec, std::ios::basefield );

  memset( &deviceInfo, 0, sizeof(deviceInfo) );
  deviceInfo.VendorId = vendorID;
  deviceInfo.DeviceId = deviceID;

  deviceHandle = pci_attach_device( NULL, PCI_SHARE | PCI_SEARCH_VENDEV | PCI_INIT_ALL, deviceIndex, &deviceInfo );

  if (deviceHandle == NULL) {
    std::cerr << "Failed to find PCI device.\nAre you running as root? (PCIDevice::query())\n";
    exit(0);
  }

  unsigned int baseAddressBuffer[6];

  int ret;
  ret = pci_read_config( deviceHandle, 0x10, 6, sizeof(unsigned int), &baseAddressBuffer );

  checkReadConfigReturnValue( ret );

  for ( int i = 0; i < 6; i++ ) {
    baseAddress[i] = baseAddressBuffer[i];
  }

  uint8_t interruptLineBuffer[1];
  ret = pci_read_config( deviceHandle, 0x3C, 1, sizeof( uint8_t ), &interruptLineBuffer );

  checkReadConfigReturnValue( ret );

  interruptLine = interruptLineBuffer[0];

  pci_detach_device( deviceHandle );
  pci_detach( pciHandle );

}