diff options
author | Till Straumann <strauman@slac.stanford.edu> | 2009-11-06 01:09:57 +0000 |
---|---|---|
committer | Till Straumann <strauman@slac.stanford.edu> | 2009-11-06 01:09:57 +0000 |
commit | b092ad6071590fea29dee39a21d7ef5cb22c61bf (patch) | |
tree | 5be77984aa084104934b05c33a364aa5ef88ce7a /c | |
parent | New. (diff) | |
download | rtems-b092ad6071590fea29dee39a21d7ef5cb22c61bf.tar.bz2 |
2009-11-05 Till Straumann <strauman@slac.stanford.edu>
* start/start.S, console/console.c: Separated code
that switched console and printk port based on info
gathered from the commandline and/or a BSP provided
routine into new BSP_console_select() which is called
from 'start.S' so that early messages make it to the
redirected printk port.
Diffstat (limited to 'c')
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/ChangeLog | 9 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/console/console.c | 97 | ||||
-rw-r--r-- | c/src/lib/libbsp/i386/pc386/start/start.S | 6 |
3 files changed, 73 insertions, 39 deletions
diff --git a/c/src/lib/libbsp/i386/pc386/ChangeLog b/c/src/lib/libbsp/i386/pc386/ChangeLog index 9cf87179a7..d6b5837ff8 100644 --- a/c/src/lib/libbsp/i386/pc386/ChangeLog +++ b/c/src/lib/libbsp/i386/pc386/ChangeLog @@ -1,3 +1,12 @@ +2009-11-05 Till Straumann <strauman@slac.stanford.edu> + + * start/start.S, console/console.c: Separated code + that switched console and printk port based on info + gathered from the commandline and/or a BSP provided + routine into new BSP_console_select() which is called + from 'start.S' so that early messages make it to the + redirected printk port. + 2009-10-28 Till Straumann <strauman@slac.stanford.edu> * start/start.S: Make sure initial stack is aligned diff --git a/c/src/lib/libbsp/i386/pc386/console/console.c b/c/src/lib/libbsp/i386/pc386/console/console.c index 8b4664b9d4..a12168c435 100644 --- a/c/src/lib/libbsp/i386/pc386/console/console.c +++ b/c/src/lib/libbsp/i386/pc386/console/console.c @@ -143,22 +143,19 @@ int kbd_poll_read( int minor ) extern void BSP_runtime_console_select(int *, int *) __attribute__((weak)); -/*-------------------------------------------------------------------------+ -| Console device driver INITIALIZE entry point. -+--------------------------------------------------------------------------+ -| Initilizes the I/O console (keyboard + VGA display) driver. -+--------------------------------------------------------------------------*/ -rtems_device_driver -console_initialize(rtems_device_major_number major, - rtems_device_minor_number minor, - void *arg) +/* provide routine to select console; this + * is called very early so that early boot + * messages also make it to the redirected + * device. + */ +void +BSP_console_select() { - rtems_status_code status; const char* mode; - + /* * Check the command line for the type of mode - * the consol is. + * the console is. */ mode = bsp_cmdline_arg ("--console="); @@ -181,14 +178,6 @@ console_initialize(rtems_device_major_number major, BSPPrintkPort = BSP_UART_COM2; } } - - /* Initialize the KBD interface */ - kbd_init(); - - /* - * Set up TERMIOS - */ - rtems_termios_initialize (); if ( BSP_runtime_console_select ) BSP_runtime_console_select(&BSPPrintkPort, &BSPConsolePort); @@ -206,6 +195,49 @@ console_initialize(rtems_device_major_number major, } #endif + if(BSPPrintkPort == BSP_UART_COM1) + { + printk("Warning : This will be the last message on console\n"); + + /* + * FIXME: cast below defeats the very idea of having + * function pointer types defined + */ + BSP_output_char = (BSP_output_char_function_type) + BSP_output_char_via_serial; + BSP_poll_char = (BSP_polling_getchar_function_type) + BSP_poll_char_via_serial; + } + else if(BSPPrintkPort != BSP_CONSOLE_PORT_CONSOLE) + { + printk("illegal assignement of printk channel"); + /* just skip; at this early stage we don't want + * to call rtems_fatal_error_occurred(). + */ + } +} + +/*-------------------------------------------------------------------------+ +| Console device driver INITIALIZE entry point. ++--------------------------------------------------------------------------+ +| Initilizes the I/O console (keyboard + VGA display) driver. ++--------------------------------------------------------------------------*/ +rtems_device_driver +console_initialize(rtems_device_major_number major, + rtems_device_minor_number minor, + void *arg) +{ + rtems_status_code status; + + + /* Initialize the KBD interface */ + kbd_init(); + + /* + * Set up TERMIOS + */ + rtems_termios_initialize (); + /* * The video was initialized in the start.s code and does not need * to be reinitialized. @@ -275,27 +307,14 @@ console_initialize(rtems_device_major_number major, { printk("Initialized console on port COM2 9600-8-N-1\n\n"); } + } - if(BSPPrintkPort == BSP_UART_COM1) - { - printk("Warning : This will be the last message on console\n"); - - /* - * FIXME: cast below defeats the very idea of having - * function pointer types defined - */ - BSP_output_char = (BSP_output_char_function_type) - BSP_output_char_via_serial; - BSP_poll_char = (BSP_polling_getchar_function_type) - BSP_poll_char_via_serial; - } - else if(BSPPrintkPort != BSP_CONSOLE_PORT_CONSOLE) - { - printk("illegal assignement of printk channel"); - rtems_fatal_error_occurred (status); - } - + if(BSPPrintkPort != BSP_CONSOLE_PORT_CONSOLE && BSPPrintkPort != BSP_UART_COM1) + { + printk("illegal assignement of printk channel"); + rtems_fatal_error_occurred (status); } + return RTEMS_SUCCESSFUL; } /* console_initialize */ diff --git a/c/src/lib/libbsp/i386/pc386/start/start.S b/c/src/lib/libbsp/i386/pc386/start/start.S index ad71ccdf31..b5e00101c4 100644 --- a/c/src/lib/libbsp/i386/pc386/start/start.S +++ b/c/src/lib/libbsp/i386/pc386/start/start.S @@ -68,6 +68,7 @@ BEGIN_CODE EXTERN (_IBMPC_initVideo) EXTERN (debugPollingGetChar) EXTERN (checkCPUtypeSetCr0) + EXTERN (BSP_console_select) /* * In case this crashes on your machine and this is not due @@ -202,6 +203,11 @@ SYM (zero_bss): call checkCPUtypeSetCr0 /*---------------------------------------------------------------------+ +| Redirect printk (and console) port if desired ++---------------------------------------------------------------------*/ + call SYM(BSP_console_select) + +/*---------------------------------------------------------------------+ | Transfer control to User's Board Support Package | Note: at the top we reserved space for the argument | so that |