int pcibios_find_class(unsigned int class_code, unsigned short index, unsigned char* bus, unsigned char* device_fn);
int pcibios_find_device(unsigned short vendor, unsigned short device_id , unsigned short index, unsigned char* bus, unsigned char* device_fn);
DESCRIPTION
The
pcibios_find_class
function searches for a certain class of device on the PCI bus. In this
instance, class is used to represent a few different categories of
devices. Some examples are storage, network, display, and memory
classes. The classes are defined by the PCI Specification, and the
class_code
is matched with the dword in the configuration space of the device at
offset 0x08.
The
pcibios_find_device
function finds a device on the PCI bus that has the matching device
and vendor ids. The vendor ids are assigned to the PCI Sig to vendors,
who in turn assign device ids to the devices they develop. The vendor
and device ids are encoded in dword 0x00 of the configuration space.
Both
pcibios_find_class
and
pcibios_find_device
include an extra
index
parameter, which is used to select the specific
device if there are multiple matches. An
index
of 0 matches the firts located board, 1 the second, and so on.
The
bus
and
device_fn
parameters are PCI specific cookies that are passed to other pcibios
functions to access the configuration space of the located device.
RETURN VALUE
On success, the functions return
PCIBIOS_SUCCESSFUL.
Otherwise, one of the following error codes is returned:
PCIBIOS_DEVICE_NOT_FOUND
There is no device that matches the search criteria,
PCIBIOS_BAD_VENDOR_ID
The vendor id is invalid. (0xffff is not a valid id.)