Author: sobomax
Date: Fri Aug 25 17:29:48 2017
New Revision: 322896
URL: https://svnweb.freebsd.org/changeset/base/322896

Log:
  Make spinconsole platform independent and hook it up into EFI loader on
  i386 and amd64. Not enabled on ARMs, those are lacking timer routines.
  
  MFC after:    2 moths
  Sponsored by: Sippy Software, Inc.

Modified:
  head/sys/boot/efi/loader/arch/amd64/Makefile.inc
  head/sys/boot/efi/loader/arch/i386/Makefile.inc
  head/sys/boot/efi/loader/conf.c
  head/sys/boot/i386/libi386/spinconsole.c

Modified: head/sys/boot/efi/loader/arch/amd64/Makefile.inc
==============================================================================
--- head/sys/boot/efi/loader/arch/amd64/Makefile.inc    Fri Aug 25 16:38:21 
2017        (r322895)
+++ head/sys/boot/efi/loader/arch/amd64/Makefile.inc    Fri Aug 25 17:29:48 
2017        (r322896)
@@ -9,7 +9,8 @@ SRCS+=  amd64_tramp.S \
 
 .PATH: ${.CURDIR}/../../i386/libi386
 SRCS+= nullconsole.c \
-       comconsole.c
+       comconsole.c \
+       spinconsole.c
 
-CFLAGS+=       -fPIC
+CFLAGS+=       -fPIC -DTERM_EMU
 LDFLAGS+=      -Wl,-znocombreloc

Modified: head/sys/boot/efi/loader/arch/i386/Makefile.inc
==============================================================================
--- head/sys/boot/efi/loader/arch/i386/Makefile.inc     Fri Aug 25 16:38:21 
2017        (r322895)
+++ head/sys/boot/efi/loader/arch/i386/Makefile.inc     Fri Aug 25 17:29:48 
2017        (r322896)
@@ -7,7 +7,8 @@ SRCS+=  start.S \
 
 .PATH: ${.CURDIR}/../../i386/libi386
 SRCS+= nullconsole.c \
-       comconsole.c
+       comconsole.c \
+       spinconsole.c
 
-CFLAGS+=       -fPIC
+CFLAGS+=       -fPIC -DTERM_EMU
 LDFLAGS+=      -Wl,-znocombreloc

Modified: head/sys/boot/efi/loader/conf.c
==============================================================================
--- head/sys/boot/efi/loader/conf.c     Fri Aug 25 16:38:21 2017        
(r322895)
+++ head/sys/boot/efi/loader/conf.c     Fri Aug 25 17:29:48 2017        
(r322896)
@@ -69,6 +69,7 @@ extern struct console efi_console;
 #if defined(__amd64__) || defined(__i386__)
 extern struct console comconsole;
 extern struct console nullconsole;
+extern struct console spinconsole;
 #endif
 
 struct console *consoles[] = {
@@ -76,6 +77,7 @@ struct console *consoles[] = {
 #if defined(__amd64__) || defined(__i386__)
        &comconsole,
        &nullconsole,
+       &spinconsole,
 #endif
        NULL
 };

Modified: head/sys/boot/i386/libi386/spinconsole.c
==============================================================================
--- head/sys/boot/i386/libi386/spinconsole.c    Fri Aug 25 16:38:21 2017        
(r322895)
+++ head/sys/boot/i386/libi386/spinconsole.c    Fri Aug 25 17:29:48 2017        
(r322896)
@@ -41,16 +41,14 @@ __FBSDID("$FreeBSD$");
 #include <stand.h>
 #include <bootstrap.h>
 
-extern void get_pos(int *x, int *y);
-extern void curs_move(int *_x, int *_y, int x, int y);
-extern void vidc_biosputchar(int c);
-
 static void    spinc_probe(struct console *cp);
 static int     spinc_init(int arg);
 static void    spinc_putchar(int c);
 static int     spinc_getchar(void);
 static int     spinc_ischar(void);
 
+extern struct console *consoles[];
+
 struct console spinconsole = {
        "spinconsole",
        "spin port",
@@ -62,47 +60,53 @@ struct console spinconsole = {
        spinc_ischar
 };
 
+static struct console *parent = NULL;
+
 static void
 spinc_probe(struct console *cp)
 {
-       cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT);
+
+       if (parent == NULL)
+               parent = consoles[0];
+       parent->c_probe(cp);
 }
 
 static int
 spinc_init(int arg)
 {
-       return(0);
+
+       return(parent->c_init(arg));
 }
 
 static void
 spinc_putchar(int c)
 {
-       static int curx, cury;
        static unsigned tw_chars = 0x5C2D2F7C;    /* "\-/|" */
-       static time_t lasttime;
+       static time_t lasttime = 0;
        time_t now;
 
-       now = time(NULL);
+       now = time(0);
        if (now < (lasttime + 1))
                return;
-       lasttime = now;
 #ifdef TERM_EMU
-       get_pos(&curx, &cury);
-       if (curx > 0)
-               curs_move(&curx, &cury, curx - 1, cury);
+       if (lasttime > 0)
+               parent->c_out('\b');
 #endif
-       vidc_biosputchar((char)tw_chars);
+       lasttime = now;
+       parent->c_out((char)tw_chars);
        tw_chars = (tw_chars >> 8) | ((tw_chars & (unsigned long)0xFF) << 24);
 }
 
 static int
 spinc_getchar(void)
 {
+
        return(-1);
 }
 
 static int
 spinc_ischar(void)
 {
+
        return(0);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to