1
0
Fork 0
mirror of https://github.com/Atmosphere-NX/Atmosphere.git synced 2024-11-22 20:06:40 +00:00

boot/powctl/i2c: more miscellaneous fixes

This commit is contained in:
Michael Scire 2020-11-10 05:50:13 -08:00 committed by SciresM
parent affdea9244
commit b62aa044e4
6 changed files with 89 additions and 57 deletions

View file

@ -30,8 +30,16 @@ namespace ams::i2c::driver::board::nintendo_nx::impl {
IAllocator(ams::MemoryResource *mr) : memory_resource(mr), list(), list_lock() { /* ... */ } IAllocator(ams::MemoryResource *mr) : memory_resource(mr), list(), list_lock() { /* ... */ }
~IAllocator() { ~IAllocator() {
/* TODO: Remove all entries, etc */ std::scoped_lock lk(this->list_lock);
AMS_ABORT("BusAccessorManager not destructible");
/* Remove all entries. */
auto it = this->list.begin();
while (it != this->list.end()) {
T *obj = std::addressof(*it);
it = this->list.erase(it);
this->memory_resource->Deallocate(obj, sizeof(T));
}
} }
template<typename ...Args> template<typename ...Args>

View file

@ -42,6 +42,22 @@ namespace ams::powctl::impl::board::nintendo_nx {
powctl::impl::RegisterDriver(std::addressof(*g_battery_driver)); powctl::impl::RegisterDriver(std::addressof(*g_battery_driver));
} }
void FinalizeChargerDriver() {
/* Unregister the driver. */
powctl::impl::UnregisterDriver(std::addressof(*g_charger_driver));
/* Destroy the battery driver. */
g_charger_driver = std::nullopt;
}
void FinalizeBatteryDriver() {
/* Unregister the driver. */
powctl::impl::UnregisterDriver(std::addressof(*g_battery_driver));
/* Destroy the battery driver. */
g_battery_driver = std::nullopt;
}
} }
void Initialize(bool use_event_handlers) { void Initialize(bool use_event_handlers) {
@ -50,8 +66,8 @@ namespace ams::powctl::impl::board::nintendo_nx {
} }
void Finalize() { void Finalize() {
/* TODO */ FinalizeBatteryDriver();
AMS_ABORT(); FinalizeChargerDriver();
} }
} }

View file

@ -85,8 +85,16 @@ namespace ams::powctl::impl {
os::WaitThread(std::addressof(g_interrupt_thread)); os::WaitThread(std::addressof(g_interrupt_thread));
os::DestroyThread(std::addressof(g_interrupt_thread)); os::DestroyThread(std::addressof(g_interrupt_thread));
/* TODO: What else? */ /* Reset all device code entries. */
AMS_ABORT(); GetDeviceCodeEntryManager().Reset();
/* Finalize all registered drivers. */
for (auto &driver : GetDriverList()) {
driver.SafeCastTo<IPowerControlDriver>().FinalizeDriver();
}
/* Finalize the interrupt handler manager. */
GetInterruptHandlerManager().Finalize();
} }
void RegisterDriver(IPowerControlDriver *driver) { void RegisterDriver(IPowerControlDriver *driver) {

View file

@ -35,7 +35,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -49,7 +49,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -63,7 +63,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -77,7 +77,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -91,7 +91,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -105,7 +105,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -119,7 +119,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -133,7 +133,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -147,7 +147,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -161,7 +161,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -175,7 +175,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -189,7 +189,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -203,7 +203,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -217,7 +217,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -231,7 +231,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -245,7 +245,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -259,7 +259,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -273,7 +273,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -287,7 +287,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -301,7 +301,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -315,7 +315,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -329,7 +329,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -343,7 +343,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -357,7 +357,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -371,7 +371,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -385,7 +385,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -399,7 +399,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -413,7 +413,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -427,7 +427,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();

View file

@ -35,7 +35,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -49,7 +49,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -63,7 +63,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -77,7 +77,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -91,7 +91,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -105,7 +105,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -119,7 +119,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -133,7 +133,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -147,7 +147,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -161,7 +161,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -175,7 +175,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -189,7 +189,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -203,7 +203,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -217,7 +217,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -231,7 +231,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -245,7 +245,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -259,7 +259,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -275,7 +275,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -289,7 +289,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -303,7 +303,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Read)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Read), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();
@ -317,7 +317,7 @@ namespace ams::powctl {
auto &impl = GetOpenSessionImpl(session); auto &impl = GetOpenSessionImpl(session);
/* Check the access mode. */ /* Check the access mode. */
R_TRY(impl.CheckAccess(ddsf::AccessMode_Write)); R_UNLESS(impl.CheckAccess(ddsf::AccessMode_Write), ddsf::ResultPermissionDenied());
/* Get the device. */ /* Get the device. */
auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>(); auto &device = impl.GetDevice().SafeCastTo<impl::IDevice>();

View file

@ -530,7 +530,7 @@ namespace ams::boot {
if (g_lcd_vendor == 0x2050) { if (g_lcd_vendor == 0x2050) {
EnableBacklightForVendor2050ForHardwareTypeFive(0); EnableBacklightForVendor2050ForHardwareTypeFive(0);
} else { } else {
pwm::driver::SetEnabled(g_lcd_backlight_session, true); pwm::driver::SetEnabled(g_lcd_backlight_session, false);
pwm::driver::CloseSession(g_lcd_backlight_session); pwm::driver::CloseSession(g_lcd_backlight_session);
} }