Files
opensbi/lib/utils/sys/sifive_test.c
Anup Patel c4acc60a46 include: sbi: Remove opensbi specific reset type defines
We can now use the standard SBI SRST extension reset types instead
of the opensbi specific (SBI_PLATFORM_RESET_xyz) reset types hence
remove related opensbi specific defines. The "platform_" prefix of
the reset type parameter of sbi_system_reset() function should also
be removed.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Atish Patra <atish.patra@wdc.com>
2020-12-01 17:05:12 +05:30

45 lines
870 B
C

/*
* SPDX-License-Identifier: BSD-3-Clause
*
* Copyright (c) 2020 Western Digital Corporation or its affiliates.
*
* Authors:
* Anup Patel <anup.patel@wdc.com>
*/
#include <sbi/riscv_io.h>
#include <sbi/sbi_platform.h>
#include <sbi_utils/sys/sifive_test.h>
#define FINISHER_FAIL 0x3333
#define FINISHER_PASS 0x5555
#define FINISHER_RESET 0x7777
static void *sifive_test_base;
int sifive_test_system_reset(u32 type)
{
/*
* Tell the "finisher" that the simulation
* was successful so that QEMU exits
*/
switch (type) {
case SBI_SRST_RESET_TYPE_SHUTDOWN:
writew(FINISHER_PASS, sifive_test_base);
break;
case SBI_SRST_RESET_TYPE_COLD_REBOOT:
case SBI_SRST_RESET_TYPE_WARM_REBOOT:
writew(FINISHER_RESET, sifive_test_base);
break;
}
return 0;
}
int sifive_test_init(unsigned long base)
{
sifive_test_base = (void *)base;
return 0;
}