Date: Sat, 25 Aug 2012 08:09:38 +0000 (UTC) From: Robert Watson <rwatson@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r239670 - in head/sys: conf dev/fb dev/syscons mips/mips Message-ID: <201208250809.q7P89cdS004442@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: rwatson Date: Sat Aug 25 08:09:37 2012 New Revision: 239670 URL: http://svn.freebsd.org/changeset/base/239670 Log: 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 Added: head/sys/mips/mips/sc_machdep.c (contents, props changed) Modified: head/sys/conf/files.mips head/sys/conf/options.mips head/sys/dev/fb/fbreg.h head/sys/dev/syscons/schistory.c head/sys/dev/syscons/scterm-teken.c head/sys/dev/syscons/syscons.c Modified: head/sys/conf/files.mips ============================================================================== --- head/sys/conf/files.mips Sat Aug 25 08:02:46 2012 (r239669) +++ head/sys/conf/files.mips Sat Aug 25 08:09:37 2012 (r239670) @@ -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 Modified: head/sys/conf/options.mips ============================================================================== --- head/sys/conf/options.mips Sat Aug 25 08:02:46 2012 (r239669) +++ head/sys/conf/options.mips Sat Aug 25 08:09:37 2012 (r239670) @@ -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 Modified: head/sys/dev/fb/fbreg.h ============================================================================== --- head/sys/dev/fb/fbreg.h Sat Aug 25 08:02:46 2012 (r239669) +++ head/sys/dev/fb/fbreg.h Sat Aug 25 08:09:37 2012 (r239670) @@ -92,6 +92,29 @@ void ofwfb_fillw(int pat, void *base, si 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)) Modified: head/sys/dev/syscons/schistory.c ============================================================================== --- head/sys/dev/syscons/schistory.c Sat Aug 25 08:02:46 2012 (r239669) +++ head/sys/dev/syscons/schistory.c Sat Aug 25 08:09:37 2012 (r239670) @@ -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> Modified: head/sys/dev/syscons/scterm-teken.c ============================================================================== --- head/sys/dev/syscons/scterm-teken.c Sat Aug 25 08:02:46 2012 (r239669) +++ head/sys/dev/syscons/scterm-teken.c Sat Aug 25 08:09:37 2012 (r239670) @@ -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> Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Sat Aug 25 08:02:46 2012 (r239669) +++ head/sys/dev/syscons/syscons.c Sat Aug 25 08:09:37 2012 (r239670) @@ -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> Added: head/sys/mips/mips/sc_machdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/mips/sc_machdep.c Sat Aug 25 08:09:37 2012 (r239670) @@ -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); +}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208250809.q7P89cdS004442>