Linux Audio

Check our new training course

Linux debugging, profiling, tracing and performance analysis training

Mar 24-27, 2025, special US time zones
Register
Loading...
v3.1
 1/*
 2 * This file is subject to the terms and conditions of the GNU General Public
 3 * License.  See the file "COPYING" in the main directory of this archive
 4 * for more details.
 5 *
 6 * Copyright (C) 2002, 2003, 06, 07 Ralf Baechle (ralf@linux-mips.org)
 7 * Copyright (C) 2007 MIPS Technologies, Inc.
 8 *   written by Ralf Baechle (ralf@linux-mips.org)
 9 */
 
10#include <linux/console.h>
 
11#include <linux/init.h>
12
13#include <asm/setup.h>
14
15extern void prom_putchar(char);
16
17static void __init
18early_console_write(struct console *con, const char *s, unsigned n)
19{
20	while (n-- && *s) {
21		if (*s == '\n')
22			prom_putchar('\r');
23		prom_putchar(*s);
24		s++;
25	}
26}
27
28static struct console early_console __initdata = {
29	.name	= "early",
30	.write	= early_console_write,
31	.flags	= CON_PRINTBUFFER | CON_BOOT,
32	.index	= -1
33};
34
35static int early_console_initialized __initdata;
36
37void __init setup_early_printk(void)
38{
39	if (early_console_initialized)
40		return;
41	early_console_initialized = 1;
42
43	register_console(&early_console);
44}
v4.6
 1/*
 2 * This file is subject to the terms and conditions of the GNU General Public
 3 * License.  See the file "COPYING" in the main directory of this archive
 4 * for more details.
 5 *
 6 * Copyright (C) 2002, 2003, 06, 07 Ralf Baechle (ralf@linux-mips.org)
 7 * Copyright (C) 2007 MIPS Technologies, Inc.
 8 *   written by Ralf Baechle (ralf@linux-mips.org)
 9 */
10#include <linux/kernel.h>
11#include <linux/console.h>
12#include <linux/printk.h>
13#include <linux/init.h>
14
15#include <asm/setup.h>
16
17extern void prom_putchar(char);
18
19static void early_console_write(struct console *con, const char *s, unsigned n)
 
20{
21	while (n-- && *s) {
22		if (*s == '\n')
23			prom_putchar('\r');
24		prom_putchar(*s);
25		s++;
26	}
27}
28
29static struct console early_console_prom = {
30	.name	= "early",
31	.write	= early_console_write,
32	.flags	= CON_PRINTBUFFER | CON_BOOT,
33	.index	= -1
34};
35
 
 
36void __init setup_early_printk(void)
37{
38	if (early_console)
39		return;
40	early_console = &early_console_prom;
41
42	register_console(&early_console_prom);
43}