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