Provide basic glue to allow syscons to be used on MIPS, modelled

on PowerPC support.  This was clearly not something syscons was
designed to do (very specific assumptions about the nature of VGA
consoles on PCs), but fortunately others have long since blazed
the way on making it work regardless of that.

Sponsored by:	DARPA, AFRL
This commit is contained in:
Robert Watson 2012-08-25 08:09:37 +00:00
parent 431735d0c3
commit 8122a592ee
7 changed files with 126 additions and 3 deletions

View File

@ -122,3 +122,9 @@ dev/ofw/ofw_fdt.c optional fdt
dev/fdt/fdt_mips.c optional fdt
dev/fb/fb.c optional sc
dev/kbd/kbd.c optional sc
dev/syscons/scgfbrndr.c optional sc
dev/syscons/scterm-teken.c optional sc
dev/syscons/scvtb.c optional sc
mips/mips/sc_machdep.c optional sc

View File

@ -46,6 +46,10 @@ CFE_CONSOLE opt_global.h
CFE_ENV opt_global.h
CFE_ENV_SIZE opt_global.h
GFB_DEBUG opt_gfb.h
GFB_NO_FONT_LOADING opt_gfb.h
GFB_NO_MODE_CHANGE opt_gfb.h
NOFPU opt_global.h
TICK_USE_YAMON_FREQ opt_global.h

View File

@ -92,6 +92,29 @@ void ofwfb_fillw(int pat, void *base, size_t cnt);
u_int16_t ofwfb_readw(u_int16_t *addr);
void ofwfb_writew(u_int16_t *addr, u_int16_t val);
#elif defined(__mips__)
/*
* Use amd64/i386-like settings under the assumption that MIPS-based display
* drivers will have to add a level of indirection between a syscons-managed
* frame buffer and the actual video hardware. We are forced to do this
* because syscons doesn't carry around required busspace handles and tags to
* use here. This is only really a problem for true VGA devices hooked up to
* MIPS, as others will be performing a translation anyway.
*/
#define bcopy_io(s, d, c) memcpy((void *)(d), (void *)(s), (c))
#define bcopy_toio(s, d, c) memcpy((void *)(d), (void *)(s), (c))
#define bcopy_fromio(s, d, c) memcpy((void *)(d), (void *)(s), (c))
#define bzero_io(d, c) memset((void *)(d), 0, (c))
#define fill_io(p, d, c) memset((void *)(d), (p), (c))
static __inline void
fillw(int val, uint16_t *buf, size_t size)
{
while (size--)
*buf++ = val;
}
#define fillw_io(p, d, c) fillw((p), (void *)(d), (c))
#else /* !__i386__ && !__amd64__ && !__ia64__ && !__sparc64__ && !__powerpc__ */
#define bcopy_io(s, d, c) memcpy_io((d), (s), (c))
#define bcopy_toio(s, d, c) memcpy_toio((d), (void *)(s), (c))

View File

@ -42,7 +42,7 @@ __FBSDID("$FreeBSD$");
#include <sys/kernel.h>
#include <sys/malloc.h>
#if defined(__sparc64__) || defined(__powerpc__)
#if defined(__sparc64__) || defined(__powerpc__) || defined(__mips__)
#include <machine/sc_machdep.h>
#else
#include <machine/pc/display.h>

View File

@ -40,7 +40,7 @@ __FBSDID("$FreeBSD$");
#include <sys/consio.h>
#include <sys/kbio.h>
#if defined(__sparc64__) || defined(__powerpc__)
#if defined(__sparc64__) || defined(__powerpc__) || defined(__mips__)
#include <machine/sc_machdep.h>
#else
#include <machine/pc/display.h>

View File

@ -62,7 +62,7 @@ __FBSDID("$FreeBSD$");
#include <sys/power.h>
#include <machine/clock.h>
#if defined(__sparc64__) || defined(__powerpc__)
#if defined(__sparc64__) || defined(__powerpc__) || defined(__mips__)
#include <machine/sc_machdep.h>
#else
#include <machine/pc/display.h>

View File

@ -0,0 +1,90 @@
/*-
* Copyright (c) 2003 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/module.h>
#include <sys/bus.h>
#include <sys/cons.h>
#include <sys/kbio.h>
#include <sys/consio.h>
#include <sys/sysctl.h>
#include <dev/syscons/syscons.h>
static sc_softc_t sc_softcs[8];
int
sc_get_cons_priority(int *unit, int *flags)
{
*unit = 0;
*flags = 0;
return (CN_INTERNAL);
}
int
sc_max_unit(void)
{
return (1);
}
sc_softc_t *
sc_get_softc(int unit, int flags)
{
sc_softc_t *sc;
if (unit < 0)
return (NULL);
sc = &sc_softcs[unit];
sc->unit = unit;
if ((sc->flags & SC_INIT_DONE) == 0) {
sc->keyboard = -1;
sc->adapter = -1;
sc->cursor_char = SC_CURSOR_CHAR;
sc->mouse_char = SC_MOUSE_CHAR;
}
return (sc);
}
void
sc_get_bios_values(bios_values_t *values)
{
values->cursor_start = 0;
values->cursor_end = 32;
values->shift_state = 0;
}
int
sc_tone(int hz)
{
return (0);
}