4164
|
1 /*
|
|
2 This file is based on:
|
|
3 $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.34.2.17 1998/11/10 11:55:40 dawes Exp $
|
|
4 Modified for readability by Nick Kurshev
|
|
5 */
|
|
6 #include <sys/file.h>
|
|
7 #include <sys/ioctl.h>
|
|
8 #include <i386/isa/pcconsioctl.h>
|
|
9 #ifndef GCCUSESGAS
|
|
10 #define GCCUSESGAS
|
|
11 #endif
|
|
12
|
|
13 static int io_fd;
|
|
14
|
|
15 static __inline__ void enable_os_io(void)
|
|
16 {
|
|
17 io_fd = -1 ;
|
|
18 if ((io_fd = open("/dev/console", O_RDWR, 0)) < 0) {
|
|
19 perror("/dev/console");
|
|
20 exit(1);
|
|
21 }
|
|
22 if (ioctl(io_fd, PCCONENABIOPL, 0) < 0) {
|
|
23 perror("ioctl(PCCONENABIOPL)");
|
|
24 exit(1);
|
|
25 }
|
|
26 }
|
|
27
|
|
28 static __inline__ void disable_os_io(void)
|
|
29 {
|
|
30 if (ioctl(io_fd, PCCONDISABIOPL, 0) < 0) {
|
|
31 perror("ioctl(PCCONDISABIOPL)");
|
|
32 close(io_fd);
|
|
33 exit(1);
|
|
34 }
|
|
35 close(io_fd);
|
|
36 }
|