diff options
-rw-r--r-- | include/sbi/sbi_platform.h | 15 | ||||
-rw-r--r-- | platform/andes/ae350/platform.c | 3 | ||||
-rw-r--r-- | platform/ariane-fpga/platform.c | 1 | ||||
-rw-r--r-- | platform/kendryte/k210/platform.c | 1 | ||||
-rw-r--r-- | platform/qemu/virt/platform.c | 1 | ||||
-rw-r--r-- | platform/sifive/fu540/platform.c | 7 | ||||
-rw-r--r-- | platform/spike/platform.c | 1 | ||||
-rw-r--r-- | platform/template/platform.c | 1 | ||||
-rw-r--r-- | platform/thead/c910/platform.c | 1 |
9 files changed, 13 insertions, 18 deletions
diff --git a/include/sbi/sbi_platform.h b/include/sbi/sbi_platform.h index a28bc50..e4f1a7d 100644 --- a/include/sbi/sbi_platform.h +++ b/include/sbi/sbi_platform.h @@ -29,12 +29,10 @@ #define SBI_PLATFORM_HART_COUNT_OFFSET (0x50) /** Offset of hart_stack_size in struct sbi_platform */ #define SBI_PLATFORM_HART_STACK_SIZE_OFFSET (0x54) -/** Offset of disabled_hart_mask in struct sbi_platform */ -#define SBI_PLATFORM_DISABLED_HART_OFFSET (0x58) /** Offset of platform_ops_addr in struct sbi_platform */ -#define SBI_PLATFORM_OPS_OFFSET (0x60) +#define SBI_PLATFORM_OPS_OFFSET (0x58) /** Offset of firmware_context in struct sbi_platform */ -#define SBI_PLATFORM_FIRMWARE_CONTEXT_OFFSET (0x60 + __SIZEOF_POINTER__) +#define SBI_PLATFORM_FIRMWARE_CONTEXT_OFFSET (0x58 + __SIZEOF_POINTER__) #define SBI_PLATFORM_TLB_RANGE_FLUSH_LIMIT_DEFAULT (1UL << 12) @@ -138,6 +136,9 @@ struct sbi_platform_operations { /** Exit platform timer for current HART */ void (*timer_exit)(void); + /** Check whether given hart is disabled */ + bool (*hart_disabled)(u32 hartid); + /** Bringup the given hart from previous stage **/ int (*hart_start)(u32 hartid, ulong saddr, ulong priv); /** @@ -182,8 +183,6 @@ struct sbi_platform { u32 hart_count; /** Per-HART stack size for exception/interrupt handling */ u32 hart_stack_size; - /** Mask representing the set of disabled HARTs */ - u64 disabled_hart_mask; /** Pointer to sbi platform operations */ unsigned long platform_ops_addr; /** Pointer to system firmware specific context */ @@ -246,8 +245,8 @@ static inline const char *sbi_platform_name(const struct sbi_platform *plat) static inline bool sbi_platform_hart_disabled(const struct sbi_platform *plat, u32 hartid) { - if (plat && (plat->disabled_hart_mask & (1 << hartid))) - return TRUE; + if (plat && sbi_platform_ops(plat)->hart_disabled) + return sbi_platform_ops(plat)->hart_disabled(hartid); return FALSE; } diff --git a/platform/andes/ae350/platform.c b/platform/andes/ae350/platform.c index d14266d..08db3eb 100644 --- a/platform/andes/ae350/platform.c +++ b/platform/andes/ae350/platform.c @@ -156,7 +156,6 @@ static int ae350_system_shutdown(u32 type) /* Platform descriptor. */ const struct sbi_platform_operations platform_ops = { - .final_init = ae350_final_init, .pmp_region_count = ae350_pmp_region_count, @@ -182,13 +181,11 @@ const struct sbi_platform_operations platform_ops = { }; const struct sbi_platform platform = { - .opensbi_version = OPENSBI_VERSION, .platform_version = SBI_PLATFORM_VERSION(0x0, 0x01), .name = "Andes AE350", .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = AE350_HART_COUNT, .hart_stack_size = AE350_HART_STACK_SIZE, - .disabled_hart_mask = 0, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/ariane-fpga/platform.c b/platform/ariane-fpga/platform.c index 5ebbff8..1975eb2 100644 --- a/platform/ariane-fpga/platform.c +++ b/platform/ariane-fpga/platform.c @@ -201,6 +201,5 @@ const struct sbi_platform platform = { .features = SBI_ARIANE_FEATURES, .hart_count = ARIANE_HART_COUNT, .hart_stack_size = 4096, - .disabled_hart_mask = 0, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/kendryte/k210/platform.c b/platform/kendryte/k210/platform.c index 8ad1bf8..1b49b39 100644 --- a/platform/kendryte/k210/platform.c +++ b/platform/kendryte/k210/platform.c @@ -139,6 +139,5 @@ const struct sbi_platform platform = { .features = SBI_PLATFORM_HAS_TIMER_VALUE, .hart_count = K210_HART_COUNT, .hart_stack_size = K210_HART_STACK_SIZE, - .disabled_hart_mask = 0, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/qemu/virt/platform.c b/platform/qemu/virt/platform.c index 883555c..d2c841c 100644 --- a/platform/qemu/virt/platform.c +++ b/platform/qemu/virt/platform.c @@ -159,6 +159,5 @@ const struct sbi_platform platform = { .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = VIRT_HART_COUNT, .hart_stack_size = VIRT_HART_STACK_SIZE, - .disabled_hart_mask = 0, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/sifive/fu540/platform.c b/platform/sifive/fu540/platform.c index 5f3d3ce..4a8c016 100644 --- a/platform/sifive/fu540/platform.c +++ b/platform/sifive/fu540/platform.c @@ -194,6 +194,11 @@ static int fu540_timer_init(bool cold_boot) return clint_warm_timer_init(); } +static bool fu540_hart_disabled(u32 hartid) +{ + return (FU540_HARITD_DISABLED & (1UL << hartid)) ? TRUE : FALSE; +} + static int fu540_system_down(u32 type) { /* For now nothing to do. */ @@ -216,6 +221,7 @@ const struct sbi_platform_operations platform_ops = { .timer_event_stop = clint_timer_event_stop, .timer_event_start = clint_timer_event_start, .timer_init = fu540_timer_init, + .hart_disabled = fu540_hart_disabled, .system_reboot = fu540_system_down, .system_shutdown = fu540_system_down }; @@ -227,6 +233,5 @@ const struct sbi_platform platform = { .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = FU540_HART_COUNT, .hart_stack_size = FU540_HART_STACK_SIZE, - .disabled_hart_mask = FU540_HARITD_DISABLED, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/spike/platform.c b/platform/spike/platform.c index c0f93e2..2b9b041 100644 --- a/platform/spike/platform.c +++ b/platform/spike/platform.c @@ -110,6 +110,5 @@ const struct sbi_platform platform = { .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = SPIKE_HART_COUNT, .hart_stack_size = SPIKE_HART_STACK_SIZE, - .disabled_hart_mask = 0, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/template/platform.c b/platform/template/platform.c index f959a11..c98bbff 100644 --- a/platform/template/platform.c +++ b/platform/template/platform.c @@ -223,6 +223,5 @@ const struct sbi_platform platform = { .features = SBI_PLATFORM_DEFAULT_FEATURES, .hart_count = 1, .hart_stack_size = 4096, - .disabled_hart_mask = 0, .platform_ops_addr = (unsigned long)&platform_ops }; diff --git a/platform/thead/c910/platform.c b/platform/thead/c910/platform.c index 9d73bf4..482caad 100644 --- a/platform/thead/c910/platform.c +++ b/platform/thead/c910/platform.c @@ -153,6 +153,5 @@ const struct sbi_platform platform = { .features = SBI_THEAD_FEATURES, .hart_count = C910_HART_COUNT, .hart_stack_size = C910_HART_STACK_SIZE, - .disabled_hart_mask = 0, .platform_ops_addr = (unsigned long)&platform_ops }; |