Changeset 5f4c41b2 in mainline


Ignore:
Timestamp:
2017-11-26T02:41:55Z (6 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f4cfd271
Parents:
9940ce0
Message:

Move sending side of Sun4v console out of output server.

Location:
uspace
Files:
2 deleted
5 edited

Legend:

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

    r9940ce0 r5f4c41b2  
    193193static void ski_con_putchar(ski_con_t *con, char ch)
    194194{
     195        if (ch == '\n')
     196                ski_con_putchar(con, '\r');
     197
    195198#ifdef UARCH_ia64
    196199        asm volatile (
     
    205208        (void) ch;
    206209#endif
    207         if (ch == '\n')
    208                 ski_con_putchar(con, '\r');
    209210}
    210211
  • uspace/drv/char/sun4v-con/sun4v-con.c

    r9940ce0 r5f4c41b2  
    3838#include <io/chardev_srv.h>
    3939#include <stdbool.h>
    40 #include <thread.h>
     40#include <sysinfo.h>
    4141
    4242#include "sun4v-con.h"
     
    5959} __attribute__((packed)) __attribute__((aligned(PAGE_SIZE))) *input_buffer_t;
    6060
     61#define OUTPUT_FIFO_SIZE  ((PAGE_SIZE) - 2 * sizeof(uint64_t))
     62
     63typedef volatile struct {
     64        uint64_t read_ptr;
     65        uint64_t write_ptr;
     66        char data[OUTPUT_FIFO_SIZE];
     67} __attribute__((packed)) output_fifo_t;
     68
    6169/* virtual address of the shared buffer */
    6270static input_buffer_t input_buffer;
     71static output_fifo_t *output_fifo;
    6372
    6473static int sun4v_con_read(chardev_srv_t *, void *, size_t, size_t *);
     
    7281static void sun4v_con_putchar(sun4v_con_t *con, uint8_t data)
    7382{
    74         (void) con;
    75         (void) data;
     83        if (data == '\n')
     84                sun4v_con_putchar(con, '\r');
     85
     86        while (output_fifo->write_ptr ==
     87            (output_fifo->read_ptr + OUTPUT_FIFO_SIZE - 1)
     88            % OUTPUT_FIFO_SIZE);
     89
     90        output_fifo->data[output_fifo->write_ptr] = data;
     91        output_fifo->write_ptr =
     92            ((output_fifo->write_ptr) + 1) % OUTPUT_FIFO_SIZE;
    7693}
    7794
     
    105122        }
    106123
     124        sysarg_t paddr;
     125        rc = sysinfo_get_value("niagara.outbuf.address", &paddr);
     126        if (rc != EOK) {
     127                ddf_msg(LVL_ERROR, "Outbuf address information not found");
     128                return rc;
     129        }
     130
     131        output_fifo = (output_fifo_t *) AS_AREA_ANY;
     132
     133        rc = physmem_map(paddr, 1, AS_AREA_READ | AS_AREA_WRITE,
     134            (void *) &output_fifo);
     135        if (rc != EOK) {
     136                ddf_msg(LVL_ERROR, "Error mapping memory: %d", rc);
     137                return rc;
     138        }
     139
    107140        rc = ddf_fun_bind(fun);
    108141        if (rc != EOK) {
     
    111144        }
    112145
     146        ddf_fun_add_to_category(fun, "console");
     147
    113148        return EOK;
    114149error:
    115         /* XXX Clean up thread */
    116 
    117150        if (input_buffer != (input_buffer_t) AS_AREA_ANY)
    118151                physmem_unmap((void *) input_buffer);
  • uspace/srv/hid/output/Makefile

    r9940ce0 r5f4c41b2  
    3636        port/ega.c \
    3737        port/kchar.c \
    38         port/niagara.c \
    3938        port/chardev.c \
    4039        proto/vt100.c \
  • uspace/srv/hid/output/output.c

    r9940ce0 r5f4c41b2  
    3737#include "port/ega.h"
    3838#include "port/kchar.h"
    39 #include "port/niagara.h"
    4039#include "port/chardev.h"
    4140#include "output.h"
     
    479478                ega_init();
    480479                kchar_init();
    481                 niagara_init();
    482480        }
    483481       
  • uspace/srv/hid/output/port/chardev.c

    r9940ce0 r5f4c41b2  
    151151        }
    152152
     153        printf("%s: Connecting service %zu\n", NAME, sid);
     154        char *name;
     155        rc = loc_service_get_name(sid, &name);
     156        if (rc != EOK) {
     157                fibril_mutex_unlock(&discovery_lock);
     158                return;
     159        }
     160        printf("%s: Service name is %s\n", NAME, name);
     161        free(name);
     162
    153163        sess = loc_service_connect(sid, INTERFACE_DDF, IPC_FLAG_BLOCKING);
    154164        if (!sess) {
     
    176186        if (!config_key_exists("console")) {
    177187                console = NULL;
    178 #ifndef MACHINE_ski
     188#ifdef MACHINE_ski
     189                /* OK */
     190#elif defined(UARCH_sparc64) && defined(PROCESSOR_sun4v)
     191                /* OK */
     192#else
    179193                return EOK;
    180194#endif
Note: See TracChangeset for help on using the changeset viewer.