diff options
author | Anup Patel <anup.patel@wdc.com> | 2021-01-08 10:07:01 +0530 |
---|---|---|
committer | Anup Patel <anup@brainfault.org> | 2021-01-12 10:41:11 +0530 |
commit | db56341dfa1f89e258921d260449eb5edee922c4 (patch) | |
tree | 77a3edcd897d852f25be9d8e9b1f4c9f0afc0a6b /lib/sbi | |
parent | 0d49c3bc1823df8bf229ba3ece8ca0a753f0622b (diff) |
lib: sbi: Allow platforms to provide root domain memory regions
Currently, the root domain memory regions are fixed in generic
code but some of the platforms may want to explicitly define
memory regions for the root domain.
This patch adds optional domains_root_regions() platform callback
which platforms can use to provide platform specific root domain
memory regions. Due to this changes, the root domain should also
undergo all sanity checks (just like regular domain) so we use
sbi_domain_register() to register root domain.
Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
Diffstat (limited to 'lib/sbi')
-rw-r--r-- | lib/sbi/sbi_domain.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/sbi/sbi_domain.c b/lib/sbi/sbi_domain.c index 6d4c608..195c941 100644 --- a/lib/sbi/sbi_domain.c +++ b/lib/sbi/sbi_domain.c @@ -496,6 +496,7 @@ int sbi_domain_finalize(struct sbi_scratch *scratch, u32 cold_hartid) int sbi_domain_init(struct sbi_scratch *scratch, u32 cold_hartid) { u32 i; + struct sbi_domain_memregion *memregs; const struct sbi_platform *plat = sbi_platform_ptr(scratch); /* Root domain firmware memory region */ @@ -514,6 +515,11 @@ int sbi_domain_init(struct sbi_scratch *scratch, u32 cold_hartid) /* Root domain memory region end */ root_memregs[ROOT_END_REGION].order = 0; + /* Use platform specific root memory regions when available */ + memregs = sbi_platform_domains_root_regions(plat); + if (memregs) + root.regions = memregs; + /* Root domain boot HART id is same as coldboot HART id */ root.boot_hartid = cold_hartid; @@ -522,18 +528,12 @@ int sbi_domain_init(struct sbi_scratch *scratch, u32 cold_hartid) root.next_addr = scratch->next_addr; root.next_mode = scratch->next_mode; - /* Select root domain for all valid HARTs */ + /* Root domain possible and assigned HARTs */ for (i = 0; i < SBI_HARTMASK_MAX_BITS; i++) { if (sbi_platform_hart_invalid(plat, i)) continue; sbi_hartmask_set_hart(i, &root_hmask); - hartid_to_domain_table[i] = &root; - sbi_hartmask_set_hart(i, &root.assigned_harts); } - /* Set root domain index */ - root.index = domain_count++; - domidx_to_domain_table[root.index] = &root; - - return 0; + return sbi_domain_register(&root, &root_hmask); } |