Initial import of 855resolution 0.4

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.
This commit is contained in:
sturm 2005-08-09 20:14:27 +00:00
parent 2db0721c13
commit 3630bec40d
11 changed files with 250 additions and 0 deletions

View File

@ -0,0 +1,27 @@
# $OpenBSD: Makefile,v 1.1.1.1 2005/08/09 20:14:27 sturm Exp $
ONLY_FOR_ARCHS= i386
COMMENT= "change resolution on available vbios mode for i855/865/915"
DISTNAME= 855resolution-0.4
CATEGORIES= x11
HOMEPAGE= http://perso.wanadoo.fr/apoirier/
MAINTAINER= Nikolay Sturm <sturm@openbsd.org>
# public domain
PERMIT_PACKAGE_CDROM= Yes
PERMIT_PACKAGE_FTP= Yes
PERMIT_DISTFILES_CDROM= Yes
PERMIT_DISTFILES_FTP= Yes
MASTER_SITES= ${HOMEPAGE}
EXTRACT_SUFX= .tgz
NO_REGRESS= Yes
WRKDIST= ${WRKDIR}/855resolution
.include <bsd.port.mk>

View File

@ -0,0 +1,4 @@
MD5 (855resolution-0.4.tgz) = 12237e534def7dd3579a3e8b0a4b9351
RMD160 (855resolution-0.4.tgz) = d075d239257b778f509c8fd96619bfd810194d3b
SHA1 (855resolution-0.4.tgz) = aabba504d0592cac676188f1ce73bd25389d8fda
SIZE (855resolution-0.4.tgz) = 6740

View File

@ -0,0 +1,26 @@
$OpenBSD: patch-855resolution_c,v 1.1.1.1 2005/08/09 20:14:27 sturm Exp $
--- 855resolution.c.orig Wed Aug 3 17:47:56 2005
+++ 855resolution.c Wed Aug 3 17:52:10 2005
@@ -15,7 +15,13 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#if defined(__OpenBSD__)
+#include <i386/sysarch.h>
+#define IOPL(x) i386_iopl(x)
+#else
#include <sys/io.h>
+#define IOPL(x) iopl(x)
+#endif
#include "vbios.h"
#include "plugin.h"
@@ -157,7 +163,7 @@ int list, plugins, mode, x, y;
display_plugins();
}
- if(iopl(3) < 0) {
+ if(IOPL(3) < 0) {
perror("Unable to obtain the proper IO permissions");
return 2;
}

View File

@ -0,0 +1,42 @@
$OpenBSD: patch-Makefile,v 1.1.1.1 2005/08/09 20:14:27 sturm Exp $
--- Makefile.orig Sun May 8 17:27:59 2005
+++ Makefile Tue Jul 26 12:49:55 2005
@@ -3,27 +3,30 @@ PRG=855resolution
# Uncomment this line if you want to test with a VBIOS image file
# VBIOS_FILE:=-DVBIOS_FILE='"../dump/vbios-865.dmp"'
-PLUGINS_SRCS:=${shell ls plugins/*.c}
+PLUGINS_SRCS!=ls plugins/*.c
SRCS=855resolution.c vbios.c plugin.c ${PLUGINS_SRCS}
OBJS=${SRCS:.c=.o}
-PLUGINS_LIST:=${shell cd plugins;ls -x *.c | sed -e 's/.c//g' -e 's/ */,/g' }
-PLUGINS_ADDR:=${shell echo ${PLUGINS_LIST} | sed -e 's/^/\&/g' -e 's/,/,\&/g' }
-VERSION:=${shell cat VERSION.txt}
-LDLIBS:=-lm
+PLUGINS_LIST!=cd plugins;ls -x *.c | sed -e 's/.c//g' -e 's/ *p/,p/g'
+PLUGINS_ADDR!=echo ${PLUGINS_LIST} | sed -e 's/^/\&/g' -e 's/,/,\&/g'
+VERSION!=cat VERSION.txt
+LDLIBS=-lm
-CFLAGS:=-Wall -I`pwd` -DVERSION='"${VERSION}"' -DPLUGINS='${PLUGINS_LIST}' -DREF_PLUGINS='${PLUGINS_ADDR}' ${VBIOS_FILE}
+CFLAGS+=-Wall -I`pwd` -DVERSION='"${VERSION}"' -DPLUGINS='${PLUGINS_LIST}' -DREF_PLUGINS='${PLUGINS_ADDR}' ${VBIOS_FILE}
LDFLAGS:=-s
all: ${PRG}
${PRG}: ${OBJS}
+ ${CC} ${OBJS:S,plugins/,,} -o ${PRG} -li386
clean:
rm -f ${OBJS} ${PRG} *~ plugins/*~
-install: ${PRG}
- cp ${PRG} /usr/sbin
+install:
+ ${BSD_INSTALL_PROGRAM} ${PRG} ${PREFIX}/sbin
+ ${BSD_INSTALL_DATA_DIR} ${PREFIX}/share/doc/855resolution
+ ${BSD_INSTALL_DATA} README.txt ${PREFIX}/share/doc/855resolution
distrib: clean
tar -C .. -zcvf /tmp/${PRG}-`cat VERSION.txt`.tgz --exclude '.*' ${PRG}

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-plugins_plugin1_c,v 1.1.1.1 2005/08/09 20:14:27 sturm Exp $
--- plugins/plugin1.c.orig Wed Aug 3 17:56:17 2005
+++ plugins/plugin1.c Wed Aug 3 17:56:51 2005
@@ -12,7 +12,6 @@
*/
#include <stdio.h>
-#include <sys/io.h>
#include "../plugin.h"

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-plugins_plugin2_c,v 1.1.1.1 2005/08/09 20:14:27 sturm Exp $
--- plugins/plugin2.c.orig Wed Aug 3 17:56:57 2005
+++ plugins/plugin2.c Wed Aug 3 17:57:01 2005
@@ -14,7 +14,6 @@
/* VBIOS as found on the Dell 510m */
#include <stdio.h>
-#include <sys/io.h>
#include "../plugin.h"

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-plugins_plugin3_c,v 1.1.1.1 2005/08/09 20:14:27 sturm Exp $
--- plugins/plugin3.c.orig Wed Aug 3 17:57:05 2005
+++ plugins/plugin3.c Wed Aug 3 17:57:10 2005
@@ -12,7 +12,6 @@
*/
#include <stdio.h>
-#include <sys/io.h>
#include "../plugin.h"

View File

@ -0,0 +1,97 @@
$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
}

View File

@ -0,0 +1,10 @@
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.
It patches only the RAM version of the video bios so the new resolution
is lost each time you reboot.
As 855resolution needs write access to /dev/mem, it does only work
in securelevel 0 or below.

View File

@ -0,0 +1,7 @@
To set the resolution at reboot, add something like this to
rc.securelevel:
if [ -x ${PREFIX}/sbin/855resolution ]; then
echo -n ' 855resolution'
${PREFIX}/sbin/855resolution 4d 1400 1050 > /dev/null
fi

View File

@ -0,0 +1,4 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2005/08/09 20:14:27 sturm Exp $
sbin/855resolution
share/doc/855resolution/
share/doc/855resolution/README.txt