~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/sibyte/common/cfe_console.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0
  2 #include <linux/init.h>
  3 #include <linux/errno.h>
  4 #include <linux/console.h>
  5 
  6 #include <asm/sibyte/board.h>
  7 
  8 #include <asm/fw/cfe/cfe_api.h>
  9 #include <asm/fw/cfe/cfe_error.h>
 10 
 11 extern int cfe_cons_handle;
 12 
 13 static void cfe_console_write(struct console *cons, const char *str,
 14                        unsigned int count)
 15 {
 16         int i, last, written;
 17 
 18         for (i=0, last=0; i<count; i++) {
 19                 if (!str[i])
 20                         /* XXXKW can/should this ever happen? */
 21                         return;
 22                 if (str[i] == '\n') {
 23                         do {
 24                                 written = cfe_write(cfe_cons_handle, &str[last], i-last);
 25                                 if (written < 0)
 26                                         ;
 27                                 last += written;
 28                         } while (last < i);
 29                         while (cfe_write(cfe_cons_handle, "\r", 1) <= 0)
 30                                 ;
 31                 }
 32         }
 33         if (last != count) {
 34                 do {
 35                         written = cfe_write(cfe_cons_handle, &str[last], count-last);
 36                         if (written < 0)
 37                                 ;
 38                         last += written;
 39                 } while (last < count);
 40         }
 41 
 42 }
 43 
 44 static int cfe_console_setup(struct console *cons, char *str)
 45 {
 46         char consdev[32];
 47         /* XXXKW think about interaction with 'console=' cmdline arg */
 48         /* If none of the console options are configured, the build will break. */
 49         if (cfe_getenv("BOOT_CONSOLE", consdev, 32) >= 0) {
 50 #ifdef CONFIG_SERIAL_SB1250_DUART
 51                 if (!strcmp(consdev, "uart0")) {
 52                         setleds("u0cn");
 53                 } else if (!strcmp(consdev, "uart1")) {
 54                         setleds("u1cn");
 55                 } else
 56 #endif
 57 #ifdef CONFIG_VGA_CONSOLE
 58                        if (!strcmp(consdev, "pcconsole0")) {
 59                                 setleds("pccn");
 60                 } else
 61 #endif
 62                         return -ENODEV;
 63         }
 64         return 0;
 65 }
 66 
 67 static struct console sb1250_cfe_cons = {
 68         .name           = "cfe",
 69         .write          = cfe_console_write,
 70         .setup          = cfe_console_setup,
 71         .flags          = CON_PRINTBUFFER,
 72         .index          = -1,
 73 };
 74 
 75 static int __init sb1250_cfe_console_init(void)
 76 {
 77         register_console(&sb1250_cfe_cons);
 78         return 0;
 79 }
 80 
 81 console_initcall(sb1250_cfe_console_init);
 82 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php