VirtualBox

source: vbox/trunk/src/VBox/Additions/x11/x11include/1.5/xorg/Pci.h@ 9233

Last change on this file since 9233 was 9233, checked in by vboxsync, 17 years ago

Additions/x11: added header files for X.org server 1.5

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id Revision
File size: 10.9 KB
Line 
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 <X11/Xarch.h>
111#include <X11/Xfuncproto.h>
112#include "xf86Pci.h"
113#include "xf86PciInfo.h"
114
115/*
116 * Global Definitions
117 */
118#define MAX_PCI_DEVICES 128 /* Max number of devices accomodated */
119 /* by xf86scanpci */
120#if defined(sun) && defined(SVR4) && defined(sparc)
121# define MAX_PCI_BUSES 4096 /* Max number of PCI buses */
122#elif (defined(__alpha__) || defined(__ia64__)) && defined (linux)
123# define MAX_PCI_DOMAINS 512
124# define PCI_DOM_MASK 0x01fful
125# define MAX_PCI_BUSES (MAX_PCI_DOMAINS*256) /* 256 per domain */
126#else
127# define MAX_PCI_BUSES 256 /* Max number of PCI buses */
128#endif
129
130#define DEVID(vendor, device) \
131 ((CARD32)((PCI_##device << 16) | PCI_##vendor))
132
133#ifndef PCI_DOM_MASK
134# define PCI_DOM_MASK 0x0ffu
135#endif
136#define PCI_DOMBUS_MASK (((PCI_DOM_MASK) << 8) | 0x0ffu)
137
138/*
139 * "b" contains an optional domain number.
140 */
141#define PCI_MAKE_TAG(b,d,f) ((((b) & (PCI_DOMBUS_MASK)) << 16) | \
142 (((d) & 0x00001fu) << 11) | \
143 (((f) & 0x000007u) << 8))
144
145#define PCI_MAKE_BUS(d,b) ((((d) & (PCI_DOM_MASK)) << 8) | ((b) & 0xffu))
146
147#define PCI_DOM_FROM_TAG(tag) (((tag) >> 24) & (PCI_DOM_MASK))
148#define PCI_BUS_FROM_TAG(tag) (((tag) >> 16) & (PCI_DOMBUS_MASK))
149#define PCI_DEV_FROM_TAG(tag) (((tag) & 0x0000f800u) >> 11)
150#define PCI_FUNC_FROM_TAG(tag) (((tag) & 0x00000700u) >> 8)
151
152#define PCI_DFN_FROM_TAG(tag) (((tag) & 0x0000ff00u) >> 8)
153#define PCI_BDEV_FROM_TAG(tag) ((tag) & 0x00fff800u)
154
155#define PCI_DOM_FROM_BUS(bus) (((bus) >> 8) & (PCI_DOM_MASK))
156#define PCI_BUS_NO_DOMAIN(bus) ((bus) & 0xffu)
157#define PCI_TAG_NO_DOMAIN(tag) ((tag) & 0x00ffff00u)
158
159/*
160 * Debug Macros/Definitions
161 */
162/* #define DEBUGPCI 2 */ /* Disable/enable trace in PCI code */
163
164#if defined(DEBUGPCI)
165
166# define PCITRACE(lvl,printfargs) \
167 if (lvl > xf86Verbose) { \
168 ErrorF printfargs; \
169 }
170
171#else /* !defined(DEBUGPCI) */
172
173# define PCITRACE(lvl,printfargs)
174
175#endif /* !defined(DEBUGPCI) */
176
177/*
178 * PCI Config mechanism definitions
179 */
180#define PCI_EN 0x80000000
181
182#define PCI_CFGMECH1_ADDRESS_REG 0xCF8
183#define PCI_CFGMECH1_DATA_REG 0xCFC
184
185#define PCI_CFGMECH1_MAXDEV 32
186
187#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \
188 defined(__DragonFly__)
189#define ARCH_PCI_INIT bsdPciInit
190#endif
191
192#if !defined(ARCH_PCI_INIT)
193/*
194 * Select architecture specific PCI init function
195 */
196#if defined(__alpha__)
197# if defined(linux)
198# define ARCH_PCI_INIT axpPciInit
199# endif
200#elif defined(__arm__)
201# if defined(linux)
202# define ARCH_PCI_INIT linuxPciInit
203# endif
204#elif defined(__hppa__)
205# if defined(linux)
206# define ARCH_PCI_INIT linuxPciInit
207# endif
208#elif defined(__ia64__)
209# if defined(linux)
210# define ARCH_PCI_INIT linuxPciInit
211# endif
212#elif defined(__i386__) || defined(__i386)
213# if defined(linux)
214# define ARCH_PCI_INIT linuxPciInit
215# else
216# define ARCH_PCI_INIT ix86PciInit
217# endif
218#elif defined(__mc68000__)
219# if defined(linux)
220# define ARCH_PCI_INIT linuxPciInit
221# endif
222#elif defined(__mips__)
223# if defined(linux)
224# define ARCH_PCI_INIT linuxPciInit
225# endif
226#elif defined(__powerpc__) || defined(__powerpc64__)
227# if defined(linux)
228# define ARCH_PCI_INIT linuxPciInit
229# else
230# define ARCH_PCI_INIT ppcPciInit
231# endif
232#elif defined(__s390__)
233# if defined(linux)
234# define ARCH_PCI_INIT linuxPciInit
235# endif
236#elif defined(__sh__)
237# if defined(linux)
238# define ARCH_PCI_INIT linuxPciInit
239# endif
240#elif defined(__sparc__) || defined(sparc)
241# if defined(linux)
242# define ARCH_PCI_INIT linuxPciInit
243# elif defined(sun)
244# define ARCH_PCI_INIT sparcPciInit
245# endif
246# if !defined(__FreeBSD__) && !defined(linux)
247# define ARCH_PCI_PCI_BRIDGE sparcPciPciBridge
248# endif
249#elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__)
250# if defined(linux)
251# define ARCH_PCI_INIT linuxPciInit
252# else
253# define ARCH_PCI_INIT ix86PciInit
254# endif
255#endif
256#endif /* !defined(ARCH_PCI_INIT) */
257
258#ifndef ARCH_PCI_INIT
259#error No PCI support available for this architecture/OS combination
260#endif
261
262extern void ARCH_PCI_INIT(void);
263
264#if defined(XF86SCANPCI_WRAPPER)
265typedef enum {
266 SCANPCI_INIT,
267 SCANPCI_TERM
268} scanpciWrapperOpt;
269extern void XF86SCANPCI_WRAPPER(scanpciWrapperOpt flags);
270#endif
271
272/*
273 * Table of functions used to access a specific PCI bus domain
274 * (e.g. a primary PCI bus and all of its secondaries)
275 */
276typedef struct pci_bus_funcs {
277 ADDRESS (*pciAddrBusToHost)(PCITAG, PciAddrType, ADDRESS);
278} pciBusFuncs_t, *pciBusFuncs_p;
279
280/*
281 * pciBusInfo_t - One structure per defined PCI bus
282 */
283typedef struct pci_bus_info {
284 unsigned char configMech; /* PCI config type to use */
285 unsigned char numDevices; /* Range of valid devnums */
286 unsigned char secondary; /* Boolean: bus is a secondary */
287 int primary_bus; /* Parent bus */
288 pciBusFuncs_p funcs; /* PCI access functions */
289 void *pciBusPriv; /* Implementation private data */
290 struct pci_device *bridge; /* bridge that opens this bus */
291} pciBusInfo_t;
292
293#define HOST_NO_BUS ((pciBusInfo_t *)(-1))
294
295/* configMech values */
296#define PCI_CFG_MECH_UNKNOWN 0 /* Not yet known */
297#define PCI_CFG_MECH_1 1 /* Most machines */
298#define PCI_CFG_MECH_2 2 /* Older PC's */
299#define PCI_CFG_MECH_OTHER 3 /* Something else */
300
301/* Generic PCI service functions and helpers */
302CARD32 pciCfgMech1Read(PCITAG tag, int offset);
303void pciCfgMech1Write(PCITAG tag, int offset, CARD32 val);
304void pciCfgMech1SetBits(PCITAG tag, int offset, CARD32 mask,
305 CARD32 val);
306ADDRESS pciAddrNOOP(PCITAG tag, PciAddrType type, ADDRESS);
307
308extern int pciMaxBusNum;
309
310extern pciBusInfo_t *pciBusInfo[];
311
312#endif /* _PCI_H */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette