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