summaryrefslogtreecommitdiff
path: root/xserver/hw/kdrive/openbsd
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2007-05-25 19:10:44 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2007-05-25 19:10:44 +0000
commit9115084396538615472d09ba93bfc94c21cf95f3 (patch)
treee75fd417e13d69b0eab528d1ba6b103f3499b12c /xserver/hw/kdrive/openbsd
parentf2880f188bbe1583ee0e10026511fb6ec7182d74 (diff)
Start filling the holes.
Diffstat (limited to 'xserver/hw/kdrive/openbsd')
-rw-r--r--xserver/hw/kdrive/openbsd/openbsd.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/xserver/hw/kdrive/openbsd/openbsd.c b/xserver/hw/kdrive/openbsd/openbsd.c
index 44df7456c..9d1bf6d04 100644
--- a/xserver/hw/kdrive/openbsd/openbsd.c
+++ b/xserver/hw/kdrive/openbsd/openbsd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: openbsd.c,v 1.1 2007/05/25 15:33:32 matthieu Exp $ */
+/* $OpenBSD: openbsd.c,v 1.2 2007/05/25 19:10:43 matthieu Exp $ */
/*
* Copyright (c) 2007 Matthieu Herrb <matthieu@openbsd.org>
*
@@ -21,6 +21,11 @@
#define XK_PUBLISHING
#include <X11/keysym.h>
#include <X11/Xdefs.h>
+
+#include <errno.h>
+#include <fcntl.h>
+#include <dev/wscons/wsconsio.h>
+
#include "kdrive.h"
#include "kopenbsd.h"
@@ -30,31 +35,50 @@ int OpenBSDApmFd = -1;
static int activeVT;
static Bool enabled;
+#define WSCONS_DEV "/dev/ttyC0"
+
+#define DBG(x) ErrorF x
+
static int
OpenBSDInit(void)
{
- WsconsConsoleFd = -1;
+ DBG(("OpenBSDInit\n"));
+ WsconsConsoleFd = open(WSCONS_DEV, O_RDWR);
+
+ if (WsconsConsoleFd == -1) {
+ FatalError("OpenBSDInit: error opening %s (%d)\n",
+ WSCONS_DEV, errno);
+ }
return 1;
}
Bool
OpenBSDFindPci(CARD16 vendor, CARD16 device, CARD32 count, KdCardAttr *attr)
{
+ DBG(("OpenBSDFindPci %04hx %04hx\n", vendor, device));
/* Find a PCI device matching vendor/device */
/* return KdCardAttr */
- return FALSE;
+ /* XXX */
+ attr->bus = 0;
+ attr->slot = 0;
+ attr->func = 0;
+
+ return TRUE;
}
unsigned char *
OpenBSDGetPciCfg(KdCardAttr *attr)
{
/* Get Config registers for card at attr */
+ DBG(("OpenBSDGetPciCfg %d:%d:%d\n",
+ attr->bus, attr->slot, attr->func));
return NULL;
}
static void
OpenBSDEnable(void)
{
+ DBG(("OpenBSDEnable\n"));
if (enabled)
return;
if (kdSwitchPending) {
@@ -70,6 +94,7 @@ OpenBSDEnable(void)
static Bool
OpenBSDSpecialKey(KeySym sym)
{
+ DBG(("OpenBSDSpecialKey\n"));
/* Initiate VT switch if needed */
return FALSE;
}
@@ -77,6 +102,7 @@ OpenBSDSpecialKey(KeySym sym)
static void
OpenBSDDisable(void)
{
+ DBG(("OpenBSDDisable\n"));
enabled = FALSE;
/* Back to text mode */
/* Remove apm hooks */
@@ -85,6 +111,7 @@ OpenBSDDisable(void)
static void
OpenBSDFini(void)
{
+ DBG(("OpenBSDFini\n"));
if (WsconsConsoleFd < 0)
return;
/* switch back to initial VT */
@@ -102,5 +129,6 @@ KdOsFuncs OpenBSDFuncs = {
void
OsVendorInit(void)
{
+ DBG(("OsVendorInit\n"));
KdOsInit(&OpenBSDFuncs);
}