Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2455 → Rev 2456

/branches/rcu/kernel/genarch/src/kbd/ns16550.c
51,6 → 51,7
#include <arch/interrupt.h>
#include <sysinfo/sysinfo.h>
#include <synch/spinlock.h>
#include <synch/rcu.h>
 
#define LSR_DATA_READY 0x01
 
86,9 → 87,9
while (ns16550_lsr_read(&ns16550) & LSR_DATA_READY)
(void) ns16550_rbr_read(&ns16550);
 
spinlock_lock(&ns16550_irq.lock);
ns16550_irq.notif_cfg.notify = false;
spinlock_unlock(&ns16550_irq.lock);
//rcu_read_lock() is not needed, ints are disabled
//rcu: atomic update doesn't need reallocation
rcu_dereference_pointer(ns16550_irq.notif_cfg).notify = false;
interrupts_restore(ipl);
}
 
96,9 → 97,10
void ns16550_release(void)
{
ipl_t ipl = interrupts_disable();
//rcu: atomic update doesn't need reallocation
spinlock_lock(&ns16550_irq.lock);
if (ns16550_irq.notif_cfg.answerbox)
ns16550_irq.notif_cfg.notify = true;
if (rcu_dereference_pointer(ns16550_irq.notif_cfg).answerbox)
rcu_dereference_pointer(ns16550_irq.notif_cfg).notify = true;
spinlock_unlock(&ns16550_irq.lock);
interrupts_restore(ipl);
}
183,7 → 185,7
spinlock_lock(&ns16550_irq.lock);
 
if (ns16550_lsr_read(&ns16550) & LSR_DATA_READY) {
if (ns16550_irq.notif_cfg.notify && ns16550_irq.notif_cfg.answerbox) {
if (rcu_dereference_pointer(ns16550_irq.notif_cfg).notify && rcu_dereference_pointer(ns16550_irq.notif_cfg).answerbox) {
/*
* Send IPC notification.
*/
/branches/rcu/kernel/genarch/src/kbd/i8042.c
49,6 → 49,7
#include <interrupt.h>
#include <sysinfo/sysinfo.h>
#include <ipc/irq.h>
#include <generic/synch/rcu.h>
 
/* Keyboard commands. */
#define KBD_ENABLE 0xf4
107,13 → 108,11
i8042_data_write(i8042_COMMAND);
i8042_wait();
 
spinlock_lock(&i8042_kbd_irq.lock);
i8042_kbd_irq.notif_cfg.notify = false;
spinlock_unlock(&i8042_kbd_irq.lock);
//rcu_read_lock() is not needed, ints are disabled
//rcu: atomic update doesn't need reallocation
rcu_dereference_pointer(i8042_kbd_irq.notif_cfg).notify = false;
spinlock_lock(&i8042_mouse_irq.lock);
i8042_mouse_irq.notif_cfg.notify = false;
spinlock_unlock(&i8042_mouse_irq.lock);
rcu_dereference_pointer(i8042_mouse_irq.notif_cfg).notify = false;
interrupts_restore(ipl);
}
121,15 → 120,15
void i8042_release(void)
{
ipl_t ipl = interrupts_disable();
//rcu: atomic update doesn't need reallocation
spinlock_lock(&i8042_kbd_irq.lock);
if (i8042_kbd_irq.notif_cfg.answerbox)
i8042_kbd_irq.notif_cfg.notify = true;
if (rcu_dereference_pointer(i8042_kbd_irq.notif_cfg).answerbox)
rcu_dereference_pointer(i8042_kbd_irq.notif_cfg).notify = true;
spinlock_unlock(&i8042_kbd_irq.lock);
spinlock_lock(&i8042_mouse_irq.lock);
if (i8042_mouse_irq.notif_cfg.answerbox)
i8042_mouse_irq.notif_cfg.notify = true;
if (rcu_dereference_pointer(i8042_mouse_irq.notif_cfg).answerbox)
rcu_dereference_pointer(i8042_mouse_irq.notif_cfg).notify = true;
spinlock_unlock(&i8042_mouse_irq.lock);
interrupts_restore(ipl);
142,7 → 141,7
 
static void i8042_kbd_irq_handler(irq_t *irq, void *arg, ...)
{
if (irq->notif_cfg.notify && irq->notif_cfg.answerbox)
if (rcu_dereference_pointer(irq->notif_cfg).notify && rcu_dereference_pointer(irq->notif_cfg).answerbox)
ipc_irq_send_notif(irq);
else {
uint8_t x;
164,7 → 163,7
 
static void i8042_mouse_irq_handler(irq_t *irq, void *arg, ...)
{
if (irq->notif_cfg.notify && irq->notif_cfg.answerbox)
if (rcu_dereference_pointer(irq->notif_cfg).notify && rcu_dereference_pointer(irq->notif_cfg).answerbox)
ipc_irq_send_notif(irq);
}
 
/branches/rcu/kernel/genarch/src/kbd/z8530.c
52,6 → 52,7
#include <interrupt.h>
#include <sysinfo/sysinfo.h>
#include <print.h>
#include <synch/rcu.h>
 
/*
* These codes read from z8530 data register are silently ignored.
90,9 → 91,9
z8530_write_a(&z8530, WR9, WR9_MIE); /* Master Interrupt Enable. */
spinlock_lock(&z8530_irq.lock);
z8530_irq.notif_cfg.notify = false;
spinlock_unlock(&z8530_irq.lock);
//rcu_read_lock() is not needed, ints are disabled
//rcu: atomic update doesn't need reallocation
rcu_dereference_pointer(z8530_irq.notif_cfg).notify = false;
interrupts_restore(ipl);
}
 
100,9 → 101,10
void z8530_release(void)
{
ipl_t ipl = interrupts_disable();
//rcu: atomic update doesn't need reallocation
spinlock_lock(&z8530_irq.lock);
if (z8530_irq.notif_cfg.answerbox)
z8530_irq.notif_cfg.notify = true;
if (rcu_dereference_pointer(z8530_irq.notif_cfg).answerbox)
rcu_dereference_pointer(z8530_irq.notif_cfg).notify = true;
spinlock_unlock(&z8530_irq.lock);
interrupts_restore(ipl);
}
204,7 → 206,7
* we cannot handle it by scheduling one of the level
* interrupt traps. Process the interrupt directly.
*/
if (irq->notif_cfg.notify && irq->notif_cfg.answerbox)
if (rcu_dereference_pointer(irq->notif_cfg).notify && rcu_dereference_pointer(irq->notif_cfg).answerbox)
ipc_irq_send_notif(irq);
else
z8530_interrupt();