forked from Mirrors/opensbi
		
	lib: sbi: Print scratch size and usage at boot time
The scratch space being a scarce resource so let us print it's size and usage at boot time. Signed-off-by: Anup Patel <apatel@ventanamicro.com> Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
This commit is contained in:
		@@ -128,6 +128,11 @@ static void sbi_boot_print_general(struct sbi_scratch *scratch)
 | 
			
		||||
		   (u32)(sbi_heap_reserved_space() / 1024),
 | 
			
		||||
		   (u32)(sbi_heap_used_space() / 1024),
 | 
			
		||||
		   (u32)(sbi_heap_free_space() / 1024));
 | 
			
		||||
	sbi_printf("Firmware Scratch Size     : "
 | 
			
		||||
		   "%d B (total), %d B (used), %d B (free)\n",
 | 
			
		||||
		   SBI_SCRATCH_SIZE,
 | 
			
		||||
		   (u32)sbi_scratch_used_space(),
 | 
			
		||||
		   (u32)(SBI_SCRATCH_SIZE - sbi_scratch_used_space()));
 | 
			
		||||
 | 
			
		||||
	/* SBI details */
 | 
			
		||||
	sbi_printf("Runtime SBI Version       : %d.%d\n",
 | 
			
		||||
 
 | 
			
		||||
@@ -97,3 +97,14 @@ void sbi_scratch_free_offset(unsigned long offset)
 | 
			
		||||
	 * brain-dead allocator.
 | 
			
		||||
	 */
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unsigned long sbi_scratch_used_space(void)
 | 
			
		||||
{
 | 
			
		||||
	unsigned long ret = 0;
 | 
			
		||||
 | 
			
		||||
	spin_lock(&extra_lock);
 | 
			
		||||
	ret = extra_offset;
 | 
			
		||||
	spin_unlock(&extra_lock);
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user