virtual const char *devif_getBusName(); virtual int devif_getDevice(); virtual int devif_getFunction(); virtual module_t *devif_getInstance(); virtual const char *devif_getName(); virtual int devif_access(pci_space_t, uint64_t paddr, uint64_t offset, bool_t wr, uint32_t size, uint64_t* buf);
This interface is included with class PciDev and mostly handled by common/pci_dev.h.
devif_access is downstream I/O access to a device. The type of access is indicated by pci_space_t: configuration, I/O, mem32, or mem64. pci_dev.h defines a stub function which returns -1. Most devices will define this function. It is the main entry point for performing I/O to a device.
The other interfaces are all defined in pci_dev.h. They return information about the device.
All PCI device modules must export this interface, for example:
// interface callback
void*
Sample::get_interface(const char *name)
{
if (!strcmp(name, SAMPLE_INTERFACE))
return this;
if (!strcmp(name, PCI_DEV_INTERFACE))
return (PciDevIf*)this;
return NULL;
}