| 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 has the private Pci definitions. The public ones are imported |
| 100 | * from xf86Pci.h. Drivers should not use this file. |
| 101 | */ |
| 102 | #ifdef HAVE_XORG_CONFIG_H |
| 103 | #include <xorg-config.h> |
| 104 | #endif |
| 105 | |
| 106 | #ifndef _PCI_H |
| 107 | #define _PCI_H 1 |
| 108 | |
| 109 | #include "xf86Pci.h" |
| 110 | |
| 111 | /* |
| 112 | * Global Definitions |
| 113 | */ |
| 114 | #if (defined(__alpha__) || defined(__ia64__)) && defined (linux) |
| 115 | #define PCI_DOM_MASK 0x01fful |
| 116 | #else |
| 117 | #define PCI_DOM_MASK 0x0ffu |
| 118 | #endif |
| 119 | |
| 120 | #ifndef PCI_DOM_MASK |
| 121 | #define PCI_DOM_MASK 0x0ffu |
| 122 | #endif |
| 123 | #define PCI_DOMBUS_MASK (((PCI_DOM_MASK) << 8) | 0x0ffu) |
| 124 | |
| 125 | /* |
| 126 | * "b" contains an optional domain number. |
| 127 | */ |
| 128 | #define PCI_MAKE_TAG(b,d,f) ((((b) & (PCI_DOMBUS_MASK)) << 16) | \ |
| 129 | (((d) & 0x00001fu) << 11) | \ |
| 130 | (((f) & 0x000007u) << 8)) |
| 131 | |
| 132 | #define PCI_MAKE_BUS(d,b) ((((d) & (PCI_DOM_MASK)) << 8) | ((b) & 0xffu)) |
| 133 | |
| 134 | #define PCI_DOM_FROM_BUS(bus) (((bus) >> 8) & (PCI_DOM_MASK)) |
| 135 | #define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu) |
| 136 | #define PCI_TAG_NO_DOMAIN(tag) ((tag) & 0x00ffff00u) |
| 137 | |
| 138 | #if defined(linux) |
| 139 | #define osPciInit(x) do {} while (0) |
| 140 | #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ |
| 141 | defined(__OpenBSD__) || defined(__NetBSD__) || \ |
| 142 | defined(__DragonFly__) || defined(__sun) || defined(__GNU__) |
| 143 | extern void osPciInit(void); |
| 144 | #else |
| 145 | #error No PCI support available for this architecture/OS combination |
| 146 | #endif |
| 147 | |
| 148 | #endif /* _PCI_H */ |