Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 3963 → Rev 3964

/trunk/kernel/generic/include/console/console.h
41,6 → 41,8
extern chardev_t *stdin;
extern chardev_t *stdout;
 
extern bool silent;
 
extern void klog_init(void);
extern void klog_update(void);
 
/trunk/kernel/generic/src/ddi/irq.c
72,6 → 72,7
#include <mm/slab.h>
#include <arch/types.h>
#include <synch/spinlock.h>
#include <console/console.h>
#include <memstr.h>
#include <arch.h>
 
193,31 → 194,17
interrupts_restore(ipl);
}
 
/** Dispatch the IRQ.
/** Search and lock the uspace IRQ hash table.
*
* We assume this function is only called from interrupt
* context (i.e. that interrupts are disabled prior to
* this call).
*
* This function attempts to lookup a fitting IRQ
* structure. In case of success, return with interrupts
* disabled and holding the respective structure.
*
* @param inr Interrupt number (aka inr or irq).
*
* @return IRQ structure of the respective device or NULL.
*/
irq_t *irq_dispatch_and_lock(inr_t inr)
static irq_t *irq_dispatch_and_lock_uspace(inr_t inr)
{
link_t *lnk;
unative_t key[] = {
(unative_t) inr,
(unative_t) -1 /* search will use claim() instead of devno */
(unative_t) -1 /* search will use claim() instead of devno */
};
/*
* Try uspace handlers first.
*/
spinlock_lock(&irq_uspace_hash_table_lock);
lnk = hash_table_find(&irq_uspace_hash_table, key);
if (lnk) {
228,10 → 215,21
return irq;
}
spinlock_unlock(&irq_uspace_hash_table_lock);
return NULL;
}
 
/*
* Fallback to kernel handlers.
*/
/** Search and lock the kernel IRQ hash table.
*
*/
static irq_t *irq_dispatch_and_lock_kernel(inr_t inr)
{
link_t *lnk;
unative_t key[] = {
(unative_t) inr,
(unative_t) -1 /* search will use claim() instead of devno */
};
spinlock_lock(&irq_kernel_hash_table_lock);
lnk = hash_table_find(&irq_kernel_hash_table, key);
if (lnk) {
242,8 → 240,47
return irq;
}
spinlock_unlock(&irq_kernel_hash_table_lock);
return NULL;
}
 
return NULL;
/** Dispatch the IRQ.
*
* We assume this function is only called from interrupt
* context (i.e. that interrupts are disabled prior to
* this call).
*
* This function attempts to lookup a fitting IRQ
* structure. In case of success, return with interrupts
* disabled and holding the respective structure.
*
* @param inr Interrupt number (aka inr or irq).
*
* @return IRQ structure of the respective device or NULL.
*/
irq_t *irq_dispatch_and_lock(inr_t inr)
{
irq_t *irq;
/*
* If the kernel console is silenced,
* then try first the uspace handlers,
* eventually fall back to kernel handlers.
*
* If the kernel console is active,
* then do it the other way around.
*/
if (silent) {
irq = irq_dispatch_and_lock_uspace(inr);
if (irq)
return irq;
return irq_dispatch_and_lock_kernel(inr);
}
irq = irq_dispatch_and_lock_kernel(inr);
if (irq)
return irq;
return irq_dispatch_and_lock_uspace(inr);
}
 
/** Compute hash index for the key.
/trunk/kernel/generic/src/console/console.c
65,8 → 65,8
/**< Number of stored kernel log characters for uspace */
static size_t klog_uspace = 0;
 
/**< Silent output */
static bool silent = false;
/**< Silence output */
bool silent = false;
 
/**< Kernel log spinlock */
SPINLOCK_INITIALIZE(klog_lock);
/trunk/kernel/generic/src/ipc/irq.c
163,7 → 163,7
irq->devno = devno;
irq->inr = inr;
irq->claim = ipc_irq_top_half_claim;
irq->handler = ipc_irq_top_half_handler;
irq->handler = ipc_irq_top_half_handler;
irq->notif_cfg.notify = true;
irq->notif_cfg.answerbox = box;
irq->notif_cfg.method = method;
/trunk/kernel/arch/ia32/src/ia32.c
164,7 → 164,6
#else
ega_redraw();
#endif
}
 
/** Return console to userspace