forked from Mirrors/opensbi
platform: generic: Modify platform ops instead of using hooks
Switch all existing platform overrides to use the helper pattern instead of the platform hooks. After this commit, only the .match_table and .init members of struct platform_override are used. There are two minor behavioral differences: - For Allwinner D1, fdt_add_cpu_idle_states() is now called before the body of generic_final_init(). This should have no functional impact. - For StarFive JH7110, if the /chosen/starfive,boot-hart-id property is missing, the code now falls back to using generic_coldboot_harts, instead of accepting any hart. Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Anup Patel <anup@brainfault.org> Link: https://lore.kernel.org/r/20250325234342.711447-7-samuel.holland@sifive.com Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:

committed by
Anup Patel

parent
2489e1421d
commit
b353af63e2
@@ -11,6 +11,7 @@
|
||||
#include <sbi/sbi_error.h>
|
||||
#include <sbi/sbi_pmu.h>
|
||||
#include <libfdt.h>
|
||||
#include <platform_override.h>
|
||||
|
||||
static void andes_hw_counter_enable_irq(uint32_t ctr_idx)
|
||||
{
|
||||
@@ -57,10 +58,14 @@ static struct sbi_pmu_device andes_pmu = {
|
||||
.hw_counter_filter_mode = andes_hw_counter_filter_mode
|
||||
};
|
||||
|
||||
int andes_pmu_extensions_init(const struct fdt_match *match,
|
||||
struct sbi_hart_features *hfeatures)
|
||||
int andes_pmu_extensions_init(struct sbi_hart_features *hfeatures)
|
||||
{
|
||||
struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
|
||||
int rc;
|
||||
|
||||
rc = generic_extensions_init(hfeatures);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
if (!has_andes_pmu())
|
||||
return 0;
|
||||
@@ -82,12 +87,12 @@ int andes_pmu_extensions_init(const struct fdt_match *match,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int andes_pmu_init(const struct fdt_match *match)
|
||||
int andes_pmu_init(void)
|
||||
{
|
||||
struct sbi_scratch *scratch = sbi_scratch_thishart_ptr();
|
||||
|
||||
if (sbi_hart_has_extension(scratch, SBI_HART_EXT_XANDESPMU))
|
||||
sbi_pmu_set_device(&andes_pmu);
|
||||
|
||||
return 0;
|
||||
return generic_pmu_init();
|
||||
}
|
||||
|
Reference in New Issue
Block a user