Allow sync-on-green to be controlled by ARCS environment variable "SyncOnGreen".

Set to anything starting with the letter 'n' to disable sync-on-green, set to
anything else or leave undefined to keep default behavior.
This commit is contained in:
sekiya 2008-02-02 04:38:37 +00:00
parent 6d8f3f878b
commit ab0a73e205
1 changed files with 15 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: crmfb.c,v 1.9 2007/12/02 17:36:57 jmcneill Exp $ */
/* $NetBSD: crmfb.c,v 1.10 2008/02/02 04:38:37 sekiya Exp $ */
/*-
* Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.9 2007/12/02 17:36:57 jmcneill Exp $");
__KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.10 2008/02/02 04:38:37 sekiya Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -110,6 +110,10 @@ int crmfb_probe(void);
#define KERNADDR(p) ((void *)((p).addr))
#define DMAADDR(p) ((p).map->dm_segs[0].ds_addr)
#define CRMFB_REG_MASK(msb, lsb) \
( (((uint32_t) 1 << ((msb)-(lsb)+1)) - 1) << (lsb) )
struct crmfb_dma {
bus_dmamap_t map;
void *addr;
@ -706,6 +710,7 @@ crmfb_setup_video(struct crmfb_softc *sc, int depth)
{
uint32_t d, h;
int i;
const char *wantsync;
/* disable DMA */
d = bus_space_read_4(sc->sc_iot, sc->sc_ioh, CRMFB_OVR_CONTROL);
@ -803,6 +808,14 @@ crmfb_setup_video(struct crmfb_softc *sc, int depth)
d |= (1 << CRMFB_FRM_CONTROL_DMAEN_SHIFT);
crmfb_write_reg(sc, CRMFB_FRM_CONTROL, d);
/* turn off sync-on-green */
wantsync = ARCBIOS->GetEnvironmentVariable("SyncOnGreen");
if ( (wantsync != NULL) && (wantsync[0] == 'n') ) {
d = ( 1 << CRMFB_VT_FLAGS_SYNC_LOW_LSB) & CRMFB_REG_MASK(CRMFB_VT_FLAGS_SYNC_LOW_MSB, CRMFB_VT_FLAGS_SYNC_LOW_LSB);
crmfb_write_reg(sc, CRMFB_VT_FLAGS, d);
}
sc->sc_depth = depth;
return 0;
}