Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / docs / mmi / PciDevIf.html
<html>
<head>
<title>SPARC Architectural Model: Device and Utility API</title>
</head>
<body bgcolor="#FFFFFF" LANG="en-US">
<h2>class PciDevIf</h2>
#include "pci.h"
<font size=-1>
<pre>
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);
</pre>
</font>
<h4>Description</h4>
This is an abstract class that defines the interface to a PCI device.
A PCI bus calls this interface in each of its devices.
<p>This interface is included with <b>class PciDev</b> and mostly handled by <b>common/pci_dev.h</b>.
<p><b>devif_access</b> is downstream I/O access to a device.
The type of access is indicated by <i>pci_space_t</i>: 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.
<p>The other interfaces are all defined in pci_dev.h. They return information about the device.
<p>All PCI device modules must export this interface, for example:
<font size=-1>
<pre>
// 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;
}
</pre>
</font>
</body>
</html>