xref: /OK3568_Linux_fs/external/xserver/hw/xfree86/os-support/xf86_OSproc.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany
3*4882a593Smuzhiyun  * Copyright 1992 by David Dawes <dawes@XFree86.org>
4*4882a593Smuzhiyun  * Copyright 1992 by Jim Tsillas <jtsilla@damon.ccs.northeastern.edu>
5*4882a593Smuzhiyun  * Copyright 1992 by Rich Murphey <Rich@Rice.edu>
6*4882a593Smuzhiyun  * Copyright 1992 by Robert Baron <Robert.Baron@ernst.mach.cs.cmu.edu>
7*4882a593Smuzhiyun  * Copyright 1992 by Orest Zborowski <obz@eskimo.com>
8*4882a593Smuzhiyun  * Copyright 1993 by Vrije Universiteit, The Netherlands
9*4882a593Smuzhiyun  * Copyright 1993 by David Wexelblat <dwex@XFree86.org>
10*4882a593Smuzhiyun  * Copyright 1994, 1996 by Holger Veit <Holger.Veit@gmd.de>
11*4882a593Smuzhiyun  * Copyright 1994-2003 by The XFree86 Project, Inc
12*4882a593Smuzhiyun  *
13*4882a593Smuzhiyun  * Permission to use, copy, modify, distribute, and sell this software and its
14*4882a593Smuzhiyun  * documentation for any purpose is hereby granted without fee, provided that
15*4882a593Smuzhiyun  * the above copyright notice appear in all copies and that both that
16*4882a593Smuzhiyun  * copyright notice and this permission notice appear in supporting
17*4882a593Smuzhiyun  * documentation, and that the names of the above listed copyright holders
18*4882a593Smuzhiyun  * not be used in advertising or publicity pertaining to distribution of
19*4882a593Smuzhiyun  * the software without specific, written prior permission.  The above listed
20*4882a593Smuzhiyun  * copyright holders make no representations about the suitability of this
21*4882a593Smuzhiyun  * software for any purpose.  It is provided "as is" without express or
22*4882a593Smuzhiyun  * implied warranty.
23*4882a593Smuzhiyun  *
24*4882a593Smuzhiyun  * THE ABOVE LISTED COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD
25*4882a593Smuzhiyun  * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
26*4882a593Smuzhiyun  * AND FITNESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDERS BE
27*4882a593Smuzhiyun  * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY
28*4882a593Smuzhiyun  * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
29*4882a593Smuzhiyun  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
30*4882a593Smuzhiyun  * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
31*4882a593Smuzhiyun  *
32*4882a593Smuzhiyun  */
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun /*
35*4882a593Smuzhiyun  * The ARM32 code here carries the following copyright:
36*4882a593Smuzhiyun  *
37*4882a593Smuzhiyun  * Copyright 1997
38*4882a593Smuzhiyun  * Digital Equipment Corporation. All rights reserved.
39*4882a593Smuzhiyun  * This software is furnished under license and may be used and copied only in
40*4882a593Smuzhiyun  * accordance with the following terms and conditions.  Subject to these
41*4882a593Smuzhiyun  * conditions, you may download, copy, install, use, modify and distribute
42*4882a593Smuzhiyun  * this software in source and/or binary form. No title or ownership is
43*4882a593Smuzhiyun  * transferred hereby.
44*4882a593Smuzhiyun  *
45*4882a593Smuzhiyun  * 1) Any source code used, modified or distributed must reproduce and retain
46*4882a593Smuzhiyun  *    this copyright notice and list of conditions as they appear in the
47*4882a593Smuzhiyun  *    source file.
48*4882a593Smuzhiyun  *
49*4882a593Smuzhiyun  * 2) No right is granted to use any trade name, trademark, or logo of Digital
50*4882a593Smuzhiyun  *    Equipment Corporation. Neither the "Digital Equipment Corporation"
51*4882a593Smuzhiyun  *    name nor any trademark or logo of Digital Equipment Corporation may be
52*4882a593Smuzhiyun  *    used to endorse or promote products derived from this software without
53*4882a593Smuzhiyun  *    the prior written permission of Digital Equipment Corporation.
54*4882a593Smuzhiyun  *
55*4882a593Smuzhiyun  * 3) This software is provided "AS-IS" and any express or implied warranties,
56*4882a593Smuzhiyun  *    including but not limited to, any implied warranties of merchantability,
57*4882a593Smuzhiyun  *    fitness for a particular purpose, or non-infringement are disclaimed.
58*4882a593Smuzhiyun  *    In no event shall DIGITAL be liable for any damages whatsoever, and in
59*4882a593Smuzhiyun  *    particular, DIGITAL shall not be liable for special, indirect,
60*4882a593Smuzhiyun  *    consequential, or incidental damages or damages for lost profits, loss
61*4882a593Smuzhiyun  *    of revenue or loss of use, whether such damages arise in contract,
62*4882a593Smuzhiyun  *    negligence, tort, under statute, in equity, at law or otherwise, even
63*4882a593Smuzhiyun  *    if advised of the possibility of such damage.
64*4882a593Smuzhiyun  *
65*4882a593Smuzhiyun  */
66*4882a593Smuzhiyun 
67*4882a593Smuzhiyun #ifndef _XF86_OSPROC_H
68*4882a593Smuzhiyun #define _XF86_OSPROC_H
69*4882a593Smuzhiyun 
70*4882a593Smuzhiyun /*
71*4882a593Smuzhiyun  * The actual prototypes have been pulled into this seperate file so
72*4882a593Smuzhiyun  * that they can can be used without pulling in all of the OS specific
73*4882a593Smuzhiyun  * stuff like sys/stat.h, etc. This casues problem for loadable modules.
74*4882a593Smuzhiyun  */
75*4882a593Smuzhiyun 
76*4882a593Smuzhiyun /*
77*4882a593Smuzhiyun  * OS-independent modem state flags for xf86SetSerialModemState() and
78*4882a593Smuzhiyun  * xf86GetSerialModemState().
79*4882a593Smuzhiyun  */
80*4882a593Smuzhiyun #define XF86_M_LE		0x001   /* line enable */
81*4882a593Smuzhiyun #define XF86_M_DTR		0x002   /* data terminal ready */
82*4882a593Smuzhiyun #define XF86_M_RTS		0x004   /* request to send */
83*4882a593Smuzhiyun #define XF86_M_ST		0x008   /* secondary transmit */
84*4882a593Smuzhiyun #define XF86_M_SR		0x010   /* secondary receive */
85*4882a593Smuzhiyun #define XF86_M_CTS		0x020   /* clear to send */
86*4882a593Smuzhiyun #define XF86_M_CAR		0x040   /* carrier detect */
87*4882a593Smuzhiyun #define XF86_M_RNG		0x080   /* ring */
88*4882a593Smuzhiyun #define XF86_M_DSR		0x100   /* data set ready */
89*4882a593Smuzhiyun 
90*4882a593Smuzhiyun #ifndef NO_OSLIB_PROTOTYPES
91*4882a593Smuzhiyun /*
92*4882a593Smuzhiyun  * This is to prevent re-entrancy to FatalError() when aborting.
93*4882a593Smuzhiyun  * Anything that can be called as a result of AbortDDX() should use this
94*4882a593Smuzhiyun  * instead of FatalError().
95*4882a593Smuzhiyun  */
96*4882a593Smuzhiyun 
97*4882a593Smuzhiyun #define xf86FatalError(a, b) \
98*4882a593Smuzhiyun 	if (dispatchException & DE_TERMINATE) { \
99*4882a593Smuzhiyun 		ErrorF(a, b); \
100*4882a593Smuzhiyun 		ErrorF("\n"); \
101*4882a593Smuzhiyun 		return; \
102*4882a593Smuzhiyun 	} else FatalError(a, b)
103*4882a593Smuzhiyun 
104*4882a593Smuzhiyun /***************************************************************************/
105*4882a593Smuzhiyun /* Prototypes                                                              */
106*4882a593Smuzhiyun /***************************************************************************/
107*4882a593Smuzhiyun 
108*4882a593Smuzhiyun #include <X11/Xfuncproto.h>
109*4882a593Smuzhiyun #include "opaque.h"
110*4882a593Smuzhiyun #include "xf86Optionstr.h"
111*4882a593Smuzhiyun 
112*4882a593Smuzhiyun _XFUNCPROTOBEGIN
113*4882a593Smuzhiyun 
114*4882a593Smuzhiyun /* public functions */
115*4882a593Smuzhiyun extern _X_EXPORT Bool xf86EnableIO(void);
116*4882a593Smuzhiyun extern _X_EXPORT void xf86DisableIO(void);
117*4882a593Smuzhiyun 
118*4882a593Smuzhiyun #ifdef __NetBSD__
119*4882a593Smuzhiyun extern _X_EXPORT void xf86SetTVOut(int);
120*4882a593Smuzhiyun extern _X_EXPORT void xf86SetRGBOut(void);
121*4882a593Smuzhiyun #endif
122*4882a593Smuzhiyun extern _X_EXPORT void xf86OSRingBell(int, int, int);
123*4882a593Smuzhiyun extern _X_EXPORT void xf86SetReallySlowBcopy(void);
124*4882a593Smuzhiyun extern _X_EXPORT void xf86SlowBcopy(unsigned char *, unsigned char *, int);
125*4882a593Smuzhiyun extern _X_EXPORT int xf86OpenSerial(XF86OptionPtr options);
126*4882a593Smuzhiyun extern _X_EXPORT int xf86SetSerial(int fd, XF86OptionPtr options);
127*4882a593Smuzhiyun extern _X_EXPORT int xf86SetSerialSpeed(int fd, int speed);
128*4882a593Smuzhiyun extern _X_EXPORT int xf86ReadSerial(int fd, void *buf, int count);
129*4882a593Smuzhiyun extern _X_EXPORT int xf86WriteSerial(int fd, const void *buf, int count);
130*4882a593Smuzhiyun extern _X_EXPORT int xf86CloseSerial(int fd);
131*4882a593Smuzhiyun extern _X_EXPORT int xf86FlushInput(int fd);
132*4882a593Smuzhiyun extern _X_EXPORT int xf86WaitForInput(int fd, int timeout);
133*4882a593Smuzhiyun extern _X_EXPORT int xf86SerialSendBreak(int fd, int duration);
134*4882a593Smuzhiyun extern _X_EXPORT int xf86SetSerialModemState(int fd, int state);
135*4882a593Smuzhiyun extern _X_EXPORT int xf86GetSerialModemState(int fd);
136*4882a593Smuzhiyun extern _X_EXPORT int xf86SerialModemSetBits(int fd, int bits);
137*4882a593Smuzhiyun extern _X_EXPORT int xf86SerialModemClearBits(int fd, int bits);
138*4882a593Smuzhiyun extern _X_EXPORT int xf86LoadKernelModule(const char *pathname);
139*4882a593Smuzhiyun extern _X_EXPORT void xf86OSInputThreadInit(void);
140*4882a593Smuzhiyun 
141*4882a593Smuzhiyun /* AGP GART interface */
142*4882a593Smuzhiyun 
143*4882a593Smuzhiyun typedef struct _AgpInfo {
144*4882a593Smuzhiyun     CARD32 bridgeId;
145*4882a593Smuzhiyun     CARD32 agpMode;
146*4882a593Smuzhiyun     unsigned long base;
147*4882a593Smuzhiyun     unsigned long size;
148*4882a593Smuzhiyun     unsigned long totalPages;
149*4882a593Smuzhiyun     unsigned long systemPages;
150*4882a593Smuzhiyun     unsigned long usedPages;
151*4882a593Smuzhiyun } AgpInfo, *AgpInfoPtr;
152*4882a593Smuzhiyun 
153*4882a593Smuzhiyun extern _X_EXPORT Bool xf86AgpGARTSupported(void);
154*4882a593Smuzhiyun extern _X_EXPORT AgpInfoPtr xf86GetAGPInfo(int screenNum);
155*4882a593Smuzhiyun extern _X_EXPORT Bool xf86AcquireGART(int screenNum);
156*4882a593Smuzhiyun extern _X_EXPORT Bool xf86ReleaseGART(int screenNum);
157*4882a593Smuzhiyun extern _X_EXPORT int xf86AllocateGARTMemory(int screenNum, unsigned long size,
158*4882a593Smuzhiyun                                             int type, unsigned long *physical);
159*4882a593Smuzhiyun extern _X_EXPORT Bool xf86DeallocateGARTMemory(int screenNum, int key);
160*4882a593Smuzhiyun extern _X_EXPORT Bool xf86BindGARTMemory(int screenNum, int key,
161*4882a593Smuzhiyun                                          unsigned long offset);
162*4882a593Smuzhiyun extern _X_EXPORT Bool xf86UnbindGARTMemory(int screenNum, int key);
163*4882a593Smuzhiyun extern _X_EXPORT Bool xf86EnableAGP(int screenNum, CARD32 mode);
164*4882a593Smuzhiyun extern _X_EXPORT Bool xf86GARTCloseScreen(int screenNum);
165*4882a593Smuzhiyun 
166*4882a593Smuzhiyun /* These routines are in shared/sigio.c and are not loaded as part of the
167*4882a593Smuzhiyun    module.  These routines are small, and the code if very POSIX-signal (or
168*4882a593Smuzhiyun    OS-signal) specific, so it seemed better to provide more complex
169*4882a593Smuzhiyun    wrappers than to wrap each individual function called. */
170*4882a593Smuzhiyun extern _X_EXPORT int xf86InstallSIGIOHandler(int fd, void (*f) (int, void *),
171*4882a593Smuzhiyun                                              void *);
172*4882a593Smuzhiyun extern _X_EXPORT int xf86RemoveSIGIOHandler(int fd);
173*4882a593Smuzhiyun 
174*4882a593Smuzhiyun #ifdef XF86_OS_PRIVS
175*4882a593Smuzhiyun typedef void (*PMClose) (void);
176*4882a593Smuzhiyun extern _X_EXPORT void xf86OpenConsole(void);
177*4882a593Smuzhiyun extern _X_EXPORT void xf86CloseConsole(void);
178*4882a593Smuzhiyun extern _X_HIDDEN Bool xf86VTActivate(int vtno);
179*4882a593Smuzhiyun extern _X_EXPORT Bool xf86VTSwitchPending(void);
180*4882a593Smuzhiyun extern _X_EXPORT Bool xf86VTSwitchAway(void);
181*4882a593Smuzhiyun extern _X_EXPORT Bool xf86VTSwitchTo(void);
182*4882a593Smuzhiyun extern _X_EXPORT void xf86VTRequest(int sig);
183*4882a593Smuzhiyun extern _X_EXPORT int xf86ProcessArgument(int, char **, int);
184*4882a593Smuzhiyun extern _X_EXPORT void xf86UseMsg(void);
185*4882a593Smuzhiyun extern _X_EXPORT PMClose xf86OSPMOpen(void);
186*4882a593Smuzhiyun 
187*4882a593Smuzhiyun extern _X_EXPORT void xf86InitVidMem(void);
188*4882a593Smuzhiyun 
189*4882a593Smuzhiyun #endif                          /* XF86_OS_PRIVS */
190*4882a593Smuzhiyun 
191*4882a593Smuzhiyun #ifdef XSERVER_PLATFORM_BUS
192*4882a593Smuzhiyun #include "hotplug.h"
193*4882a593Smuzhiyun void
194*4882a593Smuzhiyun xf86PlatformDeviceProbe(struct OdevAttributes *attribs);
195*4882a593Smuzhiyun 
196*4882a593Smuzhiyun void
197*4882a593Smuzhiyun xf86PlatformReprobeDevice(int index, struct OdevAttributes *attribs);
198*4882a593Smuzhiyun #endif
199*4882a593Smuzhiyun 
200*4882a593Smuzhiyun _XFUNCPROTOEND
201*4882a593Smuzhiyun #endif                          /* NO_OSLIB_PROTOTYPES */
202*4882a593Smuzhiyun #endif                          /* _XF86_OSPROC_H */
203