Commit | Line | Data |
---|---|---|
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> | |
12 | virtual const char *devif_getBusName(); | |
13 | virtual int devif_getDevice(); | |
14 | virtual int devif_getFunction(); | |
15 | virtual module_t *devif_getInstance(); | |
16 | virtual const char *devif_getName(); | |
17 | virtual 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> | |
22 | This is an abstract class that defines the interface to a PCI device. | |
23 | A 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. | |
26 | The type of access is indicated by <i>pci_space_t</i>: configuration, I/O, mem32, or mem64. | |
27 | pci_dev.h defines a stub function which returns -1. | |
28 | Most devices will define this function. | |
29 | It 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 | |
35 | void* | |
36 | Sample::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> |