IOS: Simplify IPC initialisation
The extra IPC ack is triggered by a syscall that is invoked in ES's main function; the syscall literally just sets Y2, IX1 and IX2 in HW_IPC_ARMCTRL -- there is no complicated ack queue or anything.
This commit is contained in:
parent
0da5ea86a3
commit
820c4836d7
|
@ -122,6 +122,8 @@ void ESDevice::FinalizeEmulationState()
|
||||||
|
|
||||||
void ESDevice::FinishInit()
|
void ESDevice::FinishInit()
|
||||||
{
|
{
|
||||||
|
m_ios.InitIPC();
|
||||||
|
|
||||||
if (s_title_to_launch != 0)
|
if (s_title_to_launch != 0)
|
||||||
{
|
{
|
||||||
NOTICE_LOG_FMT(IOS, "Re-launching title after IOS reload.");
|
NOTICE_LOG_FMT(IOS, "Re-launching title after IOS reload.");
|
||||||
|
|
|
@ -64,7 +64,6 @@ namespace IOS::HLE
|
||||||
static std::unique_ptr<EmulationKernel> s_ios;
|
static std::unique_ptr<EmulationKernel> s_ios;
|
||||||
|
|
||||||
constexpr u64 ENQUEUE_REQUEST_FLAG = 0x100000000ULL;
|
constexpr u64 ENQUEUE_REQUEST_FLAG = 0x100000000ULL;
|
||||||
constexpr u64 ENQUEUE_ACKNOWLEDGEMENT_FLAG = 0x200000000ULL;
|
|
||||||
static CoreTiming::EventType* s_event_enqueue;
|
static CoreTiming::EventType* s_event_enqueue;
|
||||||
static CoreTiming::EventType* s_event_sdio_notify;
|
static CoreTiming::EventType* s_event_sdio_notify;
|
||||||
static CoreTiming::EventType* s_event_finish_ppc_bootstrap;
|
static CoreTiming::EventType* s_event_finish_ppc_bootstrap;
|
||||||
|
@ -289,9 +288,6 @@ EmulationKernel::EmulationKernel(u64 title_id) : Kernel(title_id)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// IOS re-inits IPC and sends a dummy ack during its boot process.
|
|
||||||
EnqueueIPCAcknowledgement(0);
|
|
||||||
|
|
||||||
AddCoreDevices();
|
AddCoreDevices();
|
||||||
AddStaticDevices();
|
AddStaticDevices();
|
||||||
}
|
}
|
||||||
|
@ -443,6 +439,15 @@ bool Kernel::BootIOS(const u64 ios_title_id, const std::string& boot_content_pat
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Kernel::InitIPC()
|
||||||
|
{
|
||||||
|
if (s_ios == nullptr)
|
||||||
|
return;
|
||||||
|
|
||||||
|
INFO_LOG_FMT(IOS, "IPC initialised.");
|
||||||
|
GenerateAck(0);
|
||||||
|
}
|
||||||
|
|
||||||
void Kernel::AddDevice(std::unique_ptr<Device> device)
|
void Kernel::AddDevice(std::unique_ptr<Device> device)
|
||||||
{
|
{
|
||||||
ASSERT(device->GetDeviceType() == Device::DeviceType::Static);
|
ASSERT(device->GetDeviceType() == Device::DeviceType::Static);
|
||||||
|
@ -690,17 +695,9 @@ void Kernel::EnqueueIPCReply(const Request& request, const s32 return_value, s64
|
||||||
CoreTiming::ScheduleEvent(cycles_in_future, s_event_enqueue, request.address, from);
|
CoreTiming::ScheduleEvent(cycles_in_future, s_event_enqueue, request.address, from);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Kernel::EnqueueIPCAcknowledgement(u32 address, int cycles_in_future)
|
|
||||||
{
|
|
||||||
CoreTiming::ScheduleEvent(cycles_in_future, s_event_enqueue,
|
|
||||||
address | ENQUEUE_ACKNOWLEDGEMENT_FLAG);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Kernel::HandleIPCEvent(u64 userdata)
|
void Kernel::HandleIPCEvent(u64 userdata)
|
||||||
{
|
{
|
||||||
if (userdata & ENQUEUE_ACKNOWLEDGEMENT_FLAG)
|
if (userdata & ENQUEUE_REQUEST_FLAG)
|
||||||
m_ack_queue.push_back(static_cast<u32>(userdata));
|
|
||||||
else if (userdata & ENQUEUE_REQUEST_FLAG)
|
|
||||||
m_request_queue.push_back(static_cast<u32>(userdata));
|
m_request_queue.push_back(static_cast<u32>(userdata));
|
||||||
else
|
else
|
||||||
m_reply_queue.push_back(static_cast<u32>(userdata));
|
m_reply_queue.push_back(static_cast<u32>(userdata));
|
||||||
|
@ -730,14 +727,6 @@ void Kernel::UpdateIPC()
|
||||||
m_reply_queue.pop_front();
|
m_reply_queue.pop_front();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!m_ack_queue.empty())
|
|
||||||
{
|
|
||||||
GenerateAck(m_ack_queue.front());
|
|
||||||
WARN_LOG_FMT(IOS, "<<-- Double-ack to IPC Request @ {:#010x}", m_ack_queue.front());
|
|
||||||
m_ack_queue.pop_front();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Kernel::UpdateDevices()
|
void Kernel::UpdateDevices()
|
||||||
|
|
|
@ -133,6 +133,7 @@ public:
|
||||||
|
|
||||||
bool BootstrapPPC(const std::string& boot_content_path);
|
bool BootstrapPPC(const std::string& boot_content_path);
|
||||||
bool BootIOS(u64 ios_title_id, const std::string& boot_content_path = "");
|
bool BootIOS(u64 ios_title_id, const std::string& boot_content_path = "");
|
||||||
|
void InitIPC();
|
||||||
u32 GetVersion() const;
|
u32 GetVersion() const;
|
||||||
|
|
||||||
IOSC& GetIOSC();
|
IOSC& GetIOSC();
|
||||||
|
@ -142,7 +143,6 @@ protected:
|
||||||
|
|
||||||
void ExecuteIPCCommand(u32 address);
|
void ExecuteIPCCommand(u32 address);
|
||||||
std::optional<IPCReply> HandleIPCCommand(const Request& request);
|
std::optional<IPCReply> HandleIPCCommand(const Request& request);
|
||||||
void EnqueueIPCAcknowledgement(u32 address, int cycles_in_future = 0);
|
|
||||||
|
|
||||||
void AddDevice(std::unique_ptr<Device> device);
|
void AddDevice(std::unique_ptr<Device> device);
|
||||||
void AddCoreDevices();
|
void AddCoreDevices();
|
||||||
|
@ -165,7 +165,6 @@ protected:
|
||||||
using IPCMsgQueue = std::deque<u32>;
|
using IPCMsgQueue = std::deque<u32>;
|
||||||
IPCMsgQueue m_request_queue; // ppc -> arm
|
IPCMsgQueue m_request_queue; // ppc -> arm
|
||||||
IPCMsgQueue m_reply_queue; // arm -> ppc
|
IPCMsgQueue m_reply_queue; // arm -> ppc
|
||||||
IPCMsgQueue m_ack_queue; // arm -> ppc
|
|
||||||
u64 m_last_reply_time = 0;
|
u64 m_last_reply_time = 0;
|
||||||
|
|
||||||
IOSC m_iosc;
|
IOSC m_iosc;
|
||||||
|
|
Loading…
Reference in New Issue