lib: Remove prints from sbi_hart_switch_mode()

The sbi_hart_switch_mode() will be used by CPU hotplug. This means
if we have prints in sbi_hart_switch_mode() then these prints will
mix with Linux prints.

Being a runtime firmware, we should be verbose only at coldboot
time and error situations.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
Anup Patel
2018-12-21 14:12:10 +05:30
committed by Anup Patel
parent 1bfa244505
commit a18913200a

View File

@@ -209,7 +209,7 @@ int sbi_hart_init(struct sbi_scratch *scratch, u32 hartid)
void __attribute__((noreturn)) sbi_hart_hang(void) void __attribute__((noreturn)) sbi_hart_hang(void)
{ {
sbi_printf("\nHART %u Hang !!\n\n", sbi_current_hartid()); sbi_printf("\nHART%u Hang !!\n\n", sbi_current_hartid());
while (1) while (1)
wfi(); wfi();
@@ -222,7 +222,6 @@ void __attribute__((noreturn)) sbi_hart_switch_mode(unsigned long arg0,
unsigned long next_mode) unsigned long next_mode)
{ {
unsigned long val; unsigned long val;
char mode = 'M';
switch (next_mode) { switch (next_mode) {
case PRV_M: case PRV_M:
@@ -236,7 +235,6 @@ void __attribute__((noreturn)) sbi_hart_switch_mode(unsigned long arg0,
sbi_hart_hang(); sbi_hart_hang();
break; break;
default: default:
sbi_printf("\nTrying to switch to unsupported mode\n");
sbi_hart_hang(); sbi_hart_hang();
} }
@@ -248,21 +246,16 @@ void __attribute__((noreturn)) sbi_hart_switch_mode(unsigned long arg0,
csr_write(mepc, next_addr); csr_write(mepc, next_addr);
if (next_mode == PRV_S) { if (next_mode == PRV_S) {
mode = 'S';
csr_write(stvec, next_addr); csr_write(stvec, next_addr);
csr_write(sscratch, 0); csr_write(sscratch, 0);
csr_write(sie, 0); csr_write(sie, 0);
csr_write(satp, 0); csr_write(satp, 0);
} else if (next_mode == PRV_U) { } else if (next_mode == PRV_U) {
mode = 'U';
csr_write(utvec, next_addr); csr_write(utvec, next_addr);
csr_write(uscratch, 0); csr_write(uscratch, 0);
csr_write(uie, 0); csr_write(uie, 0);
} }
sbi_printf("HART %u switching to %c-mode...\n\n",
sbi_current_hartid(), mode);
register unsigned long a0 asm ("a0") = arg0; register unsigned long a0 asm ("a0") = arg0;
register unsigned long a1 asm ("a1") = arg1; register unsigned long a1 asm ("a1") = arg1;
__asm__ __volatile__ ("mret" : : "r" (a0), "r" (a1)); __asm__ __volatile__ ("mret" : : "r" (a0), "r" (a1));