Hello!

On Fri, 20 Dec 2002 17:53:36 +0100 (CET), kiewitz wrote:

>Example of some GCONFIG-API code:
>
>HWDEVICE  MyDevice;
>USHORT MyIRQ;
>
>if (MyDevice = PCI_FindDevice(0x1073, -1, PDD_FIND_STRAIGHT, 0)) {
>   MyIRQ = PDD_GetDeviceIRQ(MyDevice,0);
>   PrintF ("Yamaha found on %lx using %d!", &MyDevice, MyIRQ);
>   PCI_WriteConfigDWord (MyDevice, 64, 0x1000);
> }
>
>That's all the code needed to find the first PCI-device of vendor 0x1073 and 

Interesting. I have no idea (yet) how rich your API is, but in
DaniS506.ADD I have a quite elaborate code to find supported PCI
devices (for details see attachment):

enumerate *all* PCI functions on *all* PCI type buses. Take into
account that some old PCI bridges have badly broken PCI config spaces!
For each PCI function found do
{
  if (PCI class == PCI_MASS_STORAGE) {
    read PCI vendor and device id;
    match ids against a list of known devices to map functionally
identical chips to a single member;
    set compatible_device_id = remapped_device_id;
    match vendor id and compatible_device_id against a list of known
devices to map chips from the same "family" to a single representant;
    match family vendor and device id against a list of supported chip
families returning an index into this list;
    if (no match in list) {
      if ((PCI subclass == PCI_IDE_CONTROLLER) &&
          (PCI programming interface == LEGACY))
        if (PCI programming interface == PCI IDE busmaster)
          index = generic legacy SFF8038 compliant IDE busmaster
device;
        else
          index = generic legacy IDE device;
      else
        unknown/unsupported chip found;
    }
    if (supported chip found) {
      construct a IDE PCI device object instance from index into object
factory; 
      call "accept" method;
      if (instance acceptable)
        keep object instance;
      else
        destroy object instance;
    }
  }
}

In which way could GCONFIG help in this process ?

Ciao,
  Dani

Attachment: s506oemi.c
Description: Binary data

Reply via email to