sbi_emulate_csr: Shift sbi_timer_value directly

csr_val is a tartget length based variable, so on 32-bit devices it's
only 32-bits. To avoid clearing the entire register perform both steps
in a single line.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
This commit is contained in:
Alistair Francis
2019-01-18 11:36:32 -08:00
committed by Anup Patel
parent 9f44d07df5
commit f4cf6da7ff

View File

@@ -60,8 +60,7 @@ int sbi_emulate_csr_read(int csr_num,
case CSR_TIMEH:
if (!((cen >> (CSR_TIME - CSR_CYCLE)) & 1))
return -1;
*csr_val = sbi_timer_value(scratch);
*csr_val = *csr_val >> 32;
*csr_val = sbi_timer_value(scratch) >> 32;
break;
case CSR_INSTRETH:
if (!((cen >> (CSR_INSTRET - CSR_CYCLE)) & 1))