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