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
				
			@@ -282,23 +282,23 @@ err:
 | 
			
		||||
	return rc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int starfive_jh7110_final_init(bool cold_boot, void *fdt,
 | 
			
		||||
				      const struct fdt_match *match)
 | 
			
		||||
static int starfive_jh7110_final_init(bool cold_boot)
 | 
			
		||||
{
 | 
			
		||||
	if (cold_boot) {
 | 
			
		||||
		const void *fdt = fdt_get_address();
 | 
			
		||||
 | 
			
		||||
		fdt_driver_init_one(fdt, starfive_jh7110_reset_drivers);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
	return generic_final_init(cold_boot);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static bool starfive_jh7110_cold_boot_allowed(u32 hartid,
 | 
			
		||||
				   const struct fdt_match *match)
 | 
			
		||||
static bool starfive_jh7110_cold_boot_allowed(u32 hartid)
 | 
			
		||||
{
 | 
			
		||||
	if (selected_hartid != -1)
 | 
			
		||||
		return (selected_hartid == hartid);
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
	return generic_cold_boot_allowed(hartid);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int starfive_jh7110_platform_init(const void *fdt, int nodeoff,
 | 
			
		||||
@@ -314,6 +314,9 @@ static int starfive_jh7110_platform_init(const void *fdt, int nodeoff,
 | 
			
		||||
			selected_hartid = (u32) fdt32_to_cpu(*val);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	generic_platform_ops.cold_boot_allowed = starfive_jh7110_cold_boot_allowed;
 | 
			
		||||
	generic_platform_ops.final_init = starfive_jh7110_final_init;
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -325,6 +328,4 @@ static const struct fdt_match starfive_jh7110_match[] = {
 | 
			
		||||
const struct platform_override starfive_jh7110 = {
 | 
			
		||||
	.match_table = starfive_jh7110_match,
 | 
			
		||||
	.init = starfive_jh7110_platform_init,
 | 
			
		||||
	.cold_boot_allowed = starfive_jh7110_cold_boot_allowed,
 | 
			
		||||
	.final_init = starfive_jh7110_final_init,
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user