forked from Mirrors/opensbi
		
	platform: generic: Pass FDT to early/final_init overrides
Several of these override functions access the FDT blob. Explicitly indicate which callbacks are allowed to modify the FDT blob by passing the parameter as a possibly-const pointer. This also reduces code size by deduplicating the call to fdt_get_address(). Signed-off-by: Samuel Holland <samuel.holland@sifive.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
		
				
					committed by
					
						
						Anup Patel
					
				
			
			
				
	
			
			
			
						parent
						
							3f964652d9
						
					
				
				
					commit
					6e5db7b09c
				
			@@ -88,12 +88,9 @@ static const struct sbi_hsm_device andes_smu = {
 | 
			
		||||
	.hart_stop    = ae350_hart_stop,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void ae350_hsm_device_init(void)
 | 
			
		||||
static void ae350_hsm_device_init(const void *fdt)
 | 
			
		||||
{
 | 
			
		||||
	int rc;
 | 
			
		||||
	void *fdt;
 | 
			
		||||
 | 
			
		||||
	fdt = fdt_get_address();
 | 
			
		||||
 | 
			
		||||
	rc = fdt_parse_compat_addr(fdt, (uint64_t *)&smu.addr,
 | 
			
		||||
				   "andestech,atcsmu");
 | 
			
		||||
@@ -103,10 +100,11 @@ static void ae350_hsm_device_init(void)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int ae350_final_init(bool cold_boot, const struct fdt_match *match)
 | 
			
		||||
static int ae350_final_init(bool cold_boot, void *fdt,
 | 
			
		||||
			    const struct fdt_match *match)
 | 
			
		||||
{
 | 
			
		||||
	if (cold_boot)
 | 
			
		||||
		ae350_hsm_device_init();
 | 
			
		||||
		ae350_hsm_device_init(fdt);
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -311,13 +311,13 @@ static int andes_fdt_reserved_memory_fixup(void *fdt,
 | 
			
		||||
	return andes_fdt_pma_resv(fdt, pma, entry, parent);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int andes_pma_setup_regions(const struct andes_pma_region *pma_regions,
 | 
			
		||||
int andes_pma_setup_regions(void *fdt,
 | 
			
		||||
			    const struct andes_pma_region *pma_regions,
 | 
			
		||||
			    unsigned int pma_regions_count)
 | 
			
		||||
{
 | 
			
		||||
	unsigned int dt_populate_cnt;
 | 
			
		||||
	unsigned int i, j;
 | 
			
		||||
	unsigned long pa;
 | 
			
		||||
	void *fdt;
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
	if (!pma_regions || !pma_regions_count)
 | 
			
		||||
@@ -342,8 +342,6 @@ int andes_pma_setup_regions(const struct andes_pma_region *pma_regions,
 | 
			
		||||
	if (!dt_populate_cnt)
 | 
			
		||||
		return 0;
 | 
			
		||||
 | 
			
		||||
	fdt = fdt_get_address();
 | 
			
		||||
 | 
			
		||||
	ret = fdt_open_into(fdt, fdt,
 | 
			
		||||
			    fdt_totalsize(fdt) + (64 * dt_populate_cnt));
 | 
			
		||||
	if (ret < 0)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user