Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 /*
0003  *  pci.h
0004  *
0005  *  PCI defines and function prototypes
0006  *  Copyright 1994, Drew Eckhardt
0007  *  Copyright 1997--1999 Martin Mares <mj@ucw.cz>
0008  *
0009  *  For more information, please consult the following manuals (look at
0010  *  http://www.pcisig.com/ for how to get them):
0011  *
0012  *  PCI BIOS Specification
0013  *  PCI Local Bus Specification
0014  *  PCI to PCI Bridge Specification
0015  *  PCI System Design Guide
0016  */
0017 
0018 #ifndef _UAPILINUX_PCI_H
0019 #define _UAPILINUX_PCI_H
0020 
0021 #include <linux/pci_regs.h> /* The pci register defines */
0022 
0023 /*
0024  * The PCI interface treats multi-function devices as independent
0025  * devices.  The slot/function address of each device is encoded
0026  * in a single byte as follows:
0027  *
0028  *  7:3 = slot
0029  *  2:0 = function
0030  */
0031 #define PCI_DEVFN(slot, func)   ((((slot) & 0x1f) << 3) | ((func) & 0x07))
0032 #define PCI_SLOT(devfn)     (((devfn) >> 3) & 0x1f)
0033 #define PCI_FUNC(devfn)     ((devfn) & 0x07)
0034 
0035 /* Ioctls for /proc/bus/pci/X/Y nodes. */
0036 #define PCIIOC_BASE     ('P' << 24 | 'C' << 16 | 'I' << 8)
0037 #define PCIIOC_CONTROLLER   (PCIIOC_BASE | 0x00)    /* Get controller for PCI device. */
0038 #define PCIIOC_MMAP_IS_IO   (PCIIOC_BASE | 0x01)    /* Set mmap state to I/O space. */
0039 #define PCIIOC_MMAP_IS_MEM  (PCIIOC_BASE | 0x02)    /* Set mmap state to MEM space. */
0040 #define PCIIOC_WRITE_COMBINE    (PCIIOC_BASE | 0x03)    /* Enable/disable write-combining. */
0041 
0042 #endif /* _UAPILINUX_PCI_H */