mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-06-01 15:28:21 -04:00
boot: save 12KB
This commit is contained in:
parent
afccc35e79
commit
888b35833e
7 changed files with 125 additions and 31 deletions
|
@ -98,11 +98,13 @@ namespace ams::i2c::driver::board::nintendo::nx {
|
|||
}
|
||||
|
||||
void Initialize() {
|
||||
/* TODO: Should these be moved into getters? They're only used here, and they never destruct. */
|
||||
static impl::I2cBusAccessorManager s_bus_accessor_manager(ddsf::GetMemoryResource());
|
||||
static impl::I2cDevicePropertyManager s_device_manager(ddsf::GetMemoryResource());
|
||||
static constinit util::TypedStorage<impl::I2cBusAccessorManager> s_bus_accessor_manager;
|
||||
static constinit util::TypedStorage<impl::I2cDevicePropertyManager> s_device_manager;
|
||||
|
||||
return Initialize(s_bus_accessor_manager, s_device_manager);
|
||||
util::ConstructAt(s_bus_accessor_manager, ddsf::GetMemoryResource());
|
||||
util::ConstructAt(s_device_manager, ddsf::GetMemoryResource());
|
||||
|
||||
return Initialize(util::GetReference(s_bus_accessor_manager), util::GetReference(s_device_manager));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -24,13 +24,25 @@ namespace ams::i2c::driver::impl {
|
|||
constinit int g_init_count = 0;
|
||||
|
||||
i2c::driver::II2cDriver::List &GetI2cDriverList() {
|
||||
static i2c::driver::II2cDriver::List s_driver_list;
|
||||
static constinit i2c::driver::II2cDriver::List s_driver_list;
|
||||
return s_driver_list;
|
||||
}
|
||||
|
||||
ddsf::DeviceCodeEntryManager &GetDeviceCodeEntryManager() {
|
||||
static ddsf::DeviceCodeEntryManager s_device_code_entry_manager(ddsf::GetDeviceCodeEntryHolderMemoryResource());
|
||||
return s_device_code_entry_manager;
|
||||
static constinit util::TypedStorage<ddsf::DeviceCodeEntryManager> s_device_code_entry_manager;
|
||||
static constinit bool s_initialized = false;
|
||||
static constinit os::SdkMutex s_mutex;
|
||||
|
||||
if (AMS_UNLIKELY(!s_initialized)) {
|
||||
std::scoped_lock lk(s_mutex);
|
||||
|
||||
if (AMS_LIKELY(!s_initialized)) {
|
||||
util::ConstructAt(s_device_code_entry_manager, ddsf::GetDeviceCodeEntryHolderMemoryResource());
|
||||
s_initialized = true;
|
||||
}
|
||||
}
|
||||
|
||||
return util::GetReference(s_device_code_entry_manager);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue