Changes in / [b64eac6:306061a] in mainline


Ignore:
Files:
177 deleted
36 edited

Legend:

Unmodified
Added
Removed
  • HelenOS.config

    rb64eac6 r306061a  
    547547
    548548% Launch (devman) test drivers
    549 ! [CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS (n/y)
    550 
    551 % Start virtual USB host controller
    552 ! CONFIG_RUN_VIRTUAL_USB_HC (n/y)
    553 
     549! [CONFIG_DEBUG=y] CONFIG_TEST_DRIVERS (y/n)
     550
  • Makefile

    rb64eac6 r306061a  
    106106        $(MAKE) -C uspace clean
    107107        $(MAKE) -C boot clean
    108 
    109 -include Makefile.local
  • boot/Makefile.common

    rb64eac6 r306061a  
    139139        $(USPACE_PATH)/app/ping/ping \
    140140        $(USPACE_PATH)/app/stats/stats \
     141        $(USPACE_PATH)/app/top/top \
    141142        $(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 \
    147143        $(USPACE_PATH)/app/websrv/websrv
    148144
  • boot/arch/amd64/Makefile.inc

    rb64eac6 r306061a  
    4242        pciintel \
    4343        isa \
    44         ns8250 \
    45         ehci-hcd \
    46         uhci-hcd \
    47         uhci-rhd \
    48         usbhub \
    49         usbhid \
    50         usbmid \
    51         usbmouse \
    52         vhc
     44        ns8250
    5345
    5446RD_DRV_CFG += \
  • kernel/generic/include/mm/page.h

    rb64eac6 r306061a  
    3737
    3838#include <typedefs.h>
    39 #include <proc/task.h>
    4039#include <mm/as.h>
    4140#include <memstr.h>
     
    6362extern uintptr_t hw_map(uintptr_t, size_t);
    6463
    65 extern sysarg_t sys_page_find_mapping(uintptr_t, uintptr_t *);
    66 
    6764#endif
    6865
  • kernel/generic/include/syscall/syscall.h

    rb64eac6 r306061a  
    6161        SYS_AS_GET_UNMAPPED_AREA,
    6262       
    63         SYS_PAGE_FIND_MAPPING,
    64        
    6563        SYS_IPC_CALL_SYNC_FAST,
    6664        SYS_IPC_CALL_SYNC_SLOW,
  • kernel/generic/src/mm/page.c

    rb64eac6 r306061a  
    6060
    6161#include <mm/page.h>
    62 #include <genarch/mm/page_ht.h>
    63 #include <genarch/mm/page_pt.h>
    6462#include <arch/mm/page.h>
    6563#include <arch/mm/asid.h>
     
    7270#include <debug.h>
    7371#include <arch.h>
    74 #include <syscall/copy.h>
    75 #include <errno.h>
    7672
    7773/** Virtual operations for page subsystem. */
     
    177173}
    178174
    179 /** Syscall wrapper for getting mapping of a virtual page.
    180  *
    181  * @retval EOK Everything went find, @p uspace_frame and @p uspace_node
    182  *             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 
    210175/** @}
    211176 */
  • kernel/generic/src/syscall/syscall.c

    rb64eac6 r306061a  
    4141#include <proc/program.h>
    4242#include <mm/as.h>
    43 #include <mm/page.h>
    4443#include <print.h>
    4544#include <arch.h>
     
    146145        (syshandler_t) sys_as_get_unmapped_area,
    147146       
    148         /* Page mapping related syscalls. */
    149         (syshandler_t) sys_page_find_mapping,
    150        
    151147        /* IPC related syscalls. */
    152148        (syshandler_t) sys_ipc_call_sync_fast,
  • uspace/Makefile

    rb64eac6 r306061a  
    5050        app/trace \
    5151        app/top \
    52         app/usbinfo \
    53         app/virtusbkbd \
    54         app/virtusbhub \
    5552        app/netecho \
    5653        app/nettest1 \
     
    116113                drv/ns8250 \
    117114                srv/hw/irc/apic \
    118                 srv/hw/irc/i8259 \
    119                 drv/ehci-hcd \
    120                 drv/uhci-hcd \
    121                 drv/uhci-rhd \
    122                 drv/usbhid \
    123                 drv/usbhub \
    124                 drv/usbmid \
    125                 drv/usbmouse \
    126                 drv/vhc
     115                srv/hw/irc/i8259
    127116endif
    128117
     
    134123                drv/ns8250 \
    135124                srv/hw/irc/apic \
    136                 srv/hw/irc/i8259 \
    137                 drv/ehci-hcd \
    138                 drv/uhci-hcd \
    139                 drv/uhci-rhd \
    140                 drv/usbhid \
    141                 drv/usbhub \
    142                 drv/usbmid \
    143                 drv/usbmouse \
    144                 drv/vhc
     125                srv/hw/irc/i8259
    145126endif
    146127
     
    168149        lib/packet \
    169150        lib/net
    170 
    171 ifeq ($(UARCH),amd64)
    172         LIBS += lib/usb
    173         LIBS += lib/usbvirt
    174 endif
    175 
    176 ifeq ($(UARCH),ia32)
    177         LIBS += lib/usb
    178         LIBS += lib/usbvirt
    179 endif
    180151
    181152LIBC_BUILD = $(addsuffix .build,$(LIBC))
  • uspace/Makefile.common

    rb64eac6 r306061a  
    8686LIBCLUI_PREFIX = $(LIB_PREFIX)/clui
    8787
    88 
    89 LIBUSB_PREFIX = $(LIB_PREFIX)/usb
    90 LIBUSBVIRT_PREFIX = $(LIB_PREFIX)/usbvirt
    9188LIBDRV_PREFIX = $(LIB_PREFIX)/drv
    9289LIBPACKET_PREFIX = $(LIB_PREFIX)/packet
  • uspace/app/bdsh/cmds/modules/cat/cat.c

    rb64eac6 r306061a  
    144144                        return CMD_SUCCESS;
    145145                case 'H':
    146                         printf("%s", cat_oops);
     146                        printf(cat_oops);
    147147                        return CMD_FAILURE;
    148148                case 't':
    149                         printf("%s", cat_oops);
     149                        printf(cat_oops);
    150150                        return CMD_FAILURE;
    151151                case 'b':
    152                         printf("%s", cat_oops);
     152                        printf(cat_oops);
    153153                        break;
    154154                case 'm':
    155                         printf("%s", cat_oops);
     155                        printf(cat_oops);
    156156                        return CMD_FAILURE;
    157157                }
  • uspace/app/bdsh/cmds/modules/rm/rm.c

    rb64eac6 r306061a  
    227227                }
    228228                memset(buff, 0, sizeof(buff));
    229                 snprintf(buff, len, "%s", argv[i]);
     229                snprintf(buff, len, argv[i]);
    230230
    231231                scope = rm_scope(buff);
  • uspace/app/init/init.c

    rb64eac6 r306061a  
    313313        getterm("term/vc5", "/app/bdsh", false);
    314314        getterm("term/vc6", "/app/klog", false);
    315         getterm("term/vc7", "/srv/devman", false);
    316315       
    317316        return 0;
  • uspace/app/tester/Makefile

    rb64eac6 r306061a  
    3131BINARY = tester
    3232
    33 LIBS += $(LIBUSB_PREFIX)/libusb.a
    34 EXTRA_CFLAGS += -I$(LIBUSB_PREFIX)/include
    35 
    3633SOURCES = \
    3734        tester.c \
    38         adt/usbaddrkeep.c \
    3935        thread/thread1.c \
    4036        print/print1.c \
     
    5349        loop/loop1.c \
    5450        mm/malloc1.c \
    55         mm/mapping1.c \
    5651        hw/misc/virtchar1.c \
    5752        hw/serial/serial1.c
  • uspace/app/tester/tester.c

    rb64eac6 r306061a  
    6262#include "loop/loop1.def"
    6363#include "mm/malloc1.def"
    64 #include "mm/mapping1.def"
    6564#include "hw/serial/serial1.def"
    66 #include "adt/usbaddrkeep.def"
    6765#include "hw/misc/virtchar1.def"
    6866        {NULL, NULL, NULL, false}
  • uspace/app/tester/tester.h

    rb64eac6 r306061a  
    7878extern const char *test_loop1(void);
    7979extern const char *test_malloc1(void);
    80 extern const char *test_mapping1(void);
    8180extern const char *test_serial1(void);
    82 extern const char *test_usbaddrkeep(void);
    8381extern const char *test_virtchar1(void);
    8482
  • uspace/doc/doxygroups.h

    rb64eac6 r306061a  
    150150         * @endcond
    151151         */
    152 
     152       
    153153/**
    154154 * @defgroup emul Emulation Libraries
     
    165165         * @ingroup emul
    166166         */
    167 
    168 /**
    169  * @defgroup usb USB
    170  * @ingroup uspace
    171  * @brief USB support for HelenOS.
    172  */
    173         /**
    174          * @defgroup libusb USB library
    175          * @ingroup usb
    176          * @brief Library for creating USB devices drivers.
    177          */
    178 
    179         /**
    180          * @defgroup usbvirt USB virtualization
    181          * @ingroup usb
    182          * @brief Support for virtual USB devices.
    183          */
    184 
    185                 /**
    186                  * @defgroup libusbvirt USB virtualization library
    187                  * @ingroup usbvirt
    188                  * @brief Library for creating virtual USB devices.
    189                  */
    190 
    191                 /**
    192                  * @defgroup drvusbvhc Virtual USB host controller
    193                  * @ingroup usbvirt
    194                  * @brief Driver simulating work of USB host controller.
    195                  */
    196 
    197                 /**
    198                  * @defgroup usbvirthub Virtual USB hub
    199                  * @ingroup usbvirt
    200                  * @brief Extra virtual USB hub for virtual host controller.
    201                  * @details
    202                  * 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 keybaord
    208                  * @ingroup usbvirt
    209                  * @brief Virtual USB keyboard for virtual host controller.
    210                  */
    211 
    212         /**
    213          * @defgroup usbinfo USB info application
    214          * @ingroup usb
    215          * @brief Application for querying USB devices.
    216          * @details
    217          * The intended usage of this application is to query new USB devices
    218          * for their descriptors etc. to simplify driver writing.
    219          */
    220 
    221         /**
    222          * @defgroup drvusbmid USB multi interface device driver
    223          * @ingroup usb
    224          * @brief USB multi interface device driver
    225          * @details
    226          * This driver serves as a mini hub (or bus) driver for devices
    227          * that have the class defined at interface level (those devices
    228          * usually have several interfaces).
    229          *
    230          * The term multi interface device driver (MID) was borrowed
    231          * Solaris operating system.
    232          */
    233 
    234         /**
    235          * @defgroup drvusbhub USB hub driver
    236          * @ingroup usb
    237          * @brief USB hub driver.
    238          */
    239 
    240         /**
    241          * @defgroup drvusbhid USB HID driver
    242          * @ingroup usb
    243          * @brief USB driver for HID devices.
    244          */
    245 
    246         /**
    247          * @defgroup drvusbmouse USB mouse driver
    248          * @ingroup usb
    249          * @brief USB driver for mouse with boot protocol.
    250          */
    251 
    252         /**
    253          * @defgroup drvusbuhci UHCI driver
    254          * @ingroup usb
    255          * @brief Drivers for USB UHCI host controller and root hub.
    256          */
    257 
    258                 /**
    259                  * @defgroup drvusbuhcirh UHCI root hub driver
    260                  * @ingroup drvusbuhci
    261                  * @brief Driver for UHCI complaint root hub.
    262                  */
    263 
    264                 /**
    265                  * @defgroup drvusbuhcihc UHCI host controller driver
    266                  * @ingroup drvusbuhci
    267                  * @brief Driver for UHCI complaint USB host controller.
    268                  */
    269 
    270         /**
    271          * @defgroup drvusbehci EHCI driver
    272          * @ingroup usb
    273          * @brief Driver for EHCI host controller.
    274          */
    275 
    276 
  • uspace/drv/pciintel/pci.c

    rb64eac6 r306061a  
    5151#include <ipc/devman.h>
    5252#include <ipc/dev_iface.h>
    53 #include <ipc/irc.h>
    54 #include <ipc/ns.h>
    55 #include <ipc/services.h>
    56 #include <sysinfo.h>
    5753#include <ops/hw_res.h>
    5854#include <device/hw_res.h>
    5955#include <ddi.h>
    6056#include <libarch/ddi.h>
    61 #include <pci_dev_iface.h>
    6257
    6358#include "pci.h"
     
    8883static bool pciintel_enable_interrupt(ddf_fun_t *fnode)
    8984{
    90         /* This is an old ugly way, copied from ne2000 driver */
    91         assert(fnode);
    92         pci_fun_t *dev_data = (pci_fun_t *) fnode->driver_data;
    93 
    94         sysarg_t apic;
    95         sysarg_t i8259;
    96 
    97         int irc_phone = -1;
    98         int irc_service = -1;
    99 
    100         if ((sysinfo_get_value("apic", &apic) == EOK) && (apic)) {
    101                 irc_service = SERVICE_APIC;
    102         } else if ((sysinfo_get_value("i8259", &i8259) == EOK) && (i8259)) {
    103                 irc_service = SERVICE_I8259;
    104         }
    105 
    106         if (irc_service == -1) {
    107                 return false;
    108         }
    109 
    110         irc_phone = service_connect_blocking(irc_service, 0, 0);
    111         if (irc_phone < 0) {
    112                 return false;
    113         }
    114 
    115         size_t i;
    116         for (i = 0; i < dev_data->hw_resources.count; i++) {
    117                 if (dev_data->hw_resources.resources[i].type == INTERRUPT) {
    118                         int irq = dev_data->hw_resources.resources[i].res.interrupt.irq;
    119                         int rc = async_req_1_0(irc_phone, IRC_ENABLE_INTERRUPT, irq);
    120                         if (rc != EOK) {
    121                                 async_hangup(irc_phone);
    122                                 return false;
    123                         }
    124                 }
    125         }
    126 
    127         async_hangup(irc_phone);
    128         return true;
    129 }
    130 
    131 static int pci_config_space_write_32(
    132     ddf_fun_t *fun, uint32_t address, uint32_t data)
    133 {
    134         if (address > 252)
    135                 return EINVAL;
    136         pci_conf_write_32(PCI_FUN(fun), address, data);
    137         return EOK;
    138 }
    139 
    140 static int pci_config_space_write_16(
    141     ddf_fun_t *fun, uint32_t address, uint16_t data)
    142 {
    143         if (address > 254)
    144                 return EINVAL;
    145         pci_conf_write_16(PCI_FUN(fun), address, data);
    146         return EOK;
    147 }
    148 
    149 static int pci_config_space_write_8(
    150     ddf_fun_t *fun, uint32_t address, uint8_t data)
    151 {
    152         if (address > 255)
    153                 return EINVAL;
    154         pci_conf_write_8(PCI_FUN(fun), address, data);
    155         return EOK;
    156 }
    157 
    158 static int pci_config_space_read_32(
    159     ddf_fun_t *fun, uint32_t address, uint32_t *data)
    160 {
    161         if (address > 252)
    162                 return EINVAL;
    163         *data = pci_conf_read_32(PCI_FUN(fun), address);
    164         return EOK;
    165 }
    166 
    167 static int pci_config_space_read_16(
    168     ddf_fun_t *fun, uint32_t address, uint16_t *data)
    169 {
    170         if (address > 254)
    171                 return EINVAL;
    172         *data = pci_conf_read_16(PCI_FUN(fun), address);
    173         return EOK;
    174 }
    175 
    176 static int pci_config_space_read_8(
    177     ddf_fun_t *fun, uint32_t address, uint8_t *data)
    178 {
    179         if (address > 255)
    180                 return EINVAL;
    181         *data = pci_conf_read_8(PCI_FUN(fun), address);
    182         return EOK;
     85        /* TODO */
     86       
     87        return false;
    18388}
    18489
     
    18893};
    18994
    190 static pci_dev_iface_t pci_dev_ops = {
    191         .config_space_read_8 = &pci_config_space_read_8,
    192         .config_space_read_16 = &pci_config_space_read_16,
    193         .config_space_read_32 = &pci_config_space_read_32,
    194         .config_space_write_8 = &pci_config_space_write_8,
    195         .config_space_write_16 = &pci_config_space_write_16,
    196         .config_space_write_32 = &pci_config_space_write_32
    197 };
    198 
    199 static ddf_dev_ops_t pci_fun_ops = {
    200         .interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops,
    201         .interfaces[PCI_DEV_IFACE] = &pci_dev_ops
    202 };
     95static ddf_dev_ops_t pci_fun_ops;
    20396
    20497static int pci_add_device(ddf_dev_t *);
     
    394287        /* Get the value of the BAR. */
    395288        val = pci_conf_read_32(fun, addr);
    396 
    397 #define IO_MASK  (~0x3)
    398 #define MEM_MASK (~0xf)
    399289       
    400290        io = (bool) (val & 1);
    401291        if (io) {
    402292                addrw64 = false;
    403                 mask = IO_MASK;
    404293        } else {
    405                 mask = MEM_MASK;
    406294                switch ((val >> 1) & 3) {
    407295                case 0:
     
    419307        /* Get the address mask. */
    420308        pci_conf_write_32(fun, addr, 0xffffffff);
    421         mask &= pci_conf_read_32(fun, addr);
     309        mask = pci_conf_read_32(fun, addr);
    422310       
    423311        /* Restore the original value. */
     
    667555{
    668556        pci_fun_ops.interfaces[HW_RES_DEV_IFACE] = &pciintel_hw_res_ops;
    669         pci_fun_ops.interfaces[PCI_DEV_IFACE] = &pci_dev_ops;
    670557}
    671558
     
    739626size_t pci_bar_mask_to_size(uint32_t mask)
    740627{
    741         size_t size = mask & ~(mask - 1);
    742         return size;
     628        return ((mask & 0xfffffff0) ^ 0xffffffff) + 1;
    743629}
    744630
  • uspace/drv/rootvirt/devices.def

    rb64eac6 r306061a  
    2222},
    2323#endif
    24 #ifdef CONFIG_RUN_VIRTUAL_USB_HC
    25 /* Virtual USB host controller. */
    26 {
    27         .name = "usbhc",
    28         .match_id = "usb&hc=vhc"
    29 },
    30 #endif
  • uspace/lib/c/Makefile

    rb64eac6 r306061a  
    6565        generic/str.c \
    6666        generic/str_error.c \
    67         generic/l18n/langs.c \
    6867        generic/fibril.c \
    6968        generic/fibril_synch.c \
  • uspace/lib/c/generic/as.c

    rb64eac6 r306061a  
    3535#include <as.h>
    3636#include <libc.h>
    37 #include <errno.h>
    3837#include <unistd.h>
    3938#include <align.h>
     
    115114}
    116115
    117 /** Find mapping to physical address.
    118  *
    119  * @param address Virtual address in question (virtual).
    120  * @param[out] frame Frame address (physical).
    121  * @return Error code.
    122  * @retval EOK No error, @p frame holds the translation.
    123  * @retval ENOENT Mapping not found.
    124  */
    125 int as_get_physical_mapping(void *address, uintptr_t *frame)
    126 {
    127         uintptr_t tmp_frame;
    128         uintptr_t virt = (uintptr_t) address;
    129        
    130         int rc = (int) __SYSCALL2(SYS_PAGE_FIND_MAPPING,
    131             (sysarg_t) virt, (sysarg_t) &tmp_frame);
    132         if (rc != EOK) {
    133                 return rc;
    134         }
    135        
    136         if (frame != NULL) {
    137                 *frame = tmp_frame;
    138         }
    139        
    140         return EOK;
    141 }
    142 
    143116/** @}
    144117 */
  • uspace/lib/c/generic/async.c

    rb64eac6 r306061a  
    15671567}
    15681568
    1569 /** Start IPC_M_DATA_READ using the async framework.
    1570  *
    1571  * @param phoneid Phone that will be used to contact the receiving side.
    1572  * @param dst Address of the beginning of the destination buffer.
    1573  * @param size Size of the destination buffer (in bytes).
    1574  * @param dataptr Storage of call data (arg 2 holds actual data size).
    1575  * @return Hash of the sent message or 0 on error.
    1576  */
    1577 aid_t async_data_read(int phoneid, void *dst, size_t size, ipc_call_t *dataptr)
    1578 {
    1579         return async_send_2(phoneid, IPC_M_DATA_READ, (sysarg_t) dst,
    1580             (sysarg_t) size, dataptr);
    1581 }
    1582 
    15831569/** Wrapper for IPC_M_DATA_READ calls using the async framework.
    15841570 *
  • uspace/lib/c/generic/str_error.c

    rb64eac6 r306061a  
    3333 */
    3434
    35 #include <errno.h>
    3635#include <str_error.h>
    3736#include <stdio.h>
     
    6463static fibril_local char noerr[NOERR_LEN];
    6564
    66 const char *str_error(const int e)
     65const char *str_error(const int errno)
    6766{
    68         if ((e <= 0) && (e >= MIN_ERRNO))
    69                 return err_desc[-e];
     67        if ((errno <= 0) && (errno >= MIN_ERRNO))
     68                return err_desc[-errno];
    7069       
    71         /* Ad hoc descriptions of error codes interesting for USB. */
    72         switch (e) {
    73                 case EBADCHECKSUM:
    74                         return "Bad checksum";
    75                 case ESTALL:
    76                         return "Operation stalled";
    77                 case EAGAIN:
    78                         return "Resource temporarily unavailable";
    79                 case EEMPTY:
    80                         return "Resource is empty";
    81                 default:
    82                         break;
    83         }
    84 
    85         snprintf(noerr, NOERR_LEN, "Unkown error code %d", e);
     70        snprintf(noerr, NOERR_LEN, "Unkown error code %d", errno);
    8671        return noerr;
    8772}
  • uspace/lib/c/include/as.h

    rb64eac6 r306061a  
    6060extern void *set_maxheapsize(size_t mhs);
    6161extern void * as_get_mappable_page(size_t sz);
    62 extern int as_get_physical_mapping(void *address, uintptr_t *frame);
    6362
    6463#endif
  • uspace/lib/c/include/async.h

    rb64eac6 r306061a  
    340340            (arg4), (answer))
    341341
    342 extern aid_t async_data_read(int, void *, size_t, ipc_call_t *);
    343342extern int async_data_read_start(int, void *, size_t);
    344343extern bool async_data_read_receive(ipc_callid_t *, size_t *);
  • uspace/lib/c/include/errno.h

    rb64eac6 r306061a  
    5656#define EMLINK        (-266)
    5757
    58 /** Bad checksum. */
    59 #define EBADCHECKSUM  (-300)
    60 
    61 /** USB: stalled operation. */
    62 #define ESTALL (-301)
    63 
    64 /** Empty resource (no data). */
    65 #define EEMPTY (-302)
    66 
    6758/** An API function is called while another blocking function is in progress. */
    6859#define EINPROGRESS  (-10036)
  • uspace/lib/c/include/ipc/dev_iface.h

    rb64eac6 r306061a  
    3737        HW_RES_DEV_IFACE = 0,
    3838        CHAR_DEV_IFACE,
    39 
    40         /** Interface provided by any PCI device. */
    41         PCI_DEV_IFACE,
    42 
    43         /** Interface provided by any USB device. */
    44         USB_DEV_IFACE,
    45         /** Interface provided by USB host controller. */
    46         USBHC_DEV_IFACE,
    47 
    4839        DEV_IFACE_MAX
    4940} dev_inferface_idx_t;
     
    5748        DEV_IFACE_ID(DEV_FIRST_CUSTOM_METHOD_IDX)
    5849
    59 /*
    60  * The first argument is actually method (as the "real" method is used
    61  * for indexing into interfaces.
    62  */
    63 
    64 #define DEV_IPC_GET_ARG1(call) IPC_GET_ARG2((call))
    65 #define DEV_IPC_GET_ARG2(call) IPC_GET_ARG3((call))
    66 #define DEV_IPC_GET_ARG3(call) IPC_GET_ARG4((call))
    67 #define DEV_IPC_GET_ARG4(call) IPC_GET_ARG5((call))
    68 
    6950
    7051#endif
  • uspace/lib/c/include/ipc/kbd.h

    rb64eac6 r306061a  
    3939
    4040#include <ipc/common.h>
    41 #include <ipc/dev_iface.h>
    4241
    4342typedef enum {
    44         KBD_YIELD = DEV_FIRST_CUSTOM_METHOD,
     43        KBD_YIELD = IPC_FIRST_USER_METHOD,
    4544        KBD_RECLAIM
    4645} kbd_request_t;
  • uspace/lib/drv/Makefile

    rb64eac6 r306061a  
    2929
    3030USPACE_PREFIX = ../..
    31 EXTRA_CFLAGS = -Iinclude -I$(LIBUSB_PREFIX)/include
     31EXTRA_CFLAGS = -Iinclude
    3232LIBRARY = libdrv
    3333
     
    3535        generic/driver.c \
    3636        generic/dev_iface.c \
    37         generic/remote_char_dev.c \
    3837        generic/remote_hw_res.c \
    39         generic/remote_usb.c \
    40         generic/remote_pci.c \
    41         generic/remote_usbhc.c
     38        generic/remote_char_dev.c
    4239
    4340include $(USPACE_PREFIX)/Makefile.common
  • uspace/lib/drv/generic/dev_iface.c

    rb64eac6 r306061a  
    4141#include "remote_hw_res.h"
    4242#include "remote_char_dev.h"
    43 #include "remote_usb.h"
    44 #include "remote_usbhc.h"
    45 #include "remote_pci.h"
    4643
    4744static iface_dipatch_table_t remote_ifaces = {
    4845        .ifaces = {
    4946                &remote_hw_res_iface,
    50                 &remote_char_dev_iface,
    51                 &remote_pci_iface,
    52                 &remote_usb_iface,
    53                 &remote_usbhc_iface
     47                &remote_char_dev_iface
    5448        }
    5549};
  • uspace/srv/devman/devman.c

    rb64eac6 r306061a  
    148148        printf(NAME": the '%s' driver was added to the list of available "
    149149            "drivers.\n", drv->name);
    150 
    151         printf(NAME ": match ids:");
    152         link_t *cur;
    153         for (cur = drv->match_ids.ids.next; cur != &drv->match_ids.ids; cur = cur->next) {
    154                 match_id_t *match_id = list_get_instance(cur, match_id_t, link);
    155                 printf(" %d:%s", match_id->score, match_id->id);
    156         }
    157         printf("\n");
    158150}
    159151
  • uspace/srv/devman/main.c

    rb64eac6 r306061a  
    507507       
    508508        if (driver == NULL) {
    509                 printf(NAME ": devman_forward error - the device %" PRIun \
    510                     " (%s) is not in usable state.\n",
    511                     handle, dev->pfun->pathname);
     509                printf(NAME ": devman_forward error - the device is not in %" PRIun
     510                    " usable state.\n", handle);
    512511                async_answer_0(iid, ENOENT);
    513512                return;
  • uspace/srv/fs/fat/fat_dentry.c

    rb64eac6 r306061a  
    4242static bool is_d_char(const char ch)
    4343{
    44         if (isalnum(ch) || ch == '_' || ch == '-')
     44        if (isalnum(ch) || ch == '_')
    4545                return true;
    4646        else
  • uspace/srv/hid/console/console.c

    rb64eac6 r306061a  
    4141#include <ipc/ns.h>
    4242#include <errno.h>
    43 #include <str_error.h>
    4443#include <ipc/console.h>
    4544#include <unistd.h>
     
    6564#define NAME       "console"
    6665#define NAMESPACE  "term"
    67 /** Interval for checking for new keyboard (1/4s). */
    68 #define HOTPLUG_WATCH_INTERVAL (1000 * 250)
    6966
    7067/** Phone to the keyboard driver. */
     
    320317static void change_console(console_t *cons)
    321318{
    322         if (cons == active_console) {
     319        if (cons == active_console)
    323320                return;
    324         }
    325321       
    326322        fb_pending_flush();
     
    462458                        if (IPC_GET_ARG1(call) == 1) {
    463459                                int newcon = gcons_mouse_btn((bool) IPC_GET_ARG2(call));
    464                                 if (newcon != -1) {
     460                                if (newcon != -1)
    465461                                        change_console(&consoles[newcon]);
    466                                 }
    467462                        }
    468463                        retval = 0;
     
    715710}
    716711
    717 static int connect_keyboard_or_mouse(const char *devname,
    718     async_client_conn_t handler, const char *path)
    719 {
    720         int fd = open(path, O_RDONLY);
    721         if (fd < 0) {
    722                 return fd;
    723         }
    724        
    725         int phone = fd_phone(fd);
    726         if (phone < 0) {
     712static 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) {
    727723                printf(NAME ": Failed to connect to input device\n");
    728                 return phone;
    729         }
    730        
    731         int rc = async_connect_to_me(phone, SERVICE_CONSOLE, 0, 0, handler);
    732         if (rc != EOK) {
    733                 printf(NAME ": " \
    734                     "Failed to create callback from input device: %s.\n",
    735                     str_error(rc));
    736                 return rc;
    737         }
    738        
    739         printf(NAME ": found %s \"%s\".\n", devname, path);
    740 
    741         return phone;
    742 }
    743 
    744 static int connect_keyboard(const char *path)
    745 {
    746         return connect_keyboard_or_mouse("keyboard", keyboard_events, path);
    747 }
    748 
    749 static int connect_mouse(const char *path)
    750 {
    751         return connect_keyboard_or_mouse("mouse", mouse_events, path);
    752 }
    753 
    754 struct hid_class_info {
    755         char *classname;
    756         int (*connection_func)(const char *);
    757 };
    758 
    759 /** Periodically check for new keyboards in /dev/class/.
    760  *
    761  * @param arg Class name.
    762  * @return This function should never exit.
    763  */
    764 static int check_new_device_fibril(void *arg)
    765 {
    766         struct hid_class_info *dev_info = arg;
    767 
    768         size_t index = 1;
    769 
    770         while (true) {
    771                 async_usleep(HOTPLUG_WATCH_INTERVAL);
    772                 char *path;
    773                 int rc = asprintf(&path, "/dev/class/%s\\%zu",
    774                     dev_info->classname, index);
    775                 if (rc < 0) {
    776                         continue;
    777                 }
    778                 rc = 0;
    779                 rc = dev_info->connection_func(path);
    780                 if (rc > 0) {
    781                         /* We do not allow unplug. */
    782                         index++;
    783                 }
    784 
    785                 free(path);
    786         }
    787 
    788         return EOK;
    789 }
    790 
    791 
    792 /** Start a fibril monitoring hot-plugged keyboards.
    793  */
    794 static void check_new_devices_in_background(int (*connection_func)(const char *),
    795     const char *classname)
    796 {
    797         struct hid_class_info *dev_info = malloc(sizeof(struct hid_class_info));
    798         if (dev_info == NULL) {
    799                 printf(NAME ": " \
    800                     "out of memory, will not start hot-plug-watch fibril.\n");
    801                 return;
    802         }
    803         int rc;
    804 
    805         rc = asprintf(&dev_info->classname, "%s", classname);
    806         if (rc < 0) {
    807                 printf(NAME ": failed to format classname: %s.\n",
    808                     str_error(rc));
    809                 return;
    810         }
    811         dev_info->connection_func = connection_func;
    812 
    813         fid_t fid = fibril_create(check_new_device_fibril, (void *)dev_info);
    814         if (!fid) {
    815                 printf(NAME
    816                     ": failed to create hot-plug-watch fibril for %s.\n",
    817                     classname);
    818                 return;
    819         }
    820         fibril_add_ready(fid);
    821 }
    822 
    823 static bool console_init(char *input)
    824 {
    825         /* Connect to input device */
    826         kbd_phone = connect_keyboard(input);
    827         if (kbd_phone < 0) {
    828724                return false;
    829725        }
    830 
    831         mouse_phone = connect_mouse("/dev/hid_in/mouse");
     726       
     727        /* NB: The callback connection is slotted for removal */
     728        if (async_connect_to_me(kbd_phone, SERVICE_CONSOLE, 0, 0, keyboard_events)
     729            != 0) {
     730                printf(NAME ": Failed to create callback from input device\n");
     731                return false;
     732        }
     733       
     734        /* Connect to mouse device */
     735        mouse_phone = -1;
     736        int mouse_fd = open("/dev/hid_in/mouse", O_RDONLY);
     737       
     738        if (mouse_fd < 0) {
     739                printf(NAME ": Notice - failed opening %s\n", "/dev/hid_in/mouse");
     740                goto skip_mouse;
     741        }
     742       
     743        mouse_phone = fd_phone(mouse_fd);
    832744        if (mouse_phone < 0) {
    833                 printf(NAME ": Failed to connect to mouse device: %s.\n",
    834                     str_error(mouse_phone));
    835         }
     745                printf(NAME ": Failed to connect to mouse device\n");
     746                goto skip_mouse;
     747        }
     748       
     749        if (async_connect_to_me(mouse_phone, SERVICE_CONSOLE, 0, 0, mouse_events)
     750            != 0) {
     751                printf(NAME ": Failed to create callback from mouse device\n");
     752                mouse_phone = -1;
     753                goto skip_mouse;
     754        }
     755       
     756skip_mouse:
    836757       
    837758        /* Connect to framebuffer driver */
     
    916837                printf(NAME ": Error registering kconsole notifications\n");
    917838       
    918         /* Start fibril for checking on hot-plugged keyboards. */
    919         check_new_devices_in_background(connect_keyboard, "keyboard");
    920         check_new_devices_in_background(connect_mouse, "mouse");
    921 
    922839        return true;
    923840}
     
    939856        if (!console_init(argv[1]))
    940857                return -1;
    941 
     858       
    942859        printf(NAME ": Accepting connections\n");
    943860        async_manager();
  • uspace/srv/hw/irc/apic/apic.c

    rb64eac6 r306061a  
    5454#define NAME  "apic"
    5555
    56 static bool apic_found = false;
    57 
    5856static int apic_enable_irq(sysarg_t irq)
    5957{
     
    8179                callid = async_get_call(&call);
    8280               
    83                 sysarg_t method = IPC_GET_IMETHOD(call);
    84                 if (method == IPC_M_PHONE_HUNGUP) {
    85                         return;
    86                 }
    87 
    88                 if (!apic_found) {
    89                         async_answer_0(callid, ENOTSUP);
    90                         break;
    91                 }
    92 
    93                 switch (method) {
     81                switch (IPC_GET_IMETHOD(call)) {
    9482                case IRC_ENABLE_INTERRUPT:
    9583                        async_answer_0(callid, apic_enable_irq(IPC_GET_ARG1(call)));
     
    10997 *
    11098 */
    111 static void apic_init(void)
     99static bool apic_init(void)
    112100{
    113101        sysarg_t apic;
    114102       
    115         apic_found = sysinfo_get_value("apic", &apic) && apic;
    116         if (!apic_found) {
    117                 printf(NAME ": Warning: no APIC found\n");
     103        if ((sysinfo_get_value("apic", &apic) != EOK) || (!apic)) {
     104                printf(NAME ": No APIC found\n");
     105                return false;
    118106        }
    119107       
    120108        async_set_client_connection(apic_connection);
    121109        service_register(SERVICE_APIC);
     110       
     111        return true;
    122112}
    123113
     
    126116        printf(NAME ": HelenOS APIC driver\n");
    127117       
    128         apic_init();
    129 
     118        if (!apic_init())
     119                return -1;
     120       
    130121        printf(NAME ": Accepting connections\n");
    131122        async_manager();
  • uspace/srv/net/tl/udp/udp.c

    rb64eac6 r306061a  
    740740        int socket_id;
    741741        size_t addrlen;
    742         size_t size = 0;
     742        size_t size;
    743743        ipc_call_t answer;
    744744        size_t answer_count;
Note: See TracChangeset for help on using the changeset viewer.