aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-07-01 23:34:57 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-07-01 23:34:57 +0300
commit7ad9c01dad7b1b46eced8290b8b991383d648188 (patch)
treecd528648af552974b90117efef431659ef5f0cc6 /arch/riscv64/kernel
parent9ff67d879b4695e0c9910b7276f3959c005c7b19 (diff)
downloadkmi-7ad9c01dad7b1b46eced8290b8b991383d648188.tar.gz
kmi-7ad9c01dad7b1b46eced8290b8b991383d648188.zip
expand notifications into interrupt handlers
+ Terminology is still a bit poor, and will still have to write documentation + implement ipis properly
Diffstat (limited to 'arch/riscv64/kernel')
-rw-r--r--arch/riscv64/kernel/csr.h2
-rw-r--r--arch/riscv64/kernel/irq.c10
2 files changed, 8 insertions, 4 deletions
diff --git a/arch/riscv64/kernel/csr.h b/arch/riscv64/kernel/csr.h
index 9b7b78a..bc48464 100644
--- a/arch/riscv64/kernel/csr.h
+++ b/arch/riscv64/kernel/csr.h
@@ -40,6 +40,8 @@
/** Address of \c sstatus CSR. */
#define CSR_SSTATUS 0x100
+#define SR_SPIE 0b10
+
/** Address of \c sie CSR. */
#define CSR_SIE 0x104
diff --git a/arch/riscv64/kernel/irq.c b/arch/riscv64/kernel/irq.c
index 964401f..2ef15cc 100644
--- a/arch/riscv64/kernel/irq.c
+++ b/arch/riscv64/kernel/irq.c
@@ -41,12 +41,13 @@ stat_t deactivate_irq(irq_t id)
/* very simple for now */
void enable_irqs()
{
- csr_set(CSR_SSTATUS, CSR_SIE);
+ /* should be supervisor external interrupt */
+ csr_set(CSR_SIE, 1 << 9);
}
void disable_irqs()
{
- csr_clear(CSR_SSTATUS, CSR_SIE);
+ csr_clear(CSR_SIE, 1 << 9);
}
irq_t get_irq()
@@ -71,9 +72,10 @@ static void riscv_unknown_interrupt(long id)
*
* @param id ID of interrupt, with interrupt bit still set.
*/
-void riscv_handle_interrupt(long id)
+void riscv_handle_interrupt(unsigned long id)
{
- id = -id;
+ /* clear leading one */
+ id = (id << 1) >> 1;
switch (id) {
/* I think */