forked from Mirrors/opensbi
		
	lib: sbi_trap: Remove scratch parameter from sbi_trap_redirect()
The scratch parameter of sbi_trap_redirect() is not used hence we remove it. Signed-off-by: Anup Patel <anup.patel@wdc.com> Reviewed-by: Atish Patra <atish.patra@wdc.com>
This commit is contained in:
		@@ -205,8 +205,7 @@ struct sbi_trap_info {
 | 
			
		||||
struct sbi_scratch;
 | 
			
		||||
 | 
			
		||||
int sbi_trap_redirect(struct sbi_trap_regs *regs,
 | 
			
		||||
		      struct sbi_trap_info *trap,
 | 
			
		||||
		      struct sbi_scratch *scratch);
 | 
			
		||||
		      struct sbi_trap_info *trap);
 | 
			
		||||
 | 
			
		||||
void sbi_trap_handler(struct sbi_trap_regs *regs,
 | 
			
		||||
		      struct sbi_scratch *scratch);
 | 
			
		||||
 
 | 
			
		||||
@@ -111,7 +111,7 @@ int sbi_ecall_handler(u32 hartid, ulong mcause, struct sbi_trap_regs *regs,
 | 
			
		||||
 | 
			
		||||
	if (ret == SBI_ETRAP) {
 | 
			
		||||
		trap.epc = regs->mepc;
 | 
			
		||||
		sbi_trap_redirect(regs, &trap, scratch);
 | 
			
		||||
		sbi_trap_redirect(regs, &trap);
 | 
			
		||||
	} else {
 | 
			
		||||
		/*
 | 
			
		||||
		 * This function should return non-zero value only in case of
 | 
			
		||||
 
 | 
			
		||||
@@ -32,7 +32,7 @@ static int truly_illegal_insn(ulong insn, u32 hartid, ulong mcause,
 | 
			
		||||
	trap.tval2 = 0;
 | 
			
		||||
	trap.tinst = 0;
 | 
			
		||||
 | 
			
		||||
	return sbi_trap_redirect(regs, &trap, scratch);
 | 
			
		||||
	return sbi_trap_redirect(regs, &trap);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int system_opcode_insn(ulong insn, u32 hartid, ulong mcause,
 | 
			
		||||
@@ -144,8 +144,7 @@ int sbi_illegal_insn_handler(u32 hartid, ulong mcause, ulong insn,
 | 
			
		||||
			insn = sbi_get_insn(regs->mepc, &uptrap);
 | 
			
		||||
			if (uptrap.cause) {
 | 
			
		||||
				uptrap.epc = regs->mepc;
 | 
			
		||||
				return sbi_trap_redirect(regs, &uptrap,
 | 
			
		||||
							 scratch);
 | 
			
		||||
				return sbi_trap_redirect(regs, &uptrap);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if ((insn & 3) != 3)
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ int sbi_misaligned_load_handler(u32 hartid, ulong mcause,
 | 
			
		||||
		insn = sbi_get_insn(regs->mepc, &uptrap);
 | 
			
		||||
		if (uptrap.cause) {
 | 
			
		||||
			uptrap.epc = regs->mepc;
 | 
			
		||||
			return sbi_trap_redirect(regs, &uptrap, scratch);
 | 
			
		||||
			return sbi_trap_redirect(regs, &uptrap);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -114,7 +114,7 @@ int sbi_misaligned_load_handler(u32 hartid, ulong mcause,
 | 
			
		||||
		uptrap.tval = addr;
 | 
			
		||||
		uptrap.tval2 = tval2;
 | 
			
		||||
		uptrap.tinst = tinst;
 | 
			
		||||
		return sbi_trap_redirect(regs, &uptrap, scratch);
 | 
			
		||||
		return sbi_trap_redirect(regs, &uptrap);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	val.data_u64 = 0;
 | 
			
		||||
@@ -123,7 +123,7 @@ int sbi_misaligned_load_handler(u32 hartid, ulong mcause,
 | 
			
		||||
						&uptrap);
 | 
			
		||||
		if (uptrap.cause) {
 | 
			
		||||
			uptrap.epc = regs->mepc;
 | 
			
		||||
			return sbi_trap_redirect(regs, &uptrap, scratch);
 | 
			
		||||
			return sbi_trap_redirect(regs, &uptrap);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -165,7 +165,7 @@ int sbi_misaligned_store_handler(u32 hartid, ulong mcause,
 | 
			
		||||
		insn = sbi_get_insn(regs->mepc, &uptrap);
 | 
			
		||||
		if (uptrap.cause) {
 | 
			
		||||
			uptrap.epc = regs->mepc;
 | 
			
		||||
			return sbi_trap_redirect(regs, &uptrap, scratch);
 | 
			
		||||
			return sbi_trap_redirect(regs, &uptrap);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -225,7 +225,7 @@ int sbi_misaligned_store_handler(u32 hartid, ulong mcause,
 | 
			
		||||
		uptrap.tval = addr;
 | 
			
		||||
		uptrap.tval2 = tval2;
 | 
			
		||||
		uptrap.tinst = tinst;
 | 
			
		||||
		return sbi_trap_redirect(regs, &uptrap, scratch);
 | 
			
		||||
		return sbi_trap_redirect(regs, &uptrap);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for (i = 0; i < len; i++) {
 | 
			
		||||
@@ -233,7 +233,7 @@ int sbi_misaligned_store_handler(u32 hartid, ulong mcause,
 | 
			
		||||
			     &uptrap);
 | 
			
		||||
		if (uptrap.cause) {
 | 
			
		||||
			uptrap.epc = regs->mepc;
 | 
			
		||||
			return sbi_trap_redirect(regs, &uptrap, scratch);
 | 
			
		||||
			return sbi_trap_redirect(regs, &uptrap);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -74,13 +74,11 @@ static void __noreturn sbi_trap_error(const char *msg, int rc, u32 hartid,
 | 
			
		||||
 *
 | 
			
		||||
 * @param regs pointer to register state
 | 
			
		||||
 * @param trap pointer to trap details
 | 
			
		||||
 * @param scratch pointer to sbi_scratch of current HART
 | 
			
		||||
 *
 | 
			
		||||
 * @return 0 on success and negative error code on failure
 | 
			
		||||
 */
 | 
			
		||||
int sbi_trap_redirect(struct sbi_trap_regs *regs,
 | 
			
		||||
		      struct sbi_trap_info *trap,
 | 
			
		||||
		      struct sbi_scratch *scratch)
 | 
			
		||||
		      struct sbi_trap_info *trap)
 | 
			
		||||
{
 | 
			
		||||
	ulong hstatus, vsstatus, prev_mode;
 | 
			
		||||
#if __riscv_xlen == 32
 | 
			
		||||
@@ -273,7 +271,7 @@ void sbi_trap_handler(struct sbi_trap_regs *regs,
 | 
			
		||||
		trap.tval = mtval;
 | 
			
		||||
		trap.tval2 = mtval2;
 | 
			
		||||
		trap.tinst = mtinst;
 | 
			
		||||
		rc = sbi_trap_redirect(regs, &trap, scratch);
 | 
			
		||||
		rc = sbi_trap_redirect(regs, &trap);
 | 
			
		||||
		break;
 | 
			
		||||
	};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user