/** Platform functions */
struct sbi_platform_operations {
+ /* Check if specified HART is allowed to do cold boot */
+ bool (*cold_boot_allowed)(u32 hartid);
+
/* Platform nascent initialization */
int (*nascent_init)(void);
return false;
}
+/**
+ * Check whether given HART is allowed to do cold boot
+ *
+ * @param plat pointer to struct sbi_platform
+ * @param hartid HART ID
+ *
+ * @return true if HART is allowed to do cold boot and false otherwise
+ */
+static inline bool sbi_platform_cold_boot_allowed(
+ const struct sbi_platform *plat,
+ u32 hartid)
+{
+ if (plat && sbi_platform_ops(plat)->cold_boot_allowed)
+ return sbi_platform_ops(plat)->cold_boot_allowed(hartid);
+ return true;
+}
+
/**
* Nascent (very early) initialization for current HART
*
* HARTs which satisfy above condition.
*/
- if (next_mode_supported && atomic_xchg(&coldboot_lottery, 1) == 0)
- coldboot = true;
+ if (sbi_platform_cold_boot_allowed(plat, hartid)) {
+ if (next_mode_supported &&
+ atomic_xchg(&coldboot_lottery, 1) == 0)
+ coldboot = true;
+ }
/*
* Do platform specific nascent (very early) initialization so