Skip to content

Commit

Permalink
Disable the PLIC Interrupt Controller
Browse files Browse the repository at this point in the history
  • Loading branch information
lupyuen committed May 7, 2024
1 parent c6c0bd3 commit 6d66caa
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
6 changes: 6 additions & 0 deletions arch/risc-v/src/bl808/bl808_irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@

void up_irqinitialize(void)
{
#ifdef TODO ////
uintptr_t claim;

/* Disable S-Mode interrupts */
Expand Down Expand Up @@ -100,6 +101,7 @@ void up_irqinitialize(void)

up_irq_enable();
#endif
#endif //// TODO
}

/****************************************************************************
Expand All @@ -112,6 +114,7 @@ void up_irqinitialize(void)

void up_disable_irq(int irq)
{
#ifdef TODO ////
int extirq;

if (irq == RISCV_IRQ_SOFT)
Expand Down Expand Up @@ -142,6 +145,7 @@ void up_disable_irq(int irq)
PANIC();
}
}
#endif //// TODO
}

/****************************************************************************
Expand All @@ -154,6 +158,7 @@ void up_disable_irq(int irq)

void up_enable_irq(int irq)
{
#ifdef TODO ////
int extirq;

if (irq == RISCV_IRQ_SOFT)
Expand Down Expand Up @@ -184,6 +189,7 @@ void up_enable_irq(int irq)
PANIC();
}
}
#endif //// TODO
}

irqstate_t up_irq_enable(void)
Expand Down
2 changes: 2 additions & 0 deletions arch/risc-v/src/bl808/bl808_irq_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@

void *riscv_dispatch_irq(uintptr_t vector, uintptr_t *regs)
{
#ifdef TODO ////
int irq = (vector >> RV_IRQ_MASK) | (vector & 0xf);

/* Firstly, check if the irq is machine external interrupt */
Expand Down Expand Up @@ -80,5 +81,6 @@ void *riscv_dispatch_irq(uintptr_t vector, uintptr_t *regs)
putreg32(irq - RISCV_IRQ_EXT, BL808_PLIC_CLAIM);
}

#endif //// TODO
return regs;
}
14 changes: 8 additions & 6 deletions arch/risc-v/src/bl808/bl808_mm_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,23 @@
#define MMU_IO_BASE (0x00000000ul)
#define MMU_IO_SIZE (0x40000000ul)

#define MMU_INT_BASE (0xe0000000ul)
#define MMU_INT_SIZE (0x10000000ul)
//// TODO: #define MMU_INT_BASE (0xe0000000ul)
//// TODO: #define MMU_INT_SIZE (0x10000000ul)

/* Physical and virtual addresses to page tables (vaddr = paddr mapping) */

#define PGT_L1_PBASE (uintptr_t)&m_l1_pgtable
#define PGT_L2_PBASE (uintptr_t)&m_l2_pgtable
#define PGT_L2_INT_PBASE (uintptr_t)&m_l2_int_pgtable
//// TODO: #define PGT_L2_INT_PBASE (uintptr_t)&m_l2_int_pgtable
#define PGT_L3_PBASE (uintptr_t)&m_l3_pgtable
#define PGT_L1_VBASE PGT_L1_PBASE
#define PGT_L2_VBASE PGT_L2_PBASE
#define PGT_L2_INT_VBASE PGT_L2_INT_PBASE
//// TODO: #define PGT_L2_INT_VBASE PGT_L2_INT_PBASE
#define PGT_L3_VBASE PGT_L3_PBASE

#define PGT_L1_SIZE (512) /* Enough to map 512 GiB */
#define PGT_L2_SIZE (512) /* Enough to map 1 GiB */
#define PGT_L2_INT_SIZE (512) /* Enough to map 1 GiB */
//// TODO: #define PGT_L2_INT_SIZE (512) /* Enough to map 1 GiB */
#define PGT_L3_SIZE (1024) /* Enough to map 4 MiB (2MiB x 2) */

#define SLAB_COUNT (sizeof(m_l3_pgtable) / RV_MMU_PAGE_SIZE)
Expand Down Expand Up @@ -98,7 +98,7 @@ typedef struct pgalloc_slab_s pgalloc_slab_t;

static size_t m_l1_pgtable[PGT_L1_SIZE] locate_data(".pgtables");
static size_t m_l2_pgtable[PGT_L2_SIZE] locate_data(".pgtables");
static size_t m_l2_int_pgtable[PGT_L2_INT_SIZE] locate_data(".pgtables");
//// TODO: static size_t m_l2_int_pgtable[PGT_L2_INT_SIZE] locate_data(".pgtables");
static size_t m_l3_pgtable[PGT_L3_SIZE] locate_data(".pgtables");

/* Kernel mappings (L1 base) */
Expand Down Expand Up @@ -244,6 +244,7 @@ void bl808_kernel_mappings(void)
mmu_ln_map_region(1, PGT_L1_VBASE, MMU_IO_BASE, MMU_IO_BASE,
MMU_IO_SIZE, MMU_THEAD_IO_FLAGS);

#ifdef TODO ////
/* Map the PLIC with L2 page table */

binfo("map PLIC with L2 page table\n");
Expand All @@ -254,6 +255,7 @@ void bl808_kernel_mappings(void)

binfo("connect the L1 and PLIC L2 page tables\n");
mmu_ln_setentry(1, PGT_L1_VBASE, PGT_L2_INT_PBASE, MMU_INT_BASE, PTE_G);
#endif //// TODO

/* Map the kernel text and data for L2/L3 */

Expand Down
4 changes: 2 additions & 2 deletions arch/risc-v/src/bl808/hardware/bl808_memorymap.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

/* Register Base Address ****************************************************/

#define BL808_UART3_BASE 0x30002000ul
#define BL808_PLIC_BASE 0xe0000000ul
//// TODO: #define BL808_UART3_BASE 0x30002000ul
//// TODO: #define BL808_PLIC_BASE 0xe0000000ul

#endif /* __ARCH_RISCV_SRC_BL808_HARDWARE_BL808_MEMORYMAP_H */

0 comments on commit 6d66caa

Please sign in to comment.