summaryrefslogtreecommitdiff
path: root/components/drivers/core
diff options
context:
space:
mode:
authorGUI <[email protected]>2026-10-17 09:44:26 +0800
committerGitHub <[email protected]>2026-10-17 09:44:26 +0800
commit8d8dc96b67eee53af2841a8819364d52fbec39cb (patch)
treeeb2ac2f0984261f526c5d9c14462db47eceeb193 /components/drivers/core
parentc1d931bcc78915f24c3526a07bdecc64d5110d51 (diff)
[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 <[email protected]> * [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 <[email protected]> * [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 <[email protected]> --------- Signed-off-by: GuEe-GUI <[email protected]> Signed-off-by: seteiro <[email protected]> Co-authored-by: seteiro <[email protected]>
Diffstat (limited to 'components/drivers/core')
-rw-r--r--components/drivers/core/mnt.c4
-rw-r--r--components/drivers/core/platform_ofw.c26
2 files changed, 26 insertions, 4 deletions
diff --git a/components/drivers/core/mnt.c b/components/drivers/core/mnt.c
index 02a68d46dd..d5c6cc5a4d 100644
--- a/components/drivers/core/mnt.c
+++ b/components/drivers/core/mnt.c
@@ -20,8 +20,10 @@
#ifdef RT_USING_FINSH
#include <msh.h>
#endif
+#ifdef ARCH_MM_MMU
#include <ioremap.h>
#include <mm_memblock.h>
+#endif
#ifdef RT_USING_OFW
#define bootargs_select rt_ofw_bootargs_select
@@ -38,6 +40,7 @@ static int rootfs_mnt_init(void)
const char *fstype = bootargs_select("rootfstype=", 0);
const char *rw = bootargs_select("rw", 0);
+#ifdef ARCH_MM_MMU
if (!dev || !fstype)
{
const char *name = "initrd";
@@ -64,6 +67,7 @@ static int rootfs_mnt_init(void)
}
}
}
+#endif /* ARCH_MM_MMU */
if (fstype != cromfs_type && dev)
{
diff --git a/components/drivers/core/platform_ofw.c b/components/drivers/core/platform_ofw.c
index 4bc2deed5d..7bcfd4ea6c 100644
--- a/components/drivers/core/platform_ofw.c
+++ b/components/drivers/core/platform_ofw.c
@@ -20,6 +20,7 @@
#include <drivers/platform.h>
#include <drivers/core/bus.h>
#include <drivers/core/dm.h>
+#include <drivers/misc.h>
#include "../ofw/ofw_internal.h"
@@ -42,6 +43,20 @@ static const struct rt_ofw_node_id platform_ofw_ids[] =
{ /* sentinel */ }
};
+static void ofw_address_to_string(char *buffer, rt_size_t size, rt_uint64_t address)
+{
+ rt_uint32_t address_hi = rt_upper_32_bits(address);
+
+ if (address_hi)
+ {
+ rt_snprintf(buffer, size, "%x%08x", address_hi, rt_lower_32_bits(address));
+ }
+ else
+ {
+ rt_snprintf(buffer, size, "%x", rt_lower_32_bits(address));
+ }
+}
+
static void ofw_device_rename(struct rt_device *dev)
{
rt_uint32_t mask;
@@ -60,18 +75,21 @@ static void ofw_device_rename(struct rt_device *dev)
{
if (!rt_ofw_get_address(np, 0, &addr, RT_NULL))
{
+ char addr_str[sizeof(addr) * 2 + 1];
const char *node_name = rt_fdt_node_name(np->full_name);
rt_size_t tag_len = strchrnul(node_name, '@') - node_name;
+ ofw_address_to_string(addr_str, sizeof(addr_str), addr);
+
if (!rt_ofw_prop_read_u32(np, "mask", &mask))
{
- rt_dm_dev_set_name(dev, dev_name ? "%lx.%x.%.*s:%s" : "%lx.%x.%.*s",
- addr, __rt_ffs(mask) - 1, tag_len, node_name, dev_name);
+ rt_dm_dev_set_name(dev, dev_name ? "%s.%x.%.*s:%s" : "%s.%x.%.*s",
+ addr_str, __rt_ffs(mask) - 1, tag_len, node_name, dev_name);
}
else
{
- rt_dm_dev_set_name(dev, dev_name ? "%lx.%.*s:%s" : "%lx.%.*s",
- addr, tag_len, node_name, dev_name);
+ rt_dm_dev_set_name(dev, dev_name ? "%s.%.*s:%s" : "%s.%.*s",
+ addr_str, tag_len, node_name, dev_name);
}
return;