Changeset 2b017ba in mainline


Ignore:
Timestamp:
2006-10-16T20:51:55Z (18 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5f9b4d9a
Parents:
e3890b3f
Message:

Replace the old IRQ dispatcher and IPC notifier with new implementation.
Note that all architectures except for sparc64 are now broken
and don't even compile.

Files:
18 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/sparc64/src/trap/interrupt.c

    re3890b3f r2b017ba  
    4040#include <arch/types.h>
    4141#include <debug.h>
    42 #include <ipc/sysipc.h>
    4342#include <arch/asm.h>
    4443#include <arch/barrier.h>
     
    4847#include <config.h>
    4948#include <synch/spinlock.h>
    50 
    51 /*
    52  * To be removed once we get rid of the dependency in ipc_irq_bind_arch().
    53  */
    54 #include <arch/drivers/kbd.h>
    55 #include <genarch/kbd/z8530.h>
    5649
    5750/** Register Interrupt Level Handler.
     
    6659       
    6760        exc_register(n - 1, name, f);
    68 }
    69 
    70 /* Reregister irq to be IPC-ready */
    71 void irq_ipc_bind_arch(unative_t irq)
    72 {
    73 #ifdef CONFIG_Z8530
    74         if (kbd_type == KBD_Z8530)
    75                 z8530_belongs_to_kernel = false;
    76 #endif
    7761}
    7862
  • kernel/genarch/src/kbd/z8530.c

    re3890b3f r2b017ba  
    4141#include <arch/drivers/z8530.h>
    4242#include <ddi/irq.h>
     43#include <ipc/irq.h>
    4344#include <arch/interrupt.h>
    4445#include <arch/drivers/kbd.h>
     
    5960#define IGNORE_CODE     0x7f            /* all keys up */
    6061
    61 bool z8530_belongs_to_kernel = true;
    62 
    6362static z8530_t z8530;           /**< z8530 device structure. */
    6463static irq_t z8530_irq;         /**< z8530's IRQ. */
     
    7372};
    7473
    75 void z8530_wait(void);
    76 
    77 /** Initialize keyboard and service interrupts using kernel routine */
     74/** Initialize keyboard and service interrupts using kernel routine. */
    7875void z8530_grab(void)
    7976{
    80         z8530_belongs_to_kernel = true;
    81 }
    82 
    83 /** Resume the former interrupt vector */
     77}
     78
     79/** Resume the former IPC notification behavior. */
    8480void z8530_release(void)
    8581{
    86         z8530_belongs_to_kernel = false;
    8782}
    8883
     
    132127{
    133128        z8530_poll();
    134 }
    135 
    136 /** Wait until the controller reads its data. */
    137 void z8530_wait(void) {
    138129}
    139130
     
    195186        /*
    196187         * So far, we know we got this interrupt through the FHC.
    197          * Since we don't have enough information about the FHC and
    198          * because the interrupt looks like level sensitive,
     188         * Since we don't have enough documentation about the FHC
     189         * and because the interrupt looks like level sensitive,
    199190         * we cannot handle it by scheduling one of the level
    200191         * interrupt traps. Process the interrupt directly.
    201192         */
    202         if (z8530_belongs_to_kernel)
     193        if (irq->notif_cfg.answerbox)
     194                ipc_irq_send_notif(irq);
     195        else
    203196                z8530_interrupt();
    204         else
    205                 ipc_irq_send_notif(0);
    206197        fhc_clear_interrupt(central_fhc, irq->inr);
    207198}
  • kernel/generic/include/ddi/irq.h

    re3890b3f r2b017ba  
    3737
    3838#include <arch/types.h>
     39#include <typedefs.h>
    3940#include <adt/list.h>
    40 #include <ipc/ipc.h>
    4141#include <ipc/irq.h>
    42 #include <atomic.h>
    4342#include <synch/spinlock.h>
    4443
     
    5251        IRQ_TRIGGER_EDGE
    5352} irq_trigger_t;
    54 
    55 typedef struct irq irq_t;
    5653
    5754typedef void (* irq_handler_t)(irq_t *irq, void *arg, ...);
     
    8885        void *arg;
    8986
    90         /** Answerbox of the task that wanted to be notified. */
    91         answerbox_t *notif_answerbox;
    92         /** Pseudo-code to be performed by the top-half
    93          *  before a notification is sent. */
    94         irq_code_t *code;
    95         /** Method of the notification. */
    96         unative_t method;
    97         /** Counter of IRQ notifications. */
    98         atomic_t counter;
     87        /** Notification configuration structure. */
     88        ipc_notif_cfg_t notif_cfg;
    9989};
    10090
  • kernel/generic/include/ipc/ipc.h

    re3890b3f r2b017ba  
    156156#ifdef KERNEL
    157157
    158 #include <synch/mutex.h>
    159 #include <synch/condvar.h>
     158#include <synch/waitq.h>
    160159#include <adt/list.h>
    161160
  • kernel/generic/include/ipc/irq.h

    re3890b3f r2b017ba  
    3939#define IRQ_MAX_PROG_SIZE 10
    4040
    41 /** Reserved 'virtual' messages for kernel notifications */
    42 #define IPC_IRQ_RESERVED_VIRTUAL 10
    43 
    44 #define IPC_IRQ_KLOG       (-1)
    45 #define IPC_IRQ_KBDRESTART (-2)
     41#define VIRT_INR_KLOG           -2
     42#define VIRT_INR_KBDRESTART     -3
    4643
    4744typedef enum {
     
    7673
    7774#include <ipc/ipc.h>
     75#include <typedefs.h>
     76#include <arch/types.h>
    7877
    79 extern void ipc_irq_make_table(int irqcount);
    80 extern int ipc_irq_register(answerbox_t *box, int irq, irq_code_t *ucode);
    81 extern void ipc_irq_send_notif(int irq);
    82 extern void ipc_irq_send_msg(int irq, unative_t a1, unative_t a2, unative_t a3);
    83 extern void ipc_irq_unregister(answerbox_t *box, int irq);
    84 extern void irq_ipc_bind_arch(unative_t irq);
     78/** IPC notification config structure.
     79 *
     80 * Primarily, this structure is encapsulated in the irq_t structure.
     81 * It is protected by irq_t::lock.
     82 */
     83struct ipc_notif_cfg {
     84        answerbox_t *answerbox;         /**< Answerbox for notifications. */
     85        unative_t method;               /**< Method to be used for the notification. */
     86        irq_code_t *code;               /**< Top-half pseudocode. */
     87        count_t counter;                /**< Counter. */
     88};
     89
     90extern int ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method,
     91        irq_code_t *ucode);
     92extern void ipc_irq_send_notif(irq_t *irq);
     93extern void ipc_irq_send_msg(irq_t *irq, unative_t a1, unative_t a2, unative_t a3);
     94extern void ipc_irq_unregister(answerbox_t *box, inr_t inr, devno_t devno);
    8595extern void ipc_irq_cleanup(answerbox_t *box);
    8696
  • kernel/generic/include/ipc/sysipc.h

    re3890b3f r2b017ba  
    3939#include <ipc/irq.h>
    4040#include <arch/types.h>
     41#include <typedefs.h>
    4142
    4243unative_t sys_ipc_call_sync_fast(unative_t phoneid, unative_t method,
     
    5455                              unative_t method, unative_t arg1);
    5556unative_t sys_ipc_hangup(int phoneid);
    56 unative_t sys_ipc_register_irq(int irq, irq_code_t *ucode);
    57 unative_t sys_ipc_unregister_irq(int irq);
     57unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode);
     58unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno);
    5859
    5960#endif
  • kernel/generic/include/typedefs.h

    re3890b3f r2b017ba  
    9898typedef signed int inr_t;
    9999typedef signed int devno_t;
     100typedef struct irq irq_t;
     101typedef struct ipc_notif_cfg ipc_notif_cfg_t;
    100102
    101103#endif
  • kernel/generic/src/console/cmd.c

    re3890b3f r2b017ba  
    803803        printf("Use userspace controls to redraw the screen.\n");
    804804        arch_release_console();
    805         ipc_irq_send_msg(IPC_IRQ_KBDRESTART, 0, 0, 0);
     805        /* TODO: send some vitual IRQ */
     806        ipc_irq_send_msg(NULL, 0, 0, 0);
    806807        return 1;
    807808}
  • kernel/generic/src/console/klog.c

    re3890b3f r2b017ba  
    3737#include <console/klog.h>
    3838#include <print.h>
     39#include <ddi/device.h>
     40#include <ddi/irq.h>
    3941#include <ipc/irq.h>
    4042
    4143/* Order of frame to be allocated for klog communication */
    42 #define KLOG_ORDER 0
     44#define KLOG_ORDER      0
    4345
    4446static char *klog;
     
    4749
    4850SPINLOCK_INITIALIZE(klog_lock);
     51
     52static irq_t klog_irq;
     53
     54static irq_ownership_t klog_claim(void);
    4955
    5056/** Initialize kernel logging facility
     
    6470        klog = (char *)PA2KA(faddr);
    6571       
     72        devno_t devno = device_assign_devno();
     73       
    6674        sysinfo_set_item_val("klog.faddr", NULL, (unative_t)faddr);
    6775        sysinfo_set_item_val("klog.pages", NULL, 1 << KLOG_ORDER);
     76        sysinfo_set_item_val("klog.devno", NULL, devno);
     77        sysinfo_set_item_val("klog.inr", NULL, VIRT_INR_KLOG);
     78
     79        irq_initialize(&klog_irq);
     80        klog_irq.devno = devno;
     81        klog_irq.inr = VIRT_INR_KLOG;
     82        klog_irq.claim = klog_claim;
     83        irq_register(&klog_irq);
    6884
    6985        klogsize = PAGE_SIZE << KLOG_ORDER;
    7086        klogpos = 0;
     87}
     88
     89/** Allways refuse IRQ ownership.
     90 *
     91 * This is not a real IRQ, so we always decline.
     92 *
     93 * @return Always returns IRQ_DECLINE.
     94 */
     95irq_ownership_t klog_claim(void)
     96{
     97        return IRQ_DECLINE;
    7198}
    7299
     
    85112                        goto out;
    86113        }
    87         ipc_irq_send_msg(IPC_IRQ_KLOG, klogpos, ret, 0);
     114        ipc_irq_send_msg(&klog_irq, klogpos, ret, 0);
    88115        klogpos += ret;
    89116        if (klogpos >= klogsize)
  • kernel/generic/src/ddi/irq.c

    re3890b3f r2b017ba  
    7272#include <typedefs.h>
    7373#include <synch/spinlock.h>
    74 #include <atomic.h>
    7574#include <arch.h>
    7675
     
    147146        irq->handler = NULL;
    148147        irq->arg = NULL;
    149         irq->notif_answerbox = NULL;
    150         irq->code = NULL;
    151         irq->method = 0;
    152         atomic_set(&irq->counter, 0);
     148        irq->notif_cfg.answerbox = NULL;
     149        irq->notif_cfg.code = NULL;
     150        irq->notif_cfg.method = 0;
     151        irq->notif_cfg.counter = 0;
    153152}
    154153
  • kernel/generic/src/ipc/ipc.c

    re3890b3f r2b017ba  
    441441
    442442
    443 /** Initilize ipc subsystem */
     443/** Initilize IPC subsystem */
    444444void ipc_init(void)
    445445{
    446         ipc_call_slab = slab_cache_create("ipc_call",
    447                                           sizeof(call_t),
    448                                           0,
    449                                           NULL, NULL, 0);
    450         ipc_irq_make_table(IRQ_COUNT);
     446        ipc_call_slab = slab_cache_create("ipc_call", sizeof(call_t), 0, NULL, NULL, 0);
    451447}
    452448
  • kernel/generic/src/ipc/irq.c

    re3890b3f r2b017ba  
    11/*
    22 * Copyright (C) 2006 Ondrej Palkovsky
     3 * Copyright (C) 2006 Jakub Jermar
    34 * All rights reserved.
    45 *
     
    4041 *
    4142 * The structure of a notification message is as follows:
    42  * - METHOD: interrupt number
     43 * - METHOD: method as registered by the SYS_IPC_REGISTER_IRQ syscall
    4344 * - ARG1: payload modified by a 'top-half' handler
    44  * - ARG2: payload
    45  * - ARG3: payload
     45 * - ARG2: payload modified by a 'top-half' handler
     46 * - ARG3: payload modified by a 'top-half' handler
    4647 * - in_phone_hash: interrupt counter (may be needed to assure correct order
    4748 *         in multithreaded drivers)
     
    5152#include <mm/slab.h>
    5253#include <errno.h>
     54#include <ddi/irq.h>
    5355#include <ipc/ipc.h>
    5456#include <ipc/irq.h>
    55 #include <atomic.h>
    5657#include <syscall/copy.h>
    5758#include <console/console.h>
    5859#include <print.h>
    5960
    60 typedef struct {
    61         SPINLOCK_DECLARE(lock);
    62         answerbox_t *box;
    63         irq_code_t *code;
    64         atomic_t counter;
    65 } ipc_irq_t;
    66 
    67 
    68 static ipc_irq_t *irq_conns = NULL;
    69 static int irq_conns_size;
    70 
    71 
    72 /* Execute code associated with IRQ notification */
     61/** Execute code associated with IRQ notification.
     62 *
     63 * @param call Notification call.
     64 * @param code Top-half pseudocode.
     65 */
    7366static void code_execute(call_t *call, irq_code_t *code)
    7467{
     
    169162}
    170163
    171 /** Unregister task from irq */
    172 void ipc_irq_unregister(answerbox_t *box, int irq)
     164/** Unregister task from IRQ notification.
     165 *
     166 * @param box Answerbox associated with the notification.
     167 * @param inr IRQ numbe.
     168 * @param devno Device number.
     169 */
     170void ipc_irq_unregister(answerbox_t *box, inr_t inr, devno_t devno)
    173171{
    174172        ipl_t ipl;
    175         int mq = irq + IPC_IRQ_RESERVED_VIRTUAL;
     173        irq_t *irq;
    176174
    177175        ipl = interrupts_disable();
    178         spinlock_lock(&irq_conns[mq].lock);
    179         if (irq_conns[mq].box == box) {
    180                 irq_conns[mq].box = NULL;
    181                 code_free(irq_conns[mq].code);
    182                 irq_conns[mq].code = NULL;
    183         }
    184 
    185         spinlock_unlock(&irq_conns[mq].lock);
     176        irq = irq_find_and_lock(inr, devno);
     177        if (irq) {
     178                if (irq->notif_cfg.answerbox == box) {
     179                        code_free(irq->notif_cfg.code);
     180                        irq->notif_cfg.code = NULL;
     181                        irq->notif_cfg.answerbox = NULL;
     182                        irq->notif_cfg.method = 0;
     183                        irq->notif_cfg.counter = 0;
     184                        spinlock_unlock(&irq->lock);
     185                }
     186        }
    186187        interrupts_restore(ipl);
    187188}
    188189
    189 /** Register an answerbox as a receiving end of interrupts notifications */
    190 int ipc_irq_register(answerbox_t *box, int irq, irq_code_t *ucode)
     190/** Register an answerbox as a receiving end for IRQ notifications.
     191 *
     192 * @param box Receiving answerbox.
     193 * @param inr IRQ number.
     194 * @param devno Device number.
     195 * @param method Method to be associated with the notification.
     196 * @param ucode Uspace pointer to top-half pseudocode.
     197 *
     198 * @return EBADMEM, ENOENT or EEXISTS on failure or 0 on success.
     199 */
     200int
     201ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode)
    191202{
    192203        ipl_t ipl;
    193204        irq_code_t *code;
    194         int mq = irq + IPC_IRQ_RESERVED_VIRTUAL;
    195 
    196         ASSERT(irq_conns);
     205        irq_t *irq;
    197206
    198207        if (ucode) {
     
    204213
    205214        ipl = interrupts_disable();
    206         spinlock_lock(&irq_conns[mq].lock);
    207 
    208         if (irq_conns[mq].box) {
    209                 spinlock_unlock(&irq_conns[mq].lock);
     215        irq = irq_find_and_lock(inr, devno);
     216        if (!irq) {
     217                interrupts_restore(ipl);
     218                code_free(code);
     219                return ENOENT;
     220        }
     221       
     222        if (irq->notif_cfg.answerbox) {
     223                spinlock_unlock(&irq->lock);
    210224                interrupts_restore(ipl);
    211225                code_free(code);
    212226                return EEXISTS;
    213227        }
    214         irq_conns[mq].box = box;
    215         irq_conns[mq].code = code;
    216         atomic_set(&irq_conns[mq].counter, 0);
    217         spinlock_unlock(&irq_conns[mq].lock);
     228       
     229        irq->notif_cfg.answerbox = box;
     230        irq->notif_cfg.method = method;
     231        irq->notif_cfg.code = code;
     232        irq->notif_cfg.counter = 0;
     233        spinlock_unlock(&irq->lock);
    218234        interrupts_restore(ipl);
    219235
     
    221237}
    222238
    223 /** Add call to proper answerbox queue
    224  *
    225  * Assume irq_conns[mq].lock is locked */
    226 static void send_call(int mq, call_t *call)
    227 {
    228         spinlock_lock(&irq_conns[mq].box->irq_lock);
    229         list_append(&call->link, &irq_conns[mq].box->irq_notifs);
    230         spinlock_unlock(&irq_conns[mq].box->irq_lock);
     239/** Add call to proper answerbox queue.
     240 *
     241 * Assume irq->lock is locked.
     242 *
     243 */
     244static void send_call(irq_t *irq, call_t *call)
     245{
     246        spinlock_lock(&irq->notif_cfg.answerbox->irq_lock);
     247        list_append(&call->link, &irq->notif_cfg.answerbox->irq_notifs);
     248        spinlock_unlock(&irq->notif_cfg.answerbox->irq_lock);
    231249               
    232         waitq_wakeup(&irq_conns[mq].box->wq, 0);
     250        waitq_wakeup(&irq->notif_cfg.answerbox->wq, WAKEUP_FIRST);
    233251}
    234252
     
    236254 *
    237255 */
    238 void ipc_irq_send_msg(int irq, unative_t a1, unative_t a2, unative_t a3)
     256void ipc_irq_send_msg(irq_t *irq, unative_t a1, unative_t a2, unative_t a3)
    239257{
    240258        call_t *call;
    241         int mq = irq + IPC_IRQ_RESERVED_VIRTUAL;
    242 
    243         spinlock_lock(&irq_conns[mq].lock);
    244 
    245         if (irq_conns[mq].box) {
     259
     260        spinlock_lock(&irq->lock);
     261
     262        if (irq->notif_cfg.answerbox) {
    246263                call = ipc_call_alloc(FRAME_ATOMIC);
    247264                if (!call) {
    248                         spinlock_unlock(&irq_conns[mq].lock);
     265                        spinlock_unlock(&irq->lock);
    249266                        return;
    250267                }
    251268                call->flags |= IPC_CALL_NOTIF;
    252                 IPC_SET_METHOD(call->data, irq);
     269                IPC_SET_METHOD(call->data, irq->notif_cfg.method);
    253270                IPC_SET_ARG1(call->data, a1);
    254271                IPC_SET_ARG2(call->data, a2);
    255272                IPC_SET_ARG3(call->data, a3);
    256273                /* Put a counter to the message */
    257                 call->private = atomic_preinc(&irq_conns[mq].counter);
     274                call->private = ++irq->notif_cfg.counter;
    258275               
    259                 send_call(mq, call);
    260         }
    261         spinlock_unlock(&irq_conns[mq].lock);
     276                send_call(irq, call);
     277        }
     278        spinlock_unlock(&irq->lock);
    262279}
    263280
    264281/** Notify task that an irq had occurred.
    265282 *
    266  * We expect interrupts to be disabled
    267  */
    268 void ipc_irq_send_notif(int irq)
     283 * We expect interrupts to be disabled and the irq->lock already held.
     284 */
     285void ipc_irq_send_notif(irq_t *irq)
    269286{
    270287        call_t *call;
    271         int mq = irq + IPC_IRQ_RESERVED_VIRTUAL;
    272 
    273         ASSERT(irq_conns);
    274         spinlock_lock(&irq_conns[mq].lock);
    275 
    276         if (irq_conns[mq].box) {
     288
     289        ASSERT(irq);
     290
     291        if (irq->notif_cfg.answerbox) {
    277292                call = ipc_call_alloc(FRAME_ATOMIC);
    278293                if (!call) {
    279                         spinlock_unlock(&irq_conns[mq].lock);
    280294                        return;
    281295                }
    282296                call->flags |= IPC_CALL_NOTIF;
    283297                /* Put a counter to the message */
    284                 call->private = atomic_preinc(&irq_conns[mq].counter);
     298                call->private = ++irq->notif_cfg.counter;
    285299                /* Set up args */
    286                 IPC_SET_METHOD(call->data, irq);
     300                IPC_SET_METHOD(call->data, irq->notif_cfg.method);
    287301
    288302                /* Execute code to handle irq */
    289                 code_execute(call, irq_conns[mq].code);
     303                code_execute(call, irq->notif_cfg.code);
    290304               
    291                 send_call(mq, call);
    292         }
    293                
    294         spinlock_unlock(&irq_conns[mq].lock);
    295 }
    296 
    297 
    298 /** Initialize table of interrupt handlers
    299  *
    300  * @param irqcount Count of required hardware IRQs to be supported
    301  */
    302 void ipc_irq_make_table(int irqcount)
    303 {
    304         int i;
    305 
    306         irqcount +=  IPC_IRQ_RESERVED_VIRTUAL;
    307 
    308         irq_conns_size = irqcount;
    309         irq_conns = malloc(irqcount * (sizeof(*irq_conns)), 0);
    310         for (i=0; i < irqcount; i++) {
    311                 spinlock_initialize(&irq_conns[i].lock, "irq_ipc_lock");
    312                 irq_conns[i].box = NULL;
    313                 irq_conns[i].code = NULL;
    314         }
    315 }
    316 
    317 /** Disconnect all irq's notifications
    318  *
    319  * @todo It may be better to do some linked list, so that
    320  *       we wouldn't need to go through whole array every cleanup
     305                send_call(irq, call);
     306        }
     307}
     308
     309/** Disconnect all IRQ notifications from an answerbox.
     310 *
     311 * @param box Answerbox for which we want to carry out the cleanup.
    321312 */
    322313void ipc_irq_cleanup(answerbox_t *box)
    323314{
    324         int i;
    325         ipl_t ipl;
    326        
    327         for (i=0; i < irq_conns_size; i++) {
    328                 ipl = interrupts_disable();
    329                 spinlock_lock(&irq_conns[i].lock);
    330                 if (irq_conns[i].box == box)
    331                         irq_conns[i].box = NULL;
    332                 spinlock_unlock(&irq_conns[i].lock);
    333                 interrupts_restore(ipl);
    334         }
     315        /* TODO */
    335316}
    336317
  • kernel/generic/src/ipc/sysipc.c

    re3890b3f r2b017ba  
    566566}
    567567
    568 /** Connect irq handler to task */
    569 unative_t sys_ipc_register_irq(int irq, irq_code_t *ucode)
     568/** Connect irq handler to task.
     569 *
     570 * @param inr IRQ number.
     571 * @param devno Device number.
     572 * @param method Method to be associated with the notification.
     573 * @param ucode Uspace pointer to the top-half pseudocode.
     574 *
     575 * @return EPERM or a return code returned by ipc_irq_register().
     576 */
     577unative_t sys_ipc_register_irq(inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode)
    570578{
    571579        if (!(cap_get(TASK) & CAP_IRQ_REG))
    572580                return EPERM;
    573581
    574         if (irq >= IRQ_COUNT || irq <= -IPC_IRQ_RESERVED_VIRTUAL)
    575                 return (unative_t) ELIMIT;
    576        
    577         irq_ipc_bind_arch(irq);
    578 
    579         return ipc_irq_register(&TASK->answerbox, irq, ucode);
    580 }
    581 
    582 /* Disconnect irq handler from task */
    583 unative_t sys_ipc_unregister_irq(int irq)
     582        return ipc_irq_register(&TASK->answerbox, inr, devno, method, ucode);
     583}
     584
     585/** Disconnect irq handler from task.
     586 *
     587 * @param inr IRQ number.
     588 * @param devno Device number.
     589 */
     590unative_t sys_ipc_unregister_irq(inr_t inr, devno_t devno)
    584591{
    585592        if (!(cap_get(TASK) & CAP_IRQ_REG))
    586593                return EPERM;
    587594
    588         if (irq >= IRQ_COUNT || irq <= -IPC_IRQ_RESERVED_VIRTUAL)
    589                 return (unative_t) ELIMIT;
    590 
    591         ipc_irq_unregister(&TASK->answerbox, irq);
     595        ipc_irq_unregister(&TASK->answerbox, inr, devno);
    592596
    593597        return 0;
  • uspace/kbd/arch/sparc64/src/kbd.c

    re3890b3f r2b017ba  
    5959{
    6060        z8530_cmds[0].addr = (void *) sysinfo_value("kbd.address.virtual") + 6;
    61         ipc_register_irq(sysinfo_value("kbd.irq"), &z8530_kbd);
     61        ipc_register_irq(sysinfo_value("kbd.inr"), sysinfo_value("kbd.devno"), 0, &z8530_kbd);
    6262        return 0;
    6363}
  • uspace/klog/klog.c

    re3890b3f r2b017ba  
    4141#include <as.h>
    4242#include <kernel/ipc/irq.h>
     43#include <sysinfo.h>
    4344
    4445/* Pointer to klog area */
     
    7374        klog = mapping;
    7475
    75         if (ipc_register_irq(IPC_IRQ_KLOG, NULL)) {
     76        int inr = sysinfo_value("klog.inr");
     77        int devno = sysinfo_value("klog.devno");
     78        if (ipc_register_irq(inr, devno, 0, NULL)) {
    7679                printf("Error registering for klog service.\n");
    7780                return 0;
  • uspace/libc/generic/async.c

    re3890b3f r2b017ba  
    637637
    638638        if (in_interrupt_handler) {
    639                 printf("Cannot send asynchronou request in interrupt handler.\n");
     639                printf("Cannot send asynchronous request in interrupt handler.\n");
    640640                _exit(1);
    641641        }
     
    663663
    664664        if (in_interrupt_handler) {
    665                 printf("Cannot send asynchronou request in interrupt handler.\n");
     665                printf("Cannot send asynchronous request in interrupt handler.\n");
    666666                _exit(1);
    667667        }
  • uspace/libc/generic/ipc.c

    re3890b3f r2b017ba  
    450450}
    451451
    452 int ipc_register_irq(int irq, irq_code_t *ucode)
    453 {
    454         return __SYSCALL2(SYS_IPC_REGISTER_IRQ, irq, (sysarg_t) ucode);
    455 }
    456 
    457 int ipc_unregister_irq(int irq)
    458 {
    459         return __SYSCALL1(SYS_IPC_UNREGISTER_IRQ, irq);
     452/** Register IRQ notification.
     453 *
     454 * @param inr IRQ number.
     455 * @param devno Device number of the device generating inr.
     456 * @param method Use this method for notifying me.
     457 * @param ucode Top-half pseudocode handler.
     458 *
     459 * @return Value returned by the kernel.
     460 */
     461int ipc_register_irq(int inr, int devno, int method, irq_code_t *ucode)
     462{
     463        return __SYSCALL4(SYS_IPC_REGISTER_IRQ, inr, devno, method, (sysarg_t) ucode);
     464}
     465
     466/** Unregister IRQ notification.
     467 *
     468 * @param inr IRQ number.
     469 * @param devno Device number of the device generating inr.
     470 *
     471 * @return Value returned by the kernel.
     472 */
     473int ipc_unregister_irq(int inr, int devno)
     474{
     475        return __SYSCALL2(SYS_IPC_UNREGISTER_IRQ, inr, devno);
    460476}
    461477
  • uspace/libc/include/ipc/ipc.h

    re3890b3f r2b017ba  
    8484extern int ipc_connect_me_to(int phoneid, int arg1, int arg2);
    8585extern int ipc_hangup(int phoneid);
    86 extern int ipc_register_irq(int irq, irq_code_t *code);
    87 extern int ipc_unregister_irq(int irq);
     86extern int ipc_register_irq(int inr, int devno, int method, irq_code_t *code);
     87extern int ipc_unregister_irq(int inr, int devno);
    8888extern int ipc_forward_fast(ipc_callid_t callid, int phoneid, int method, ipcarg_t arg1);
    8989
Note: See TracChangeset for help on using the changeset viewer.