2018-09-07 16:00:13 +01:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2018 Atmosphère-NX
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2018-02-17 23:48:34 +00:00
|
|
|
#ifndef EXOSPHERE_SMC_API_H
|
|
|
|
#define EXOSPHERE_SMC_API_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2019-01-20 01:31:35 +00:00
|
|
|
#define SMC_HANDLER_USER 0
|
|
|
|
#define SMC_HANDLER_PRIV 1
|
|
|
|
#define SMC_HANDLER_COUNT 2
|
|
|
|
|
|
|
|
#define SMC_HANDLER_AMS (SMC_HANDLER_COUNT)
|
|
|
|
|
|
|
|
#define SMC_CALL_RANGE_ARM_ARCH 0
|
|
|
|
#define SMC_CALL_RANGE_CPU 1
|
|
|
|
#define SMC_CALL_RANGE_SIP 2
|
|
|
|
#define SMC_CALL_RANGE_OEM 3
|
|
|
|
#define SMC_CALL_RANGE_STANDARD 4
|
|
|
|
|
|
|
|
#define SMC_CALL_RANGE_TRUSTED_APP 0x30
|
2018-02-17 23:48:34 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
uint64_t X[8];
|
|
|
|
} smc_args_t;
|
|
|
|
|
2018-03-05 20:07:09 +00:00
|
|
|
bool try_set_user_smc_in_progress(void);
|
2018-03-04 20:57:25 +00:00
|
|
|
void set_user_smc_in_progress(void);
|
|
|
|
void clear_user_smc_in_progress(void);
|
|
|
|
|
2018-02-24 14:20:45 +00:00
|
|
|
void set_priv_smc_in_progress(void);
|
|
|
|
void clear_priv_smc_in_progress(void);
|
|
|
|
|
2018-02-25 02:34:15 +00:00
|
|
|
uintptr_t get_smc_core012_stack_address(void);
|
2018-02-25 19:00:50 +00:00
|
|
|
uintptr_t get_exception_entry_stack_address(unsigned int core_id);
|
2018-02-24 14:20:45 +00:00
|
|
|
|
2018-03-25 22:05:08 +01:00
|
|
|
void set_version_specific_smcs(void);
|
|
|
|
|
2018-08-17 02:45:38 +01:00
|
|
|
|
|
|
|
void set_suspend_for_debug(void);
|
|
|
|
|
2018-02-17 23:48:34 +00:00
|
|
|
void call_smc_handler(unsigned int handler_id, smc_args_t *args);
|
|
|
|
|
2018-02-25 02:34:15 +00:00
|
|
|
#endif
|