debuggers.hg

view xen/include/xen/pci.h @ 0:7d21f7218375

Exact replica of unstable on 051908 + README-this
author Mukesh Rathor
date Mon May 19 15:34:57 2008 -0700 (2008-05-19)
parents
children 5c0bf00e371d
line source
1 /******************************************************************************
2 * pci.h
3 *
4 * PCI access functions.
5 */
7 #ifndef __XEN_PCI_H__
8 #define __XEN_PCI_H__
10 #include <xen/config.h>
11 #include <xen/types.h>
12 #include <xen/list.h>
14 /*
15 * The PCI interface treats multi-function devices as independent
16 * devices. The slot/function address of each device is encoded
17 * in a single byte as follows:
18 *
19 * 15:8 = bus
20 * 7:3 = slot
21 * 2:0 = function
22 */
23 #define PCI_DEVFN(slot,func) (((slot & 0x1f) << 3) | (func & 0x07))
24 #define PCI_SLOT(devfn) (((devfn) >> 3) & 0x1f)
25 #define PCI_FUNC(devfn) ((devfn) & 0x07)
27 struct pci_dev {
28 struct list_head list;
29 struct list_head msi_dev_list;
30 u8 bus;
31 u8 devfn;
32 struct list_head msi_list;
33 };
35 uint8_t pci_conf_read8(
36 unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg);
37 uint16_t pci_conf_read16(
38 unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg);
39 uint32_t pci_conf_read32(
40 unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg);
41 void pci_conf_write8(
42 unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
43 uint8_t data);
44 void pci_conf_write16(
45 unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
46 uint16_t data);
47 void pci_conf_write32(
48 unsigned int bus, unsigned int dev, unsigned int func, unsigned int reg,
49 uint32_t data);
50 int pci_find_cap_offset(u8 bus, u8 dev, u8 func, u8 cap);
51 int pci_find_next_cap(u8 bus, unsigned int devfn, u8 pos, int cap);
53 #endif /* __XEN_PCI_H__ */