Compare commits

...

15 Commits

Author SHA1 Message Date
Michael Scire
9377be2525 sm: fix wait list reentrancy and state on processing loop entry 2020-12-31 15:53:32 -08:00
Michael Scire
30336362f4 sm: implement accurate request deferral semantics 2020-12-31 00:29:06 -08:00
Michael Scire
24111d46a1 git subrepo push libraries
subrepo:
  subdir:   "libraries"
  merged:   "b05ba02f"
upstream:
  origin:   "https://github.com/Atmosphere-NX/Atmosphere-libs"
  branch:   "master"
  commit:   "b05ba02f"
git-subrepo:
  version:  "0.4.1"
  origin:   "???"
  commit:   "???"
2020-12-29 13:08:25 -08:00
Michael Scire
f2a6a4a6e6 fusee: fix sept enc header dependency 2020-12-29 13:07:48 -08:00
Michael Scire
6633af769e boot: fix rebuild-every-time-make-is-invoked 2020-12-29 13:01:06 -08:00
Michael Scire
131c8609c8 libmeso: explicitly blacklist ::sdmmc::, instead of relying on incorrect board tricks 2020-12-29 12:36:26 -08:00
Michael Scire
30e70e20d8 strat: fix board namespacing for nintendo::nx 2020-12-29 12:30:43 -08:00
Michael Scire
a26e8ac54f ams: resolve source dir inconsistency 2020-12-29 12:28:07 -08:00
Michael Scire
8bfda27e0e kern: remove target-firmware logic for kernel loader 2020-12-29 12:21:41 -08:00
Michael Scire
0c9cb830f7 git subrepo push libraries
subrepo:
  subdir:   "libraries"
  merged:   "be8388d6"
upstream:
  origin:   "https://github.com/Atmosphere-NX/Atmosphere-libs"
  branch:   "master"
  commit:   "be8388d6"
git-subrepo:
  version:  "0.4.1"
  origin:   "???"
  commit:   "???"
2020-12-28 17:34:31 -08:00
Michael Scire
ee1b638dde svc: we support kernel version 15.4 2020-12-28 17:33:45 -08:00
Michael Scire
9826358533 ams: update five -> aula, per CalWriterManu 2020-12-28 15:54:25 -08:00
Michael Scire
113ab8439d kern: fix KTrace buffer memory region type to match official kernel 2020-12-28 00:57:45 -08:00
ameerj
60c888126b fix typo in KServerPort::Destroy() 2020-12-25 20:23:10 -08:00
Michael Scire
d7b14f48d2 fusee: fix no-BCT.ini for fusee-secondary 2020-12-19 12:08:05 -08:00
105 changed files with 534 additions and 341 deletions

View File

@@ -120,7 +120,7 @@ $(OFILES) : $(ATMOSPHERE_LIBRARIES_DIR)/libexosphere/$(ATMOSPHERE_LIBRARY_DIR)/l
program.lz4.o: program_lz4.h
program.lz4.o program_lz4.h: $(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4
program_lz4.h: $(TOPDIR)/../program/program$(ATMOSPHERE_BUILD_TARGET_BINARY_SUFFIX).lz4
@echo $(notdir $<)
@rm -rf tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)
@mkdir -p tmp_program_$(ATMOSPHERE_BUILD_TARGET_IDENTIFIER)

View File

