1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Copyright 1998 by Concurrent Computer Corporation 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Permission to use, copy, modify, distribute, and sell this software 5*4882a593Smuzhiyun * and its documentation for any purpose is hereby granted without fee, 6*4882a593Smuzhiyun * provided that the above copyright notice appear in all copies and that 7*4882a593Smuzhiyun * both that copyright notice and this permission notice appear in 8*4882a593Smuzhiyun * supporting documentation, and that the name of Concurrent Computer 9*4882a593Smuzhiyun * Corporation not be used in advertising or publicity pertaining to 10*4882a593Smuzhiyun * distribution of the software without specific, written prior 11*4882a593Smuzhiyun * permission. Concurrent Computer Corporation makes no representations 12*4882a593Smuzhiyun * about the suitability of this software for any purpose. It is 13*4882a593Smuzhiyun * provided "as is" without express or implied warranty. 14*4882a593Smuzhiyun * 15*4882a593Smuzhiyun * CONCURRENT COMPUTER CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD 16*4882a593Smuzhiyun * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 17*4882a593Smuzhiyun * AND FITNESS, IN NO EVENT SHALL CONCURRENT COMPUTER CORPORATION BE 18*4882a593Smuzhiyun * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 19*4882a593Smuzhiyun * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 20*4882a593Smuzhiyun * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 21*4882a593Smuzhiyun * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 22*4882a593Smuzhiyun * SOFTWARE. 23*4882a593Smuzhiyun * 24*4882a593Smuzhiyun * Copyright 1998 by Metro Link Incorporated 25*4882a593Smuzhiyun * 26*4882a593Smuzhiyun * Permission to use, copy, modify, distribute, and sell this software 27*4882a593Smuzhiyun * and its documentation for any purpose is hereby granted without fee, 28*4882a593Smuzhiyun * provided that the above copyright notice appear in all copies and that 29*4882a593Smuzhiyun * both that copyright notice and this permission notice appear in 30*4882a593Smuzhiyun * supporting documentation, and that the name of Metro Link 31*4882a593Smuzhiyun * Incorporated not be used in advertising or publicity pertaining to 32*4882a593Smuzhiyun * distribution of the software without specific, written prior 33*4882a593Smuzhiyun * permission. Metro Link Incorporated makes no representations 34*4882a593Smuzhiyun * about the suitability of this software for any purpose. It is 35*4882a593Smuzhiyun * provided "as is" without express or implied warranty. 36*4882a593Smuzhiyun * 37*4882a593Smuzhiyun * METRO LINK INCORPORATED DISCLAIMS ALL WARRANTIES WITH REGARD 38*4882a593Smuzhiyun * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 39*4882a593Smuzhiyun * AND FITNESS, IN NO EVENT SHALL METRO LINK INCORPORATED BE 40*4882a593Smuzhiyun * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 41*4882a593Smuzhiyun * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 42*4882a593Smuzhiyun * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 43*4882a593Smuzhiyun * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 44*4882a593Smuzhiyun * SOFTWARE. 45*4882a593Smuzhiyun * 46*4882a593Smuzhiyun * This file is derived in part from the original xf86_PCI.h that included 47*4882a593Smuzhiyun * following copyright message: 48*4882a593Smuzhiyun * 49*4882a593Smuzhiyun * Copyright 1995 by Robin Cutshaw <robin@XFree86.Org> 50*4882a593Smuzhiyun * 51*4882a593Smuzhiyun * Permission to use, copy, modify, distribute, and sell this software and its 52*4882a593Smuzhiyun * documentation for any purpose is hereby granted without fee, provided that 53*4882a593Smuzhiyun * the above copyright notice appear in all copies and that both that 54*4882a593Smuzhiyun * copyright notice and this permission notice appear in supporting 55*4882a593Smuzhiyun * documentation, and that the names of the above listed copyright holder(s) 56*4882a593Smuzhiyun * not be used in advertising or publicity pertaining to distribution of 57*4882a593Smuzhiyun * the software without specific, written prior permission. The above listed 58*4882a593Smuzhiyun * copyright holder(s) make(s) no representations about the suitability of this 59*4882a593Smuzhiyun * software for any purpose. It is provided "as is" without express or 60*4882a593Smuzhiyun * implied warranty. 61*4882a593Smuzhiyun * 62*4882a593Smuzhiyun * THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM(S) ALL WARRANTIES WITH REGARD 63*4882a593Smuzhiyun * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 64*4882a593Smuzhiyun * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE 65*4882a593Smuzhiyun * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY 66*4882a593Smuzhiyun * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER 67*4882a593Smuzhiyun * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING 68*4882a593Smuzhiyun * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 69*4882a593Smuzhiyun * 70*4882a593Smuzhiyun */ 71*4882a593Smuzhiyun /* 72*4882a593Smuzhiyun * Copyright (c) 1999-2003 by The XFree86 Project, Inc. 73*4882a593Smuzhiyun * 74*4882a593Smuzhiyun * Permission is hereby granted, free of charge, to any person obtaining a 75*4882a593Smuzhiyun * copy of this software and associated documentation files (the "Software"), 76*4882a593Smuzhiyun * to deal in the Software without restriction, including without limitation 77*4882a593Smuzhiyun * the rights to use, copy, modify, merge, publish, distribute, sublicense, 78*4882a593Smuzhiyun * and/or sell copies of the Software, and to permit persons to whom the 79*4882a593Smuzhiyun * Software is furnished to do so, subject to the following conditions: 80*4882a593Smuzhiyun * 81*4882a593Smuzhiyun * The above copyright notice and this permission notice shall be included in 82*4882a593Smuzhiyun * all copies or substantial portions of the Software. 83*4882a593Smuzhiyun * 84*4882a593Smuzhiyun * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 85*4882a593Smuzhiyun * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 86*4882a593Smuzhiyun * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 87*4882a593Smuzhiyun * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 88*4882a593Smuzhiyun * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 89*4882a593Smuzhiyun * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 90*4882a593Smuzhiyun * OTHER DEALINGS IN THE SOFTWARE. 91*4882a593Smuzhiyun * 92*4882a593Smuzhiyun * Except as contained in this notice, the name of the copyright holder(s) 93*4882a593Smuzhiyun * and author(s) shall not be used in advertising or otherwise to promote 94*4882a593Smuzhiyun * the sale, use or other dealings in this Software without prior written 95*4882a593Smuzhiyun * authorization from the copyright holder(s) and author(s). 96*4882a593Smuzhiyun */ 97*4882a593Smuzhiyun 98*4882a593Smuzhiyun /* 99*4882a593Smuzhiyun * This file contains just the public interface to the PCI code. 100*4882a593Smuzhiyun * Drivers should use this file rather than Pci.h. 101*4882a593Smuzhiyun */ 102*4882a593Smuzhiyun 103*4882a593Smuzhiyun #ifndef _XF86PCI_H 104*4882a593Smuzhiyun #define _XF86PCI_H 1 105*4882a593Smuzhiyun #include <X11/Xarch.h> 106*4882a593Smuzhiyun #include <X11/Xfuncproto.h> 107*4882a593Smuzhiyun #include "misc.h" 108*4882a593Smuzhiyun #include <pciaccess.h> 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun /* 111*4882a593Smuzhiyun * PCI cfg space definitions (e.g. stuff right out of the PCI spec) 112*4882a593Smuzhiyun */ 113*4882a593Smuzhiyun 114*4882a593Smuzhiyun /* Device identification register */ 115*4882a593Smuzhiyun #define PCI_ID_REG 0x00 116*4882a593Smuzhiyun 117*4882a593Smuzhiyun /* Command and status register */ 118*4882a593Smuzhiyun #define PCI_CMD_STAT_REG 0x04 119*4882a593Smuzhiyun #define PCI_CMD_BASE_REG 0x10 120*4882a593Smuzhiyun #define PCI_CMD_BIOS_REG 0x30 121*4882a593Smuzhiyun #define PCI_CMD_MASK 0xffff 122*4882a593Smuzhiyun #define PCI_CMD_IO_ENABLE 0x01 123*4882a593Smuzhiyun #define PCI_CMD_MEM_ENABLE 0x02 124*4882a593Smuzhiyun #define PCI_CMD_MASTER_ENABLE 0x04 125*4882a593Smuzhiyun #define PCI_CMD_SPECIAL_ENABLE 0x08 126*4882a593Smuzhiyun #define PCI_CMD_INVALIDATE_ENABLE 0x10 127*4882a593Smuzhiyun #define PCI_CMD_PALETTE_ENABLE 0x20 128*4882a593Smuzhiyun #define PCI_CMD_PARITY_ENABLE 0x40 129*4882a593Smuzhiyun #define PCI_CMD_STEPPING_ENABLE 0x80 130*4882a593Smuzhiyun #define PCI_CMD_SERR_ENABLE 0x100 131*4882a593Smuzhiyun #define PCI_CMD_BACKTOBACK_ENABLE 0x200 132*4882a593Smuzhiyun #define PCI_CMD_BIOS_ENABLE 0x01 133*4882a593Smuzhiyun 134*4882a593Smuzhiyun /* base class */ 135*4882a593Smuzhiyun #define PCI_CLASS_REG 0x08 136*4882a593Smuzhiyun #define PCI_CLASS_MASK 0xff000000 137*4882a593Smuzhiyun #define PCI_CLASS_SHIFT 24 138*4882a593Smuzhiyun #define PCI_CLASS_EXTRACT(x) \ 139*4882a593Smuzhiyun (((x) & PCI_CLASS_MASK) >> PCI_CLASS_SHIFT) 140*4882a593Smuzhiyun 141*4882a593Smuzhiyun /* base class values */ 142*4882a593Smuzhiyun #define PCI_CLASS_PREHISTORIC 0x00 143*4882a593Smuzhiyun #define PCI_CLASS_MASS_STORAGE 0x01 144*4882a593Smuzhiyun #define PCI_CLASS_NETWORK 0x02 145*4882a593Smuzhiyun #define PCI_CLASS_DISPLAY 0x03 146*4882a593Smuzhiyun #define PCI_CLASS_MULTIMEDIA 0x04 147*4882a593Smuzhiyun #define PCI_CLASS_MEMORY 0x05 148*4882a593Smuzhiyun #define PCI_CLASS_BRIDGE 0x06 149*4882a593Smuzhiyun #define PCI_CLASS_COMMUNICATIONS 0x07 150*4882a593Smuzhiyun #define PCI_CLASS_SYSPERIPH 0x08 151*4882a593Smuzhiyun #define PCI_CLASS_INPUT 0x09 152*4882a593Smuzhiyun #define PCI_CLASS_DOCKING 0x0a 153*4882a593Smuzhiyun #define PCI_CLASS_PROCESSOR 0x0b 154*4882a593Smuzhiyun #define PCI_CLASS_SERIALBUS 0x0c 155*4882a593Smuzhiyun #define PCI_CLASS_WIRELESS 0x0d 156*4882a593Smuzhiyun #define PCI_CLASS_I2O 0x0e 157*4882a593Smuzhiyun #define PCI_CLASS_SATELLITE 0x0f 158*4882a593Smuzhiyun #define PCI_CLASS_CRYPT 0x10 159*4882a593Smuzhiyun #define PCI_CLASS_DATA_ACQUISTION 0x11 160*4882a593Smuzhiyun #define PCI_CLASS_UNDEFINED 0xff 161*4882a593Smuzhiyun 162*4882a593Smuzhiyun /* sub class */ 163*4882a593Smuzhiyun #define PCI_SUBCLASS_MASK 0x00ff0000 164*4882a593Smuzhiyun #define PCI_SUBCLASS_SHIFT 16 165*4882a593Smuzhiyun #define PCI_SUBCLASS_EXTRACT(x) \ 166*4882a593Smuzhiyun (((x) & PCI_SUBCLASS_MASK) >> PCI_SUBCLASS_SHIFT) 167*4882a593Smuzhiyun 168*4882a593Smuzhiyun /* Sub class values */ 169*4882a593Smuzhiyun /* 0x00 prehistoric subclasses */ 170*4882a593Smuzhiyun #define PCI_SUBCLASS_PREHISTORIC_MISC 0x00 171*4882a593Smuzhiyun #define PCI_SUBCLASS_PREHISTORIC_VGA 0x01 172*4882a593Smuzhiyun 173*4882a593Smuzhiyun /* 0x03 display subclasses */ 174*4882a593Smuzhiyun #define PCI_SUBCLASS_DISPLAY_VGA 0x00 175*4882a593Smuzhiyun #define PCI_SUBCLASS_DISPLAY_XGA 0x01 176*4882a593Smuzhiyun #define PCI_SUBCLASS_DISPLAY_MISC 0x80 177*4882a593Smuzhiyun 178*4882a593Smuzhiyun /* 0x04 multimedia subclasses */ 179*4882a593Smuzhiyun #define PCI_SUBCLASS_MULTIMEDIA_VIDEO 0x00 180*4882a593Smuzhiyun #define PCI_SUBCLASS_MULTIMEDIA_AUDIO 0x01 181*4882a593Smuzhiyun #define PCI_SUBCLASS_MULTIMEDIA_MISC 0x80 182*4882a593Smuzhiyun 183*4882a593Smuzhiyun /* 0x06 bridge subclasses */ 184*4882a593Smuzhiyun #define PCI_SUBCLASS_BRIDGE_HOST 0x00 185*4882a593Smuzhiyun #define PCI_SUBCLASS_BRIDGE_ISA 0x01 186*4882a593Smuzhiyun #define PCI_SUBCLASS_BRIDGE_EISA 0x02 187*4882a593Smuzhiyun #define PCI_SUBCLASS_BRIDGE_MC 0x03 188*4882a593Smuzhiyun #define PCI_SUBCLASS_BRIDGE_PCI 0x04 189*4882a593Smuzhiyun #define PCI_SUBCLASS_BRIDGE_PCMCIA 0x05 190*4882a593Smuzhiyun #define PCI_SUBCLASS_BRIDGE_NUBUS 0x06 191*4882a593Smuzhiyun #define PCI_SUBCLASS_BRIDGE_CARDBUS 0x07 192*4882a593Smuzhiyun #define PCI_SUBCLASS_BRIDGE_RACEWAY 0x08 193*4882a593Smuzhiyun #define PCI_SUBCLASS_BRIDGE_MISC 0x80 194*4882a593Smuzhiyun #define PCI_IF_BRIDGE_PCI_SUBTRACTIVE 0x01 195*4882a593Smuzhiyun 196*4882a593Smuzhiyun /* 0x0b processor subclasses */ 197*4882a593Smuzhiyun #define PCI_SUBCLASS_PROCESSOR_386 0x00 198*4882a593Smuzhiyun #define PCI_SUBCLASS_PROCESSOR_486 0x01 199*4882a593Smuzhiyun #define PCI_SUBCLASS_PROCESSOR_PENTIUM 0x02 200*4882a593Smuzhiyun #define PCI_SUBCLASS_PROCESSOR_ALPHA 0x10 201*4882a593Smuzhiyun #define PCI_SUBCLASS_PROCESSOR_POWERPC 0x20 202*4882a593Smuzhiyun #define PCI_SUBCLASS_PROCESSOR_MIPS 0x30 203*4882a593Smuzhiyun #define PCI_SUBCLASS_PROCESSOR_COPROC 0x40 204*4882a593Smuzhiyun 205*4882a593Smuzhiyun /* PCI-PCI bridge mapping registers */ 206*4882a593Smuzhiyun #define PCI_PCI_BRIDGE_BUS_REG 0x18 207*4882a593Smuzhiyun #define PCI_SUBORDINATE_BUS_MASK 0x00ff0000 208*4882a593Smuzhiyun #define PCI_SECONDARY_BUS_MASK 0x0000ff00 209*4882a593Smuzhiyun #define PCI_PRIMARY_BUS_MASK 0x000000ff 210*4882a593Smuzhiyun 211*4882a593Smuzhiyun #define PCI_PCI_BRIDGE_IO_REG 0x1c 212*4882a593Smuzhiyun #define PCI_PCI_BRIDGE_MEM_REG 0x20 213*4882a593Smuzhiyun #define PCI_PCI_BRIDGE_PMEM_REG 0x24 214*4882a593Smuzhiyun 215*4882a593Smuzhiyun #define PCI_PCI_BRIDGE_CONTROL_REG 0x3E 216*4882a593Smuzhiyun #define PCI_PCI_BRIDGE_PARITY_EN 0x01 217*4882a593Smuzhiyun #define PCI_PCI_BRIDGE_SERR_EN 0x02 218*4882a593Smuzhiyun #define PCI_PCI_BRIDGE_ISA_EN 0x04 219*4882a593Smuzhiyun #define PCI_PCI_BRIDGE_VGA_EN 0x08 220*4882a593Smuzhiyun #define PCI_PCI_BRIDGE_MASTER_ABORT_EN 0x20 221*4882a593Smuzhiyun #define PCI_PCI_BRIDGE_SECONDARY_RESET 0x40 222*4882a593Smuzhiyun #define PCI_PCI_BRIDGE_FAST_B2B_EN 0x80 223*4882a593Smuzhiyun 224*4882a593Smuzhiyun /* Subsystem identification register */ 225*4882a593Smuzhiyun #define PCI_SUBSYSTEM_ID_REG 0x2c 226*4882a593Smuzhiyun 227*4882a593Smuzhiyun /* User defined cfg space regs */ 228*4882a593Smuzhiyun #define PCI_REG_USERCONFIG 0x40 229*4882a593Smuzhiyun #define PCI_OPTION_REG 0x40 230*4882a593Smuzhiyun 231*4882a593Smuzhiyun /* 232*4882a593Smuzhiyun * Typedefs, etc... 233*4882a593Smuzhiyun */ 234*4882a593Smuzhiyun 235*4882a593Smuzhiyun /* Public PCI access functions */ 236*4882a593Smuzhiyun extern _X_EXPORT Bool xf86scanpci(void); 237*4882a593Smuzhiyun extern _X_EXPORT char *DRICreatePCIBusID(const struct pci_device *dev); 238*4882a593Smuzhiyun 239*4882a593Smuzhiyun #endif /* _XF86PCI_H */ 240