From 9e8ff05cb61f157fb0bcb6b0071d7b6dc0763faa Mon Sep 17 00:00:00 2001 From: Anup Patel Date: Tue, 11 Dec 2018 19:24:06 +0530 Subject: Initial commit. Signed-off-by: Anup Patel --- lib/sbi_system.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 lib/sbi_system.c (limited to 'lib/sbi_system.c') diff --git a/lib/sbi_system.c b/lib/sbi_system.c new file mode 100644 index 0000000..cd250f5 --- /dev/null +++ b/lib/sbi_system.c @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2018 Western Digital Corporation or its affiliates. + * + * Authors: + * Anup Patel + * + * SPDX-License-Identifier: BSD-2-Clause + */ + +#include +#include +#include + +int sbi_system_warm_early_init(struct sbi_scratch *scratch, u32 hartid) +{ + return sbi_platform_warm_early_init(sbi_platform_ptr(scratch), hartid); +} + +int sbi_system_warm_final_init(struct sbi_scratch *scratch, u32 hartid) +{ + return sbi_platform_warm_final_init(sbi_platform_ptr(scratch), hartid); +} + +int sbi_system_cold_early_init(struct sbi_scratch *scratch) +{ + return sbi_platform_cold_early_init(sbi_platform_ptr(scratch)); +} + +int sbi_system_cold_final_init(struct sbi_scratch *scratch) +{ + return sbi_platform_cold_final_init(sbi_platform_ptr(scratch)); +} + +void __attribute__((noreturn)) sbi_system_reboot(struct sbi_scratch *scratch, + u32 type) + +{ + sbi_platform_system_reboot(sbi_platform_ptr(scratch), type); + sbi_hart_hang(); +} + +void __attribute__((noreturn)) sbi_system_shutdown(struct sbi_scratch *scratch, + u32 type) +{ + sbi_platform_system_shutdown(sbi_platform_ptr(scratch), type); + sbi_hart_hang(); +} -- cgit v1.2.3