Skip to content
Snippets Groups Projects
Commit f5c3ba79 authored by Mark Jackson's avatar Mark Jackson Committed by Wolfgang Denk
Browse files

Allow console input to be disabled


Added new CONFIG_DISABLE_CONSOLE define and GD_FLG_DISABLE_CONSOLE.

When CONFIG_DISABLE_CONSOLE is defined, setting
GD_FLG_DISABLE_CONSOLE disables all console input and output.

Signed-off-by: default avatarMark Jackson <mpfj@mimc.co.uk>
parent 2b22d608
Branches
Tags
No related merge requests found
...@@ -162,6 +162,11 @@ void fprintf (int file, const char *fmt, ...) ...@@ -162,6 +162,11 @@ void fprintf (int file, const char *fmt, ...)
int getc (void) int getc (void)
{ {
#ifdef CONFIG_DISABLE_CONSOLE
if (gd->flags & GD_FLG_DISABLE_CONSOLE)
return 0;
#endif
if (gd->flags & GD_FLG_DEVINIT) { if (gd->flags & GD_FLG_DEVINIT) {
/* Get from the standard input */ /* Get from the standard input */
return fgetc (stdin); return fgetc (stdin);
...@@ -173,6 +178,11 @@ int getc (void) ...@@ -173,6 +178,11 @@ int getc (void)
int tstc (void) int tstc (void)
{ {
#ifdef CONFIG_DISABLE_CONSOLE
if (gd->flags & GD_FLG_DISABLE_CONSOLE)
return 0;
#endif
if (gd->flags & GD_FLG_DEVINIT) { if (gd->flags & GD_FLG_DEVINIT) {
/* Test the standard input */ /* Test the standard input */
return ftstc (stdin); return ftstc (stdin);
...@@ -189,6 +199,11 @@ void putc (const char c) ...@@ -189,6 +199,11 @@ void putc (const char c)
return; return;
#endif #endif
#ifdef CONFIG_DISABLE_CONSOLE
if (gd->flags & GD_FLG_DISABLE_CONSOLE)
return;
#endif
if (gd->flags & GD_FLG_DEVINIT) { if (gd->flags & GD_FLG_DEVINIT) {
/* Send to the standard output */ /* Send to the standard output */
fputc (stdout, c); fputc (stdout, c);
...@@ -205,6 +220,11 @@ void puts (const char *s) ...@@ -205,6 +220,11 @@ void puts (const char *s)
return; return;
#endif #endif
#ifdef CONFIG_DISABLE_CONSOLE
if (gd->flags & GD_FLG_DISABLE_CONSOLE)
return;
#endif
if (gd->flags & GD_FLG_DEVINIT) { if (gd->flags & GD_FLG_DEVINIT) {
/* Send to the standard output */ /* Send to the standard output */
fputs (stdout, s); fputs (stdout, s);
......
...@@ -63,6 +63,7 @@ typedef struct global_data { ...@@ -63,6 +63,7 @@ typedef struct global_data {
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */ #define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */ #define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8") #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r8")
......
...@@ -54,6 +54,7 @@ typedef struct global_data { ...@@ -54,6 +54,7 @@ typedef struct global_data {
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */ #define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buf has been initialized */ #define GD_FLG_LOGINIT 0x00020 /* Log Buf has been initialized */
#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm("r5") #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm("r5")
......
...@@ -64,6 +64,7 @@ typedef struct global_data { ...@@ -64,6 +64,7 @@ typedef struct global_data {
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */ #define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buf has been initialized */ #define GD_FLG_LOGINIT 0x00020 /* Log Buf has been initialized */
#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register gd_t * volatile gd asm ("P5") #define DECLARE_GLOBAL_DATA_PTR register gd_t * volatile gd asm ("P5")
......
...@@ -57,6 +57,7 @@ typedef struct { ...@@ -57,6 +57,7 @@ typedef struct {
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */ #define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */ #define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
extern gd_t *global_data; extern gd_t *global_data;
......
...@@ -75,6 +75,7 @@ typedef struct global_data { ...@@ -75,6 +75,7 @@ typedef struct global_data {
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */ #define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */ #define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#if 0 #if 0
extern gd_t *global_data; extern gd_t *global_data;
......
...@@ -55,6 +55,7 @@ typedef struct global_data { ...@@ -55,6 +55,7 @@ typedef struct global_data {
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */ #define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */ #define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r31") #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r31")
......
...@@ -57,6 +57,7 @@ typedef struct global_data { ...@@ -57,6 +57,7 @@ typedef struct global_data {
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */ #define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buf has been initialized */ #define GD_FLG_LOGINIT 0x00020 /* Log Buf has been initialized */
#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("k0") #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("k0")
......
...@@ -48,6 +48,7 @@ typedef struct global_data { ...@@ -48,6 +48,7 @@ typedef struct global_data {
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */ #define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */ #define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("%g7") #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("%g7")
......
...@@ -47,6 +47,7 @@ typedef struct global_data { ...@@ -47,6 +47,7 @@ typedef struct global_data {
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */ #define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */ #define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("r15") #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("r15")
......
...@@ -180,6 +180,7 @@ typedef struct global_data { ...@@ -180,6 +180,7 @@ typedef struct global_data {
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */ #define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */ #define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#if 1 #if 1
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2") #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("r2")
......
...@@ -47,6 +47,7 @@ typedef struct global_data ...@@ -47,6 +47,7 @@ typedef struct global_data
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */ #define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */ #define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("r13") #define DECLARE_GLOBAL_DATA_PTR register gd_t *gd asm ("r13")
......
...@@ -82,6 +82,7 @@ typedef struct global_data { ...@@ -82,6 +82,7 @@ typedef struct global_data {
#define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */ #define GD_FLG_POSTFAIL 0x00008 /* Critical POST test failed */
#define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */ #define GD_FLG_POSTSTOP 0x00010 /* POST seqeunce aborted */
#define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */ #define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
#define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out) */
#define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("%g7") #define DECLARE_GLOBAL_DATA_PTR register volatile gd_t *gd asm ("%g7")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment