3630bec40d
This software changes the resolution of an available vbios mode. It is reported to work on several i855 / i865 / i915 chipset based laptops. This is needed on certain laptops in order to get the full native resolution of the LCD.
98 lines
2.1 KiB
Plaintext
98 lines
2.1 KiB
Plaintext
$OpenBSD: patch-vbios_c,v 1.1.1.1 2005/08/09 20:14:27 sturm Exp $
|
|
--- vbios.c.orig Wed Aug 3 17:57:29 2005
|
|
+++ vbios.c Wed Aug 3 18:08:27 2005
|
|
@@ -18,7 +18,15 @@
|
|
#include <string.h>
|
|
#include <sys/mman.h>
|
|
#include <fcntl.h>
|
|
+#if defined(__OpenBSD__)
|
|
+#include <i386/pio.h>
|
|
+#define OUTL(x, y) outl(y, x)
|
|
+#define OUTB(x, y) outb(y, x)
|
|
+#else
|
|
#include <sys/io.h>
|
|
+#define OUTL(x, y) outl(x, y)
|
|
+#define OUTB(x, y) outb(x, y)
|
|
+#endif
|
|
|
|
#include "vbios.h"
|
|
|
|
@@ -40,7 +48,7 @@ static int biosfd = 0;
|
|
static unsigned char b1, b2;
|
|
|
|
static unsigned int get_chipset(void) {
|
|
- outl(0x80000000, 0xcf8);
|
|
+ OUTL(0x80000000, 0xcf8);
|
|
return inl(0xcfc);
|
|
}
|
|
|
|
@@ -75,35 +83,35 @@ void close_bios(void) {
|
|
void unlock_bios(void) {
|
|
if(get_chipset() == CHIPSET_855)
|
|
{
|
|
- outl(0x8000005a, 0xcf8);
|
|
+ OUTL(0x8000005a, 0xcf8);
|
|
b1 = inb(0xcfe);
|
|
|
|
- outl(0x8000005a, 0xcf8);
|
|
- outb(0x33, 0xcfe);
|
|
+ OUTL(0x8000005a, 0xcf8);
|
|
+ OUTB(0x33, 0xcfe);
|
|
}
|
|
else
|
|
{
|
|
- outl(0x80000090, 0xcf8);
|
|
+ OUTL(0x80000090, 0xcf8);
|
|
b1 = inb(0xcfd);
|
|
b2 = inb(0xcfe);
|
|
|
|
- outl(0x80000090, 0xcf8);
|
|
- outb(0x33, 0xcfd);
|
|
- outb(0x33, 0xcfe);
|
|
+ OUTL(0x80000090, 0xcf8);
|
|
+ OUTB(0x33, 0xcfd);
|
|
+ OUTB(0x33, 0xcfe);
|
|
}
|
|
}
|
|
|
|
void relock_bios(void) {
|
|
if(get_chipset() == CHIPSET_855)
|
|
{
|
|
- outl(0x8000005a, 0xcf8);
|
|
- outb(b1, 0xcfe);
|
|
+ OUTL(0x8000005a, 0xcf8);
|
|
+ OUTB(b1, 0xcfe);
|
|
}
|
|
else
|
|
{
|
|
- outl(0x80000090, 0xcf8);
|
|
- outb(b1, 0xcfd);
|
|
- outb(b2, 0xcfe);
|
|
+ OUTL(0x80000090, 0xcf8);
|
|
+ OUTB(b1, 0xcfd);
|
|
+ OUTB(b2, 0xcfe);
|
|
}
|
|
}
|
|
|
|
@@ -137,6 +145,20 @@ unsigned int chipset;
|
|
}
|
|
|
|
unsigned char *get_vbios_cfg(void) {
|
|
+#if defined(__OpenBSD__)
|
|
+ char *b = bios;
|
|
+ int ctr = 0;
|
|
+ int limit = VBIOS_SIZE - strlen(CFG_SIGNATURE);
|
|
+
|
|
+ while (memcmp(b, CFG_SIGNATURE, strlen(CFG_SIGNATURE))) {
|
|
+ b++;
|
|
+ if (++ctr > limit)
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
+ return b;
|
|
+#else
|
|
return memmem(bios, VBIOS_SIZE, CFG_SIGNATURE, strlen(CFG_SIGNATURE));
|
|
+#endif
|
|
}
|
|
|