Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/char/ski-con/ski-con.c

    rcf3a905c r09ab0a9a  
    11/*
    22 * Copyright (c) 2005 Jakub Jermar
    3  * Copyright (c) 2018 Jiri Svoboda
     3 * Copyright (c) 2017 Jiri Svoboda
    44 * All rights reserved.
    55 *
     
    3131 */
    3232
    33 #include <as.h>
    3433#include <async.h>
    3534#include <ddf/driver.h>
    3635#include <ddf/log.h>
    37 #include <ddi.h>
    3836#include <errno.h>
    3937#include <fibril.h>
     
    4240#include <stdlib.h>
    4341#include <stdbool.h>
    44 #include <sysinfo.h>
    4542
    4643#include "ski-con.h"
     
    7168        ddf_fun_t *fun = NULL;
    7269        bool bound = false;
    73         uintptr_t faddr;
    74         void *addr = AS_AREA_ANY;
    7570        errno_t rc;
    7671
     
    9287        con->cds.sarg = con;
    9388
    94         rc = sysinfo_get_value("ski.paddr", &faddr);
    95         if (rc != EOK)
    96                 faddr = 0; /* No kernel driver to arbitrate with */
    97 
    98         if (faddr != 0) {
    99                 addr = AS_AREA_ANY;
    100                 rc = physmem_map(faddr, 1, AS_AREA_READ | AS_AREA_CACHEABLE,
    101                     &addr);
    102                 if (rc != EOK) {
    103                         ddf_msg(LVL_ERROR, "Cannot map kernel driver arbitration area.");
    104                         goto error;
    105                 }
    106         }
    107 
    10889        rc = ddf_fun_bind(fun);
    10990        if (rc != EOK) {
     
    126107        return EOK;
    127108error:
    128         if (addr != AS_AREA_ANY)
    129                 as_area_destroy(addr);
    130109        if (bound)
    131110                ddf_fun_unbind(fun);
     
    148127}
    149128
    150 /** Detect if SKI console is in use by the kernel.
    151  *
    152  * This is needed since the kernel has no way of fencing off the user-space
    153  * driver.
    154  *
    155  * @return @c true if in use by the kernel.
    156  */
    157 static bool ski_con_disabled(void)
    158 {
    159         sysarg_t kconsole;
    160 
    161         /*
    162          * XXX Ideally we should get information from our kernel counterpart
    163          * driver. But there needs to be a mechanism for the kernel console
    164          * to inform the kernel driver.
    165          */
    166         if (sysinfo_get_value("kconsole", &kconsole) != EOK)
    167                 return false;
    168 
    169         return kconsole != false;
    170 }
    171 
    172129/** Poll Ski for keypresses. */
    173130static errno_t ski_con_fibril(void *arg)
     
    178135
    179136        while (true) {
    180                 while (!ski_con_disabled()) {
     137                while (true) {
    181138                        c = ski_con_getchar();
    182139                        if (c == 0)
     
    289246        uint8_t *dp = (uint8_t *) data;
    290247
    291         if (!ski_con_disabled()) {
    292                 for (i = 0; i < size; i++) {
    293                         ski_con_putchar(con, dp[i]);
    294                 }
    295         }
     248        for (i = 0; i < size; i++)
     249                ski_con_putchar(con, dp[i]);
    296250
    297251        *nwr = size;
Note: See TracChangeset for help on using the changeset viewer.