Changeset bfa4ffa in mainline
- Timestamp:
- 2016-12-27T13:34:08Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9185e42
- Parents:
- 0d9b4a8 (diff), 73d8600 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Files:
-
- 9 added
- 1 deleted
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
boot/Makefile
r0d9b4a8 rbfa4ffa 113 113 file_dir="`dirname "$$file"`" ; \ 114 114 file_name="`basename "$$file"`" ; \ 115 cp "$(USPACE_PATH)/$(DRVS_PATH)/$$file_dir/$$file_name/ $$file_name.dev" "$(DIST_PATH)/$(DRVS_PATH)/$$file_name/" ; \115 cp "$(USPACE_PATH)/$(DRVS_PATH)/$$file_dir/$$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
r0d9b4a8 rbfa4ffa 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/ns8250 46 47 RD_DRV_CFG += \ 48 bus/isa 49 41 50 RD_SRVS_NON_ESSENTIAL += 42 51 -
kernel/arch/sparc64/src/drivers/pci.c
r0d9b4a8 rbfa4ffa 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 120 114 return pci; 121 115 } … … 159 153 pci->reg = (uint64_t *) km_map(paddr, reg[PSYCHO_INTERNAL_REG].size, 160 154 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);167 155 168 156 return pci; -
kernel/arch/sparc64/src/sparc64.c
r0d9b4a8 rbfa4ffa 36 36 #include <arch/arch.h> 37 37 #include <mm/slab.h> 38 #include <sysinfo/sysinfo.h> 38 39 #include <config.h> 39 40 #include <arch/proc/thread.h> … … 73 74 uwb_cache = slab_cache_create("uwb_cache", UWB_SIZE, 74 75 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 } 75 88 } 76 89 } -
kernel/genarch/src/multiboot/multiboot.c
r0d9b4a8 rbfa4ffa 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 102 123 static void multiboot_modules(uint32_t count, multiboot_module_t *mods) 103 124 { … … 153 174 if (signature != MULTIBOOT_LOADER_MAGIC) 154 175 return; 155 176 177 /* Copy command line. */ 178 if ((info->flags & MULTIBOOT_INFO_FLAGS_CMDLINE) != 0) 179 multiboot_cmdline((char *) MULTIBOOT_PTR(info->cmd_line)); 180 156 181 /* Copy modules information. */ 157 182 if ((info->flags & MULTIBOOT_INFO_FLAGS_MODS) != 0) -
kernel/generic/include/config.h
r0d9b4a8 rbfa4ffa 43 43 44 44 #define STACK_SIZE_USER (1 * 1024 * 1024) 45 46 #define CONFIG_BOOT_ARGUMENTS_BUFLEN 256 45 47 46 48 #define CONFIG_INIT_TASKS 32 … … 102 104 103 105 extern config_t config; 106 extern char bargs[]; 104 107 extern init_t init; 105 108 extern ballocs_t ballocs; -
kernel/generic/src/main/main.c
r0d9b4a8 rbfa4ffa 117 117 }; 118 118 119 /** Boot arguments. */ 120 char bargs[CONFIG_BOOT_ARGUMENTS_BUFLEN] = {}; 121 119 122 /** Initial user-space tasks */ 120 123 init_t init = { … … 276 279 thread_init(); 277 280 futex_init(); 278 281 282 sysinfo_set_item_data("boot_args", NULL, bargs, str_size(bargs) + 1); 283 279 284 if (init.cnt > 0) { 280 285 size_t i; -
tools/ew.py
r0d9b4a8 rbfa4ffa 95 95 return 'system-ppc', '-m 256' 96 96 elif platform == 'sparc64': 97 return 'system-sparc64', ' '97 return 'system-sparc64', '--prom-env boot-args="console=devices/\\hw\\pci0\\00:03.0\\com1\\a"' 98 98 99 99 def hdisk_mk(): … … 266 266 'run' : qemu_run, 267 267 'image' : 'image.iso', 268 'audio' : False 268 'audio' : False, 269 'console' : False, 269 270 }, 270 271 'sun4v' : { -
uspace/Makefile
r0d9b4a8 rbfa4ffa 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/ns8250 210 endif 204 211 endif 205 212 -
uspace/app/init/init.c
r0d9b4a8 rbfa4ffa 49 49 #include <loc.h> 50 50 #include <str_error.h> 51 #include <config.h> 51 52 #include "init.h" 52 53 … … 306 307 int main(int argc, char *argv[]) 307 308 { 309 int rc; 310 308 311 info_print(); 309 312 … … 356 359 srv_start("/srv/hound"); 357 360 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); 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 } 363 368 } 364 369 -
uspace/drv/bus/isa/isa.c
r0d9b4a8 rbfa4ffa 66 66 #include <device/pio_window.h> 67 67 68 #include <pci_dev_iface.h> 69 68 70 #include "i8237.h" 69 71 70 72 #define NAME "isa" 71 #define CHILD_FUN_CONF_PATH "/drv/isa/isa.dev" 73 #define ISA_CHILD_FUN_CONF_PATH "/drv/isa/isa.dev" 74 #define EBUS_CHILD_FUN_CONF_PATH "/drv/isa/ebus.dev" 72 75 73 76 #define ISA_MAX_HW_RES 5 … … 75 78 typedef struct { 76 79 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; 77 84 ddf_dev_t *dev; 78 85 ddf_fun_t *fctl; … … 593 600 static void isa_functions_add(isa_bus_t *isa) 594 601 { 595 char *conf = fun_conf_read(CHILD_FUN_CONF_PATH); 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); 596 619 while (conf != NULL && *conf != '\0') { 597 620 conf = isa_fun_read_info(conf, isa); … … 623 646 } 624 647 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 625 661 rc = pio_window_get(sess, &isa->pio_win); 626 662 if (rc != EOK) { -
uspace/drv/bus/isa/isa.ma
r0d9b4a8 rbfa4ffa 1 9 pci/class=06&subclass=01 1 # ISA bridge 2 10 pci/class=06&subclass=01 3 4 # EBUS 5 1 pci/ven=108e&dev=1000 -
uspace/drv/bus/pci/pciintel/pci.c
r0d9b4a8 rbfa4ffa 63 63 #define NAME "pciintel" 64 64 65 #define CONF_ADDR_ENABLE (1 << 31) 65 66 #define CONF_ADDR(bus, dev, fn, reg) \ 66 (( 1 << 31) | (bus << 16) | (dev << 11) | (fn << 8) | (reg & ~3))67 ((bus << 16) | (dev << 11) | (fn << 8) | (reg & ~3)) 67 68 68 69 /** Obtain PCI function soft-state from DDF function node */ … … 232 233 fibril_mutex_lock(&bus->conf_mutex); 233 234 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)); 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 } 242 249 243 250 switch (len) { … … 260 267 const uint32_t conf_addr = CONF_ADDR(fun->bus, fun->dev, fun->fn, reg); 261 268 pci_bus_t *bus = pci_bus_from_fun(fun); 262 uint32_t val = 0; // Prevent -Werror=maybe-uninitialized269 uint32_t val; 263 270 264 271 fibril_mutex_lock(&bus->conf_mutex); … … 275 282 * missing bits first. 276 283 */ 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)); 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 } 279 292 } 280 293 … … 293 306 } 294 307 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)); 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 } 297 316 298 317 fibril_mutex_unlock(&bus->conf_mutex); … … 620 639 ddf_msg(LVL_DEBUG, "Adding new function %s.", 621 640 ddf_fun_get_name(fun->fnode)); 622 641 623 642 pci_fun_create_match_ids(fun); 624 643 … … 688 707 689 708 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; 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 } 713 754 } 714 755 -
uspace/drv/bus/pci/pciintel/pci.h
r0d9b4a8 rbfa4ffa 47 47 ioport32_t *conf_addr_reg; 48 48 ioport32_t *conf_data_reg; 49 ioport32_t *conf_space; 49 50 pio_window_t pio_win; 50 51 fibril_mutex_t conf_mutex; -
uspace/drv/char/ns8250/ns8250.c
r0d9b4a8 rbfa4ffa 163 163 int irq; 164 164 /** The base i/o address of the devices registers. */ 165 uint 32_t io_addr;165 uintptr_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 *) (uintptr_t)ns->io_addr, REG_COUNT,332 if (pio_enable((void *) ns->io_addr, REG_COUNT, 333 333 (void **) &ns->port)) { 334 ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIx 32334 ddf_msg(LVL_ERROR, "Cannot map the port %#" PRIxn 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% x.", ddf_dev_get_name(ns->dev), ns->io_addr);434 "0x%#" PRIxn ".", 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 774 773 uint8_t iir = pio_read_8(&ns->regs->iid); 775 774 if ((iir & NS8250_IID_CAUSE_MASK) == NS8250_IID_CAUSE_RXSTATUS) { … … 781 780 782 781 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
r0d9b4a8 rbfa4ffa 65 65 generic/cap.c \ 66 66 generic/clipboard.c \ 67 generic/config.c \ 67 68 generic/corecfg.c \ 68 69 generic/devman.c \ -
uspace/lib/drv/include/pci_dev_iface.h
r0d9b4a8 rbfa4ffa 40 40 #include "ddf/driver.h" 41 41 42 #define PCI_VENDOR_ID 0x00 43 #define PCI_DEVICE_ID 0x02 42 #define PCI_VENDOR_ID 0x00 43 #define PCI_DEVICE_ID 0x02 44 #define PCI_SUB_CLASS 0x0A 45 #define PCI_BASE_CLASS 0x0B 44 46 45 47 extern int pci_config_space_read_8(async_sess_t *, uint32_t, uint8_t *); -
uspace/srv/devman/match.c
r0d9b4a8 rbfa4ffa 41 41 #include "devman.h" 42 42 #include "match.h" 43 44 #define COMMENT '#' 43 45 44 46 /** Compute compound score of driver and device. … … 145 147 if (!skip_spaces(&buf)) 146 148 break; 149 150 if (*buf == COMMENT) { 151 skip_line(&buf); 152 continue; 153 } 147 154 148 155 /* read score */ -
uspace/srv/devman/util.c
r0d9b4a8 rbfa4ffa 73 73 } 74 74 75 void skip_line(char **buf) 76 { 77 while (**buf && **buf != '\n') 78 (*buf)++; 79 } 80 75 81 size_t get_nonspace_len(const char *str) 76 82 { -
uspace/srv/devman/util.h
r0d9b4a8 rbfa4ffa 42 42 43 43 extern bool skip_spaces(char **); 44 extern void skip_line(char **); 44 45 extern size_t get_nonspace_len(const char *); 45 46 extern void replace_char(char *, char, char); -
uspace/srv/hid/input/Makefile
r0d9b4a8 rbfa4ffa 30 30 USPACE_PREFIX = ../../.. 31 31 BINARY = input 32 LIBS = $(LIBDRV_PREFIX)/libdrv.a 33 EXTRA_CFLAGS = -I$(LIBDRV_PREFIX)/include 32 34 33 35 SOURCES = \ … … 41 43 port/msim.c \ 42 44 port/niagara.c \ 43 port/ns16550.c \44 45 port/ski.c \ 45 46 proto/adb.c \ -
uspace/srv/hid/input/input.c
r0d9b4a8 rbfa4ffa 42 42 #include <ipc/services.h> 43 43 #include <ipc/input.h> 44 #include < sysinfo.h>44 #include <config.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> 56 58 #include "layout.h" 57 59 #include "kbd.h" … … 60 62 #include "mouse.h" 61 63 #include "mouse_proto.h" 64 #include "serial.h" 62 65 #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 94 97 /** List of keyboard devices */ 95 98 static list_t kbd_devs; … … 97 100 /** List of mouse devices */ 98 101 static list_t mouse_devs; 102 103 /** List of serial devices */ 104 static list_t serial_devs; 99 105 100 106 static FIBRIL_MUTEX_INITIALIZE(discovery_lock); … … 395 401 mouse_dev_t *mdev = calloc(1, sizeof(mouse_dev_t)); 396 402 if (mdev == NULL) { 397 printf("%s: Error allocating keyboarddevice. "403 printf("%s: Error allocating mouse device. " 398 404 "Out of memory.\n", NAME); 399 405 return NULL; … … 403 409 404 410 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; 405 431 } 406 432 … … 532 558 return -1; 533 559 } 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 534 629 535 630 /** Add legacy drivers/devices. */ … … 555 650 kbd_add_dev(&niagara_port, &stty_ctl); 556 651 #endif 557 #if defined(UARCH_sparc64) && defined(MACHINE_generic)558 kbd_add_dev(&ns16550_port, &sun_ctl);559 #endif560 652 /* Silence warning on abs32le about kbd_add_dev() being unused */ 561 653 (void) kbd_add_dev; … … 678 770 } 679 771 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; 778 int rc; 779 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 680 823 static int dev_check_new(void) 681 824 { … … 684 827 fibril_mutex_lock(&discovery_lock); 685 828 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; 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 } 696 847 } 697 848 … … 726 877 int main(int argc, char **argv) 727 878 { 879 int rc; 880 728 881 if (argc < 2) { 729 882 usage(argv[0]); … … 733 886 printf("%s: HelenOS input service\n", NAME); 734 887 735 sysarg_t obio;736 737 888 list_initialize(&clients); 738 889 list_initialize(&kbd_devs); 739 890 list_initialize(&mouse_devs); 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 } 891 list_initialize(&serial_devs); 892 893 serial_console = config_get_value("console"); 749 894 750 895 /* Add legacy keyboard devices. */ … … 759 904 async_set_fallback_port_handler(client_connection, NULL); 760 905 761 intrc = loc_server_register(NAME);906 rc = loc_server_register(NAME); 762 907 if (rc != EOK) { 763 908 printf("%s: Unable to register server\n", NAME); -
uspace/srv/hid/output/Makefile
r0d9b4a8 rbfa4ffa 30 30 USPACE_PREFIX = ../../.. 31 31 BINARY = output 32 LIBS = $(LIBDRV_PREFIX)/libdrv.a 33 EXTRA_CFLAGS = -I$(LIBDRV_PREFIX)/include 32 34 33 35 SOURCES = \ … … 37 39 port/niagara.c \ 38 40 port/ski.c \ 41 port/chardev.c \ 39 42 proto/vt100.c \ 40 43 output.c -
uspace/srv/hid/output/output.c
r0d9b4a8 rbfa4ffa 34 34 #include <task.h> 35 35 #include <ipc/output.h> 36 #include <config.h> 36 37 #include "port/ega.h" 37 38 #include "port/kchar.h" 38 39 #include "port/niagara.h" 39 40 #include "port/ski.h" 41 #include "port/chardev.h" 40 42 #include "output.h" 41 43 … … 401 403 402 404 switch (IPC_GET_IMETHOD(call)) { 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 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); 444 446 } 445 447 } … … 475 477 } 476 478 477 ega_init(); 478 kchar_init(); 479 niagara_init(); 480 ski_init(); 479 if (!config_key_exists("console")) { 480 ega_init(); 481 kchar_init(); 482 niagara_init(); 483 ski_init(); 484 } else { 485 chardev_init(); 486 } 481 487 482 488 printf("%s: Accepting connections\n", NAME); -
uspace/srv/hid/output/proto/vt100.c
r0d9b4a8 rbfa4ffa 141 141 vt100_putchar_t putchar_fn, vt100_control_puts_t control_puts_fn) 142 142 { 143 vt100_state_t *state = 144 malloc(sizeof(vt100_state_t)); 143 vt100_state_t *state = malloc(sizeof(vt100_state_t)); 145 144 if (state == NULL) 146 145 return NULL; … … 164 163 state->control_puts("\033[2J"); 165 164 state->control_puts("\033[?25l"); 166 165 167 166 return state; 168 167 } -
uspace/srv/hw/irc/obio/obio.c
r0d9b4a8 rbfa4ffa 45 45 #include <ipc/irc.h> 46 46 #include <ns.h> 47 #include <sysinfo.h>48 47 #include <as.h> 49 48 #include <ddi.h> … … 94 93 switch (IPC_GET_IMETHOD(call)) { 95 94 case IRC_ENABLE_INTERRUPT: 96 /* Noop */ 95 inr = IPC_GET_ARG1(call); 96 base_virt[OBIO_IMR(inr & INO_MASK)] |= (1UL << 31); 97 97 async_answer_0(callid, EOK); 98 98 break; … … 111 111 /** Initialize the OBIO driver. 112 112 * 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. 113 * In the future, the OBIO driver should be integrated with the sun4u platform driver. 115 114 */ 116 115 static bool obio_init(void) 117 116 { 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; 117 base_phys = (uintptr_t) 0x1fe00000000ULL; 126 118 127 119 int flags = AS_AREA_READ | AS_AREA_WRITE; … … 135 127 } 136 128 137 printf("%s: OBIO registers with base at % zu\n", NAME, base_phys);129 printf("%s: OBIO registers with base at %lx\n", NAME, base_phys); 138 130 139 131 async_set_fallback_port_handler(obio_connection, NULL);
Note:
See TracChangeset
for help on using the changeset viewer.