summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2007-05-29 22:04:36 -0400
committerDavid Nusinow <dnusinow@debian.org>2007-05-29 22:04:36 -0400
commit99eae8bea6724a24477375ad5b2d31cc4883cf6b (patch)
treeeb0d9548dd82c3ca70ab32238125ee5afcb23f5d /hw
parent3c6f1428489c1f71acd41066ea73ef4ae7c60f17 (diff)
I/O enable/disable update for the Hurd
Diffstat (limited to 'hw')
-rw-r--r--hw/xfree86/os-support/hurd/hurd_video.c44
1 files changed, 12 insertions, 32 deletions
diff --git a/hw/xfree86/os-support/hurd/hurd_video.c b/hw/xfree86/os-support/hurd/hurd_video.c
index 45e9a094b..b8892831c 100644
--- a/hw/xfree86/os-support/hurd/hurd_video.c
+++ b/hw/xfree86/os-support/hurd/hurd_video.c
@@ -117,49 +117,29 @@ xf86LinearVidMem()
/**************************************************************************
* I/O Permissions section
***************************************************************************/
-mach_port_t io_port;
+
+/*
+ * Due to conflicts with "compiler.h", don't rely on <sys/io.h> to declare
+ * this.
+ */
+extern int ioperm(unsigned long __from, unsigned long __num, int __turn_on);
Bool
xf86EnableIO()
{
- mach_port_t device;
- kern_return_t err;
-
- err = get_privileged_ports(NULL, &device);
- if( err )
- {
- errno = err;
- FatalError("xf86EnableIO() can't get_privileged_ports. (%s)\n",strerror(errno));
- }
- err = device_open(device,D_READ|D_WRITE,"io",&io_port);
- mach_port_deallocate(mach_task_self(), device);
- if( err )
- {
- errno = err;
- FatalError("xf86EnableIO() can't device_open. (%s)\n",strerror(errno));
- }
-
- err = i386_io_port_add(mach_thread_self (), io_port);
- if( err )
- {
- errno = err;
- FatalError("xf86EnableIO() can't i386_io_port_add.(io_port) (%s)\n",strerror(errno));
+ if (ioperm(0, 0xffff, 1)) {
+ FatalError("xf86EnableIO: ioperm() failed (%s)\n", strerror(errno));
+ return FALSE;
}
+ ioperm(0x40,4,0); /* trap access to the timer chip */
+ ioperm(0x60,4,0); /* trap access to the keyboard controller */
return TRUE;
}
void
xf86DisableIO()
{
- kern_return_t err;
-
- err = i386_io_port_remove(mach_thread_self (), io_port);
- if( err )
- {
- errno = err;
- FatalError("xf86DisableIO() can't i386_io_port_remove.(io_port) (%s)\n",strerror(errno));
- }
- mach_port_deallocate(mach_task_self(), io_port);
+ ioperm(0,0xffff,0);
return;
}