included modified version of M.Dolze's patch patch_drivers_port from his web site
This commit is contained in:
@@ -230,6 +230,8 @@ Use i386_get_ioperm, i386_set_ioperm from <machine/sysarch.h> and inb and outb f
|
|||||||
#include <machine/cpufunc.h>
|
#include <machine/cpufunc.h>
|
||||||
#include <machine/sysarch.h>
|
#include <machine/sysarch.h>
|
||||||
|
|
||||||
|
static FILE * port_access_handle = NULL;
|
||||||
|
|
||||||
/* Read a byte from port */
|
/* Read a byte from port */
|
||||||
static inline int port_in (unsigned short port) {
|
static inline int port_in (unsigned short port) {
|
||||||
return inb(port);
|
return inb(port);
|
||||||
@@ -247,7 +249,16 @@ static inline int port_access (unsigned short port) {
|
|||||||
|
|
||||||
/* Get access to multiple ports at once */
|
/* Get access to multiple ports at once */
|
||||||
static inline int port_access_multiple (unsigned short port, unsigned short count) {
|
static inline int port_access_multiple (unsigned short port, unsigned short count) {
|
||||||
|
#if (__FreeBSD_version > 500000)
|
||||||
|
if( port_access_handle
|
||||||
|
|| (port_access_handle = fopen("/dev/io", "rw")) != NULL ) {
|
||||||
return i386_set_ioperm(port, count, 1);
|
return i386_set_ioperm(port, count, 1);
|
||||||
|
} else {
|
||||||
|
return( -1 ); /* Failure */
|
||||||
|
};
|
||||||
|
#else
|
||||||
|
return i386_set_ioperm(port, count, 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close access to a specific port */
|
/* Close access to a specific port */
|
||||||
|
|||||||
Reference in New Issue
Block a user