diff options
author | ian <ian@FreeBSD.org> | 2015-02-11 22:55:24 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2015-02-11 22:55:24 +0000 |
commit | f8178723e9bb3e51a017187b2a3694e110ad5202 (patch) | |
tree | f1c6cb0a9a16de5c5aae59f0978cc9c2a2d77234 /sys/boot | |
parent | ba124c2ef35f4bf14972d64b724ac66e69bbed26 (diff) | |
download | FreeBSD-src-f8178723e9bb3e51a017187b2a3694e110ad5202.zip FreeBSD-src-f8178723e9bb3e51a017187b2a3694e110ad5202.tar.gz |
MFC r276079, r276087:
Add a divisor parameter to twiddle() so that callers can request that
output only happen on every Nth call.
Add a new loader(8) variable, twiddle_divisor, allowing control over the
output frequency of the "twiddle" IO progress indicator.
Diffstat (limited to 'sys/boot')
-rw-r--r-- | sys/boot/common/console.c | 29 | ||||
-rw-r--r-- | sys/boot/common/loader.8 | 8 | ||||
-rw-r--r-- | sys/boot/forth/loader.conf | 1 |
3 files changed, 37 insertions, 1 deletions
diff --git a/sys/boot/common/console.c b/sys/boot/common/console.c index 6c1fdab..6656eab 100644 --- a/sys/boot/common/console.c +++ b/sys/boot/common/console.c @@ -39,6 +39,7 @@ static int cons_set(struct env_var *ev, int flags, const void *value); static int cons_find(const char *name); static int cons_check(const char *string); static void cons_change(const char *string); +static int twiddle_set(struct env_var *ev, int flags, const void *value); /* * Detect possible console(s) to use. If preferred console(s) have been @@ -52,6 +53,9 @@ cons_probe(void) int active; char *prefconsole; + /* We want a callback to install the new value when this var changes. */ + env_setenv("twiddle_divisor", EV_VOLATILE, "1", twiddle_set, env_nounset); + /* Do all console probes */ for (cons = 0; consoles[cons] != NULL; cons++) { consoles[cons]->c_flags = 0; @@ -232,3 +236,28 @@ cons_change(const char *string) free(dup); } + +/* + * Change the twiddle divisor. + * + * The user can set the twiddle_divisor variable to directly control how fast + * the progress twiddle spins, useful for folks with slow serial consoles. The + * code to monitor changes to the variable and propagate them to the twiddle + * routines has to live somewhere. Twiddling is console-related so it's here. + */ +static int +twiddle_set(struct env_var *ev, int flags, const void *value) +{ + u_long tdiv; + char * eptr; + + tdiv = strtoul(value, &eptr, 0); + if (*(const char *)value == 0 || *eptr != 0) { + printf("invalid twiddle_divisor '%s'\n", (const char *)value); + return (CMD_ERROR); + } + twiddle_divisor((u_int)tdiv); + env_setenv(ev->ev_name, flags | EV_NOHOOK, value, NULL, NULL); + + return(CMD_OK); +} diff --git a/sys/boot/common/loader.8 b/sys/boot/common/loader.8 index fe247ac..cac5674 100644 --- a/sys/boot/common/loader.8 +++ b/sys/boot/common/loader.8 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 1, 2013 +.Dd December 22, 2014 .Dt LOADER 8 .Os .Sh NAME @@ -670,6 +670,12 @@ Overrides the compile-time set value of .Dv TCBHASHSIZE or the preset default of 512. Must be a power of 2. +.It Va twiddle_divisor +Throttles the output of the `twiddle' I/O progress indicator displayed +while loading the kernel and modules. +This is useful on slow serial consoles where the time spent waiting for +these characters to be written can add up to many seconds. +The default is 1 (full speed); a value of 2 spins half as fast, and so on. .It Va vm.kmem_size Sets the size of kernel memory (bytes). This overrides the value determined when the kernel was compiled. diff --git a/sys/boot/forth/loader.conf b/sys/boot/forth/loader.conf index 0e56ecc..8e06029 100644 --- a/sys/boot/forth/loader.conf +++ b/sys/boot/forth/loader.conf @@ -75,6 +75,7 @@ module_path="/boot/modules" # Set the module search path # the block size is set to 512. If the value # is out of range ( < 8 || > 9008 ) an error is # returned. +#twiddle_divisor="1" # >1 means slow down the progress indicator. ############################################################## |