Files
rt-thread/libcpu/risc-v/common/include/interrupt.h
T
GUIandseteiro 8d8dc96b67 [ARCH/RISC-V] Next RISC-V (#10320)
* [libcpu][risc-v] Refactor the RISC-V architecture port

Introduce an opt-in unified RISC-V common layer for RV32 and RV64 while keeping existing BSPs on the legacy implementation during migration.

- use ARCH_RISCV and ARCH_CPU_64BIT for architecture and XLEN selection
- unify context, trap, MMU, cache, timer, SBI, SMP and ISA handling
- add PLIC, CLIC, ACLINT, APLIC and IMSIC support
- map physical hart IDs to contiguous logical CPU IDs
- add T-Head vendor overrides while preserving legacy ports
- migrate qemu-virt64-riscv with RV32 and RV64 support
- update clock_time, MM, LWP, OFW, PCI and Rust integration

Existing BSPs continue using legacy_common or common64 unless they select RT_USING_RISCV_NEW_COMMON.

Signed-off-by: GuEe-GUI <2991707448@qq.com>

* [libcpu][risc-v] skip disabled CPU nodes in early FDT walk

Rbb666 noted that rt_hw_fdt_install_early() walked every /cpus child
without checking status, so disabled cores still joined hart registration
and MMU capability probing. Skip nodes that are not okay/ok via
rt_fdt_device_is_available() before reading reg or mmu-type.

Signed-off-by: seteiro <chenmoushun@163.com>

* [libcpu][risc-v] Fix per-CPU page table mapping

- reuse existing non-leaf page table entries when mapping per-CPU areas
- reject leaf entry conflicts instead of overwriting mappings

Signed-off-by: GuEe-GUI <2991707448@qq.com>

---------

Signed-off-by: GuEe-GUI <2991707448@qq.com>
Signed-off-by: seteiro <chenmoushun@163.com>
Co-authored-by: seteiro <chenmoushun@163.com>
2026-10-17 09:44:26 +08:00

68 lines
1.7 KiB
C

/*
* Copyright (c) 2006-2025, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2018-10-01 Bernard The first version
* 2025-04-20 GuEe-GUI Port for not DM
*/
#ifndef __INTERRUPT_H__
#define __INTERRUPT_H__
#include <rthw.h>
#ifndef RT_USING_DM
#ifdef RT_USING_ADT_BITMAP
#include <bitmap.h>
#define RISCV_PLIC_QUIRK_EDGE_INTERRUPT RT_BIT(0)
#define RISCV_CLIC_QUIRK_MODE_FIXED RT_BIT(0)
#define RISCV_CLIC_QUIRK_MINTTHRESH RT_BIT(1)
#define RISCV_CLIC_QUIRK_SHV RT_BIT(2)
#endif /* RT_USING_ADT_BITMAP */
#define INTC_TYPE_RISCV 0
#define INTC_TYPE_ANDESTECH 1
#define INTC_TYPE_CLIC 2
#define IRQ_INTC(vector) (vector)
#ifdef RT_USING_SMP
#define IPI_INTC(vector) (ipi_intc_base + (vector))
#endif
#define IRQ_PLIC(vector) (irq_plic_base + (vector))
#define IRQ_CLIC(vector) (vector)
#ifdef RT_USING_SMP
#define IPI_CLIC(vector) (ipi_clic_base + (vector))
extern int ipi_intc_base;
extern int ipi_clic_base;
#endif
extern int irq_plic_base;
rt_ubase_t platform_get_plic_base(void);
rt_size_t platform_get_plic_size(void);
rt_ubase_t platform_get_plic_quirks(void);
rt_ubase_t platform_get_clic_base(void);
rt_size_t platform_get_clic_size(void);
rt_ubase_t platform_get_clic_quirks(void);
#ifdef ARCH_RISCV_M_MODE
rt_ubase_t platform_get_clint_base(void);
rt_size_t platform_get_clint_size(void);
#endif
#endif /* !RT_USING_DM */
#ifdef RT_USING_SMP
void rt_hw_ipi_handler_install(int ipi_vector, rt_isr_handler_t ipi_isr_handler);
#endif
void rt_hw_interrupt_handle(rt_uint32_t vector, void *param);
#endif /* __INTERRUPT_H__ */