Changeset 8820544 in mainline for uspace/srv


Ignore:
Timestamp:
2014-08-16T00:02:04Z (11 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
35b8bfe, 8cd680c
Parents:
83f29e0
Message:

support for kernel notification multiplexing in the async framework

  • rename SYS_EVENT_* and SYS_IRQ_* syscalls to unify the terminology
  • add SYS_IPC_EVENT_UNSUBSCRIBE
  • remove IRQ handler multiplexing from DDF, the generic mechanism replaces it (unfortunatelly the order of arguments used by interrupt_handler_t needs to be permutated to align with the async framework conventions)
Location:
uspace/srv
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/hid/input/input.c

    r83f29e0 r8820544  
    5454#include <io/keycode.h>
    5555#include <loc.h>
    56 #include <event.h>
    5756#include <str_error.h>
    5857#include "layout.h"
     
    358357}
    359358
    360 static void kconsole_event_received(ipc_callid_t callid, ipc_call_t *call)
     359static void kconsole_event_handler(ipc_callid_t callid, ipc_call_t *call,
     360    void *arg)
    361361{
    362362        if (IPC_GET_ARG1(*call)) {
     
    772772       
    773773        /* Receive kernel notifications */
    774         async_set_interrupt_received(kconsole_event_received);
    775         rc = event_subscribe(EVENT_KCONSOLE, 0);
     774        rc = async_event_subscribe(EVENT_KCONSOLE, kconsole_event_handler, NULL);
    776775        if (rc != EOK)
    777776                printf("%s: Failed to register kconsole notifications (%s)\n",
  • uspace/srv/hid/input/port/msim.c

    r83f29e0 r8820544  
    7878};
    7979
    80 static void msim_irq_handler(ipc_callid_t iid, ipc_call_t *call);
     80static void msim_irq_handler(ipc_callid_t iid, ipc_call_t *call, void *arg)
     81{
     82        kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
     83}
    8184
    8285static int msim_port_init(kbd_dev_t *kdev)
     
    9497        msim_ranges[0].base = paddr;
    9598        msim_cmds[0].addr = (void *) paddr;
    96         async_set_interrupt_received(msim_irq_handler);
    97         irq_register(inr, device_assign_devno(), 0, &msim_kbd);
     99        async_irq_subscribe(inr, device_assign_devno(), msim_irq_handler, NULL,
     100            &msim_kbd);
    98101       
    99102        return 0;
     
    105108}
    106109
    107 static void msim_irq_handler(ipc_callid_t iid, ipc_call_t *call)
    108 {
    109         kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
    110 }
    111 
    112110/** @}
    113111 */
  • uspace/srv/hid/input/port/ns16550.c

    r83f29e0 r8820544  
    107107};
    108108
    109 static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call);
     109static uintptr_t ns16550_physical;
     110static kbd_dev_t *kbd_dev;
     111static sysarg_t inr;
    110112
    111 static uintptr_t ns16550_physical;
    112 
    113 static kbd_dev_t *kbd_dev;
     113static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call, void *arg)
     114{
     115        kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
     116       
     117        if (irc_service) {
     118                async_exch_t *exch = async_exchange_begin(irc_sess);
     119                async_msg_1(exch, IRC_CLEAR_INTERRUPT, inr);
     120                async_exchange_end(exch);
     121        }
     122}
    114123
    115124static int ns16550_port_init(kbd_dev_t *kdev)
    116125{
    117         void *vaddr;
    118        
    119126        kbd_dev = kdev;
    120127       
     
    128135                return -1;
    129136       
    130         sysarg_t inr;
    131137        if (sysinfo_get_value("kbd.inr", &inr) != EOK)
    132138                return -1;
     
    136142        ns16550_kbd.cmds[3].addr = (void *) (ns16550_physical + RBR_REG);
    137143       
    138         async_set_interrupt_received(ns16550_irq_handler);
    139         irq_register(inr, device_assign_devno(), inr, &ns16550_kbd);
     144        async_irq_subscribe(inr, device_assign_devno(), ns16550_irq_handler, NULL,
     145            &ns16550_kbd);
    140146       
     147        void *vaddr;
    141148        return pio_enable((void *) ns16550_physical, 8, &vaddr);
    142149}
     
    147154}
    148155
    149 static void ns16550_irq_handler(ipc_callid_t iid, ipc_call_t *call)
    150 {
    151         kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
    152        
    153         if (irc_service) {
    154                 async_exch_t *exch = async_exchange_begin(irc_sess);
    155                 async_msg_1(exch, IRC_CLEAR_INTERRUPT, IPC_GET_IMETHOD(*call));
    156                 async_exchange_end(exch);
    157         }
    158 }
    159 
    160156/**
    161157 * @}
  • uspace/srv/hid/input/port/pl050.c

    r83f29e0 r8820544  
    101101};
    102102
    103 static void pl050_irq_handler(ipc_callid_t iid, ipc_call_t *call);
     103static void pl050_irq_handler(ipc_callid_t iid, ipc_call_t *call, void *arg)
     104{
     105        kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
     106}
    104107
    105108static int pl050_port_init(kbd_dev_t *kdev)
     
    119122                return -1;
    120123       
    121         async_set_interrupt_received(pl050_irq_handler);
    122         irq_register(inr, device_assign_devno(), 0, &pl050_kbd);
     124        async_irq_subscribe(inr, device_assign_devno(), pl050_irq_handler, NULL,
     125            &pl050_kbd);
    123126       
    124127        return 0;
     
    130133}
    131134
    132 static void pl050_irq_handler(ipc_callid_t iid, ipc_call_t *call)
    133 {
    134         kbd_push_data(kbd_dev, IPC_GET_ARG2(*call));
    135 }
    136 
    137135/**
    138136 * @}
  • uspace/srv/hid/remcons/remcons.c

    r83f29e0 r8820544  
    4040#include <str_error.h>
    4141#include <loc.h>
    42 #include <event.h>
    4342#include <io/keycode.h>
    4443#include <align.h>
  • uspace/srv/hid/remcons/user.c

    r83f29e0 r8820544  
    3838#include <str_error.h>
    3939#include <loc.h>
    40 #include <event.h>
    4140#include <io/keycode.h>
    4241#include <align.h>
  • uspace/srv/hid/s3c24xx_ts/s3c24xx_ts.c

    r83f29e0 r8820544  
    7272static void s3c24xx_ts_connection(ipc_callid_t iid, ipc_call_t *icall,
    7373    void *arg);
    74 static void s3c24xx_ts_irq_handler(ipc_callid_t iid, ipc_call_t *call);
     74static void s3c24xx_ts_irq_handler(ipc_callid_t iid, ipc_call_t *call, void *);
    7575static void s3c24xx_ts_pen_down(s3c24xx_ts_t *ts);
    7676static void s3c24xx_ts_pen_up(s3c24xx_ts_t *ts);
     
    138138            (void *) ts->paddr, inr);
    139139
    140         async_set_interrupt_received(s3c24xx_ts_irq_handler);
    141         irq_register(inr, device_assign_devno(), 0, &ts_irq_code);
     140        async_irq_subscribe(inr, device_assign_devno(), s3c24xx_ts_irq_handler,
     141            NULL, &ts_irq_code);
    142142
    143143        s3c24xx_ts_wait_for_int_mode(ts, updn_down);
     
    204204
    205205/** Handle touchscreen interrupt */
    206 static void s3c24xx_ts_irq_handler(ipc_callid_t iid, ipc_call_t *call)
     206static void s3c24xx_ts_irq_handler(ipc_callid_t iid, ipc_call_t *call,
     207    void *arg)
    207208{
    208209        ts_updn_t updn;
  • uspace/srv/hw/bus/cuda_adb/cuda_adb.c

    r83f29e0 r8820544  
    5555static void cuda_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg);
    5656static int cuda_init(void);
    57 static void cuda_irq_handler(ipc_callid_t iid, ipc_call_t *call);
     57static void cuda_irq_handler(ipc_callid_t iid, ipc_call_t *call, void *arg);
    5858
    5959static void cuda_irq_listen(void);
     
    282282        cuda_irq_code.ranges[0].base = (uintptr_t) instance->cuda_physical;
    283283        cuda_irq_code.cmds[0].addr = (void *) &((cuda_t *) instance->cuda_physical)->ifr;
    284         async_set_interrupt_received(cuda_irq_handler);
    285         irq_register(10, device_assign_devno(), 0, &cuda_irq_code);
     284        async_irq_subscribe(10, device_assign_devno(), cuda_irq_handler, NULL,
     285            &cuda_irq_code);
    286286
    287287        /* Enable SR interrupt. */
     
    295295}
    296296
    297 static void cuda_irq_handler(ipc_callid_t iid, ipc_call_t *call)
     297static void cuda_irq_handler(ipc_callid_t iid, ipc_call_t *call, void *arg)
    298298{
    299299        uint8_t rbuf[CUDA_RCV_BUF_SIZE];
  • uspace/srv/hw/char/s3c24xx_uart/s3c24xx_uart.c

    r83f29e0 r8820544  
    6868static s3c24xx_uart_t *uart;
    6969
    70 static void s3c24xx_uart_connection(ipc_callid_t iid, ipc_call_t *icall,
    71     void *arg);
    72 static void s3c24xx_uart_irq_handler(ipc_callid_t iid, ipc_call_t *call);
    73 static int s3c24xx_uart_init(s3c24xx_uart_t *uart);
    74 static void s3c24xx_uart_sendb(s3c24xx_uart_t *uart, uint8_t byte);
     70static void s3c24xx_uart_connection(ipc_callid_t, ipc_call_t *, void *);
     71static void s3c24xx_uart_irq_handler(ipc_callid_t, ipc_call_t *, void *);
     72static int s3c24xx_uart_init(s3c24xx_uart_t *);
     73static void s3c24xx_uart_sendb(s3c24xx_uart_t *, uint8_t);
    7574
    7675int main(int argc, char *argv[])
     
    150149}
    151150
    152 static void s3c24xx_uart_irq_handler(ipc_callid_t iid, ipc_call_t *call)
    153 {
    154         (void) iid; (void) call;
     151static void s3c24xx_uart_irq_handler(ipc_callid_t iid, ipc_call_t *call,
     152    void *arg)
     153{
     154        (void) iid;
     155        (void) call;
     156        (void) arg;
    155157
    156158        while ((pio_read_32(&uart->io->ufstat) & S3C24XX_UFSTAT_RX_COUNT) != 0) {
     
    192194            (void *) uart->paddr, inr);
    193195
    194         async_set_interrupt_received(s3c24xx_uart_irq_handler);
    195 
    196         irq_register(inr, device_assign_devno(), 0, &uart_irq_code);
     196        async_irq_subscribe(inr, device_assign_devno(), s3c24xx_uart_irq_handler,
     197            NULL, &uart_irq_code);
    197198
    198199        /* Enable FIFO, Tx trigger level: empty, Rx trigger level: 1 byte. */
  • uspace/srv/klog/klog.c

    r83f29e0 r8820544  
    4040#include <as.h>
    4141#include <ddi.h>
    42 #include <event.h>
    4342#include <errno.h>
    4443#include <str_error.h>
     
    193192 *
    194193 */
    195 static void notification_received(ipc_callid_t callid, ipc_call_t *call)
     194static void klog_notification_received(ipc_callid_t callid, ipc_call_t *call,
     195    void *arg)
    196196{
    197197        /*
     
    205205        producer();
    206206       
    207         event_unmask(EVENT_KLOG);
     207        async_event_unmask(EVENT_KLOG);
    208208        fibril_mutex_unlock(&mtx);
    209209}
     
    229229       
    230230        prodcons_initialize(&pc);
    231         async_set_interrupt_received(notification_received);
    232         rc = event_subscribe(EVENT_KLOG, 0);
     231        rc = async_event_subscribe(EVENT_KLOG, klog_notification_received, NULL);
    233232        if (rc != EOK) {
    234233                log_msg(LOG_DEFAULT, LVL_ERROR,
     
    245244       
    246245        fibril_add_ready(fid);
    247         event_unmask(EVENT_KLOG);
     246        async_event_unmask(EVENT_KLOG);
    248247       
    249248        fibril_mutex_lock(&mtx);
  • uspace/srv/taskmon/taskmon.c

    r83f29e0 r8820544  
    4040#include <sys/typefmt.h>
    4141#include <task.h>
    42 #include <event.h>
    4342#include <ipc/corecfg.h>
    4443#include <loc.h>
     
    5352static void corecfg_client_conn(ipc_callid_t , ipc_call_t *, void *);
    5453
    55 static void fault_event(ipc_callid_t callid, ipc_call_t *call)
     54static void fault_event(ipc_callid_t callid, ipc_call_t *call, void *arg)
    5655{
    5756        const char *fname;
     
    143142        write_core_files = false;
    144143#endif
    145         if (event_subscribe(EVENT_FAULT, 0) != EOK) {
     144        if (async_event_subscribe(EVENT_FAULT, fault_event, NULL) != EOK) {
    146145                printf("%s: Error registering fault notifications.\n", NAME);
    147146                return -1;
     
    165164        }
    166165       
    167         async_set_interrupt_received(fault_event);
    168166        task_retval(0);
    169167        async_manager();
  • uspace/srv/vfs/vfs.c

    r83f29e0 r8820544  
    3838#include <vfs/vfs.h>
    3939#include <ipc/services.h>
    40 #include <abi/ipc/event.h>
    41 #include <event.h>
    4240#include <ns.h>
    4341#include <async.h>
     
    5351#define NAME  "vfs"
    5452
    55 enum {
    56         VFS_TASK_STATE_CHANGE
    57 };
    58 
    5953static void vfs_connection(ipc_callid_t iid, ipc_call_t *icall, void *arg)
    6054{
     
    145139}
    146140
    147 static void notification_received(ipc_callid_t callid, ipc_call_t *call)
     141static void notification_handler(ipc_callid_t callid, ipc_call_t *call, void *arg)
    148142{
    149         switch (IPC_GET_IMETHOD(*call)) {
    150         case VFS_TASK_STATE_CHANGE:
    151                 if (IPC_GET_ARG1(*call) == VFS_PASS_HANDLE)
    152                         vfs_pass_handle(
    153                             (task_id_t) MERGE_LOUP32(IPC_GET_ARG4(*call),
    154                             IPC_GET_ARG5(*call)), call->in_task_id,
    155                             (int) IPC_GET_ARG2(*call));
    156                 break;
    157         default:
    158                 break;
    159         }
     143        if (IPC_GET_ARG1(*call) == VFS_PASS_HANDLE)
     144                vfs_pass_handle(
     145                    (task_id_t) MERGE_LOUP32(IPC_GET_ARG4(*call),
     146                    IPC_GET_ARG5(*call)), call->in_task_id,
     147                    (int) IPC_GET_ARG2(*call));
    160148}
    161149
     
    196184
    197185        /*
    198          * Set notification handler and subscribe to notifications.
    199          */
    200         async_set_interrupt_received(notification_received);
    201         event_task_subscribe(EVENT_TASK_STATE_CHANGE, VFS_TASK_STATE_CHANGE);
     186         * Subscribe to notifications.
     187         */
     188        async_event_task_subscribe(EVENT_TASK_STATE_CHANGE, notification_handler,
     189            NULL);
    202190       
    203191        /*
Note: See TracChangeset for help on using the changeset viewer.