@@ -111,7 +111,7 @@ namespace ams::secmon::fatal {
}
}
void EnableBacklightForVendor2050ForHardwareTypeFive(int brightness) {
void EnableBacklightForVendor2050ForAula(int brightness) {
/* Enable FRAME_END_INT */
reg::Write(g_disp1_regs + sizeof(u32) * DC_CMD_INT_ENABLE, 2);
@@ -270,7 +270,7 @@ namespace ams::secmon::fatal {
reg::ClearBits(g_apb_misc_regs + PINMUX_AUX_LCD_BL_EN, reg::EncodeMask(PINMUX_REG_BITS_MASK(AUX_TRISTATE)));
reg::ClearBits(g_apb_misc_regs + PINMUX_AUX_LCD_RST, reg::EncodeMask(PINMUX_REG_BITS_MASK(AUX_TRISTATE)));
if (fuse::GetHardwareType() == fuse::HardwareType_Five) {
if (fuse::GetHardwareType() == fuse::HardwareType_Aula) {
/* Configure LCD backlight. */
reg::SetBits(g_gpio_regs + GPIO_PORT6_CNF_1, 0x4);
reg::SetBits(g_gpio_regs + GPIO_PORT6_OE_1, 0x4);
@@ -384,7 +384,7 @@ namespace ams::secmon::fatal {
reg::ClearBits(g_apb_misc_regs + PINMUX_AUX_LCD_BL_EN, reg::EncodeMask(PINMUX_REG_BITS_MASK(AUX_TRISTATE)));
reg::ClearBits(g_apb_misc_regs + PINMUX_AUX_LCD_RST, reg::EncodeMask(PINMUX_REG_BITS_MASK(AUX_TRISTATE)));
if (hw_type == fuse::HardwareType_Five) {
if (hw_type == fuse::HardwareType_Aula) {
/* Configure LCD backlight. */
reg::SetBits(g_gpio_regs + GPIO_PORT6_CNF_1, 0x4);
reg::SetBits(g_gpio_regs + GPIO_PORT6_OE_1, 0x4);
@@ -429,7 +429,7 @@ namespace ams::secmon::fatal {
reg::SetBits(g_gpio_regs + GPIO_PORT6_OUT_1, 0x4);
util::WaitMicroSeconds(60'000ul);
if (hw_type == fuse::HardwareType_Five) {
if (hw_type == fuse::HardwareType_Aula) {
reg::Write(g_dsi_regs + sizeof(u32) * DSI_BTA_TIMING, 0x40103);
} else {
reg::Write(g_dsi_regs + sizeof(u32) * DSI_BTA_TIMING, 0x50204);
@@ -593,7 +593,7 @@ namespace ams::secmon::fatal {
/* Enable backlight. */
constexpr auto DisplayBrightness = 100;
if (GetLcdVendor() == 0x2050) {
EnableBacklightForVendor2050ForHardwareTypeFive(DisplayBrightness);
EnableBacklightForVendor2050ForAula(DisplayBrightness);
} else {
EnableBacklightForGeneric(DisplayBrightness);
}

View File

@@ -409,8 +409,8 @@ namespace ams::secmon {
reg0 |= reg::Encode(SLAVE_SECURITY_REG_BITS_ENUM(0, CEC, ENABLE));
}
/* Icosa, Iowa, and Five all set I2C4 to be secure. */
if (hw_type == fuse::HardwareType_Icosa && hw_type == fuse::HardwareType_Iowa && hw_type == fuse::HardwareType_Five) {
/* Icosa, Iowa, and Aula all set I2C4 to be secure. */
if (hw_type == fuse::HardwareType_Icosa && hw_type == fuse::HardwareType_Iowa && hw_type == fuse::HardwareType_Aula) {
reg1 |= reg::Encode(SLAVE_SECURITY_REG_BITS_ENUM(1, I2C4, ENABLE));
}

View File

@@ -47,7 +47,7 @@ namespace ams::secmon::smc {
[fuse::DramId_IcosaSamsung4GB] = pkg1::MemorySize_4GB,
[fuse::DramId_IcosaHynix4GB] = pkg1::MemorySize_4GB,
[fuse::DramId_IcosaMicron4GB] = pkg1::MemorySize_4GB,
[fuse::DramId_FiveHynix1y4GB] = pkg1::MemorySize_4GB,
[fuse::DramId_AulaHynix1y4GB] = pkg1::MemorySize_4GB,
[fuse::DramId_IcosaSamsung6GB] = pkg1::MemorySize_6GB,
[fuse::DramId_CopperHynix4GB] = pkg1::MemorySize_4GB,
[fuse::DramId_CopperMicron4GB] = pkg1::MemorySize_4GB,
@@ -66,13 +66,13 @@ namespace ams::secmon::smc {
[fuse::DramId_HoagSamsung1y4GBX] = pkg1::MemorySize_4GB,
[fuse::DramId_IowaSamsung1y4GBY] = pkg1::MemorySize_4GB,
[fuse::DramId_IowaSamsung1y8GBY] = pkg1::MemorySize_8GB,
[fuse::DramId_FiveSamsung1y4GB] = pkg1::MemorySize_4GB,
[fuse::DramId_AulaSamsung1y4GB] = pkg1::MemorySize_4GB,
[fuse::DramId_HoagSamsung1y8GBX] = pkg1::MemorySize_8GB,
[fuse::DramId_FiveSamsung1y4GBX] = pkg1::MemorySize_4GB,
[fuse::DramId_AulaSamsung1y4GBX] = pkg1::MemorySize_4GB,
[fuse::DramId_IowaMicron1y4GB] = pkg1::MemorySize_4GB,
[fuse::DramId_HoagMicron1y4GB] = pkg1::MemorySize_4GB,
[fuse::DramId_FiveMicron1y4GB] = pkg1::MemorySize_4GB,
[fuse::DramId_FiveSamsung1y8GBX] = pkg1::MemorySize_8GB,
[fuse::DramId_AulaMicron1y4GB] = pkg1::MemorySize_4GB,
[fuse::DramId_AulaSamsung1y8GBX] = pkg1::MemorySize_8GB,
};
constexpr const pkg1::MemoryMode MemoryModes[] = {

View File

@@ -217,7 +217,7 @@ sept_primary.bin.o sept_primary_bin.h: sept-primary.bin
@echo $(notdir $<)
@$(_bin2o)
sept_secondary_00.enc.o sept_secondary_00.h: sept-secondary_00.enc
sept_secondary_00.enc.o sept_secondary_00_enc.h: sept-secondary_00.enc
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(_bin2o)

View File

@@ -70,6 +70,18 @@ static void exit_callback(int rc) {
}
}
static const char *get_default_bct0(void) {
return "BCT0\n"
"[stage1]\n"
"stage2_path = atmosphere/fusee-secondary.bin\n"
"stage2_mtc_path = atmosphere/fusee-mtc.bin\n"
"stage2_addr = 0xF0000000\n"
"stage2_entrypoint = 0xF0000000\n"
"\n"
"[stratosphere]\n"
"\n";
}
/* Allow for main(int argc, void **argv) signature. */
#pragma GCC diagnostic ignored "-Wmain"
@@ -102,7 +114,8 @@ int main(int argc, void **argv) {
if (strcmp(g_stage2_args->bct0, "") == 0) {
uint32_t bct_tmp_buf[sizeof(g_stage2_args->bct0) / sizeof(uint32_t)] = {0};
if (!read_from_file(bct_tmp_buf, sizeof(bct_tmp_buf) - 1, "atmosphere/config/BCT.ini")) {
fatal_error("Failed to read BCT0 from SD!\n");
const char * const default_bct0 = get_default_bct0();
memcpy(bct_tmp_buf, default_bct0, strlen(default_bct0));
}
memcpy(g_stage2_args->bct0, bct_tmp_buf, sizeof(bct_tmp_buf));
}

View File

@@ -6,7 +6,7 @@
[subrepo]
remote = https://github.com/Atmosphere-NX/Atmosphere-libs
branch = master
commit = 886dfaf6d5cf47c06895173721c6c12dfaf0b476
parent = 8b61537aa347e0e6495b8c6d71eb62faab0c652a
commit = b05ba02f044beb03b3e228a660c0c28d0b1efe0d
parent = f2a6a4a6e60bfe0dea11ba3a0ff56c95a5871a6c
method = merge
cmdver = 0.4.0
cmdver = 0.4.1

View File

@@ -108,15 +108,17 @@ BUILD := build
DATA := data
INCLUDES := include
GENERAL_SOURCE_DIRS=$1 $(foreach d,$(filter-out $1/arch $1/board $1/os $1/cpu $1,$(wildcard $1/*)),$(if $(wildcard $d/.),$(call DIR_WILDCARD,$d) $d,))
GENERAL_SOURCE_DIRS=$1 $(foreach d,$(filter-out $1/arch $1/board $1/os $1/cpu $1,$(wildcard $1/*)),$(if $(wildcard $d/.),$(filter-out $d,$(call GENERAL_SOURCE_DIRS,$d)) $d,))
SPECIFIC_SOURCE_DIRS=$(if $(wildcard $1/$2/$3/.*),$1/$2/$3 $(call DIR_WILDCARD,$1/$2/$3),$(if $(wildcard $1/$2/generic/.*), $1/$2/generic $(call DIR_WILDCARD,$1/$2/generic),))
UNFILTERED_SOURCE_DIRS=$1 $(foreach d,$(wildcard $1/*),$(if $(wildcard $d/.),$(call DIR_WILDCARD,$d) $d,))
ALL_SOURCE_DIRS=$(call GENERAL_SOURCE_DIRS,$1) \
$(call SPECIFIC_SOURCE_DIRS,$1,arch,$(ATMOSPHERE_ARCH_DIR)) \
$(call SPECIFIC_SOURCE_DIRS,$1,board,$(ATMOSPHERE_BOARD_DIR)) \
$(call SPECIFIC_SOURCE_DIRS,$1,os,$(ATMOSPHERE_OS_DIR)) \
$(call SPECIFIC_SOURCE_DIRS,$1,cpu,$(ATMOSPHERE_ARCH_DIR)/$(ATMOSPHERE_CPU_DIR))
ALL_SOURCE_DIRS=$(foreach d,$(call GENERAL_SOURCE_DIRS,$1), \
$d \
$(call SPECIFIC_SOURCE_DIRS,$d,arch,$(ATMOSPHERE_ARCH_DIR)) \
$(call SPECIFIC_SOURCE_DIRS,$d,board,$(ATMOSPHERE_BOARD_DIR)) \
$(call SPECIFIC_SOURCE_DIRS,$d,os,$(ATMOSPHERE_OS_DIR)) \
$(call SPECIFIC_SOURCE_DIRS,$d,cpu,$(ATMOSPHERE_ARCH_DIR)/$(ATMOSPHERE_CPU_DIR)) \
)
SOURCES ?= $(call ALL_SOURCE_DIRS,source)

View File

@@ -26,7 +26,7 @@ namespace ams::fuse {
HardwareType_Hoag = 2,
HardwareType_Iowa = 3,
HardwareType_Calcio = 4,
HardwareType_Five = 5,
HardwareType_Aula = 5,
HardwareType_Undefined = 0xF,
};
@@ -51,7 +51,7 @@ namespace ams::fuse {
DramId_IcosaSamsung4GB = 0,
DramId_IcosaHynix4GB = 1,
DramId_IcosaMicron4GB = 2,
DramId_FiveHynix1y4GB = 3,
DramId_AulaHynix1y4GB = 3,
DramId_IcosaSamsung6GB = 4,
DramId_CopperHynix4GB = 5,
DramId_CopperMicron4GB = 6,
@@ -70,13 +70,13 @@ namespace ams::fuse {
DramId_HoagSamsung1y4GBX = 19,
DramId_IowaSamsung1y4GBY = 20,
DramId_IowaSamsung1y8GBY = 21,
DramId_FiveSamsung1y4GB = 22,
DramId_AulaSamsung1y4GB = 22,
DramId_HoagSamsung1y8GBX = 23,
DramId_FiveSamsung1y4GBX = 24,
DramId_AulaSamsung1y4GBX = 24,
DramId_IowaMicron1y4GB = 25,
DramId_HoagMicron1y4GB = 26,
DramId_FiveMicron1y4GB = 27,
DramId_FiveSamsung1y8GBX = 28,
DramId_AulaMicron1y4GB = 27,
DramId_AulaSamsung1y8GBX = 28,
DramId_Count,
};

View File

@@ -316,7 +316,7 @@ namespace ams::fuse {
case 0x02: return (true /* TODO: GetSocType() == SocType_Mariko */) ? HardwareType_Calcio : HardwareType_Copper;
case 0x04: return HardwareType_Iowa;
case 0x08: return HardwareType_Hoag;
case 0x10: return HardwareType_Five;
case 0x10: return HardwareType_Aula;
default: return HardwareType_Undefined;
}
}
@@ -371,7 +371,7 @@ namespace ams::fuse {
case HardwareType_Iowa:
case HardwareType_Hoag:
case HardwareType_Calcio:
case HardwareType_Five:
case HardwareType_Aula:
return SocType_Mariko;
default:
return SocType_Undefined;

View File

@@ -16,7 +16,7 @@ CFLAGS := $(ATMOSPHERE_CFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
CXXFLAGS := $(CFLAGS) $(ATMOSPHERE_CXXFLAGS) -fno-use-cxa-atexit -flto
ASFLAGS := $(ATMOSPHERE_ASFLAGS) $(SETTINGS) $(DEFINES) $(INCLUDE)
SOURCES += $(call ALL_SOURCE_DIRS,../libvapours/source)
SOURCES += $(foreach v,$(call ALL_SOURCE_DIRS,../libvapours/source),$(if $(findstring ../libvapours/source/sdmmc,$v),,$v))
LIBS :=

View File

@@ -690,12 +690,7 @@ namespace ams::kern::arch::arm64::init {
}
ALWAYS_INLINE void InitializeFromState(uintptr_t state_val) {
if (kern::GetTargetFirmware() >= ams::TargetFirmware_10_0_0) {
m_state = *reinterpret_cast<State *>(state_val);
} else {
m_state.next_address = state_val;
m_state.free_bitmap = 0;
}
m_state = *reinterpret_cast<State *>(state_val);
}
ALWAYS_INLINE void GetFinalState(State *out) {

View File

@@ -184,14 +184,13 @@ namespace ams::kern {
constexpr inline const auto KMemoryRegionType_DramReservedEarly = KMemoryRegionType_DramReservedBase.DeriveAttribute(KMemoryRegionAttr_NoUserMap);
static_assert(KMemoryRegionType_DramReservedEarly.GetValue() == (0x16 | KMemoryRegionAttr_NoUserMap));
/* UNUSED: DeriveSparse(0, 3, 0); */
constexpr inline const auto KMemoryRegionType_KernelTraceBuffer = KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 0).SetAttribute(KMemoryRegionAttr_LinearMapped).SetAttribute(KMemoryRegionAttr_UserReadOnly);
constexpr inline const auto KMemoryRegionType_OnMemoryBootImage = KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 1);
constexpr inline const auto KMemoryRegionType_DTB = KMemoryRegionType_DramReservedBase.DeriveSparse(0, 3, 2);
static_assert(KMemoryRegionType_KernelTraceBuffer.GetValue() == (0xD6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_UserReadOnly));
static_assert(KMemoryRegionType_OnMemoryBootImage.GetValue() == 0x156);
static_assert(KMemoryRegionType_DTB.GetValue() == 0x256);
constexpr inline const auto KMemoryRegionType_KernelTraceBuffer = KMemoryRegionType_DramHeapBase.DeriveTransition(1, 3).SetAttribute(KMemoryRegionAttr_UserReadOnly);
static_assert(KMemoryRegionType_KernelTraceBuffer.GetValue() == (0xA6 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_UserReadOnly));
constexpr inline const auto KMemoryRegionType_DramPoolPartition = KMemoryRegionType_DramHeapBase.DeriveAttribute(KMemoryRegionAttr_NoUserMap);
static_assert(KMemoryRegionType_DramPoolPartition.GetValue() == (0x26 | KMemoryRegionAttr_LinearMapped | KMemoryRegionAttr_NoUserMap));

View File

@@ -100,6 +100,13 @@ namespace ams::kern {
/* Insert blocks into the tree. */
MESOSPHERE_INIT_ABORT_UNLESS(KMemoryLayout::GetPhysicalMemoryRegionTree().Insert(GetInteger(physical_memory_base_address), intended_memory_size, KMemoryRegionType_Dram));
MESOSPHERE_INIT_ABORT_UNLESS(KMemoryLayout::GetPhysicalMemoryRegionTree().Insert(GetInteger(physical_memory_base_address), ReservedEarlyDramSize, KMemoryRegionType_DramReservedEarly));
/* Insert the KTrace block at the end of Dram, if KTrace is enabled. */
static_assert(!IsKTraceEnabled || KTraceBufferSize > 0);
if constexpr (IsKTraceEnabled) {
const KPhysicalAddress ktrace_buffer_phys_addr = physical_memory_base_address + intended_memory_size - KTraceBufferSize;
MESOSPHERE_INIT_ABORT_UNLESS(KMemoryLayout::GetPhysicalMemoryRegionTree().Insert(GetInteger(ktrace_buffer_phys_addr), KTraceBufferSize, KMemoryRegionType_KernelTraceBuffer));
}
}
void SetupPoolPartitionMemoryRegions() {

View File

@@ -77,7 +77,7 @@ namespace ams::kern {
void KServerPort::Destroy() {
/* Note with our parent that we're closed. */
m_parent->OnClientClosed();
m_parent->OnServerClosed();
/* Perform necessary cleanup of our session lists. */
this->CleanupSessions();

View File

@@ -18,7 +18,7 @@
#include <stratosphere/gpio/gpio_types.hpp>
#include <stratosphere/gpio/driver/gpio_i_gpio_driver.hpp>
namespace ams::gpio::driver::board::nintendo_nx {
namespace ams::gpio::driver::board::nintendo::nx {
void Initialize(bool enable_interrupt_handlers);

View File

@@ -22,11 +22,11 @@
#if defined(ATMOSPHERE_BOARD_NINTENDO_NX)
#include <stratosphere/gpio/driver/board/nintendo_nx/gpio_driver_api.hpp>
#include <stratosphere/gpio/driver/board/nintendo/nx/gpio_driver_api.hpp>
namespace ams::gpio::driver::board {
using namespace ams::gpio::driver::board::nintendo_nx;
using namespace ams::gpio::driver::board::nintendo::nx;
}

View File

@@ -17,7 +17,7 @@
#include <vapours.hpp>
#include <stratosphere/i2c/i2c_types.hpp>
namespace ams::i2c::driver::board::nintendo_nx {
namespace ams::i2c::driver::board::nintendo::nx {
void Initialize();

View File

@@ -21,11 +21,11 @@
#if defined(ATMOSPHERE_BOARD_NINTENDO_NX)
#include <stratosphere/i2c/driver/board/nintendo_nx/i2c_driver_api.hpp>
#include <stratosphere/i2c/driver/board/nintendo/nx/i2c_driver_api.hpp>
namespace ams::i2c::driver::board {
using namespace ams::i2c::driver::board::nintendo_nx;
using namespace ams::i2c::driver::board::nintendo::nx;
}

View File

@@ -17,7 +17,7 @@
#include <vapours.hpp>
#include <stratosphere/pwm/pwm_types.hpp>
namespace ams::pwm::driver::board::nintendo_nx {
namespace ams::pwm::driver::board::nintendo::nx {
void Initialize();

View File

@@ -20,11 +20,11 @@
#if defined(ATMOSPHERE_BOARD_NINTENDO_NX)
#include <stratosphere/pwm/driver/board/nintendo_nx/pwm_driver_api.hpp>
#include <stratosphere/pwm/driver/board/nintendo/nx/pwm_driver_api.hpp>
namespace ams::pwm::driver::board {
using namespace ams::pwm::driver::board::nintendo_nx;
using namespace ams::pwm::driver::board::nintendo::nx;
}

View File

@@ -128,10 +128,6 @@ namespace ams::sf::hipc {
os::Mutex waitlist_mutex;
os::WaitableManagerType waitlist;
os::Mutex deferred_session_mutex;
using DeferredSessionList = typename util::IntrusiveListMemberTraits<&ServerSession::deferred_list_node>::ListType;
DeferredSessionList deferred_session_list;
private:
virtual void RegisterSessionToWaitList(ServerSession *session) override final;
void RegisterToWaitList(os::WaitableHolderType *holder);
@@ -143,8 +139,6 @@ namespace ams::sf::hipc {
Result ProcessForMitmServer(os::WaitableHolderType *holder);
Result ProcessForSession(os::WaitableHolderType *holder);
void ProcessDeferredSessions();
template<typename Interface, auto MakeShared>
void RegisterServerImpl(Handle port_handle, sm::ServiceName service_name, bool managed, cmif::ServiceObjectHolder &&static_holder) {
/* Allocate server memory. */
@@ -176,7 +170,7 @@ namespace ams::sf::hipc {
ServerManagerBase(DomainEntryStorage *entry_storage, size_t entry_count) :
ServerDomainSessionManager(entry_storage, entry_count),
request_stop_event(os::EventClearMode_ManualClear), notify_event(os::EventClearMode_ManualClear),
waitable_selection_mutex(false), waitlist_mutex(false), deferred_session_mutex(false)
waitable_selection_mutex(false), waitlist_mutex(false)
{
/* Link waitables. */
os::InitializeWaitableManager(std::addressof(this->waitable_manager));

View File

@@ -45,7 +45,6 @@ namespace ams::sf::hipc {
NON_COPYABLE(ServerSession);
NON_MOVEABLE(ServerSession);
private:
util::IntrusiveListNode deferred_list_node;
cmif::ServiceObjectHolder srv_obj_holder;
cmif::PointerAndSize pointer_buffer;
cmif::PointerAndSize saved_message;

View File

@@ -106,12 +106,12 @@ namespace ams::spl {
}
enum class HardwareType {
Icosa = 0,
Copper = 1,
Hoag = 2,
Iowa = 3,
Calcio = 4,
_Five_ = 5,
Icosa = 0,
Copper = 1,
Hoag = 2,
Iowa = 3,
Calcio = 4,
Aula = 5,
};
enum SocType {

View File

@@ -18,11 +18,11 @@
#include "impl/gpio_initial_config.hpp"
#include "impl/gpio_tegra_pad.hpp"
namespace ams::gpio::driver::board::nintendo_nx {
namespace ams::gpio::driver::board::nintendo::nx {
namespace {
ams::gpio::driver::board::nintendo_nx::impl::DriverImpl *g_driver_impl = nullptr;
ams::gpio::driver::board::nintendo::nx::impl::DriverImpl *g_driver_impl = nullptr;
}
@@ -38,7 +38,7 @@ namespace ams::gpio::driver::board::nintendo_nx {
AMS_ABORT_UNLESS(driver_storage != nullptr);
/* Construct the new driver. */
g_driver_impl = new (driver_storage) ams::gpio::driver::board::nintendo_nx::impl::DriverImpl(impl::GpioRegistersPhysicalAddress, impl::GpioRegistersSize);
g_driver_impl = new (driver_storage) ams::gpio::driver::board::nintendo::nx::impl::DriverImpl(impl::GpioRegistersPhysicalAddress, impl::GpioRegistersSize);
/* Register the driver. */
gpio::driver::RegisterDriver(g_driver_impl);

View File

@@ -17,7 +17,7 @@
#include "gpio_driver_impl.hpp"
#include "gpio_register_accessor.hpp"
namespace ams::gpio::driver::board::nintendo_nx::impl {
namespace ams::gpio::driver::board::nintendo::nx::impl {
void InterruptEventHandler::Initialize(DriverImpl *drv, os::InterruptName intr, int ctlr) {
/* Set fields. */

View File

@@ -20,7 +20,7 @@
#include "gpio_register_accessor.hpp"
#include "gpio_suspend_handler.hpp"
namespace ams::gpio::driver::board::nintendo_nx::impl {
namespace ams::gpio::driver::board::nintendo::nx::impl {
class DriverImpl;
@@ -43,7 +43,7 @@ namespace ams::gpio::driver::board::nintendo_nx::impl {
class DriverImpl : public ::ams::gpio::driver::IGpioDriver {
NON_COPYABLE(DriverImpl);
NON_MOVEABLE(DriverImpl);
AMS_DDSF_CASTABLE_TRAITS(ams::gpio::driver::board::nintendo_nx::impl::DriverImpl, ::ams::gpio::driver::IGpioDriver);
AMS_DDSF_CASTABLE_TRAITS(ams::gpio::driver::board::nintendo::nx::impl::DriverImpl, ::ams::gpio::driver::IGpioDriver);
friend class InterruptEventHandler;
private:
dd::PhysicalAddress gpio_physical_address;

View File

@@ -18,7 +18,7 @@
#include "gpio_initial_config.hpp"
#include "gpio_wake_pin_config.hpp"
namespace ams::gpio::driver::board::nintendo_nx::impl {
namespace ams::gpio::driver::board::nintendo::nx::impl {
namespace {
@@ -36,14 +36,14 @@ namespace ams::gpio::driver::board::nintendo_nx::impl {
#include "gpio_initial_wake_pin_config_hoag.inc"
#include "gpio_initial_wake_pin_config_iowa.inc"
#include "gpio_initial_wake_pin_config_calcio.inc"
#include "gpio_initial_wake_pin_config_five.inc"
#include "gpio_initial_wake_pin_config_aula.inc"
#include "gpio_initial_config_icosa.inc"
/* #include "gpio_initial_config_copper.inc" */
#include "gpio_initial_config_hoag.inc"
#include "gpio_initial_config_iowa.inc"
#include "gpio_initial_config_calcio.inc"
#include "gpio_initial_config_five.inc"
#include "gpio_initial_config_aula.inc"
}
@@ -70,9 +70,9 @@ namespace ams::gpio::driver::board::nintendo_nx::impl {
configs = InitialGpioConfigsCalcio;
num_configs = NumInitialGpioConfigsCalcio;
break;
case spl::HardwareType::_Five_:
configs = InitialGpioConfigsFive;
num_configs = NumInitialGpioConfigsFive;
case spl::HardwareType::Aula:
configs = InitialGpioConfigsAula;
num_configs = NumInitialGpioConfigsAula;
break;
case spl::HardwareType::Copper:
AMS_UNREACHABLE_DEFAULT_CASE();
@@ -151,9 +151,9 @@ namespace ams::gpio::driver::board::nintendo_nx::impl {
configs = InitialWakePinConfigsCalcio;
num_configs = NumInitialWakePinConfigsCalcio;
break;
case spl::HardwareType::_Five_:
configs = InitialWakePinConfigsFive;
num_configs = NumInitialWakePinConfigsFive;
case spl::HardwareType::Aula:
configs = InitialWakePinConfigsAula;
num_configs = NumInitialWakePinConfigsAula;
break;
case spl::HardwareType::Copper:
AMS_UNREACHABLE_DEFAULT_CASE();

View File

@@ -16,7 +16,7 @@
#pragma once
#include <stratosphere.hpp>
namespace ams::gpio::driver::board::nintendo_nx::impl {
namespace ams::gpio::driver::board::nintendo::nx::impl {
struct GpioInitialConfig {
DeviceCode device_code;

View File

@@ -16,7 +16,7 @@
/* NOTE: This file is auto-generated by gpio_pad_gen.py, do not edit manually. */
constexpr inline const GpioInitialConfig InitialGpioConfigsFive[] = {
constexpr inline const GpioInitialConfig InitialGpioConfigsAula[] = {
{ DeviceCode_GameCardReset, Direction_Output, GpioValue_Low },
{ DeviceCode_CodecAlert, Direction_Input, GpioValue_Low },
{ DeviceCode_Debug0, Direction_Output, GpioValue_Low },
@@ -67,4 +67,4 @@ constexpr inline const GpioInitialConfig InitialGpioConfigsFive[] = {
{ DeviceCode_ExtconChgS, Direction_Output, GpioValue_Low },
};
constexpr inline size_t NumInitialGpioConfigsFive = util::size(InitialGpioConfigsFive);
constexpr inline size_t NumInitialGpioConfigsAula = util::size(InitialGpioConfigsAula);

View File

@@ -16,7 +16,7 @@
/* NOTE: This file is auto-generated by wake_pin_gen.py, do not edit manually. */
constexpr inline const WakePinConfig InitialWakePinConfigsFive[] = {
constexpr inline const WakePinConfig InitialWakePinConfigsAula[] = {
{ ams::wec::WakeEvent_PexWakeN, false, ams::wec::WakeEventLevel_Auto },
{ ams::wec::WakeEvent_GpioPortA6, false, ams::wec::WakeEventLevel_Auto },
{ ams::wec::WakeEvent_QspiCsN, false, ams::wec::WakeEventLevel_Auto },
@@ -77,4 +77,4 @@ constexpr inline const WakePinConfig InitialWakePinConfigsFive[] = {
{ ams::wec::WakeEvent_MotionInt, false, ams::wec::WakeEventLevel_Auto },
};
constexpr inline size_t NumInitialWakePinConfigsFive = util::size(InitialWakePinConfigsFive);
constexpr inline size_t NumInitialWakePinConfigsAula = util::size(InitialWakePinConfigsAula);

View File

@@ -18,7 +18,7 @@
#include "gpio_tegra_pad.hpp"
namespace ams::gpio::driver::board::nintendo_nx::impl {
namespace ams::gpio::driver::board::nintendo::nx::impl {
constexpr inline dd::PhysicalAddress GpioRegistersPhysicalAddress = 0x6000D000;
constexpr inline size_t GpioRegistersSize = 4_KB;

View File

@@ -16,7 +16,7 @@
#include <stratosphere.hpp>
#include "gpio_suspend_handler.hpp"
namespace ams::gpio::driver::board::nintendo_nx::impl {
namespace ams::gpio::driver::board::nintendo::nx::impl {
void SuspendHandler::Initialize(uintptr_t gpio_vaddr) {
/* Set our gpio virtual address. */

View File

@@ -18,7 +18,7 @@
#include "gpio_tegra_pad.hpp"
namespace ams::gpio::driver::board::nintendo_nx::impl {
namespace ams::gpio::driver::board::nintendo::nx::impl {
class SuspendHandler {
NON_COPYABLE(SuspendHandler);

View File

@@ -16,7 +16,7 @@
#pragma once
#include <stratosphere.hpp>
namespace ams::gpio::driver::board::nintendo_nx::impl {
namespace ams::gpio::driver::board::nintendo::nx::impl {
enum GpioPadPort {
GpioPadPort_A = 0,
@@ -347,7 +347,7 @@ namespace ams::gpio::driver::board::nintendo_nx::impl {
};
class TegraPad : public ::ams::gpio::driver::Pad {
AMS_DDSF_CASTABLE_TRAITS(ams::gpio::driver::board::nintendo_nx::impl::TegraPad, ::ams::gpio::driver::Pad);
AMS_DDSF_CASTABLE_TRAITS(ams::gpio::driver::board::nintendo::nx::impl::TegraPad, ::ams::gpio::driver::Pad);
private:
using Base = ::ams::gpio::driver::Pad;
private:

View File

@@ -16,7 +16,7 @@
#pragma once
#include <stratosphere.hpp>
namespace ams::gpio::driver::board::nintendo_nx::impl {
namespace ams::gpio::driver::board::nintendo::nx::impl {
struct WakePinConfig {
wec::WakeEvent wake_event;

View File

@@ -17,7 +17,7 @@
#include "impl/i2c_bus_manager.hpp"
#include "impl/i2c_device_property_manager.hpp"
namespace ams::i2c::driver::board::nintendo_nx {
namespace ams::i2c::driver::board::nintendo::nx {
namespace {

View File

@@ -16,7 +16,7 @@
#include <stratosphere.hpp>
#include "i2c_bus_accessor.hpp"
namespace ams::i2c::driver::board::nintendo_nx::impl {
namespace ams::i2c::driver::board::nintendo::nx::impl {
namespace {

View File

@@ -17,12 +17,12 @@
#include <stratosphere.hpp>
#include "i2c_i2c_registers.hpp"
namespace ams::i2c::driver::board::nintendo_nx::impl {
namespace ams::i2c::driver::board::nintendo::nx::impl {
class I2cBusAccessor : public ::ams::i2c::driver::II2cDriver {
NON_COPYABLE(I2cBusAccessor);
NON_MOVEABLE(I2cBusAccessor);
AMS_DDSF_CASTABLE_TRAITS(ams::i2c::driver::board::nintendo_nx::impl::I2cBusAccessor, ::ams::i2c::driver::II2cDriver);
AMS_DDSF_CASTABLE_TRAITS(ams::i2c::driver::board::nintendo::nx::impl::I2cBusAccessor, ::ams::i2c::driver::II2cDriver);
private:
enum class State {
NotInitialized = 0,

View File

@@ -18,7 +18,7 @@
#include "i2c_bus_accessor.hpp"
#include "i2c_i_allocator.hpp"
namespace ams::i2c::driver::board::nintendo_nx::impl {
namespace ams::i2c::driver::board::nintendo::nx::impl {
class I2cBusAccessorManager : public IAllocator<I2cBusAccessor::BusAccessorList> {
/* ... */

View File

@@ -17,7 +17,7 @@
#include <stratosphere.hpp>
#include "i2c_i_allocator.hpp"
namespace ams::i2c::driver::board::nintendo_nx::impl {
namespace ams::i2c::driver::board::nintendo::nx::impl {
class I2cDevicePropertyManager : public IAllocator<I2cDeviceProperty::DevicePropertyList> {
/* ... */

View File

@@ -16,7 +16,7 @@
#pragma once
#include <stratosphere.hpp>
namespace ams::i2c::driver::board::nintendo_nx::impl {
namespace ams::i2c::driver::board::nintendo::nx::impl {
struct I2cRegisters {
volatile u32 cnfg;

View File

@@ -16,7 +16,7 @@
#pragma once
#include <stratosphere.hpp>
namespace ams::i2c::driver::board::nintendo_nx::impl {
namespace ams::i2c::driver::board::nintendo::nx::impl {
template<typename ListType>
class IAllocator {

View File

@@ -18,7 +18,7 @@
#include "pinmux_board_driver_api.hpp"
#include "pinmux_platform_pads.hpp"
namespace ams::pinmux::driver::board::nintendo_nx {
namespace ams::pinmux::driver::board::nintendo::nx {
namespace {
@@ -28,7 +28,7 @@ namespace ams::pinmux::driver::board::nintendo_nx {
#include "pinmux_initial_pad_config_hoag.inc"
#include "pinmux_initial_pad_config_iowa.inc"
#include "pinmux_initial_pad_config_calcio.inc"
#include "pinmux_initial_pad_config_five.inc"
#include "pinmux_initial_pad_config_aula.inc"
#include "pinmux_initial_drive_pad_config.inc"
#include "pinmux_initial_drive_pad_config_hoag.inc"
@@ -73,9 +73,9 @@ namespace ams::pinmux::driver::board::nintendo_nx {
num_configs = NumPinmuxPadConfigsCalcio;
is_mariko = true;
break;
case spl::HardwareType::_Five_:
configs = PinmuxPadConfigsFive;
num_configs = NumPinmuxPadConfigsFive;
case spl::HardwareType::Aula:
configs = PinmuxPadConfigsAula;
num_configs = NumPinmuxPadConfigsAula;
is_mariko = true;
break;
AMS_UNREACHABLE_DEFAULT_CASE();
@@ -121,7 +121,7 @@ namespace ams::pinmux::driver::board::nintendo_nx {
configs = PinmuxDrivePadConfigs;
num_configs = NumPinmuxDrivePadConfigs;
break;
case spl::HardwareType::_Five_:
case spl::HardwareType::Aula:
configs = PinmuxDrivePadConfigs;
num_configs = NumPinmuxDrivePadConfigs;
break;

View File

@@ -16,7 +16,7 @@
#pragma once
#include <stratosphere.hpp>
namespace ams::pinmux::driver::board::nintendo_nx {
namespace ams::pinmux::driver::board::nintendo::nx {
bool IsInitialized();

View File

@@ -16,7 +16,7 @@
/* NOTE: This file is auto-generated by pinmux_initial_config.py, do not edit manually. */
constexpr inline const PinmuxPadConfig PinmuxPadConfigsFive[] = {
constexpr inline const PinmuxPadConfig PinmuxPadConfigsAula[] = {
{ PinmuxPadIndex_AudMclk, 0x00000000, 0x0000007F },
{ PinmuxPadIndex_Dap1Din, 0x00000028, 0x0000007F },
{ PinmuxPadIndex_Dap1Dout, 0x00000000, 0x0000007F },
@@ -193,4 +193,4 @@ constexpr inline const PinmuxPadConfig PinmuxPadConfigsFive[] = {
{ PinmuxPadIndex_HdmiCec, 0x00000005, 0x00000007 },
};
constexpr inline const size_t NumPinmuxPadConfigsFive = util::size(PinmuxPadConfigsFive);
constexpr inline const size_t NumPinmuxPadConfigsAula = util::size(PinmuxPadConfigsAula);

View File

@@ -18,7 +18,7 @@
#include "pinmux_board_driver_api.hpp"
#include "pinmux_platform_pads.hpp"
namespace ams::pinmux::driver::board::nintendo_nx {
namespace ams::pinmux::driver::board::nintendo::nx {
namespace {

View File

@@ -16,7 +16,7 @@
#pragma once
#include <stratosphere.hpp>
namespace ams::pinmux::driver::board::nintendo_nx {
namespace ams::pinmux::driver::board::nintendo::nx {
struct PinmuxPadConfig {
u32 index;

View File

@@ -18,9 +18,9 @@
#if defined(ATMOSPHERE_BOARD_NINTENDO_NX)
#include "board/nintendo_nx/pinmux_board_driver_api.hpp"
#include "board/nintendo/nx/pinmux_board_driver_api.hpp"
namespace ams::pinmux::driver::board {
using namespace ams::pinmux::driver::board::nintendo_nx;
using namespace ams::pinmux::driver::board::nintendo::nx;
}
#else

View File

@@ -63,8 +63,8 @@ namespace ams::powctl::driver::impl {
} else if (battery_version == 1) {
return ChargeParametersForBatteryVersion1;
} else {
if (spl::GetHardwareType() == spl::HardwareType::_Five_) {
return ChargeParametersForBatteryVersion0ForFive;
if (spl::GetHardwareType() == spl::HardwareType::Aula) {
return ChargeParametersForBatteryVersion0ForAula;
} else {
return ChargeParametersForBatteryVersion0;
}

View File

@@ -51,7 +51,7 @@ constexpr inline const ChargeParametersRule ChargeParametersRulesForBatteryVersi
{ BatteryTemperatureLevel::TooHigh, 4080, Max, Min, Max, Min, Max, AcceptablePowerStates, util::size(AcceptablePowerStates), false, false, 4320, 1664, 0, 0 },
};
constexpr inline const ChargeParametersRule ChargeParametersRulesForBatteryVersion0ForFive[] = {
constexpr inline const ChargeParametersRule ChargeParametersRulesForBatteryVersion0ForAula[] = {
{ BatteryTemperatureLevel::TooLow, Min, Max, Min, Max, Min, Max, AcceptablePowerStates, util::size(AcceptablePowerStates), false, false, 4208, 768, 0, 0 },
{ BatteryTemperatureLevel::Low, Min, Max, Min, Max, Min, Max, AcceptablePowerStates, util::size(AcceptablePowerStates), false, true, 4208, 768, 0, 0 },
{ BatteryTemperatureLevel::Medium, Min, Max, Min, 4001, 2049, Max, AcceptablePowerStatesForNotAwakeCharge, util::size(AcceptablePowerStatesForNotAwakeCharge), true, true, 4000, 3072, 40, 112 },
@@ -74,6 +74,6 @@ constexpr inline const ChargeParameters ChargeParametersForBatteryVersion2 = {
1, 19, 48, 59, 1664, 4320, UnknownXTableForBatteryVersion2, util::size(UnknownXTableForBatteryVersion2), 95.0, 100.4, ChargeParametersRulesForBatteryVersion2, util::size(ChargeParametersRulesForBatteryVersion2)
};
constexpr inline const ChargeParameters ChargeParametersForBatteryVersion0ForFive = {
4, 17, 51, 60, 512, 4208, nullptr, 0, 95.0, 99.0, ChargeParametersRulesForBatteryVersion0ForFive, util::size(ChargeParametersRulesForBatteryVersion0ForFive)
constexpr inline const ChargeParameters ChargeParametersForBatteryVersion0ForAula = {
4, 17, 51, 60, 512, 4208, nullptr, 0, 95.0, 99.0, ChargeParametersRulesForBatteryVersion0ForAula, util::size(ChargeParametersRulesForBatteryVersion0ForAula)
};

View File

@@ -14,12 +14,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "../../powctl_device_management.hpp"
#include "../../../powctl_device_management.hpp"
#include "powctl_retry_helper.hpp"
#include "powctl_battery_driver.hpp"
#include "powctl_max17050_driver.hpp"
namespace ams::powctl::impl::board::nintendo_nx {
namespace ams::powctl::impl::board::nintendo::nx {
namespace {

View File

@@ -15,15 +15,15 @@
*/
#pragma once
#include <stratosphere.hpp>
#include "../../powctl_i_power_control_driver.hpp"
#include "../../../powctl_i_power_control_driver.hpp"
#include "powctl_interrupt_event_handler.hpp"
namespace ams::powctl::impl::board::nintendo_nx {
namespace ams::powctl::impl::board::nintendo::nx {
class BatteryDevice : public powctl::impl::IDevice {
NON_COPYABLE(BatteryDevice);
NON_MOVEABLE(BatteryDevice);
AMS_DDSF_CASTABLE_TRAITS(ams::powctl::impl::board::nintendo_nx::BatteryDevice, ::ams::powctl::impl::IDevice);
AMS_DDSF_CASTABLE_TRAITS(ams::powctl::impl::board::nintendo::nx::BatteryDevice, ::ams::powctl::impl::IDevice);
private:
bool use_event_handler;
std::optional<BatteryInterruptEventHandler> event_handler;
@@ -43,7 +43,7 @@ namespace ams::powctl::impl::board::nintendo_nx {
class BatteryDriver : public IPowerControlDriver {
NON_COPYABLE(BatteryDriver);
NON_MOVEABLE(BatteryDriver);
AMS_DDSF_CASTABLE_TRAITS(ams::powctl::impl::board::nintendo_nx::BatteryDriver, ::ams::powctl::impl::IPowerControlDriver);
AMS_DDSF_CASTABLE_TRAITS(ams::powctl::impl::board::nintendo::nx::BatteryDriver, ::ams::powctl::impl::IPowerControlDriver);
public:
BatteryDriver(bool ev) : IPowerControlDriver(ev) { /* ... */ }

View File

@@ -14,12 +14,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "../../powctl_device_management.hpp"
#include "../../../powctl_device_management.hpp"
#include "powctl_board_impl.hpp"
#include "powctl_battery_driver.hpp"
#include "powctl_charger_driver.hpp"
namespace ams::powctl::impl::board::nintendo_nx {
namespace ams::powctl::impl::board::nintendo::nx {
namespace {

View File

@@ -18,7 +18,7 @@
#include "powctl_interrupt_event_handler.hpp"
namespace ams::powctl::impl::board::nintendo_nx {
namespace ams::powctl::impl::board::nintendo::nx {
void Initialize(bool use_event_handlers);
void Finalize();

View File

@@ -16,7 +16,7 @@
#include <stratosphere.hpp>
#include "powctl_bq24193_driver.hpp"
namespace ams::powctl::impl::board::nintendo_nx {
namespace ams::powctl::impl::board::nintendo::nx {
namespace bq24193 {

View File

@@ -16,7 +16,7 @@
#pragma once
#include <stratosphere.hpp>
namespace ams::powctl::impl::board::nintendo_nx {
namespace ams::powctl::impl::board::nintendo::nx {
namespace bq24193 {

View File

@@ -14,12 +14,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <stratosphere.hpp>
#include "../../powctl_device_management.hpp"
#include "../../../powctl_device_management.hpp"
#include "powctl_retry_helper.hpp"
#include "powctl_charger_driver.hpp"
#include "powctl_bq24193_driver.hpp"
namespace ams::powctl::impl::board::nintendo_nx {
namespace ams::powctl::impl::board::nintendo::nx {
namespace {

View File

@@ -15,15 +15,15 @@
*/
#pragma once
#include <stratosphere.hpp>
#include "../../powctl_i_power_control_driver.hpp"
#include "../../../powctl_i_power_control_driver.hpp"
#include "powctl_interrupt_event_handler.hpp"
namespace ams::powctl::impl::board::nintendo_nx {
namespace ams::powctl::impl::board::nintendo::nx {
class ChargerDevice : public powctl::impl::IDevice {
NON_COPYABLE(ChargerDevice);
NON_MOVEABLE(ChargerDevice);
AMS_DDSF_CASTABLE_TRAITS(ams::powctl::impl::board::nintendo_nx::ChargerDevice, ::ams::powctl::impl::IDevice);
AMS_DDSF_CASTABLE_TRAITS(ams::powctl::impl::board::nintendo::nx::ChargerDevice, ::ams::powctl::impl::IDevice);
private:
gpio::GpioPadSession gpio_pad_session;
bool watchdog_timer_enabled;
@@ -54,7 +54,7 @@ namespace ams::powctl::impl::board::nintendo_nx {
class ChargerDriver : public IPowerControlDriver {
NON_COPYABLE(ChargerDriver);
NON_MOVEABLE(ChargerDriver);
AMS_DDSF_CASTABLE_TRAITS(ams::powctl::impl::board::nintendo_nx::ChargerDriver, ::ams::powctl::impl::IPowerControlDriver);
AMS_DDSF_CASTABLE_TRAITS(ams::powctl::impl::board::nintendo::nx::ChargerDriver, ::ams::powctl::impl::IPowerControlDriver);
public:
ChargerDriver(bool ev) : IPowerControlDriver(ev) { /* ... */ }

View File

@@ -16,7 +16,7 @@
#include <stratosphere.hpp>
#include "powctl_interrupt_event_handler.hpp"
namespace ams::powctl::impl::board::nintendo_nx {
namespace ams::powctl::impl::board::nintendo::nx {
void ChargerInterruptEventHandler::SignalEvent(IDevice *device) {
/* TODO */

View File

@@ -15,9 +15,9 @@
*/
#pragma once
#include <stratosphere.hpp>
#include "../../powctl_i_power_control_driver.hpp"
#include "../../../powctl_i_power_control_driver.hpp"
namespace ams::powctl::impl::board::nintendo_nx {
namespace ams::powctl::impl::board::nintendo::nx {
template<typename Derived>
class InterruptEventHandler : public ddsf::IEventHandler {

View File

@@ -20,7 +20,7 @@
#include <arm_neon.h>
#endif
namespace ams::powctl::impl::board::nintendo_nx {
namespace ams::powctl::impl::board::nintendo::nx {
namespace max17050 {

View File

@@ -16,7 +16,7 @@
#pragma once
#include <stratosphere.hpp>
namespace ams::powctl::impl::board::nintendo_nx {
namespace ams::powctl::impl::board::nintendo::nx {
namespace max17050 {

View File

@@ -19,10 +19,10 @@
#if defined(ATMOSPHERE_BOARD_NINTENDO_NX)
#include "board/nintendo_nx/powctl_board_impl.hpp"
#include "board/nintendo/nx/powctl_board_impl.hpp"
namespace ams::powctl::impl::board {
using namespace ams::powctl::impl::board::nintendo_nx;
using namespace ams::powctl::impl::board::nintendo::nx;
}
#else

View File

@@ -17,7 +17,7 @@
#include "pwm_impl_pwm_driver_api.hpp"
#include "pwm_pwm_driver_impl.hpp"
namespace ams::pwm::driver::board::nintendo_nx::impl {
namespace ams::pwm::driver::board::nintendo::nx::impl {
namespace {

View File

@@ -16,7 +16,7 @@
#pragma once
#include <stratosphere.hpp>
namespace ams::pwm::driver::board::nintendo_nx::impl {
namespace ams::pwm::driver::board::nintendo::nx::impl {
struct ChannelDefinition {
DeviceCode device_code;

View File

@@ -16,7 +16,7 @@
#include <stratosphere.hpp>
#include "pwm_pwm_driver_impl.hpp"
namespace ams::pwm::driver::board::nintendo_nx::impl {
namespace ams::pwm::driver::board::nintendo::nx::impl {
namespace {

View File

@@ -17,12 +17,12 @@
#include <stratosphere.hpp>
#include "pwm_impl_pwm_driver_api.hpp"
namespace ams::pwm::driver::board::nintendo_nx::impl {
namespace ams::pwm::driver::board::nintendo::nx::impl {
class PwmDeviceImpl : public ::ams::pwm::driver::IPwmDevice {
NON_COPYABLE(PwmDeviceImpl);
NON_MOVEABLE(PwmDeviceImpl);
AMS_DDSF_CASTABLE_TRAITS(ams::pwm::driver::board::nintendo_nx::impl::PwmDeviceImpl, ::ams::pwm::driver::IPwmDevice);
AMS_DDSF_CASTABLE_TRAITS(ams::pwm::driver::board::nintendo::nx::impl::PwmDeviceImpl, ::ams::pwm::driver::IPwmDevice);
private:
os::SdkMutex suspend_mutex;
u32 suspend_value;
@@ -39,7 +39,7 @@ namespace ams::pwm::driver::board::nintendo_nx::impl {
class PwmDriverImpl : public ::ams::pwm::driver::IPwmDriver {
NON_COPYABLE(PwmDriverImpl);
NON_MOVEABLE(PwmDriverImpl);
AMS_DDSF_CASTABLE_TRAITS(ams::pwm::driver::board::nintendo_nx::impl::PwmDriverImpl, ::ams::pwm::driver::IPwmDriver);
AMS_DDSF_CASTABLE_TRAITS(ams::pwm::driver::board::nintendo::nx::impl::PwmDriverImpl, ::ams::pwm::driver::IPwmDriver);
private:
dd::PhysicalAddress registers_phys_addr;
size_t registers_size;

View File

@@ -16,7 +16,7 @@
#include <stratosphere.hpp>
#include "impl/pwm_impl_pwm_driver_api.hpp"
namespace ams::pwm::driver::board::nintendo_nx {
namespace ams::pwm::driver::board::nintendo::nx {
void Initialize() {
R_ABORT_UNLESS(impl::InitializePwmDriver());

View File

@@ -147,62 +147,14 @@ namespace ams::sf::hipc {
return ResultSuccess();
}
void ServerManagerBase::ProcessDeferredSessions() {
/* Iterate over the list of deferred sessions, and see if we can't do anything. */
std::scoped_lock lk(this->deferred_session_mutex);
/* Undeferring a request may undefer another request. We'll continue looping until everything is stable. */
bool needs_undefer_all = true;
while (needs_undefer_all) {
needs_undefer_all = false;
auto it = this->deferred_session_list.begin();
while (it != this->deferred_session_list.end()) {
ServerSession *session = static_cast<ServerSession *>(&*it);
R_TRY_CATCH(this->ProcessForSession(session)) {
R_CATCH(sf::ResultRequestDeferred) {
/* Session is still deferred, so let's continue. */
it++;
continue;
}
R_CATCH(sf::impl::ResultRequestInvalidated) {
/* Session is no longer deferred! */
it = this->deferred_session_list.erase(it);
needs_undefer_all = true;
continue;
}
} R_END_TRY_CATCH_WITH_ABORT_UNLESS;
/* We succeeded! Remove from deferred list. */
it = this->deferred_session_list.erase(it);
needs_undefer_all = true;
}
}
}
Result ServerManagerBase::Process(os::WaitableHolderType *holder) {
switch (static_cast<UserDataTag>(os::GetWaitableHolderUserData(holder))) {
case UserDataTag::Server:
return this->ProcessForServer(holder);
break;
case UserDataTag::MitmServer:
return this->ProcessForMitmServer(holder);
break;
case UserDataTag::Session:
/* Try to process for session. */
R_TRY_CATCH(this->ProcessForSession(holder)) {
R_CATCH(sf::ResultRequestDeferred) {
/* The session was deferred, so push it onto the deferred session list. */
std::scoped_lock lk(this->deferred_session_mutex);
this->deferred_session_list.push_back(*static_cast<ServerSession *>(holder));
return ResultSuccess();
}
} R_END_TRY_CATCH;
/* We successfully invoked a command...so let's see if anything can be undeferred. */
this->ProcessDeferredSessions();
return ResultSuccess();
break;
return this->ProcessForSession(holder);
AMS_UNREACHABLE_DEFAULT_CASE();
}
}

View File

@@ -254,7 +254,7 @@ namespace ams::spl {
return SocType_Erista;
case HardwareType::Hoag:
case HardwareType::Iowa:
case HardwareType::_Five_:
case HardwareType::Aula:
return SocType_Mariko;
AMS_UNREACHABLE_DEFAULT_CASE();
}

View File

@@ -464,7 +464,7 @@ namespace ams::updater {
case spl::HardwareType::Hoag:
case spl::HardwareType::Iowa:
case spl::HardwareType::Calcio:
case spl::HardwareType::_Five_:
case spl::HardwareType::Aula:
return BootImageUpdateType::Mariko;
AMS_UNREACHABLE_DEFAULT_CASE();
}

View File

@@ -57,7 +57,7 @@ namespace ams::svc {
/* This is the highest SVC version supported by Atmosphere, to be updated on new kernel releases. */
/* NOTE: Official kernel versions have SVC major = SDK major + 4, SVC minor = SDK minor. */
constexpr inline u32 SupportedKernelMajorVersion = ConvertToSvcMajorVersion(10);
constexpr inline u32 SupportedKernelMajorVersion = ConvertToSvcMajorVersion(11);
constexpr inline u32 SupportedKernelMinorVersion = ConvertToSvcMinorVersion( 4);
constexpr inline u32 SupportedKernelVersion = EncodeKernelVersion(SupportedKernelMajorVersion, SupportedKernelMinorVersion);

View File

@@ -300,14 +300,6 @@ namespace ams::kern::init {
/* Insert a physical region for the kernel page table heap region */
MESOSPHERE_INIT_ABORT_UNLESS(KMemoryLayout::GetPhysicalMemoryRegionTree().Insert(GetInteger(slab_end_phys_addr), page_table_heap_size, KMemoryRegionType_DramKernelPtHeap));
/* Insert a physical region for the kernel trace buffer. */
static_assert(!IsKTraceEnabled || KTraceBufferSize > 0);
if constexpr (IsKTraceEnabled) {
const auto dram_extents = KMemoryLayout::GetMainMemoryPhysicalExtents();
const KPhysicalAddress ktrace_buffer_phys_addr = dram_extents.GetEndAddress() - KTraceBufferSize;
MESOSPHERE_INIT_ABORT_UNLESS(KMemoryLayout::GetPhysicalMemoryRegionTree().Insert(GetInteger(ktrace_buffer_phys_addr), KTraceBufferSize, KMemoryRegionType_KernelTraceBuffer));
}
/* All DRAM regions that we haven't tagged by this point will be mapped under the linear mapping. Tag them. */
for (auto &region : KMemoryLayout::GetPhysicalMemoryRegionTree()) {
if (region.GetType() == KMemoryRegionType_Dram) {

View File

@@ -0,0 +1,25 @@
/*
* Copyright (c) 2018-2020 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/>.
*/
#include <mesosphere.hpp>
#include "../../../kern_init_loader_board_setup.hpp"
namespace ams::kern::init::loader {
void PerformBoardSpecificSetup() {
/* ... */
}
}

View File

@@ -14,7 +14,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <mesosphere.hpp>
#include "kern_init_loader_asm.hpp"
#include "kern_init_loader_board_setup.hpp"
/* Necessary for calculating kernelldr size/base for initial identity mapping */
extern "C" {
@@ -71,22 +71,6 @@ namespace ams::kern::init::loader {
cpu::InvalidateEntireTlb();
}
#ifdef ATMOSPHERE_BOARD_NINTENDO_NX
ALWAYS_INLINE bool ShouldPerformCpuSpecificSetup() {
/* Perform cpu-specific setup only on < 10.0.0. */
return kern::GetTargetFirmware() < ams::TargetFirmware_10_0_0;
}
#else
consteval ALWAYS_INLINE bool ShouldPerformCpuSpecificSetup() {
/* Always perform cpu-specific setup. */
return true;
}
#endif
void SetupInitialIdentityMapping(KInitialPageTable &ttbr1_table, uintptr_t base_address, uintptr_t kernel_size, uintptr_t page_table_region, size_t page_table_region_size, KInitialPageTable::IPageAllocator &allocator) {
/* Make a new page table for TTBR0_EL1. */
KInitialPageTable ttbr0_table(allocator.Allocate());
@@ -116,72 +100,8 @@ namespace ams::kern::init::loader {
cpu::MemoryAccessIndirectionRegisterAccessor(MairValue).Store();
cpu::TranslationControlRegisterAccessor(TcrValue).Store();
/* Perform cpu-specific setup if needed. */
if (ShouldPerformCpuSpecificSetup()) {
SavedRegisterState saved_registers;
SaveRegistersToTpidrEl1(&saved_registers);
ON_SCOPE_EXIT { VerifyAndClearTpidrEl1(&saved_registers); };
/* Main ID specific setup. */
cpu::MainIdRegisterAccessor midr_el1;
if (midr_el1.GetImplementer() == cpu::MainIdRegisterAccessor::Implementer::ArmLimited) {
/* ARM limited specific setup. */
const auto cpu_primary_part = midr_el1.GetPrimaryPartNumber();
const auto cpu_variant = midr_el1.GetVariant();
const auto cpu_revision = midr_el1.GetRevision();
if (cpu_primary_part == cpu::MainIdRegisterAccessor::PrimaryPartNumber::CortexA57) {
/* Cortex-A57 specific setup. */
/* Non-cacheable load forwarding enabled. */
u64 cpuactlr_value = 0x1000000;
/* Enable the processor to receive instruction cache and TLB maintenance */
/* operations broadcast from other processors in the cluster; */
/* set the L2 load/store data prefetch distance to 8 requests; */
/* set the L2 instruction fetch prefetch distance to 3 requests. */
u64 cpuectlr_value = 0x1B00000040;
/* Disable load-pass DMB on certain hardware variants. */
if (cpu_variant == 0 || (cpu_variant == 1 && cpu_revision <= 1)) {
cpuactlr_value |= 0x800000000000000;
}
/* Set actlr and ectlr. */
if (cpu::GetCpuActlrEl1() != cpuactlr_value) {
cpu::SetCpuActlrEl1(cpuactlr_value);
}
if (cpu::GetCpuEctlrEl1() != cpuectlr_value) {
cpu::SetCpuEctlrEl1(cpuectlr_value);
}
} else if (cpu_primary_part == cpu::MainIdRegisterAccessor::PrimaryPartNumber::CortexA53) {
/* Cortex-A53 specific setup. */
/* Set L1 data prefetch control to allow 5 outstanding prefetches; */
/* enable device split throttle; */
/* set the number of independent data prefetch streams to 2; */
/* disable transient and no-read-allocate hints for loads; */
/* set write streaming no-allocate threshold so the 128th consecutive streaming */
/* cache line does not allocate in the L1 or L2 cache. */
u64 cpuactlr_value = 0x90CA000;
/* Enable hardware management of data coherency with other cores in the cluster. */
u64 cpuectlr_value = 0x40;
/* If supported, enable data cache clean as data cache clean/invalidate. */
if (cpu_variant != 0 || (cpu_variant == 0 && cpu_revision > 2)) {
cpuactlr_value |= 0x100000000000;
}
/* Set actlr and ectlr. */
if (cpu::GetCpuActlrEl1() != cpuactlr_value) {
cpu::SetCpuActlrEl1(cpuactlr_value);
}
if (cpu::GetCpuEctlrEl1() != cpuectlr_value) {
cpu::SetCpuEctlrEl1(cpuectlr_value);
}
}
}
}
/* Perform board-specific setup. */
PerformBoardSpecificSetup();
/* Ensure that the entire cache is flushed. */
EnsureEntireDataCacheFlushed();
@@ -300,10 +220,9 @@ namespace ams::kern::init::loader {
ttbr1_table.Map(virtual_base_address + ro_offset, ro_end_offset - ro_offset, base_address + ro_offset, KernelRwDataAttribute, g_initial_page_allocator);
ttbr1_table.Map(virtual_base_address + rw_offset, bss_end_offset - rw_offset, base_address + rw_offset, KernelRwDataAttribute, g_initial_page_allocator);
/* On 10.0.0+, Physically randomize the kernel region. */
if (kern::GetTargetFirmware() >= ams::TargetFirmware_10_0_0) {
ttbr1_table.PhysicallyRandomize(virtual_base_address + rx_offset, bss_end_offset - rx_offset, true);
}
/* Physically randomize the kernel region. */
/* NOTE: Nintendo does this only on 10.0.0+ */
ttbr1_table.PhysicallyRandomize(virtual_base_address + rx_offset, bss_end_offset - rx_offset, true);
/* Clear kernel .bss. */
std::memset(GetVoidPointer(virtual_base_address + bss_offset), 0, bss_end_offset - bss_offset);
@@ -330,11 +249,7 @@ namespace ams::kern::init::loader {
uintptr_t GetFinalPageAllocatorState() {
g_initial_page_allocator.GetFinalState(std::addressof(g_final_page_allocator_state));
if (kern::GetTargetFirmware() >= ams::TargetFirmware_10_0_0) {
return reinterpret_cast<uintptr_t>(std::addressof(g_final_page_allocator_state));
} else {
return g_final_page_allocator_state.next_address;
}
return reinterpret_cast<uintptr_t>(std::addressof(g_final_page_allocator_state));
}
}

View File

@@ -0,0 +1,93 @@
/*
* Copyright (c) 2018-2020 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/>.
*/
#include <mesosphere.hpp>
#include "kern_init_loader_asm.hpp"
#include "kern_init_loader_board_setup.hpp"
namespace ams::kern::init::loader {
void PerformDefaultAarch64SpecificSetup() {
SavedRegisterState saved_registers;
SaveRegistersToTpidrEl1(std::addressof(saved_registers));
ON_SCOPE_EXIT { VerifyAndClearTpidrEl1(std::addressof(saved_registers)); };
/* Main ID specific setup. */
cpu::MainIdRegisterAccessor midr_el1;
if (midr_el1.GetImplementer() == cpu::MainIdRegisterAccessor::Implementer::ArmLimited) {
/* ARM limited specific setup. */
const auto cpu_primary_part = midr_el1.GetPrimaryPartNumber();
const auto cpu_variant = midr_el1.GetVariant();
const auto cpu_revision = midr_el1.GetRevision();
if (cpu_primary_part == cpu::MainIdRegisterAccessor::PrimaryPartNumber::CortexA57) {
/* Cortex-A57 specific setup. */
/* Non-cacheable load forwarding enabled. */
u64 cpuactlr_value = 0x1000000;
/* Enable the processor to receive instruction cache and TLB maintenance */
/* operations broadcast from other processors in the cluster; */
/* set the L2 load/store data prefetch distance to 8 requests; */
/* set the L2 instruction fetch prefetch distance to 3 requests. */
u64 cpuectlr_value = 0x1B00000040;
/* Disable load-pass DMB on certain hardware variants. */
if (cpu_variant == 0 || (cpu_variant == 1 && cpu_revision <= 1)) {
cpuactlr_value |= 0x800000000000000;
}
/* Set actlr and ectlr. */
if (cpu::GetCpuActlrEl1() != cpuactlr_value) {
cpu::SetCpuActlrEl1(cpuactlr_value);
}
if (cpu::GetCpuEctlrEl1() != cpuectlr_value) {
cpu::SetCpuEctlrEl1(cpuectlr_value);
}
} else if (cpu_primary_part == cpu::MainIdRegisterAccessor::PrimaryPartNumber::CortexA53) {
/* Cortex-A53 specific setup. */
/* Set L1 data prefetch control to allow 5 outstanding prefetches; */
/* enable device split throttle; */
/* set the number of independent data prefetch streams to 2; */
/* disable transient and no-read-allocate hints for loads; */
/* set write streaming no-allocate threshold so the 128th consecutive streaming */
/* cache line does not allocate in the L1 or L2 cache. */
u64 cpuactlr_value = 0x90CA000;
/* Enable hardware management of data coherency with other cores in the cluster. */
u64 cpuectlr_value = 0x40;
/* If supported, enable data cache clean as data cache clean/invalidate. */
if (cpu_variant != 0 || (cpu_variant == 0 && cpu_revision > 2)) {
cpuactlr_value |= 0x100000000000;
}
/* Set actlr and ectlr. */
if (cpu::GetCpuActlrEl1() != cpuactlr_value) {
cpu::SetCpuActlrEl1(cpuactlr_value);
}
if (cpu::GetCpuEctlrEl1() != cpuectlr_value) {
cpu::SetCpuEctlrEl1(cpuectlr_value);
}
}
}
}
/* This is a default implementation, which should be overridden in a source file in board/ */
WEAK_SYMBOL void PerformBoardSpecificSetup() {
return PerformDefaultAarch64SpecificSetup();
}
}

View File

@@ -0,0 +1,27 @@
/*
* Copyright (c) 2018-2020 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 <mesosphere.hpp>
namespace ams::kern::init::loader {
#if defined(ATMOSPHERE_ARCH_ARM64)
void PerformDefaultAarch64SpecificSetup();
#endif
void PerformBoardSpecificSetup();
}

View File

@@ -24,16 +24,6 @@ SFILES := $(call FIND_SOURCE_FILES,$(SOURCES),s)
BINFILES := $(foreach dir,$(DATA),$(notdir $(wildcard $(dir)/*.*))) fusee-primary.bin
#---------------------------------------------------------------------------------
# boot has a custom bin2o rule for fusee-primary -> fusee_primary
#---------------------------------------------------------------------------------
define _bin2o
bin2s $< | $(AS) -o $(@)
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _ | tr - _)`"_end[];" > `(echo $(<F) | tr . _ | tr - _)`.h
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _ | tr - _)`"[];" >> `(echo $(<F) | tr . _ | tr - _)`.h
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _ | tr - _)`_size";" >> `(echo $(<F) | tr . _ | tr - _)`.h
endef
#---------------------------------------------------------------------------------
# use CXX for linking C++ projects, CC for standard C
#---------------------------------------------------------------------------------
@@ -106,17 +96,12 @@ $(OUTPUT).kip : $(OUTPUT).elf
$(OUTPUT).elf : $(OFILES)
boot_power_utils.o: fusee_primary.bin.o fusee_primary_bin.h
boot_power_utils.o: fusee-primary.bin.o
#---------------------------------------------------------------------------------
# you need a rule like this for each extension you use as binary data
#---------------------------------------------------------------------------------
fusee_primary.bin.o fusee_primary_bin.h: fusee-primary.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(_bin2o)
%.bin.o : %.bin
fusee-primary.bin.o: fusee-primary.bin
#---------------------------------------------------------------------------------
@echo $(notdir $<)
@$(bin2o)

Some files were not shown because too many files have changed in this diff Show More