mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
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.
This commit is contained in:
parent
5a28df2e13
commit
c7e10205ae
4 changed files with 26 additions and 18 deletions
|
|
@ -9,7 +9,8 @@ SRCS+= amd64_tramp.S \
|
||||||
|
|
||||||
.PATH: ${.CURDIR}/../../i386/libi386
|
.PATH: ${.CURDIR}/../../i386/libi386
|
||||||
SRCS+= nullconsole.c \
|
SRCS+= nullconsole.c \
|
||||||
comconsole.c
|
comconsole.c \
|
||||||
|
spinconsole.c
|
||||||
|
|
||||||
CFLAGS+= -fPIC
|
CFLAGS+= -fPIC -DTERM_EMU
|
||||||
LDFLAGS+= -Wl,-znocombreloc
|
LDFLAGS+= -Wl,-znocombreloc
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,8 @@ SRCS+= start.S \
|
||||||
|
|
||||||
.PATH: ${.CURDIR}/../../i386/libi386
|
.PATH: ${.CURDIR}/../../i386/libi386
|
||||||
SRCS+= nullconsole.c \
|
SRCS+= nullconsole.c \
|
||||||
comconsole.c
|
comconsole.c \
|
||||||
|
spinconsole.c
|
||||||
|
|
||||||
CFLAGS+= -fPIC
|
CFLAGS+= -fPIC -DTERM_EMU
|
||||||
LDFLAGS+= -Wl,-znocombreloc
|
LDFLAGS+= -Wl,-znocombreloc
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ extern struct console efi_console;
|
||||||
#if defined(__amd64__) || defined(__i386__)
|
#if defined(__amd64__) || defined(__i386__)
|
||||||
extern struct console comconsole;
|
extern struct console comconsole;
|
||||||
extern struct console nullconsole;
|
extern struct console nullconsole;
|
||||||
|
extern struct console spinconsole;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct console *consoles[] = {
|
struct console *consoles[] = {
|
||||||
|
|
@ -76,6 +77,7 @@ struct console *consoles[] = {
|
||||||
#if defined(__amd64__) || defined(__i386__)
|
#if defined(__amd64__) || defined(__i386__)
|
||||||
&comconsole,
|
&comconsole,
|
||||||
&nullconsole,
|
&nullconsole,
|
||||||
|
&spinconsole,
|
||||||
#endif
|
#endif
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -41,16 +41,14 @@ __FBSDID("$FreeBSD$");
|
||||||
#include <stand.h>
|
#include <stand.h>
|
||||||
#include <bootstrap.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 void spinc_probe(struct console *cp);
|
||||||
static int spinc_init(int arg);
|
static int spinc_init(int arg);
|
||||||
static void spinc_putchar(int c);
|
static void spinc_putchar(int c);
|
||||||
static int spinc_getchar(void);
|
static int spinc_getchar(void);
|
||||||
static int spinc_ischar(void);
|
static int spinc_ischar(void);
|
||||||
|
|
||||||
|
extern struct console *consoles[];
|
||||||
|
|
||||||
struct console spinconsole = {
|
struct console spinconsole = {
|
||||||
"spinconsole",
|
"spinconsole",
|
||||||
"spin port",
|
"spin port",
|
||||||
|
|
@ -62,47 +60,53 @@ struct console spinconsole = {
|
||||||
spinc_ischar
|
spinc_ischar
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct console *parent = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spinc_probe(struct console *cp)
|
spinc_probe(struct console *cp)
|
||||||
{
|
{
|
||||||
cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT);
|
|
||||||
|
if (parent == NULL)
|
||||||
|
parent = consoles[0];
|
||||||
|
parent->c_probe(cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spinc_init(int arg)
|
spinc_init(int arg)
|
||||||
{
|
{
|
||||||
return(0);
|
|
||||||
|
return(parent->c_init(arg));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
spinc_putchar(int c)
|
spinc_putchar(int c)
|
||||||
{
|
{
|
||||||
static int curx, cury;
|
|
||||||
static unsigned tw_chars = 0x5C2D2F7C; /* "\-/|" */
|
static unsigned tw_chars = 0x5C2D2F7C; /* "\-/|" */
|
||||||
static time_t lasttime;
|
static time_t lasttime = 0;
|
||||||
time_t now;
|
time_t now;
|
||||||
|
|
||||||
now = time(NULL);
|
now = time(0);
|
||||||
if (now < (lasttime + 1))
|
if (now < (lasttime + 1))
|
||||||
return;
|
return;
|
||||||
lasttime = now;
|
|
||||||
#ifdef TERM_EMU
|
#ifdef TERM_EMU
|
||||||
get_pos(&curx, &cury);
|
if (lasttime > 0)
|
||||||
if (curx > 0)
|
parent->c_out('\b');
|
||||||
curs_move(&curx, &cury, curx - 1, cury);
|
|
||||||
#endif
|
#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);
|
tw_chars = (tw_chars >> 8) | ((tw_chars & (unsigned long)0xFF) << 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spinc_getchar(void)
|
spinc_getchar(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
spinc_ischar(void)
|
spinc_ischar(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue