summaryrefslogtreecommitdiffstats
path: root/c/src/lib/libbsp/i386/pc386/console/console.c
diff options
context:
space:
mode:
authorTill Straumann <strauman@slac.stanford.edu>2009-11-06 01:09:57 +0000
committerTill Straumann <strauman@slac.stanford.edu>2009-11-06 01:09:57 +0000
commitb092ad6071590fea29dee39a21d7ef5cb22c61bf (patch)
tree5be77984aa084104934b05c33a364aa5ef88ce7a /c/src/lib/libbsp/i386/pc386/console/console.c
parentNew. (diff)
downloadrtems-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/src/lib/libbsp/i386/pc386/console/console.c')
-rw-r--r--c/src/lib/libbsp/i386/pc386/console/console.c97
1 files changed, 58 insertions, 39 deletions
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 */