forked from Mirrors/opensbi
		
	lib: sbi: Improve misa_string() implementation
The RISC-V ISA string does not follow alphabetical order. Instead, we have a RISC-V specific ordering of extensions in the RISC-V ISA string. This patch improves misa_string() implementation to return a valid RISC-V ISA string. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
		@@ -173,19 +173,8 @@ int misa_extension_imp(char ext);
 | 
			
		||||
/* Get MXL field of misa, return -1 on error */
 | 
			
		||||
int misa_xlen(void);
 | 
			
		||||
 | 
			
		||||
static inline void misa_string(char *out, unsigned int out_sz)
 | 
			
		||||
{
 | 
			
		||||
	unsigned long i;
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < 26; i++) {
 | 
			
		||||
		if (misa_extension_imp('A' + i)) {
 | 
			
		||||
			*out = 'A' + i;
 | 
			
		||||
			out++;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	*out = '\0';
 | 
			
		||||
	out++;
 | 
			
		||||
}
 | 
			
		||||
/* Get RISC-V ISA string representation */
 | 
			
		||||
void misa_string(int xlen, char *out, unsigned int out_sz);
 | 
			
		||||
 | 
			
		||||
int pmp_set(unsigned int n, unsigned long prot, unsigned long addr,
 | 
			
		||||
	    unsigned long log2len);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user