aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSamuel Holland <samuel.holland@sifive.com>2024-08-30 08:49:07 -0700
committerAnup Patel <anup@brainfault.org>2024-09-25 12:03:30 +0530
commit15c4e285db3fe09bf96bddb7c15acb8d8827e1fe (patch)
tree164cd41a13b450c562c53c568c8215a01c3df7da /include
parent9d7a983060dc379ae788ed1879371211a1005c6f (diff)
downloadopensbi-15c4e285db3fe09bf96bddb7c15acb8d8827e1fe.zip
opensbi-15c4e285db3fe09bf96bddb7c15acb8d8827e1fe.tar.gz
opensbi-15c4e285db3fe09bf96bddb7c15acb8d8827e1fe.tar.bz2
lib: sbi: Use current_hartindex() where possible
This avoids calls to the expensive sbi_hartid_to_hartindex() function and also makes the firmware smaller. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org>
Diffstat (limited to 'include')
-rw-r--r--include/sbi/sbi_domain.h2
-rw-r--r--include/sbi/sbi_domain_context.h7
2 files changed, 4 insertions, 5 deletions
diff --git a/include/sbi/sbi_domain.h b/include/sbi/sbi_domain.h
index 313ae15..c1a1717 100644
--- a/include/sbi/sbi_domain.h
+++ b/include/sbi/sbi_domain.h
@@ -204,7 +204,7 @@ void sbi_update_hartindex_to_domain(u32 hartindex, struct sbi_domain *dom);
/** Get pointer to sbi_domain for current HART */
#define sbi_domain_thishart_ptr() \
- sbi_hartindex_to_domain(sbi_hartid_to_hartindex(current_hartid()))
+ sbi_hartindex_to_domain(current_hartindex())
/** Head of linked list of domains */
extern struct sbi_dlist domain_list;
diff --git a/include/sbi/sbi_domain_context.h b/include/sbi/sbi_domain_context.h
index 0d25884..a92f338 100644
--- a/include/sbi/sbi_domain_context.h
+++ b/include/sbi/sbi_domain_context.h
@@ -52,10 +52,9 @@ struct sbi_context {
(__d)->hartindex_to_context_table[__hartindex]
/** Macro to obtain the current hart's context pointer */
-#define sbi_domain_context_thishart_ptr() \
- sbi_hartindex_to_domain_context( \
- sbi_hartid_to_hartindex(current_hartid()), \
- sbi_domain_thishart_ptr())
+#define sbi_domain_context_thishart_ptr() \
+ sbi_hartindex_to_domain_context(current_hartindex(), \
+ sbi_domain_thishart_ptr())
/**
* Enter a specific domain context synchronously