xref: /linux/include/uapi/linux/pci.h (revision 607ca46e97a1b6594b29647d98a32d545c24bdff)
1*607ca46eSDavid Howells /*
2*607ca46eSDavid Howells  *	pci.h
3*607ca46eSDavid Howells  *
4*607ca46eSDavid Howells  *	PCI defines and function prototypes
5*607ca46eSDavid Howells  *	Copyright 1994, Drew Eckhardt
6*607ca46eSDavid Howells  *	Copyright 1997--1999 Martin Mares <mj@ucw.cz>
7*607ca46eSDavid Howells  *
8*607ca46eSDavid Howells  *	For more information, please consult the following manuals (look at
9*607ca46eSDavid Howells  *	http://www.pcisig.com/ for how to get them):
10*607ca46eSDavid Howells  *
11*607ca46eSDavid Howells  *	PCI BIOS Specification
12*607ca46eSDavid Howells  *	PCI Local Bus Specification
13*607ca46eSDavid Howells  *	PCI to PCI Bridge Specification
14*607ca46eSDavid Howells  *	PCI System Design Guide
15*607ca46eSDavid Howells  */
16*607ca46eSDavid Howells 
17*607ca46eSDavid Howells #ifndef _UAPILINUX_PCI_H
18*607ca46eSDavid Howells #define _UAPILINUX_PCI_H
19*607ca46eSDavid Howells 
20*607ca46eSDavid Howells #include <linux/pci_regs.h>	/* The pci register defines */
21*607ca46eSDavid Howells 
22*607ca46eSDavid Howells /*
23*607ca46eSDavid Howells  * The PCI interface treats multi-function devices as independent
24*607ca46eSDavid Howells  * devices.  The slot/function address of each device is encoded
25*607ca46eSDavid Howells  * in a single byte as follows:
26*607ca46eSDavid Howells  *
27*607ca46eSDavid Howells  *	7:3 = slot
28*607ca46eSDavid Howells  *	2:0 = function
29*607ca46eSDavid Howells  */
30*607ca46eSDavid Howells #define PCI_DEVFN(slot, func)	((((slot) & 0x1f) << 3) | ((func) & 0x07))
31*607ca46eSDavid Howells #define PCI_SLOT(devfn)		(((devfn) >> 3) & 0x1f)
32*607ca46eSDavid Howells #define PCI_FUNC(devfn)		((devfn) & 0x07)
33*607ca46eSDavid Howells 
34*607ca46eSDavid Howells /* Ioctls for /proc/bus/pci/X/Y nodes. */
35*607ca46eSDavid Howells #define PCIIOC_BASE		('P' << 24 | 'C' << 16 | 'I' << 8)
36*607ca46eSDavid Howells #define PCIIOC_CONTROLLER	(PCIIOC_BASE | 0x00)	/* Get controller for PCI device. */
37*607ca46eSDavid Howells #define PCIIOC_MMAP_IS_IO	(PCIIOC_BASE | 0x01)	/* Set mmap state to I/O space. */
38*607ca46eSDavid Howells #define PCIIOC_MMAP_IS_MEM	(PCIIOC_BASE | 0x02)	/* Set mmap state to MEM space. */
39*607ca46eSDavid Howells #define PCIIOC_WRITE_COMBINE	(PCIIOC_BASE | 0x03)	/* Enable/disable write-combining. */
40*607ca46eSDavid Howells 
41*607ca46eSDavid Howells #endif /* _UAPILINUX_PCI_H */
42