summaryrefslogtreecommitdiff
path: root/tools/perf/ui/tui/helpline.c
blob: 88f5143a59811521dad080453fc69aab9a55e01f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>

#include "../../util/debug.h"
#include "../helpline.h"
#include "../ui.h"
#include "../libslang.h"

char ui_helpline__last_msg[1024];
bool tui_helpline__set;

static void tui_helpline__pop(void)
{
}

static void tui_helpline__push(const char *msg)
{
	const size_t sz = sizeof(ui_helpline__current);

	SLsmg_gotorc(SLtt_Screen_Rows - 1, 0);
	SLsmg_set_color(0);
	SLsmg_write_nstring((char *)msg, SLtt_Screen_Cols);
	SLsmg_refresh();
	strncpy(ui_helpline__current, msg, sz)[sz - 1] = '\0';
}

static int tui_helpline__show(const char *format, va_list ap)
{
	int ret;
	static int backlog;

	pthread_mutex_lock(&ui__lock);
	ret = vscnprintf(ui_helpline__last_msg + backlog,
			sizeof(ui_helpline__last_msg) - backlog, format, ap);
	backlog += ret;

	tui_helpline__set = true;

	if (ui_helpline__last_msg[backlog - 1] == '\n') {
		ui_helpline__puts(ui_helpline__last_msg);
		SLsmg_refresh();
		backlog = 0;
	}
	pthread_mutex_unlock(&ui__lock);

	return ret;
}

struct ui_helpline tui_helpline_fns = {
	.pop	= tui_helpline__pop,
	.push	= tui_helpline__push,
	.show	= tui_helpline__show,
};

void ui_helpline__init(void)
{
	helpline_fns = &tui_helpline_fns;
	ui_helpline__puts(" ");
}
bootup). Fix that by always mapping the first page of physical memory into the EFI pagetables. We're free to hand this page to the BIOS, as trim_bios_range() will reserve the first page and isolate it away from memory allocators anyway. Note that just reverting 129766708 alone is not enough on v4.9-rc1+ to fix the regression on affected hardware, as this commit: ab72a27da ("x86/efi: Consolidate region mapping logic") later made the first physical frame not to be mapped anyway. Reported-by: Hanka Pavlikova <hanka@ucw.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Matt Fleming <matt@codeblueprint.co.uk> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Borislav Petkov <bp@suse.de> Cc: Laura Abbott <labbott@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Vojtech Pavlik <vojtech@ucw.cz> Cc: Waiman Long <waiman.long@hpe.com> Cc: linux-efi@vger.kernel.org Cc: stable@kernel.org # v4.8+ Fixes: 129766708 ("x86/efi: Only map RAM into EFI page tables if in mixed-mode") Link: http://lkml.kernel.org/r/20170127222552.22336-1-matt@codeblueprint.co.uk [ Tidied up the changelog and the comment. ] Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'include/dt-bindings/clock/qcom,gcc-msm8960.h')