lib: sbi: do platform-specific extension population

A patch from »Add support for T-HEAD C9xx PMU extensions« in state Accepted for opensbi

From: Heiko Stuebner <heiko@...> Date: Thu, 11 Aug 2022 18:52:34 +0200

Commit-Message

Some of the more specific detections in hart_detect_features() might need to check platform-specific extensions so might need the platform-extensions being populated earlier. So move the call to sbi_platform_extensions_init() to an earlier place. Signed-off-by: Heiko Stuebner <heiko@...>

Patch-Comment

lib/sbi/sbi_hart.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)

Statistics

  • 6 lines added
  • 6 lines removed

Changes

------------------------------ lib/sbi/sbi_hart.c ------------------------------
index 50e5907..5b33623 100644
@@ -553,6 +553,12 @@ static int hart_detect_features(struct sbi_scratch *scratch)
hfeatures->pmp_count = 0;
hfeatures->mhpm_count = 0;
+ /* Let platform populate extensions */
+ rc = sbi_platform_extensions_init(sbi_platform_thishart_ptr(),
+ &hfeatures->extensions);
+ if (rc)
+ return rc;
+
#define __check_csr(__csr, __rdonly, __wrval, __field, __skip) \
oldval = csr_read_allowed(__csr, (ulong)&trap); \
if (!trap.cause) { \
@@ -681,12 +687,6 @@ __mhpm_skip:
SBI_HART_EXT_SMSTATEEN, true);
}
- /* Let platform populate extensions */
- rc = sbi_platform_extensions_init(sbi_platform_thishart_ptr(),
- &hfeatures->extensions);
- if (rc)
- return rc;
-
/* Mark hart feature detection done */
hfeatures->detected = true;
 
 

Recent Patches

About Us

Sed lacus. Donec lectus. Nullam pretium nibh ut turpis. Nam bibendum. In nulla tortor, elementum vel, tempor at, varius non, purus. Mauris vitae nisl nec metus placerat consectetuer.

Read More...