c19b0efc58
from Stefan Sperling <stsp at stsp.in-berlin.de> ok maintainer
120 lines
3.1 KiB
Plaintext
120 lines
3.1 KiB
Plaintext
$OpenBSD: patch-915resolution_c,v 1.2 2007/03/31 15:32:20 sturm Exp $
|
|
--- 915resolution.c.orig Thu Feb 2 15:28:34 2006
|
|
+++ 915resolution.c Sat Mar 31 17:23:15 2007
|
|
@@ -22,7 +22,24 @@
|
|
#include <string.h>
|
|
#include <sys/mman.h>
|
|
#include <fcntl.h>
|
|
+#if defined(__OpenBSD__)
|
|
+#if defined(__i386__)
|
|
+#include <i386/pio.h>
|
|
+#include <i386/sysarch.h>
|
|
+#define IOPL(x) i386_iopl(x)
|
|
+#elif defined(__amd64__)
|
|
+#include <amd64/pio.h>
|
|
+#include <amd64/sysarch.h>
|
|
+#define IOPL(x) amd64_iopl(x)
|
|
+#endif
|
|
+#define OUTL(x,y) outl(y,x)
|
|
+#define OUTB(x,y) outb(y,x)
|
|
+#else
|
|
#include <sys/io.h>
|
|
+#define IOPL(x) iopl(x)
|
|
+#define OUTL(x,y) outl(x,y)
|
|
+#define OUTB(x,y) outb(x,y)
|
|
+#endif
|
|
#include <unistd.h>
|
|
#include <assert.h>
|
|
|
|
@@ -161,7 +178,7 @@ typedef struct {
|
|
void initialize_system(char * filename) {
|
|
|
|
if (!filename) {
|
|
- if (iopl(3) < 0) {
|
|
+ if (IOPL(3) < 0) {
|
|
perror("Unable to obtain the proper IO permissions");
|
|
exit(2);
|
|
}
|
|
@@ -169,7 +186,7 @@ void initialize_system(char * filename)
|
|
}
|
|
|
|
cardinal get_chipset_id(void) {
|
|
- outl(0x80000000, 0xcf8);
|
|
+ OUTL(0x80000000, 0xcf8);
|
|
return inl(0xcfc);
|
|
}
|
|
|
|
@@ -330,6 +347,7 @@ vbios_map * open_vbios(char * filename,
|
|
}
|
|
}
|
|
|
|
+#if 0
|
|
/*
|
|
* check if we have ATI Radeon
|
|
*/
|
|
@@ -378,6 +396,7 @@ vbios_map * open_vbios(char * filename,
|
|
close_vbios(map);
|
|
exit(2);
|
|
}
|
|
+#endif /* 0 */
|
|
|
|
/*
|
|
* Figure out where the mode table is
|
|
@@ -476,11 +495,11 @@ void unlock_vbios(vbios_map * map) {
|
|
case CT_UNKWN:
|
|
break;
|
|
case CT_855GM:
|
|
- outl(0x8000005a, 0xcf8);
|
|
+ OUTL(0x8000005a, 0xcf8);
|
|
map->b1 = inb(0xcfe);
|
|
|
|
- outl(0x8000005a, 0xcf8);
|
|
- outb(0x33, 0xcfe);
|
|
+ OUTL(0x8000005a, 0xcf8);
|
|
+ OUTB(0x33, 0xcfe);
|
|
break;
|
|
case CT_845G:
|
|
case CT_865G:
|
|
@@ -488,13 +507,13 @@ void unlock_vbios(vbios_map * map) {
|
|
case CT_915GM:
|
|
case CT_945G:
|
|
case CT_945GM:
|
|
- outl(0x80000090, 0xcf8);
|
|
+ OUTL(0x80000090, 0xcf8);
|
|
map->b1 = inb(0xcfd);
|
|
map->b2 = inb(0xcfe);
|
|
|
|
- outl(0x80000090, 0xcf8);
|
|
- outb(0x33, 0xcfd);
|
|
- outb(0x33, 0xcfe);
|
|
+ OUTL(0x80000090, 0xcf8);
|
|
+ OUTB(0x33, 0xcfd);
|
|
+ OUTB(0x33, 0xcfe);
|
|
break;
|
|
}
|
|
}
|
|
@@ -526,8 +545,8 @@ void relock_vbios(vbios_map * map) {
|
|
case CT_UNKWN:
|
|
break;
|
|
case CT_855GM:
|
|
- outl(0x8000005a, 0xcf8);
|
|
- outb(map->b1, 0xcfe);
|
|
+ OUTL(0x8000005a, 0xcf8);
|
|
+ OUTB(map->b1, 0xcfe);
|
|
break;
|
|
case CT_845G:
|
|
case CT_865G:
|
|
@@ -535,9 +554,9 @@ void relock_vbios(vbios_map * map) {
|
|
case CT_915GM:
|
|
case CT_945G:
|
|
case CT_945GM:
|
|
- outl(0x80000090, 0xcf8);
|
|
- outb(map->b1, 0xcfd);
|
|
- outb(map->b2, 0xcfe);
|
|
+ OUTL(0x80000090, 0xcf8);
|
|
+ OUTB(map->b1, 0xcfd);
|
|
+ OUTB(map->b2, 0xcfe);
|
|
break;
|
|
}
|
|
}
|