Changeset 05641a9e in mainline


Ignore:
Timestamp:
2009-03-23T21:46:40Z (15 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
c3ebc47
Parents:
a5e5030
Message:

Revive kernel notifications.

Files:
5 added
12 edited

Legend:

Unmodified
Added
Removed
  • kernel/Makefile

    ra5e5030 r05641a9e  
    162162        generic/src/ddi/device.c \
    163163        generic/src/debug/symtab.c \
     164        generic/src/event/event.c \
    164165        generic/src/interrupt/interrupt.c \
    165166        generic/src/main/main.c \
  • kernel/generic/include/syscall/syscall.h

    ra5e5030 r05641a9e  
    6969        SYS_IPC_REGISTER_IRQ,
    7070        SYS_IPC_UNREGISTER_IRQ,
     71
     72        SYS_EVENT_SUBSCRIBE,
    7173       
    7274        SYS_CAP_GRANT,
  • kernel/generic/src/console/cmd.c

    ra5e5030 r05641a9e  
    6565#include <ipc/ipc.h>
    6666#include <ipc/irq.h>
     67#include <event/event.h>
    6768#include <symtab.h>
    6869#include <errno.h>
     
    955956        release_console();
    956957       
    957         if ((kconsole_notify) && (kconsole_irq.notif_cfg.notify))
    958                 ipc_irq_send_msg_0(&kconsole_irq);
     958        event_notify_0(EVENT_KCONSOLE);
    959959       
    960960        return 1;
  • kernel/generic/src/console/console.c

    ra5e5030 r05641a9e  
    4242#include <ddi/irq.h>
    4343#include <ddi/ddi.h>
     44#include <event/event.h>
    4445#include <ipc/irq.h>
    4546#include <arch.h>
     
    100101        sysinfo_set_item_val("klog.faddr", NULL, (unative_t) faddr);
    101102        sysinfo_set_item_val("klog.pages", NULL, SIZE2FRAMES(KLOG_SIZE));
    102        
    103         //irq_initialize(&klog_irq);
    104         //klog_irq.devno = devno;
    105         //klog_irq.inr = KLOG_VIRT_INR;
    106         //klog_irq.claim = klog_claim;
    107         //irq_register(&klog_irq);
    108103       
    109104        spinlock_lock(&klog_lock);
     
    243238        spinlock_lock(&klog_lock);
    244239       
    245 //      if ((klog_inited) && (klog_irq.notif_cfg.notify) && (klog_uspace > 0)) {
    246 //              ipc_irq_send_msg_3(&klog_irq, klog_start, klog_len, klog_uspace);
    247 //              klog_uspace = 0;
    248 //      }
     240        if (klog_inited && event_is_subscribed(EVENT_KLOG) && klog_uspace > 0) {
     241                event_notify_3(EVENT_KLOG, klog_start, klog_len, klog_uspace);
     242                klog_uspace = 0;
     243        }
    249244       
    250245        spinlock_unlock(&klog_lock);
  • kernel/generic/src/console/kconsole.c

    ra5e5030 r05641a9e  
    8888static char history[KCONSOLE_HISTORY][MAX_CMDLINE] = {};
    8989
    90 /*
    91  * For now, we use 0 as INR.
    92  * However, it is therefore desirable to have architecture specific
    93  * definition of KCONSOLE_VIRT_INR in the future.
    94  */
    95 #define KCONSOLE_VIRT_INR  0
    96 
    97 bool kconsole_notify = false;
    98 irq_t kconsole_irq;
    99 
    100 
    101 /** Allways refuse IRQ ownership.
    102  *
    103  * This is not a real IRQ, so we always decline.
    104  *
    105  * @return Always returns IRQ_DECLINE.
    106  *
    107  */
    108 static irq_ownership_t kconsole_claim(irq_t *irq)
    109 {
    110         return IRQ_DECLINE;
    111 }
    112 
    113 
    11490/** Initialize kconsole data structures
    11591 *
     
    126102                history[i][0] = '\0';
    127103}
    128 
    129 
    130 /** Initialize kconsole notification mechanism
    131  *
    132  * Initialize the virtual IRQ notification mechanism.
    133  *
    134  */
    135 void kconsole_notify_init(void)
    136 {
    137         sysinfo_set_item_val("kconsole.present", NULL, true);
    138         sysinfo_set_item_val("kconsole.inr", NULL, KCONSOLE_VIRT_INR);
    139        
    140         irq_initialize(&kconsole_irq);
    141         kconsole_irq.devno = device_assign_devno();
    142         kconsole_irq.inr = KCONSOLE_VIRT_INR;
    143         kconsole_irq.claim = kconsole_claim;
    144         irq_register(&kconsole_irq);
    145        
    146         kconsole_notify = true;
    147 }
    148 
    149104
    150105/** Register kconsole command.
  • kernel/generic/src/ipc/ipc.c

    ra5e5030 r05641a9e  
    4545#include <ipc/ipc.h>
    4646#include <ipc/kbox.h>
     47#include <event/event.h>
    4748#include <errno.h>
    4849#include <mm/slab.h>
     
    5152#include <memstr.h>
    5253#include <debug.h>
     54
    5355
    5456#include <print.h>
     
    526528        for (i = 0; i < IPC_MAX_PHONES; i++)
    527529                ipc_phone_hangup(&TASK->phones[i]);
     530
     531        /* Unsubscribe from any event notifications. */
     532        event_cleanup_answerbox(&TASK->answerbox);
    528533
    529534        /* Disconnect all connected irqs */
  • kernel/generic/src/main/main.c

    ra5e5030 r05641a9e  
    8383#include <ddi/ddi.h>
    8484#include <main/main.h>
     85#include <event/event.h>
    8586
    8687/** Global configuration structure. */
     
    256257       
    257258        LOG_EXEC(ipc_init());
     259        LOG_EXEC(event_init());
    258260        LOG_EXEC(klog_init());
    259        
    260 #ifdef CONFIG_KCONSOLE
    261         LOG_EXEC(kconsole_notify_init());
    262 #endif
    263261       
    264262        /*
  • kernel/generic/src/syscall/syscall.c

    ra5e5030 r05641a9e  
    5050#include <synch/smc.h>
    5151#include <ddi/ddi.h>
     52#include <event/event.h>
    5253#include <security/cap.h>
    5354#include <sysinfo/sysinfo.h>
     
    127128        (syshandler_t) sys_ipc_register_irq,
    128129        (syshandler_t) sys_ipc_unregister_irq,
     130
     131        /* Event notification syscalls. */
     132        (syshandler_t) sys_event_subscribe,
    129133       
    130134        /* Capabilities related syscalls. */
  • uspace/app/klog/klog.c

    ra5e5030 r05641a9e  
    4343#include <io/stream.h>
    4444#include <console.h>
     45#include <event.h>
    4546#include <errno.h>
    4647
     
    8384        }
    8485       
    85 //      int inr = sysinfo_value("klog.inr");
    86 //      if (ipc_register_irq(inr, devno, 0, NULL) != EOK) {
    87 //              printf(NAME ": Error registering klog notifications\n");
    88 //              return -1;
    89 //      }
     86        if (event_subscribe(EVENT_KLOG, 0) != EOK) {
     87                printf(NAME ": Error registering klog notifications\n");
     88                return -1;
     89        }
    9090       
    9191        async_set_interrupt_received(interrupt_received);
  • uspace/app/trace/syscalls.c

    ra5e5030 r05641a9e  
    6666    [SYS_IPC_UNREGISTER_IRQ] = { "ipc_unregister_irq",  2,      V_ERRNO },
    6767
     68    [SYS_EVENT_SUBSCRIBE] = { "event_subscribe",        2,      V_ERRNO },
     69
    6870    [SYS_CAP_GRANT] = { "cap_grant",                    2,      V_ERRNO },
    6971    [SYS_CAP_REVOKE] = { "cap_revoke",                  2,      V_ERRNO },
  • uspace/lib/libc/Makefile

    ra5e5030 r05641a9e  
    4848        generic/cap.c \
    4949        generic/console.c \
     50        generic/event.c \
    5051        generic/mem.c \
    5152        generic/string.c \
  • uspace/srv/console/console.c

    ra5e5030 r05641a9e  
    5050#include <stdio.h>
    5151#include <sysinfo.h>
     52#include <event.h>
    5253
    5354#include "console.h"
     
    730731       
    731732        /* Receive kernel notifications */
    732 //      if (sysinfo_value("kconsole.present")) {
    733 //              int inr = sysinfo_value("kconsole.inr");
    734 //              if (ipc_register_irq(inr, device_assign_devno(), 0, NULL) != EOK)
    735 //                      printf(NAME ": Error registering kconsole notifications\n");
    736 //             
    737 //              async_set_interrupt_received(interrupt_received);
    738 //      }
     733        if (event_subscribe(EVENT_KCONSOLE, 0) != EOK)
     734                printf(NAME ": Error registering kconsole notifications\n");
     735               
     736        async_set_interrupt_received(interrupt_received);
    739737       
    740738        // FIXME: avoid connectiong to itself, keep using klog
Note: See TracChangeset for help on using the changeset viewer.