Initial commit of OpenSPARC T2 architecture model.
[OpenSPARC-T2-SAM] / sam-t2 / docs / mmi / PciDevIf.html
CommitLineData
920dae64
AT
1<html>
2<head>
3<title>SPARC Architectural Model: Device and Utility API</title>
4</head>
5<body bgcolor="#FFFFFF" LANG="en-US">
6
7<h2>class PciDevIf</h2>
8#include "pci.h"
9
10<font size=-1>
11<pre>
12virtual const char *devif_getBusName();
13virtual int devif_getDevice();
14virtual int devif_getFunction();
15virtual module_t *devif_getInstance();
16virtual const char *devif_getName();
17virtual int devif_access(pci_space_t, uint64_t paddr, uint64_t offset, bool_t wr, uint32_t size, uint64_t* buf);
18</pre>
19</font>
20
21<h4>Description</h4>
22This is an abstract class that defines the interface to a PCI device.
23A PCI bus calls this interface in each of its devices.
24<p>This interface is included with <b>class PciDev</b> and mostly handled by <b>common/pci_dev.h</b>.
25<p><b>devif_access</b> is downstream I/O access to a device.
26The type of access is indicated by <i>pci_space_t</i>: configuration, I/O, mem32, or mem64.
27pci_dev.h defines a stub function which returns -1.
28Most devices will define this function.
29It is the main entry point for performing I/O to a device.
30<p>The other interfaces are all defined in pci_dev.h. They return information about the device.
31<p>All PCI device modules must export this interface, for example:
32<font size=-1>
33<pre>
34// interface callback
35void*
36Sample::get_interface(const char *name)
37{
38 if (!strcmp(name, SAMPLE_INTERFACE))
39 return this;
40 if (!strcmp(name, PCI_DEV_INTERFACE))
41 return (PciDevIf*)this;
42 return NULL;
43}
44</pre>
45</font>
46</body>
47</html>