summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMike Belopuhov <mikeb@cvs.openbsd.org>2012-05-29 17:37:10 +0000
committerMike Belopuhov <mikeb@cvs.openbsd.org>2012-05-29 17:37:10 +0000
commit90afeea55a5f9e45f962adbbf8b6f98aea05c85d (patch)
treed4dd256a708a6f690d8877f9aed261a18f337e25 /sys
parent698e0023fa1a7b4f5ee9538ebddb2382616a5d12 (diff)
Make it possible to disable the Sync-on-Green signal by setting the
ARCBios environment variable OSLoadOptions to "nosog". Now everyone can enjoy running O2 without an SGI monitor and don't turn vegetarian afterwards. All the essential bits come from NetBSD's crmfb driver except they've chosen to use a "SyncOnGreen" variable not saved by the ARCS. Pointers and corrections from and ok miod, jsing
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sgi/dev/gbe.c10
-rw-r--r--sys/arch/sgi/dev/gbereg.h4
-rw-r--r--sys/arch/sgi/include/autoconf.h3
-rw-r--r--sys/arch/sgi/sgi/autoconf.c3
-rw-r--r--sys/arch/sgi/sgi/machdep.c5
5 files changed, 19 insertions, 6 deletions
diff --git a/sys/arch/sgi/dev/gbe.c b/sys/arch/sgi/dev/gbe.c
index 508e879633e..a89b1b262e9 100644
--- a/sys/arch/sgi/dev/gbe.c
+++ b/sys/arch/sgi/dev/gbe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: gbe.c,v 1.15 2012/04/16 22:17:13 miod Exp $ */
+/* $OpenBSD: gbe.c,v 1.16 2012/05/29 17:37:09 mikeb Exp $ */
/*
* Copyright (c) 2007, 2008, 2009 Joel Sing <jsing@openbsd.org>
@@ -564,6 +564,11 @@ gbe_enable(struct gbe_softc *gsc)
if (i == 10000)
printf("timeout unfreezing pixel counter!\n");
+ /* Disable sync-on-green. */
+ if (strcmp(osloadoptions, "nosog") == 0)
+ bus_space_write_4(gsc->iot, gsc->ioh, GBE_VT_FLAGS,
+ GBE_VT_SYNC_LOW);
+
/* Provide GBE with address of tilemap and enable DMA. */
bus_space_write_4(gsc->iot, gsc->ioh, GBE_FB_CTRL,
((screen->tm_phys >> 9) <<
@@ -581,6 +586,9 @@ gbe_disable(struct gbe_softc *gsc)
if ((val & GBE_VT_XY_FREEZE) == GBE_VT_XY_FREEZE)
return;
+ /* Enable sync-on-green. */
+ bus_space_write_4(gsc->iot, gsc->ioh, GBE_VT_FLAGS, 0);
+
val = bus_space_read_4(gsc->iot, gsc->ioh, GBE_DOTCLOCK);
if ((val & GBE_DOTCLOCK_RUN) == 0)
return;
diff --git a/sys/arch/sgi/dev/gbereg.h b/sys/arch/sgi/dev/gbereg.h
index 5f20f704d7c..c20007fa3c5 100644
--- a/sys/arch/sgi/dev/gbereg.h
+++ b/sys/arch/sgi/dev/gbereg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: gbereg.h,v 1.5 2012/04/16 22:17:13 miod Exp $ */
+/* $OpenBSD: gbereg.h,v 1.6 2012/05/29 17:37:09 mikeb Exp $ */
/*
* Copyright (c) 2007, Joel Sing <jsing@openbsd.org>
@@ -52,7 +52,7 @@
#define GBE_VT_VBLANK 0x00010010 /* Vertical blanking */
#define GBE_VT_HBLANK 0x00010014 /* Horizontal blanking */
#define GBE_VT_FLAGS 0x00010018 /* Video timing flags */
-#define GBE_VT_SYNC_LOW 0x00000010 /* Sync on green */
+#define GBE_VT_SYNC_LOW 0x00000020 /* Sync on green */
#define GBE_VT_HPIX 0x00010034 /* Horizontal pixel on/off */
#define GBE_VT_VPIX 0x00010038 /* Vertical pixel on/off */
#define GBE_VT_VPIX_OFF_MASK 0x00000fff
diff --git a/sys/arch/sgi/include/autoconf.h b/sys/arch/sgi/include/autoconf.h
index 6fdb3a55034..7a6f08c6cc7 100644
--- a/sys/arch/sgi/include/autoconf.h
+++ b/sys/arch/sgi/include/autoconf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.h,v 1.36 2012/05/27 14:27:10 miod Exp $ */
+/* $OpenBSD: autoconf.h,v 1.37 2012/05/29 17:37:09 mikeb Exp $ */
/*
* Copyright (c) 2001-2003 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -102,6 +102,7 @@ void ip30_autoconf(struct device *);
void ip32_setup(void);
extern char osloadpartition[256];
+extern char osloadoptions[129];
extern int16_t masternasid;
extern int16_t currentnasid;
diff --git a/sys/arch/sgi/sgi/autoconf.c b/sys/arch/sgi/sgi/autoconf.c
index 0c18a9b1e0a..d927e0a006d 100644
--- a/sys/arch/sgi/sgi/autoconf.c
+++ b/sys/arch/sgi/sgi/autoconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: autoconf.c,v 1.34 2012/03/28 20:44:23 miod Exp $ */
+/* $OpenBSD: autoconf.c,v 1.35 2012/05/29 17:37:09 mikeb Exp $ */
/*
* Copyright (c) 2009, 2010 Miodrag Vallat.
*
@@ -127,6 +127,7 @@ struct device *bootdv = NULL;
int16_t currentnasid = 0;
char osloadpartition[256];
+char osloadoptions[129];
/*
* Configure all devices found that we know about.
diff --git a/sys/arch/sgi/sgi/machdep.c b/sys/arch/sgi/sgi/machdep.c
index 0247d1f44bc..c0150956c24 100644
--- a/sys/arch/sgi/sgi/machdep.c
+++ b/sys/arch/sgi/sgi/machdep.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machdep.c,v 1.124 2012/05/27 14:27:10 miod Exp $ */
+/* $OpenBSD: machdep.c,v 1.125 2012/05/29 17:37:09 mikeb Exp $ */
/*
* Copyright (c) 2003-2004 Opsycon AB (www.opsycon.se / www.opsycon.com)
@@ -226,6 +226,9 @@ mips_init(int argc, void *argv, caddr_t boot_esym)
bios_consrate = bios_getenvint("dbaud");
if (bios_consrate < 50 || bios_consrate > 115200)
bios_consrate = 9600; /* sane default */
+ cp = Bios_GetEnvironmentVariable("OSLoadOptions");
+ if (cp != NULL && strlen(cp) > 0)
+ strlcpy(osloadoptions, cp, sizeof osloadoptions);
/*
* Determine system type and set up configuration record data.