forked from Mirrors/opensbi
		
	include: Add documentation for sbi_scratch and friends
This patch adds doxygen style documentation for struct sbi_scratch and related helper macros/defines. Signed-off-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
		@@ -12,36 +12,58 @@
 | 
			
		||||
 | 
			
		||||
#include <sbi/riscv_asm.h>
 | 
			
		||||
 | 
			
		||||
/** Offset of fw_start member in sbi_scratch */
 | 
			
		||||
#define SBI_SCRATCH_FW_START_OFFSET		(0 * __SIZEOF_POINTER__)
 | 
			
		||||
/** Offset of fw_size member in sbi_scratch */
 | 
			
		||||
#define SBI_SCRATCH_FW_SIZE_OFFSET		(1 * __SIZEOF_POINTER__)
 | 
			
		||||
/** Offset of next_arg1 member in sbi_scratch */
 | 
			
		||||
#define SBI_SCRATCH_NEXT_ARG1_OFFSET		(2 * __SIZEOF_POINTER__)
 | 
			
		||||
/** Offset of next_addr member in sbi_scratch */
 | 
			
		||||
#define SBI_SCRATCH_NEXT_ADDR_OFFSET		(3 * __SIZEOF_POINTER__)
 | 
			
		||||
/** Offset of next_mode member in sbi_scratch */
 | 
			
		||||
#define SBI_SCRATCH_NEXT_MODE_OFFSET		(4 * __SIZEOF_POINTER__)
 | 
			
		||||
/** Offset of warmboot_addr member in sbi_scratch */
 | 
			
		||||
#define SBI_SCRATCH_WARMBOOT_ADDR_OFFSET	(5 * __SIZEOF_POINTER__)
 | 
			
		||||
/** Offset of platform_addr member in sbi_scratch */
 | 
			
		||||
#define SBI_SCRATCH_PLATFORM_ADDR_OFFSET	(6 * __SIZEOF_POINTER__)
 | 
			
		||||
/** Offset of hartid_to_scratch member in sbi_scratch */
 | 
			
		||||
#define SBI_SCRATCH_HARTID_TO_SCRATCH_OFFSET	(7 * __SIZEOF_POINTER__)
 | 
			
		||||
/** Offset of ipi_type member in sbi_scratch */
 | 
			
		||||
#define SBI_SCRATCH_IPI_TYPE_OFFSET		(8 * __SIZEOF_POINTER__)
 | 
			
		||||
/** Maximum size of sbi_scratch */
 | 
			
		||||
#define SBI_SCRATCH_SIZE			256
 | 
			
		||||
 | 
			
		||||
#ifndef __ASSEMBLY__
 | 
			
		||||
 | 
			
		||||
#include <sbi/sbi_types.h>
 | 
			
		||||
 | 
			
		||||
/** Representation of per-HART scratch space */
 | 
			
		||||
struct sbi_scratch {
 | 
			
		||||
	/** Start (or base) address of firmware linked to OpenSBI library */
 | 
			
		||||
	unsigned long fw_start;
 | 
			
		||||
	/** Size (in bytes) of firmware linked to OpenSBI library */
 | 
			
		||||
	unsigned long fw_size;
 | 
			
		||||
	/** Arg1 (or 'a1' register) of next booting stage for this HART */
 | 
			
		||||
	unsigned long next_arg1;
 | 
			
		||||
	/** Address of next booting stage for this HART */
 | 
			
		||||
	unsigned long next_addr;
 | 
			
		||||
	/** Priviledge mode of next booting stage for this HART */
 | 
			
		||||
	unsigned long next_mode;
 | 
			
		||||
	/** Warm boot entry point address for this HART */
 | 
			
		||||
	unsigned long warmboot_addr;
 | 
			
		||||
	/** Address of sbi_platform */
 | 
			
		||||
	unsigned long platform_addr;
 | 
			
		||||
	/** Address of HART ID to sbi_scratch conversion function */
 | 
			
		||||
	unsigned long hartid_to_scratch;
 | 
			
		||||
	/** IPI type (or flags) */
 | 
			
		||||
	unsigned long ipi_type;
 | 
			
		||||
} __attribute__((packed));
 | 
			
		||||
 | 
			
		||||
/** Get pointer to sbi_scratch for current HART */
 | 
			
		||||
#define sbi_scratch_thishart_ptr()	\
 | 
			
		||||
((struct sbi_scratch *)csr_read(mscratch))
 | 
			
		||||
 | 
			
		||||
/** Get Arg1 of next booting stage for current HART */
 | 
			
		||||
#define sbi_scratch_thishart_arg1_ptr()	\
 | 
			
		||||
((void *)(sbi_scratch_thishart_ptr()->next_arg1))
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user