View | Details | Raw Unified | Return to bug 148367 | Differences between
and this patch

Collapse All | Expand All

(-)sys/dev/syscons/syscons.h (+1 lines)
Lines 573-578 Link Here
573
573
574
/* schistory.c */
574
/* schistory.c */
575
#ifndef SC_NO_HISTORY
575
#ifndef SC_NO_HISTORY
576
void		sc_init_history(void);
576
int		sc_alloc_history_buffer(scr_stat *scp, int lines,
577
int		sc_alloc_history_buffer(scr_stat *scp, int lines,
577
					int prev_ysize, int wait);
578
					int prev_ysize, int wait);
578
void		sc_free_history_buffer(scr_stat *scp, int prev_ysize);
579
void		sc_free_history_buffer(scr_stat *scp, int prev_ysize);
(-)sys/dev/syscons/syscons.c (-1 / +5 lines)
Lines 2726-2733 Link Here
2726
    int i;
2726
    int i;
2727
2727
2728
    /* one time initialization */
2728
    /* one time initialization */
2729
    if (init_done == COLD)
2729
    if (init_done == COLD) {
2730
	sc_get_bios_values(&bios_value);
2730
	sc_get_bios_values(&bios_value);
2731
#ifndef SC_NO_HISTORY
2732
	sc_init_history();
2733
#endif
2734
    }
2731
    init_done = WARM;
2735
    init_done = WARM;
