Changes in / [bfa4ffa:0d9b4a8] in mainline


Ignore:
Files:
1 added
9 deleted
26 edited

Legend:

Unmodified
Added
Removed
  • boot/Makefile

    rbfa4ffa r0d9b4a8  
    113113                file_dir="`dirname "$$file"`" ; \
    114114                file_name="`basename "$$file"`" ; \
    115                 cp "$(USPACE_PATH)/$(DRVS_PATH)/$$file_dir/$$file_name/"*".dev" "$(DIST_PATH)/$(DRVS_PATH)/$$file_name/" ; \
     115                cp "$(USPACE_PATH)/$(DRVS_PATH)/$$file_dir/$$file_name/$$file_name.dev" "$(DIST_PATH)/$(DRVS_PATH)/$$file_name/" ; \
    116116        done
    117117        for file in $(RD_DRVS_FW) ; do \
  • boot/arch/sparc64/Makefile.inc

    rbfa4ffa r0d9b4a8  
    3939EXTRA_CFLAGS = -mcpu=ultrasparc -m64 -mno-fpu -mcmodel=medlow
    4040
    41 RD_DRVS_ESSENTIAL += \
    42         platform/sun4u \
    43         bus/pci/pciintel \
    44         bus/isa \
    45         char/ns8250
    46 
    47 RD_DRV_CFG += \
    48         bus/isa
    49 
    5041RD_SRVS_NON_ESSENTIAL +=
    5142
  • kernel/arch/sparc64/src/drivers/pci.c

    rbfa4ffa r0d9b4a8  
    112112            PAGE_WRITE | PAGE_NOT_CACHEABLE);
    113113
     114        /*
     115         * Set sysinfo data needed by the uspace OBIO driver.
     116         */
     117        sysinfo_set_item_val("obio.base.physical", NULL, paddr);
     118        sysinfo_set_item_val("kbd.cir.obio", NULL, 1);
     119
    114120        return pci;
    115121}
     
    153159        pci->reg = (uint64_t *) km_map(paddr, reg[PSYCHO_INTERNAL_REG].size,
    154160            PAGE_WRITE | PAGE_NOT_CACHEABLE);
     161
     162        /*
     163         * Set sysinfo data needed by the uspace OBIO driver.
     164         */
     165        sysinfo_set_item_val("obio.base.physical", NULL, paddr);
     166        sysinfo_set_item_val("kbd.cir.obio", NULL, 1);
    155167
    156168        return pci;
  • kernel/arch/sparc64/src/sparc64.c

    rbfa4ffa r0d9b4a8  
    3636#include <arch/arch.h>
    3737#include <mm/slab.h>
    38 #include <sysinfo/sysinfo.h>
    3938#include <config.h>
    4039#include <arch/proc/thread.h>
     
    7473                uwb_cache = slab_cache_create("uwb_cache", UWB_SIZE,
    7574                    UWB_ALIGNMENT, NULL, NULL, SLAB_CACHE_MAGDEFERRED);
    76 
    77                 /* Copy boot arguments */
    78                 ofw_tree_node_t *options = ofw_tree_lookup("/options");
    79                 if (options) {
    80                         ofw_tree_property_t *prop;
    81                
    82                         prop = ofw_tree_getprop(options, "boot-args");
    83                         if (prop && prop->value) {
    84                                 str_ncpy(bargs, CONFIG_BOOT_ARGUMENTS_BUFLEN,
    85                                     prop->value, prop->size);
    86                         }
    87                 }
    8875        }
    8976}
  • kernel/genarch/src/multiboot/multiboot.c

    rbfa4ffa r0d9b4a8  
    100100}
    101101
    102 static void multiboot_cmdline(char *cmdline)
    103 {
    104         /*
    105          * GRUB passes the command line in an escaped form.
    106          */
    107         for (size_t i = 0, j = 0;
    108             cmdline[i] && j < CONFIG_BOOT_ARGUMENTS_BUFLEN;
    109             i++, j++) {
    110                 if (cmdline[i] == '\\') {
    111                         switch (cmdline[i + 1]) {
    112                         case '\\':
    113                         case '\'':
    114                         case '\"':
    115                                 i++;
    116                                 break;
    117                         }
    118                 }
    119                 bargs[j] = cmdline[i];
    120         }
    121 }
    122 
    123102static void multiboot_modules(uint32_t count, multiboot_module_t *mods)
    124103{
     
    174153        if (signature != MULTIBOOT_LOADER_MAGIC)
    175154                return;
    176 
    177         /* Copy command line. */
    178         if ((info->flags & MULTIBOOT_INFO_FLAGS_CMDLINE) != 0)
    179                 multiboot_cmdline((char *) MULTIBOOT_PTR(info->cmd_line));
    180 
     155       
    181156        /* Copy modules information. */
    182157        if ((info->flags & MULTIBOOT_INFO_FLAGS_MODS) != 0)
  • kernel/generic/include/config.h

    rbfa4ffa r0d9b4a8  
    4343
    4444#define STACK_SIZE_USER  (1 * 1024 * 1024)
    45 
    46 #define CONFIG_BOOT_ARGUMENTS_BUFLEN 256
    4745
    4846#define CONFIG_INIT_TASKS        32
     
    104102
    105103extern config_t config;
    106 extern char bargs[];
    107104extern init_t init;
    108105extern ballocs_t ballocs;
  • kernel/generic/src/main/main.c

    rbfa4ffa r0d9b4a8  
    117117};
    118118
    119 /** Boot arguments. */
    120 char bargs[CONFIG_BOOT_ARGUMENTS_BUFLEN] = {};
    121 
    122119/** Initial user-space tasks */
    123120init_t init = {
     
    279276        thread_init();
    280277        futex_init();
    281 
    282         sysinfo_set_item_data("boot_args", NULL, bargs, str_size(bargs) + 1);
    283 
     278       
    284279        if (init.cnt > 0) {
    285280                size_t i;
  • tools/ew.py

    rbfa4ffa r0d9b4a8  
    9595                return 'system-ppc', '-m 256'
    9696        elif platform == 'sparc64':
    97                 return 'system-sparc64', '--prom-env boot-args="console=devices/\\hw\\pci0\\00:03.0\\com1\\a"'
     97                return 'system-sparc64', ''
    9898
    9999def hdisk_mk():
     
    266266                                'run' : qemu_run,
    267267                                'image' : 'image.iso',
    268                                 'audio' : False,
    269                                 'console' : False,
     268                                'audio' : False
    270269                        },
    271270                        'sun4v' : {
  • uspace/Makefile

    rbfa4ffa r0d9b4a8  
    202202        DIRS += \
    203203                srv/hw/irc/obio
    204 ifeq ($(MACHINE),generic)
    205         DIRS += \
    206                 drv/platform/sun4u \
    207                 drv/bus/pci/pciintel \
    208                 drv/bus/isa \
    209                 drv/char/ns8250
    210 endif
    211204endif
    212205
  • uspace/app/init/init.c

    rbfa4ffa r0d9b4a8  
    4949#include <loc.h>
    5050#include <str_error.h>
    51 #include <config.h>
    5251#include "init.h"
    5352
     
    307306int main(int argc, char *argv[])
    308307{
    309         int rc;
    310 
    311308        info_print();
    312309       
     
    359356        srv_start("/srv/hound");
    360357       
    361         if (!config_key_exists("console")) {
    362                 rc = compositor(HID_INPUT, HID_COMPOSITOR_SERVER);
    363                 if (rc == EOK) {
    364                         gui_start("/app/barber", HID_COMPOSITOR_SERVER);
    365                         gui_start("/app/vlaunch", HID_COMPOSITOR_SERVER);
    366                         gui_start("/app/vterm", HID_COMPOSITOR_SERVER);
    367                 }
     358        int rc = compositor(HID_INPUT, HID_COMPOSITOR_SERVER);
     359        if (rc == EOK) {
     360                gui_start("/app/barber", HID_COMPOSITOR_SERVER);
     361                gui_start("/app/vlaunch", HID_COMPOSITOR_SERVER);
     362                gui_start("/app/vterm", HID_COMPOSITOR_SERVER);
    368363        }
    369364       
  • uspace/drv/bus/isa/isa.c

    rbfa4ffa r0d9b4a8  
    6666#include <device/pio_window.h>
    6767
    68 #include <pci_dev_iface.h>
    69 
    7068#include "i8237.h"
    7169
    7270#define NAME "isa"
    73 #define ISA_CHILD_FUN_CONF_PATH "/drv/isa/isa.dev"
    74 #define EBUS_CHILD_FUN_CONF_PATH "/drv/isa/ebus.dev"
     71#define CHILD_FUN_CONF_PATH "/drv/isa/isa.dev"
    7572
    7673#define ISA_MAX_HW_RES 5
     
    7875typedef struct {
    7976        fibril_mutex_t mutex;
    80         uint16_t pci_vendor_id;
    81         uint16_t pci_device_id;
    82         uint8_t pci_class;
    83         uint8_t pci_subclass;
    8477        ddf_dev_t *dev;
    8578        ddf_fun_t *fctl;
     
    600593static void isa_functions_add(isa_bus_t *isa)
    601594{
    602 #define BASE_CLASS_BRIDGE       0x06
    603 #define SUB_CLASS_BRIDGE_ISA    0x01
    604         bool isa_bridge = ((isa->pci_class == BASE_CLASS_BRIDGE) &&
    605             (isa->pci_subclass == SUB_CLASS_BRIDGE_ISA));
    606 
    607 #define VENDOR_ID_SUN   0x108e
    608 #define DEVICE_ID_EBUS  0x1000
    609         bool ebus = ((isa->pci_vendor_id == VENDOR_ID_SUN) &&
    610             (isa->pci_device_id == DEVICE_ID_EBUS));
    611 
    612         const char *conf_path = NULL;
    613         if (isa_bridge)
    614                 conf_path = ISA_CHILD_FUN_CONF_PATH;
    615         else if (ebus)
    616                 conf_path = EBUS_CHILD_FUN_CONF_PATH;
    617 
    618         char *conf = fun_conf_read(conf_path);
     595        char *conf = fun_conf_read(CHILD_FUN_CONF_PATH);
    619596        while (conf != NULL && *conf != '\0') {
    620597                conf = isa_fun_read_info(conf, isa);
     
    646623        }
    647624
    648         rc = pci_config_space_read_16(sess, PCI_VENDOR_ID, &isa->pci_vendor_id);
    649         if (rc != EOK)
    650                 return rc;
    651         rc = pci_config_space_read_16(sess, PCI_DEVICE_ID, &isa->pci_device_id);
    652         if (rc != EOK)
    653                 return rc;
    654         rc = pci_config_space_read_8(sess, PCI_BASE_CLASS, &isa->pci_class);
    655         if (rc != EOK)
    656                 return rc;
    657         rc = pci_config_space_read_8(sess, PCI_SUB_CLASS, &isa->pci_subclass);
    658         if (rc != EOK)
    659                 return rc;
    660        
    661625        rc = pio_window_get(sess, &isa->pio_win);
    662626        if (rc != EOK) {
  • uspace/drv/bus/isa/isa.ma

    rbfa4ffa r0d9b4a8  
    1 # ISA bridge
    2 10 pci/class=06&subclass=01
    3 
    4 # EBUS
    5 1 pci/ven=108e&dev=1000
     19 pci/class=06&subclass=01
  • uspace/drv/bus/pci/pciintel/pci.c

    rbfa4ffa r0d9b4a8  
    6363#define NAME "pciintel"
    6464
    65 #define CONF_ADDR_ENABLE        (1 << 31)
    6665#define CONF_ADDR(bus, dev, fn, reg) \
    67         ((bus << 16) | (dev << 11) | (fn << 8) | (reg & ~3))
     66        ((1 << 31) | (bus << 16) | (dev << 11) | (fn << 8) | (reg & ~3))
    6867
    6968/** Obtain PCI function soft-state from DDF function node */
     
    233232        fibril_mutex_lock(&bus->conf_mutex);
    234233
    235         if (bus->conf_addr_reg) {
    236                 pio_write_32(bus->conf_addr_reg,
    237                     host2uint32_t_le(CONF_ADDR_ENABLE | conf_addr));
    238                 /*
    239                  * Always read full 32-bits from the PCI conf_data_port
    240                  * register and get the desired portion of it afterwards. Some
    241                  * architectures do not support shorter PIO reads offset from
    242                  * this register.
    243                  */
    244                 val = uint32_t_le2host(pio_read_32(bus->conf_data_reg));
    245         } else {
    246                 val = uint32_t_le2host(pio_read_32(
    247                     &bus->conf_space[conf_addr / sizeof(ioport32_t)]));
    248         }
     234        pio_write_32(bus->conf_addr_reg, host2uint32_t_le(conf_addr));
     235
     236        /*
     237         * Always read full 32-bits from the PCI conf_data_port register and
     238         * get the desired portion of it afterwards. Some architectures do not
     239         * support shorter PIO reads offset from this register.
     240         */
     241        val = uint32_t_le2host(pio_read_32(bus->conf_data_reg));
    249242
    250243        switch (len) {
     
    267260        const uint32_t conf_addr = CONF_ADDR(fun->bus, fun->dev, fun->fn, reg);
    268261        pci_bus_t *bus = pci_bus_from_fun(fun);
    269         uint32_t val;
     262        uint32_t val = 0; // Prevent -Werror=maybe-uninitialized
    270263       
    271264        fibril_mutex_lock(&bus->conf_mutex);
     
    282275                 * missing bits first.
    283276                 */
    284                 if (bus->conf_addr_reg) {
    285                         pio_write_32(bus->conf_addr_reg,
    286                             host2uint32_t_le(CONF_ADDR_ENABLE | conf_addr));
    287                         val = uint32_t_le2host(pio_read_32(bus->conf_data_reg));
    288                 } else {
    289                         val = uint32_t_le2host(pio_read_32(
    290                             &bus->conf_space[conf_addr / sizeof(ioport32_t)]));
    291                 }
     277                pio_write_32(bus->conf_addr_reg, host2uint32_t_le(conf_addr));
     278                val = uint32_t_le2host(pio_read_32(bus->conf_data_reg));
    292279        }
    293280       
     
    306293        }
    307294
    308         if (bus->conf_addr_reg) {
    309                 pio_write_32(bus->conf_addr_reg,
    310                     host2uint32_t_le(CONF_ADDR_ENABLE | conf_addr));
    311                 pio_write_32(bus->conf_data_reg, host2uint32_t_le(val));
    312         } else {
    313                 pio_write_32(&bus->conf_space[conf_addr / sizeof(ioport32_t)],
    314                     host2uint32_t_le(val));
    315         }
     295        pio_write_32(bus->conf_addr_reg, host2uint32_t_le(conf_addr));
     296        pio_write_32(bus->conf_data_reg, host2uint32_t_le(val));
    316297       
    317298        fibril_mutex_unlock(&bus->conf_mutex);
     
    639620                        ddf_msg(LVL_DEBUG, "Adding new function %s.",
    640621                            ddf_fun_get_name(fun->fnode));
    641 
     622                       
    642623                        pci_fun_create_match_ids(fun);
    643624                       
     
    707688       
    708689       
    709         assert(hw_resources.count >= 1);
    710 
    711         if (hw_resources.count == 1) {
    712                 assert(hw_resources.resources[0].type == MEM_RANGE);
    713 
    714                 ddf_msg(LVL_DEBUG, "conf_addr_space = %" PRIx64 ".",
    715                     hw_resources.resources[0].res.mem_range.address);
    716 
    717                 if (pio_enable_resource(&bus->pio_win,
    718                     &hw_resources.resources[0],
    719                     (void **) &bus->conf_space)) {
    720                         ddf_msg(LVL_ERROR,
    721                             "Failed to map configuration space.");
    722                         rc = EADDRNOTAVAIL;
    723                         goto fail;
    724                 }
    725                
    726         } else {
    727                 assert(hw_resources.resources[0].type == IO_RANGE);
    728                 assert(hw_resources.resources[0].res.io_range.size >= 4);
    729        
    730                 assert(hw_resources.resources[1].type == IO_RANGE);
    731                 assert(hw_resources.resources[1].res.io_range.size >= 4);
    732        
    733                 ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ".",
    734                     hw_resources.resources[0].res.io_range.address);
    735                 ddf_msg(LVL_DEBUG, "data_addr = %" PRIx64 ".",
    736                     hw_resources.resources[1].res.io_range.address);
    737        
    738                 if (pio_enable_resource(&bus->pio_win,
    739                     &hw_resources.resources[0],
    740                     (void **) &bus->conf_addr_reg)) {
    741                         ddf_msg(LVL_ERROR,
    742                             "Failed to enable configuration ports.");
    743                         rc = EADDRNOTAVAIL;
    744                         goto fail;
    745                 }
    746                 if (pio_enable_resource(&bus->pio_win,
    747                     &hw_resources.resources[1],
    748                     (void **) &bus->conf_data_reg)) {
    749                         ddf_msg(LVL_ERROR,
    750                             "Failed to enable configuration ports.");
    751                         rc = EADDRNOTAVAIL;
    752                         goto fail;
    753                 }
     690        assert(hw_resources.count > 1);
     691        assert(hw_resources.resources[0].type == IO_RANGE);
     692        assert(hw_resources.resources[0].res.io_range.size >= 4);
     693       
     694        assert(hw_resources.resources[1].type == IO_RANGE);
     695        assert(hw_resources.resources[1].res.io_range.size >= 4);
     696       
     697        ddf_msg(LVL_DEBUG, "conf_addr = %" PRIx64 ".",
     698            hw_resources.resources[0].res.io_range.address);
     699        ddf_msg(LVL_DEBUG, "data_addr = %" PRIx64 ".",
     700            hw_resources.resources[1].res.io_range.address);
     701       
     702        if (pio_enable_resource(&bus->pio_win, &hw_resources.resources[0],
     703            (void **) &bus->conf_addr_reg)) {
     704                ddf_msg(LVL_ERROR, "Failed to enable configuration ports.");
     705                rc = EADDRNOTAVAIL;
     706                goto fail;
     707        }
     708        if (pio_enable_resource(&bus->pio_win, &hw_resources.resources[1],
     709            (void **) &bus->conf_data_reg)) {
     710                ddf_msg(LVL_ERROR, "Failed to enable configuration ports.");
     711                rc = EADDRNOTAVAIL;
     712                goto fail;
    754713        }
    755714       
  • uspace/drv/bus/pci/pciintel/pci.h

    rbfa4ffa r0d9b4a8  
    4747        ioport32_t *conf_addr_reg;
    4848        ioport32_t *conf_data_reg;
    49         ioport32_t *conf_space;
    5049        pio_window_t pio_win;
    5150        fibril_mutex_t conf_mutex;
  • uspace/drv/char/ns8250/ns8250.c

    rbfa4ffa r0d9b4a8  
    163163        int irq;
    164164        /** The base i/o address of the devices registers. */
    165         uintptr_t io_addr;
     165        uint32_t io_addr;
    166166        /** The i/o port used to access the serial ports registers. */
    167167        ioport8_t *port;
     
    330330       
    331331        /* Gain control over port's registers. */
    332         if (pio_enable((void *) ns->io_addr, REG_COUNT,
     332        if (pio_enable((void *)(uintptr_t) ns->io_addr, REG_COUNT,
    333333            (void **) &ns->port)) {
    334                 ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIxn
     334                ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIx32
    335335                    " for device %s.", ns->io_addr, ddf_dev_get_name(ns->dev));
    336336                return false;
     
    432432                        ioport = true;
    433433                        ddf_msg(LVL_NOTE, "Device %s was assigned I/O address = "
    434                             "0x%#" PRIxn ".", ddf_dev_get_name(ns->dev), ns->io_addr);
     434                            "0x%x.", ddf_dev_get_name(ns->dev), ns->io_addr);
    435435                        break;
    436436                       
     
    771771{
    772772        ns8250_t *ns = dev_ns8250(dev);
     773
    773774        uint8_t iir = pio_read_8(&ns->regs->iid);
    774775        if ((iir & NS8250_IID_CAUSE_MASK) == NS8250_IID_CAUSE_RXSTATUS) {
     
    780781       
    781782        ns8250_read_from_device(ns);
    782         irc_disable_interrupt(ns->irq);
    783783}
    784784
     
    857857        }
    858858        need_unreg_intr_handler = true;
    859 
     859       
    860860        /* Enable interrupt. */
    861861        rc = ns8250_interrupt_enable(ns);
  • uspace/lib/c/Makefile

    rbfa4ffa r0d9b4a8  
    6565        generic/cap.c \
    6666        generic/clipboard.c \
    67         generic/config.c \
    6867        generic/corecfg.c \
    6968        generic/devman.c \
  • uspace/lib/drv/include/pci_dev_iface.h

    rbfa4ffa r0d9b4a8  
    4040#include "ddf/driver.h"
    4141
    42 #define PCI_VENDOR_ID   0x00
    43 #define PCI_DEVICE_ID   0x02
    44 #define PCI_SUB_CLASS   0x0A
    45 #define PCI_BASE_CLASS  0x0B
     42#define PCI_VENDOR_ID  0x00
     43#define PCI_DEVICE_ID  0x02
    4644
    4745extern int pci_config_space_read_8(async_sess_t *, uint32_t, uint8_t *);
  • uspace/srv/devman/match.c

    rbfa4ffa r0d9b4a8  
    4141#include "devman.h"
    4242#include "match.h"
    43 
    44 #define COMMENT '#'
    4543
    4644/** Compute compound score of driver and device.
     
    147145                if (!skip_spaces(&buf))
    148146                        break;
    149 
    150                 if (*buf == COMMENT) {
    151                         skip_line(&buf);
    152                         continue;
    153                 }
    154147               
    155148                /* read score */
  • uspace/srv/devman/util.c

    rbfa4ffa r0d9b4a8  
    7373}
    7474
    75 void skip_line(char **buf)
    76 {
    77         while (**buf && **buf != '\n')
    78                 (*buf)++;
    79 }
    80 
    8175size_t get_nonspace_len(const char *str)
    8276{
  • uspace/srv/devman/util.h

    rbfa4ffa r0d9b4a8  
    4242
    4343extern bool skip_spaces(char **);
    44 extern void skip_line(char **);
    4544extern size_t get_nonspace_len(const char *);
    4645extern void replace_char(char *, char, char);
  • uspace/srv/hid/input/Makefile

    rbfa4ffa r0d9b4a8  
    3030USPACE_PREFIX = ../../..
    3131BINARY = input
    32 LIBS = $(LIBDRV_PREFIX)/libdrv.a
    33 EXTRA_CFLAGS = -I$(LIBDRV_PREFIX)/include
    3432
    3533SOURCES = \
     
    4341        port/msim.c \
    4442        port/niagara.c \
     43        port/ns16550.c \
    4544        port/ski.c \
    4645        proto/adb.c \
  • uspace/srv/hid/input/input.c

    rbfa4ffa r0d9b4a8  
    4242#include <ipc/services.h>
    4343#include <ipc/input.h>
    44 #include <config.h>
     44#include <sysinfo.h>
    4545#include <stdio.h>
    4646#include <unistd.h>
     
    5454#include <loc.h>
    5555#include <str_error.h>
    56 #include <char_dev_iface.h>
    57 #include <fibril.h>
    5856#include "layout.h"
    5957#include "kbd.h"
     
    6260#include "mouse.h"
    6361#include "mouse_proto.h"
    64 #include "serial.h"
    6562#include "input.h"
     63
     64bool irc_service = false;
     65async_sess_t *irc_sess = NULL;
    6666
    6767#define NUM_LAYOUTS  4
     
    9292static bool active = true;
    9393
    94 /** Serial console specified by the user */
    95 static char *serial_console;
    96 
    9794/** List of keyboard devices */
    9895static list_t kbd_devs;
     
    10097/** List of mouse devices */
    10198static list_t mouse_devs;
    102 
    103 /** List of serial devices */
    104 static list_t serial_devs;
    10599
    106100static FIBRIL_MUTEX_INITIALIZE(discovery_lock);
     
    401395        mouse_dev_t *mdev = calloc(1, sizeof(mouse_dev_t));
    402396        if (mdev == NULL) {
    403                 printf("%s: Error allocating mouse device. "
     397                printf("%s: Error allocating keyboard device. "
    404398                    "Out of memory.\n", NAME);
    405399                return NULL;
     
    409403       
    410404        return mdev;
    411 }
    412 
    413 static serial_dev_t *serial_dev_new(void)
    414 {
    415         serial_dev_t *sdev = calloc(1, sizeof(serial_dev_t));
    416         if (sdev == NULL) {
    417                 printf("%s: Error allocating serial device. "
    418                     "Out of memory.\n", NAME);
    419                 return NULL;
    420         }
    421        
    422         sdev->kdev = kbd_dev_new();
    423         if (sdev->kdev == NULL) {
    424                 free(sdev);
    425                 return NULL;
    426         }
    427 
    428         link_initialize(&sdev->link);
    429        
    430         return sdev;
    431405}
    432406
     
    558532        return -1;
    559533}
    560 
    561 static int serial_consumer(void *arg)
    562 {
    563         serial_dev_t *sdev = (serial_dev_t *) arg;
    564 
    565         while (true) {
    566                 uint8_t data;
    567 
    568                 char_dev_read(sdev->sess, &data, sizeof(data));
    569                 kbd_push_data(sdev->kdev, data);
    570         }
    571 
    572         return EOK;
    573 }
    574 
    575 /** Add new serial console device.
    576  *
    577  * @param service_id Service ID of the chardev device
    578  *
    579  */
    580 static int serial_add_srldev(service_id_t service_id, serial_dev_t **sdevp)
    581 {
    582         bool match = false;
    583 
    584         serial_dev_t *sdev = serial_dev_new();
    585         if (sdev == NULL)
    586                 return -1;
    587        
    588         sdev->kdev->svc_id = service_id;
    589        
    590         int rc = loc_service_get_name(service_id, &sdev->kdev->svc_name);
    591         if (rc != EOK)
    592                 goto fail;
    593 
    594         list_append(&sdev->link, &serial_devs);
    595 
    596         /*
    597          * Is this the device the user wants to use as a serial console?
    598          */
    599         match = (serial_console != NULL) &&
    600             !str_cmp(serial_console, sdev->kdev->svc_name);
    601 
    602         if (match) {
    603                 sdev->kdev->ctl_ops = &stty_ctl;
    604 
    605                 /* Initialize controller driver. */
    606                 if ((*sdev->kdev->ctl_ops->init)(sdev->kdev) != 0) {
    607                         list_remove(&sdev->link);
    608                         goto fail;
    609                 }
    610 
    611                 sdev->sess = loc_service_connect(service_id, INTERFACE_DDF,
    612                     IPC_FLAG_BLOCKING);
    613 
    614                 fid_t fid = fibril_create(serial_consumer, sdev);
    615                 fibril_add_ready(fid);
    616         }
    617        
    618         *sdevp = sdev;
    619         return EOK;
    620        
    621 fail:
    622         if (sdev->kdev->svc_name != NULL)
    623                 free(sdev->kdev->svc_name);
    624         free(sdev->kdev);
    625         free(sdev);
    626         return -1;
    627 }
    628 
    629534
    630535/** Add legacy drivers/devices. */
     
    650555        kbd_add_dev(&niagara_port, &stty_ctl);
    651556#endif
     557#if defined(UARCH_sparc64) && defined(MACHINE_generic)
     558        kbd_add_dev(&ns16550_port, &sun_ctl);
     559#endif
    652560        /* Silence warning on abs32le about kbd_add_dev() being unused */
    653561        (void) kbd_add_dev;
     
    770678}
    771679
    772 static int dev_check_new_serialdevs(void)
    773 {
    774         category_id_t serial_cat;
    775         service_id_t *svcs;
    776         size_t count, i;
    777         bool already_known;
     680static int dev_check_new(void)
     681{
    778682        int rc;
    779683       
    780         rc = loc_category_get_id("serial", &serial_cat, IPC_FLAG_BLOCKING);
    781         if (rc != EOK) {
    782                 printf("%s: Failed resolving category 'serial'.\n", NAME);
    783                 return ENOENT;
    784         }
    785        
    786         /*
    787          * Check for new serial devices
    788          */
    789         rc = loc_category_get_svcs(serial_cat, &svcs, &count);
    790         if (rc != EOK) {
    791                 printf("%s: Failed getting list of serial devices.\n",
    792                     NAME);
    793                 return EIO;
    794         }
    795 
    796         for (i = 0; i < count; i++) {
    797                 already_known = false;
    798                
    799                 /* Determine whether we already know this device. */
    800                 list_foreach(serial_devs, link, serial_dev_t, sdev) {
    801                         if (sdev->kdev->svc_id == svcs[i]) {
    802                                 already_known = true;
    803                                 break;
    804                         }
    805                 }
    806                
    807                 if (!already_known) {
    808                         serial_dev_t *sdev;
    809                         if (serial_add_srldev(svcs[i], &sdev) == EOK) {
    810                                 printf("%s: Connected serial device '%s'\n",
    811                                     NAME, sdev->kdev->svc_name);
    812                         }
    813                 }
    814         }
    815        
    816         free(svcs);
    817        
    818         /* XXX Handle device removal */
    819        
    820         return EOK;
    821 }
    822 
    823 static int dev_check_new(void)
    824 {
    825         int rc;
    826        
    827684        fibril_mutex_lock(&discovery_lock);
    828685       
    829         if (!serial_console) {
    830                 rc = dev_check_new_kbdevs();
    831                 if (rc != EOK) {
    832                         fibril_mutex_unlock(&discovery_lock);
    833                         return rc;
    834                 }
    835        
    836                 rc = dev_check_new_mousedevs();
    837                 if (rc != EOK) {
    838                         fibril_mutex_unlock(&discovery_lock);
    839                         return rc;
    840                 }
    841         } else {
    842                 rc = dev_check_new_serialdevs();
    843                 if (rc != EOK) {
    844                         fibril_mutex_unlock(&discovery_lock);
    845                         return rc;
    846                 }
     686        rc = dev_check_new_kbdevs();
     687        if (rc != EOK) {
     688                fibril_mutex_unlock(&discovery_lock);
     689                return rc;
     690        }
     691       
     692        rc = dev_check_new_mousedevs();
     693        if (rc != EOK) {
     694                fibril_mutex_unlock(&discovery_lock);
     695                return rc;
    847696        }
    848697       
     
    877726int main(int argc, char **argv)
    878727{
    879         int rc;
    880 
    881728        if (argc < 2) {
    882729                usage(argv[0]);
     
    886733        printf("%s: HelenOS input service\n", NAME);
    887734       
     735        sysarg_t obio;
     736       
    888737        list_initialize(&clients);
    889738        list_initialize(&kbd_devs);
    890739        list_initialize(&mouse_devs);
    891         list_initialize(&serial_devs);
    892        
    893         serial_console = config_get_value("console");
     740       
     741        if ((sysinfo_get_value("kbd.cir.obio", &obio) == EOK) && (obio))
     742                irc_service = true;
     743       
     744        if (irc_service) {
     745                while (irc_sess == NULL)
     746                        irc_sess = service_connect_blocking(SERVICE_IRC,
     747                            INTERFACE_IRC, 0);
     748        }
    894749       
    895750        /* Add legacy keyboard devices. */
     
    904759        async_set_fallback_port_handler(client_connection, NULL);
    905760       
    906         rc = loc_server_register(NAME);
     761        int rc = loc_server_register(NAME);
    907762        if (rc != EOK) {
    908763                printf("%s: Unable to register server\n", NAME);
  • uspace/srv/hid/output/Makefile

    rbfa4ffa r0d9b4a8  
    3030USPACE_PREFIX = ../../..
    3131BINARY = output
    32 LIBS = $(LIBDRV_PREFIX)/libdrv.a
    33 EXTRA_CFLAGS = -I$(LIBDRV_PREFIX)/include
    3432
    3533SOURCES = \
     
    3937        port/niagara.c \
    4038        port/ski.c \
    41         port/chardev.c \
    4239        proto/vt100.c \
    4340        output.c
  • uspace/srv/hid/output/output.c

    rbfa4ffa r0d9b4a8  
    3434#include <task.h>
    3535#include <ipc/output.h>
    36 #include <config.h>
    3736#include "port/ega.h"
    3837#include "port/kchar.h"
    3938#include "port/niagara.h"
    4039#include "port/ski.h"
    41 #include "port/chardev.h"
    4240#include "output.h"
    4341
     
    403401               
    404402                switch (IPC_GET_IMETHOD(call)) {
    405                 case OUTPUT_YIELD:
    406                         srv_yield(callid, &call);
    407                         break;
    408                 case OUTPUT_CLAIM:
    409                         srv_claim(callid, &call);
    410                         break;
    411                 case OUTPUT_GET_DIMENSIONS:
    412                         srv_get_dimensions(callid, &call);
    413                         break;
    414                 case OUTPUT_GET_CAPS:
    415                         srv_get_caps(callid, &call);
    416                         break;
    417                
    418                 case OUTPUT_FRONTBUF_CREATE:
    419                         srv_frontbuf_create(callid, &call);
    420                         break;
    421                 case OUTPUT_FRONTBUF_DESTROY:
    422                         srv_frontbuf_destroy(callid, &call);
    423                         break;
    424                        
    425                 case OUTPUT_CURSOR_UPDATE:
    426                         srv_cursor_update(callid, &call);
    427                         break;
    428                 case OUTPUT_SET_STYLE:
    429                         srv_set_style(callid, &call);
    430                         break;
    431                 case OUTPUT_SET_COLOR:
    432                         srv_set_color(callid, &call);
    433                         break;
    434                 case OUTPUT_SET_RGB_COLOR:
    435                         srv_set_rgb_color(callid, &call);
    436                         break;
    437                 case OUTPUT_UPDATE:
    438                         srv_update(callid, &call);
    439                         break;
    440                 case OUTPUT_DAMAGE:
    441                         srv_damage(callid, &call);
    442                         break;
    443                        
    444                 default:
    445                         async_answer_0(callid, EINVAL);
     403                        case OUTPUT_YIELD:
     404                                srv_yield(callid, &call);
     405                                break;
     406                        case OUTPUT_CLAIM:
     407                                srv_claim(callid, &call);
     408                                break;
     409                        case OUTPUT_GET_DIMENSIONS:
     410                                srv_get_dimensions(callid, &call);
     411                                break;
     412                        case OUTPUT_GET_CAPS:
     413                                srv_get_caps(callid, &call);
     414                                break;
     415                       
     416                        case OUTPUT_FRONTBUF_CREATE:
     417                                srv_frontbuf_create(callid, &call);
     418                                break;
     419                        case OUTPUT_FRONTBUF_DESTROY:
     420                                srv_frontbuf_destroy(callid, &call);
     421                                break;
     422                       
     423                        case OUTPUT_CURSOR_UPDATE:
     424                                srv_cursor_update(callid, &call);
     425                                break;
     426                        case OUTPUT_SET_STYLE:
     427                                srv_set_style(callid, &call);
     428                                break;
     429                        case OUTPUT_SET_COLOR:
     430                                srv_set_color(callid, &call);
     431                                break;
     432                        case OUTPUT_SET_RGB_COLOR:
     433                                srv_set_rgb_color(callid, &call);
     434                                break;
     435                        case OUTPUT_UPDATE:
     436                                srv_update(callid, &call);
     437                                break;
     438                        case OUTPUT_DAMAGE:
     439                                srv_damage(callid, &call);
     440                                break;
     441                       
     442                        default:
     443                                async_answer_0(callid, EINVAL);
    446444                }
    447445        }
     
    477475        }
    478476       
    479         if (!config_key_exists("console")) {
    480                 ega_init();
    481                 kchar_init();
    482                 niagara_init();
    483                 ski_init();
    484         } else {
    485                 chardev_init();
    486         }
     477        ega_init();
     478        kchar_init();
     479        niagara_init();
     480        ski_init();
    487481       
    488482        printf("%s: Accepting connections\n", NAME);
  • uspace/srv/hid/output/proto/vt100.c

    rbfa4ffa r0d9b4a8  
    141141    vt100_putchar_t putchar_fn, vt100_control_puts_t control_puts_fn)
    142142{
    143         vt100_state_t *state = malloc(sizeof(vt100_state_t));
     143        vt100_state_t *state =
     144            malloc(sizeof(vt100_state_t));
    144145        if (state == NULL)
    145146                return NULL;
     
    163164        state->control_puts("\033[2J");
    164165        state->control_puts("\033[?25l");
    165 
     166       
    166167        return state;
    167168}
  • uspace/srv/hw/irc/obio/obio.c

    rbfa4ffa r0d9b4a8  
    4545#include <ipc/irc.h>
    4646#include <ns.h>
     47#include <sysinfo.h>
    4748#include <as.h>
    4849#include <ddi.h>
     
    9394                switch (IPC_GET_IMETHOD(call)) {
    9495                case IRC_ENABLE_INTERRUPT:
    95                         inr = IPC_GET_ARG1(call);
    96                         base_virt[OBIO_IMR(inr & INO_MASK)] |= (1UL << 31);
     96                        /* Noop */
    9797                        async_answer_0(callid, EOK);
    9898                        break;
     
    111111/** Initialize the OBIO driver.
    112112 *
    113  * In the future, the OBIO driver should be integrated with the sun4u platform driver.
     113 * So far, the driver heavily depends on information provided by the kernel via
     114 * sysinfo. In the future, there should be a standalone OBIO driver.
    114115 */
    115116static bool obio_init(void)
    116117{
    117         base_phys = (uintptr_t) 0x1fe00000000ULL;
     118        sysarg_t paddr;
     119       
     120        if (sysinfo_get_value("obio.base.physical", &paddr) != EOK) {
     121                printf("%s: No OBIO registers found\n", NAME);
     122                return false;
     123        }
     124       
     125        base_phys = (uintptr_t) paddr;
    118126       
    119127        int flags = AS_AREA_READ | AS_AREA_WRITE;
     
    127135        }
    128136       
    129         printf("%s: OBIO registers with base at %lx\n", NAME, base_phys);
     137        printf("%s: OBIO registers with base at %zu\n", NAME, base_phys);
    130138       
    131139        async_set_fallback_port_handler(obio_connection, NULL);
Note: See TracChangeset for help on using the changeset viewer.