2020-05-05 06:33:16 +00:00
|
|
|
/*
|
2021-10-04 19:59:10 +00:00
|
|
|
* Copyright (c) Atmosphère-NX
|
2020-05-05 06:33:16 +00:00
|
|
|
*
|
|
|
|
* 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/>.
|
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <exosphere.hpp>
|
|
|
|
|
|
|
|
namespace ams::secmon::smc {
|
|
|
|
|
|
|
|
enum class SmcResult : u32 {
|
|
|
|
Success = 0,
|
2021-10-10 19:57:24 +00:00
|
|
|
NotSupported = 1,
|
2020-05-05 06:33:16 +00:00
|
|
|
InvalidArgument = 2,
|
2020-05-15 10:23:31 +00:00
|
|
|
Busy = 3,
|
2020-05-05 06:33:16 +00:00
|
|
|
NoAsyncOperation = 4,
|
|
|
|
InvalidAsyncOperation = 5,
|
|
|
|
NotPermitted = 6,
|
|
|
|
NotInitialized = 7,
|
|
|
|
|
|
|
|
PsciSuccess = 0,
|
|
|
|
PsciNotSupported = static_cast<u32>(-1),
|
|
|
|
PsciInvalidParameters = static_cast<u32>(-2),
|
|
|
|
PsciDenied = static_cast<u32>(-3),
|
|
|
|
PsciAlreadyOn = static_cast<u32>(-4),
|
|
|
|
};
|
|
|
|
|
2020-05-15 18:10:28 +00:00
|
|
|
#define SMC_R_SUCCEEEDED(res) (res == SmcResult::Success)
|
|
|
|
#define SMC_R_FAILED(res) (res != SmcResult::Success)
|
|
|
|
|
|
|
|
#define SMC_R_TRY(res_expr) ({ const auto _tmp_r_try_rc = (res_expr); if (SMC_R_FAILED(_tmp_r_try_rc)) { return _tmp_r_try_rc; } })
|
|
|
|
#define SMC_R_UNLESS(cond, RES) ({ if (!(cond)) { return SmcResult::RES; }})
|
|
|
|
|
2020-05-05 06:33:16 +00:00
|
|
|
struct SmcArguments {
|
|
|
|
u64 r[8];
|
|
|
|
};
|
|
|
|
|
|
|
|
constexpr inline int SecurityEngineUserInterruptId = 44;
|
|
|
|
constexpr inline u64 InvalidAsyncKey = 0;
|
|
|
|
|
|
|
|
}
|