Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 392f0e7 in mainline


Ignore:
Timestamp:
2018-11-23T14:50:24Z (20 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
2519349
Parents:
ca21f1e2
git-author:
Jiri Svoboda <jiri@…> (2018-11-22 17:48:21)
git-committer:
Jiri Svoboda <jiri@…> (2018-11-23 14:50:24)
Message:

Provide a way for kernel console on SKI to disable the user-space driver.

Files:
2 edited

Legend:

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

    rca21f1e2 r392f0e7  
    209209void grab_console(void)
    210210{
     211        sysinfo_set_item_val("kconsole", NULL, true);
    211212        event_notify_1(EVENT_KCONSOLE, false, true);
    212213        bool prev = console_override;
     
    226227void release_console(void)
    227228{
     229        sysinfo_set_item_val("kconsole", NULL, false);
    228230        console_override = false;
    229231        event_notify_1(EVENT_KCONSOLE, false, false);
  • uspace/drv/char/ski-con/ski-con.c

    rca21f1e2 r392f0e7  
    11/*
    22 * Copyright (c) 2005 Jakub Jermar
    3  * Copyright (c) 2017 Jiri Svoboda
     3 * Copyright (c) 2018 Jiri Svoboda
    44 * All rights reserved.
    55 *
     
    4040#include <stdlib.h>
    4141#include <stdbool.h>
     42#include <sysinfo.h>
    4243
    4344#include "ski-con.h"
     
    127128}
    128129
     130/** Detect if SKI console is in use by the kernel.
     131 *
     132 * This is needed since the kernel has no way of fencing off the user-space
     133 * driver.
     134 *
     135 * @return @c true if in use by the kernel.
     136 */
     137static bool ski_con_disabled(void)
     138{
     139        sysarg_t kconsole;
     140
     141        /*
     142         * XXX Ideally we should get information from our kernel counterpart
     143         * driver. But there needs to be a mechanism for the kernel console
     144         * to inform the kernel driver.
     145         */
     146        if (sysinfo_get_value("kconsole", &kconsole) != EOK)
     147                return false;
     148
     149        return kconsole != false;
     150}
     151
    129152/** Poll Ski for keypresses. */
    130153static errno_t ski_con_fibril(void *arg)
     
    135158
    136159        while (true) {
    137                 while (true) {
     160                while (!ski_con_disabled()) {
    138161                        c = ski_con_getchar();
    139162                        if (c == 0)
     
    246269        uint8_t *dp = (uint8_t *) data;
    247270
    248         for (i = 0; i < size; i++)
    249                 ski_con_putchar(con, dp[i]);
     271        for (i = 0; i < size; i++) {
     272                if (!ski_con_disabled())
     273                        ski_con_putchar(con, dp[i]);
     274        }
    250275
    251276        *nwr = size;
Note: See TracChangeset for help on using the changeset viewer.