1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * RISC-V SBI based earlycon 4 * 5 * Copyright (C) 2018 Anup Patel <anup@brainfault.org> 6 */ 7 #include <linux/kernel.h> 8 #include <linux/console.h> 9 #include <linux/init.h> 10 #include <linux/serial_core.h> 11 #include <asm/sbi.h> 12 13 static void sbi_console_write(struct console *con, 14 const char *s, unsigned int n) 15 { 16 int i; 17 18 for (i = 0; i < n; ++i) 19 sbi_console_putchar(s[i]); 20 } 21 22 static int __init early_sbi_setup(struct earlycon_device *device, 23 const char *opt) 24 { 25 device->con->write = sbi_console_write; 26 return 0; 27 } 28 EARLYCON_DECLARE(sbi, early_sbi_setup); 29