comparison vidix/sysdep/pci_netbsd.c @ 22900:a9e111b88c4a

merged libdha and libvidix, moved all files from libdha to vidix directory
author ben
date Fri, 06 Apr 2007 15:20:49 +0000
parents libdha/sysdep/pci_netbsd.c@4cfb6b9a6da3
children 9c4ad35fabc5
comparison
equal deleted inserted replaced
22899:515545f81186 22900:a9e111b88c4a
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 <errno.h>
7 #include <sys/param.h>
8 #include <sys/file.h>
9 #include <machine/sysarch.h>
10 #ifndef GCCUSESGAS
11 #define GCCUSESGAS
12 #endif
13
14 static int io_fd;
15
16 static __inline__ int enable_os_io(void)
17 {
18 io_fd = -1 ;
19 #if !defined(USE_I386_IOPL)
20 if ((io_fd = open("/dev/io", O_RDWR, 0)) < 0) {
21 perror("/dev/io");
22 return(errno);
23 }
24 #else
25 if (i386_iopl(1) < 0) {
26 perror("i386_iopl");
27 return(errno);
28 }
29 #endif /* USE_I386_IOPL */
30 return(0);
31 }
32
33 static __inline__ int disable_os_io(void)
34 {
35 #if !defined(USE_I386_IOPL)
36 close(io_fd);
37 #else
38 if (i386_iopl(0) < 0) {
39 perror("i386_iopl");
40 return(errno);
41 }
42 #endif /* NetBSD1_1 */
43 return(0);
44 }