mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2025-08-24 15:31:22 +01:00
lib: sbi: Remove domain_get() platform callback function
The domain_get() platform callback function is now redundant because fdt_domain_populate() register new domain explicitly using the sbi_domain_register() function. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Alistair Francis <alistair.francis@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
@@ -93,8 +93,6 @@ struct sbi_platform_operations {
|
|||||||
|
|
||||||
/** Initialize (or populate) domains for the platform */
|
/** Initialize (or populate) domains for the platform */
|
||||||
int (*domains_init)(void);
|
int (*domains_init)(void);
|
||||||
/** Get domain pointer for given HART id */
|
|
||||||
struct sbi_domain *(*domain_get)(u32 hartid);
|
|
||||||
|
|
||||||
/** Write a character to the platform console output */
|
/** Write a character to the platform console output */
|
||||||
void (*console_putc)(char ch);
|
void (*console_putc)(char ch);
|
||||||
@@ -467,22 +465,6 @@ static inline int sbi_platform_domains_init(const struct sbi_platform *plat)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get domain pointer for given HART
|
|
||||||
*
|
|
||||||
* @param plat pointer to struct sbi_platform
|
|
||||||
* @param hartid shorthand letter for CPU extensions
|
|
||||||
*
|
|
||||||
* @return non-NULL domain pointer on success and NULL on failure
|
|
||||||
*/
|
|
||||||
static inline struct sbi_domain *sbi_platform_domain_get(
|
|
||||||
const struct sbi_platform *plat, u32 hartid)
|
|
||||||
{
|
|
||||||
if (plat && sbi_platform_ops(plat)->domain_get)
|
|
||||||
return sbi_platform_ops(plat)->domain_get(hartid);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write a character to the platform console output
|
* Write a character to the platform console output
|
||||||
*
|
*
|
||||||
|
@@ -441,12 +441,11 @@ int sbi_domain_register(struct sbi_domain *dom,
|
|||||||
int sbi_domain_finalize(struct sbi_scratch *scratch, u32 cold_hartid)
|
int sbi_domain_finalize(struct sbi_scratch *scratch, u32 cold_hartid)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
u32 i, j, dhart;
|
u32 i, dhart;
|
||||||
bool dom_exists;
|
struct sbi_domain *dom;
|
||||||
struct sbi_domain *dom, *tdom;
|
|
||||||
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
|
const struct sbi_platform *plat = sbi_platform_ptr(scratch);
|
||||||
|
|
||||||
/* Initialize domains for the platform */
|
/* Initialize and populate domains for the platform */
|
||||||
rc = sbi_platform_domains_init(plat);
|
rc = sbi_platform_domains_init(plat);
|
||||||
if (rc) {
|
if (rc) {
|
||||||
sbi_printf("%s: platform domains_init() failed (error %d)\n",
|
sbi_printf("%s: platform domains_init() failed (error %d)\n",
|
||||||
@@ -454,77 +453,6 @@ int sbi_domain_finalize(struct sbi_scratch *scratch, u32 cold_hartid)
|
|||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Discover domains */
|
|
||||||
for (i = 0; i < SBI_HARTMASK_MAX_BITS; i++) {
|
|
||||||
/* Ignore invalid HART */
|
|
||||||
if (sbi_platform_hart_invalid(plat, i))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Get domain assigned to HART */
|
|
||||||
dom = sbi_platform_domain_get(plat, i);
|
|
||||||
if (!dom)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Check if domain already discovered */
|
|
||||||
dom_exists = FALSE;
|
|
||||||
sbi_domain_for_each(j, tdom) {
|
|
||||||
if (tdom == dom) {
|
|
||||||
dom_exists = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Newly discovered domain */
|
|
||||||
if (!dom_exists) {
|
|
||||||
/*
|
|
||||||
* Ensure that we have room for Domain Index to
|
|
||||||
* HART ID mapping
|
|
||||||
*/
|
|
||||||
if (SBI_DOMAIN_MAX_INDEX <= domain_count) {
|
|
||||||
sbi_printf("%s: No room for %s\n",
|
|
||||||
__func__, dom->name);
|
|
||||||
return SBI_ENOSPC;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sanitize discovered domain */
|
|
||||||
rc = sanitize_domain(plat, dom);
|
|
||||||
if (rc) {
|
|
||||||
sbi_printf("%s: sanity checks failed for"
|
|
||||||
" %s (error %d)\n", __func__,
|
|
||||||
dom->name, rc);
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Assign index to domain */
|
|
||||||
dom->index = domain_count++;
|
|
||||||
domidx_to_domain_table[dom->index] = dom;
|
|
||||||
|
|
||||||
/* Clear assigned HARTs of domain */
|
|
||||||
sbi_hartmask_clear_all(&dom->assigned_harts);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Assign domain to HART if HART is a possible HART */
|
|
||||||
if (sbi_hartmask_test_hart(i, dom->possible_harts)) {
|
|
||||||
tdom = hartid_to_domain_table[i];
|
|
||||||
if (tdom)
|
|
||||||
sbi_hartmask_clear_hart(i,
|
|
||||||
&tdom->assigned_harts);
|
|
||||||
hartid_to_domain_table[i] = dom;
|
|
||||||
sbi_hartmask_set_hart(i, &dom->assigned_harts);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If cold boot HART is assigned to this domain then
|
|
||||||
* override boot HART of this domain.
|
|
||||||
*/
|
|
||||||
if (i == cold_hartid &&
|
|
||||||
dom->boot_hartid != cold_hartid) {
|
|
||||||
sbi_printf("Domain%d Boot HARTID forced to"
|
|
||||||
" %d\n", dom->index, cold_hartid);
|
|
||||||
dom->boot_hartid = cold_hartid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Startup boot HART of domains */
|
/* Startup boot HART of domains */
|
||||||
sbi_domain_for_each(i, dom) {
|
sbi_domain_for_each(i, dom) {
|
||||||
/* Domain boot HART */
|
/* Domain boot HART */
|
||||||
|
Reference in New Issue
Block a user