Skip to content

Commit

Permalink
Don't expect the OS to provide inb/outb, just define the assembler
Browse files Browse the repository at this point in the history
functions directly. Fixes build on NetBSD current. Add DESTDIR support.
  • Loading branch information
jsonn committed Oct 29, 2007
1 parent 9cf1630 commit ecc05e3
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
4 changes: 3 additions & 1 deletion sysutils/vbetool/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.4 2007/08/08 17:12:44 xtraeme Exp $
# $NetBSD: Makefile,v 1.5 2007/10/29 18:41:24 joerg Exp $
#

DISTNAME= vbetool_0.7-1
Expand All @@ -11,6 +11,8 @@ MAINTAINER= [email protected]
HOMEPAGE= http://www.srcf.ucam.org/~mjg59/vbetool/
COMMENT= Run real-mode video BIOS code to alter hardware state

PKG_DESTDIR_SUPPORT= user-destdir

ONLY_FOR_PLATFORM+= Linux-*-i386 NetBSD-*-i386 NetBSD-*-x86_64

WRKSRC= ${WRKDIR}/vbetool-0.7
Expand Down
4 changes: 2 additions & 2 deletions sysutils/vbetool/distinfo
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
$NetBSD: distinfo,v 1.3 2007/08/08 17:12:44 xtraeme Exp $
$NetBSD: distinfo,v 1.4 2007/10/29 18:41:24 joerg Exp $

SHA1 (vbetool_0.7-1.tar.gz) = 49c86aa6fb877f35a0b336d6aa1d6b204c2cc66f
RMD160 (vbetool_0.7-1.tar.gz) = b5a5d3a0794f8dbb06c78373e15c26d9536d8303
Size (vbetool_0.7-1.tar.gz) = 176277 bytes
SHA1 (patch-aa) = d27a3dd8eb1943c3f30351996483a01638521e90
SHA1 (patch-ab) = 1b5b041ec8dac282a0e8305b82af2c0fe325e1e8
SHA1 (patch-ab) = 16e42e95d69b98b5ec5886a84bbc294aea942056
SHA1 (patch-ac) = 89b24bd2fadbf40ab614186b53dc339653029919
44 changes: 27 additions & 17 deletions sysutils/vbetool/patches/patch-ab
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
$NetBSD: patch-ab,v 1.3 2007/08/08 17:12:44 xtraeme Exp $
$NetBSD: patch-ab,v 1.4 2007/10/29 18:41:24 joerg Exp $

--- vbetool.c.orig 2006-07-26 03:27:21.000000000 +0200
+++ vbetool.c 2007-08-08 19:07:18.000000000 +0200
@@ -8,19 +8,29 @@
+++ vbetool.c
@@ -8,19 +8,39 @@ This program is released under the terms
version 2
*/

Expand All @@ -24,16 +24,26 @@ $NetBSD: patch-ab,v 1.3 2007/08/08 17:12:44 xtraeme Exp $

+#ifdef __NetBSD__
+#include <machine/sysarch.h>
+#include <machine/pio.h>
+#endif
+
+/* out* arguments are swapped between NetBSD and linux */
+#define __outb(v, p) outb((p), (v))
+static uint8_t
+asm_inb(unsigned port)
+{
+ uint8_t data;
+ __asm volatile("inb %w1,%0" : "=a" (data) : "d" (port));
+ return data;
+}
+
+static __inline void
+asm_outb(uint8_t data, unsigned port)
+{
+ __asm volatile("outb %0,%w1" : : "a" (data), "d" (port));
+}
+
#include "include/lrmi.h"
#include "vbetool.h"

@@ -42,8 +52,16 @@
@@ -42,8 +62,16 @@ int vbetool_init (void) {
exit(1);
}

Expand All @@ -50,7 +60,7 @@ $NetBSD: patch-ab,v 1.3 2007/08/08 17:12:44 xtraeme Exp $

pacc = pci_alloc();
pacc->numeric_ids = 1;
@@ -256,7 +274,9 @@
@@ -256,7 +284,9 @@ void restore_state_from(char *data)

LRMI_free_real(data);

Expand All @@ -60,7 +70,7 @@ $NetBSD: patch-ab,v 1.3 2007/08/08 17:12:44 xtraeme Exp $

}

@@ -476,23 +496,25 @@
@@ -476,23 +506,25 @@ int check_console()
return 11;
}

Expand All @@ -75,10 +85,10 @@ $NetBSD: patch-ab,v 1.3 2007/08/08 17:12:44 xtraeme Exp $
- outb(0x01 | inb(0x3C3), 0x3C3);
- outb(0x08 | inb(0x46e8), 0x46e8);
- outb(0x01 | inb(0x102), 0x102);
+ __outb(0x03 | inb(0x3CC), 0x3C2);
+ __outb(0x01 | inb(0x3C3), 0x3C3);
+ __outb(0x08 | inb(0x46e8), 0x46e8);
+ __outb(0x01 | inb(0x102), 0x102);
+ asm_outb(0x03 | asm_inb(0x3CC), 0x3C2);
+ asm_outb(0x01 | asm_inb(0x3C3), 0x3C3);
+ asm_outb(0x08 | asm_inb(0x46e8), 0x46e8);
+ asm_outb(0x01 | asm_inb(0x102), 0x102);
return 0;
}

Expand All @@ -87,10 +97,10 @@ $NetBSD: patch-ab,v 1.3 2007/08/08 17:12:44 xtraeme Exp $
- outb(~0x01 & inb(0x3C3), 0x3C3);
- outb(~0x08 & inb(0x46e8), 0x46e8);
- outb(~0x01 & inb(0x102), 0x102);
+ __outb(~0x03 & inb(0x3CC), 0x3C2);
+ __outb(~0x01 & inb(0x3C3), 0x3C3);
+ __outb(~0x08 & inb(0x46e8), 0x46e8);
+ __outb(~0x01 & inb(0x102), 0x102);
+ asm_outb(~0x03 & asm_inb(0x3CC), 0x3C2);
+ asm_outb(~0x01 & asm_inb(0x3C3), 0x3C3);
+ asm_outb(~0x08 & asm_inb(0x46e8), 0x46e8);
+ asm_outb(~0x01 & asm_inb(0x102), 0x102);
return 0;
}

0 comments on commit ecc05e3

Please sign in to comment.