Changeset 516ff92 in mainline for kernel/arch


Ignore:
Timestamp:
2009-01-31T21:27:18Z (17 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
4863e50b
Parents:
96a2e45
Message:

silent kernel console output when user space console is active

Location:
kernel/arch
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/arm32/include/machine.h

    r96a2e45 r516ff92  
    103103
    104104
    105 #ifdef MACHINE_GXEMUL_TESTARM   
    106 #define machine_console_init(devno)           gxemul_console_init(devno)
    107 #define machine_grab_console                  gxemul_grab_console
    108 #define machine_release_console               gxemul_release_console
    109 #define machine_hw_map_init                   gxemul_hw_map_init
    110 #define machine_timer_irq_start               gxemul_timer_irq_start
    111 #define machine_cpu_halt                      gxemul_cpu_halt
    112 #define machine_get_memory_size               gxemul_get_memory_size
    113 #define machine_debug_putc(ch)                gxemul_debug_putc(ch)
    114 #define machine_irq_exception(exc_no, istate) \
    115         gxemul_irq_exception(exc_no, istate)
    116 #define machine_get_fb_address                gxemul_get_fb_address
     105#ifdef MACHINE_GXEMUL_TESTARM
     106        #define machine_console_init(devno)            gxemul_console_init(devno)
     107        #define machine_grab_console                   gxemul_grab_console
     108        #define machine_release_console                gxemul_release_console
     109        #define machine_hw_map_init                    gxemul_hw_map_init
     110        #define machine_timer_irq_start                gxemul_timer_irq_start
     111        #define machine_cpu_halt                       gxemul_cpu_halt
     112        #define machine_get_memory_size                gxemul_get_memory_size
     113        #define machine_debug_putc(ch)                 gxemul_debug_putc(ch)
     114        #define machine_irq_exception(exc_no, istate)  gxemul_irq_exception(exc_no, istate)
     115        #define machine_get_fb_address                 gxemul_get_fb_address
    117116#endif
    118117
  • kernel/arch/arm32/src/drivers/gxemul.c

    r96a2e45 r516ff92  
    134134 * @param ch Characted to be printed.
    135135 */
    136 static void gxemul_write(chardev_t *dev, const char ch)
    137 {
    138         *((char *) gxemul_hw_map.videoram) = ch;
     136static void gxemul_write(chardev_t *dev, const char ch, bool silent)
     137{
     138        if (!silent)
     139                *((char *) gxemul_hw_map.videoram) = ch;
    139140}
    140141
  • kernel/arch/ia32xen/src/drivers/xconsole.c

    r96a2e45 r516ff92  
    5656}
    5757
    58 void xen_putchar(chardev_t *d, const char ch)
     58void xen_putchar(chardev_t *d, const char ch, bool silent)
    5959{
    60         if (start_info.console.domU.evtchn != 0) {
    61                 uint32_t cons = console_page.out_cons;
    62                 uint32_t prod = console_page.out_prod;
    63                
    64                 memory_barrier();
    65                
    66                 if ((prod - cons) > sizeof(console_page.out))
    67                         return;
    68                
    69                 if (ch == '\n')
    70                         console_page.out[MASK_INDEX(prod++, console_page.out)] = '\r';
    71                 console_page.out[MASK_INDEX(prod++, console_page.out)] = ch;
    72                
    73                 write_barrier();
    74                
    75                 console_page.out_prod = prod;
    76                
    77                 xen_notify_remote(start_info.console.domU.evtchn);
    78         } else
    79                 xen_console_io(CONSOLE_IO_WRITE, 1, &ch);
     60        if (!silent) {
     61                if (start_info.console.domU.evtchn != 0) {
     62                        uint32_t cons = console_page.out_cons;
     63                        uint32_t prod = console_page.out_prod;
     64                       
     65                        memory_barrier();
     66                       
     67                        if ((prod - cons) > sizeof(console_page.out))
     68                                return;
     69                       
     70                        if (ch == '\n')
     71                                console_page.out[MASK_INDEX(prod++, console_page.out)] = '\r';
     72                        console_page.out[MASK_INDEX(prod++, console_page.out)] = ch;
     73                       
     74                        write_barrier();
     75                       
     76                        console_page.out_prod = prod;
     77                       
     78                        xen_notify_remote(start_info.console.domU.evtchn);
     79                } else
     80                        xen_console_io(CONSOLE_IO_WRITE, 1, &ch);
     81        }
    8082}
    8183
  • kernel/arch/ia64/src/ia64.c

    r96a2e45 r516ff92  
    255255#else
    256256        i8042_grab();
    257 #endif 
    258 #endif 
     257#endif
     258#endif
    259259}
    260260
  • kernel/arch/ia64/src/ski/ski.c

    r96a2e45 r516ff92  
    5757static bool kbd_disabled;
    5858
    59 static void ski_putchar(chardev_t *d, const char ch);
    60 static int32_t ski_getchar(void);
    61 
    6259/** Display character on debug console
    6360 *
     
    6865 * @param ch Character to be printed.
    6966 */
    70 void ski_putchar(chardev_t *d, const char ch)
    71 {
    72         asm volatile (
    73                 "mov r15 = %0\n"
    74                 "mov r32 = %1\n"        /* r32 is in0 */
    75                 "break 0x80000\n"       /* modifies r8 */
    76                 :
    77                 : "i" (SKI_PUTCHAR), "r" (ch)
    78                 : "r15", "in0", "r8"
    79         );
    80        
    81         if (ch == '\n')
    82                 ski_putchar(d, '\r');
     67static void ski_putchar(chardev_t *d, const char ch, bool silent)
     68{
     69        if (!silent) {
     70                asm volatile (
     71                        "mov r15 = %0\n"
     72                        "mov r32 = %1\n"   /* r32 is in0 */
     73                        "break 0x80000\n"  /* modifies r8 */
     74                        :
     75                        : "i" (SKI_PUTCHAR), "r" (ch)
     76                        : "r15", "in0", "r8"
     77                );
     78               
     79                if (ch == '\n')
     80                        ski_putchar(d, '\r');
     81        }
    8382}
    8483
     
    9291 * @return ASCII code of pressed key or 0 if no key pressed.
    9392 */
    94 int32_t ski_getchar(void)
     93static int32_t ski_getchar(void)
    9594{
    9695        uint64_t ch;
  • kernel/arch/mips32/src/drivers/msim.c

    r96a2e45 r516ff92  
    2727 */
    2828
    29 /** @addtogroup mips32 
     29/** @addtogroup mips32
    3030 * @{
    3131 */
     
    5959
    6060/** Putchar that works with MSIM & gxemul */
    61 void msim_write(chardev_t *dev, const char ch)
     61void msim_write(chardev_t *dev, const char ch, bool silent)
    6262{
    63         *((char *) MSIM_VIDEORAM) = ch;
     63        if (!silent)
     64                *((char *) MSIM_VIDEORAM) = ch;
    6465}
    6566
     
    8182{
    8283        char ch;
    83 
     84       
    8485        while (1) {
    8586                ch = *((volatile char *) MSIM_KBD_ADDRESS);
     
    102103                char ch = 0;
    103104               
    104                         ch = *((char *) MSIM_KBD_ADDRESS);
    105                         if (ch =='\r')
    106                                 ch = '\n';
    107                         if (ch == 0x7f)
    108                                 ch = '\b';
    109                         chardev_push_character(&console, ch);
     105                ch = *((char *) MSIM_KBD_ADDRESS);
     106                if (ch =='\r')
     107                        ch = '\n';
     108                if (ch == 0x7f)
     109                        ch = '\b';
     110                chardev_push_character(&console, ch);
    110111        }
    111112}
  • kernel/arch/mips32/src/drivers/serial.c

    r96a2e45 r516ff92  
    2727 */
    2828
    29 /** @addtogroup mips32 
     29/** @addtogroup mips32
    3030 * @{
    3131 */
     
    4747static bool kb_enabled;
    4848
    49 static void serial_write(chardev_t *d, const char ch)
     49static void serial_write(chardev_t *d, const char ch, bool silent)
    5050{
    51         serial_t *sd = (serial_t *)d->data;
    52 
    53         if (ch == '\n')
    54                 serial_write(d, '\r');
    55         /* Wait until transmit buffer empty */
    56         while (! (SERIAL_READ_LSR(sd->port) & (1<<TRANSMIT_EMPTY_BIT)))
    57                 ;
    58         SERIAL_WRITE(sd->port, ch);
     51        if (!silent) {
     52                serial_t *sd = (serial_t *)d->data;
     53               
     54                if (ch == '\n')
     55                        serial_write(d, '\r');
     56               
     57                /* Wait until transmit buffer empty */
     58                while (!(SERIAL_READ_LSR(sd->port) & (1 << TRANSMIT_EMPTY_BIT)));
     59                SERIAL_WRITE(sd->port, ch);
     60        }
    5961}
    6062
     
    134136{
    135137        serial_t *sd = &sconf[0];
    136 
    137 
     138       
    138139        chardev_initialize("serial_console", &console, &serial_ops);
    139140        console.data = sd;
     
    146147        serial_irq.handler = serial_irq_handler;
    147148        irq_register(&serial_irq);
    148 
     149       
    149150        /* I don't know why, but the serial interrupts simply
    150          * don't work on simics
    151          */
     151           don't work on simics */
    152152        virtual_timer_fnc = &serial_handler;
    153153       
  • kernel/arch/ppc32/src/ppc32.c

    r96a2e45 r516ff92  
    148148       
    149149        /* Unreachable */
    150         for (;;)
    151                 ;
     150        while (true);
    152151}
    153152
  • kernel/arch/sparc64/src/drivers/sgcn.c

    r96a2e45 r516ff92  
    296296 * written straight away.
    297297 */
    298 static void sgcn_putchar(struct chardev * cd, const char c)
    299 {
    300         spinlock_lock(&sgcn_output_lock);
    301        
    302         sgcn_do_putchar(c);
    303         if (c == '\n') {
    304                 sgcn_do_putchar('\r');
     298static void sgcn_putchar(struct chardev * cd, const char c, bool silent)
     299{
     300        if (!silent) {
     301                spinlock_lock(&sgcn_output_lock);
     302               
     303                sgcn_do_putchar(c);
     304                if (c == '\n')
     305                        sgcn_do_putchar('\r');
     306               
     307                spinlock_unlock(&sgcn_output_lock);
    305308        }
    306        
    307         spinlock_unlock(&sgcn_output_lock);
    308309}
    309310
Note: See TracChangeset for help on using the changeset viewer.