Changes in / [2b96463:ae0300b5] in mainline
- Files:
-
- 113 deleted
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
HelenOS.config
r2b96463 rae0300b5 547 547 548 548 % Launch (devman) test drivers 549 ! [CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS ( n/y)550 549 ! [CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS (y/n) 550 -
Makefile
r2b96463 rae0300b5 92 92 $(MAKE) -C uspace clean 93 93 $(MAKE) -C boot clean 94 95 -include Makefile.local -
boot/Makefile.common
r2b96463 rae0300b5 139 139 $(USPACE_PATH)/app/ping/ping \ 140 140 $(USPACE_PATH)/app/stats/stats \ 141 $(USPACE_PATH)/app/top/top \ 141 142 $(USPACE_PATH)/app/sysinfo/sysinfo \ 142 $(USPACE_PATH)/app/tasks/tasks \143 $(USPACE_PATH)/app/top/top \144 $(USPACE_PATH)/app/usbinfo/usbinfo \145 $(USPACE_PATH)/app/virtusbkbd/vuk \146 $(USPACE_PATH)/app/virtusbhub/vuh \147 143 $(USPACE_PATH)/app/websrv/websrv 148 144 -
boot/arch/amd64/Makefile.inc
r2b96463 rae0300b5 42 42 pciintel \ 43 43 isa \ 44 ns8250 \ 45 uhci \ 46 usbhub \ 47 usbkbd \ 48 vhc 44 ns8250 49 45 50 46 RD_DRV_CFG += \ -
kernel/generic/include/mm/page.h
r2b96463 rae0300b5 37 37 38 38 #include <typedefs.h> 39 #include <proc/task.h>40 39 #include <mm/as.h> 41 40 #include <memstr.h> … … 63 62 extern uintptr_t hw_map(uintptr_t, size_t); 64 63 65 extern sysarg_t sys_page_find_mapping(uintptr_t, uintptr_t *);66 67 64 #endif 68 65 -
kernel/generic/include/syscall/syscall.h
r2b96463 rae0300b5 59 59 SYS_AS_AREA_DESTROY, 60 60 61 SYS_PAGE_FIND_MAPPING,62 63 61 SYS_IPC_CALL_SYNC_FAST, 64 62 SYS_IPC_CALL_SYNC_SLOW, -
kernel/generic/src/mm/page.c
r2b96463 rae0300b5 60 60 61 61 #include <mm/page.h> 62 #include <genarch/mm/page_ht.h>63 #include <genarch/mm/page_pt.h>64 62 #include <arch/mm/page.h> 65 63 #include <arch/mm/asid.h> … … 72 70 #include <debug.h> 73 71 #include <arch.h> 74 #include <syscall/copy.h>75 #include <errno.h>76 72 77 73 /** Virtual operations for page subsystem. */ … … 177 173 } 178 174 179 /** Syscall wrapper for getting mapping of a virtual page.180 *181 * @retval EOK Everything went find, @p uspace_frame and @p uspace_node182 * contains correct values.183 * @retval ENOENT Virtual address has no mapping.184 */185 sysarg_t sys_page_find_mapping(uintptr_t virt_address,186 uintptr_t *uspace_frame)187 {188 mutex_lock(&AS->lock);189 190 pte_t *pte = page_mapping_find(AS, virt_address);191 if (!PTE_VALID(pte) || !PTE_PRESENT(pte)) {192 mutex_unlock(&AS->lock);193 194 return (sysarg_t) ENOENT;195 }196 197 uintptr_t phys_address = PTE_GET_FRAME(pte);198 199 mutex_unlock(&AS->lock);200 201 int rc = copy_to_uspace(uspace_frame,202 &phys_address, sizeof(phys_address));203 if (rc != EOK) {204 return (sysarg_t) rc;205 }206 207 return EOK;208 }209 210 175 /** @} 211 176 */ -
kernel/generic/src/syscall/syscall.c
r2b96463 rae0300b5 41 41 #include <proc/program.h> 42 42 #include <mm/as.h> 43 #include <mm/page.h>44 43 #include <print.h> 45 44 #include <arch.h> … … 145 144 (syshandler_t) sys_as_area_destroy, 146 145 147 /* Page mapping related syscalls. */148 (syshandler_t) sys_page_find_mapping,149 150 146 /* IPC related syscalls. */ 151 147 (syshandler_t) sys_ipc_call_sync_fast, -
uspace/Makefile
r2b96463 rae0300b5 50 50 app/trace \ 51 51 app/top \ 52 app/usbinfo \53 app/virtusbkbd \54 app/virtusbhub \55 52 app/netecho \ 56 53 app/nettest1 \ … … 116 113 drv/ns8250 \ 117 114 srv/hw/irc/apic \ 118 srv/hw/irc/i8259 \ 119 drv/uhci \ 120 drv/usbhub \ 121 drv/usbkbd \ 122 drv/vhc 115 srv/hw/irc/i8259 123 116 endif 124 117 … … 130 123 drv/ns8250 \ 131 124 srv/hw/irc/apic \ 132 srv/hw/irc/i8259 \ 133 drv/uhci \ 134 drv/usbhub \ 135 drv/usbkbd \ 136 drv/vhc 125 srv/hw/irc/i8259 137 126 endif 138 127 … … 160 149 lib/packet \ 161 150 lib/net 162 163 ifeq ($(UARCH),amd64)164 LIBS += lib/usb165 LIBS += lib/usbvirt166 endif167 168 ifeq ($(UARCH),ia32)169 LIBS += lib/usb170 LIBS += lib/usbvirt171 endif172 151 173 152 LIBC_BUILD = $(addsuffix .build,$(LIBC)) -
uspace/Makefile.common
r2b96463 rae0300b5 86 86 LIBCLUI_PREFIX = $(LIB_PREFIX)/clui 87 87 88 89 LIBUSB_PREFIX = $(LIB_PREFIX)/usb90 LIBUSBVIRT_PREFIX = $(LIB_PREFIX)/usbvirt91 88 LIBDRV_PREFIX = $(LIB_PREFIX)/drv 92 89 LIBPACKET_PREFIX = $(LIB_PREFIX)/packet -
uspace/app/init/init.c
r2b96463 rae0300b5 314 314 getterm("term/vc5", "/app/bdsh", false); 315 315 getterm("term/vc6", "/app/klog", false); 316 getterm("term/vc7", "/srv/devman", false);317 316 318 317 return 0; -
uspace/app/tester/Makefile
r2b96463 rae0300b5 31 31 BINARY = tester 32 32 33 LIBS += $(LIBUSB_PREFIX)/libusb.a34 EXTRA_CFLAGS += -I$(LIBUSB_PREFIX)/include35 36 33 SOURCES = \ 37 34 tester.c \ 38 adt/usbaddrkeep.c \39 35 thread/thread1.c \ 40 36 print/print1.c \ … … 53 49 loop/loop1.c \ 54 50 mm/malloc1.c \ 55 mm/mapping1.c \56 51 hw/misc/virtchar1.c \ 57 52 hw/serial/serial1.c -
uspace/app/tester/tester.c
r2b96463 rae0300b5 62 62 #include "loop/loop1.def" 63 63 #include "mm/malloc1.def" 64 #include "mm/mapping1.def"65 64 #include "hw/serial/serial1.def" 66 #include "adt/usbaddrkeep.def"67 65 #include "hw/misc/virtchar1.def" 68 66 {NULL, NULL, NULL, false} -
uspace/app/tester/tester.h
r2b96463 rae0300b5 79 79 extern const char *test_loop1(void); 80 80 extern const char *test_malloc1(void); 81 extern const char *test_mapping1(void);82 81 extern const char *test_serial1(void); 83 extern const char *test_usbaddrkeep(void);84 82 extern const char *test_virtchar1(void); 85 83 -
uspace/doc/doxygroups.h
r2b96463 rae0300b5 150 150 * @endcond 151 151 */ 152 152 153 153 /** 154 154 * @defgroup emul Emulation Libraries … … 165 165 * @ingroup emul 166 166 */ 167 168 /**169 * @defgroup usb USB170 * @ingroup uspace171 * @brief USB support for HelenOS.172 */173 /**174 * @defgroup libusb USB library175 * @ingroup usb176 * @brief Library for creating USB devices drivers.177 */178 179 /**180 * @defgroup usbvirt USB virtualization181 * @ingroup usb182 * @brief Support for virtual USB devices.183 */184 185 /**186 * @defgroup libusbvirt USB virtualization library187 * @ingroup usbvirt188 * @brief Library for creating virtual USB devices.189 */190 191 /**192 * @defgroup drvusbvhc Virtual USB host controller193 * @ingroup usbvirt194 * @brief Driver simulating work of USB host controller.195 */196 197 /**198 * @defgroup usbvirthub Virtual USB hub199 * @ingroup usbvirt200 * @brief Extra virtual USB hub for virtual host controller.201 * @details202 * Some of the sources are shared with virtual host controller,203 * see @ref drvusbvhc for the rest of the files.204 */205 206 /**207 * @defgroup usbvirtkbd Virtual USB keybaord208 * @ingroup usbvirt209 * @brief Virtual USB keyboard for virtual host controller.210 */211 212 /**213 * @defgroup drvusbhub USB hub driver214 * @ingroup usb215 * @brief USB hub driver.216 */217 218 /**219 * @defgroup drvusbhid USB HID driver220 * @ingroup usb221 * @brief USB driver for HID devices.222 */223 224 /**225 * @defgroup drvusbuhci UHCI driver226 * @ingroup usb227 * @brief Driver for USB host controller UHCI.228 */229 -
uspace/drv/root/root.c
r2b96463 rae0300b5 88 88 89 89 int res = child_device_register_wrapper(parent, VIRTUAL_DEVICE_NAME, 90 VIRTUAL_DEVICE_MATCH_ID, VIRTUAL_DEVICE_MATCH_SCORE, 91 NULL); 90 VIRTUAL_DEVICE_MATCH_ID, VIRTUAL_DEVICE_MATCH_SCORE); 92 91 93 92 return res; … … 137 136 138 137 res = child_device_register_wrapper(parent, PLATFORM_DEVICE_NAME, 139 match_id, PLATFORM_DEVICE_MATCH_SCORE , NULL);138 match_id, PLATFORM_DEVICE_MATCH_SCORE); 140 139 141 140 return res; -
uspace/drv/rootvirt/devices.def
r2b96463 rae0300b5 22 22 }, 23 23 #endif 24 /* Virtual USB host controller. */25 {26 .name = "usbhc",27 .match_id = "usb&hc=vhc"28 }, -
uspace/drv/rootvirt/rootvirt.c
r2b96463 rae0300b5 84 84 85 85 int rc = child_device_register_wrapper(parent, virt_dev->name, 86 virt_dev->match_id, 10 , NULL);86 virt_dev->match_id, 10); 87 87 88 88 if (rc == EOK) { -
uspace/drv/test1/test1.c
r2b96463 rae0300b5 62 62 63 63 int rc = child_device_register_wrapper(parent, name, 64 match_id, match_score , NULL);64 match_id, match_score); 65 65 66 66 if (rc == EOK) { -
uspace/drv/test2/test2.c
r2b96463 rae0300b5 64 64 65 65 int rc = child_device_register_wrapper(parent, name, 66 match_id, match_score , NULL);66 match_id, match_score); 67 67 68 68 if (rc == EOK) { -
uspace/lib/c/generic/as.c
r2b96463 rae0300b5 35 35 #include <as.h> 36 36 #include <libc.h> 37 #include <errno.h>38 37 #include <unistd.h> 39 38 #include <align.h> … … 129 128 } 130 129 131 /** Find mapping to physical address.132 *133 * @param address Virtual address in question (virtual).134 * @param[out] frame Frame address (physical).135 * @return Error code.136 * @retval EOK No error, @p frame holds the translation.137 * @retval ENOENT Mapping not found.138 */139 int as_get_physical_mapping(void *address, uintptr_t *frame)140 {141 uintptr_t tmp_frame;142 uintptr_t virt = (uintptr_t) address;143 144 int rc = (int) __SYSCALL2(SYS_PAGE_FIND_MAPPING,145 (sysarg_t) virt, (sysarg_t) &tmp_frame);146 if (rc != EOK) {147 return rc;148 }149 150 if (frame != NULL) {151 *frame = tmp_frame;152 }153 154 return EOK;155 }156 157 130 /** @} 158 131 */ -
uspace/lib/c/include/as.h
r2b96463 rae0300b5 47 47 extern void *set_maxheapsize(size_t mhs); 48 48 extern void * as_get_mappable_page(size_t sz); 49 extern int as_get_physical_mapping(void *address, uintptr_t *frame);50 49 51 50 #endif -
uspace/lib/c/include/assert.h
r2b96463 rae0300b5 57 57 printf("Assertion failed (%s) at file '%s', " \ 58 58 "line %d.\n", #expr, __FILE__, __LINE__); \ 59 stacktrace_print(); \60 core(); \61 59 abort(); \ 62 60 } \ -
uspace/lib/c/include/ipc/dev_iface.h
r2b96463 rae0300b5 38 38 HW_RES_DEV_IFACE = 0, 39 39 CHAR_DEV_IFACE, 40 41 /** Interface provided by any USB device. */42 USB_DEV_IFACE,43 /** Interface provided by USB host controller. */44 USBHC_DEV_IFACE,45 46 40 DEV_IFACE_MAX 47 41 } dev_inferface_idx_t; … … 55 49 DEV_IFACE_ID(DEV_FIRST_CUSTOM_METHOD_IDX) 56 50 57 /*58 * The first argument is actually method (as the "real" method is used59 * for indexing into interfaces.60 */61 62 #define DEV_IPC_GET_ARG1(call) IPC_GET_ARG2((call))63 #define DEV_IPC_GET_ARG2(call) IPC_GET_ARG3((call))64 #define DEV_IPC_GET_ARG3(call) IPC_GET_ARG4((call))65 #define DEV_IPC_GET_ARG4(call) IPC_GET_ARG5((call))66 67 51 68 52 #endif -
uspace/lib/c/include/ipc/kbd.h
r2b96463 rae0300b5 39 39 40 40 #include <ipc/ipc.h> 41 #include <ipc/dev_iface.h>42 41 43 42 typedef enum { 44 KBD_YIELD = DEV_FIRST_CUSTOM_METHOD,43 KBD_YIELD = IPC_FIRST_USER_METHOD, 45 44 KBD_RECLAIM 46 45 } kbd_request_t; -
uspace/lib/drv/Makefile
r2b96463 rae0300b5 29 29 30 30 USPACE_PREFIX = ../.. 31 EXTRA_CFLAGS = -Iinclude -I$(LIBUSB_PREFIX)/include31 EXTRA_CFLAGS = -Iinclude 32 32 LIBRARY = libdrv 33 33 … … 35 35 generic/driver.c \ 36 36 generic/dev_iface.c \ 37 generic/remote_char_dev.c \38 37 generic/remote_hw_res.c \ 39 generic/remote_usb.c \ 40 generic/remote_usbhc.c 38 generic/remote_char_dev.c 41 39 42 40 include $(USPACE_PREFIX)/Makefile.common -
uspace/lib/drv/generic/dev_iface.c
r2b96463 rae0300b5 41 41 #include "remote_hw_res.h" 42 42 #include "remote_char_dev.h" 43 #include "remote_usb.h"44 #include "remote_usbhc.h"45 43 46 44 static iface_dipatch_table_t remote_ifaces = { 47 45 .ifaces = { 48 46 &remote_hw_res_iface, 49 &remote_char_dev_iface, 50 &remote_usb_iface, 51 &remote_usbhc_iface 47 &remote_char_dev_iface 52 48 } 53 49 }; -
uspace/lib/drv/generic/driver.c
r2b96463 rae0300b5 512 512 */ 513 513 int child_device_register_wrapper(device_t *parent, const char *child_name, 514 const char *child_match_id, int child_match_score, 515 devman_handle_t *child_handle) 514 const char *child_match_id, int child_match_score) 516 515 { 517 516 device_t *child = NULL; … … 540 539 if (rc != EOK) 541 540 goto failure; 542 543 if (child_handle != NULL) { 544 *child_handle = child->handle; 545 } 546 541 547 542 return EOK; 548 543 -
uspace/lib/drv/include/driver.h
r2b96463 rae0300b5 146 146 extern int child_device_register(device_t *, device_t *); 147 147 extern int child_device_register_wrapper(device_t *, const char *, const char *, 148 int , devman_handle_t *);148 int); 149 149 150 150 /* -
uspace/srv/devman/devman.c
r2b96463 rae0300b5 133 133 printf(NAME": the '%s' driver was added to the list of available " 134 134 "drivers.\n", drv->name); 135 136 printf(NAME ": match ids:");137 link_t *cur;138 for (cur = drv->match_ids.ids.next; cur != &drv->match_ids.ids; cur = cur->next) {139 match_id_t *match_id = list_get_instance(cur, match_id_t, link);140 printf(" %d:%s", match_id->score, match_id->id);141 }142 printf("\n");143 135 } 144 136 -
uspace/srv/devman/main.c
r2b96463 rae0300b5 458 458 459 459 if (driver == NULL) { 460 printf(NAME ": devman_forward error - the device %" PRIun \ 461 " (%s) is not in usable state.\n", 462 handle, dev->pathname); 460 printf(NAME ": devman_forward error - the device is not in %" PRIun 461 " usable state.\n", handle); 463 462 ipc_answer_0(iid, ENOENT); 464 463 return; … … 479 478 } 480 479 481 //printf(NAME ": devman_forward: forward connection to device %s to "482 //"driver %s.\n", dev->pathname, driver->name);480 printf(NAME ": devman_forward: forward connection to device %s to " 481 "driver %s.\n", dev->pathname, driver->name); 483 482 ipc_forward_fast(iid, driver->phone, method, dev->handle, 0, IPC_FF_NONE); 484 483 } -
uspace/srv/hid/console/console.c
r2b96463 rae0300b5 317 317 static void change_console(console_t *cons) 318 318 { 319 if (cons == active_console) {319 if (cons == active_console) 320 320 return; 321 }322 321 323 322 fb_pending_flush(); … … 459 458 if (IPC_GET_ARG1(call) == 1) { 460 459 int newcon = gcons_mouse_btn((bool) IPC_GET_ARG2(call)); 461 if (newcon != -1) {460 if (newcon != -1) 462 461 change_console(&consoles[newcon]); 463 }464 462 } 465 463 retval = 0; … … 712 710 } 713 711 714 static int connect_keyboard(char *path) 715 { 716 int fd = open(path, O_RDONLY); 717 if (fd < 0) { 718 return fd; 719 } 720 721 int phone = fd_phone(fd); 722 if (phone < 0) { 712 static bool console_init(char *input) 713 { 714 /* Connect to input device */ 715 int input_fd = open(input, O_RDONLY); 716 if (input_fd < 0) { 717 printf(NAME ": Failed opening %s\n", input); 718 return false; 719 } 720 721 kbd_phone = fd_phone(input_fd); 722 if (kbd_phone < 0) { 723 723 printf(NAME ": Failed to connect to input device\n"); 724 return phone;724 return false; 725 725 } 726 726 727 727 /* NB: The callback connection is slotted for removal */ 728 sysarg_t taskhash; 728 729 sysarg_t phonehash; 729 sysarg_t taskhash; 730 int rc = async_req_3_5(phone, IPC_M_CONNECT_TO_ME, SERVICE_CONSOLE, 731 0, 0, NULL, NULL, NULL, &taskhash, &phonehash); 732 if (rc != EOK) { 730 if (ipc_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, &taskhash, 731 &phonehash) != 0) { 733 732 printf(NAME ": Failed to create callback from input device\n"); 734 return rc;733 return false; 735 734 } 736 735 737 736 async_new_connection(taskhash, phonehash, 0, NULL, keyboard_events); 738 739 printf(NAME ": we got a hit (new keyboard \"%s\").\n", path); 740 741 return phone; 742 } 743 744 /** Try to connect to given keyboard, bypassing provided libc routines. 745 * 746 * @param devmap_path Path to keyboard without /dev prefix. 747 * @return Phone or error code. 748 */ 749 static int connect_keyboard_bypass(char *devmap_path) 750 { 751 int devmap_phone = async_connect_me_to_blocking(PHONE_NS, 752 SERVICE_DEVMAP, DEVMAP_CLIENT, 0); 753 if (devmap_phone < 0) { 754 return devmap_phone; 755 } 756 ipc_call_t answer; 757 aid_t req = async_send_2(devmap_phone, DEVMAP_DEVICE_GET_HANDLE, 758 0, 0, &answer); 759 760 sysarg_t retval = async_data_write_start(devmap_phone, 761 devmap_path, str_size(devmap_path)); 762 if (retval != EOK) { 763 async_wait_for(req, NULL); 764 ipc_hangup(devmap_phone); 765 return retval; 766 } 767 768 async_wait_for(req, &retval); 769 770 if (retval != EOK) { 771 ipc_hangup(devmap_phone); 772 return retval; 773 } 774 775 devmap_handle_t handle = (devmap_handle_t) IPC_GET_ARG1(answer); 776 777 ipc_hangup(devmap_phone); 778 779 int phone = async_connect_me_to(PHONE_NS, 780 SERVICE_DEVMAP, DEVMAP_CONNECT_TO_DEVICE, handle); 781 if (phone < 0) { 782 return phone; 783 } 784 785 /* NB: The callback connection is slotted for removal */ 786 sysarg_t phonehash; 787 sysarg_t taskhash; 788 int rc = async_req_3_5(phone, IPC_M_CONNECT_TO_ME, SERVICE_CONSOLE, 789 0, 0, NULL, NULL, NULL, &taskhash, &phonehash); 790 if (rc != EOK) { 791 printf(NAME ": Failed to create callback from input device\n"); 792 return rc; 793 } 794 795 async_new_connection(taskhash, phonehash, 0, NULL, keyboard_events); 796 797 printf(NAME ": we got a hit (new keyboard \"/dev/%s\").\n", 798 devmap_path); 799 800 return phone; 801 } 802 803 804 static int check_new_keyboards(void *arg) 805 { 806 char *class_name = (char *) arg; 807 808 int index = 1; 809 810 while (true) { 811 async_usleep(1 * 500 * 1000); 812 char *path; 813 int rc = asprintf(&path, "class/%s\\%d", class_name, index); 814 if (rc < 0) { 815 continue; 816 } 817 rc = 0; 818 rc = connect_keyboard_bypass(path); 819 if (rc > 0) { 820 /* We do not allow unplug. */ 821 index++; 822 } 823 824 free(path); 825 } 826 827 return EOK; 828 } 829 830 831 /** Start a fibril monitoring hot-plugged keyboards. 832 */ 833 static void check_new_keyboards_in_background() 834 { 835 fid_t fid = fibril_create(check_new_keyboards, (void *)"keyboard"); 836 if (!fid) { 837 printf(NAME ": failed to create hot-plug-watch fibril.\n"); 838 return; 839 } 840 fibril_add_ready(fid); 841 } 842 843 static bool console_init(char *input) 844 { 845 /* Connect to input device */ 846 kbd_phone = connect_keyboard(input); 847 if (kbd_phone < 0) { 848 return false; 849 } 850 737 851 738 /* Connect to mouse device */ 852 739 mouse_phone = -1; … … 864 751 } 865 752 866 sysarg_t taskhash;867 sysarg_t phonehash;868 753 if (ipc_connect_to_me(mouse_phone, SERVICE_CONSOLE, 0, 0, &taskhash, 869 754 &phonehash) != 0) { … … 958 843 async_set_interrupt_received(interrupt_received); 959 844 960 /* Start fibril for checking on hot-plugged keyboards. */961 check_new_keyboards_in_background();962 963 845 return true; 964 846 } … … 980 862 if (!console_init(argv[1])) 981 863 return -1; 982 864 983 865 printf(NAME ": Accepting connections\n"); 984 866 async_manager(); -
uspace/srv/net/tl/udp/udp.c
r2b96463 rae0300b5 741 741 int socket_id; 742 742 size_t addrlen; 743 size_t size = 0;743 size_t size; 744 744 ipc_call_t answer; 745 745 size_t answer_count;
Note:
See TracChangeset
for help on using the changeset viewer.