2026-08-18 18:11:33 +02:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
2025-12-18 21:46:00 +01:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
2022-04-23 04:59:50 -04:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2018 yuzu Emulator Project
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2018-07-31 06:33:38 -04:00
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
|
|
|
|
|
#include "core/hle/service/pcie/pcie.h"
|
2023-02-18 16:26:48 -05:00
|
|
|
#include "core/hle/service/server_manager.h"
|
2018-07-31 06:33:38 -04:00
|
|
|
#include "core/hle/service/service.h"
|
2026-08-18 18:11:33 +02:00
|
|
|
#include "frontend_common/firmware_manager.h"
|
2018-07-31 06:33:38 -04:00
|
|
|
|
|
|
|
|
namespace Service::PCIe {
|
|
|
|
|
|
|
|
|
|
class ISession final : public ServiceFramework<ISession> {
|
|
|
|
|
public:
|
2020-11-26 15:19:08 -05:00
|
|
|
explicit ISession(Core::System& system_) : ServiceFramework{system_, "ISession"} {
|
2018-07-31 06:33:38 -04:00
|
|
|
// clang-format off
|
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
|
{0, nullptr, "QueryFunctions"},
|
|
|
|
|
{1, nullptr, "AcquireFunction"},
|
|
|
|
|
{2, nullptr, "ReleaseFunction"},
|
|
|
|
|
{3, nullptr, "GetFunctionState"},
|
|
|
|
|
{4, nullptr, "GetBarProfile"},
|
|
|
|
|
{5, nullptr, "ReadConfig"},
|
|
|
|
|
{6, nullptr, "WriteConfig"},
|
|
|
|
|
{7, nullptr, "ReadBarRegion"},
|
|
|
|
|
{8, nullptr, "WriteBarRegion"},
|
|
|
|
|
{9, nullptr, "FindCapability"},
|
|
|
|
|
{10, nullptr, "FindExtendedCapability"},
|
|
|
|
|
{11, nullptr, "MapDma"},
|
|
|
|
|
{12, nullptr, "UnmapDma"},
|
|
|
|
|
{13, nullptr, "UnmapDmaBusAddress"},
|
|
|
|
|
{14, nullptr, "GetDmaBusAddress"},
|
|
|
|
|
{15, nullptr, "GetDmaBusAddressRange"},
|
|
|
|
|
{16, nullptr, "SetDmaEnable"},
|
|
|
|
|
{17, nullptr, "AcquireIrq"},
|
|
|
|
|
{18, nullptr, "ReleaseIrq"},
|
|
|
|
|
{19, nullptr, "SetIrqEnable"},
|
2025-12-18 21:46:00 +01:00
|
|
|
{20, nullptr, "GetIrqEvent"},
|
|
|
|
|
{21, nullptr, "SetAspmEnable"},
|
|
|
|
|
{22, nullptr, "SetResetUponResumeEnable"},
|
|
|
|
|
{23, nullptr, "ResetFunction"},
|
2018-07-31 06:33:38 -04:00
|
|
|
};
|
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-08-18 18:11:33 +02:00
|
|
|
class PCIE final : public ServiceFramework<PCIE> {
|
2018-07-31 06:33:38 -04:00
|
|
|
public:
|
2026-08-18 18:11:33 +02:00
|
|
|
explicit PCIE(Core::System& system_) : ServiceFramework{system_, "pcie"} {
|
2018-07-31 06:33:38 -04:00
|
|
|
// clang-format off
|
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
|
{0, nullptr, "RegisterClassDriver"},
|
|
|
|
|
{1, nullptr, "QueryFunctionsUnregistered"},
|
|
|
|
|
};
|
|
|
|
|
// clang-format on
|
|
|
|
|
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2026-08-18 18:11:33 +02:00
|
|
|
class PCIE_LOG final : public ServiceFramework<PCIE_LOG> {
|
|
|
|
|
public:
|
|
|
|
|
explicit PCIE_LOG(Core::System& system_) : ServiceFramework{system_, "pcie:log"} {
|
|
|
|
|
// clang-format off
|
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
|
{0, nullptr, "GetLoggedState"},
|
|
|
|
|
{1, nullptr, "GetLoggedStateEvent"},
|
|
|
|
|
};
|
|
|
|
|
// clang-format on
|
|
|
|
|
RegisterHandlers(functions);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2023-02-18 16:26:48 -05:00
|
|
|
void LoopProcess(Core::System& system) {
|
|
|
|
|
auto server_manager = std::make_unique<ServerManager>(system);
|
|
|
|
|
|
2026-08-18 18:11:33 +02:00
|
|
|
server_manager->RegisterNamedService("pcie", std::make_shared<PCIE>(system));
|
|
|
|
|
// +6.0.0
|
|
|
|
|
if (FirmwareManager::GetFirmwareVersion(system).first.major >= 6) {
|
|
|
|
|
server_manager->RegisterNamedService("pcie:log", std::make_shared<PCIE_LOG>(system));
|
|
|
|
|
}
|
2023-02-18 16:26:48 -05:00
|
|
|
ServerManager::RunServer(std::move(server_manager));
|
2018-07-31 06:33:38 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace Service::PCIe
|