Changeset 3ad953c in mainline for kernel/generic/src


Ignore:
Timestamp:
2008-12-30T19:55:10Z (17 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f58321c4
Parents:
6b21292
Message:

send notification to uspace console when switching from kernel console

Location:
kernel/generic/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/cmd.c

    r6b21292 r3ad953c  
    977977{
    978978        printf("The kernel will now relinquish the console.\n");
    979         printf("Use userspace controls to redraw the screen.\n");
    980979        arch_release_console();
     980       
     981        if ((kconsole_notify) && (kconsole_irq.notif_cfg.notify))
     982                ipc_irq_send_msg_0(&kconsole_irq);
     983       
    981984        return 1;
    982985}
  • kernel/generic/src/console/kconsole.c

    r6b21292 r3ad953c  
    5252#include <symtab.h>
    5353#include <macros.h>
     54#include <sysinfo/sysinfo.h>
     55#include <ddi/device.h>
    5456
    5557/** Simple kernel console.
     
    8486static char history[KCONSOLE_HISTORY][MAX_CMDLINE] = {};
    8587
    86 /** Initialize kconsole data structures. */
     88/*
     89 * For now, we use 0 as INR.
     90 * However, it is therefore desirable to have architecture specific
     91 * definition of KCONSOLE_VIRT_INR in the future.
     92 */
     93#define KCONSOLE_VIRT_INR  0
     94
     95bool kconsole_notify = false;
     96irq_t kconsole_irq;
     97
     98
     99/** Allways refuse IRQ ownership.
     100 *
     101 * This is not a real IRQ, so we always decline.
     102 *
     103 * @return Always returns IRQ_DECLINE.
     104 *
     105 */
     106static irq_ownership_t kconsole_claim(void)
     107{
     108        return IRQ_DECLINE;
     109}
     110
     111
     112/** Initialize kconsole data structures
     113 *
     114 * This is the most basic initialization, almost no
     115 * other kernel subsystem is ready yet.
     116 *
     117 */
    87118void kconsole_init(void)
    88119{
    89         int i;
     120        unsigned int i;
    90121
    91122        cmd_init();
    92123        for (i = 0; i < KCONSOLE_HISTORY; i++)
    93124                history[i][0] = '\0';
     125}
     126
     127
     128/** Initialize kconsole notification mechanism
     129 *
     130 * Initialize the virtual IRQ notification mechanism.
     131 *
     132 */
     133void kconsole_notify_init(void)
     134{
     135        devno_t devno = device_assign_devno();
     136       
     137        sysinfo_set_item_val("kconsole.present", NULL, true);
     138        sysinfo_set_item_val("kconsole.devno", NULL, devno);
     139        sysinfo_set_item_val("kconsole.inr", NULL, KCONSOLE_VIRT_INR);
     140       
     141        irq_initialize(&kconsole_irq);
     142        kconsole_irq.devno = devno;
     143        kconsole_irq.inr = KCONSOLE_VIRT_INR;
     144        kconsole_irq.claim = kconsole_claim;
     145        irq_register(&kconsole_irq);
     146       
     147        kconsole_notify = true;
    94148}
    95149
  • kernel/generic/src/main/main.c

    r6b21292 r3ad953c  
    199199            config.base, config.kernel_size, config.stack_base,
    200200            config.stack_size);
    201 
     201       
    202202#ifdef CONFIG_KCONSOLE
    203203        /*
     
    214214         */
    215215        LOG_EXEC(exc_init());
    216 
     216       
    217217        /*
    218218         * Memory management subsystems initialization.
     
    260260        LOG_EXEC(ipc_init());
    261261        LOG_EXEC(klog_init());
    262 
     262       
     263#ifdef CONFIG_KCONSOLE
     264        LOG_EXEC(kconsole_notify_init());
     265#endif
     266       
    263267        /*
    264268         * Create kernel task.
Note: See TracChangeset for help on using the changeset viewer.