Changes in / [bfa4ffa:0d9b4a8] in mainline
- Files:
-
- 1 added
- 9 deleted
- 26 edited
-
boot/Makefile (modified) (1 diff)
-
boot/arch/sparc64/Makefile.inc (modified) (1 diff)
-
kernel/arch/sparc64/src/drivers/pci.c (modified) (2 diffs)
-
kernel/arch/sparc64/src/sparc64.c (modified) (2 diffs)
-
kernel/genarch/src/multiboot/multiboot.c (modified) (2 diffs)
-
kernel/generic/include/config.h (modified) (2 diffs)
-
kernel/generic/src/main/main.c (modified) (2 diffs)
-
tools/ew.py (modified) (2 diffs)
-
uspace/Makefile (modified) (1 diff)
-
uspace/app/init/init.c (modified) (3 diffs)
-
uspace/drv/bus/isa/ebus.dev (deleted)
-
uspace/drv/bus/isa/isa.c (modified) (4 diffs)
-
uspace/drv/bus/isa/isa.ma (modified) (1 diff)
-
uspace/drv/bus/pci/pciintel/pci.c (modified) (7 diffs)
-
uspace/drv/bus/pci/pciintel/pci.h (modified) (1 diff)
-
uspace/drv/char/ns8250/ns8250.c (modified) (6 diffs)
-
uspace/drv/platform/sun4u/Makefile (deleted)
-
uspace/drv/platform/sun4u/sun4u.c (deleted)
-
uspace/drv/platform/sun4u/sun4u.ma (deleted)
-
uspace/lib/c/Makefile (modified) (1 diff)
-
uspace/lib/c/generic/config.c (deleted)
-
uspace/lib/c/include/config.h (deleted)
-
uspace/lib/drv/include/pci_dev_iface.h (modified) (1 diff)
-
uspace/srv/devman/match.c (modified) (2 diffs)
-
uspace/srv/devman/util.c (modified) (1 diff)
-
uspace/srv/devman/util.h (modified) (1 diff)
-
uspace/srv/hid/input/Makefile (modified) (2 diffs)
-
uspace/srv/hid/input/input.c (modified) (13 diffs)
-
uspace/srv/hid/input/port/ns16550.c (added)
-
uspace/srv/hid/input/serial.h (deleted)
-
uspace/srv/hid/output/Makefile (modified) (2 diffs)
-
uspace/srv/hid/output/output.c (modified) (3 diffs)
-
uspace/srv/hid/output/port/chardev.c (deleted)
-
uspace/srv/hid/output/port/chardev.h (deleted)
-
uspace/srv/hid/output/proto/vt100.c (modified) (2 diffs)
-
uspace/srv/hw/irc/obio/obio.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile
rbfa4ffa r0d9b4a8 113 113 file_dir="`dirname "$$file"`" ; \ 114 114 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/" ; \ 116 116 done 117 117 for file in $(RD_DRVS_FW) ; do \ -
boot/arch/sparc64/Makefile.inc
rbfa4ffa r0d9b4a8 39 39 EXTRA_CFLAGS = -mcpu=ultrasparc -m64 -mno-fpu -mcmodel=medlow 40 40 41 RD_DRVS_ESSENTIAL += \42 platform/sun4u \43 bus/pci/pciintel \44 bus/isa \45 char/ns825046 47 RD_DRV_CFG += \48 bus/isa49 50 41 RD_SRVS_NON_ESSENTIAL += 51 42 -
kernel/arch/sparc64/src/drivers/pci.c
rbfa4ffa r0d9b4a8 112 112 PAGE_WRITE | PAGE_NOT_CACHEABLE); 113 113 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 114 120 return pci; 115 121 } … … 153 159 pci->reg = (uint64_t *) km_map(paddr, reg[PSYCHO_INTERNAL_REG].size, 154 160 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); 155 167 156 168 return pci; -
kernel/arch/sparc64/src/sparc64.c
rbfa4ffa r0d9b4a8 36 36 #include <arch/arch.h> 37 37 #include <mm/slab.h> 38 #include <sysinfo/sysinfo.h>39 38 #include <config.h> 40 39 #include <arch/proc/thread.h> … … 74 73 uwb_cache = slab_cache_create("uwb_cache", UWB_SIZE, 75 74 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 }88 75 } 89 76 } -
kernel/genarch/src/multiboot/multiboot.c
rbfa4ffa r0d9b4a8 100 100 } 101 101 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 123 102 static void multiboot_modules(uint32_t count, multiboot_module_t *mods) 124 103 { … … 174 153 if (signature != MULTIBOOT_LOADER_MAGIC) 175 154 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 181 156 /* Copy modules information. */ 182 157 if ((info->flags & MULTIBOOT_INFO_FLAGS_MODS) != 0) -
kernel/generic/include/config.h
rbfa4ffa r0d9b4a8 43 43 44 44 #define STACK_SIZE_USER (1 * 1024 * 1024) 45 46 #define CONFIG_BOOT_ARGUMENTS_BUFLEN 25647 45 48 46 #define CONFIG_INIT_TASKS 32 … … 104 102 105 103 extern config_t config; 106 extern char bargs[];107 104 extern init_t init; 108 105 extern ballocs_t ballocs; -
kernel/generic/src/main/main.c
rbfa4ffa r0d9b4a8 117 117 }; 118 118 119 /** Boot arguments. */120 char bargs[CONFIG_BOOT_ARGUMENTS_BUFLEN] = {};121 122 119 /** Initial user-space tasks */ 123 120 init_t init = { … … 279 276 thread_init(); 280 277 futex_init(); 281 282 sysinfo_set_item_data("boot_args", NULL, bargs, str_size(bargs) + 1); 283 278 284 279 if (init.cnt > 0) { 285 280 size_t i; -
tools/ew.py
rbfa4ffa r0d9b4a8 95 95 return 'system-ppc', '-m 256' 96 96 elif platform == 'sparc64': 97 return 'system-sparc64', ' --prom-env boot-args="console=devices/\\hw\\pci0\\00:03.0\\com1\\a"'97 return 'system-sparc64', '' 98 98 99 99 def hdisk_mk(): … … 266 266 'run' : qemu_run, 267 267 'image' : 'image.iso', 268 'audio' : False, 269 'console' : False, 268 'audio' : False 270 269 }, 271 270 'sun4v' : { -
uspace/Makefile
rbfa4ffa r0d9b4a8 202 202 DIRS += \ 203 203 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/ns8250210 endif211 204 endif 212 205 -
uspace/app/init/init.c
rbfa4ffa r0d9b4a8 49 49 #include <loc.h> 50 50 #include <str_error.h> 51 #include <config.h>52 51 #include "init.h" 53 52 … … 307 306 int main(int argc, char *argv[]) 308 307 { 309 int rc;310 311 308 info_print(); 312 309 … … 359 356 srv_start("/srv/hound"); 360 357 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); 368 363 } 369 364 -
uspace/drv/bus/isa/isa.c
rbfa4ffa r0d9b4a8 66 66 #include <device/pio_window.h> 67 67 68 #include <pci_dev_iface.h>69 70 68 #include "i8237.h" 71 69 72 70 #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" 75 72 76 73 #define ISA_MAX_HW_RES 5 … … 78 75 typedef struct { 79 76 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;84 77 ddf_dev_t *dev; 85 78 ddf_fun_t *fctl; … … 600 593 static void isa_functions_add(isa_bus_t *isa) 601 594 { 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); 619 596 while (conf != NULL && *conf != '\0') { 620 597 conf = isa_fun_read_info(conf, isa); … … 646 623 } 647 624 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 661 625 rc = pio_window_get(sess, &isa->pio_win); 662 626 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 1 9 pci/class=06&subclass=01 -
uspace/drv/bus/pci/pciintel/pci.c
rbfa4ffa r0d9b4a8 63 63 #define NAME "pciintel" 64 64 65 #define CONF_ADDR_ENABLE (1 << 31)66 65 #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)) 68 67 69 68 /** Obtain PCI function soft-state from DDF function node */ … … 233 232 fibril_mutex_lock(&bus->conf_mutex); 234 233 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)); 249 242 250 243 switch (len) { … … 267 260 const uint32_t conf_addr = CONF_ADDR(fun->bus, fun->dev, fun->fn, reg); 268 261 pci_bus_t *bus = pci_bus_from_fun(fun); 269 uint32_t val ;262 uint32_t val = 0; // Prevent -Werror=maybe-uninitialized 270 263 271 264 fibril_mutex_lock(&bus->conf_mutex); … … 282 275 * missing bits first. 283 276 */ 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)); 292 279 } 293 280 … … 306 293 } 307 294 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)); 316 297 317 298 fibril_mutex_unlock(&bus->conf_mutex); … … 639 620 ddf_msg(LVL_DEBUG, "Adding new function %s.", 640 621 ddf_fun_get_name(fun->fnode)); 641 622 642 623 pci_fun_create_match_ids(fun); 643 624 … … 707 688 708 689 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; 754 713 } 755 714 -
uspace/drv/bus/pci/pciintel/pci.h
rbfa4ffa r0d9b4a8 47 47 ioport32_t *conf_addr_reg; 48 48 ioport32_t *conf_data_reg; 49 ioport32_t *conf_space;50 49 pio_window_t pio_win; 51 50 fibril_mutex_t conf_mutex; -
uspace/drv/char/ns8250/ns8250.c
rbfa4ffa r0d9b4a8 163 163 int irq; 164 164 /** The base i/o address of the devices registers. */ 165 uint ptr_t io_addr;165 uint32_t io_addr; 166 166 /** The i/o port used to access the serial ports registers. */ 167 167 ioport8_t *port; … … 330 330 331 331 /* 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, 333 333 (void **) &ns->port)) { 334 ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIx n334 ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIx32 335 335 " for device %s.", ns->io_addr, ddf_dev_get_name(ns->dev)); 336 336 return false; … … 432 432 ioport = true; 433 433 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); 435 435 break; 436 436 … … 771 771 { 772 772 ns8250_t *ns = dev_ns8250(dev); 773 773 774 uint8_t iir = pio_read_8(&ns->regs->iid); 774 775 if ((iir & NS8250_IID_CAUSE_MASK) == NS8250_IID_CAUSE_RXSTATUS) { … … 780 781 781 782 ns8250_read_from_device(ns); 782 irc_disable_interrupt(ns->irq);783 783 } 784 784 … … 857 857 } 858 858 need_unreg_intr_handler = true; 859 859 860 860 /* Enable interrupt. */ 861 861 rc = ns8250_interrupt_enable(ns); -
uspace/lib/c/Makefile
rbfa4ffa r0d9b4a8 65 65 generic/cap.c \ 66 66 generic/clipboard.c \ 67 generic/config.c \68 67 generic/corecfg.c \ 69 68 generic/devman.c \ -
uspace/lib/drv/include/pci_dev_iface.h
rbfa4ffa r0d9b4a8 40 40 #include "ddf/driver.h" 41 41 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 46 44 47 45 extern int pci_config_space_read_8(async_sess_t *, uint32_t, uint8_t *); -
uspace/srv/devman/match.c
rbfa4ffa r0d9b4a8 41 41 #include "devman.h" 42 42 #include "match.h" 43 44 #define COMMENT '#'45 43 46 44 /** Compute compound score of driver and device. … … 147 145 if (!skip_spaces(&buf)) 148 146 break; 149 150 if (*buf == COMMENT) {151 skip_line(&buf);152 continue;153 }154 147 155 148 /* read score */ -
uspace/srv/devman/util.c
rbfa4ffa r0d9b4a8 73 73 } 74 74 75 void skip_line(char **buf)76 {77 while (**buf && **buf != '\n')78 (*buf)++;79 }80 81 75 size_t get_nonspace_len(const char *str) 82 76 { -
uspace/srv/devman/util.h
rbfa4ffa r0d9b4a8 42 42 43 43 extern bool skip_spaces(char **); 44 extern void skip_line(char **);45 44 extern size_t get_nonspace_len(const char *); 46 45 extern void replace_char(char *, char, char); -
uspace/srv/hid/input/Makefile
rbfa4ffa r0d9b4a8 30 30 USPACE_PREFIX = ../../.. 31 31 BINARY = input 32 LIBS = $(LIBDRV_PREFIX)/libdrv.a33 EXTRA_CFLAGS = -I$(LIBDRV_PREFIX)/include34 32 35 33 SOURCES = \ … … 43 41 port/msim.c \ 44 42 port/niagara.c \ 43 port/ns16550.c \ 45 44 port/ski.c \ 46 45 proto/adb.c \ -
uspace/srv/hid/input/input.c
rbfa4ffa r0d9b4a8 42 42 #include <ipc/services.h> 43 43 #include <ipc/input.h> 44 #include < config.h>44 #include <sysinfo.h> 45 45 #include <stdio.h> 46 46 #include <unistd.h> … … 54 54 #include <loc.h> 55 55 #include <str_error.h> 56 #include <char_dev_iface.h>57 #include <fibril.h>58 56 #include "layout.h" 59 57 #include "kbd.h" … … 62 60 #include "mouse.h" 63 61 #include "mouse_proto.h" 64 #include "serial.h"65 62 #include "input.h" 63 64 bool irc_service = false; 65 async_sess_t *irc_sess = NULL; 66 66 67 67 #define NUM_LAYOUTS 4 … … 92 92 static bool active = true; 93 93 94 /** Serial console specified by the user */95 static char *serial_console;96 97 94 /** List of keyboard devices */ 98 95 static list_t kbd_devs; … … 100 97 /** List of mouse devices */ 101 98 static list_t mouse_devs; 102 103 /** List of serial devices */104 static list_t serial_devs;105 99 106 100 static FIBRIL_MUTEX_INITIALIZE(discovery_lock); … … 401 395 mouse_dev_t *mdev = calloc(1, sizeof(mouse_dev_t)); 402 396 if (mdev == NULL) { 403 printf("%s: Error allocating mousedevice. "397 printf("%s: Error allocating keyboard device. " 404 398 "Out of memory.\n", NAME); 405 399 return NULL; … … 409 403 410 404 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;431 405 } 432 406 … … 558 532 return -1; 559 533 } 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 device578 *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 629 534 630 535 /** Add legacy drivers/devices. */ … … 650 555 kbd_add_dev(&niagara_port, &stty_ctl); 651 556 #endif 557 #if defined(UARCH_sparc64) && defined(MACHINE_generic) 558 kbd_add_dev(&ns16550_port, &sun_ctl); 559 #endif 652 560 /* Silence warning on abs32le about kbd_add_dev() being unused */ 653 561 (void) kbd_add_dev; … … 770 678 } 771 679 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; 680 static int dev_check_new(void) 681 { 778 682 int rc; 779 683 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 devices788 */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 827 684 fibril_mutex_lock(&discovery_lock); 828 685 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; 847 696 } 848 697 … … 877 726 int main(int argc, char **argv) 878 727 { 879 int rc;880 881 728 if (argc < 2) { 882 729 usage(argv[0]); … … 886 733 printf("%s: HelenOS input service\n", NAME); 887 734 735 sysarg_t obio; 736 888 737 list_initialize(&clients); 889 738 list_initialize(&kbd_devs); 890 739 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 } 894 749 895 750 /* Add legacy keyboard devices. */ … … 904 759 async_set_fallback_port_handler(client_connection, NULL); 905 760 906 rc = loc_server_register(NAME);761 int rc = loc_server_register(NAME); 907 762 if (rc != EOK) { 908 763 printf("%s: Unable to register server\n", NAME); -
uspace/srv/hid/output/Makefile
rbfa4ffa r0d9b4a8 30 30 USPACE_PREFIX = ../../.. 31 31 BINARY = output 32 LIBS = $(LIBDRV_PREFIX)/libdrv.a33 EXTRA_CFLAGS = -I$(LIBDRV_PREFIX)/include34 32 35 33 SOURCES = \ … … 39 37 port/niagara.c \ 40 38 port/ski.c \ 41 port/chardev.c \42 39 proto/vt100.c \ 43 40 output.c -
uspace/srv/hid/output/output.c
rbfa4ffa r0d9b4a8 34 34 #include <task.h> 35 35 #include <ipc/output.h> 36 #include <config.h>37 36 #include "port/ega.h" 38 37 #include "port/kchar.h" 39 38 #include "port/niagara.h" 40 39 #include "port/ski.h" 41 #include "port/chardev.h"42 40 #include "output.h" 43 41 … … 403 401 404 402 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); 446 444 } 447 445 } … … 477 475 } 478 476 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(); 487 481 488 482 printf("%s: Accepting connections\n", NAME); -
uspace/srv/hid/output/proto/vt100.c
rbfa4ffa r0d9b4a8 141 141 vt100_putchar_t putchar_fn, vt100_control_puts_t control_puts_fn) 142 142 { 143 vt100_state_t *state = malloc(sizeof(vt100_state_t)); 143 vt100_state_t *state = 144 malloc(sizeof(vt100_state_t)); 144 145 if (state == NULL) 145 146 return NULL; … … 163 164 state->control_puts("\033[2J"); 164 165 state->control_puts("\033[?25l"); 165 166 166 167 return state; 167 168 } -
uspace/srv/hw/irc/obio/obio.c
rbfa4ffa r0d9b4a8 45 45 #include <ipc/irc.h> 46 46 #include <ns.h> 47 #include <sysinfo.h> 47 48 #include <as.h> 48 49 #include <ddi.h> … … 93 94 switch (IPC_GET_IMETHOD(call)) { 94 95 case IRC_ENABLE_INTERRUPT: 95 inr = IPC_GET_ARG1(call); 96 base_virt[OBIO_IMR(inr & INO_MASK)] |= (1UL << 31); 96 /* Noop */ 97 97 async_answer_0(callid, EOK); 98 98 break; … … 111 111 /** Initialize the OBIO driver. 112 112 * 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. 114 115 */ 115 116 static bool obio_init(void) 116 117 { 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; 118 126 119 127 int flags = AS_AREA_READ | AS_AREA_WRITE; … … 127 135 } 128 136 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); 130 138 131 139 async_set_fallback_port_handler(obio_connection, NULL);
Note:
See TracChangeset
for help on using the changeset viewer.