2732
2736
2733
    /*
2737
    /*
(-)sys/dev/syscons/schistory.c (-5 / +26 lines)
Lines 41-46 Link Here
41
#include <sys/tty.h>
41
#include <sys/tty.h>
42
#include <sys/kernel.h>
42
#include <sys/kernel.h>
43
#include <sys/malloc.h>
43
#include <sys/malloc.h>
44
#include <sys/sysctl.h>
44
45
45
#if defined(__sparc64__) || defined(__powerpc__)
46
#if defined(__sparc64__) || defined(__powerpc__)
46
#include <machine/sc_machdep.h>
47
#include <machine/sc_machdep.h>
Lines 77-93 Link Here
77
static int		extra_history_size
78
static int		extra_history_size
78
				= SC_MAX_HISTORY_SIZE - SC_HISTORY_SIZE*MAXCONS;
79
				= SC_MAX_HISTORY_SIZE - SC_HISTORY_SIZE*MAXCONS;
79
80
81
static int		sc_history_size = SC_HISTORY_SIZE;
82
83
SYSCTL_DECL(_hw_syscons);
84
SYSCTL_INT(_hw_syscons, OID_AUTO, history_size, CTLFLAG_RDTUN, &sc_history_size, 0,
85
    "Number of history buffer lines");
86
80
/* local functions */
87
/* local functions */
81
static void copy_history(sc_vtb_t *from, sc_vtb_t *to);
88
static void copy_history(sc_vtb_t *from, sc_vtb_t *to);
82
static void history_to_screen(scr_stat *scp);
89
static void history_to_screen(scr_stat *scp);
83
90
91
/* tune history buffer size */
92
void
93
sc_init_history(void)
94
{
95
96
	TUNABLE_INT_FETCH("hw.syscons.history_size", &sc_history_size);
97
	if (sc_history_size < ROW * 4)
98
	    sc_history_size = ROW * 4;
99
	extra_history_size =
100
	    ((sc_history_size * MAXCONS * MAXSC) > SC_MAX_HISTORY_SIZE ?
101
		sc_history_size * MAXCONS * MAXSC : SC_MAX_HISTORY_SIZE) -
102
		    sc_history_size * MAXCONS;
103
}
104
84
/* allocate a history buffer */
105
/* allocate a history buffer */
85
int
106
int
86
sc_alloc_history_buffer(scr_stat *scp, int lines, int prev_ysize, int wait)
107
sc_alloc_history_buffer(scr_stat *scp, int lines, int prev_ysize, int wait)
87
{
108
{
88
	/*
109
	/*
89
	 * syscons unconditionally allocates buffers up to 
110
	 * syscons unconditionally allocates buffers up to 
90
	 * SC_HISTORY_SIZE lines or scp->ysize lines, whichever 
111
	 * sc_history_size lines or scp->ysize lines, whichever 
91
	 * is larger. A value greater than that is allowed, 
112
	 * is larger. A value greater than that is allowed, 
92
	 * subject to extra_history_size.
113
	 * subject to extra_history_size.
93
	 */
114
	 */
Lines 98-104 Link Here
98
	int delta;				/* lines to put back */
119
	int delta;				/* lines to put back */
99
120
100
	if (lines <= 0)
121
	if (lines <= 0)
101
		lines = SC_HISTORY_SIZE;	/* use the default value */
122
		lines = sc_history_size;	/* use the default value */
102
123
103
	/* make it at least as large as the screen size */
124
	/* make it at least as large as the screen size */
104
	lines = imax(lines, scp->ysize);
125
	lines = imax(lines, scp->ysize);
Lines 111-123 Link Here
111
	delta = 0;
132
	delta = 0;
112
	if (prev_history) {
133
	if (prev_history) {
113
		cur_lines = sc_vtb_rows(history);
134
		cur_lines = sc_vtb_rows(history);
114
		min_lines = imax(SC_HISTORY_SIZE, prev_ysize);
135
		min_lines = imax(sc_history_size, prev_ysize);
115
		if (cur_lines > min_lines)
136
		if (cur_lines > min_lines)
116
			delta = cur_lines - min_lines;
137
			delta = cur_lines - min_lines;
117
	}
138
	}
118
139
119
	/* lines up to min_lines are always allowed. */
140
	/* lines up to min_lines are always allowed. */
120
	min_lines = imax(SC_HISTORY_SIZE, scp->ysize);
141
	min_lines = imax(sc_history_size, scp->ysize);
121
	if (lines > min_lines) {
142
	if (lines > min_lines) {
122
		if (lines - min_lines > extra_history_size + delta) {
143
		if (lines - min_lines > extra_history_size + delta) {
123
			/* too many lines are requested */
144
			/* too many lines are requested */
Lines 196-202 Link Here
196
		return;
217
		return;
197
218
198
	cur_lines = sc_vtb_rows(history);
219
	cur_lines = sc_vtb_rows(history);
199
	min_lines = imax(SC_HISTORY_SIZE, prev_ysize);
220
	min_lines = imax(sc_history_size, prev_ysize);
200
	extra_history_size += (cur_lines > min_lines) ? 
221
	extra_history_size += (cur_lines > min_lines) ? 
201
				  cur_lines - min_lines : 0;
222
				  cur_lines - min_lines : 0;
202
223
(-)share/man/man4/syscons.4 (+14 lines)
Lines 442-447 Link Here
442
for a keyboard device if it is not currently attached to one.
442
for a keyboard device if it is not currently attached to one.
443
Otherwise, the driver only probes for a keyboard once during bootup.
443
Otherwise, the driver only probes for a keyboard once during bootup.
444
.El
444
.El
445
.Ss Loader Tunables
446
Tunables can be set at the
447
.Xr loader 8
448
prompt before booting the kernel or stored in
449
.Pa /boot/loader.conf .
450
Some of these tunables also have a matching
451
.Xr sysctl 8
452
entry for access after boot.
453
.Bl -tag -width indent
454
.It hw.syscons.history_size
455
Override the size of back scroll buffer (specified by the
456
.Dv SC_HISTORY_SIZE
457
option).
458
.El
445
.Sh FILES
459
.Sh FILES
446
.Bl -tag -width /usr/share/syscons/xxxxyyyyzzz -compact
460
.Bl -tag -width /usr/share/syscons/xxxxyyyyzzz -compact
447
.It Pa /dev/console
461
.It Pa /dev/console

Return to bug 148367