summaryrefslogtreecommitdiffstats
path: root/sys/boot
diff options
context:
space:
mode:
authorsobomax <sobomax@FreeBSD.org>2009-11-27 03:55:42 +0000
committersobomax <sobomax@FreeBSD.org>2009-11-27 03:55:42 +0000
commitb6f35cb16245f36acda0d07553cf947424fb7b62 (patch)
tree2195129ce124b7c68b9b4ff3940ef0a820408cea /sys/boot
parent39508ed75b28dfbe7ad89a031a90063e7b2da07f (diff)
downloadFreeBSD-src-b6f35cb16245f36acda0d07553cf947424fb7b62.zip
FreeBSD-src-b6f35cb16245f36acda0d07553cf947424fb7b62.tar.gz
Add new loader console type: "spinconsole". This console selects the
video console which doesn't take any input from keyboard and hides all output replacing it with ``spinning'' character (useful for embedded products and custom installations). Sponsored by: Sippy Software, Inc.
Diffstat (limited to 'sys/boot')
-rw-r--r--sys/boot/forth/loader.conf.59
-rw-r--r--sys/boot/i386/libi386/Makefile2
-rw-r--r--sys/boot/i386/libi386/spinconsole.c106
-rw-r--r--sys/boot/i386/libi386/vidconsole.c34
-rw-r--r--sys/boot/i386/loader/conf.c2
-rw-r--r--sys/boot/pc98/loader/conf.c2
6 files changed, 135 insertions, 20 deletions
diff --git a/sys/boot/forth/loader.conf.5 b/sys/boot/forth/loader.conf.5
index b7e8af2..df2183f 100644
--- a/sys/boot/forth/loader.conf.5
+++ b/sys/boot/forth/loader.conf.5
@@ -180,10 +180,15 @@ serial port speed setting.
.Dq comconsole
selects serial console,
.Dq vidconsole
-selects the video console, and
+selects the video console,
.Dq nullconsole
selects a mute console
-(useful for systems with neither a video console nor a serial port).
+(useful for systems with neither a video console nor a serial port), and
+.Dq spinconsole
+selects the video console which prevents any input and hides all output
+replacing it with
+.Dq spinning
+character (useful for embedded products and such).
.It Va kernel
.Pq Dq Pa /boot/kernel/kernel
.It Va loader_conf_files
diff --git a/sys/boot/i386/libi386/Makefile b/sys/boot/i386/libi386/Makefile
index c1bbb52..f1a461a 100644
--- a/sys/boot/i386/libi386/Makefile
+++ b/sys/boot/i386/libi386/Makefile
@@ -8,7 +8,7 @@ SRCS= biosacpi.c bioscd.c biosdisk.c biosmem.c biospnp.c \
comconsole.c devicename.c elf32_freebsd.c \
elf64_freebsd.c \
i386_copy.c i386_module.c nullconsole.c pxe.c pxetramp.s \
- smbios.c time.c vidconsole.c amd64_tramp.S
+ smbios.c time.c vidconsole.c amd64_tramp.S spinconsole.c
# Enable PXE TFTP or NFS support, not both.
.if defined(LOADER_TFTP_SUPPORT)
diff --git a/sys/boot/i386/libi386/spinconsole.c b/sys/boot/i386/libi386/spinconsole.c
new file mode 100644
index 0000000..6e9955c
--- /dev/null
+++ b/sys/boot/i386/libi386/spinconsole.c
@@ -0,0 +1,106 @@
+/*-
+ * spinconsole.c
+ *
+ * Author: Maksym Sobolyev <sobomax@sippysoft.com>
+ * Copyright (c) 2009 Sippy Software, Inc.
+ * All rights reserved.
+ *
+ * Subject to the following obligations and disclaimer of warranty, use and
+ * redistribution of this software, in source or object code forms, with or
+ * without modifications are expressly permitted by Whistle Communications;
+ * provided, however, that:
+ * 1. Any and all reproductions of the source or object code must include the
+ * copyright notice above and the following disclaimer of warranties; and
+ * 2. No rights are granted, in any manner or form, to use Whistle
+ * Communications, Inc. trademarks, including the mark "WHISTLE
+ * COMMUNICATIONS" on advertising, endorsements, or otherwise except as
+ * such appears in the above copyright notice or in the software.
+ *
+ * THIS SOFTWARE IS BEING PROVIDED BY WHISTLE COMMUNICATIONS "AS IS", AND
+ * TO THE MAXIMUM EXTENT PERMITTED BY LAW, WHISTLE COMMUNICATIONS MAKES NO
+ * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING THIS SOFTWARE,
+ * INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT.
+ * WHISTLE COMMUNICATIONS DOES NOT WARRANT, GUARANTEE, OR MAKE ANY
+ * REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS OF THE USE OF THIS
+ * SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY, RELIABILITY OR OTHERWISE.
+ * IN NO EVENT SHALL WHISTLE COMMUNICATIONS BE LIABLE FOR ANY DAMAGES
+ * RESULTING FROM OR ARISING OUT OF ANY USE OF THIS SOFTWARE, INCLUDING
+ * WITHOUT LIMITATION, ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ * PUNITIVE, OR CONSEQUENTIAL DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES, LOSS OF USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER 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 WHISTLE COMMUNICATIONS IS ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGE.
+ */
+
+#include <sys/cdefs.h>
+__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);
+
+struct console spinconsole = {
+ "spinconsole",
+ "spin port",
+ 0,
+ spinc_probe,
+ spinc_init,
+ spinc_putchar,
+ spinc_getchar,
+ spinc_ischar
+};
+
+static void
+spinc_probe(struct console *cp)
+{
+ cp->c_flags |= (C_PRESENTIN | C_PRESENTOUT);
+}
+
+static int
+spinc_init(int arg)
+{
+ return(0);
+}
+
+static void
+spinc_putchar(int c)
+{
+ static int curx, cury;
+ static unsigned tw_chars = 0x5C2D2F7C; /* "\-/|" */
+ static time_t lasttime;
+ time_t now;
+
+ now = time(NULL);
+ if (now < (lasttime + 1))
+ return;
+ lasttime = now;
+ get_pos(&curx, &cury);
+ if (curx > 0)
+ curs_move(&curx, &cury, curx - 1, cury);
+ vidc_biosputchar((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);
+}
diff --git a/sys/boot/i386/libi386/vidconsole.c b/sys/boot/i386/libi386/vidconsole.c
index 1f41100..1b1e648 100644
--- a/sys/boot/i386/libi386/vidconsole.c
+++ b/sys/boot/i386/libi386/vidconsole.c
@@ -57,8 +57,8 @@ static int vidc_started;
void end_term(void);
void bail_out(int c);
void vidc_term_emu(int c);
-void get_pos(void);
-void curs_move(int x, int y);
+void get_pos(int *x, int *y);
+void curs_move(int *_x, int *_y, int x, int y);
void write_char(int c, int fg, int bg);
void scroll_up(int rows, int fg, int bg);
void CD(void);
@@ -110,8 +110,8 @@ vidc_init(int arg)
#ifdef TERM_EMU
/* Init terminal emulator */
end_term();
- get_pos();
- curs_move(curx, cury);
+ get_pos(&curx, &cury);
+ curs_move(&curx, &cury, curx, cury);
fg_c = DEFAULT_FGCOLOR;
bg_c = DEFAULT_BGCOLOR;
#endif
@@ -120,7 +120,7 @@ vidc_init(int arg)
return (0); /* XXX reinit? */
}
-static void
+void
vidc_biosputchar(int c)
{
@@ -151,7 +151,7 @@ vidc_rawputchar(int c)
return;
case '\r':
curx = 0;
- curs_move(curx, cury);
+ curs_move(&curx, &cury, curx, cury);
return;
case '\n':
cury++;
@@ -159,13 +159,13 @@ vidc_rawputchar(int c)
scroll_up(1, fg_c, bg_c);
cury--;
} else {
- curs_move(curx, cury);
+ curs_move(&curx, &cury, curx, cury);
}
return;
case '\b':
if (curx > 0) {
curx--;
- curs_move(curx, cury);
+ curs_move(&curx, &cury, curx, cury);
/* write_char(' ', fg_c, bg_c); XXX destructive(!) */
return;
}
@@ -183,7 +183,7 @@ vidc_rawputchar(int c)
cury--;
}
}
- curs_move(curx, cury);
+ curs_move(&curx, &cury, curx, cury);
#endif
}
}
@@ -194,7 +194,7 @@ vidc_rawputchar(int c)
* curx and cury appropriately.
*/
void
-get_pos(void)
+get_pos(int *x, int *y)
{
v86.ctl = 0;
@@ -202,13 +202,13 @@ get_pos(void)
v86.eax = 0x0300;
v86.ebx = 0x0;
v86int();
- curx = v86.edx & 0x00ff;
- cury = (v86.edx & 0xff00) >> 8;
+ *x = v86.edx & 0x00ff;
+ *y = (v86.edx & 0xff00) >> 8;
}
/* Move cursor to x rows and y cols (0-based). */
void
-curs_move(int x, int y)
+curs_move(int *_x, int *_y, int x, int y)
{
v86.ctl = 0;
@@ -217,8 +217,8 @@ curs_move(int x, int y)
v86.ebx = 0x0;
v86.edx = ((0x00ff & y) << 8) + (0x00ff & x);
v86int();
- curx = x;
- cury = y;
+ *_x = x;
+ *_y = y;
/* If there is ctrl char at this position, cursor would be invisible.
* Make it a space instead.
*/
@@ -277,7 +277,7 @@ void
CD(void)
{
- get_pos();
+ get_pos(&curx, &cury);
if (curx > 0) {
v86.ctl = 0;
v86.addr = 0x10;
@@ -312,7 +312,7 @@ CM(void)
args[0]--;
if (args[1] > 0)
args[1]--;
- curs_move(args[1], args[0]);
+ curs_move(&curx, &cury, args[1], args[0]);
end_term();
}
diff --git a/sys/boot/i386/loader/conf.c b/sys/boot/i386/loader/conf.c
index 05c9a9e9..bd14f47 100644
--- a/sys/boot/i386/loader/conf.c
+++ b/sys/boot/i386/loader/conf.c
@@ -128,6 +128,7 @@ extern struct console comconsole;
extern struct console dconsole;
#endif
extern struct console nullconsole;
+extern struct console spinconsole;
struct console *consoles[] = {
&vidconsole,
@@ -136,6 +137,7 @@ struct console *consoles[] = {
&dconsole,
#endif
&nullconsole,
+ &spinconsole,
NULL
};
diff --git a/sys/boot/pc98/loader/conf.c b/sys/boot/pc98/loader/conf.c
index ce80cef..5ef48bd 100644
--- a/sys/boot/pc98/loader/conf.c
+++ b/sys/boot/pc98/loader/conf.c
@@ -100,11 +100,13 @@ struct file_format *file_formats[] = {
extern struct console vidconsole;
extern struct console comconsole;
extern struct console nullconsole;
+extern struct console spinconsole;
struct console *consoles[] = {
&vidconsole,
&comconsole,
&nullconsole,
+ &spinconsole,
NULL
};
OpenPOWER on IntegriCloud