Revert "hoc-clk: add live vdd2, live boost clock and basic pwm dimming"
This reverts commit 15b7df8ef1.
This commit is contained in:
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
#include <exosphere/common.hpp>
|
||||
#include <exosphere/hw.hpp>
|
||||
#include <exosphere/util.hpp>
|
||||
#include <exosphere/mmu.hpp>
|
||||
#include <exosphere/br.hpp>
|
||||
#include <exosphere/charger.hpp>
|
||||
#include <exosphere/gic.hpp>
|
||||
#include <exosphere/wdt.hpp>
|
||||
#include <exosphere/pkg1.hpp>
|
||||
#include <exosphere/pkg2.hpp>
|
||||
#include <exosphere/tsec.hpp>
|
||||
#include <exosphere/se.hpp>
|
||||
#include <exosphere/flow.hpp>
|
||||
#include <exosphere/fuse.hpp>
|
||||
#include <exosphere/i2c.hpp>
|
||||
#include <exosphere/uart.hpp>
|
||||
#include <exosphere/pinmux.hpp>
|
||||
#include <exosphere/pmic.hpp>
|
||||
#include <exosphere/pmic_setup.hpp>
|
||||
#include <exosphere/rtc.hpp>
|
||||
#include <exosphere/log.hpp>
|
||||
#include <exosphere/clkrst.hpp>
|
||||
#include <exosphere/actmon.hpp>
|
||||
#include <exosphere/pmc.hpp>
|
||||
#include <exosphere/secmon.hpp>
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::actmon {
|
||||
|
||||
using InterruptHandler = void(*)();
|
||||
|
||||
void SetRegisterAddress(uintptr_t address);
|
||||
|
||||
void HandleInterrupt();
|
||||
|
||||
void StartMonitoringBpmp(InterruptHandler handler);
|
||||
void StopMonitoringBpmp();
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
#include <exosphere/br/br_types.hpp>
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
#include <exosphere/br/impl/br_erista_types.hpp>
|
||||
#include <exosphere/br/impl/br_mariko_types.hpp>
|
||||
|
||||
namespace ams::br {
|
||||
|
||||
struct BootEcid {
|
||||
u32 ecid[4];
|
||||
};
|
||||
static_assert(util::is_pod<BootEcid>::value);
|
||||
static_assert(sizeof(BootEcid) == 0x10);
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::br {
|
||||
|
||||
enum BootMemoryType : u32 {
|
||||
BootMemoryType_None,
|
||||
BootMemoryType_LpDdr2,
|
||||
BootMemoryType_Ddr3,
|
||||
BootMemoryType_LpDdr4,
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,500 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/br/impl/br_common_types.hpp>
|
||||
|
||||
namespace ams::br::erista {
|
||||
|
||||
struct BootSdramParams {
|
||||
BootMemoryType MemoryType;
|
||||
u32 PllMInputDivider;
|
||||
u32 PllMFeedbackDivider;
|
||||
u32 PllMStableTime;
|
||||
u32 PllMSetupControl;
|
||||
u32 PllMPostDivider;
|
||||
u32 PllMKCP;
|
||||
u32 PllMKVCO;
|
||||
u32 EmcBctSpare0;
|
||||
u32 EmcBctSpare1;
|
||||
u32 EmcBctSpare2;
|
||||
u32 EmcBctSpare3;
|
||||
u32 EmcBctSpare4;
|
||||
u32 EmcBctSpare5;
|
||||
u32 EmcBctSpare6;
|
||||
u32 EmcBctSpare7;
|
||||
u32 EmcBctSpare8;
|
||||
u32 EmcBctSpare9;
|
||||
u32 EmcBctSpare10;
|
||||
u32 EmcBctSpare11;
|
||||
u32 EmcBctSpare12;
|
||||
u32 EmcBctSpare13;
|
||||
u32 EmcClockSource;
|
||||
u32 EmcClockSourceDll;
|
||||
u32 ClkRstControllerPllmMisc2Override;
|
||||
u32 ClkRstControllerPllmMisc2OverrideEnable;
|
||||
u32 ClearClk2Mc1;
|
||||
u32 EmcAutoCalInterval;
|
||||
u32 EmcAutoCalConfig;
|
||||
u32 EmcAutoCalConfig2;
|
||||
u32 EmcAutoCalConfig3;
|
||||
u32 EmcAutoCalConfig4;
|
||||
u32 EmcAutoCalConfig5;
|
||||
u32 EmcAutoCalConfig6;
|
||||
u32 EmcAutoCalConfig7;
|
||||
u32 EmcAutoCalConfig8;
|
||||
u32 EmcAutoCalVrefSel0;
|
||||
u32 EmcAutoCalVrefSel1;
|
||||
u32 EmcAutoCalChannel;
|
||||
u32 EmcPmacroAutocalCfg0;
|
||||
u32 EmcPmacroAutocalCfg1;
|
||||
u32 EmcPmacroAutocalCfg2;
|
||||
u32 EmcPmacroRxTerm;
|
||||
u32 EmcPmacroDqTxDrv;
|
||||
u32 EmcPmacroCaTxDrv;
|
||||
u32 EmcPmacroCmdTxDrv;
|
||||
u32 EmcPmacroAutocalCfgCommon;
|
||||
u32 EmcPmacroZctrl;
|
||||
u32 EmcAutoCalWait;
|
||||
u32 EmcXm2CompPadCtrl;
|
||||
u32 EmcXm2CompPadCtrl2;
|
||||
u32 EmcXm2CompPadCtrl3;
|
||||
u32 EmcAdrCfg;
|
||||
u32 EmcPinProgramWait;
|
||||
u32 EmcPinExtraWait;
|
||||
u32 EmcPinGpioEn;
|
||||
u32 EmcPinGpio;
|
||||
u32 EmcTimingControlWait;
|
||||
u32 EmcRc;
|
||||
u32 EmcRfc;
|
||||
u32 EmcRfcPb;
|
||||
u32 EmcRefctrl2;
|
||||
u32 EmcRfcSlr;
|
||||
u32 EmcRas;
|
||||
u32 EmcRp;
|
||||
u32 EmcR2r;
|
||||
u32 EmcW2w;
|
||||
u32 EmcR2w;
|
||||
u32 EmcW2r;
|
||||
u32 EmcR2p;
|
||||
u32 EmcW2p;
|
||||
u32 EmcTppd;
|
||||
u32 EmcCcdmw;
|
||||
u32 EmcRdRcd;
|
||||
u32 EmcWrRcd;
|
||||
u32 EmcRrd;
|
||||
u32 EmcRext;
|
||||
u32 EmcWext;
|
||||
u32 EmcWdv;
|
||||
u32 EmcWdvChk;
|
||||
u32 EmcWsv;
|
||||
u32 EmcWev;
|
||||
u32 EmcWdvMask;
|
||||
u32 EmcWsDuration;
|
||||
u32 EmcWeDuration;
|
||||
u32 EmcQUse;
|
||||
u32 EmcQuseWidth;
|
||||
u32 EmcIbdly;
|
||||
u32 EmcObdly;
|
||||
u32 EmcEInput;
|
||||
u32 EmcEInputDuration;
|
||||
u32 EmcPutermExtra;
|
||||
u32 EmcPutermWidth;
|
||||
u32 EmcQRst;
|
||||
u32 EmcQSafe;
|
||||
u32 EmcRdv;
|
||||
u32 EmcRdvMask;
|
||||
u32 EmcRdvEarly;
|
||||
u32 EmcRdvEarlyMask;
|
||||
u32 EmcQpop;
|
||||
u32 EmcRefresh;
|
||||
u32 EmcBurstRefreshNum;
|
||||
u32 EmcPreRefreshReqCnt;
|
||||
u32 EmcPdEx2Wr;
|
||||
u32 EmcPdEx2Rd;
|
||||
u32 EmcPChg2Pden;
|
||||
u32 EmcAct2Pden;
|
||||
u32 EmcAr2Pden;
|
||||
u32 EmcRw2Pden;
|
||||
u32 EmcCke2Pden;
|
||||
u32 EmcPdex2Cke;
|
||||
u32 EmcPdex2Mrr;
|
||||
u32 EmcTxsr;
|
||||
u32 EmcTxsrDll;
|
||||
u32 EmcTcke;
|
||||
u32 EmcTckesr;
|
||||
u32 EmcTpd;
|
||||
u32 EmcTfaw;
|
||||
u32 EmcTrpab;
|
||||
u32 EmcTClkStable;
|
||||
u32 EmcTClkStop;
|
||||
u32 EmcTRefBw;
|
||||
u32 EmcFbioCfg5;
|
||||
u32 EmcFbioCfg7;
|
||||
u32 EmcFbioCfg8;
|
||||
u32 EmcCmdMappingCmd0_0;
|
||||
u32 EmcCmdMappingCmd0_1;
|
||||
u32 EmcCmdMappingCmd0_2;
|
||||
u32 EmcCmdMappingCmd1_0;
|
||||
u32 EmcCmdMappingCmd1_1;
|
||||
u32 EmcCmdMappingCmd1_2;
|
||||
u32 EmcCmdMappingCmd2_0;
|
||||
u32 EmcCmdMappingCmd2_1;
|
||||
u32 EmcCmdMappingCmd2_2;
|
||||
u32 EmcCmdMappingCmd3_0;
|
||||
u32 EmcCmdMappingCmd3_1;
|
||||
u32 EmcCmdMappingCmd3_2;
|
||||
u32 EmcCmdMappingByte;
|
||||
u32 EmcFbioSpare;
|
||||
u32 EmcCfgRsv;
|
||||
u32 EmcMrs;
|
||||
u32 EmcEmrs;
|
||||
u32 EmcEmrs2;
|
||||
u32 EmcEmrs3;
|
||||
u32 EmcMrw1;
|
||||
u32 EmcMrw2;
|
||||
u32 EmcMrw3;
|
||||
u32 EmcMrw4;
|
||||
u32 EmcMrw6;
|
||||
u32 EmcMrw8;
|
||||
u32 EmcMrw9;
|
||||
u32 EmcMrw10;
|
||||
u32 EmcMrw12;
|
||||
u32 EmcMrw13;
|
||||
u32 EmcMrw14;
|
||||
u32 EmcMrwExtra;
|
||||
u32 EmcWarmBootMrwExtra;
|
||||
u32 EmcWarmBootExtraModeRegWriteEnable;
|
||||
u32 EmcExtraModeRegWriteEnable;
|
||||
u32 EmcMrwResetCommand;
|
||||
u32 EmcMrwResetNInitWait;
|
||||
u32 EmcMrsWaitCnt;
|
||||
u32 EmcMrsWaitCnt2;
|
||||
u32 EmcCfg;
|
||||
u32 EmcCfg2;
|
||||
u32 EmcCfgPipe;
|
||||
u32 EmcCfgPipeClk;
|
||||
u32 EmcFdpdCtrlCmdNoRamp;
|
||||
u32 EmcCfgUpdate;
|
||||
u32 EmcDbg;
|
||||
u32 EmcDbgWriteMux;
|
||||
u32 EmcCmdQ;
|
||||
u32 EmcMc2EmcQ;
|
||||
u32 EmcDynSelfRefControl;
|
||||
u32 AhbArbitrationXbarCtrlMemInitDone;
|
||||
u32 EmcCfgDigDll;
|
||||
u32 EmcCfgDigDll_1;
|
||||
u32 EmcCfgDigDllPeriod;
|
||||
u32 EmcDevSelect;
|
||||
u32 EmcSelDpdCtrl;
|
||||
u32 EmcFdpdCtrlDq;
|
||||
u32 EmcFdpdCtrlCmd;
|
||||
u32 EmcPmacroIbVrefDq_0;
|
||||
u32 EmcPmacroIbVrefDq_1;
|
||||
u32 EmcPmacroIbVrefDqs_0;
|
||||
u32 EmcPmacroIbVrefDqs_1;
|
||||
u32 EmcPmacroIbRxrt;
|
||||
u32 EmcCfgPipe1;
|
||||
u32 EmcCfgPipe2;
|
||||
u32 EmcPmacroQuseDdllRank0_0;
|
||||
u32 EmcPmacroQuseDdllRank0_1;
|
||||
u32 EmcPmacroQuseDdllRank0_2;
|
||||
u32 EmcPmacroQuseDdllRank0_3;
|
||||
u32 EmcPmacroQuseDdllRank0_4;
|
||||
u32 EmcPmacroQuseDdllRank0_5;
|
||||
u32 EmcPmacroQuseDdllRank1_0;
|
||||
u32 EmcPmacroQuseDdllRank1_1;
|
||||
u32 EmcPmacroQuseDdllRank1_2;
|
||||
u32 EmcPmacroQuseDdllRank1_3;
|
||||
u32 EmcPmacroQuseDdllRank1_4;
|
||||
u32 EmcPmacroQuseDdllRank1_5;
|
||||
u32 EmcPmacroObDdllLongDqRank0_0;
|
||||
u32 EmcPmacroObDdllLongDqRank0_1;
|
||||
u32 EmcPmacroObDdllLongDqRank0_2;
|
||||
u32 EmcPmacroObDdllLongDqRank0_3;
|
||||
u32 EmcPmacroObDdllLongDqRank0_4;
|
||||
u32 EmcPmacroObDdllLongDqRank0_5;
|
||||
u32 EmcPmacroObDdllLongDqRank1_0;
|
||||
u32 EmcPmacroObDdllLongDqRank1_1;
|
||||
u32 EmcPmacroObDdllLongDqRank1_2;
|
||||
u32 EmcPmacroObDdllLongDqRank1_3;
|
||||
u32 EmcPmacroObDdllLongDqRank1_4;
|
||||
u32 EmcPmacroObDdllLongDqRank1_5;
|
||||
u32 EmcPmacroObDdllLongDqsRank0_0;
|
||||
u32 EmcPmacroObDdllLongDqsRank0_1;
|
||||
u32 EmcPmacroObDdllLongDqsRank0_2;
|
||||
u32 EmcPmacroObDdllLongDqsRank0_3;
|
||||
u32 EmcPmacroObDdllLongDqsRank0_4;
|
||||
u32 EmcPmacroObDdllLongDqsRank0_5;
|
||||
u32 EmcPmacroObDdllLongDqsRank1_0;
|
||||
u32 EmcPmacroObDdllLongDqsRank1_1;
|
||||
u32 EmcPmacroObDdllLongDqsRank1_2;
|
||||
u32 EmcPmacroObDdllLongDqsRank1_3;
|
||||
u32 EmcPmacroObDdllLongDqsRank1_4;
|
||||
u32 EmcPmacroObDdllLongDqsRank1_5;
|
||||
u32 EmcPmacroIbDdllLongDqsRank0_0;
|
||||
u32 EmcPmacroIbDdllLongDqsRank0_1;
|
||||
u32 EmcPmacroIbDdllLongDqsRank0_2;
|
||||
u32 EmcPmacroIbDdllLongDqsRank0_3;
|
||||
u32 EmcPmacroIbDdllLongDqsRank1_0;
|
||||
u32 EmcPmacroIbDdllLongDqsRank1_1;
|
||||
u32 EmcPmacroIbDdllLongDqsRank1_2;
|
||||
u32 EmcPmacroIbDdllLongDqsRank1_3;
|
||||
u32 EmcPmacroDdllLongCmd_0;
|
||||
u32 EmcPmacroDdllLongCmd_1;
|
||||
u32 EmcPmacroDdllLongCmd_2;
|
||||
u32 EmcPmacroDdllLongCmd_3;
|
||||
u32 EmcPmacroDdllLongCmd_4;
|
||||
u32 EmcPmacroDdllShortCmd_0;
|
||||
u32 EmcPmacroDdllShortCmd_1;
|
||||
u32 EmcPmacroDdllShortCmd_2;
|
||||
u32 WarmBootWait;
|
||||
u32 EmcOdtWrite;
|
||||
u32 EmcZcalInterval;
|
||||
u32 EmcZcalWaitCnt;
|
||||
u32 EmcZcalMrwCmd;
|
||||
u32 EmcMrsResetDll;
|
||||
u32 EmcZcalInitDev0;
|
||||
u32 EmcZcalInitDev1;
|
||||
u32 EmcZcalInitWait;
|
||||
u32 EmcZcalWarmColdBootEnables;
|
||||
u32 EmcMrwLpddr2ZcalWarmBoot;
|
||||
u32 EmcZqCalDdr3WarmBoot;
|
||||
u32 EmcZqCalLpDdr4WarmBoot;
|
||||
u32 EmcZcalWarmBootWait;
|
||||
u32 EmcMrsWarmBootEnable;
|
||||
u32 EmcMrsResetDllWait;
|
||||
u32 EmcMrsExtra;
|
||||
u32 EmcWarmBootMrsExtra;
|
||||
u32 EmcEmrsDdr2DllEnable;
|
||||
u32 EmcMrsDdr2DllReset;
|
||||
u32 EmcEmrsDdr2OcdCalib;
|
||||
u32 EmcDdr2Wait;
|
||||
u32 EmcClkenOverride;
|
||||
u32 EmcExtraRefreshNum;
|
||||
u32 EmcClkenOverrideAllWarmBoot;
|
||||
u32 McClkenOverrideAllWarmBoot;
|
||||
u32 EmcCfgDigDllPeriodWarmBoot;
|
||||
u32 PmcVddpSel;
|
||||
u32 PmcVddpSelWait;
|
||||
u32 PmcDdrPwr;
|
||||
u32 PmcDdrCfg;
|
||||
u32 PmcIoDpd3Req;
|
||||
u32 PmcIoDpd3ReqWait;
|
||||
u32 PmcIoDpd4ReqWait;
|
||||
u32 PmcRegShort;
|
||||
u32 PmcNoIoPower;
|
||||
u32 PmcDdrCntrlWait;
|
||||
u32 PmcDdrCntrl;
|
||||
u32 EmcAcpdControl;
|
||||
u32 EmcSwizzleRank0Byte0;
|
||||
u32 EmcSwizzleRank0Byte1;
|
||||
u32 EmcSwizzleRank0Byte2;
|
||||
u32 EmcSwizzleRank0Byte3;
|
||||
u32 EmcSwizzleRank1Byte0;
|
||||
u32 EmcSwizzleRank1Byte1;
|
||||
u32 EmcSwizzleRank1Byte2;
|
||||
u32 EmcSwizzleRank1Byte3;
|
||||
u32 EmcTxdsrvttgen;
|
||||
u32 EmcDataBrlshft0;
|
||||
u32 EmcDataBrlshft1;
|
||||
u32 EmcDqsBrlshft0;
|
||||
u32 EmcDqsBrlshft1;
|
||||
u32 EmcCmdBrlshft0;
|
||||
u32 EmcCmdBrlshft1;
|
||||
u32 EmcCmdBrlshft2;
|
||||
u32 EmcCmdBrlshft3;
|
||||
u32 EmcQuseBrlshft0;
|
||||
u32 EmcQuseBrlshft1;
|
||||
u32 EmcQuseBrlshft2;
|
||||
u32 EmcQuseBrlshft3;
|
||||
u32 EmcDllCfg0;
|
||||
u32 EmcDllCfg1;
|
||||
u32 EmcPmcScratch1;
|
||||
u32 EmcPmcScratch2;
|
||||
u32 EmcPmcScratch3;
|
||||
u32 EmcPmacroPadCfgCtrl;
|
||||
u32 EmcPmacroVttgenCtrl0;
|
||||
u32 EmcPmacroVttgenCtrl1;
|
||||
u32 EmcPmacroVttgenCtrl2;
|
||||
u32 EmcPmacroBrickCtrlRfu1;
|
||||
u32 EmcPmacroCmdBrickCtrlFdpd;
|
||||
u32 EmcPmacroBrickCtrlRfu2;
|
||||
u32 EmcPmacroDataBrickCtrlFdpd;
|
||||
u32 EmcPmacroBgBiasCtrl0;
|
||||
u32 EmcPmacroDataPadRxCtrl;
|
||||
u32 EmcPmacroCmdPadRxCtrl;
|
||||
u32 EmcPmacroDataRxTermMode;
|
||||
u32 EmcPmacroCmdRxTermMode;
|
||||
u32 EmcPmacroDataPadTxCtrl;
|
||||
u32 EmcPmacroCommonPadTxCtrl;
|
||||
u32 EmcPmacroCmdPadTxCtrl;
|
||||
u32 EmcCfg3;
|
||||
u32 EmcPmacroTxPwrd0;
|
||||
u32 EmcPmacroTxPwrd1;
|
||||
u32 EmcPmacroTxPwrd2;
|
||||
u32 EmcPmacroTxPwrd3;
|
||||
u32 EmcPmacroTxPwrd4;
|
||||
u32 EmcPmacroTxPwrd5;
|
||||
u32 EmcConfigSampleDelay;
|
||||
u32 EmcPmacroBrickMapping0;
|
||||
u32 EmcPmacroBrickMapping1;
|
||||
u32 EmcPmacroBrickMapping2;
|
||||
u32 EmcPmacroTxSelClkSrc0;
|
||||
u32 EmcPmacroTxSelClkSrc1;
|
||||
u32 EmcPmacroTxSelClkSrc2;
|
||||
u32 EmcPmacroTxSelClkSrc3;
|
||||
u32 EmcPmacroTxSelClkSrc4;
|
||||
u32 EmcPmacroTxSelClkSrc5;
|
||||
u32 EmcPmacroDdllBypass;
|
||||
u32 EmcPmacroDdllPwrd0;
|
||||
u32 EmcPmacroDdllPwrd1;
|
||||
u32 EmcPmacroDdllPwrd2;
|
||||
u32 EmcPmacroCmdCtrl0;
|
||||
u32 EmcPmacroCmdCtrl1;
|
||||
u32 EmcPmacroCmdCtrl2;
|
||||
u32 McEmemAdrCfg;
|
||||
u32 McEmemAdrCfgDev0;
|
||||
u32 McEmemAdrCfgDev1;
|
||||
u32 McEmemAdrCfgChannelMask;
|
||||
u32 McEmemAdrCfgBankMask0;
|
||||
u32 McEmemAdrCfgBankMask1;
|
||||
u32 McEmemAdrCfgBankMask2;
|
||||
u32 McEmemCfg;
|
||||
u32 McEmemArbCfg;
|
||||
u32 McEmemArbOutstandingReq;
|
||||
u32 McEmemArbRefpbHpCtrl;
|
||||
u32 McEmemArbRefpbBankCtrl;
|
||||
u32 McEmemArbTimingRcd;
|
||||
u32 McEmemArbTimingRp;
|
||||
u32 McEmemArbTimingRc;
|
||||
u32 McEmemArbTimingRas;
|
||||
u32 McEmemArbTimingFaw;
|
||||
u32 McEmemArbTimingRrd;
|
||||
u32 McEmemArbTimingRap2Pre;
|
||||
u32 McEmemArbTimingWap2Pre;
|
||||
u32 McEmemArbTimingR2R;
|
||||
u32 McEmemArbTimingW2W;
|
||||
u32 McEmemArbTimingR2W;
|
||||
u32 McEmemArbTimingW2R;
|
||||
u32 McEmemArbTimingRFCPB;
|
||||
u32 McEmemArbDaTurns;
|
||||
u32 McEmemArbDaCovers;
|
||||
u32 McEmemArbMisc0;
|
||||
u32 McEmemArbMisc1;
|
||||
u32 McEmemArbMisc2;
|
||||
u32 McEmemArbRing1Throttle;
|
||||
u32 McEmemArbOverride;
|
||||
u32 McEmemArbOverride1;
|
||||
u32 McEmemArbRsv;
|
||||
u32 McDaCfg0;
|
||||
u32 McEmemArbTimingCcdmw;
|
||||
u32 McClkenOverride;
|
||||
u32 McStatControl;
|
||||
u32 McVideoProtectBom;
|
||||
u32 McVideoProtectBomAdrHi;
|
||||
u32 McVideoProtectSizeMb;
|
||||
u32 McVideoProtectVprOverride;
|
||||
u32 McVideoProtectVprOverride1;
|
||||
u32 McVideoProtectGpuOverride0;
|
||||
u32 McVideoProtectGpuOverride1;
|
||||
u32 McSecCarveoutBom;
|
||||
u32 McSecCarveoutAdrHi;
|
||||
u32 McSecCarveoutSizeMb;
|
||||
u32 McVideoProtectWriteAccess;
|
||||
u32 McSecCarveoutProtectWriteAccess;
|
||||
u32 McGeneralizedCarveout1Bom;
|
||||
u32 McGeneralizedCarveout1BomHi;
|
||||
u32 McGeneralizedCarveout1Size128kb;
|
||||
u32 McGeneralizedCarveout1Access0;
|
||||
u32 McGeneralizedCarveout1Access1;
|
||||
u32 McGeneralizedCarveout1Access2;
|
||||
u32 McGeneralizedCarveout1Access3;
|
||||
u32 McGeneralizedCarveout1Access4;
|
||||
u32 McGeneralizedCarveout1ForceInternalAccess0;
|
||||
u32 McGeneralizedCarveout1ForceInternalAccess1;
|
||||
u32 McGeneralizedCarveout1ForceInternalAccess2;
|
||||
u32 McGeneralizedCarveout1ForceInternalAccess3;
|
||||
u32 McGeneralizedCarveout1ForceInternalAccess4;
|
||||
u32 McGeneralizedCarveout1Cfg0;
|
||||
u32 McGeneralizedCarveout2Bom;
|
||||
u32 McGeneralizedCarveout2BomHi;
|
||||
u32 McGeneralizedCarveout2Size128kb;
|
||||
u32 McGeneralizedCarveout2Access0;
|
||||
u32 McGeneralizedCarveout2Access1;
|
||||
u32 McGeneralizedCarveout2Access2;
|
||||
u32 McGeneralizedCarveout2Access3;
|
||||
u32 McGeneralizedCarveout2Access4;
|
||||
u32 McGeneralizedCarveout2ForceInternalAccess0;
|
||||
u32 McGeneralizedCarveout2ForceInternalAccess1;
|
||||
u32 McGeneralizedCarveout2ForceInternalAccess2;
|
||||
u32 McGeneralizedCarveout2ForceInternalAccess3;
|
||||
u32 McGeneralizedCarveout2ForceInternalAccess4;
|
||||
u32 McGeneralizedCarveout2Cfg0;
|
||||
u32 McGeneralizedCarveout3Bom;
|
||||
u32 McGeneralizedCarveout3BomHi;
|
||||
u32 McGeneralizedCarveout3Size128kb;
|
||||
u32 McGeneralizedCarveout3Access0;
|
||||
u32 McGeneralizedCarveout3Access1;
|
||||
u32 McGeneralizedCarveout3Access2;
|
||||
u32 McGeneralizedCarveout3Access3;
|
||||
u32 McGeneralizedCarveout3Access4;
|
||||
u32 McGeneralizedCarveout3ForceInternalAccess0;
|
||||
u32 McGeneralizedCarveout3ForceInternalAccess1;
|
||||
u32 McGeneralizedCarveout3ForceInternalAccess2;
|
||||
u32 McGeneralizedCarveout3ForceInternalAccess3;
|
||||
u32 McGeneralizedCarveout3ForceInternalAccess4;
|
||||
u32 McGeneralizedCarveout3Cfg0;
|
||||
u32 McGeneralizedCarveout4Bom;
|
||||
u32 McGeneralizedCarveout4BomHi;
|
||||
u32 McGeneralizedCarveout4Size128kb;
|
||||
u32 McGeneralizedCarveout4Access0;
|
||||
u32 McGeneralizedCarveout4Access1;
|
||||
u32 McGeneralizedCarveout4Access2;
|
||||
u32 McGeneralizedCarveout4Access3;
|
||||
u32 McGeneralizedCarveout4Access4;
|
||||
u32 McGeneralizedCarveout4ForceInternalAccess0;
|
||||
u32 McGeneralizedCarveout4ForceInternalAccess1;
|
||||
u32 McGeneralizedCarveout4ForceInternalAccess2;
|
||||
u32 McGeneralizedCarveout4ForceInternalAccess3;
|
||||
u32 McGeneralizedCarveout4ForceInternalAccess4;
|
||||
u32 McGeneralizedCarveout4Cfg0;
|
||||
u32 McGeneralizedCarveout5Bom;
|
||||
u32 McGeneralizedCarveout5BomHi;
|
||||
u32 McGeneralizedCarveout5Size128kb;
|
||||
u32 McGeneralizedCarveout5Access0;
|
||||
u32 McGeneralizedCarveout5Access1;
|
||||
u32 McGeneralizedCarveout5Access2;
|
||||
u32 McGeneralizedCarveout5Access3;
|
||||
u32 McGeneralizedCarveout5Access4;
|
||||
u32 McGeneralizedCarveout5ForceInternalAccess0;
|
||||
u32 McGeneralizedCarveout5ForceInternalAccess1;
|
||||
u32 McGeneralizedCarveout5ForceInternalAccess2;
|
||||
u32 McGeneralizedCarveout5ForceInternalAccess3;
|
||||
u32 McGeneralizedCarveout5ForceInternalAccess4;
|
||||
u32 McGeneralizedCarveout5Cfg0;
|
||||
u32 EmcCaTrainingEnable;
|
||||
u32 SwizzleRankByteEncode;
|
||||
u32 BootRomPatchControl;
|
||||
u32 BootRomPatchData;
|
||||
u32 McMtsCarveoutBom;
|
||||
u32 McMtsCarveoutAdrHi;
|
||||
u32 McMtsCarveoutSizeMb;
|
||||
u32 McMtsCarveoutRegCtrl;
|
||||
};
|
||||
static_assert(sizeof(BootSdramParams) == 0x768);
|
||||
|
||||
}
|
||||
@@ -1,552 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/br/impl/br_common_types.hpp>
|
||||
|
||||
namespace ams::br::mariko {
|
||||
|
||||
struct BootSdramParams {
|
||||
BootMemoryType MemoryType;
|
||||
u32 PllMInputDivider;
|
||||
u32 PllMFeedbackDivider;
|
||||
u32 PllMStableTime;
|
||||
u32 PllMSetupControl;
|
||||
u32 PllMPostDivider;
|
||||
u32 PllMKCP;
|
||||
u32 PllMKVCO;
|
||||
u32 EmcBctSpare0;
|
||||
u32 EmcBctSpare1;
|
||||
u32 EmcBctSpare2;
|
||||
u32 EmcBctSpare3;
|
||||
u32 EmcBctSpare4;
|
||||
u32 EmcBctSpare5;
|
||||
u32 EmcBctSpare6;
|
||||
u32 EmcBctSpare7;
|
||||
u32 EmcBctSpare8;
|
||||
u32 EmcBctSpare9;
|
||||
u32 EmcBctSpare10;
|
||||
u32 EmcBctSpare11;
|
||||
u32 EmcBctSpare12;
|
||||
u32 EmcBctSpare13;
|
||||
u32 EmcBctSpareSecure0;
|
||||
u32 EmcBctSpareSecure1;
|
||||
u32 EmcBctSpareSecure2;
|
||||
u32 EmcBctSpareSecure3;
|
||||
u32 EmcBctSpareSecure4;
|
||||
u32 EmcBctSpareSecure5;
|
||||
u32 EmcBctSpareSecure6;
|
||||
u32 EmcBctSpareSecure7;
|
||||
u32 EmcBctSpareSecure8;
|
||||
u32 EmcBctSpareSecure9;
|
||||
u32 EmcBctSpareSecure10;
|
||||
u32 EmcBctSpareSecure11;
|
||||
u32 EmcBctSpareSecure12;
|
||||
u32 EmcBctSpareSecure13;
|
||||
u32 EmcBctSpareSecure14;
|
||||
u32 EmcBctSpareSecure15;
|
||||
u32 EmcBctSpareSecure16;
|
||||
u32 EmcBctSpareSecure17;
|
||||
u32 EmcBctSpareSecure18;
|
||||
u32 EmcBctSpareSecure19;
|
||||
u32 EmcBctSpareSecure20;
|
||||
u32 EmcBctSpareSecure21;
|
||||
u32 EmcBctSpareSecure22;
|
||||
u32 EmcBctSpareSecure23;
|
||||
u32 EmcClockSource;
|
||||
u32 EmcClockSourceDll;
|
||||
u32 ClkRstControllerPllmMisc2Override;
|
||||
u32 ClkRstControllerPllmMisc2OverrideEnable;
|
||||
u32 ClearClk2Mc1;
|
||||
u32 EmcAutoCalInterval;
|
||||
u32 EmcAutoCalConfig;
|
||||
u32 EmcAutoCalConfig2;
|
||||
u32 EmcAutoCalConfig3;
|
||||
u32 EmcAutoCalConfig4;
|
||||
u32 EmcAutoCalConfig5;
|
||||
u32 EmcAutoCalConfig6;
|
||||
u32 EmcAutoCalConfig7;
|
||||
u32 EmcAutoCalConfig8;
|
||||
u32 EmcAutoCalConfig9;
|
||||
u32 EmcAutoCalVrefSel0;
|
||||
u32 EmcAutoCalVrefSel1;
|
||||
u32 EmcAutoCalChannel;
|
||||
u32 EmcPmacroAutocalCfg0;
|
||||
u32 EmcPmacroAutocalCfg1;
|
||||
u32 EmcPmacroAutocalCfg2;
|
||||
u32 EmcPmacroRxTerm;
|
||||
u32 EmcPmacroDqTxDrv;
|
||||
u32 EmcPmacroCaTxDrv;
|
||||
u32 EmcPmacroCmdTxDrv;
|
||||
u32 EmcPmacroAutocalCfgCommon;
|
||||
u32 EmcPmacroZctrl;
|
||||
u32 EmcAutoCalWait;
|
||||
u32 EmcXm2CompPadCtrl;
|
||||
u32 EmcXm2CompPadCtrl2;
|
||||
u32 EmcXm2CompPadCtrl3;
|
||||
u32 EmcAdrCfg;
|
||||
u32 EmcPinProgramWait;
|
||||
u32 EmcPinExtraWait;
|
||||
u32 EmcPinGpioEn;
|
||||
u32 EmcPinGpio;
|
||||
u32 EmcTimingControlWait;
|
||||
u32 EmcRc;
|
||||
u32 EmcRfc;
|
||||
u32 EmcRfcPb;
|
||||
u32 EmcRefctrl2;
|
||||
u32 EmcRfcSlr;
|
||||
u32 EmcRas;
|
||||
u32 EmcRp;
|
||||
u32 EmcR2r;
|
||||
u32 EmcW2w;
|
||||
u32 EmcR2w;
|
||||
u32 EmcW2r;
|
||||
u32 EmcR2p;
|
||||
u32 EmcW2p;
|
||||
u32 EmcTppd;
|
||||
u32 EmcTrtm;
|
||||
u32 EmcTwtm;
|
||||
u32 EmcTratm;
|
||||
u32 EmcTwatm;
|
||||
u32 EmcTr2ref;
|
||||
u32 EmcCcdmw;
|
||||
u32 EmcRdRcd;
|
||||
u32 EmcWrRcd;
|
||||
u32 EmcRrd;
|
||||
u32 EmcRext;
|
||||
u32 EmcWext;
|
||||
u32 EmcWdv;
|
||||
u32 EmcWdvChk;
|
||||
u32 EmcWsv;
|
||||
u32 EmcWev;
|
||||
u32 EmcWdvMask;
|
||||
u32 EmcWsDuration;
|
||||
u32 EmcWeDuration;
|
||||
u32 EmcQUse;
|
||||
u32 EmcQuseWidth;
|
||||
u32 EmcIbdly;
|
||||
u32 EmcObdly;
|
||||
u32 EmcEInput;
|
||||
u32 EmcEInputDuration;
|
||||
u32 EmcPutermExtra;
|
||||
u32 EmcPutermWidth;
|
||||
u32 EmcQRst;
|
||||
u32 EmcQSafe;
|
||||
u32 EmcRdv;
|
||||
u32 EmcRdvMask;
|
||||
u32 EmcRdvEarly;
|
||||
u32 EmcRdvEarlyMask;
|
||||
u32 EmcQpop;
|
||||
u32 EmcRefresh;
|
||||
u32 EmcBurstRefreshNum;
|
||||
u32 EmcPreRefreshReqCnt;
|
||||
u32 EmcPdEx2Wr;
|
||||
u32 EmcPdEx2Rd;
|
||||
u32 EmcPChg2Pden;
|
||||
u32 EmcAct2Pden;
|
||||
u32 EmcAr2Pden;
|
||||
u32 EmcRw2Pden;
|
||||
u32 EmcCke2Pden;
|
||||
u32 EmcPdex2Cke;
|
||||
u32 EmcPdex2Mrr;
|
||||
u32 EmcTxsr;
|
||||
u32 EmcTxsrDll;
|
||||
u32 EmcTcke;
|
||||
u32 EmcTckesr;
|
||||
u32 EmcTpd;
|
||||
u32 EmcTfaw;
|
||||
u32 EmcTrpab;
|
||||
u32 EmcTClkStable;
|
||||
u32 EmcTClkStop;
|
||||
u32 EmcTRefBw;
|
||||
u32 EmcFbioCfg5;
|
||||
u32 EmcFbioCfg7;
|
||||
u32 EmcFbioCfg8;
|
||||
u32 EmcCmdMappingCmd0_0;
|
||||
u32 EmcCmdMappingCmd0_1;
|
||||
u32 EmcCmdMappingCmd0_2;
|
||||
u32 EmcCmdMappingCmd1_0;
|
||||
u32 EmcCmdMappingCmd1_1;
|
||||
u32 EmcCmdMappingCmd1_2;
|
||||
u32 EmcCmdMappingCmd2_0;
|
||||
u32 EmcCmdMappingCmd2_1;
|
||||
u32 EmcCmdMappingCmd2_2;
|
||||
u32 EmcCmdMappingCmd3_0;
|
||||
u32 EmcCmdMappingCmd3_1;
|
||||
u32 EmcCmdMappingCmd3_2;
|
||||
u32 EmcCmdMappingByte;
|
||||
u32 EmcFbioSpare;
|
||||
u32 EmcCfgRsv;
|
||||
u32 EmcMrs;
|
||||
u32 EmcEmrs;
|
||||
u32 EmcEmrs2;
|
||||
u32 EmcEmrs3;
|
||||
u32 EmcMrw1;
|
||||
u32 EmcMrw2;
|
||||
u32 EmcMrw3;
|
||||
u32 EmcMrw4;
|
||||
u32 EmcMrw6;
|
||||
u32 EmcMrw8;
|
||||
u32 EmcMrw9;
|
||||
u32 EmcMrw10;
|
||||
u32 EmcMrw12;
|
||||
u32 EmcMrw13;
|
||||
u32 EmcMrw14;
|
||||
u32 EmcMrwExtra;
|
||||
u32 EmcWarmBootMrwExtra;
|
||||
u32 EmcWarmBootExtraModeRegWriteEnable;
|
||||
u32 EmcExtraModeRegWriteEnable;
|
||||
u32 EmcMrwResetCommand;
|
||||
u32 EmcMrwResetNInitWait;
|
||||
u32 EmcMrsWaitCnt;
|
||||
u32 EmcMrsWaitCnt2;
|
||||
u32 EmcCfg;
|
||||
u32 EmcCfg2;
|
||||
u32 EmcCfgPipe;
|
||||
u32 EmcCfgPipeClk;
|
||||
u32 EmcFdpdCtrlCmdNoRamp;
|
||||
u32 EmcCfgUpdate;
|
||||
u32 EmcDbg;
|
||||
u32 EmcDbgWriteMux;
|
||||
u32 EmcCmdQ;
|
||||
u32 EmcMc2EmcQ;
|
||||
u32 EmcDynSelfRefControl;
|
||||
u32 AhbArbitrationXbarCtrlMemInitDone;
|
||||
u32 EmcCfgDigDll;
|
||||
u32 EmcCfgDigDll_1;
|
||||
u32 EmcCfgDigDllPeriod;
|
||||
u32 EmcDevSelect;
|
||||
u32 EmcSelDpdCtrl;
|
||||
u32 EmcFdpdCtrlDq;
|
||||
u32 EmcFdpdCtrlCmd;
|
||||
u32 EmcPmacroIbVrefDq_0;
|
||||
u32 EmcPmacroIbVrefDq_1;
|
||||
u32 EmcPmacroIbVrefDqs_0;
|
||||
u32 EmcPmacroIbVrefDqs_1;
|
||||
u32 EmcPmacroIbRxrt;
|
||||
u32 EmcCfgPipe1;
|
||||
u32 EmcCfgPipe2;
|
||||
u32 EmcPmacroQuseDdllRank0_0;
|
||||
u32 EmcPmacroQuseDdllRank0_1;
|
||||
u32 EmcPmacroQuseDdllRank0_2;
|
||||
u32 EmcPmacroQuseDdllRank0_3;
|
||||
u32 EmcPmacroQuseDdllRank0_4;
|
||||
u32 EmcPmacroQuseDdllRank0_5;
|
||||
u32 EmcPmacroQuseDdllRank1_0;
|
||||
u32 EmcPmacroQuseDdllRank1_1;
|
||||
u32 EmcPmacroQuseDdllRank1_2;
|
||||
u32 EmcPmacroQuseDdllRank1_3;
|
||||
u32 EmcPmacroQuseDdllRank1_4;
|
||||
u32 EmcPmacroQuseDdllRank1_5;
|
||||
u32 EmcPmacroObDdllLongDqRank0_0;
|
||||
u32 EmcPmacroObDdllLongDqRank0_1;
|
||||
u32 EmcPmacroObDdllLongDqRank0_2;
|
||||
u32 EmcPmacroObDdllLongDqRank0_3;
|
||||
u32 EmcPmacroObDdllLongDqRank0_4;
|
||||
u32 EmcPmacroObDdllLongDqRank0_5;
|
||||
u32 EmcPmacroObDdllLongDqRank1_0;
|
||||
u32 EmcPmacroObDdllLongDqRank1_1;
|
||||
u32 EmcPmacroObDdllLongDqRank1_2;
|
||||
u32 EmcPmacroObDdllLongDqRank1_3;
|
||||
u32 EmcPmacroObDdllLongDqRank1_4;
|
||||
u32 EmcPmacroObDdllLongDqRank1_5;
|
||||
u32 EmcPmacroObDdllLongDqsRank0_0;
|
||||
u32 EmcPmacroObDdllLongDqsRank0_1;
|
||||
u32 EmcPmacroObDdllLongDqsRank0_2;
|
||||
u32 EmcPmacroObDdllLongDqsRank0_3;
|
||||
u32 EmcPmacroObDdllLongDqsRank0_4;
|
||||
u32 EmcPmacroObDdllLongDqsRank0_5;
|
||||
u32 EmcPmacroObDdllLongDqsRank1_0;
|
||||
u32 EmcPmacroObDdllLongDqsRank1_1;
|
||||
u32 EmcPmacroObDdllLongDqsRank1_2;
|
||||
u32 EmcPmacroObDdllLongDqsRank1_3;
|
||||
u32 EmcPmacroObDdllLongDqsRank1_4;
|
||||
u32 EmcPmacroObDdllLongDqsRank1_5;
|
||||
u32 EmcPmacroIbDdllLongDqsRank0_0;
|
||||
u32 EmcPmacroIbDdllLongDqsRank0_1;
|
||||
u32 EmcPmacroIbDdllLongDqsRank0_2;
|
||||
u32 EmcPmacroIbDdllLongDqsRank0_3;
|
||||
u32 EmcPmacroIbDdllLongDqsRank1_0;
|
||||
u32 EmcPmacroIbDdllLongDqsRank1_1;
|
||||
u32 EmcPmacroIbDdllLongDqsRank1_2;
|
||||
u32 EmcPmacroIbDdllLongDqsRank1_3;
|
||||
u32 EmcPmacroDdllLongCmd_0;
|
||||
u32 EmcPmacroDdllLongCmd_1;
|
||||
u32 EmcPmacroDdllLongCmd_2;
|
||||
u32 EmcPmacroDdllLongCmd_3;
|
||||
u32 EmcPmacroDdllLongCmd_4;
|
||||
u32 EmcPmacroDdllShortCmd_0;
|
||||
u32 EmcPmacroDdllShortCmd_1;
|
||||
u32 EmcPmacroDdllShortCmd_2;
|
||||
u32 EmcPmacroDdllPeriodicOffset;
|
||||
u32 WarmBootWait;
|
||||
u32 EmcOdtWrite;
|
||||
u32 EmcZcalInterval;
|
||||
u32 EmcZcalWaitCnt;
|
||||
u32 EmcZcalMrwCmd;
|
||||
u32 EmcMrsResetDll;
|
||||
u32 EmcZcalInitDev0;
|
||||
u32 EmcZcalInitDev1;
|
||||
u32 EmcZcalInitWait;
|
||||
u32 EmcZcalWarmColdBootEnables;
|
||||
u32 EmcMrwLpddr2ZcalWarmBoot;
|
||||
u32 EmcZqCalDdr3WarmBoot;
|
||||
u32 EmcZqCalLpDdr4WarmBoot;
|
||||
u32 EmcZcalWarmBootWait;
|
||||
u32 EmcMrsWarmBootEnable;
|
||||
u32 EmcMrsResetDllWait;
|
||||
u32 EmcMrsExtra;
|
||||
u32 EmcWarmBootMrsExtra;
|
||||
u32 EmcEmrsDdr2DllEnable;
|
||||
u32 EmcMrsDdr2DllReset;
|
||||
u32 EmcEmrsDdr2OcdCalib;
|
||||
u32 EmcDdr2Wait;
|
||||
u32 EmcClkenOverride;
|
||||
u32 EmcExtraRefreshNum;
|
||||
u32 EmcClkenOverrideAllWarmBoot;
|
||||
u32 McClkenOverrideAllWarmBoot;
|
||||
u32 EmcCfgDigDllPeriodWarmBoot;
|
||||
u32 PmcVddpSel;
|
||||
u32 PmcVddpSelWait;
|
||||
u32 PmcDdrCfg;
|
||||
u32 PmcIoDpd3Req;
|
||||
u32 PmcIoDpd3ReqWait;
|
||||
u32 PmcIoDpd4ReqWait;
|
||||
u32 PmcRegShort;
|
||||
u32 PmcNoIoPower;
|
||||
u32 PmcDdrCntrlWait;
|
||||
u32 PmcDdrCntrl;
|
||||
u32 EmcAcpdControl;
|
||||
u32 EmcSwizzleRank0Byte0;
|
||||
u32 EmcSwizzleRank0Byte1;
|
||||
u32 EmcSwizzleRank0Byte2;
|
||||
u32 EmcSwizzleRank0Byte3;
|
||||
u32 EmcSwizzleRank1Byte0;
|
||||
u32 EmcSwizzleRank1Byte1;
|
||||
u32 EmcSwizzleRank1Byte2;
|
||||
u32 EmcSwizzleRank1Byte3;
|
||||
u32 EmcTxdsrvttgen;
|
||||
u32 EmcDataBrlshft0;
|
||||
u32 EmcDataBrlshft1;
|
||||
u32 EmcDqsBrlshft0;
|
||||
u32 EmcDqsBrlshft1;
|
||||
u32 EmcCmdBrlshft0;
|
||||
u32 EmcCmdBrlshft1;
|
||||
u32 EmcCmdBrlshft2;
|
||||
u32 EmcCmdBrlshft3;
|
||||
u32 EmcQuseBrlshft0;
|
||||
u32 EmcQuseBrlshft1;
|
||||
u32 EmcQuseBrlshft2;
|
||||
u32 EmcQuseBrlshft3;
|
||||
u32 EmcPmacroDllCfg0;
|
||||
u32 EmcPmacroDllCfg1;
|
||||
u32 EmcPmcScratch1;
|
||||
u32 EmcPmcScratch2;
|
||||
u32 EmcPmcScratch3;
|
||||
u32 EmcPmacroPadCfgCtrl;
|
||||
u32 EmcPmacroVttgenCtrl0;
|
||||
u32 EmcPmacroVttgenCtrl1;
|
||||
u32 EmcPmacroVttgenCtrl2;
|
||||
u32 EmcPmacroDsrVttgenCtrl0;
|
||||
u32 EmcPmacroBrickCtrlRfu1;
|
||||
u32 EmcPmacroCmdBrickCtrlFdpd;
|
||||
u32 EmcPmacroBrickCtrlRfu2;
|
||||
u32 EmcPmacroDataBrickCtrlFdpd;
|
||||
u32 EmcPmacroBgBiasCtrl0;
|
||||
u32 EmcPmacroDataPadRxCtrl;
|
||||
u32 EmcPmacroCmdPadRxCtrl;
|
||||
u32 EmcPmacroDataRxTermMode;
|
||||
u32 EmcPmacroCmdRxTermMode;
|
||||
u32 EmcPmacroDataPadTxCtrl;
|
||||
u32 EmcPmacroCmdPadTxCtrl;
|
||||
u32 EmcCfg3;
|
||||
u32 EmcPmacroTxPwrd0;
|
||||
u32 EmcPmacroTxPwrd1;
|
||||
u32 EmcPmacroTxPwrd2;
|
||||
u32 EmcPmacroTxPwrd3;
|
||||
u32 EmcPmacroTxPwrd4;
|
||||
u32 EmcPmacroTxPwrd5;
|
||||
u32 EmcConfigSampleDelay;
|
||||
u32 EmcPmacroBrickMapping0;
|
||||
u32 EmcPmacroBrickMapping1;
|
||||
u32 EmcPmacroBrickMapping2;
|
||||
u32 EmcPmacroTxSelClkSrc0;
|
||||
u32 EmcPmacroTxSelClkSrc1;
|
||||
u32 EmcPmacroTxSelClkSrc2;
|
||||
u32 EmcPmacroTxSelClkSrc3;
|
||||
u32 EmcPmacroTxSelClkSrc4;
|
||||
u32 EmcPmacroTxSelClkSrc5;
|
||||
u32 EmcPmacroPerbitFgcgCtrl0;
|
||||
u32 EmcPmacroPerbitFgcgCtrl1;
|
||||
u32 EmcPmacroPerbitFgcgCtrl2;
|
||||
u32 EmcPmacroPerbitFgcgCtrl3;
|
||||
u32 EmcPmacroPerbitFgcgCtrl4;
|
||||
u32 EmcPmacroPerbitFgcgCtrl5;
|
||||
u32 EmcPmacroPerbitRfuCtrl0;
|
||||
u32 EmcPmacroPerbitRfuCtrl1;
|
||||
u32 EmcPmacroPerbitRfuCtrl2;
|
||||
u32 EmcPmacroPerbitRfuCtrl3;
|
||||
u32 EmcPmacroPerbitRfuCtrl4;
|
||||
u32 EmcPmacroPerbitRfuCtrl5;
|
||||
u32 EmcPmacroPerbitRfu1Ctrl0;
|
||||
u32 EmcPmacroPerbitRfu1Ctrl1;
|
||||
u32 EmcPmacroPerbitRfu1Ctrl2;
|
||||
u32 EmcPmacroPerbitRfu1Ctrl3;
|
||||
u32 EmcPmacroPerbitRfu1Ctrl4;
|
||||
u32 EmcPmacroPerbitRfu1Ctrl5;
|
||||
u32 EmcPmacroDataPiCtrl;
|
||||
u32 EmcPmacroCmdPiCtrl;
|
||||
u32 EmcPmacroDdllBypass;
|
||||
u32 EmcPmacroDdllPwrd0;
|
||||
u32 EmcPmacroDdllPwrd1;
|
||||
u32 EmcPmacroDdllPwrd2;
|
||||
u32 EmcPmacroCmdCtrl0;
|
||||
u32 EmcPmacroCmdCtrl1;
|
||||
u32 EmcPmacroCmdCtrl2;
|
||||
u32 McEmemAdrCfg;
|
||||
u32 McEmemAdrCfgDev0;
|
||||
u32 McEmemAdrCfgDev1;
|
||||
u32 McEmemAdrCfgChannelMask;
|
||||
u32 McEmemAdrCfgBankMask0;
|
||||
u32 McEmemAdrCfgBankMask1;
|
||||
u32 McEmemAdrCfgBankMask2;
|
||||
u32 McEmemCfg;
|
||||
u32 McEmemArbCfg;
|
||||
u32 McEmemArbOutstandingReq;
|
||||
u32 McEmemArbRefpbHpCtrl;
|
||||
u32 McEmemArbRefpbBankCtrl;
|
||||
u32 McEmemArbTimingRcd;
|
||||
u32 McEmemArbTimingRp;
|
||||
u32 McEmemArbTimingRc;
|
||||
u32 McEmemArbTimingRas;
|
||||
u32 McEmemArbTimingFaw;
|
||||
u32 McEmemArbTimingRrd;
|
||||
u32 McEmemArbTimingRap2Pre;
|
||||
u32 McEmemArbTimingWap2Pre;
|
||||
u32 McEmemArbTimingR2R;
|
||||
u32 McEmemArbTimingW2W;
|
||||
u32 McEmemArbTimingR2W;
|
||||
u32 McEmemArbTimingW2R;
|
||||
u32 McEmemArbTimingRFCPB;
|
||||
u32 McEmemArbDaTurns;
|
||||
u32 McEmemArbDaCovers;
|
||||
u32 McEmemArbMisc0;
|
||||
u32 McEmemArbMisc1;
|
||||
u32 McEmemArbMisc2;
|
||||
u32 McEmemArbRing1Throttle;
|
||||
u32 McEmemArbOverride;
|
||||
u32 McEmemArbOverride1;
|
||||
u32 McEmemArbRsv;
|
||||
u32 McDaCfg0;
|
||||
u32 McEmemArbTimingCcdmw;
|
||||
u32 McClkenOverride;
|
||||
u32 McStatControl;
|
||||
u32 McVideoProtectBom;
|
||||
u32 McVideoProtectBomAdrHi;
|
||||
u32 McVideoProtectSizeMb;
|
||||
u32 McVideoProtectVprOverride;
|
||||
u32 McVideoProtectVprOverride1;
|
||||
u32 McVideoProtectGpuOverride0;
|
||||
u32 McVideoProtectGpuOverride1;
|
||||
u32 McSecCarveoutBom;
|
||||
u32 McSecCarveoutAdrHi;
|
||||
u32 McSecCarveoutSizeMb;
|
||||
u32 McVideoProtectWriteAccess;
|
||||
u32 McSecCarveoutProtectWriteAccess;
|
||||
u32 McGeneralizedCarveout1Bom;
|
||||
u32 McGeneralizedCarveout1BomHi;
|
||||
u32 McGeneralizedCarveout1Size128kb;
|
||||
u32 McGeneralizedCarveout1Access0;
|
||||
u32 McGeneralizedCarveout1Access1;
|
||||
u32 McGeneralizedCarveout1Access2;
|
||||
u32 McGeneralizedCarveout1Access3;
|
||||
u32 McGeneralizedCarveout1Access4;
|
||||
u32 McGeneralizedCarveout1ForceInternalAccess0;
|
||||
u32 McGeneralizedCarveout1ForceInternalAccess1;
|
||||
u32 McGeneralizedCarveout1ForceInternalAccess2;
|
||||
u32 McGeneralizedCarveout1ForceInternalAccess3;
|
||||
u32 McGeneralizedCarveout1ForceInternalAccess4;
|
||||
u32 McGeneralizedCarveout1Cfg0;
|
||||
u32 McGeneralizedCarveout2Bom;
|
||||
u32 McGeneralizedCarveout2BomHi;
|
||||
u32 McGeneralizedCarveout2Size128kb;
|
||||
u32 McGeneralizedCarveout2Access0;
|
||||
u32 McGeneralizedCarveout2Access1;
|
||||
u32 McGeneralizedCarveout2Access2;
|
||||
u32 McGeneralizedCarveout2Access3;
|
||||
u32 McGeneralizedCarveout2Access4;
|
||||
u32 McGeneralizedCarveout2ForceInternalAccess0;
|
||||
u32 McGeneralizedCarveout2ForceInternalAccess1;
|
||||
u32 McGeneralizedCarveout2ForceInternalAccess2;
|
||||
u32 McGeneralizedCarveout2ForceInternalAccess3;
|
||||
u32 McGeneralizedCarveout2ForceInternalAccess4;
|
||||
u32 McGeneralizedCarveout2Cfg0;
|
||||
u32 McGeneralizedCarveout3Bom;
|
||||
u32 McGeneralizedCarveout3BomHi;
|
||||
u32 McGeneralizedCarveout3Size128kb;
|
||||
u32 McGeneralizedCarveout3Access0;
|
||||
u32 McGeneralizedCarveout3Access1;
|
||||
u32 McGeneralizedCarveout3Access2;
|
||||
u32 McGeneralizedCarveout3Access3;
|
||||
u32 McGeneralizedCarveout3Access4;
|
||||
u32 McGeneralizedCarveout3ForceInternalAccess0;
|
||||
u32 McGeneralizedCarveout3ForceInternalAccess1;
|
||||
u32 McGeneralizedCarveout3ForceInternalAccess2;
|
||||
u32 McGeneralizedCarveout3ForceInternalAccess3;
|
||||
u32 McGeneralizedCarveout3ForceInternalAccess4;
|
||||
u32 McGeneralizedCarveout3Cfg0;
|
||||
u32 McGeneralizedCarveout4Bom;
|
||||
u32 McGeneralizedCarveout4BomHi;
|
||||
u32 McGeneralizedCarveout4Size128kb;
|
||||
u32 McGeneralizedCarveout4Access0;
|
||||
u32 McGeneralizedCarveout4Access1;
|
||||
u32 McGeneralizedCarveout4Access2;
|
||||
u32 McGeneralizedCarveout4Access3;
|
||||
u32 McGeneralizedCarveout4Access4;
|
||||
u32 McGeneralizedCarveout4ForceInternalAccess0;
|
||||
u32 McGeneralizedCarveout4ForceInternalAccess1;
|
||||
u32 McGeneralizedCarveout4ForceInternalAccess2;
|
||||
u32 McGeneralizedCarveout4ForceInternalAccess3;
|
||||
u32 McGeneralizedCarveout4ForceInternalAccess4;
|
||||
u32 McGeneralizedCarveout4Cfg0;
|
||||
u32 McGeneralizedCarveout5Bom;
|
||||
u32 McGeneralizedCarveout5BomHi;
|
||||
u32 McGeneralizedCarveout5Size128kb;
|
||||
u32 McGeneralizedCarveout5Access0;
|
||||
u32 McGeneralizedCarveout5Access1;
|
||||
u32 McGeneralizedCarveout5Access2;
|
||||
u32 McGeneralizedCarveout5Access3;
|
||||
u32 McGeneralizedCarveout5Access4;
|
||||
u32 McGeneralizedCarveout5ForceInternalAccess0;
|
||||
u32 McGeneralizedCarveout5ForceInternalAccess1;
|
||||
u32 McGeneralizedCarveout5ForceInternalAccess2;
|
||||
u32 McGeneralizedCarveout5ForceInternalAccess3;
|
||||
u32 McGeneralizedCarveout5ForceInternalAccess4;
|
||||
u32 McGeneralizedCarveout5Cfg0;
|
||||
u32 EmcCaTrainingEnable;
|
||||
u32 SwizzleRankByteEncode;
|
||||
u32 BootRomPatchControl;
|
||||
u32 BootRomPatchData;
|
||||
u32 McMtsCarveoutBom;
|
||||
u32 McMtsCarveoutAdrHi;
|
||||
u32 McMtsCarveoutSizeMb;
|
||||
u32 McMtsCarveoutRegCtrl;
|
||||
u32 McUntranslatedRegionCheck;
|
||||
u32 BCT_NA;
|
||||
};
|
||||
static_assert(sizeof(BootSdramParams) == 0x838);
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::charger {
|
||||
|
||||
bool IsHiZMode();
|
||||
void EnterHiZMode();
|
||||
void ExitHiZMode();
|
||||
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::clkrst {
|
||||
|
||||
void SetRegisterAddress(uintptr_t address);
|
||||
|
||||
void SetFuseVisibility(bool visible);
|
||||
|
||||
void EnableUartAClock();
|
||||
void EnableUartBClock();
|
||||
void EnableUartCClock();
|
||||
void EnableActmonClock();
|
||||
void EnableI2c1Clock();
|
||||
void EnableI2c5Clock();
|
||||
|
||||
void EnableSeClock();
|
||||
void EnableCldvfsClock();
|
||||
void EnableCsiteClock();
|
||||
void EnableTzramClock();
|
||||
|
||||
void EnableCache2Clock();
|
||||
void EnableCram2Clock();
|
||||
|
||||
void EnableHost1xClock();
|
||||
void EnableTsecClock();
|
||||
void EnableSorSafeClock();
|
||||
void EnableSor0Clock();
|
||||
void EnableSor1Clock();
|
||||
void EnableKfuseClock();
|
||||
|
||||
void DisableI2c1Clock();
|
||||
|
||||
void DisableHost1xClock();
|
||||
void DisableTsecClock();
|
||||
void DisableSorSafeClock();
|
||||
void DisableSor0Clock();
|
||||
void DisableSor1Clock();
|
||||
void DisableKfuseClock();
|
||||
|
||||
|
||||
enum BpmpClockRate {
|
||||
BpmpClockRate_408MHz,
|
||||
BpmpClockRate_544MHz,
|
||||
BpmpClockRate_576MHz,
|
||||
BpmpClockRate_589MHz,
|
||||
|
||||
BpmpClockRate_Count,
|
||||
};
|
||||
|
||||
BpmpClockRate GetBpmpClockRate();
|
||||
BpmpClockRate SetBpmpClockRate(BpmpClockRate rate);
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
#if 1 || defined(AMS_BUILD_FOR_AUDITING)
|
||||
#define EXOSPHERE_BUILD_FOR_AUDITING
|
||||
#endif
|
||||
|
||||
#if defined(EXOSPHERE_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
|
||||
#define EXOSPHERE_BUILD_FOR_DEBUGGING
|
||||
#endif
|
||||
|
||||
#ifdef EXOSPHERE_BUILD_FOR_DEBUGGING
|
||||
#define EXOSPHERE_ENABLE_ASSERTIONS
|
||||
#define EXOSPHERE_ENABLE_DEBUG_PRINT
|
||||
#endif
|
||||
@@ -1,119 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
|
||||
void AbortImpl(const char *expr, const char *func, const char *file, int line) {
|
||||
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||
{
|
||||
AMS_LOG("Abort Called\n");
|
||||
AMS_LOG(" Location: %s:%d\n", file, line);
|
||||
AMS_LOG(" Function: %s\n", func);
|
||||
AMS_LOG(" Expression: %s\n", expr);
|
||||
AMS_LOG("\n");
|
||||
}
|
||||
#else
|
||||
AMS_UNUSED(file, line, func, expr);
|
||||
#endif
|
||||
AbortImpl();
|
||||
}
|
||||
|
||||
void AbortImpl(const char *expr, const char *func, const char *file, int line, const char *format, ...) {
|
||||
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||
{
|
||||
AMS_LOG("Abort Called\n");
|
||||
AMS_LOG(" Location: %s:%d\n", file, line);
|
||||
AMS_LOG(" Function: %s\n", func);
|
||||
AMS_LOG(" Expression: %s\n", expr);
|
||||
AMS_LOG(" Value: %016" PRIx64 "\n", value);
|
||||
AMS_LOG("\n");
|
||||
{
|
||||
::std::va_list vl;
|
||||
va_start(vl, format);
|
||||
AMS_VLOG(format, vl);
|
||||
va_end(vl);
|
||||
AMS_LOG("\n");
|
||||
}
|
||||
}
|
||||
#else
|
||||
AMS_UNUSED(file, line, func, expr, format);
|
||||
#endif
|
||||
AbortImpl();
|
||||
}
|
||||
|
||||
void AbortImpl(const char *expr, const char *func, const char *file, int line, const ::ams::Result *result, const char *format, ...) {
|
||||
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||
{
|
||||
AMS_LOG("Abort Called\n");
|
||||
AMS_LOG(" Location: %s:%d\n", file, line);
|
||||
AMS_LOG(" Function: %s\n", func);
|
||||
AMS_LOG(" Expression: %s\n", expr);
|
||||
AMS_LOG(" Result: 0x%08" PRIx32 "\n", result->GetValue());
|
||||
AMS_LOG("\n");
|
||||
{
|
||||
::std::va_list vl;
|
||||
va_start(vl, format);
|
||||
AMS_VLOG(format, vl);
|
||||
va_end(vl);
|
||||
AMS_LOG("\n");
|
||||
}
|
||||
}
|
||||
#else
|
||||
AMS_UNUSED(file, line, func, expr, result, format);
|
||||
#endif
|
||||
AbortImpl();
|
||||
}
|
||||
|
||||
void OnAssertionFailure(AssertionType type, const char *expr, const char *func, const char *file, int line) {
|
||||
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||
{
|
||||
AMS_LOG("Assertion Failure\n");
|
||||
AMS_LOG(" Location: %s:%d\n", file, line);
|
||||
AMS_LOG(" Function: %s\n", func);
|
||||
AMS_LOG(" Expression: %s\n", expr);
|
||||
AMS_LOG(" Value: %016" PRIx64 "\n", value);
|
||||
AMS_LOG("\n");
|
||||
|
||||
AMS_UNUSED(type);
|
||||
}
|
||||
#else
|
||||
AMS_UNUSED(type, expr, func, file, line);
|
||||
#endif
|
||||
AbortImpl();
|
||||
}
|
||||
|
||||
void OnAssertionFailure(AssertionType type, const char *expr, const char *func, const char *file, int line, const char *format, ...) {
|
||||
#if defined(AMS_ENABLE_DETAILED_ASSERTIONS)
|
||||
{
|
||||
AMS_LOG("Assertion Failure\n");
|
||||
AMS_LOG(" Location: %s:%d\n", file, line);
|
||||
AMS_LOG(" Function: %s\n", func);
|
||||
AMS_LOG(" Expression: %s\n", expr);
|
||||
AMS_LOG(" Value: %016" PRIx64 "\n", value);
|
||||
AMS_LOG("\n");
|
||||
{
|
||||
::std::va_list vl;
|
||||
va_start(vl, format);
|
||||
AMS_VLOG(format, vl);
|
||||
va_end(vl);
|
||||
AMS_LOG("\n");
|
||||
}
|
||||
|
||||
AMS_UNUSED(type);
|
||||
}
|
||||
#else
|
||||
AMS_UNUSED(type, expr, func, file, line, format);
|
||||
#endif
|
||||
AbortImpl();
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::flow {
|
||||
|
||||
void SetRegisterAddress(uintptr_t address);
|
||||
|
||||
void ResetCpuRegisters(int core);
|
||||
|
||||
void SetCpuCsr(int core, u32 enable_ext);
|
||||
void SetHaltCpuEvents(int core, bool resume_on_irq);
|
||||
void SetCc4Ctrl(int core, u32 value);
|
||||
void ClearL2FlushControl();
|
||||
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/br.hpp>
|
||||
#include <exosphere/pmic.hpp>
|
||||
|
||||
namespace ams::fuse {
|
||||
|
||||
enum HardwareType {
|
||||
HardwareType_Icosa = 0,
|
||||
HardwareType_Copper = 1,
|
||||
HardwareType_Hoag = 2,
|
||||
HardwareType_Iowa = 3,
|
||||
HardwareType_Calcio = 4,
|
||||
HardwareType_Aula = 5,
|
||||
|
||||
HardwareType_Undefined = 0xF,
|
||||
};
|
||||
|
||||
enum SocType {
|
||||
SocType_Erista = 0,
|
||||
SocType_Mariko = 1,
|
||||
SocType_Undefined = 0xF,
|
||||
};
|
||||
|
||||
enum HardwareState {
|
||||
HardwareState_Development = 0,
|
||||
HardwareState_Production = 1,
|
||||
HardwareState_Undefined = 2,
|
||||
};
|
||||
|
||||
enum PatchVersion {
|
||||
PatchVersion_Odnx02A2 = (SocType_Erista << 12) | 0x07F,
|
||||
};
|
||||
|
||||
enum DramId {
|
||||
DramId_IcosaSamsung4GB = 0,
|
||||
DramId_IcosaHynix4GB = 1,
|
||||
DramId_IcosaMicron4GB = 2,
|
||||
DramId_IowaHynix1y4GB = 3,
|
||||
DramId_IcosaSamsung6GB = 4,
|
||||
DramId_HoagHynix1y4GB = 5,
|
||||
DramId_AulaHynix1y4GB = 6,
|
||||
DramId_Deprecated7 = 7,
|
||||
DramId_IowaSansung4GB = 8,
|
||||
DramId_IowaSamsung8GB = 9,
|
||||
DramId_IowaHynix4GB = 10,
|
||||
DramId_IowaMicron4GB = 11,
|
||||
DramId_HoagSamsung4GB = 12,
|
||||
DramId_HoagSamsung8GB = 13,
|
||||
DramId_HoagHynix4GB = 14,
|
||||
DramId_HoagMicron4GB = 15,
|
||||
DramId_Deprecated16 = 16,
|
||||
DramId_IowaSamsung1y4GBX = 17,
|
||||
DramId_IowaSamsung1y8GBX = 18,
|
||||
DramId_HoagSamsung1y4GBX = 19,
|
||||
DramId_IowaSamsung1z4GB = 20,
|
||||
DramId_HoagSamsung1z4GB = 21,
|
||||
DramId_AulaSamsung1z4GB = 22,
|
||||
DramId_HoagSamsung1y8GBX = 23,
|
||||
DramId_AulaSamsung1y4GBX = 24,
|
||||
DramId_IowaMicron1y4GB = 25,
|
||||
DramId_HoagMicron1y4GB = 26,
|
||||
DramId_AulaMicron1y4GB = 27,
|
||||
DramId_AulaSamsung1y8GBX = 28,
|
||||
DramId_IowaX1X2Samsung4GB = 29,
|
||||
DramId_HoagX1X2Samsung4GB = 30,
|
||||
DramId_AulaX1X2Samsung4GB = 31,
|
||||
DramId_IowaSamsung4GBY = 32,
|
||||
DramId_HoagSamsung4GBY = 33,
|
||||
DramId_AulaSamsung4GBY = 34,
|
||||
|
||||
DramId_Count,
|
||||
};
|
||||
|
||||
enum RetailInteractiveDisplayState {
|
||||
RetailInteractiveDisplayState_Disabled = 0,
|
||||
RetailInteractiveDisplayState_Enabled = 1,
|
||||
};
|
||||
|
||||
void SetRegisterAddress(uintptr_t address);
|
||||
void SetWriteSecureOnly();
|
||||
void Lockout();
|
||||
|
||||
void Activate();
|
||||
void Deactivate();
|
||||
void Reload();
|
||||
|
||||
u32 ReadWord(int address);
|
||||
|
||||
u32 GetOdmWord(int index);
|
||||
|
||||
DramId GetDramId();
|
||||
|
||||
bool GetSecureBootKey(void *dst);
|
||||
|
||||
void GetEcid(br::BootEcid *out);
|
||||
HardwareType GetHardwareType();
|
||||
HardwareState GetHardwareState();
|
||||
u64 GetDeviceId();
|
||||
PatchVersion GetPatchVersion();
|
||||
RetailInteractiveDisplayState GetRetailInteractiveDisplayState();
|
||||
pmic::Regulator GetRegulator();
|
||||
int GetDeviceUniqueKeyGeneration();
|
||||
|
||||
SocType GetSocType();
|
||||
int GetExpectedFuseVersion(TargetFirmware target_fw);
|
||||
int GetFuseVersion();
|
||||
bool HasRcmVulnerabilityPatch();
|
||||
|
||||
bool IsOdmProductionMode();
|
||||
void ConfigureFuseBypass();
|
||||
|
||||
}
|
||||
@@ -1,44 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::gic {
|
||||
|
||||
enum InterruptMode {
|
||||
InterruptMode_Level = 0,
|
||||
InterruptMode_Edge = 1,
|
||||
};
|
||||
|
||||
constexpr inline s32 HighestPriority = 0;
|
||||
constexpr inline s32 InterruptCount = 224;
|
||||
|
||||
void SetRegisterAddress(uintptr_t distributor_address, uintptr_t cpu_interface_address);
|
||||
void InitializeCommon();
|
||||
void InitializeCoreUnique();
|
||||
|
||||
void SetPriority(int interrupt_id, int priority);
|
||||
void SetInterruptGroup(int interrupt_id, int group);
|
||||
void SetEnable(int interrupt_id, bool enable);
|
||||
void SetSpiTargetCpu(int interrupt_id, u32 cpu_mask);
|
||||
void SetSpiMode(int interrupt_id, InterruptMode mode);
|
||||
|
||||
void SetPending(int interrupt_id);
|
||||
|
||||
int GetInterruptRequestId();
|
||||
void SetEndOfInterrupt(int interrupt_id);
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
#if defined(ATMOSPHERE_ARCH_ARM64)
|
||||
#include <exosphere/hw/hw_arm64.hpp>
|
||||
namespace ams::hw { using namespace ams::hw::arch::arm64; }
|
||||
#elif defined(ATMOSPHERE_ARCH_ARM)
|
||||
#include <exosphere/hw/hw_arm.hpp>
|
||||
namespace ams::hw { using namespace ams::hw::arch::arm; }
|
||||
#else
|
||||
#error "Unknown architecture for hw!"
|
||||
#endif
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::hw::arch::arm {
|
||||
|
||||
#ifdef __BPMP__
|
||||
constexpr inline size_t DataCacheLineSize = 0x20;
|
||||
constexpr inline size_t DataCacheSize = 32_KB;
|
||||
|
||||
ALWAYS_INLINE void DataSynchronizationBarrier() {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void DataSynchronizationBarrierInnerShareable() {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void DataMemoryBarrier() {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void InstructionSynchronizationBarrier() {
|
||||
/* ... */
|
||||
}
|
||||
|
||||
void InitializeDataCache();
|
||||
void FinalizeDataCache();
|
||||
|
||||
void InvalidateEntireDataCache();
|
||||
void StoreEntireDataCache();
|
||||
void FlushEntireDataCache();
|
||||
|
||||
void InvalidateDataCacheLine(void *ptr);
|
||||
void StoreDataCacheLine(void *ptr);
|
||||
void FlushDataCacheLine(void *ptr);
|
||||
|
||||
void InvalidateDataCache(void *ptr, size_t size);
|
||||
void StoreDataCache(const void *ptr, size_t size);
|
||||
void FlushDataCache(const void *ptr, size_t size);
|
||||
#else
|
||||
#error "Unknown ARM board for ams::hw"
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/hw/hw_arm64_system_registers.hpp>
|
||||
#include <exosphere/hw/hw_arm64_cache.hpp>
|
||||
|
||||
namespace ams::hw::arch::arm64 {
|
||||
|
||||
ALWAYS_INLINE void DataSynchronizationBarrier() {
|
||||
__asm__ __volatile__("dsb sy" ::: "memory");
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void DataSynchronizationBarrierInnerShareable() {
|
||||
__asm__ __volatile__("dsb ish" ::: "memory");
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void DataMemoryBarrier() {
|
||||
__asm__ __volatile__("dmb sy" ::: "memory");
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void InstructionSynchronizationBarrier() {
|
||||
__asm__ __volatile__("isb" ::: "memory");
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void WaitForInterrupt() {
|
||||
__asm__ __volatile__("wfi" ::: "memory");
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void WaitForEvent() {
|
||||
__asm__ __volatile__("wfe" ::: "memory");
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void SendEvent() {
|
||||
__asm__ __volatile__("sev" ::: "memory");
|
||||
}
|
||||
|
||||
ALWAYS_INLINE int CountLeadingZeros(u64 v) {
|
||||
u64 z;
|
||||
__asm__ __volatile__("clz %[z], %[v]" : [z]"=r"(z) : [v]"r"(v));
|
||||
return z;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE int CountLeadingZeros(u32 v) {
|
||||
u32 z;
|
||||
__asm__ __volatile__("clz %w[z], %w[v]" : [z]"=r"(z) : [v]"r"(v));
|
||||
return z;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE int GetCurrentCoreId() {
|
||||
u64 mpidr;
|
||||
HW_CPU_GET_MPIDR_EL1(mpidr);
|
||||
return mpidr & 0xFF;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::hw::arch::arm64 {
|
||||
|
||||
#if defined(ATMOSPHERE_CPU_ARM_CORTEX_A57) || defined(ATMOSPHERE_CPU_ARM_CORTEX_A53)
|
||||
constexpr inline size_t InstructionCacheLineSize = 0x40;
|
||||
constexpr inline size_t DataCacheLineSize = 0x40;
|
||||
constexpr inline size_t NumPerformanceCounters = 6;
|
||||
#else
|
||||
#error "Unknown CPU for cache line sizes"
|
||||
#endif
|
||||
|
||||
ALWAYS_INLINE void InvalidateEntireTlb() {
|
||||
__asm__ __volatile__("tlbi alle3is" ::: "memory");
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void InvalidateDataCacheLine(void *ptr) {
|
||||
__asm __volatile__("dc ivac, %[ptr]" :: [ptr]"r"(ptr) : "memory");
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void FlushDataCacheLine(void *ptr) {
|
||||
__asm __volatile__("dc civac, %[ptr]" :: [ptr]"r"(ptr) : "memory");
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void InvalidateEntireInstructionCache() {
|
||||
__asm__ __volatile__("ic iallu" ::: "memory");
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void InvalidateTlb(uintptr_t address) {
|
||||
const uintptr_t page_index = address / 4_KB;
|
||||
__asm__ __volatile__("tlbi vae3is, %[page_index]" :: [page_index]"r"(page_index) : "memory");
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void InvalidateTlbLastLevel(uintptr_t address) {
|
||||
const uintptr_t page_index = address / 4_KB;
|
||||
__asm__ __volatile__("tlbi vale3is, %[page_index]" :: [page_index]"r"(page_index) : "memory");
|
||||
}
|
||||
|
||||
void FlushDataCache(const void *ptr, size_t size);
|
||||
void InvalidateDataCache(const void *ptr, size_t size);
|
||||
|
||||
}
|
||||
@@ -1,348 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::hw::arch::arm64 {
|
||||
|
||||
#define HW_CPU_GET_SYSREG(name, value) __asm__ __volatile__("mrs %0, " #name "" : "=&r"(value) :: "memory");
|
||||
|
||||
#define HW_CPU_SET_SYSREG(name, value) __asm__ __volatile__("msr " #name ", %0" :: "r"(value) : "memory", "cc")
|
||||
|
||||
#define HW_CPU_GET_SCTLR_EL3(value) HW_CPU_GET_SYSREG(sctlr_el3, value)
|
||||
#define HW_CPU_SET_SCTLR_EL3(value) HW_CPU_SET_SYSREG(sctlr_el3, value)
|
||||
|
||||
#define HW_CPU_GET_SCR_EL3(value) HW_CPU_GET_SYSREG(scr_el3, value)
|
||||
#define HW_CPU_SET_SCR_EL3(value) HW_CPU_SET_SYSREG(scr_el3, value)
|
||||
|
||||
#define HW_CPU_GET_CPTR_EL3(value) HW_CPU_GET_SYSREG(cptr_el3, value)
|
||||
#define HW_CPU_SET_CPTR_EL3(value) HW_CPU_SET_SYSREG(cptr_el3, value)
|
||||
|
||||
#define HW_CPU_GET_TTBR0_EL3(value) HW_CPU_GET_SYSREG(ttbr0_el3, value)
|
||||
#define HW_CPU_SET_TTBR0_EL3(value) HW_CPU_SET_SYSREG(ttbr0_el3, value)
|
||||
|
||||
#define HW_CPU_GET_TCR_EL3(value) HW_CPU_GET_SYSREG(tcr_el3, value)
|
||||
#define HW_CPU_SET_TCR_EL3(value) HW_CPU_SET_SYSREG(tcr_el3, value)
|
||||
|
||||
#define HW_CPU_GET_MAIR_EL3(value) HW_CPU_GET_SYSREG(mair_el3, value)
|
||||
#define HW_CPU_SET_MAIR_EL3(value) HW_CPU_SET_SYSREG(mair_el3, value)
|
||||
|
||||
#define HW_CPU_GET_VBAR_EL3(value) HW_CPU_GET_SYSREG(vbar_el3, value)
|
||||
#define HW_CPU_SET_VBAR_EL3(value) HW_CPU_SET_SYSREG(vbar_el3, value)
|
||||
|
||||
#define HW_CPU_GET_ELR_EL3(value) HW_CPU_GET_SYSREG(elr_el3, value)
|
||||
#define HW_CPU_SET_ELR_EL3(value) HW_CPU_SET_SYSREG(elr_el3, value)
|
||||
|
||||
#define HW_CPU_GET_FAR_EL3(value) HW_CPU_GET_SYSREG(far_el3, value)
|
||||
#define HW_CPU_SET_FAR_EL3(value) HW_CPU_SET_SYSREG(far_el3, value)
|
||||
|
||||
#define HW_CPU_GET_ESR_EL3(value) HW_CPU_GET_SYSREG(esr_el3, value)
|
||||
#define HW_CPU_SET_ESR_EL3(value) HW_CPU_SET_SYSREG(esr_el3, value)
|
||||
|
||||
#define HW_CPU_GET_CLIDR_EL1(value) HW_CPU_GET_SYSREG(clidr_el1, value)
|
||||
#define HW_CPU_SET_CLIDR_EL1(value) HW_CPU_SET_SYSREG(clidr_el1, value)
|
||||
|
||||
#define HW_CPU_GET_CCSIDR_EL1(value) HW_CPU_GET_SYSREG(ccsidr_el1, value)
|
||||
#define HW_CPU_SET_CCSIDR_EL1(value) HW_CPU_SET_SYSREG(ccsidr_el1, value)
|
||||
|
||||
#define HW_CPU_GET_CSSELR_EL1(value) HW_CPU_GET_SYSREG(csselr_el1, value)
|
||||
#define HW_CPU_SET_CSSELR_EL1(value) HW_CPU_SET_SYSREG(csselr_el1, value)
|
||||
|
||||
#define HW_CPU_GET_CPUACTLR_EL1(value) HW_CPU_GET_SYSREG(s3_1_c15_c2_0, value)
|
||||
#define HW_CPU_SET_CPUACTLR_EL1(value) HW_CPU_SET_SYSREG(s3_1_c15_c2_0, value)
|
||||
|
||||
#define HW_CPU_GET_CPUECTLR_EL1(value) HW_CPU_GET_SYSREG(s3_1_c15_c2_1, value)
|
||||
#define HW_CPU_SET_CPUECTLR_EL1(value) HW_CPU_SET_SYSREG(s3_1_c15_c2_1, value)
|
||||
|
||||
#define HW_CPU_GET_DBGAUTHSTATUS_EL1(value) HW_CPU_GET_SYSREG(dbgauthstatus_el1, value)
|
||||
#define HW_CPU_SET_DBGAUTHSTATUS_EL1(value) HW_CPU_SET_SYSREG(dbgauthstatus_el1, value)
|
||||
|
||||
#define HW_CPU_GET_MPIDR_EL1(value) HW_CPU_GET_SYSREG(mpidr_el1, value)
|
||||
|
||||
#define HW_CPU_GET_OSLAR_EL1(value) HW_CPU_GET_SYSREG(oslar_el1, value)
|
||||
#define HW_CPU_SET_OSLAR_EL1(value) HW_CPU_SET_SYSREG(oslar_el1, value)
|
||||
|
||||
#define HW_CPU_GET_OSDTRRX_EL1(value) HW_CPU_GET_SYSREG(osdtrrx_el1, value)
|
||||
#define HW_CPU_SET_OSDTRRX_EL1(value) HW_CPU_SET_SYSREG(osdtrrx_el1, value)
|
||||
|
||||
#define HW_CPU_GET_OSDTRTX_EL1(value) HW_CPU_GET_SYSREG(osdtrtx_el1, value)
|
||||
#define HW_CPU_SET_OSDTRTX_EL1(value) HW_CPU_SET_SYSREG(osdtrtx_el1, value)
|
||||
|
||||
#define HW_CPU_GET_MDSCR_EL1(value) HW_CPU_GET_SYSREG(mdscr_el1, value)
|
||||
#define HW_CPU_SET_MDSCR_EL1(value) HW_CPU_SET_SYSREG(mdscr_el1, value)
|
||||
|
||||
#define HW_CPU_GET_OSECCR_EL1(value) HW_CPU_GET_SYSREG(oseccr_el1, value)
|
||||
#define HW_CPU_SET_OSECCR_EL1(value) HW_CPU_SET_SYSREG(oseccr_el1, value)
|
||||
|
||||
#define HW_CPU_GET_MDCCINT_EL1(value) HW_CPU_GET_SYSREG(mdccint_el1, value)
|
||||
#define HW_CPU_SET_MDCCINT_EL1(value) HW_CPU_SET_SYSREG(mdccint_el1, value)
|
||||
|
||||
#define HW_CPU_GET_DBGCLAIMCLR_EL1(value) HW_CPU_GET_SYSREG(dbgclaimclr_el1, value)
|
||||
#define HW_CPU_SET_DBGCLAIMCLR_EL1(value) HW_CPU_SET_SYSREG(dbgclaimclr_el1, value)
|
||||
|
||||
#define HW_CPU_GET_FAR_EL1(value) HW_CPU_GET_SYSREG(far_el1, value)
|
||||
#define HW_CPU_SET_FAR_EL1(value) HW_CPU_SET_SYSREG(far_el1, value)
|
||||
|
||||
#define HW_CPU_GET_DBGVCR32_EL2(value) HW_CPU_GET_SYSREG(dbgvcr32_el2, value)
|
||||
#define HW_CPU_SET_DBGVCR32_EL2(value) HW_CPU_SET_SYSREG(dbgvcr32_el2, value)
|
||||
|
||||
#define HW_CPU_GET_SDER32_EL3(value) HW_CPU_GET_SYSREG(sder32_el3, value)
|
||||
#define HW_CPU_SET_SDER32_EL3(value) HW_CPU_SET_SYSREG(sder32_el3, value)
|
||||
|
||||
#define HW_CPU_GET_MDCR_EL2(value) HW_CPU_GET_SYSREG(mdcr_el2, value)
|
||||
#define HW_CPU_SET_MDCR_EL2(value) HW_CPU_SET_SYSREG(mdcr_el2, value)
|
||||
|
||||
#define HW_CPU_GET_MDCR_EL3(value) HW_CPU_GET_SYSREG(mdcr_el3, value)
|
||||
#define HW_CPU_SET_MDCR_EL3(value) HW_CPU_SET_SYSREG(mdcr_el3, value)
|
||||
|
||||
#define HW_CPU_GET_SPSR_EL3(value) HW_CPU_GET_SYSREG(spsr_el3, value)
|
||||
#define HW_CPU_SET_SPSR_EL3(value) HW_CPU_SET_SYSREG(spsr_el3, value)
|
||||
|
||||
#define HW_CPU_GET_DBGBVR0_EL1(value) HW_CPU_GET_SYSREG(dbgbvr0_el1, value)
|
||||
#define HW_CPU_SET_DBGBVR0_EL1(value) HW_CPU_SET_SYSREG(dbgbvr0_el1, value)
|
||||
#define HW_CPU_GET_DBGBCR0_EL1(value) HW_CPU_GET_SYSREG(dbgbcr0_el1, value)
|
||||
#define HW_CPU_SET_DBGBCR0_EL1(value) HW_CPU_SET_SYSREG(dbgbcr0_el1, value)
|
||||
#define HW_CPU_GET_DBGBVR1_EL1(value) HW_CPU_GET_SYSREG(dbgbvr1_el1, value)
|
||||
#define HW_CPU_SET_DBGBVR1_EL1(value) HW_CPU_SET_SYSREG(dbgbvr1_el1, value)
|
||||
#define HW_CPU_GET_DBGBCR1_EL1(value) HW_CPU_GET_SYSREG(dbgbcr1_el1, value)
|
||||
#define HW_CPU_SET_DBGBCR1_EL1(value) HW_CPU_SET_SYSREG(dbgbcr1_el1, value)
|
||||
#define HW_CPU_GET_DBGBVR2_EL1(value) HW_CPU_GET_SYSREG(dbgbvr2_el1, value)
|
||||
#define HW_CPU_SET_DBGBVR2_EL1(value) HW_CPU_SET_SYSREG(dbgbvr2_el1, value)
|
||||
#define HW_CPU_GET_DBGBCR2_EL1(value) HW_CPU_GET_SYSREG(dbgbcr2_el1, value)
|
||||
#define HW_CPU_SET_DBGBCR2_EL1(value) HW_CPU_SET_SYSREG(dbgbcr2_el1, value)
|
||||
#define HW_CPU_GET_DBGBVR3_EL1(value) HW_CPU_GET_SYSREG(dbgbvr3_el1, value)
|
||||
#define HW_CPU_SET_DBGBVR3_EL1(value) HW_CPU_SET_SYSREG(dbgbvr3_el1, value)
|
||||
#define HW_CPU_GET_DBGBCR3_EL1(value) HW_CPU_GET_SYSREG(dbgbcr3_el1, value)
|
||||
#define HW_CPU_SET_DBGBCR3_EL1(value) HW_CPU_SET_SYSREG(dbgbcr3_el1, value)
|
||||
#define HW_CPU_GET_DBGBVR4_EL1(value) HW_CPU_GET_SYSREG(dbgbvr4_el1, value)
|
||||
#define HW_CPU_SET_DBGBVR4_EL1(value) HW_CPU_SET_SYSREG(dbgbvr4_el1, value)
|
||||
#define HW_CPU_GET_DBGBCR4_EL1(value) HW_CPU_GET_SYSREG(dbgbcr4_el1, value)
|
||||
#define HW_CPU_SET_DBGBCR4_EL1(value) HW_CPU_SET_SYSREG(dbgbcr4_el1, value)
|
||||
#define HW_CPU_GET_DBGBVR5_EL1(value) HW_CPU_GET_SYSREG(dbgbvr5_el1, value)
|
||||
#define HW_CPU_SET_DBGBVR5_EL1(value) HW_CPU_SET_SYSREG(dbgbvr5_el1, value)
|
||||
#define HW_CPU_GET_DBGBCR5_EL1(value) HW_CPU_GET_SYSREG(dbgbcr5_el1, value)
|
||||
#define HW_CPU_SET_DBGBCR5_EL1(value) HW_CPU_SET_SYSREG(dbgbcr5_el1, value)
|
||||
|
||||
#define HW_CPU_GET_DBGWVR0_EL1(value) HW_CPU_GET_SYSREG(dbgwvr0_el1, value)
|
||||
#define HW_CPU_SET_DBGWVR0_EL1(value) HW_CPU_SET_SYSREG(dbgwvr0_el1, value)
|
||||
#define HW_CPU_GET_DBGWCR0_EL1(value) HW_CPU_GET_SYSREG(dbgwcr0_el1, value)
|
||||
#define HW_CPU_SET_DBGWCR0_EL1(value) HW_CPU_SET_SYSREG(dbgwcr0_el1, value)
|
||||
#define HW_CPU_GET_DBGWVR1_EL1(value) HW_CPU_GET_SYSREG(dbgwvr1_el1, value)
|
||||
#define HW_CPU_SET_DBGWVR1_EL1(value) HW_CPU_SET_SYSREG(dbgwvr1_el1, value)
|
||||
#define HW_CPU_GET_DBGWCR1_EL1(value) HW_CPU_GET_SYSREG(dbgwcr1_el1, value)
|
||||
#define HW_CPU_SET_DBGWCR1_EL1(value) HW_CPU_SET_SYSREG(dbgwcr1_el1, value)
|
||||
#define HW_CPU_GET_DBGWVR2_EL1(value) HW_CPU_GET_SYSREG(dbgwvr2_el1, value)
|
||||
#define HW_CPU_SET_DBGWVR2_EL1(value) HW_CPU_SET_SYSREG(dbgwvr2_el1, value)
|
||||
#define HW_CPU_GET_DBGWCR2_EL1(value) HW_CPU_GET_SYSREG(dbgwcr2_el1, value)
|
||||
#define HW_CPU_SET_DBGWCR2_EL1(value) HW_CPU_SET_SYSREG(dbgwcr2_el1, value)
|
||||
#define HW_CPU_GET_DBGWVR3_EL1(value) HW_CPU_GET_SYSREG(dbgwvr3_el1, value)
|
||||
#define HW_CPU_SET_DBGWVR3_EL1(value) HW_CPU_SET_SYSREG(dbgwvr3_el1, value)
|
||||
#define HW_CPU_GET_DBGWCR3_EL1(value) HW_CPU_GET_SYSREG(dbgwcr3_el1, value)
|
||||
#define HW_CPU_SET_DBGWCR3_EL1(value) HW_CPU_SET_SYSREG(dbgwcr3_el1, value)
|
||||
|
||||
#define HW_CPU_GET_CNTFRQ_EL0(value) HW_CPU_GET_SYSREG(cntfrq_el0, value)
|
||||
#define HW_CPU_SET_CNTFRQ_EL0(value) HW_CPU_SET_SYSREG(cntfrq_el0, value)
|
||||
|
||||
#define HW_CPU_GET_CNTHCTL_EL2(value) HW_CPU_GET_SYSREG(cnthctl_el2, value)
|
||||
#define HW_CPU_SET_CNTHCTL_EL2(value) HW_CPU_SET_SYSREG(cnthctl_el2, value)
|
||||
|
||||
#define HW_CPU_GET_ACTLR_EL2(value) HW_CPU_GET_SYSREG(actlr_el2, value)
|
||||
#define HW_CPU_SET_ACTLR_EL2(value) HW_CPU_SET_SYSREG(actlr_el2, value)
|
||||
|
||||
#define HW_CPU_GET_ACTLR_EL3(value) HW_CPU_GET_SYSREG(actlr_el3, value)
|
||||
#define HW_CPU_SET_ACTLR_EL3(value) HW_CPU_SET_SYSREG(actlr_el3, value)
|
||||
|
||||
#define HW_CPU_GET_HCR_EL2(value) HW_CPU_GET_SYSREG(hcr_el2, value)
|
||||
#define HW_CPU_SET_HCR_EL2(value) HW_CPU_SET_SYSREG(hcr_el2, value)
|
||||
|
||||
#define HW_CPU_GET_DACR32_EL2(value) HW_CPU_GET_SYSREG(dacr32_el2, value)
|
||||
#define HW_CPU_SET_DACR32_EL2(value) HW_CPU_SET_SYSREG(dacr32_el2, value)
|
||||
|
||||
#define HW_CPU_GET_SCTLR_EL2(value) HW_CPU_GET_SYSREG(sctlr_el2, value)
|
||||
#define HW_CPU_SET_SCTLR_EL2(value) HW_CPU_SET_SYSREG(sctlr_el2, value)
|
||||
|
||||
#define HW_CPU_GET_SCTLR_EL1(value) HW_CPU_GET_SYSREG(sctlr_el1, value)
|
||||
#define HW_CPU_SET_SCTLR_EL1(value) HW_CPU_SET_SYSREG(sctlr_el1, value)
|
||||
|
||||
/* https://developer.arm.com/docs/ddi0488/h/system-control/aarch64-register-descriptions/system-control-register-el3 */
|
||||
struct SctlrEl3 {
|
||||
using M = util::BitPack64::Field< 0, 1>;
|
||||
using A = util::BitPack64::Field< 1, 1>;
|
||||
using C = util::BitPack64::Field< 2, 1>;
|
||||
using Sa = util::BitPack64::Field< 3, 1>;
|
||||
using I = util::BitPack64::Field<12, 1>;
|
||||
using Wxn = util::BitPack64::Field<19, 1>;
|
||||
using Ee = util::BitPack64::Field<25, 1>;
|
||||
|
||||
static constexpr u64 Res1 = 0x30C50830;
|
||||
};
|
||||
|
||||
/* https://static.docs.arm.com/ddi0487/fb/DDI0487F_b_armv8_arm.pdf */
|
||||
struct SctlrEl2 {
|
||||
using M = util::BitPack64::Field< 0, 1>;
|
||||
using A = util::BitPack64::Field< 1, 1>;
|
||||
using C = util::BitPack64::Field< 2, 1>;
|
||||
using Sa = util::BitPack64::Field< 3, 1>;
|
||||
using I = util::BitPack64::Field<12, 1>;
|
||||
using Wxn = util::BitPack64::Field<19, 1>;
|
||||
using Ee = util::BitPack64::Field<25, 1>;
|
||||
|
||||
static constexpr u64 Res1 = 0x30C50830;
|
||||
};
|
||||
|
||||
/* https://developer.arm.com/docs/ddi0488/h/system-control/aarch64-register-descriptions/system-control-register-el1 */
|
||||
struct SctlrEl1 {
|
||||
using M = util::BitPack64::Field< 0, 1>;
|
||||
using A = util::BitPack64::Field< 1, 1>;
|
||||
using C = util::BitPack64::Field< 2, 1>;
|
||||
using Sa = util::BitPack64::Field< 3, 1>;
|
||||
using Sa0 = util::BitPack64::Field< 4, 1>;
|
||||
using Cp15BEn = util::BitPack64::Field< 5, 1>;
|
||||
using Thee = util::BitPack64::Field< 6, 1>;
|
||||
using Itd = util::BitPack64::Field< 7, 1>;
|
||||
using Sed = util::BitPack64::Field< 8, 1>;
|
||||
using Uma = util::BitPack64::Field< 9, 1>;
|
||||
using I = util::BitPack64::Field<12, 1>;
|
||||
using Dze = util::BitPack64::Field<14, 1>;
|
||||
using Uct = util::BitPack64::Field<15, 1>;
|
||||
using Ntwi = util::BitPack64::Field<16, 1>;
|
||||
using Ntwe = util::BitPack64::Field<18, 1>;
|
||||
using Wxn = util::BitPack64::Field<19, 1>;
|
||||
using E0e = util::BitPack64::Field<24, 1>;
|
||||
using Ee = util::BitPack64::Field<25, 1>;
|
||||
using Uci = util::BitPack64::Field<26, 1>;
|
||||
|
||||
static constexpr u64 Res1 = 0x30D00800;
|
||||
};
|
||||
|
||||
/* http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0488c/BABGIHHJ.html */
|
||||
struct ScrEl3 {
|
||||
using Ns = util::BitPack32::Field< 0, 1>;
|
||||
using Irq = util::BitPack32::Field< 1, 1>;
|
||||
using Fiq = util::BitPack32::Field< 2, 1>;
|
||||
using Ea = util::BitPack32::Field< 3, 1>;
|
||||
using Fw = util::BitPack32::Field< 4, 1>;
|
||||
using Aw = util::BitPack32::Field< 5, 1>;
|
||||
using Net = util::BitPack32::Field< 6, 1>;
|
||||
using Smd = util::BitPack32::Field< 7, 1>;
|
||||
using Hce = util::BitPack32::Field< 8, 1>;
|
||||
using Sif = util::BitPack32::Field< 9, 1>;
|
||||
using RwCortexA53 = util::BitPack32::Field<10, 1>;
|
||||
using StCortexA53 = util::BitPack32::Field<11, 1>;
|
||||
using Twi = util::BitPack32::Field<12, 1>;
|
||||
using Twe = util::BitPack32::Field<13, 1>;
|
||||
};
|
||||
|
||||
/* http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ddi0488c/CIHDEBIG.html */
|
||||
struct CptrEl3 {
|
||||
using Tfp = util::BitPack32::Field<10, 1>;
|
||||
using Tta = util::BitPack32::Field<20, 1>;
|
||||
using Tcpac = util::BitPack32::Field<31, 1>;
|
||||
};
|
||||
|
||||
/* https://developer.arm.com/docs/ddi0488/h/system-control/aarch64-register-descriptions/translation-control-register-el3 */
|
||||
struct TcrEl3 {
|
||||
using T0sz = util::BitPack32::Field< 0, 6>;
|
||||
using Irgn0 = util::BitPack32::Field< 8, 2>;
|
||||
using Orgn0 = util::BitPack32::Field<10, 2>;
|
||||
using Sh0 = util::BitPack32::Field<12, 2>;
|
||||
using Tg0 = util::BitPack32::Field<14, 2>;
|
||||
using Ps = util::BitPack32::Field<16, 3>;
|
||||
using Tbi = util::BitPack32::Field<20, 1>;
|
||||
|
||||
static constexpr u32 Res1 = 0x80800000;
|
||||
};
|
||||
|
||||
struct ClidrEl1 {
|
||||
using Ctype1 = util::BitPack32::Field< 0, 3>;
|
||||
using Ctype2 = util::BitPack32::Field< 3, 3>;
|
||||
using Ctype3 = util::BitPack32::Field< 6, 3>;
|
||||
using Louis = util::BitPack32::Field<21, 3>;
|
||||
using Loc = util::BitPack32::Field<24, 3>;
|
||||
using Louu = util::BitPack32::Field<27, 3>;
|
||||
};
|
||||
|
||||
struct CcsidrEl1 {
|
||||
using LineSize = util::BitPack32::Field< 0, 3>;
|
||||
using Associativity = util::BitPack32::Field< 3, 10>;
|
||||
using NumSets = util::BitPack32::Field<13, 15>;
|
||||
using Wa = util::BitPack32::Field<28, 1>;
|
||||
using Ra = util::BitPack32::Field<29, 1>;
|
||||
using Wb = util::BitPack32::Field<30, 1>;
|
||||
using Wt = util::BitPack32::Field<31, 1>;
|
||||
};
|
||||
|
||||
struct CsselrEl1 {
|
||||
using InD = util::BitPack32::Field<0, 1>;
|
||||
using Level = util::BitPack32::Field<1, 3>;
|
||||
};
|
||||
|
||||
/* https://developer.arm.com/docs/ddi0488/h/system-control/aarch64-register-descriptions/cpu-auxiliary-control-register-el1 */
|
||||
struct CpuactlrEl1CortexA57 {
|
||||
/* TODO: Other bits */
|
||||
using NonCacheableStreamingEnhancement = util::BitPack64::Field<24, 1>;
|
||||
/* TODO: Other bits */
|
||||
using DisableLoadPassDmb = util::BitPack64::Field<59, 1>;
|
||||
using ForceProcessorRcgEnablesActive = util::BitPack64::Field<63, 1>;
|
||||
};
|
||||
|
||||
/* https://developer.arm.com/docs/ddi0488/h/system-control/aarch64-register-descriptions/cpu-extended-control-register-el1 */
|
||||
struct CpuectlrEl1CortexA57 {
|
||||
using ProcessorDynamicRetentionControl = util::BitPack64::Field< 0, 2>;
|
||||
using Smpen = util::BitPack64::Field< 6, 1>;
|
||||
using L2LoadStoreDataPrefetchDistance = util::BitPack64::Field<32, 2>;
|
||||
using L2InstructionFetchPrefetchDistance = util::BitPack64::Field<35, 2>;
|
||||
using DisableTableWalkDescriptorAccessPrefetch = util::BitPack64::Field<38, 1>;
|
||||
};
|
||||
|
||||
/* https://developer.arm.com/docs/ddi0595/b/aarch64-system-registers/dbgauthstatus_el1 */
|
||||
struct DbgAuthStatusEl1 {
|
||||
using Nsid = util::BitPack32::Field<0, 2>;
|
||||
using Nsnid = util::BitPack32::Field<2, 2>;
|
||||
using Sid = util::BitPack32::Field<4, 2>;
|
||||
using Snid = util::BitPack32::Field<6, 2>;
|
||||
};
|
||||
|
||||
/* https://developer.arm.com/docs/ddi0595/b/aarch64-system-registers/cnthctl_el2 */
|
||||
struct CnthctlEl2 {
|
||||
using El1PctEn = util::BitPack32::Field<0, 1>;
|
||||
using El1PcEn = util::BitPack32::Field<1, 1>;
|
||||
using EvntEn = util::BitPack32::Field<2, 1>;
|
||||
using EvntDir = util::BitPack32::Field<3, 1>;
|
||||
using EvntI = util::BitPack32::Field<4, 4>;
|
||||
};
|
||||
|
||||
/* https://developer.arm.com/docs/ddi0488/h/system-control/aarch64-register-descriptions/auxiliary-control-register-el3 */
|
||||
struct ActlrCortexA57 {
|
||||
using Cpuactlr = util::BitPack32::Field<0, 1>;
|
||||
using Cpuectlr = util::BitPack32::Field<1, 1>;
|
||||
using L2ctlr = util::BitPack32::Field<4, 1>;
|
||||
using L2ectlr = util::BitPack32::Field<5, 1>;
|
||||
using L2actlr = util::BitPack32::Field<6, 1>;
|
||||
};
|
||||
|
||||
/* https://developer.arm.com/docs/ddi0488/h/system-control/aarch64-register-descriptions/hypervisor-configuration-register-el2 */
|
||||
struct HcrEl2 {
|
||||
using Rw = util::BitPack64::Field<31, 1>;
|
||||
};
|
||||
|
||||
struct EsrEl3 {
|
||||
using Iss = util::BitPack32::Field< 0, 25>;
|
||||
using Il = util::BitPack32::Field<25, 1>;
|
||||
using Ec = util::BitPack32::Field<26, 6>;
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::i2c {
|
||||
|
||||
enum Port {
|
||||
Port_1 = 0,
|
||||
/* TODO: Support other ports? */
|
||||
Port_5 = 4,
|
||||
|
||||
Port_Count = 5,
|
||||
};
|
||||
|
||||
void SetRegisterAddress(Port port, uintptr_t address);
|
||||
|
||||
void Initialize(Port port);
|
||||
|
||||
bool Query(void *dst, size_t dst_size, Port port, int address, int r);
|
||||
bool Send(Port port, int address, int r, const void *src, size_t src_size);
|
||||
|
||||
inline u8 QueryByte(Port port, int address, int r) {
|
||||
u8 byte;
|
||||
Query(std::addressof(byte), sizeof(byte), port, address, r);
|
||||
return byte;
|
||||
}
|
||||
|
||||
inline void SendByte(Port port, int address, int r, u8 byte) {
|
||||
Send(port, address, r, std::addressof(byte), sizeof(byte));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,48 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::log {
|
||||
|
||||
#if defined(AMS_BUILD_FOR_AUDITING) || defined(AMS_BUILD_FOR_DEBUGGING)
|
||||
#define AMS_IMPL_ENABLE_LOG
|
||||
#endif
|
||||
|
||||
#if defined(AMS_IMPL_ENABLE_LOG)
|
||||
#define AMS_LOG(...) ::ams::log::Printf(__VA_ARGS__)
|
||||
#define AMS_VLOG(...) ::ams::log::VPrintf(__VA_ARGS__)
|
||||
#define AMS_DUMP(...) ::ams::log::Dump(__VA_ARGS__)
|
||||
#define AMS_LOG_FLUSH() ::ams::log::Flush()
|
||||
#else
|
||||
#define AMS_LOG(...) static_cast<void>(0)
|
||||
#define AMS_VLOG(...) static_cast<void>(0)
|
||||
#define AMS_DUMP(...) static_cast<void>(0)
|
||||
#define AMS_LOG_FLUSH() static_cast<void>(0)
|
||||
#endif
|
||||
|
||||
void Initialize();
|
||||
void Initialize(uart::Port port, u32 baud_rate, u32 flags);
|
||||
void Finalize();
|
||||
|
||||
void Printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));
|
||||
void VPrintf(const char *fmt, ::std::va_list vl);
|
||||
void Dump(const void *src, size_t size);
|
||||
|
||||
void SendText(const void *text, size_t size);
|
||||
void Flush();
|
||||
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/mmu/mmu_api.hpp>
|
||||
@@ -1,43 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::mmu::arch::arm {
|
||||
|
||||
/* NOTE: mmu is not supported by libexosphere-on-arm. */
|
||||
/* However, we want the memory layout to be parseable, so we will include some arm64 mmu definitions. */
|
||||
constexpr inline u64 L1EntryShift = 30;
|
||||
constexpr inline u64 L2EntryShift = 21;
|
||||
constexpr inline u64 L3EntryShift = 12;
|
||||
|
||||
constexpr inline u64 L1EntrySize = 1_GB;
|
||||
constexpr inline u64 L2EntrySize = 2_MB;
|
||||
constexpr inline u64 L3EntrySize = 4_KB;
|
||||
|
||||
constexpr inline u64 PageSize = L3EntrySize;
|
||||
|
||||
constexpr inline u64 L1EntryMask = ((static_cast<u64>(1) << (48 - L1EntryShift)) - 1) << L1EntryShift;
|
||||
constexpr inline u64 L2EntryMask = ((static_cast<u64>(1) << (48 - L2EntryShift)) - 1) << L2EntryShift;
|
||||
constexpr inline u64 L3EntryMask = ((static_cast<u64>(1) << (48 - L3EntryShift)) - 1) << L3EntryShift;
|
||||
|
||||
constexpr inline u64 TableEntryMask = L3EntryMask;
|
||||
|
||||
static_assert(L1EntryMask == 0x0000FFFFC0000000ul);
|
||||
static_assert(L2EntryMask == 0x0000FFFFFFE00000ul);
|
||||
static_assert(L3EntryMask == 0x0000FFFFFFFFF000ul);
|
||||
|
||||
}
|
||||
@@ -1,286 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::mmu::arch::arm64 {
|
||||
|
||||
enum PageTableTableAttribute : u64 {
|
||||
PageTableTableAttribute_None = (0ul << 0),
|
||||
PageTableTableAttribute_PrivilegedExecuteNever = (1ul << 59),
|
||||
PageTableTableAttribute_ExecuteNever = (1ul << 60),
|
||||
PageTableTableAttribute_NonSecure = (1ul << 63),
|
||||
|
||||
PageTableTableAttributes_El3SecureCode = PageTableTableAttribute_None,
|
||||
PageTableTableAttributes_El3SecureData = PageTableTableAttribute_ExecuteNever,
|
||||
PageTableTableAttributes_El3NonSecureCode = PageTableTableAttributes_El3SecureCode | PageTableTableAttribute_NonSecure,
|
||||
PageTableTableAttributes_El3NonSecureData = PageTableTableAttributes_El3SecureData | PageTableTableAttribute_NonSecure,
|
||||
};
|
||||
|
||||
enum PageTableMappingAttribute : u64{
|
||||
/* Security. */
|
||||
PageTableMappingAttribute_NonSecure = (1ul << 5),
|
||||
|
||||
/* El1 Access. */
|
||||
PageTableMappingAttribute_El1NotAllowed = (0ul << 6),
|
||||
PageTableMappingAttribute_El1Allowed = (1ul << 6),
|
||||
|
||||
/* RW Permission. */
|
||||
PageTableMappingAttribute_PermissionReadWrite = (0ul << 7),
|
||||
PageTableMappingAttribute_PermissionReadOnly = (1ul << 7),
|
||||
|
||||
/* Shareability. */
|
||||
PageTableMappingAttribute_ShareabilityNonShareable = (0ul << 8),
|
||||
PageTableMappingAttribute_ShareabiltiyOuterShareable = (2ul << 8),
|
||||
PageTableMappingAttribute_ShareabilityInnerShareable = (3ul << 8),
|
||||
|
||||
/* Access flag. */
|
||||
PageTableMappingAttribute_AccessFlagNotAccessed = (0ul << 10),
|
||||
PageTableMappingAttribute_AccessFlagAccessed = (1ul << 10),
|
||||
|
||||
/* Global. */
|
||||
PageTableMappingAttribute_Global = (0ul << 11),
|
||||
PageTableMappingAttribute_NonGlobal = (1ul << 11),
|
||||
|
||||
/* Contiguous */
|
||||
PageTableMappingAttribute_NonContiguous = (0ul << 52),
|
||||
PageTableMappingAttribute_Contiguous = (1ul << 52),
|
||||
|
||||
/* Privileged Execute Never */
|
||||
PageTableMappingAttribute_PrivilegedExecuteNever = (1ul << 53),
|
||||
|
||||
/* Execute Never */
|
||||
PageTableMappingAttribute_ExecuteNever = (1ul << 54),
|
||||
|
||||
|
||||
/* Useful definitions. */
|
||||
PageTableMappingAttributes_El3SecureRwCode = (
|
||||
PageTableMappingAttribute_PermissionReadWrite |
|
||||
PageTableMappingAttribute_ShareabilityInnerShareable
|
||||
),
|
||||
|
||||
PageTableMappingAttributes_El3SecureRoCode = (
|
||||
PageTableMappingAttribute_PermissionReadOnly |
|
||||
PageTableMappingAttribute_ShareabilityInnerShareable
|
||||
),
|
||||
|
||||
PageTableMappingAttributes_El3SecureRoData = (
|
||||
PageTableMappingAttribute_PermissionReadOnly |
|
||||
PageTableMappingAttribute_ShareabilityInnerShareable |
|
||||
PageTableMappingAttribute_ExecuteNever
|
||||
),
|
||||
|
||||
PageTableMappingAttributes_El3SecureRwData = (
|
||||
PageTableMappingAttribute_PermissionReadWrite |
|
||||
PageTableMappingAttribute_ShareabilityInnerShareable |
|
||||
PageTableMappingAttribute_ExecuteNever
|
||||
),
|
||||
|
||||
PageTableMappingAttributes_El3NonSecureRwCode = PageTableMappingAttributes_El3SecureRwCode | PageTableMappingAttribute_NonSecure,
|
||||
PageTableMappingAttributes_El3NonSecureRoCode = PageTableMappingAttributes_El3SecureRoCode | PageTableMappingAttribute_NonSecure,
|
||||
PageTableMappingAttributes_El3NonSecureRoData = PageTableMappingAttributes_El3SecureRoData | PageTableMappingAttribute_NonSecure,
|
||||
PageTableMappingAttributes_El3NonSecureRwData = PageTableMappingAttributes_El3SecureRwData | PageTableMappingAttribute_NonSecure,
|
||||
|
||||
|
||||
PageTableMappingAttributes_El3SecureDevice = PageTableMappingAttributes_El3SecureRwData,
|
||||
PageTableMappingAttributes_El3NonSecureDevice = PageTableMappingAttributes_El3NonSecureRwData,
|
||||
};
|
||||
|
||||
enum MemoryRegionAttribute : u64 {
|
||||
MemoryRegionAttribute_Device_nGnRnE = (0ul << 2),
|
||||
MemoryRegionAttribute_Device_nGnRE = (1ul << 2),
|
||||
MemoryRegionAttribute_NormalMemory = (2ul << 2),
|
||||
MemoryRegionAttribute_NormalMemoryNotCacheable = (3ul << 2),
|
||||
|
||||
MemoryRegionAttribute_NormalInnerShift = 0,
|
||||
MemoryRegionAttribute_NormalOuterShift = 4,
|
||||
|
||||
#define AMS_MRA_DEFINE_NORMAL_ATTR(__NAME__, __VAL__) \
|
||||
MemoryRegionAttribute_NormalInner##__NAME__ = (__VAL__ << MemoryRegionAttribute_NormalInnerShift), \
|
||||
MemoryRegionAttribute_NormalOuter##__NAME__ = (__VAL__ << MemoryRegionAttribute_NormalOuterShift)
|
||||
|
||||
AMS_MRA_DEFINE_NORMAL_ATTR(NonCacheable, 4),
|
||||
|
||||
AMS_MRA_DEFINE_NORMAL_ATTR(WriteAllocate, (1ul << 0)),
|
||||
AMS_MRA_DEFINE_NORMAL_ATTR(ReadAllocate, (1ul << 1)),
|
||||
|
||||
AMS_MRA_DEFINE_NORMAL_ATTR(WriteThroughTransient, (0ul << 2)),
|
||||
AMS_MRA_DEFINE_NORMAL_ATTR(WriteBackTransient, (1ul << 2)),
|
||||
AMS_MRA_DEFINE_NORMAL_ATTR(WriteThroughNonTransient, (2ul << 2)),
|
||||
AMS_MRA_DEFINE_NORMAL_ATTR(WriteBackNonTransient, (3ul << 2)),
|
||||
|
||||
#undef AMS_MRA_DEFINE_NORMAL_ATTR
|
||||
|
||||
MemoryRegionAttributes_Normal = (
|
||||
MemoryRegionAttribute_NormalInnerReadAllocate |
|
||||
MemoryRegionAttribute_NormalOuterReadAllocate |
|
||||
MemoryRegionAttribute_NormalInnerWriteAllocate |
|
||||
MemoryRegionAttribute_NormalOuterWriteAllocate |
|
||||
MemoryRegionAttribute_NormalInnerWriteBackNonTransient |
|
||||
MemoryRegionAttribute_NormalOuterWriteBackNonTransient
|
||||
),
|
||||
|
||||
MemoryRegionAttributes_Device = (
|
||||
MemoryRegionAttribute_Device_nGnRE
|
||||
),
|
||||
};
|
||||
|
||||
constexpr inline u64 MemoryRegionAttributeWidth = 8;
|
||||
|
||||
constexpr ALWAYS_INLINE PageTableMappingAttribute AddMappingAttributeIndex(PageTableMappingAttribute attr, int index) {
|
||||
return static_cast<PageTableMappingAttribute>(attr | (static_cast<typename std::underlying_type<PageTableMappingAttribute>::type>(index) << 2));
|
||||
}
|
||||
|
||||
constexpr inline u64 L1EntryShift = 30;
|
||||
constexpr inline u64 L2EntryShift = 21;
|
||||
constexpr inline u64 L3EntryShift = 12;
|
||||
|
||||
constexpr inline u64 L1EntrySize = 1_GB;
|
||||
constexpr inline u64 L2EntrySize = 2_MB;
|
||||
constexpr inline u64 L3EntrySize = 4_KB;
|
||||
|
||||
constexpr inline u64 PageSize = L3EntrySize;
|
||||
|
||||
constexpr inline u64 L1EntryMask = ((1ul << (48 - L1EntryShift)) - 1) << L1EntryShift;
|
||||
constexpr inline u64 L2EntryMask = ((1ul << (48 - L2EntryShift)) - 1) << L2EntryShift;
|
||||
constexpr inline u64 L3EntryMask = ((1ul << (48 - L3EntryShift)) - 1) << L3EntryShift;
|
||||
|
||||
constexpr inline u64 TableEntryMask = L3EntryMask;
|
||||
|
||||
static_assert(L1EntryMask == 0x0000FFFFC0000000ul);
|
||||
static_assert(L2EntryMask == 0x0000FFFFFFE00000ul);
|
||||
static_assert(L3EntryMask == 0x0000FFFFFFFFF000ul);
|
||||
|
||||
constexpr inline u64 TableEntryIndexMask = 0x1FF;
|
||||
|
||||
constexpr inline u64 EntryBlock = 0x1ul;
|
||||
constexpr inline u64 EntryPage = 0x3ul;
|
||||
|
||||
constexpr ALWAYS_INLINE u64 MakeTableEntry(u64 address, PageTableTableAttribute attr) {
|
||||
return address | static_cast<u64>(attr) | 0x3ul;
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE u64 MakeL1BlockEntry(u64 address, PageTableMappingAttribute attr) {
|
||||
return address | static_cast<u64>(attr) | static_cast<u64>(PageTableMappingAttribute_AccessFlagAccessed) | 0x1ul;
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE u64 MakeL2BlockEntry(u64 address, PageTableMappingAttribute attr) {
|
||||
return address | static_cast<u64>(attr) | static_cast<u64>(PageTableMappingAttribute_AccessFlagAccessed) | 0x1ul;
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE u64 MakeL3BlockEntry(u64 address, PageTableMappingAttribute attr) {
|
||||
return address | static_cast<u64>(attr) | static_cast<u64>(PageTableMappingAttribute_AccessFlagAccessed) | 0x3ul;
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE uintptr_t GetL2Offset(uintptr_t address) {
|
||||
return address & ((1ul << L2EntryShift) - 1);
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE u64 GetL1EntryIndex(uintptr_t address) {
|
||||
return ((address >> L1EntryShift) & TableEntryIndexMask);
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE u64 GetL2EntryIndex(uintptr_t address) {
|
||||
return ((address >> L2EntryShift) & TableEntryIndexMask);
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE u64 GetL3EntryIndex(uintptr_t address) {
|
||||
return ((address >> L3EntryShift) & TableEntryIndexMask);
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE void SetTableEntryImpl(volatile u64 *table, u64 index, u64 value) {
|
||||
/* Write the value. */
|
||||
table[index] = value;
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE void SetTableEntry(u64 *table, u64 index, u64 value) {
|
||||
/* Ensure (for constexpr validation purposes) that the entry we set is clear. */
|
||||
if (std::is_constant_evaluated()) {
|
||||
if (table[index]) {
|
||||
__builtin_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the value. */
|
||||
SetTableEntryImpl(table, index, value);
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE void SetL1TableEntry(u64 *table, uintptr_t virt_addr, uintptr_t phys_addr, PageTableTableAttribute attr) {
|
||||
SetTableEntry(table, GetL1EntryIndex(virt_addr), MakeTableEntry(phys_addr & TableEntryMask, attr));
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE void SetL2TableEntry(u64 *table, uintptr_t virt_addr, uintptr_t phys_addr, PageTableTableAttribute attr) {
|
||||
SetTableEntry(table, GetL2EntryIndex(virt_addr), MakeTableEntry(phys_addr & TableEntryMask, attr));
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE void SetL1BlockEntry(u64 *table, uintptr_t virt_addr, uintptr_t phys_addr, size_t size, PageTableMappingAttribute attr) {
|
||||
const u64 start = GetL1EntryIndex(virt_addr);
|
||||
const u64 count = (size >> L1EntryShift);
|
||||
|
||||
for (u64 i = 0; i < count; ++i) {
|
||||
SetTableEntry(table, start + i, MakeL1BlockEntry((phys_addr & L1EntryMask) + (i << L1EntryShift), attr));
|
||||
}
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE void SetL2BlockEntry(u64 *table, uintptr_t virt_addr, uintptr_t phys_addr, size_t size, PageTableMappingAttribute attr) {
|
||||
const u64 start = GetL2EntryIndex(virt_addr);
|
||||
const u64 count = (size >> L2EntryShift);
|
||||
|
||||
for (u64 i = 0; i < count; ++i) {
|
||||
SetTableEntry(table, start + i, MakeL2BlockEntry((phys_addr & L2EntryMask) + (i << L2EntryShift), attr));
|
||||
}
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE void SetL3BlockEntry(u64 *table, uintptr_t virt_addr, uintptr_t phys_addr, size_t size, PageTableMappingAttribute attr) {
|
||||
const u64 start = GetL3EntryIndex(virt_addr);
|
||||
const u64 count = (size >> L3EntryShift);
|
||||
|
||||
for (u64 i = 0; i < count; ++i) {
|
||||
SetTableEntry(table, start + i, MakeL3BlockEntry((phys_addr & L3EntryMask) + (i << L3EntryShift), attr));
|
||||
}
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE void InvalidateL1Entries(volatile u64 *table, uintptr_t virt_addr, size_t size) {
|
||||
const u64 start = GetL1EntryIndex(virt_addr);
|
||||
const u64 count = (size >> L1EntryShift);
|
||||
const u64 end = start + count;
|
||||
|
||||
for (u64 i = start; i < end; ++i) {
|
||||
table[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE void InvalidateL2Entries(volatile u64 *table, uintptr_t virt_addr, size_t size) {
|
||||
const u64 start = GetL2EntryIndex(virt_addr);
|
||||
const u64 count = (size >> L2EntryShift);
|
||||
const u64 end = start + count;
|
||||
|
||||
for (u64 i = start; i < end; ++i) {
|
||||
table[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE void InvalidateL3Entries(volatile u64 *table, uintptr_t virt_addr, size_t size) {
|
||||
const u64 start = GetL3EntryIndex(virt_addr);
|
||||
const u64 count = (size >> L3EntryShift);
|
||||
const u64 end = start + count;
|
||||
|
||||
for (u64 i = start; i < end; ++i) {
|
||||
table[i] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
#if defined(ATMOSPHERE_ARCH_ARM64)
|
||||
#include <exosphere/mmu/mmu_api.arch.arm64.hpp>
|
||||
#elif defined(ATMOSPHERE_ARCH_ARM)
|
||||
#include <exosphere/mmu/mmu_api.arch.arm.hpp>
|
||||
#else
|
||||
#error "Unknown architecture for mmu!"
|
||||
#endif
|
||||
|
||||
namespace ams::mmu {
|
||||
|
||||
#if defined(ATMOSPHERE_ARCH_ARM64)
|
||||
using namespace ams::mmu::arch::arm64;
|
||||
#elif defined(ATMOSPHERE_ARCH_ARM)
|
||||
using namespace ams::mmu::arch::arm;
|
||||
#else
|
||||
#error "Unknown architecture for mmu!"
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/fuse.hpp>
|
||||
|
||||
namespace ams::pinmux {
|
||||
|
||||
void SetRegisterAddress(uintptr_t pinmux_address, uintptr_t gpio_address);
|
||||
|
||||
void SetupFirst(fuse::HardwareType hw_type);
|
||||
|
||||
void SetupUartA();
|
||||
void SetupUartB();
|
||||
void SetupUartC();
|
||||
void SetupI2c1();
|
||||
void SetupI2c5();
|
||||
|
||||
void SetupVolumeButton();
|
||||
void SetupHomeButton();
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/pkg1/pkg1_bootloader_parameters.hpp>
|
||||
#include <exosphere/pkg1/pkg1_boot_config.hpp>
|
||||
#include <exosphere/pkg1/pkg1_error_types.hpp>
|
||||
#include <exosphere/pkg1/pkg1_key_generation.hpp>
|
||||
#include <exosphere/pkg1/pkg1_se_key_slots.hpp>
|
||||
#include <exosphere/pkg1/pkg1_api.hpp>
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::pkg1 {
|
||||
|
||||
bool IsProduction();
|
||||
bool IsProductionForVersionCheck();
|
||||
bool IsProductionForPublicKey();
|
||||
|
||||
}
|
||||
@@ -1,145 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::pkg1 {
|
||||
|
||||
enum MemorySize {
|
||||
MemorySize_4GB = 0,
|
||||
MemorySize_6GB = 1,
|
||||
MemorySize_8GB = 2,
|
||||
};
|
||||
|
||||
enum MemoryArrange {
|
||||
MemoryArrange_Normal = 1,
|
||||
MemoryArrange_AppletDev = 2,
|
||||
MemoryArrange_SystemDev = 3,
|
||||
};
|
||||
|
||||
enum MemoryMode {
|
||||
MemoryMode_SizeShift = 4,
|
||||
MemoryMode_SizeMask = 0x30,
|
||||
|
||||
MemoryMode_ArrangeMask = 0x0F,
|
||||
|
||||
MemoryMode_Auto = 0x00,
|
||||
|
||||
MemoryMode_4GB = ((MemorySize_4GB << MemoryMode_SizeShift) | (MemoryArrange_Normal)),
|
||||
MemoryMode_4GBAppletDev = ((MemorySize_4GB << MemoryMode_SizeShift) | (MemoryArrange_AppletDev)),
|
||||
MemoryMode_4GBSystemDev = ((MemorySize_4GB << MemoryMode_SizeShift) | (MemoryArrange_SystemDev)),
|
||||
|
||||
MemoryMode_6GB = ((MemorySize_6GB << MemoryMode_SizeShift) | (MemoryArrange_Normal)),
|
||||
MemoryMode_6GBAppletDev = ((MemorySize_6GB << MemoryMode_SizeShift) | (MemoryArrange_AppletDev)),
|
||||
|
||||
MemoryMode_8GB = ((MemorySize_8GB << MemoryMode_SizeShift) | (MemoryArrange_Normal)),
|
||||
};
|
||||
|
||||
constexpr ALWAYS_INLINE MemorySize GetMemorySize(MemoryMode mode) {
|
||||
return static_cast<MemorySize>(mode >> MemoryMode_SizeShift);
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE MemoryArrange GetMemoryArrange(MemoryMode mode) {
|
||||
return static_cast<MemoryArrange>(mode & MemoryMode_ArrangeMask);
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE MemoryMode MakeMemoryMode(MemorySize size, MemoryArrange arrange) {
|
||||
return static_cast<MemoryMode>((size << MemoryMode_SizeShift) | (arrange));
|
||||
}
|
||||
|
||||
struct BootConfigData {
|
||||
u32 version;
|
||||
u32 reserved_04;
|
||||
u32 reserved_08;
|
||||
u32 reserved_0C;
|
||||
u8 flags1[0x10];
|
||||
u8 flags0[0x10];
|
||||
u64 initial_tsc_value;
|
||||
u8 padding_38[0x200 - 0x38];
|
||||
|
||||
constexpr bool IsDevelopmentFunctionEnabled() const {
|
||||
return (this->flags1[0] & (1 << 1)) != 0;
|
||||
}
|
||||
|
||||
constexpr bool IsSErrorDebugEnabled() const {
|
||||
return (this->flags1[0] & (1 << 2)) != 0;
|
||||
}
|
||||
|
||||
constexpr u8 GetKernelFlags0() const {
|
||||
return this->flags0[1];
|
||||
}
|
||||
|
||||
constexpr u8 GetKernelFlags1() const {
|
||||
return this->flags1[0];
|
||||
}
|
||||
|
||||
constexpr MemoryMode GetMemoryMode() const {
|
||||
return static_cast<MemoryMode>(this->flags0[3]);
|
||||
}
|
||||
|
||||
constexpr bool IsInitialTscValueValid() const {
|
||||
return (this->flags0[4] & (1 << 0)) != 0;
|
||||
}
|
||||
|
||||
constexpr u64 GetInitialTscValue() const {
|
||||
return this->IsInitialTscValueValid() ? this->initial_tsc_value : 0;
|
||||
}
|
||||
};
|
||||
static_assert(util::is_pod<BootConfigData>::value);
|
||||
static_assert(sizeof(BootConfigData) == 0x200);
|
||||
|
||||
struct BootConfigSignedData {
|
||||
u32 version;
|
||||
u32 reserved_04;
|
||||
u8 flags;
|
||||
u8 reserved_09[0x10 - 9];
|
||||
u8 ecid[0x10];
|
||||
u8 flags1[0x10];
|
||||
u8 flags0[0x10];
|
||||
u8 padding_40[0x100 - 0x40];
|
||||
|
||||
constexpr bool IsPackage2EncryptionDisabled() const {
|
||||
return (this->flags & (1 << 0)) != 0;
|
||||
}
|
||||
|
||||
constexpr bool IsPackage2SignatureVerificationDisabled() const {
|
||||
return (this->flags & (1 << 1)) != 0;
|
||||
}
|
||||
|
||||
constexpr bool IsProgramVerificationDisabled() const {
|
||||
return (this->flags1[0] & (1 << 0)) != 0;
|
||||
}
|
||||
|
||||
constexpr void SetPackage2SignatureVerificationDisabled(bool decrypted) {
|
||||
this->flags |= decrypted ? (1 << 1) : (0 << 0);
|
||||
}
|
||||
|
||||
constexpr void SetPackage2EncryptionDisabled(bool decrypted) {
|
||||
this->flags |= decrypted ? (1 << 0) : (0 << 0);
|
||||
}
|
||||
};
|
||||
static_assert(util::is_pod<BootConfigSignedData>::value);
|
||||
static_assert(sizeof(BootConfigSignedData) == 0x100);
|
||||
|
||||
struct BootConfig {
|
||||
BootConfigData data;
|
||||
u8 signature[0x100];
|
||||
BootConfigSignedData signed_data;
|
||||
};
|
||||
static_assert(util::is_pod<BootConfig>::value);
|
||||
static_assert(sizeof(BootConfig) == 0x400);
|
||||
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::pkg1 {
|
||||
|
||||
enum BootloaderState {
|
||||
BootloaderState_Start = 0,
|
||||
BootloaderState_LoadedBootConfig = 1,
|
||||
BootloaderState_InitializedDram = 2,
|
||||
BootloaderState_LoadedPackage2 = 3,
|
||||
BootloaderState_Done = 4,
|
||||
};
|
||||
|
||||
enum SecureMonitorState {
|
||||
SecureMonitorState_Start = 0,
|
||||
SecureMonitorState_Initialized = 1,
|
||||
};
|
||||
|
||||
struct BctParameters {
|
||||
u32 bootloader_version;
|
||||
u32 bootloader_start_block;
|
||||
u32 bootloader_start_page;
|
||||
u32 bootloader_attributes;
|
||||
};
|
||||
static_assert(util::is_pod<BctParameters>::value && sizeof(BctParameters) == 0x10);
|
||||
|
||||
struct SecureMonitorParameters {
|
||||
u32 bootloader_start_time;
|
||||
u32 bootloader_end_time;
|
||||
u32 secmon_start_time;
|
||||
u32 secmon_end_time;
|
||||
BctParameters bct_params;
|
||||
u32 deprecated_boot_reason_value;
|
||||
u8 deprecated_boot_reason_state;
|
||||
u8 reserved[0xD3];
|
||||
u32 bootloader_state;
|
||||
u32 secmon_state;
|
||||
u8 reserved2[0x100];
|
||||
};
|
||||
static_assert(util::is_pod<SecureMonitorParameters>::value);
|
||||
static_assert(sizeof(SecureMonitorParameters) == 0x200);
|
||||
|
||||
static_assert(AMS_OFFSETOF(SecureMonitorParameters, bct_params) == 0x10);
|
||||
static_assert(AMS_OFFSETOF(SecureMonitorParameters, bootloader_state) == 0xF8);
|
||||
static_assert(AMS_OFFSETOF(SecureMonitorParameters, secmon_state) == 0xFC);
|
||||
|
||||
enum BootloaderAttribute {
|
||||
BootloaderAttribute_None = (0u << 0),
|
||||
BootloaderAttribute_RecoveryBoot = (1u << 0),
|
||||
|
||||
BootloaderAttribute_RestrictedSmcShift = 1,
|
||||
BootloaderAttribute_RestrictedSmcMask = (0xFu << BootloaderAttribute_RestrictedSmcShift),
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,108 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::pkg1 {
|
||||
|
||||
enum ErrorReason {
|
||||
ErrorReason_None = 0,
|
||||
ErrorReason_InvalidPackage2Signature = 1,
|
||||
ErrorReason_InvalidPackage2Meta = 2,
|
||||
ErrorReason_InvalidPackage2Version = 3,
|
||||
ErrorReason_InvalidPackage2Payload = 4,
|
||||
ErrorReason_UnknownSmc = 5,
|
||||
ErrorReason_UnknownAbort = 6,
|
||||
ErrorReason_InvalidCoreContext = 7,
|
||||
ErrorReason_InvalidSecurityEngineStickyBits = 8,
|
||||
ErrorReason_UnexpectedReset = 9,
|
||||
|
||||
ErrorReason_Exception = 0x10,
|
||||
|
||||
ErrorReason_TransitionToSafeMode = 0x20,
|
||||
ErrorReason_SecureInitializerReboot = 0x21,
|
||||
|
||||
ErrorReason_SdmmcError = 0x30,
|
||||
ErrorReason_InvalidDramId = 0x31,
|
||||
ErrorReason_InvalidPackage2 = 0x32,
|
||||
ErrorReason_InvalidBct = 0x33,
|
||||
ErrorReason_InvalidGpt = 0x34,
|
||||
ErrorReason_FailedToTransitionToSafeMode = 0x35,
|
||||
ErrorReason_ActivityMonitorInterrupt = 0x36,
|
||||
|
||||
ErrorReason_KernelPanic = 0x40,
|
||||
};
|
||||
|
||||
enum ErrorColor {
|
||||
ErrorColor_Black = 0x000,
|
||||
|
||||
ErrorColor_Red = 0x00F,
|
||||
ErrorColor_Yellow = 0x0FF,
|
||||
ErrorColor_Orange = 0x07F,
|
||||
ErrorColor_Blue = 0xF00,
|
||||
ErrorColor_LightBlue = 0xFF0,
|
||||
ErrorColor_Pink = 0xF7F,
|
||||
ErrorColor_Purple = 0xF0A,
|
||||
};
|
||||
|
||||
enum ErrorInfo {
|
||||
ErrorInfo_ReasonMask = 0xFF,
|
||||
ErrorInfo_ColorShift = 20,
|
||||
|
||||
#define MAKE_ERROR_INFO(_COLOR_, _DESC_) ((static_cast<u32>(ErrorColor_##_COLOR_) << ErrorInfo_ColorShift) | (ErrorReason_##_DESC_))
|
||||
|
||||
ErrorInfo_None = MAKE_ERROR_INFO(Black, None),
|
||||
|
||||
ErrorInfo_InvalidPackage2Signature = MAKE_ERROR_INFO(Blue, InvalidPackage2Signature),
|
||||
ErrorInfo_InvalidPackage2Meta = MAKE_ERROR_INFO(Blue, InvalidPackage2Meta),
|
||||
ErrorInfo_InvalidPackage2Version = MAKE_ERROR_INFO(Blue, InvalidPackage2Version),
|
||||
ErrorInfo_InvalidPackage2Payload = MAKE_ERROR_INFO(Blue, InvalidPackage2Payload),
|
||||
|
||||
ErrorInfo_UnknownSmc = MAKE_ERROR_INFO(LightBlue, UnknownSmc),
|
||||
|
||||
ErrorInfo_UnknownAbort = MAKE_ERROR_INFO(Yellow, UnknownAbort),
|
||||
|
||||
ErrorInfo_InvalidCoreContext = MAKE_ERROR_INFO(Pink, InvalidCoreContext),
|
||||
ErrorInfo_InvalidSecurityEngineStickyBits = MAKE_ERROR_INFO(Pink, InvalidSecurityEngineStickyBits),
|
||||
ErrorInfo_UnexpectedReset = MAKE_ERROR_INFO(Pink, UnexpectedReset),
|
||||
|
||||
ErrorInfo_Exception = MAKE_ERROR_INFO(Orange, Exception),
|
||||
|
||||
ErrorInfo_TransitionToSafeMode = MAKE_ERROR_INFO(Black, TransitionToSafeMode),
|
||||
ErrorInfo_SecureInitializerReboot = MAKE_ERROR_INFO(Black, SecureInitializerReboot),
|
||||
|
||||
ErrorInfo_SdmmcError = MAKE_ERROR_INFO(Purple, SdmmcError),
|
||||
ErrorInfo_InvalidDramId = MAKE_ERROR_INFO(Purple, InvalidDramId),
|
||||
ErrorInfo_InvalidPackage2 = MAKE_ERROR_INFO(Purple, InvalidPackage2),
|
||||
ErrorInfo_InvalidBct = MAKE_ERROR_INFO(Purple, InvalidBct),
|
||||
ErrorInfo_InvalidGpt = MAKE_ERROR_INFO(Purple, InvalidGpt),
|
||||
ErrorInfo_FailedToTransitionToSafeMode = MAKE_ERROR_INFO(Purple, FailedToTransitionToSafeMode),
|
||||
ErrorInfo_ActivityMonitorInterrupt = MAKE_ERROR_INFO(Purple, ActivityMonitorInterrupt),
|
||||
|
||||
#undef MAKE_ERROR_INFO
|
||||
};
|
||||
|
||||
constexpr inline ErrorReason GetErrorReason(u32 info) {
|
||||
return static_cast<ErrorReason>(info & ErrorInfo_ReasonMask);
|
||||
}
|
||||
|
||||
constexpr inline ErrorInfo MakeKernelPanicResetInfo(u32 color) {
|
||||
return static_cast<ErrorInfo>((color << ErrorInfo_ColorShift) | (ErrorReason_KernelPanic));
|
||||
}
|
||||
|
||||
#define PKG1_SECURE_MONITOR_PMC_ERROR_SCRATCH (0x840)
|
||||
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::pkg1 {
|
||||
|
||||
enum KeyGeneration : int {
|
||||
|
||||
KeyGeneration_1_0_0 = 0x00,
|
||||
KeyGeneration_3_0_0 = 0x01,
|
||||
KeyGeneration_3_0_1 = 0x02,
|
||||
KeyGeneration_4_0_0 = 0x03,
|
||||
KeyGeneration_5_0_0 = 0x04,
|
||||
KeyGeneration_6_0_0 = 0x05,
|
||||
KeyGeneration_6_2_0 = 0x06,
|
||||
KeyGeneration_7_0_0 = 0x07,
|
||||
KeyGeneration_8_1_0 = 0x08,
|
||||
KeyGeneration_9_0_0 = 0x09,
|
||||
KeyGeneration_9_1_0 = 0x0A,
|
||||
KeyGeneration_12_1_0 = 0x0B,
|
||||
KeyGeneration_13_0_0 = 0x0C,
|
||||
KeyGeneration_14_0_0 = 0x0D,
|
||||
KeyGeneration_15_0_0 = 0x0E,
|
||||
KeyGeneration_16_0_0 = 0x0F,
|
||||
KeyGeneration_17_0_0 = 0x10,
|
||||
KeyGeneration_18_0_0 = 0x11,
|
||||
KeyGeneration_19_0_0 = 0x12,
|
||||
KeyGeneration_20_0_0 = 0x13,
|
||||
|
||||
KeyGeneration_Count,
|
||||
|
||||
KeyGeneration_Current = KeyGeneration_Count - 1,
|
||||
|
||||
KeyGeneration_Min = 0x00,
|
||||
KeyGeneration_Max = 0x20,
|
||||
};
|
||||
static_assert(KeyGeneration_Count <= KeyGeneration_Max);
|
||||
|
||||
constexpr inline const int OldMasterKeyCount = KeyGeneration_Count - 1;
|
||||
constexpr inline const int OldDeviceMasterKeyCount = KeyGeneration_Count - KeyGeneration_4_0_0;
|
||||
|
||||
constexpr bool IsValidDeviceUniqueKeyGeneration(int generation) {
|
||||
return generation == KeyGeneration_1_0_0 || (KeyGeneration_4_0_0 <= generation && generation <= KeyGeneration_Current);
|
||||
}
|
||||
|
||||
constexpr bool IsValidKeyGeneration(int generation) {
|
||||
return KeyGeneration_Min <= generation && generation <= KeyGeneration_Current;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::pkg1 {
|
||||
|
||||
enum AesKeySlot {
|
||||
AesKeySlot_UserStart = 0,
|
||||
|
||||
AesKeySlot_TzramSaveKek = 2,
|
||||
AesKeySlot_TzramSaveKey = 3,
|
||||
|
||||
AesKeySlot_UserLast = 5,
|
||||
AesKeySlot_UserEnd = AesKeySlot_UserLast + 1,
|
||||
|
||||
AesKeySlot_SecmonStart = 8,
|
||||
|
||||
AesKeySlot_Temporary = 8,
|
||||
AesKeySlot_Smc = 9,
|
||||
AesKeySlot_RandomForUserWrap = 10,
|
||||
AesKeySlot_RandomForKeyStorageWrap = 11,
|
||||
AesKeySlot_DeviceMaster = 12,
|
||||
AesKeySlot_Master = 13,
|
||||
AesKeySlot_Device = 15,
|
||||
|
||||
AesKeySlot_Count = 16,
|
||||
AesKeySlot_SecmonEnd = AesKeySlot_Count,
|
||||
|
||||
/* Used only during boot. */
|
||||
AesKeySlot_TsecRootDev = 11,
|
||||
AesKeySlot_Tsec = 12,
|
||||
AesKeySlot_TsecRoot = 13,
|
||||
AesKeySlot_SecureBoot = 14,
|
||||
AesKeySlot_SecureStorage = 15,
|
||||
|
||||
AesKeySlot_DeviceMasterKeySourceKekErista = 10,
|
||||
AesKeySlot_MasterKek = 13,
|
||||
AesKeySlot_DeviceMasterKeySourceKekMariko = 14,
|
||||
|
||||
/* Mariko only keyslots, used during boot. */
|
||||
AesKeySlot_MarikoKek = 12,
|
||||
AesKeySlot_MarikoBek = 13,
|
||||
|
||||
/* Bootloader keyslots, for fusee only. */
|
||||
AesKeySlot_BootloaderSystem0 = 2,
|
||||
AesKeySlot_BootloaderSystem1 = 3,
|
||||
AesKeySlot_BootloaderDeviceMaster = 6,
|
||||
AesKeySlot_BootloaderMaster = 7,
|
||||
AesKeySlot_BootloaderTemporary = 8,
|
||||
};
|
||||
|
||||
enum RsaKeySlot {
|
||||
RsaKeySlot_Temporary = 0,
|
||||
RsaKeySlot_PrivateKey = 1,
|
||||
};
|
||||
|
||||
constexpr bool IsUserAesKeySlot(int slot) {
|
||||
return AesKeySlot_UserStart <= slot && slot < AesKeySlot_UserEnd;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::pkg2 {
|
||||
|
||||
constexpr inline size_t Package2SizeMax = 8_MB - 16_KB;
|
||||
constexpr inline size_t PayloadAlignment = 4;
|
||||
|
||||
constexpr inline int PayloadCount = 3;
|
||||
|
||||
constexpr inline int MinimumValidDataVersion = 0; /* We allow older package2 to load; this value is currently 0x18 in Nintendo's code. */
|
||||
constexpr inline int CurrentBootloaderVersion = 0x17;
|
||||
|
||||
struct Package2Meta {
|
||||
using Magic = util::FourCC<'P','K','2','1'>;
|
||||
|
||||
u32 package2_size;
|
||||
u8 key_generation;
|
||||
u8 header_iv_remainder[11];
|
||||
u8 payload_ivs[PayloadCount][0x10];
|
||||
u8 padding_40[0x10];
|
||||
u8 magic[4];
|
||||
u32 entrypoint;
|
||||
u8 padding_58[4];
|
||||
u8 package2_version;
|
||||
u8 bootloader_version;
|
||||
u8 padding_5E[2];
|
||||
u32 payload_sizes[PayloadCount];
|
||||
u8 padding_6C[4];
|
||||
u32 payload_offsets[PayloadCount];
|
||||
u8 padding_7C[4];
|
||||
u8 payload_hashes[PayloadCount][crypto::Sha256Generator::HashSize];
|
||||
u8 padding_E0[0x20];
|
||||
|
||||
private:
|
||||
static ALWAYS_INLINE u32 ReadWord(const void *ptr, int offset) {
|
||||
return util::LoadLittleEndian(reinterpret_cast<const u32 *>(reinterpret_cast<uintptr_t>(ptr) + offset));
|
||||
}
|
||||
public:
|
||||
ALWAYS_INLINE u8 GetKeyGeneration() const {
|
||||
return static_cast<u8>(std::max<s32>(0, static_cast<s32>(this->key_generation ^ this->header_iv_remainder[1] ^ this->header_iv_remainder[2]) - 1));
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u32 GetSize() const {
|
||||
return this->package2_size ^ ReadWord(this->header_iv_remainder, 3) ^ ReadWord(this->header_iv_remainder, 7);
|
||||
}
|
||||
};
|
||||
static_assert(util::is_pod<Package2Meta>::value);
|
||||
static_assert(sizeof(Package2Meta) == 0x100);
|
||||
|
||||
struct Package2Header {
|
||||
u8 signature[0x100];
|
||||
Package2Meta meta;
|
||||
};
|
||||
static_assert(util::is_pod<Package2Header>::value);
|
||||
static_assert(sizeof(Package2Header) == 0x200);
|
||||
|
||||
struct StorageLayout {
|
||||
u8 boot_config[16_KB];
|
||||
Package2Header package2_header;
|
||||
u8 data[Package2SizeMax - sizeof(Package2Header)];
|
||||
};
|
||||
static_assert(util::is_pod<StorageLayout>::value);
|
||||
static_assert(sizeof(StorageLayout) == 8_MB);
|
||||
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::pmc {
|
||||
|
||||
enum SecureRegister {
|
||||
SecureRegister_Other = (1 << 0),
|
||||
SecureRegister_DramParameters = (1 << 1),
|
||||
SecureRegister_ResetVector = (1 << 2),
|
||||
SecureRegister_Carveout = (1 << 3),
|
||||
SecureRegister_CmacWrite = (1 << 4),
|
||||
SecureRegister_CmacRead = (1 << 5),
|
||||
SecureRegister_KeySourceWrite = (1 << 6),
|
||||
SecureRegister_KeySourceRead = (1 << 7),
|
||||
SecureRegister_Srk = (1 << 8),
|
||||
|
||||
SecureRegister_CmacReadWrite = SecureRegister_CmacRead | SecureRegister_CmacWrite,
|
||||
SecureRegister_KeySourceReadWrite = SecureRegister_KeySourceRead | SecureRegister_KeySourceWrite,
|
||||
};
|
||||
|
||||
void SetRegisterAddress(uintptr_t address);
|
||||
|
||||
void InitializeRandomScratch();
|
||||
void EnableWakeEventDetection();
|
||||
void ConfigureForSc7Entry();
|
||||
|
||||
void LockSecureRegister(SecureRegister reg);
|
||||
|
||||
enum class LockState {
|
||||
Locked = 0,
|
||||
NotLocked = 1,
|
||||
PartiallyLocked = 2,
|
||||
};
|
||||
|
||||
LockState GetSecureRegisterLockState(SecureRegister reg);
|
||||
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::pmic {
|
||||
|
||||
enum Regulator {
|
||||
/* Erista regulators. */
|
||||
Regulator_Erista_Max77621 = 0, /* Device code 0x3A000001 */
|
||||
|
||||
/* Mariko regulators. */
|
||||
Regulator_Mariko_Max77812_A = 1, /* Device code 0x3A000002 */
|
||||
Regulator_Mariko_Max77812_B = 2, /* Device code 0x3A000006 */
|
||||
};
|
||||
|
||||
void SetEnBit(Regulator regulator);
|
||||
void EnableVddCpu(Regulator regulator);
|
||||
void DisableVddCpu(Regulator regulator);
|
||||
void EnableSleep();
|
||||
void PowerOff();
|
||||
void ShutdownSystem(bool reboot);
|
||||
bool IsAcOk();
|
||||
bool IsPowerButtonPressed();
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/pmic.hpp>
|
||||
#include <exosphere/fuse.hpp>
|
||||
|
||||
namespace ams::pmic {
|
||||
|
||||
void SetSystemSetting(fuse::SocType soc_type);
|
||||
void EnableVddCore(fuse::SocType soc_type);
|
||||
void EnableLdo8();
|
||||
|
||||
void EnableVddMemory(fuse::SocType soc_type);
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::rtc {
|
||||
|
||||
void StopAlarm();
|
||||
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
#include <exosphere/se/se_common.hpp>
|
||||
#include <exosphere/se/se_management.hpp>
|
||||
#include <exosphere/se/se_aes.hpp>
|
||||
#include <exosphere/se/se_hash.hpp>
|
||||
#include <exosphere/se/se_oaep.hpp>
|
||||
#include <exosphere/se/se_rsa.hpp>
|
||||
#include <exosphere/se/se_rng.hpp>
|
||||
#include <exosphere/se/se_suspend.hpp>
|
||||
@@ -1,56 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/se/se_common.hpp>
|
||||
|
||||
namespace ams::se {
|
||||
|
||||
constexpr inline int AesKeySlotCount = 16;
|
||||
constexpr inline size_t AesBlockSize = crypto::AesEncryptor128::BlockSize;
|
||||
|
||||
void ClearAesKeySlot(int slot);
|
||||
void ClearAesKeyIv(int slot);
|
||||
void LockAesKeySlot(int slot, u32 flags);
|
||||
|
||||
/* NOTE: This is Nintendo's API, but if we actually want to use SE2 we should use a different one. */
|
||||
void ClearAesKeySlot2(int slot);
|
||||
|
||||
void SetAesKey(int slot, const void *key, size_t key_size);
|
||||
|
||||
void SetEncryptedAesKey128(int dst_slot, int kek_slot, const void *key, size_t key_size);
|
||||
void SetEncryptedAesKey256(int dst_slot, int kek_slot, const void *key, size_t key_size);
|
||||
|
||||
void EncryptAes128(void *dst, size_t dst_size, int slot, const void *src, size_t src_size);
|
||||
void DecryptAes128(void *dst, size_t dst_size, int slot, const void *src, size_t src_size);
|
||||
|
||||
void ComputeAes128Ctr(void *dst, size_t dst_size, int slot, const void *src, size_t src_size, const void *iv, size_t iv_size);
|
||||
|
||||
void ComputeAes128Cmac(void *dst, size_t dst_size, int slot, const void *src, size_t src_size);
|
||||
void ComputeAes256Cmac(void *dst, size_t dst_size, int slot, const void *src, size_t src_size);
|
||||
|
||||
void EncryptAes128Cbc(void *dst, size_t dst_size, int slot, const void *src, size_t src_size, const void *iv, size_t iv_size);
|
||||
void EncryptAes256Cbc(void *dst, size_t dst_size, int slot, const void *src, size_t src_size, const void *iv, size_t iv_size);
|
||||
void DecryptAes128Cbc(void *dst, size_t dst_size, int slot, const void *src, size_t src_size, const void *iv, size_t iv_size);
|
||||
void DecryptAes256Cbc(void *dst, size_t dst_size, int slot, const void *src, size_t src_size, const void *iv, size_t iv_size);
|
||||
|
||||
void DecryptAes128Xts(void *dst, size_t dst_size, int slot_enc, int slot_tweak, const void *src, size_t src_size, size_t sector);
|
||||
|
||||
void EncryptAes128CbcAsync(u32 out_ll_address, int slot, u32 in_ll_address, u32 size, const void *iv, size_t iv_size, DoneHandler handler);
|
||||
void DecryptAes128CbcAsync(u32 out_ll_address, int slot, u32 in_ll_address, u32 size, const void *iv, size_t iv_size, DoneHandler handler);
|
||||
void ComputeAes128CtrAsync(u32 out_ll_address, int slot, u32 in_ll_address, u32 size, const void *iv, size_t iv_size, DoneHandler handler);
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::secmon {
|
||||
|
||||
u8 *GetSecurityEngineEphemeralWorkBlock();
|
||||
|
||||
}
|
||||
|
||||
namespace ams::se {
|
||||
|
||||
using DoneHandler = void(*)();
|
||||
|
||||
enum KeySlotLockFlags {
|
||||
KeySlotLockFlags_None = 0,
|
||||
KeySlotLockFlags_KeyRead = (1u << 0),
|
||||
KeySlotLockFlags_KeyWrite = (1u << 1),
|
||||
KeySlotLockFlags_OriginalIvRead = (1u << 2),
|
||||
KeySlotLockFlags_OriginalIvWrite = (1u << 3),
|
||||
KeySlotLockFlags_UpdatedIvRead = (1u << 4),
|
||||
KeySlotLockFlags_UpdatedIvWrite = (1u << 5),
|
||||
KeySlotLockFlags_KeyUse = (1u << 6),
|
||||
KeySlotLockFlags_DstKeyTableOnly = (1u << 7),
|
||||
KeySlotLockFlags_PerKey = (1u << 8),
|
||||
|
||||
KeySlotLockFlags_AllReadLock = (KeySlotLockFlags_KeyRead | KeySlotLockFlags_OriginalIvRead | KeySlotLockFlags_UpdatedIvRead),
|
||||
KeySlotLockFlags_AllLockKek = 0x1FF,
|
||||
KeySlotLockFlags_AllLockKey = (KeySlotLockFlags_AllLockKek & ~KeySlotLockFlags_DstKeyTableOnly),
|
||||
|
||||
KeySlotLockFlags_EristaMask = 0x7F,
|
||||
KeySlotLockFlags_MarikoMask = 0xFF,
|
||||
};
|
||||
|
||||
ALWAYS_INLINE u8 *GetEphemeralWorkBlock() {
|
||||
return ::ams::secmon::GetSecurityEngineEphemeralWorkBlock();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::se {
|
||||
|
||||
constexpr inline int Sha256HashSize = crypto::Sha256Generator::HashSize;
|
||||
|
||||
union Sha256Hash {
|
||||
u8 bytes[Sha256HashSize / sizeof(u8) ];
|
||||
u32 words[Sha256HashSize / sizeof(u32)];
|
||||
};
|
||||
|
||||
void CalculateSha256(Sha256Hash *dst, const void *src, size_t src_size);
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::se {
|
||||
|
||||
void SetRegisterAddress(uintptr_t address, uintptr_t address2);
|
||||
|
||||
void Initialize();
|
||||
|
||||
void SetSecure(bool secure);
|
||||
void SetTzramSecure();
|
||||
void SetPerKeySecure();
|
||||
void SetContextSaveSecure();
|
||||
|
||||
void Lockout();
|
||||
|
||||
void HandleInterrupt();
|
||||
|
||||
void ValidateErrStatus();
|
||||
void ValidateAesOperationResult();
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::se {
|
||||
|
||||
size_t DecodeRsaOaepSha256(void *dst, size_t dst_size, void *src, size_t src_size, const void *label_digest, size_t label_digest_size);
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::se {
|
||||
|
||||
void InitializeRandom();
|
||||
|
||||
void GenerateRandomBytes(void *dst, size_t size);
|
||||
void SetRandomKey(int slot);
|
||||
|
||||
void GenerateSrk();
|
||||
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/se/se_common.hpp>
|
||||
|
||||
namespace ams::se {
|
||||
|
||||
constexpr inline int RsaKeySlotCount = 2;
|
||||
constexpr inline int RsaSize = 0x100;
|
||||
|
||||
void ClearRsaKeySlot(int slot);
|
||||
void LockRsaKeySlot(int slot, u32 flags);
|
||||
|
||||
void SetRsaKey(int slot, const void *mod, size_t mod_size, const void *exp, size_t exp_size);
|
||||
|
||||
void ModularExponentiate(void *dst, size_t dst_size, int slot, const void *src, size_t src_size);
|
||||
void ModularExponentiateAsync(int slot, const void *src, size_t src_size, DoneHandler handler);
|
||||
|
||||
void GetRsaResult(void *dst, size_t dst_size);
|
||||
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/se/se_aes.hpp>
|
||||
#include <exosphere/se/se_rsa.hpp>
|
||||
|
||||
namespace ams::se {
|
||||
|
||||
/* 256-bit AES keyslots are two 128-bit keys. */
|
||||
constexpr inline int AesKeySlotPartCount = 2;
|
||||
|
||||
/* RSA keys are both a modulus and an exponent. */
|
||||
constexpr inline int RsaKeySlotPartCount = 2;
|
||||
|
||||
constexpr inline size_t StickyBitContextSize = 2 * AesBlockSize;
|
||||
|
||||
struct Context {
|
||||
u8 random[AesBlockSize];
|
||||
u8 sticky_bits[StickyBitContextSize / AesBlockSize][AesBlockSize];
|
||||
u8 aes_key[AesKeySlotCount][AesKeySlotPartCount][AesBlockSize];
|
||||
u8 aes_oiv[AesKeySlotCount][AesBlockSize];
|
||||
u8 aes_uiv[AesKeySlotCount][AesBlockSize];
|
||||
u8 rsa_key[RsaKeySlotCount][RsaKeySlotPartCount][RsaSize / AesBlockSize][AesBlockSize];
|
||||
u8 fixed_pattern[AesBlockSize];
|
||||
};
|
||||
static_assert(sizeof(Context) == 0x840);
|
||||
static_assert(util::is_pod<Context>::value);
|
||||
|
||||
struct StickyBits {
|
||||
u8 se_security;
|
||||
u8 tzram_security;
|
||||
u16 crypto_security_perkey;
|
||||
u8 crypto_keytable_access[AesKeySlotCount];
|
||||
u8 rsa_security_perkey;
|
||||
u8 rsa_keytable_access[RsaKeySlotCount];
|
||||
};
|
||||
static_assert(util::is_pod<StickyBits>::value);
|
||||
|
||||
bool ValidateStickyBits(const StickyBits &bits);
|
||||
void SaveContext(Context *dst);
|
||||
|
||||
void ConfigureAutomaticContextSave();
|
||||
void SaveContextAutomatic();
|
||||
void SaveTzramAutomatic();
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/secmon/secmon_log.hpp>
|
||||
#include <exosphere/secmon/secmon_memory_layout.hpp>
|
||||
#include <exosphere/secmon/secmon_configuration_context.hpp>
|
||||
#include <exosphere/secmon/secmon_volatile_context.hpp>
|
||||
@@ -1,139 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/pkg1.hpp>
|
||||
#include <exosphere/se.hpp>
|
||||
#include <exosphere/secmon/secmon_monitor_context.hpp>
|
||||
|
||||
namespace ams::secmon {
|
||||
|
||||
struct ConfigurationContext {
|
||||
union {
|
||||
SecureMonitorConfiguration secmon_cfg;
|
||||
u8 _raw_exosphere_config[0x80];
|
||||
};
|
||||
union {
|
||||
EmummcConfiguration emummc_cfg;
|
||||
u8 _raw_emummc_config[0x120];
|
||||
};
|
||||
u8 sealed_device_keys[pkg1::KeyGeneration_Max][se::AesBlockSize];
|
||||
u8 sealed_master_keys[pkg1::KeyGeneration_Max][se::AesBlockSize];
|
||||
pkg1::BootConfig boot_config;
|
||||
u8 rsa_private_exponents[4][se::RsaSize];
|
||||
union {
|
||||
u8 _misc_data[0xFC0 - sizeof(_raw_exosphere_config) - sizeof(_raw_emummc_config) - sizeof(sealed_device_keys) - sizeof(sealed_master_keys) - sizeof(boot_config) - sizeof(rsa_private_exponents)];
|
||||
};
|
||||
/* u8 l1_page_table[0x40]; */
|
||||
};
|
||||
static_assert(sizeof(ConfigurationContext) == 0xFC0);
|
||||
static_assert(util::is_pod<ConfigurationContext>::value);
|
||||
|
||||
namespace impl {
|
||||
|
||||
ALWAYS_INLINE uintptr_t GetConfigurationContextAddress() {
|
||||
register uintptr_t x18 asm("x18");
|
||||
__asm__ __volatile__("" : [x18]"=r"(x18));
|
||||
return x18;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE ConfigurationContext &GetConfigurationContext() {
|
||||
return *reinterpret_cast<ConfigurationContext *>(GetConfigurationContextAddress());
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u8 *GetMasterKeyStorage(int generation) {
|
||||
return GetConfigurationContext().sealed_master_keys[generation];
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u8 *GetDeviceMasterKeyStorage(int generation) {
|
||||
return GetConfigurationContext().sealed_device_keys[generation];
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u8 *GetRsaPrivateExponentStorage(int which) {
|
||||
return GetConfigurationContext().rsa_private_exponents[which];
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void SetKeyGeneration(int generation) {
|
||||
GetConfigurationContext().secmon_cfg.key_generation = generation;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void SetTargetFirmware(ams::TargetFirmware target_firmware) {
|
||||
GetConfigurationContext().secmon_cfg.target_firmware = target_firmware;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE pkg1::BootConfig *GetBootConfigStorage() {
|
||||
return std::addressof(GetConfigurationContext().boot_config);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const ConfigurationContext &GetConfigurationContext() {
|
||||
return *reinterpret_cast<const ConfigurationContext *>(impl::GetConfigurationContextAddress());
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const SecureMonitorConfiguration &GetSecmonConfiguration() {
|
||||
return GetConfigurationContext().secmon_cfg;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const EmummcConfiguration &GetEmummcConfiguration() {
|
||||
return GetConfigurationContext().emummc_cfg;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const pkg1::BootConfig &GetBootConfig() {
|
||||
return GetConfigurationContext().boot_config;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE ams::TargetFirmware GetTargetFirmware() {
|
||||
return GetSecmonConfiguration().GetTargetFirmware();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE int GetKeyGeneration() {
|
||||
return GetSecmonConfiguration().GetKeyGeneration();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE fuse::HardwareType GetHardwareType() {
|
||||
return GetSecmonConfiguration().GetHardwareType();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE fuse::SocType GetSocType() {
|
||||
return GetSecmonConfiguration().GetSocType();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE fuse::HardwareState GetHardwareState() {
|
||||
return GetSecmonConfiguration().GetHardwareState();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u16 GetLcdVendor() {
|
||||
return GetSecmonConfiguration().GetLcdVendor();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE uart::Port GetLogPort() {
|
||||
return GetSecmonConfiguration().GetLogPort();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u8 GetLogFlags() {
|
||||
return GetSecmonConfiguration().GetLogFlags();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u32 GetLogBaudRate() {
|
||||
return GetSecmonConfiguration().GetLogBaudRate();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE bool IsProduction() {
|
||||
return GetSecmonConfiguration().IsProduction();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
#if defined(ATMOSPHERE_ARCH_ARM64)
|
||||
#include <exosphere/secmon/secmon_configuration_context.arch.arm64.hpp>
|
||||
#elif defined(ATMOSPHERE_ARCH_ARM)
|
||||
/* Nothing to include. */
|
||||
#else
|
||||
#error "Unknown architecture for secmon::ConfigurationContext.hpp"
|
||||
#endif
|
||||
@@ -1,89 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::secmon {
|
||||
|
||||
enum EmummcType : u32 {
|
||||
EmummcType_None = 0,
|
||||
EmummcType_Partition = 1,
|
||||
EmummcType_File = 2,
|
||||
};
|
||||
|
||||
enum EmummcMmc {
|
||||
EmummcMmc_Nand = 0,
|
||||
EmummcMmc_Sd = 1,
|
||||
EmummcMmc_Gc = 2,
|
||||
};
|
||||
|
||||
constexpr inline size_t EmummcFilePathLengthMax = 0x80;
|
||||
|
||||
struct EmummcFilePath {
|
||||
char str[EmummcFilePathLengthMax];
|
||||
};
|
||||
static_assert(util::is_pod<EmummcFilePath>::value);
|
||||
static_assert(sizeof(EmummcFilePath) == EmummcFilePathLengthMax);
|
||||
|
||||
struct EmummcBaseConfiguration {
|
||||
static constexpr u32 Magic = util::FourCC<'E','F','S','0'>::Code;
|
||||
|
||||
u32 magic;
|
||||
EmummcType type;
|
||||
u32 id;
|
||||
u32 fs_version;
|
||||
|
||||
constexpr bool IsValid() const {
|
||||
return this->magic == Magic;
|
||||
}
|
||||
|
||||
constexpr bool IsEmummcActive() const {
|
||||
return this->IsValid() && this->type != EmummcType_None;
|
||||
}
|
||||
};
|
||||
static_assert(util::is_pod<EmummcBaseConfiguration>::value);
|
||||
static_assert(sizeof(EmummcBaseConfiguration) == 0x10);
|
||||
|
||||
struct EmummcPartitionConfiguration {
|
||||
u64 start_sector;
|
||||
};
|
||||
static_assert(util::is_pod<EmummcPartitionConfiguration>::value);
|
||||
|
||||
struct EmummcFileConfiguration {
|
||||
EmummcFilePath path;
|
||||
};
|
||||
static_assert(util::is_pod<EmummcFileConfiguration>::value);
|
||||
|
||||
struct EmummcConfiguration {
|
||||
EmummcBaseConfiguration base_cfg;
|
||||
union {
|
||||
EmummcPartitionConfiguration partition_cfg;
|
||||
EmummcFileConfiguration file_cfg;
|
||||
};
|
||||
EmummcFilePath emu_dir_path;
|
||||
|
||||
constexpr bool IsValid() const {
|
||||
return this->base_cfg.IsValid();
|
||||
}
|
||||
|
||||
constexpr bool IsEmummcActive() const {
|
||||
return this->base_cfg.IsEmummcActive();
|
||||
}
|
||||
};
|
||||
static_assert(util::is_pod<EmummcConfiguration>::value);
|
||||
static_assert(sizeof(EmummcConfiguration) <= 0x200);
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/log.hpp>
|
||||
|
||||
#define AMS_SECMON_LOG(...) AMS_LOG(" [secmon] " __VA_ARGS__)
|
||||
@@ -1,348 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/mmu.hpp>
|
||||
|
||||
namespace ams::secmon {
|
||||
|
||||
using Address = u64;
|
||||
|
||||
struct MemoryRegion {
|
||||
private:
|
||||
Address m_start_address;
|
||||
Address m_end_address;
|
||||
public:
|
||||
consteval MemoryRegion(Address address, size_t size) : m_start_address(address), m_end_address(address + size) {
|
||||
if (m_end_address < m_start_address) {
|
||||
__builtin_unreachable();
|
||||
}
|
||||
}
|
||||
|
||||
constexpr Address GetStartAddress() const {
|
||||
return m_start_address;
|
||||
}
|
||||
|
||||
constexpr Address GetAddress() const {
|
||||
return this->GetStartAddress();
|
||||
}
|
||||
|
||||
constexpr Address GetEndAddress() const {
|
||||
return m_end_address;
|
||||
}
|
||||
|
||||
constexpr Address GetLastAddress() const {
|
||||
return m_end_address - 1;
|
||||
}
|
||||
|
||||
constexpr size_t GetSize() const {
|
||||
return m_end_address - m_start_address;
|
||||
}
|
||||
|
||||
constexpr bool Contains(Address address, size_t size) const {
|
||||
return m_start_address <= address && (address + size - 1) <= this->GetLastAddress();
|
||||
}
|
||||
|
||||
constexpr bool Contains(const MemoryRegion &rhs) const {
|
||||
return this->Contains(rhs.GetStartAddress(), rhs.GetSize());
|
||||
}
|
||||
|
||||
template<typename T = void> requires (std::is_same<T, void>::value || util::is_pod<T>::value)
|
||||
ALWAYS_INLINE T *GetPointer() const {
|
||||
return reinterpret_cast<T *>(this->GetAddress());
|
||||
}
|
||||
|
||||
template<typename T = void> requires (std::is_same<T, void>::value || util::is_pod<T>::value)
|
||||
ALWAYS_INLINE T *GetEndPointer() const {
|
||||
return reinterpret_cast<T *>(this->GetEndAddress());
|
||||
}
|
||||
};
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtual = MemoryRegion(UINT64_C(0x1F0000000), 2_MB);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysical = MemoryRegion(UINT64_C( 0x40000000), 1_GB);
|
||||
constexpr inline const MemoryRegion MemoryRegionDram = MemoryRegion(UINT64_C( 0x80000000), 2_GB);
|
||||
constexpr inline const MemoryRegion MemoryRegionDramHigh = MemoryRegion(MemoryRegionDram.GetEndAddress(), 2_GB);
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionDramForMarikoProgram = MemoryRegion(UINT64_C(0xC0000000), 1_GB);
|
||||
constexpr inline const MemoryRegion MemoryRegionDramDcFramebuffer = MemoryRegion(UINT64_C(0xC0000000), 4_MB);
|
||||
static_assert(MemoryRegionDram.Contains(MemoryRegionDramForMarikoProgram));
|
||||
static_assert(MemoryRegionDramForMarikoProgram.Contains(MemoryRegionDramDcFramebuffer));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionDramGpuCarveout = MemoryRegion(UINT64_C(0x80020000), UINT64_C(0x40000));
|
||||
static_assert(MemoryRegionDram.Contains(MemoryRegionDramGpuCarveout));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionDramDefaultKernelCarveout = MemoryRegion(UINT64_C(0x80060000), UINT64_C(0x1FFE0000));
|
||||
static_assert(MemoryRegionDram.Contains(MemoryRegionDramDefaultKernelCarveout));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionDramPackage2Payloads = MemoryRegion(MemoryRegionDram.GetAddress(), 8_MB);
|
||||
static_assert(MemoryRegionDram.Contains(MemoryRegionDramPackage2Payloads));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionDramPackage2 = MemoryRegion(UINT64_C(0xA9800000), UINT64_C(0x07FC0000));
|
||||
static_assert(MemoryRegionDram.Contains(MemoryRegionDramPackage2));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalIram = MemoryRegion(UINT64_C(0x40000000), 0x40000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzram = MemoryRegion(UINT64_C(0x7C010000), 0x10000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramMariko = MemoryRegion(UINT64_C(0x7C010000), 0x40000);
|
||||
static_assert(MemoryRegionPhysical.Contains(MemoryRegionPhysicalIram));
|
||||
static_assert(MemoryRegionPhysical.Contains(MemoryRegionPhysicalTzram));
|
||||
static_assert(MemoryRegionPhysicalTzramMariko.Contains(MemoryRegionPhysicalTzram));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramVolatile(UINT64_C(0x7C010000), 0x2000);
|
||||
static_assert(MemoryRegionPhysicalTzram.Contains(MemoryRegionPhysicalTzramVolatile));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramNonVolatile(UINT64_C(0x7C012000), 0xE000);
|
||||
static_assert(MemoryRegionPhysicalTzram.Contains(MemoryRegionPhysicalTzramNonVolatile));
|
||||
|
||||
static_assert(MemoryRegionPhysicalTzram.GetSize() == MemoryRegionPhysicalTzramNonVolatile.GetSize() + MemoryRegionPhysicalTzramVolatile.GetSize());
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualL1 = MemoryRegion(util::AlignDown(MemoryRegionVirtual.GetAddress(), mmu::L1EntrySize), mmu::L1EntrySize);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalL1 = MemoryRegion(util::AlignDown(MemoryRegionPhysical.GetAddress(), mmu::L1EntrySize), mmu::L1EntrySize);
|
||||
static_assert(MemoryRegionVirtualL1.Contains(MemoryRegionVirtual));
|
||||
static_assert(MemoryRegionPhysicalL1.Contains(MemoryRegionPhysical));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualL2 = MemoryRegion(util::AlignDown(MemoryRegionVirtual.GetAddress(), mmu::L2EntrySize), mmu::L2EntrySize);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalIramL2 = MemoryRegion(util::AlignDown(MemoryRegionPhysicalIram.GetAddress(), mmu::L2EntrySize), mmu::L2EntrySize);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramL2 = MemoryRegion(util::AlignDown(MemoryRegionPhysicalTzram.GetAddress(), mmu::L2EntrySize), mmu::L2EntrySize);
|
||||
static_assert(MemoryRegionVirtualL2.Contains(MemoryRegionVirtual));
|
||||
static_assert(MemoryRegionPhysicalIramL2.Contains(MemoryRegionPhysicalIram));
|
||||
static_assert(MemoryRegionPhysicalTzramL2.Contains(MemoryRegionPhysicalTzram));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalIramBootCode = MemoryRegion(UINT64_C(0x40020000), 0x20000);
|
||||
static_assert(MemoryRegionPhysicalIram.Contains(MemoryRegionPhysicalIramBootCode));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDevice = MemoryRegion(UINT64_C(0x1F0040000), UINT64_C(0x40000));
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualDevice));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDeviceEmpty = MemoryRegion(MemoryRegionVirtualDevice.GetStartAddress(), 0);
|
||||
|
||||
#define AMS_SECMON_FOREACH_DEVICE_REGION(HANDLER, ...) \
|
||||
HANDLER(GicDistributor, Empty, UINT64_C(0x50041000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(GicCpuInterface, GicDistributor, UINT64_C(0x50042000), UINT64_C(0x2000), true, ## __VA_ARGS__) \
|
||||
HANDLER(Uart, GicCpuInterface, UINT64_C(0x70006000), UINT64_C(0x1000), false, ## __VA_ARGS__) \
|
||||
HANDLER(ClkRst, Uart, UINT64_C(0x60006000), UINT64_C(0x1000), false, ## __VA_ARGS__) \
|
||||
HANDLER(RtcPmc, ClkRst, UINT64_C(0x7000E000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(Timer, RtcPmc, UINT64_C(0x60005000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(System, Timer, UINT64_C(0x6000C000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(SecurityEngine, System, UINT64_C(0x70012000), UINT64_C(0x2000), true, ## __VA_ARGS__) \
|
||||
HANDLER(SecurityEngine2, SecurityEngine, UINT64_C(0x70412000), UINT64_C(0x2000), true, ## __VA_ARGS__) \
|
||||
HANDLER(SysCtr0, SecurityEngine2, UINT64_C(0x700F0000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(MemoryController, SysCtr0, UINT64_C(0x70019000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(ExternalMemoryController, MemoryController, UINT64_C(0x7001b000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(FuseKFuse, ExternalMemoryController, UINT64_C(0x7000F000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(ApbMisc, FuseKFuse, UINT64_C(0x70000000), UINT64_C(0x4000), true, ## __VA_ARGS__) \
|
||||
HANDLER(FlowController, ApbMisc, UINT64_C(0x60007000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(BootloaderParams, FlowController, UINT64_C(0x40000000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(I2c5, BootloaderParams, UINT64_C(0x7000D000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(Gpio, I2c5, UINT64_C(0x6000D000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(I2c1, Gpio, UINT64_C(0x7000C000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(ExceptionVectors, I2c1, UINT64_C(0x6000F000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(MemoryController0, ExceptionVectors, UINT64_C(0x7001C000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(MemoryController1, MemoryController0, UINT64_C(0x7001D000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(Sdmmc, MemoryController1, UINT64_C(0x700B0000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(Disp1, Sdmmc, UINT64_C(0x54200000), UINT64_C(0x3000), true, ## __VA_ARGS__) \
|
||||
HANDLER(Dsi, Disp1, UINT64_C(0x54300000), UINT64_C(0x1000), true, ## __VA_ARGS__) \
|
||||
HANDLER(MipiCal, Dsi, UINT64_C(0x700E3000), UINT64_C(0x1000), true, ## __VA_ARGS__)
|
||||
|
||||
#define DEFINE_DEVICE_REGION(_NAME_, _PREV_, _ADDRESS_, _SIZE_, _SECURE_) \
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDevice##_NAME_ = MemoryRegion(MemoryRegionVirtualDevice##_PREV_.GetEndAddress() + 0x1000, _SIZE_); \
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDevice##_NAME_ = MemoryRegion(_ADDRESS_, _SIZE_); \
|
||||
static_assert(MemoryRegionVirtualDevice.Contains(MemoryRegionVirtualDevice##_NAME_)); \
|
||||
static_assert(MemoryRegionPhysical.Contains(MemoryRegionPhysicalDevice##_NAME_));
|
||||
|
||||
AMS_SECMON_FOREACH_DEVICE_REGION(DEFINE_DEVICE_REGION)
|
||||
|
||||
#undef DEFINE_DEVICE_REGION
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDeviceFuses = MemoryRegion(MemoryRegionVirtualDeviceFuseKFuse.GetAddress() + 0x800, 0x400);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDeviceFuses = MemoryRegion(MemoryRegionPhysicalDeviceFuseKFuse.GetAddress() + 0x800, 0x400);
|
||||
static_assert(MemoryRegionVirtualDeviceFuseKFuse.Contains(MemoryRegionVirtualDeviceFuses));
|
||||
static_assert(MemoryRegionPhysicalDeviceFuseKFuse.Contains(MemoryRegionPhysicalDeviceFuses));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDeviceActivityMonitor = MemoryRegion(MemoryRegionVirtualDeviceSystem.GetAddress() + 0x800, 0x400);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDeviceActivityMonitor = MemoryRegion(MemoryRegionPhysicalDeviceSystem.GetAddress() + 0x800, 0x400);
|
||||
static_assert(MemoryRegionVirtualDeviceSystem.Contains(MemoryRegionVirtualDeviceActivityMonitor));
|
||||
static_assert(MemoryRegionPhysicalDeviceSystem.Contains(MemoryRegionPhysicalDeviceActivityMonitor));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDeviceUartA = MemoryRegion(MemoryRegionVirtualDeviceUart.GetAddress() + 0x000, 0x040);
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDeviceUartB = MemoryRegion(MemoryRegionVirtualDeviceUart.GetAddress() + 0x040, 0x040);
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDeviceUartC = MemoryRegion(MemoryRegionVirtualDeviceUart.GetAddress() + 0x200, 0x100);
|
||||
static_assert(MemoryRegionVirtualDeviceUart.Contains(MemoryRegionVirtualDeviceUartA));
|
||||
static_assert(MemoryRegionVirtualDeviceUart.Contains(MemoryRegionVirtualDeviceUartB));
|
||||
static_assert(MemoryRegionVirtualDeviceUart.Contains(MemoryRegionVirtualDeviceUartC));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDeviceUartA = MemoryRegion(MemoryRegionPhysicalDeviceUart.GetAddress() + 0x000, 0x040);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDeviceUartB = MemoryRegion(MemoryRegionPhysicalDeviceUart.GetAddress() + 0x040, 0x040);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDeviceUartC = MemoryRegion(MemoryRegionPhysicalDeviceUart.GetAddress() + 0x200, 0x100);
|
||||
static_assert(MemoryRegionPhysicalDeviceUart.Contains(MemoryRegionPhysicalDeviceUartA));
|
||||
static_assert(MemoryRegionPhysicalDeviceUart.Contains(MemoryRegionPhysicalDeviceUartB));
|
||||
static_assert(MemoryRegionPhysicalDeviceUart.Contains(MemoryRegionPhysicalDeviceUartC));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDevicePmc = MemoryRegion(MemoryRegionVirtualDeviceRtcPmc.GetAddress() + 0x400, 0xC00);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDevicePmc = MemoryRegion(MemoryRegionPhysicalDeviceRtcPmc.GetAddress() + 0x400, 0xC00);
|
||||
static_assert(MemoryRegionVirtualDeviceRtcPmc.Contains(MemoryRegionVirtualDevicePmc));
|
||||
static_assert(MemoryRegionPhysicalDeviceRtcPmc.Contains(MemoryRegionPhysicalDevicePmc));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualTzramReadOnlyAlias = MemoryRegion(UINT64_C(0x1F00A0000), MemoryRegionPhysicalTzram.GetSize());
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramReadOnlyAlias = MemoryRegion(MemoryRegionPhysicalTzram.GetAddress(), MemoryRegionPhysicalTzram.GetSize());
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualTzramReadOnlyAlias));
|
||||
static_assert(MemoryRegionPhysicalTzram.Contains(MemoryRegionPhysicalTzramReadOnlyAlias));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualTzramProgram(UINT64_C(0x1F00C0000), 0xC000);
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualTzramProgram));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualTzramProgramExceptionVectors(UINT64_C(0x1F00C0000), 0x800);
|
||||
static_assert(MemoryRegionVirtualTzramProgram.Contains(MemoryRegionVirtualTzramProgramExceptionVectors));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualTzramMarikoProgram(UINT64_C(0x1F00D0000), 0x20000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramMarikoProgram(UINT64_C(0x7C020000), 0x20000);
|
||||
static_assert(MemoryRegionPhysicalTzramMariko.Contains(MemoryRegionPhysicalTzramMarikoProgram));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualTzramMarikoProgramFatalErrorContext(UINT64_C(0x1F00EF000), 0x1000);
|
||||
static_assert(MemoryRegionVirtualTzramMarikoProgram.Contains(MemoryRegionVirtualTzramMarikoProgramFatalErrorContext));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalIramFatalErrorContext(UINT64_C(0x4003E000), 0x1000);
|
||||
static_assert(MemoryRegionPhysicalIram.Contains(MemoryRegionPhysicalIramFatalErrorContext));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualTzramMarikoProgramStack(UINT64_C(0x1F00F4000), 0x8000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramMarikoProgramStack(UINT64_C(0x7C040000), 0x8000);
|
||||
static_assert(MemoryRegionPhysicalTzramMariko.Contains(MemoryRegionPhysicalTzramMarikoProgramStack));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalMarikoProgramImage(UINT64_C(0x80020000), 0x20000);
|
||||
static_assert(MemoryRegionDram.Contains(MemoryRegionPhysicalMarikoProgramImage));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualTzramProgramMain(UINT64_C(0x1F00C0800), 0xB800);
|
||||
static_assert(MemoryRegionVirtualTzramProgram.Contains(MemoryRegionVirtualTzramProgramMain));
|
||||
|
||||
static_assert(MemoryRegionVirtualTzramProgram.GetSize() == MemoryRegionVirtualTzramProgramExceptionVectors.GetSize() + MemoryRegionVirtualTzramProgramMain.GetSize());
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramProgram(UINT64_C(0x7C012000), 0xC000);
|
||||
static_assert(MemoryRegionPhysicalTzramNonVolatile.Contains(MemoryRegionPhysicalTzramProgram));
|
||||
|
||||
constexpr inline const Address PhysicalTzramProgramResetVector = MemoryRegionPhysicalTzramProgram.GetAddress() + MemoryRegionVirtualTzramProgramExceptionVectors.GetSize();
|
||||
static_assert(static_cast<u32>(PhysicalTzramProgramResetVector) == PhysicalTzramProgramResetVector);
|
||||
|
||||
constexpr uintptr_t GetPhysicalTzramProgramAddress(uintptr_t virtual_address) {
|
||||
return virtual_address - MemoryRegionVirtualTzramProgram.GetStartAddress() + MemoryRegionPhysicalTzramNonVolatile.GetStartAddress();
|
||||
}
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualIramSc7Work = MemoryRegion(UINT64_C(0x1F0120000), MemoryRegionPhysicalTzram.GetSize());
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalIramSc7Work = MemoryRegion( UINT64_C(0x40020000), MemoryRegionPhysicalTzram.GetSize());
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualIramSc7Work));
|
||||
static_assert(MemoryRegionPhysicalIram.Contains(MemoryRegionPhysicalIramSc7Work));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualIramSc7Firmware = MemoryRegion(UINT64_C(0x1F0140000), 0x1000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalIramSc7Firmware = MemoryRegion( UINT64_C(0x40003000), 0x1000);
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualIramSc7Firmware));
|
||||
static_assert(MemoryRegionPhysicalIram.Contains(MemoryRegionPhysicalIramSc7Firmware));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalIramSecureMonitorDebug(UINT64_C(0x40034000), 0x4000);
|
||||
static_assert(MemoryRegionPhysicalIram.Contains(MemoryRegionPhysicalIramSecureMonitorDebug));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDebugCode = MemoryRegion(UINT64_C(0x1F0150000), 0x4000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDebugCode = MemoryRegion(UINT64_C(0x40034000), 0x4000);
|
||||
static_assert(MemoryRegionPhysicalIramSecureMonitorDebug.Contains(MemoryRegionPhysicalDebugCode));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDebug = MemoryRegion(UINT64_C(0x1F0160000), 0x10000);
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualDebug));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualTzramBootCode = MemoryRegion(UINT64_C(0x1F01C0000), 0x2000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramBootCode = MemoryRegion( UINT64_C(0x7C010000), 0x2000);
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualTzramBootCode));
|
||||
static_assert(MemoryRegionPhysicalTzramVolatile.Contains(MemoryRegionPhysicalTzramBootCode));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDramMonitorConfiguration = MemoryRegion( UINT64_C(0x8000F000), 0x1000);
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDramSecureDataStore = MemoryRegion(UINT64_C(0x1F0100000), 0x10000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDramSecureDataStore = MemoryRegion( UINT64_C(0x80010000), 0x10000);
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualDramSecureDataStore));
|
||||
static_assert(MemoryRegionDram.Contains(MemoryRegionPhysicalDramSecureDataStore));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDramDebugDataStore = MemoryRegion(UINT64_C(0x1F0110000), 0x4000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDramDebugDataStore = MemoryRegion( UINT64_C(0x8000C000), 0x4000);
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualDramSecureDataStore));
|
||||
static_assert(MemoryRegionDram.Contains(MemoryRegionPhysicalDramSecureDataStore));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDramSdmmcMappedData = MemoryRegion(UINT64_C(0x1F0100000), 0xC000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDramSdmmcMappedData = MemoryRegion(UINT64_C(0x80010000), 0xC000);
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDramDcL0DevicePageTable = MemoryRegion(UINT64_C(0x1F010C000), 0x1000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDramDcL0DevicePageTable = MemoryRegion( UINT64_C(0x8001C000), 0x1000);
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDramSdmmc1L0DevicePageTable = MemoryRegion(UINT64_C(0x1F010E000), 0x1000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDramSdmmc1L0DevicePageTable = MemoryRegion( UINT64_C(0x8001E000), 0x1000);
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDramSdmmc1L1DevicePageTable = MemoryRegion(UINT64_C(0x1F010F000), 0x1000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDramSdmmc1L1DevicePageTable = MemoryRegion( UINT64_C(0x8001F000), 0x1000);
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDramSecureDataStoreTzram = MemoryRegion(UINT64_C(0x1F0100000), 0xE000);
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDramSecureDataStoreWarmbootFirmware = MemoryRegion(UINT64_C(0x1F010E000), 0x17C0);
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualDramSecureDataStoreSecurityEngineState = MemoryRegion(UINT64_C(0x1F010F7C0), 0x0840);
|
||||
static_assert(MemoryRegionVirtualDramSecureDataStore.Contains(MemoryRegionVirtualDramSecureDataStoreTzram));
|
||||
static_assert(MemoryRegionVirtualDramSecureDataStore.Contains(MemoryRegionVirtualDramSecureDataStoreWarmbootFirmware));
|
||||
static_assert(MemoryRegionVirtualDramSecureDataStore.Contains(MemoryRegionVirtualDramSecureDataStoreSecurityEngineState));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDramSecureDataStoreTzram = MemoryRegion(UINT64_C(0x80010000), 0xE000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDramSecureDataStoreWarmbootFirmware = MemoryRegion(UINT64_C(0x8001E000), 0x17C0);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalDramSecureDataStoreSecurityEngineState = MemoryRegion(UINT64_C(0x8001F7C0), 0x0840);
|
||||
static_assert(MemoryRegionPhysicalDramSecureDataStore.Contains(MemoryRegionPhysicalDramSecureDataStoreTzram));
|
||||
static_assert(MemoryRegionPhysicalDramSecureDataStore.Contains(MemoryRegionPhysicalDramSecureDataStoreWarmbootFirmware));
|
||||
static_assert(MemoryRegionPhysicalDramSecureDataStore.Contains(MemoryRegionPhysicalDramSecureDataStoreSecurityEngineState));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualAtmosphereIramPage = MemoryRegion(UINT64_C(0x1F01F0000), 0x1000);
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualAtmosphereIramPage));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualAtmosphereUserPage = MemoryRegion(UINT64_C(0x1F01F2000), 0x1000);
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualAtmosphereUserPage));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualSmcUserPage = MemoryRegion(UINT64_C(0x1F01F4000), 0x1000);
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualSmcUserPage));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualTzramVolatileData = MemoryRegion(UINT64_C(0x1F01F6000), 0x1000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramVolatileData = MemoryRegion( UINT64_C(0x7C010000), 0x1000);
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualTzramVolatileData));
|
||||
static_assert(MemoryRegionPhysicalTzramVolatile.Contains(MemoryRegionPhysicalTzramVolatileData));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualTzramVolatileStack = MemoryRegion(UINT64_C(0x1F01F8000), 0x1000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramVolatileStack = MemoryRegion( UINT64_C(0x7C011000), 0x1000);
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualTzramVolatileStack));
|
||||
static_assert(MemoryRegionPhysicalTzramVolatile.Contains(MemoryRegionPhysicalTzramVolatileStack));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualTzramConfigurationData = MemoryRegion(UINT64_C(0x1F01FA000), 0x1000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramConfigurationData = MemoryRegion( UINT64_C(0x7C01E000), 0x1000);
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualTzramConfigurationData));
|
||||
static_assert(MemoryRegionPhysicalTzramNonVolatile.Contains(MemoryRegionPhysicalTzramConfigurationData));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualTzramL1PageTable = MemoryRegion(UINT64_C(0x1F01FCFC0), 0x40);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramL1PageTable = MemoryRegion( UINT64_C(0x7C01EFC0), 0x40);
|
||||
static_assert(MemoryRegionPhysicalTzramConfigurationData.Contains(MemoryRegionPhysicalTzramL1PageTable));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionVirtualTzramL2L3PageTable = MemoryRegion(UINT64_C(0x1F01FE000), 0x1000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramL2L3PageTable = MemoryRegion( UINT64_C(0x7C01F000), 0x1000);
|
||||
static_assert(MemoryRegionVirtual.Contains(MemoryRegionVirtualTzramL2L3PageTable));
|
||||
static_assert(MemoryRegionPhysicalTzramNonVolatile.Contains(MemoryRegionPhysicalTzramL2L3PageTable));
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalTzramFullProgramImage = MemoryRegion(UINT64_C(0x7C010800), 0xD800);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalIramBootCodeImage = MemoryRegion(UINT64_C(0x40032000), 0xC000);
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalIramBootCodeCode = MemoryRegion(UINT64_C(0x40032000), 0x1000);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalIramBootCodeKeys = MemoryRegion(UINT64_C(0x40033000), 0x1000);
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalIramWarmbootBin = MemoryRegion(UINT64_C(0x4003E000), 0x17F0);
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalIramBootConfig = MemoryRegion(UINT64_C(0x4003F800), 0x400);
|
||||
|
||||
constexpr inline const MemoryRegion MemoryRegionPhysicalIramRebootStub = MemoryRegion(UINT64_C(0x4003F000), 0x1000);
|
||||
|
||||
}
|
||||
@@ -1,127 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/fuse.hpp>
|
||||
#include <exosphere/uart.hpp>
|
||||
#include <exosphere/secmon/secmon_emummc_context.hpp>
|
||||
|
||||
namespace ams::secmon {
|
||||
|
||||
enum SecureMonitorConfigurationFlag : u32 {
|
||||
SecureMonitorConfigurationFlag_None = (0u << 0),
|
||||
SecureMonitorConfigurationFlag_IsDevelopmentFunctionEnabledForKernel = (1u << 1),
|
||||
SecureMonitorConfigurationFlag_IsDevelopmentFunctionEnabledForUser = (1u << 2),
|
||||
SecureMonitorConfigurationFlag_DisableUserModeExceptionHandlers = (1u << 3),
|
||||
SecureMonitorConfigurationFlag_EnableUserModePerformanceCounterAccess = (1u << 4),
|
||||
SecureMonitorConfigurationFlag_ShouldUseBlankCalibrationBinary = (1u << 5),
|
||||
SecureMonitorConfigurationFlag_AllowWritingToCalibrationBinarySysmmc = (1u << 6),
|
||||
SecureMonitorConfigurationFlag_ForceEnableUsb30 = (1u << 7),
|
||||
|
||||
SecureMonitorConfigurationFlag_Default = SecureMonitorConfigurationFlag_IsDevelopmentFunctionEnabledForKernel,
|
||||
};
|
||||
|
||||
struct SecureMonitorStorageConfiguration {
|
||||
static constexpr u32 Magic = util::FourCC<'E','X','O','0'>::Code;
|
||||
|
||||
u32 magic;
|
||||
ams::TargetFirmware target_firmware;
|
||||
u32 flags[2];
|
||||
u16 lcd_vendor;
|
||||
u8 log_port;
|
||||
u8 log_flags;
|
||||
u32 log_baud_rate;
|
||||
u32 reserved1[2];
|
||||
EmummcConfiguration emummc_cfg;
|
||||
|
||||
constexpr bool IsValid() const { return this->magic == Magic; }
|
||||
};
|
||||
static_assert(util::is_pod<SecureMonitorStorageConfiguration>::value);
|
||||
static_assert(sizeof(SecureMonitorStorageConfiguration) == 0x130);
|
||||
|
||||
struct SecureMonitorConfiguration {
|
||||
ams::TargetFirmware target_firmware;
|
||||
s32 key_generation;
|
||||
u8 hardware_type;
|
||||
u8 soc_type;
|
||||
u8 hardware_state;
|
||||
u8 log_port;
|
||||
u32 flags[2];
|
||||
u16 lcd_vendor;
|
||||
u8 log_flags;
|
||||
u8 reserved0;
|
||||
u32 log_baud_rate;
|
||||
u32 reserved1[(0x80 - 0x1C) / sizeof(u32)];
|
||||
|
||||
constexpr void CopyFrom(const SecureMonitorStorageConfiguration &storage) {
|
||||
this->target_firmware = storage.target_firmware;
|
||||
this->flags[0] = storage.flags[0];
|
||||
this->flags[1] = storage.flags[1];
|
||||
this->lcd_vendor = storage.lcd_vendor;
|
||||
this->log_port = storage.log_port;
|
||||
this->log_flags = storage.log_flags;
|
||||
this->log_baud_rate = storage.log_baud_rate != 0 ? storage.log_baud_rate : 115200;
|
||||
}
|
||||
|
||||
void SetFuseInfo() {
|
||||
this->hardware_type = fuse::GetHardwareType();
|
||||
this->soc_type = fuse::GetSocType();
|
||||
this->hardware_state = fuse::GetHardwareState();
|
||||
}
|
||||
|
||||
constexpr ams::TargetFirmware GetTargetFirmware() const { return this->target_firmware; }
|
||||
constexpr int GetKeyGeneration() const { return this->key_generation; }
|
||||
constexpr fuse::HardwareType GetHardwareType() const { return static_cast<fuse::HardwareType>(this->hardware_type); }
|
||||
constexpr fuse::SocType GetSocType() const { return static_cast<fuse::SocType>(this->soc_type); }
|
||||
constexpr fuse::HardwareState GetHardwareState() const { return static_cast<fuse::HardwareState>(this->hardware_state); }
|
||||
constexpr uart::Port GetLogPort() const { return static_cast<uart::Port>(this->log_port); }
|
||||
constexpr u8 GetLogFlags() const { return this->log_flags; }
|
||||
|
||||
constexpr u16 GetLcdVendor() const { return this->lcd_vendor; }
|
||||
|
||||
constexpr u32 GetLogBaudRate() const { return this->log_baud_rate; }
|
||||
|
||||
constexpr bool IsProduction() const { return this->GetHardwareState() != fuse::HardwareState_Development; }
|
||||
|
||||
constexpr bool IsDevelopmentFunctionEnabledForKernel() const { return (this->flags[0] & SecureMonitorConfigurationFlag_IsDevelopmentFunctionEnabledForKernel) != 0; }
|
||||
constexpr bool IsDevelopmentFunctionEnabledForUser() const { return (this->flags[0] & SecureMonitorConfigurationFlag_IsDevelopmentFunctionEnabledForUser) != 0; }
|
||||
constexpr bool DisableUserModeExceptionHandlers() const { return (this->flags[0] & SecureMonitorConfigurationFlag_DisableUserModeExceptionHandlers) != 0; }
|
||||
constexpr bool EnableUserModePerformanceCounterAccess() const { return (this->flags[0] & SecureMonitorConfigurationFlag_EnableUserModePerformanceCounterAccess) != 0; }
|
||||
constexpr bool ShouldUseBlankCalibrationBinary() const { return (this->flags[0] & SecureMonitorConfigurationFlag_ShouldUseBlankCalibrationBinary) != 0; }
|
||||
constexpr bool AllowWritingToCalibrationBinarySysmmc() const { return (this->flags[0] & SecureMonitorConfigurationFlag_AllowWritingToCalibrationBinarySysmmc) != 0; }
|
||||
constexpr bool IsUsb30ForceEnabled() const { return (this->flags[0] & SecureMonitorConfigurationFlag_ForceEnableUsb30) != 0; }
|
||||
|
||||
constexpr bool IsDevelopmentFunctionEnabled(bool for_kern) const { return for_kern ? this->IsDevelopmentFunctionEnabledForKernel() : this->IsDevelopmentFunctionEnabledForUser(); }
|
||||
};
|
||||
static_assert(util::is_pod<SecureMonitorConfiguration>::value);
|
||||
static_assert(sizeof(SecureMonitorConfiguration) == 0x80);
|
||||
|
||||
constexpr inline const SecureMonitorConfiguration DefaultSecureMonitorConfiguration = {
|
||||
.target_firmware = ams::TargetFirmware_Current,
|
||||
.key_generation = {},
|
||||
.hardware_type = {},
|
||||
.soc_type = {},
|
||||
.hardware_state = {},
|
||||
.log_port = uart::Port_ReservedDebug,
|
||||
.flags = { SecureMonitorConfigurationFlag_Default, SecureMonitorConfigurationFlag_None },
|
||||
.lcd_vendor = {},
|
||||
.log_flags = {},
|
||||
.reserved0 = {},
|
||||
.log_baud_rate = 115200,
|
||||
.reserved1 = {},
|
||||
};
|
||||
|
||||
}
|
||||
@@ -1,138 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
#include <exosphere/pkg1.hpp>
|
||||
#include <exosphere/pkg2.hpp>
|
||||
|
||||
namespace ams::secmon {
|
||||
|
||||
/* The VolatileStack page is reserved entirely for use for core 3 SMC handling. */
|
||||
constexpr inline const Address Core3SmcStackAddress = MemoryRegionVirtualTzramVolatileStack.GetAddress() + MemoryRegionVirtualTzramVolatileStack.GetSize();
|
||||
|
||||
constexpr inline const size_t CoreExceptionStackSize = 0x80;
|
||||
|
||||
/* Volatile keydata that we lose access to after boot. */
|
||||
struct VolatileKeys {
|
||||
u8 boot_config_rsa_modulus[0x100];
|
||||
u8 package2_dev_rsa_modulus[0x100];
|
||||
u8 package2_prod_rsa_modulus[0x100];
|
||||
u8 package2_aes_key[0x10];
|
||||
u8 master_key_source[0x10];
|
||||
u8 device_master_key_source_kek_source[0x10];
|
||||
u8 mariko_dev_master_kek_source[0x10];
|
||||
u8 mariko_prod_master_kek_source[0x10];
|
||||
u8 dev_master_key_vectors[pkg1::OldMasterKeyCount + 1][0x10];
|
||||
u8 prod_master_key_vectors[pkg1::OldMasterKeyCount + 1][0x10];
|
||||
u8 device_master_key_source_sources[pkg1::OldDeviceMasterKeyCount][0x10];
|
||||
u8 dev_device_master_kek_sources[pkg1::OldDeviceMasterKeyCount][0x10];
|
||||
u8 prod_device_master_kek_sources[pkg1::OldDeviceMasterKeyCount][0x10];
|
||||
};
|
||||
static_assert(util::is_pod<VolatileKeys>::value);
|
||||
static_assert(sizeof(VolatileKeys) <= 0x1000);
|
||||
|
||||
/* Nintendo uses the bottom 0x740 of this as a stack for warmboot setup, and another 0x740 for the core 0/1/2 SMC stacks. */
|
||||
/* This is...wasteful. The warmboot stack is not deep. We will thus save 1K+ of nonvolatile storage by keeping the random cache in here. */
|
||||
struct VolatileData {
|
||||
u8 se_work_block[crypto::AesEncryptor128::BlockSize];
|
||||
union {
|
||||
u8 random_cache[0x400];
|
||||
pkg2::Package2Meta pkg2_meta;
|
||||
};
|
||||
u8 reserved_danger_zone[0x30]; /* This memory is "available", but careful consideration must be taken before declaring it used. */
|
||||
u8 warmboot_stack[0x380];
|
||||
u8 core012_smc_stack[0x6C0];
|
||||
u8 core_exception_stacks[3][CoreExceptionStackSize];
|
||||
};
|
||||
static_assert(util::is_pod<VolatileData>::value);
|
||||
static_assert(sizeof(VolatileData) == 0x1000);
|
||||
|
||||
ALWAYS_INLINE VolatileData &GetVolatileData() {
|
||||
return *MemoryRegionVirtualTzramVolatileData.GetPointer<VolatileData>();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u8 *GetRandomBytesCache() {
|
||||
return GetVolatileData().random_cache;
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE size_t GetRandomBytesCacheSize() {
|
||||
return sizeof(VolatileData::random_cache);
|
||||
}
|
||||
|
||||
ALWAYS_INLINE u8 *GetSecurityEngineEphemeralWorkBlock() {
|
||||
return GetVolatileData().se_work_block;
|
||||
}
|
||||
|
||||
namespace boot {
|
||||
|
||||
ALWAYS_INLINE VolatileKeys &GetVolatileKeys() {
|
||||
return *MemoryRegionPhysicalIramBootCodeKeys.GetPointer<VolatileKeys>();
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const u8 *GetBootConfigRsaModulus() {
|
||||
return GetVolatileKeys().boot_config_rsa_modulus;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const u8 *GetPackage2RsaModulus(bool is_prod) {
|
||||
auto &keys = GetVolatileKeys();
|
||||
return is_prod ? keys.package2_prod_rsa_modulus : keys.package2_dev_rsa_modulus;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const u8 *GetPackage2AesKey() {
|
||||
return GetVolatileKeys().package2_aes_key;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const u8 *GetMasterKeySource() {
|
||||
return GetVolatileKeys().master_key_source;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const u8 *GetDeviceMasterKeySourceKekSource() {
|
||||
return GetVolatileKeys().device_master_key_source_kek_source;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const u8 *GetMarikoMasterKekSource(bool is_prod) {
|
||||
auto &keys = GetVolatileKeys();
|
||||
return is_prod ? keys.mariko_prod_master_kek_source : keys.mariko_dev_master_kek_source;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const u8 *GetMasterKeyVector(bool is_prod, size_t i) {
|
||||
auto &keys = GetVolatileKeys();
|
||||
return is_prod ? keys.prod_master_key_vectors[i] : keys.dev_master_key_vectors[i];
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const u8 *GetDeviceMasterKeySourceSource(size_t i) {
|
||||
return GetVolatileKeys().device_master_key_source_sources[i];
|
||||
}
|
||||
|
||||
ALWAYS_INLINE const u8 *GetDeviceMasterKekSource(bool is_prod, size_t i) {
|
||||
auto &keys = GetVolatileKeys();
|
||||
return is_prod ? keys.prod_device_master_kek_sources[i] : keys.dev_device_master_kek_sources[i];
|
||||
}
|
||||
|
||||
ALWAYS_INLINE pkg2::Package2Meta &GetEphemeralPackage2Meta() {
|
||||
return GetVolatileData().pkg2_meta;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
constexpr inline const Address WarmbootStackAddress = MemoryRegionVirtualTzramVolatileData.GetAddress() + AMS_OFFSETOF(VolatileData, warmboot_stack) + sizeof(VolatileData::warmboot_stack);
|
||||
constexpr inline const Address Core012SmcStackAddress = MemoryRegionVirtualTzramVolatileData.GetAddress() + AMS_OFFSETOF(VolatileData, core012_smc_stack) + sizeof(VolatileData::core012_smc_stack);
|
||||
|
||||
constexpr inline const Address Core0ExceptionStackAddress = MemoryRegionVirtualTzramVolatileData.GetAddress() + AMS_OFFSETOF(VolatileData, core_exception_stacks) + CoreExceptionStackSize;
|
||||
constexpr inline const Address Core1ExceptionStackAddress = Core0ExceptionStackAddress + CoreExceptionStackSize;
|
||||
constexpr inline const Address Core2ExceptionStackAddress = Core1ExceptionStackAddress + CoreExceptionStackSize;
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::tsec {
|
||||
|
||||
bool RunTsecFirmware(const void *fw, size_t fw_size);
|
||||
|
||||
void Lock();
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::uart {
|
||||
|
||||
enum Port {
|
||||
Port_A = 0,
|
||||
Port_B = 1,
|
||||
Port_C = 2,
|
||||
|
||||
Port_Count = 3,
|
||||
|
||||
Port_ReservedDebug = Port_A,
|
||||
Port_RightJoyCon = Port_B,
|
||||
Port_LeftJoyCon = Port_C,
|
||||
};
|
||||
|
||||
enum Flags {
|
||||
Flag_None = (0u << 0),
|
||||
Flag_Inverted = (1u << 0),
|
||||
};
|
||||
|
||||
void SetRegisterAddress(uintptr_t address);
|
||||
|
||||
void Initialize(Port port, int baud_rate, u32 flags);
|
||||
|
||||
void SendText(Port port, const void *data, size_t size);
|
||||
|
||||
void WaitFlush(Port port);
|
||||
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::util {
|
||||
|
||||
void SetRegisterAddress(uintptr_t address);
|
||||
|
||||
void ClearMemory(void *ptr, size_t size);
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 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/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <vapours.hpp>
|
||||
|
||||
namespace ams::wdt {
|
||||
|
||||
void SetRegisterAddress(uintptr_t address);
|
||||
void Reboot();
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user