mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-22 10:48:02 +00: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
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=322896
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue