1 /*
2 * Copyright 1997, 1998 by UCHIYAMA Yasushi
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of UCHIYAMA Yasushi not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. UCHIYAMA Yasushi makes no representations
11 * about the suitability of this software for any purpose. It is provided
12 * "as is" without express or implied warranty.
13 *
14 * UCHIYAMA YASUSHI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL UCHIYAMA YASUSHI BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
21 *
22 */
23
24 #ifdef HAVE_XORG_CONFIG_H
25 #include <xorg-config.h>
26 #endif
27
28 #include <mach.h>
29 #include <device/device.h>
30 #include <mach/machine/mach_i386.h>
31 #include <hurd.h>
32
33 #include <X11/X.h>
34 #include "input.h"
35 #include "scrnintstr.h"
36
37 #include "xf86.h"
38 #include "xf86Priv.h"
39 #include "xf86_OSlib.h"
40 #include "xf86OSpriv.h"
41
42 /**************************************************************************
43 * Video Memory Mapping section
44 ***************************************************************************/
45
46 /**************************************************************************
47 * I/O Permissions section
48 ***************************************************************************/
49
50 /*
51 * Due to conflicts with "compiler.h", don't rely on <sys/io.h> to declare
52 * this.
53 */
54 extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on);
55
56 Bool
xf86EnableIO()57 xf86EnableIO()
58 {
59 if (ioperm(0, 0x10000, 1)) {
60 FatalError("xf86EnableIO: ioperm() failed (%s)\n", strerror(errno));
61 return FALSE;
62 }
63 #if 0
64 /*
65 * Trapping disabled for now, as some VBIOSes (mga-g450 notably) use these
66 * ports, and the int10 wrapper is not emulating them. (Note that it's
67 * effectively what happens in the Linux variant too, as iopl() is used
68 * there, making the ioperm() meaningless.)
69 *
70 * Reenable this when int10 gets fixed. */
71 ioperm(0x40, 4, 0); /* trap access to the timer chip */
72 ioperm(0x60, 4, 0); /* trap access to the keyboard controller */
73 #endif
74 return TRUE;
75 }
76
77 void
xf86DisableIO()78 xf86DisableIO()
79 {
80 ioperm(0, 0x10000, 0);
81 return;
82 }
83
84 void
xf86OSInitVidMem(VidMemInfoPtr pVidMem)85 xf86OSInitVidMem(VidMemInfoPtr pVidMem)
86 {
87 pVidMem->initialised = TRUE;
88 }
89