Changeset b092ad6 in rtems


Ignore:
Timestamp:
Nov 6, 2009, 1:09:57 AM (10 years ago)
Author:
Till Straumann <strauman@…>
Branches:
4.10, 4.11, master
Children:
260e6fb3
Parents:
f942ba6
Message:

2009-11-05 Till Straumann <strauman@…>

  • 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.
Location:
c/src/lib/libbsp/i386/pc386
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/i386/pc386/ChangeLog

    rf942ba6 rb092ad6  
     12009-11-05      Till Straumann <strauman@slac.stanford.edu>
     2
     3        * start/start.S, console/console.c: Separated code
     4        that switched console and printk port based on info
     5        gathered from the commandline and/or a BSP provided
     6        routine into new BSP_console_select() which is called
     7        from 'start.S' so that early messages make it to the
     8        redirected printk port.
     9
    1102009-10-28      Till Straumann <strauman@slac.stanford.edu>
    211
  • c/src/lib/libbsp/i386/pc386/console/console.c

    rf942ba6 rb092ad6  
    144144BSP_runtime_console_select(int *, int *) __attribute__((weak));
    145145
    146 /*-------------------------------------------------------------------------+
    147 | Console device driver INITIALIZE entry point.
    148 +--------------------------------------------------------------------------+
    149 | Initilizes the I/O console (keyboard + VGA display) driver.
    150 +--------------------------------------------------------------------------*/
    151 rtems_device_driver
    152 console_initialize(rtems_device_major_number major,
    153                    rtems_device_minor_number minor,
    154                    void                      *arg)
    155 {
    156   rtems_status_code status;
     146/* provide routine to select console; this
     147 * is called very early so that early boot
     148 * messages also make it to the redirected
     149 * device.
     150 */
     151void
     152BSP_console_select()
     153{
    157154  const char* mode;
    158  
     155
    159156  /*
    160157   * Check the command line for the type of mode
    161    * the consol is.
     158   * the console is.
    162159   */
    163160  mode = bsp_cmdline_arg ("--console=");
     
    182179    }
    183180  }
    184  
    185   /* Initialize the KBD interface */
    186   kbd_init();
    187 
    188   /*
    189    * Set up TERMIOS
    190    */
    191   rtems_termios_initialize ();
    192181
    193182  if ( BSP_runtime_console_select )
     
    206195  }
    207196#endif
     197
     198  if(BSPPrintkPort == BSP_UART_COM1)
     199    {
     200      printk("Warning : This will be the last message on console\n");
     201
     202      /*
     203       * FIXME: cast below defeats the very idea of having
     204       * function pointer types defined
     205       */
     206      BSP_output_char = (BSP_output_char_function_type)
     207                          BSP_output_char_via_serial;
     208      BSP_poll_char   = (BSP_polling_getchar_function_type)
     209                          BSP_poll_char_via_serial;
     210    }
     211  else if(BSPPrintkPort != BSP_CONSOLE_PORT_CONSOLE)
     212    {
     213      printk("illegal assignement of printk channel");
     214      /* just skip; at this early stage we don't want
     215       * to call rtems_fatal_error_occurred().
     216       */
     217    }
     218}
     219
     220/*-------------------------------------------------------------------------+
     221| Console device driver INITIALIZE entry point.
     222+--------------------------------------------------------------------------+
     223| Initilizes the I/O console (keyboard + VGA display) driver.
     224+--------------------------------------------------------------------------*/
     225rtems_device_driver
     226console_initialize(rtems_device_major_number major,
     227                   rtems_device_minor_number minor,
     228                   void                      *arg)
     229{
     230  rtems_status_code status;
     231 
     232 
     233  /* Initialize the KBD interface */
     234  kbd_init();
     235
     236  /*
     237   * Set up TERMIOS
     238   */
     239  rtems_termios_initialize ();
    208240
    209241  /*
     
    276308          printk("Initialized console on port COM2 9600-8-N-1\n\n");
    277309        }
    278 
    279       if(BSPPrintkPort == BSP_UART_COM1)
    280         {
    281           printk("Warning : This will be the last message on console\n");
    282 
    283           /*
    284            * FIXME: cast below defeats the very idea of having
    285            * function pointer types defined
    286            */
    287           BSP_output_char = (BSP_output_char_function_type)
    288                               BSP_output_char_via_serial;
    289           BSP_poll_char   = (BSP_polling_getchar_function_type)
    290                               BSP_poll_char_via_serial;
    291         }
    292       else if(BSPPrintkPort != BSP_CONSOLE_PORT_CONSOLE)
    293         {
    294            printk("illegal assignement of printk channel");
    295          rtems_fatal_error_occurred (status);
    296         }
    297 
    298     }
     310  }
     311
     312  if(BSPPrintkPort != BSP_CONSOLE_PORT_CONSOLE && BSPPrintkPort != BSP_UART_COM1)
     313    {
     314      printk("illegal assignement of printk channel");
     315      rtems_fatal_error_occurred (status);
     316    }
     317
    299318  return RTEMS_SUCCESSFUL;
    300319} /* console_initialize */
  • c/src/lib/libbsp/i386/pc386/start/start.S

    rf942ba6 rb092ad6  
    6969        EXTERN (debugPollingGetChar)
    7070        EXTERN (checkCPUtypeSetCr0)
     71        EXTERN (BSP_console_select)
    7172
    7273/*
     
    203204
    204205/*---------------------------------------------------------------------+
     206| Redirect printk (and console) port if desired
     207+---------------------------------------------------------------------*/
     208        call SYM(BSP_console_select)
     209
     210/*---------------------------------------------------------------------+
    205211| Transfer control to User's Board Support Package
    206212| Note: at the top we reserved space for the argument
Note: See TracChangeset for help on using the changeset viewer.