forked from Mirrors/opensbi
		
	platform: generic: andes: add a new Andes SBI call to set up a PMA entry
Implement a new Andes SBI call, which is to set up a NAPOT region with given memory attributes. Signed-off-by: Ben Zong-You Xie <ben717@andestech.com> Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
		
				
					committed by
					
						
						Anup Patel
					
				
			
			
				
	
			
			
			
						parent
						
							4a72abb5f4
						
					
				
				
					commit
					aa56084c4d
				
			@@ -12,11 +12,15 @@
 | 
			
		||||
 | 
			
		||||
#define ANDES_PMA_GRANULARITY			(1 << 12)
 | 
			
		||||
 | 
			
		||||
#define ANDES_PMACFG_ETYP_OFFSET		0
 | 
			
		||||
#define ANDES_PMACFG_ETYP_MASK			(3 << ANDES_PMACFG_ETYP_OFFSET)
 | 
			
		||||
#define ANDES_PMACFG_ETYP_OFF			(0 << ANDES_PMACFG_ETYP_OFFSET)
 | 
			
		||||
/* Naturally aligned power of 2 region */
 | 
			
		||||
#define ANDES_PMACFG_ETYP_NAPOT			3
 | 
			
		||||
#define ANDES_PMACFG_ETYP_NAPOT			(3 << ANDES_PMACFG_ETYP_OFFSET)
 | 
			
		||||
 | 
			
		||||
#define ANDES_PMACFG_MTYP_OFFSET		2
 | 
			
		||||
/* Memory, Non-cacheable, Bufferable */
 | 
			
		||||
#define ANDES_PMACFG_MTYP_MEM_NON_CACHE_BUF	(3 << 2)
 | 
			
		||||
#define ANDES_PMACFG_MTYP_MEM_NON_CACHE_BUF	(3 << ANDES_PMACFG_MTYP_OFFSET)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * struct andes_pma_region - Describes PMA regions
 | 
			
		||||
@@ -59,4 +63,18 @@ int andes_pma_setup_regions(const struct andes_pma_region *pma_regions,
 | 
			
		||||
 */
 | 
			
		||||
bool andes_sbi_probe_pma(void);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Set a NAPOT region with given memory attributes
 | 
			
		||||
 * @param pa: Start address of the NAPOT region
 | 
			
		||||
 * @param size: Size of the NAPOT region
 | 
			
		||||
 * @param flags: Memory attributes set to the NAPOT region
 | 
			
		||||
 *
 | 
			
		||||
 * @return SBI_SUCCESS on success
 | 
			
		||||
 * @return SBI_ERR_NOT_SUPPORTED if hardware does not support PPMA features
 | 
			
		||||
 * @return SBI_ERR_INVALID_PARAM if the given region is overlapped with the
 | 
			
		||||
 *	   region that has been set already
 | 
			
		||||
 * @return SBI_ERR_FAILED if available entries have run out or setup fails
 | 
			
		||||
 */
 | 
			
		||||
int andes_sbi_set_pma(unsigned long pa, unsigned long size, u8 flags);
 | 
			
		||||
 | 
			
		||||
#endif /* _ANDES_PMA_H_ */
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user