Rev 2131 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2131 | Rev 2456 | ||
---|---|---|---|
Line 37... | Line 37... | ||
37 | #include <console/chardev.h> |
37 | #include <console/chardev.h> |
38 | #include <arch/drivers/msim.h> |
38 | #include <arch/drivers/msim.h> |
39 | #include <arch/cp0.h> |
39 | #include <arch/cp0.h> |
40 | #include <console/console.h> |
40 | #include <console/console.h> |
41 | #include <sysinfo/sysinfo.h> |
41 | #include <sysinfo/sysinfo.h> |
- | 42 | #include <synch/rcu.h> |
|
42 | 43 | ||
43 | /** Address of devices. */ |
44 | /** Address of devices. */ |
44 | #define MSIM_VIDEORAM 0xB0000000 |
45 | #define MSIM_VIDEORAM 0xB0000000 |
45 | #define MSIM_KBD_ADDRESS 0xB0000000 |
46 | #define MSIM_KBD_ADDRESS 0xB0000000 |
46 | #define MSIM_KBD_IRQ 2 |
47 | #define MSIM_KBD_IRQ 2 |
Line 97... | Line 98... | ||
97 | } |
98 | } |
98 | 99 | ||
99 | /** Process keyboard interrupt. */ |
100 | /** Process keyboard interrupt. */ |
100 | static void msim_irq_handler(irq_t *irq, void *arg, ...) |
101 | static void msim_irq_handler(irq_t *irq, void *arg, ...) |
101 | { |
102 | { |
102 | if ((irq->notif_cfg.notify) && (irq->notif_cfg.answerbox)) |
103 | if ((rcu_dereference_pointer(irq->notif_cfg).notify) && (rcu_dereference_pointer(irq->notif_cfg).answerbox)) |
103 | ipc_irq_send_notif(irq); |
104 | ipc_irq_send_notif(irq); |
104 | else { |
105 | else { |
105 | char ch = 0; |
106 | char ch = 0; |
106 | 107 | ||
107 | ch = *((char *) MSIM_KBD_ADDRESS); |
108 | ch = *((char *) MSIM_KBD_ADDRESS); |
Line 119... | Line 120... | ||
119 | } |
120 | } |
120 | 121 | ||
121 | void msim_kbd_grab(void) |
122 | void msim_kbd_grab(void) |
122 | { |
123 | { |
123 | ipl_t ipl = interrupts_disable(); |
124 | ipl_t ipl = interrupts_disable(); |
124 | spinlock_lock(&msim_irq.lock); |
125 | //rcu_read_lock() is not needed, ints are disabled |
125 | msim_irq.notif_cfg.notify = false; |
126 | //rcu: atomic update doesn't need reallocation |
126 | spinlock_unlock(&msim_irq.lock); |
127 | rcu_dereference_pointer(msim_irq.notif_cfg).notify = false; |
127 | interrupts_restore(ipl); |
128 | interrupts_restore(ipl); |
128 | } |
129 | } |
129 | 130 | ||
130 | void msim_kbd_release(void) |
131 | void msim_kbd_release(void) |
131 | { |
132 | { |
132 | ipl_t ipl = interrupts_disable(); |
133 | ipl_t ipl = interrupts_disable(); |
- | 134 | //rcu: atomic update doesn't need reallocation |
|
133 | spinlock_lock(&msim_irq.lock); |
135 | spinlock_lock(&msim_irq.lock); |
134 | if (msim_irq.notif_cfg.answerbox) |
136 | if (rcu_dereference_pointer(msim_irq.notif_cfg).answerbox) |
135 | msim_irq.notif_cfg.notify = true; |
137 | rcu_dereference_pointer(msim_irq.notif_cfg).notify = true; |
136 | spinlock_unlock(&msim_irq.lock); |
138 | spinlock_unlock(&msim_irq.lock); |
137 | interrupts_restore(ipl); |
139 | interrupts_restore(ipl); |
138 | } |
140 | } |
139 | 141 | ||
140 | 142 |