*/
int (*misa_get_xlen)(void);
+ /** Initialize (or populate) domains for the platform */
+ int (*domains_init)(void);
/** Get domain pointer for given HART id */
struct sbi_domain *(*domain_get)(u32 hartid);
}
/**
+ * Initialize (or populate) domains for the platform
+ *
+ * @param plat pointer to struct sbi_platform
+ *
+ * @return 0 on success and negative error code on failure
+ */
+static inline int sbi_platform_domains_init(const struct sbi_platform *plat)
+{
+ if (plat && sbi_platform_ops(plat)->domains_init)
+ return sbi_platform_ops(plat)->domains_init();
+ return 0;
+}
+
+/**
* Get domain pointer for given HART
*
* @param plat pointer to struct sbi_platform
struct sbi_domain *dom, *tdom;
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
+ /* Initialize domains for the platform */
+ rc = sbi_platform_domains_init(plat);
+ if (rc) {
+ sbi_printf("%s: platform domains_init() failed (error %d)\n",
+ __func__, rc);
+ return rc;
+ }
+
/* Discover domains */
for (i = 0; i < SBI_HARTMASK_MAX_BITS; i++) {
/* Ignore invalid HART */