Subversion Repositories HelenOS

Rev

Rev 2131 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2131 Rev 2456
Line 50... Line 50...
50
#include <console/chardev.h>
50
#include <console/chardev.h>
51
#include <console/console.h>
51
#include <console/console.h>
52
#include <interrupt.h>
52
#include <interrupt.h>
53
#include <sysinfo/sysinfo.h>
53
#include <sysinfo/sysinfo.h>
54
#include <print.h>
54
#include <print.h>
-
 
55
#include <synch/rcu.h>
55
 
56
 
56
/*
57
/*
57
 * These codes read from z8530 data register are silently ignored.
58
 * These codes read from z8530 data register are silently ignored.
58
 */
59
 */
59
#define IGNORE_CODE 0x7f        /* all keys up */
60
#define IGNORE_CODE 0x7f        /* all keys up */
Line 88... Line 89...
88
    /* 8 bits per character and enable receiver */
89
    /* 8 bits per character and enable receiver */
89
    z8530_write_a(&z8530, WR3, WR3_RX8BITSCH | WR3_RX_ENABLE);
90
    z8530_write_a(&z8530, WR3, WR3_RX8BITSCH | WR3_RX_ENABLE);
90
   
91
   
91
    z8530_write_a(&z8530, WR9, WR9_MIE);        /* Master Interrupt Enable. */
92
    z8530_write_a(&z8530, WR9, WR9_MIE);        /* Master Interrupt Enable. */
92
   
93
   
93
    spinlock_lock(&z8530_irq.lock);
94
    //rcu_read_lock() is not needed, ints are disabled
94
    z8530_irq.notif_cfg.notify = false;
95
    //rcu: atomic update doesn't need reallocation
95
    spinlock_unlock(&z8530_irq.lock);
96
    rcu_dereference_pointer(z8530_irq.notif_cfg).notify = false;
96
    interrupts_restore(ipl);
97
    interrupts_restore(ipl);
97
}
98
}
98
 
99
 
99
/** Resume the former IPC notification behavior. */
100
/** Resume the former IPC notification behavior. */
100
void z8530_release(void)
101
void z8530_release(void)
101
{
102
{
102
    ipl_t ipl = interrupts_disable();
103
    ipl_t ipl = interrupts_disable();
-
 
104
    //rcu: atomic update doesn't need reallocation
103
    spinlock_lock(&z8530_irq.lock);
105
    spinlock_lock(&z8530_irq.lock);
104
    if (z8530_irq.notif_cfg.answerbox)
106
    if (rcu_dereference_pointer(z8530_irq.notif_cfg).answerbox)
105
        z8530_irq.notif_cfg.notify = true;
107
        rcu_dereference_pointer(z8530_irq.notif_cfg).notify = true;
106
    spinlock_unlock(&z8530_irq.lock);
108
    spinlock_unlock(&z8530_irq.lock);
107
    interrupts_restore(ipl);
109
    interrupts_restore(ipl);
108
}
110
}
109
 
111
 
110
/** Initialize z8530. */
112
/** Initialize z8530. */
Line 202... Line 204...
202
     * Since we don't have enough documentation about the FHC
204
     * Since we don't have enough documentation about the FHC
203
     * and because the interrupt looks like level sensitive,
205
     * and because the interrupt looks like level sensitive,
204
     * we cannot handle it by scheduling one of the level
206
     * we cannot handle it by scheduling one of the level
205
     * interrupt traps. Process the interrupt directly.
207
     * interrupt traps. Process the interrupt directly.
206
     */
208
     */
207
    if (irq->notif_cfg.notify && irq->notif_cfg.answerbox)
209
    if (rcu_dereference_pointer(irq->notif_cfg).notify && rcu_dereference_pointer(irq->notif_cfg).answerbox)
208
        ipc_irq_send_notif(irq);
210
        ipc_irq_send_notif(irq);
209
    else
211
    else
210
        z8530_interrupt();
212
        z8530_interrupt();
211
    fhc_clear_interrupt(central_fhc, irq->inr);
213
    fhc_clear_interrupt(central_fhc, irq->inr);
212
}
214
}