forked from Mirrors/opensbi
		
	firmware: Add RW section offset in scratch
Add the RW section offset, provided by _fw_rw_offset symbol, to the scratch structure. This will be used to program separate pmp entry for RW section. Signed-off-by: Himanshu Chauhan <hchauhan@ventanamicro.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
		
				
					committed by
					
						
						Anup Patel
					
				
			
			
				
	
			
			
			
						parent
						
							2f40a99c9e
						
					
				
				
					commit
					c10e3fe5f9
				
			@@ -298,6 +298,12 @@ _scratch_init:
 | 
				
			|||||||
	sub	a5, t3, a4
 | 
						sub	a5, t3, a4
 | 
				
			||||||
	REG_S	a4, SBI_SCRATCH_FW_START_OFFSET(tp)
 | 
						REG_S	a4, SBI_SCRATCH_FW_START_OFFSET(tp)
 | 
				
			||||||
	REG_S	a5, SBI_SCRATCH_FW_SIZE_OFFSET(tp)
 | 
						REG_S	a5, SBI_SCRATCH_FW_SIZE_OFFSET(tp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/* Store R/W section's offset in scratch space */
 | 
				
			||||||
 | 
						lla	a4, __fw_rw_offset
 | 
				
			||||||
 | 
						REG_L	a5, 0(a4)
 | 
				
			||||||
 | 
						REG_S	a5, SBI_SCRATCH_FW_RW_OFFSET(tp)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Store next arg1 in scratch space */
 | 
						/* Store next arg1 in scratch space */
 | 
				
			||||||
	MOV_3R	s0, a0, s1, a1, s2, a2
 | 
						MOV_3R	s0, a0, s1, a1, s2, a2
 | 
				
			||||||
	call	fw_next_arg1
 | 
						call	fw_next_arg1
 | 
				
			||||||
@@ -519,6 +525,8 @@ _link_start:
 | 
				
			|||||||
	RISCV_PTR	FW_TEXT_START
 | 
						RISCV_PTR	FW_TEXT_START
 | 
				
			||||||
_link_end:
 | 
					_link_end:
 | 
				
			||||||
	RISCV_PTR	_fw_reloc_end
 | 
						RISCV_PTR	_fw_reloc_end
 | 
				
			||||||
 | 
					__fw_rw_offset:
 | 
				
			||||||
 | 
						RISCV_PTR	_fw_rw_offset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	.section .entry, "ax", %progbits
 | 
						.section .entry, "ax", %progbits
 | 
				
			||||||
	.align 3
 | 
						.align 3
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,26 +18,28 @@
 | 
				
			|||||||
#define SBI_SCRATCH_FW_START_OFFSET		(0 * __SIZEOF_POINTER__)
 | 
					#define SBI_SCRATCH_FW_START_OFFSET		(0 * __SIZEOF_POINTER__)
 | 
				
			||||||
/** Offset of fw_size member in sbi_scratch */
 | 
					/** Offset of fw_size member in sbi_scratch */
 | 
				
			||||||
#define SBI_SCRATCH_FW_SIZE_OFFSET		(1 * __SIZEOF_POINTER__)
 | 
					#define SBI_SCRATCH_FW_SIZE_OFFSET		(1 * __SIZEOF_POINTER__)
 | 
				
			||||||
 | 
					/** Offset (in sbi_scratch) of the R/W Offset */
 | 
				
			||||||
 | 
					#define SBI_SCRATCH_FW_RW_OFFSET		(2 * __SIZEOF_POINTER__)
 | 
				
			||||||
/** Offset of next_arg1 member in sbi_scratch */
 | 
					/** Offset of next_arg1 member in sbi_scratch */
 | 
				
			||||||
#define SBI_SCRATCH_NEXT_ARG1_OFFSET		(2 * __SIZEOF_POINTER__)
 | 
					#define SBI_SCRATCH_NEXT_ARG1_OFFSET		(3 * __SIZEOF_POINTER__)
 | 
				
			||||||
/** Offset of next_addr member in sbi_scratch */
 | 
					/** Offset of next_addr member in sbi_scratch */
 | 
				
			||||||
#define SBI_SCRATCH_NEXT_ADDR_OFFSET		(3 * __SIZEOF_POINTER__)
 | 
					#define SBI_SCRATCH_NEXT_ADDR_OFFSET		(4 * __SIZEOF_POINTER__)
 | 
				
			||||||
/** Offset of next_mode member in sbi_scratch */
 | 
					/** Offset of next_mode member in sbi_scratch */
 | 
				
			||||||
#define SBI_SCRATCH_NEXT_MODE_OFFSET		(4 * __SIZEOF_POINTER__)
 | 
					#define SBI_SCRATCH_NEXT_MODE_OFFSET		(5 * __SIZEOF_POINTER__)
 | 
				
			||||||
/** Offset of warmboot_addr member in sbi_scratch */
 | 
					/** Offset of warmboot_addr member in sbi_scratch */
 | 
				
			||||||
#define SBI_SCRATCH_WARMBOOT_ADDR_OFFSET	(5 * __SIZEOF_POINTER__)
 | 
					#define SBI_SCRATCH_WARMBOOT_ADDR_OFFSET	(6 * __SIZEOF_POINTER__)
 | 
				
			||||||
/** Offset of platform_addr member in sbi_scratch */
 | 
					/** Offset of platform_addr member in sbi_scratch */
 | 
				
			||||||
#define SBI_SCRATCH_PLATFORM_ADDR_OFFSET	(6 * __SIZEOF_POINTER__)
 | 
					#define SBI_SCRATCH_PLATFORM_ADDR_OFFSET	(7 * __SIZEOF_POINTER__)
 | 
				
			||||||
/** Offset of hartid_to_scratch member in sbi_scratch */
 | 
					/** Offset of hartid_to_scratch member in sbi_scratch */
 | 
				
			||||||
#define SBI_SCRATCH_HARTID_TO_SCRATCH_OFFSET	(7 * __SIZEOF_POINTER__)
 | 
					#define SBI_SCRATCH_HARTID_TO_SCRATCH_OFFSET	(8 * __SIZEOF_POINTER__)
 | 
				
			||||||
/** Offset of trap_exit member in sbi_scratch */
 | 
					/** Offset of trap_exit member in sbi_scratch */
 | 
				
			||||||
#define SBI_SCRATCH_TRAP_EXIT_OFFSET		(8 * __SIZEOF_POINTER__)
 | 
					#define SBI_SCRATCH_TRAP_EXIT_OFFSET		(9 * __SIZEOF_POINTER__)
 | 
				
			||||||
/** Offset of tmp0 member in sbi_scratch */
 | 
					/** Offset of tmp0 member in sbi_scratch */
 | 
				
			||||||
#define SBI_SCRATCH_TMP0_OFFSET			(9 * __SIZEOF_POINTER__)
 | 
					#define SBI_SCRATCH_TMP0_OFFSET			(10 * __SIZEOF_POINTER__)
 | 
				
			||||||
/** Offset of options member in sbi_scratch */
 | 
					/** Offset of options member in sbi_scratch */
 | 
				
			||||||
#define SBI_SCRATCH_OPTIONS_OFFSET		(10 * __SIZEOF_POINTER__)
 | 
					#define SBI_SCRATCH_OPTIONS_OFFSET		(11 * __SIZEOF_POINTER__)
 | 
				
			||||||
/** Offset of extra space in sbi_scratch */
 | 
					/** Offset of extra space in sbi_scratch */
 | 
				
			||||||
#define SBI_SCRATCH_EXTRA_SPACE_OFFSET		(11 * __SIZEOF_POINTER__)
 | 
					#define SBI_SCRATCH_EXTRA_SPACE_OFFSET		(12 * __SIZEOF_POINTER__)
 | 
				
			||||||
/** Maximum size of sbi_scratch (4KB) */
 | 
					/** Maximum size of sbi_scratch (4KB) */
 | 
				
			||||||
#define SBI_SCRATCH_SIZE			(0x1000)
 | 
					#define SBI_SCRATCH_SIZE			(0x1000)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -53,6 +55,8 @@ struct sbi_scratch {
 | 
				
			|||||||
	unsigned long fw_start;
 | 
						unsigned long fw_start;
 | 
				
			||||||
	/** Size (in bytes) of firmware linked to OpenSBI library */
 | 
						/** Size (in bytes) of firmware linked to OpenSBI library */
 | 
				
			||||||
	unsigned long fw_size;
 | 
						unsigned long fw_size;
 | 
				
			||||||
 | 
						/** Offset (in bytes) of the R/W section */
 | 
				
			||||||
 | 
						unsigned long fw_rw_offset;
 | 
				
			||||||
	/** Arg1 (or 'a1' register) of next booting stage for this HART */
 | 
						/** Arg1 (or 'a1' register) of next booting stage for this HART */
 | 
				
			||||||
	unsigned long next_arg1;
 | 
						unsigned long next_arg1;
 | 
				
			||||||
	/** Address of next booting stage for this HART */
 | 
						/** Address of next booting stage for this HART */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user