Files
system76-coreboot/src/console/printk.c
Patrick Georgi 6b5bc77c9b treewide: Remove "this file is part of" lines
Stefan thinks they don't add value.

Command used:
sed -i -e '/file is part of /d' $(git grep "file is part of " |egrep ":( */\*.*\*/\$|#|;#|-- | *\* )" | cut -d: -f1 |grep -v crossgcc |grep -v gcov | grep -v /elf.h |grep -v nvramtool)

The exceptions are for:
 - crossgcc (patch file)
 - gcov (imported from gcc)
 - elf.h (imported from GNU's libc)
 - nvramtool (more complicated header)

The removed lines are:
-       fmt.Fprintln(f, "/* This file is part of the coreboot project. */")
-# This file is part of a set of unofficial pre-commit hooks available
-/* This file is part of coreboot */
-# This file is part of msrtool.
-/* This file is part of msrtool. */
- * This file is part of ncurses, designed to be appended after curses.h.in
-/* This file is part of pgtblgen. */
- * This file is part of the coreboot project.
- /* This file is part of the coreboot project. */
-#  This file is part of the coreboot project.
-# This file is part of the coreboot project.
-## This file is part of the coreboot project.
--- This file is part of the coreboot project.
-/* This file is part of the coreboot project */
-/* This file is part of the coreboot project. */
-;## This file is part of the coreboot project.
-# This file is part of the coreboot project. It originated in the
- * This file is part of the coreinfo project.
-## This file is part of the coreinfo project.
- * This file is part of the depthcharge project.
-/* This file is part of the depthcharge project. */
-/* This file is part of the ectool project. */
- * This file is part of the GNU C Library.
- * This file is part of the libpayload project.
-## This file is part of the libpayload project.
-/* This file is part of the Linux kernel. */
-## This file is part of the superiotool project.
-/* This file is part of the superiotool project */
-/* This file is part of uio_usbdebug */

Change-Id: I82d872b3b337388c93d5f5bf704e9ee9e53ab3a9
Signed-off-by: Patrick Georgi <pgeorgi@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/41194
Reviewed-by: HAOUAS Elyes <ehaouas@noos.fr>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
2020-05-11 17:11:40 +00:00

116 lines
2.2 KiB
C

/* SPDX-License-Identifier: GPL-2.0-only */
/*
* blatantly copied from linux/kernel/printk.c
*/
#include <console/cbmem_console.h>
#include <console/console.h>
#include <console/streams.h>
#include <console/vtxprintf.h>
#include <smp/spinlock.h>
#include <smp/node.h>
#include <stddef.h>
#include <trace.h>
#include <timer.h>
DECLARE_SPIN_LOCK(console_lock)
#define TRACK_CONSOLE_TIME (!ENV_SMM && CONFIG(HAVE_MONOTONIC_TIMER))
static struct mono_time mt_start, mt_stop;
static long console_usecs;
static void console_time_run(void)
{
if (TRACK_CONSOLE_TIME && boot_cpu())
timer_monotonic_get(&mt_start);
}
static void console_time_stop(void)
{
if (TRACK_CONSOLE_TIME && boot_cpu()) {
timer_monotonic_get(&mt_stop);
console_usecs += mono_time_diff_microseconds(&mt_start, &mt_stop);
}
}
void console_time_report(void)
{
if (!TRACK_CONSOLE_TIME)
return;
printk(BIOS_DEBUG, "BS: " ENV_STRING " times (exec / console): total (unknown) / %ld ms\n",
DIV_ROUND_CLOSEST(console_usecs, USECS_PER_MSEC));
}
long console_time_get_and_reset(void)
{
if (!TRACK_CONSOLE_TIME)
return 0;
long elapsed = console_usecs;
console_usecs = 0;
return elapsed;
}
void do_putchar(unsigned char byte)
{
console_time_run();
console_tx_byte(byte);
console_time_stop();
}
static void wrap_putchar(unsigned char byte, void *data)
{
console_tx_byte(byte);
}
static void wrap_putchar_cbmemc(unsigned char byte, void *data)
{
__cbmemc_tx_byte(byte);
}
int do_vprintk(int msg_level, const char *fmt, va_list args)
{
int i, log_this;
if (CONFIG(SQUELCH_EARLY_SMP) && ENV_ROMSTAGE_OR_BEFORE && !boot_cpu())
return 0;
log_this = console_log_level(msg_level);
if (log_this < CONSOLE_LOG_FAST)
return 0;
DISABLE_TRACE;
spin_lock(&console_lock);
console_time_run();
if (log_this == CONSOLE_LOG_FAST) {
i = vtxprintf(wrap_putchar_cbmemc, fmt, args, NULL);
} else {
i = vtxprintf(wrap_putchar, fmt, args, NULL);
console_tx_flush();
}
console_time_stop();
spin_unlock(&console_lock);
ENABLE_TRACE;
return i;
}
int do_printk(int msg_level, const char *fmt, ...)
{
va_list args;
int i;
va_start(args, fmt);
i = do_vprintk(msg_level, fmt, args);
va_end(args);
return i;
}