diff options
| author | 2022-08-20 10:43:04 +0800 | |
|---|---|---|
| committer | 2022-08-20 14:08:59 +0800 | |
| commit | 4bab0d07a6467d8edeeca643fd2e6ee696008773 (patch) | |
| tree | 44c211b895156537dd8797f1e3674a26bdd890c4 /src | |
| parent | Merge pull request #8791 from liamwhite/r16g16b16x16 (diff) | |
| download | yuzu-4bab0d07a6467d8edeeca643fd2e6ee696008773.tar.gz yuzu-4bab0d07a6467d8edeeca643fd2e6ee696008773.tar.xz yuzu-4bab0d07a6467d8edeeca643fd2e6ee696008773.zip | |
core: implement clkrst service
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/pcv/pcv.cpp | 93 | ||||
| -rw-r--r-- | src/core/hle/service/pcv/pcv.h | 91 |
2 files changed, 184 insertions, 0 deletions
diff --git a/src/core/hle/service/pcv/pcv.cpp b/src/core/hle/service/pcv/pcv.cpp index 0989474be..f7a497a14 100644 --- a/src/core/hle/service/pcv/pcv.cpp +++ b/src/core/hle/service/pcv/pcv.cpp | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | 3 | ||
| 4 | #include <memory> | 4 | #include <memory> |
| 5 | 5 | ||
| 6 | #include "core/hle/ipc_helpers.h" | ||
| 6 | #include "core/hle/service/pcv/pcv.h" | 7 | #include "core/hle/service/pcv/pcv.h" |
| 7 | #include "core/hle/service/service.h" | 8 | #include "core/hle/service/service.h" |
| 8 | #include "core/hle/service/sm/sm.h" | 9 | #include "core/hle/service/sm/sm.h" |
| @@ -77,10 +78,102 @@ public: | |||
| 77 | } | 78 | } |
| 78 | }; | 79 | }; |
| 79 | 80 | ||
| 81 | class IClkrstSession final : public ServiceFramework<IClkrstSession> { | ||
| 82 | public: | ||
| 83 | explicit IClkrstSession(Core::System& system_, DeviceCode deivce_code_) | ||
| 84 | : ServiceFramework{system_, "IClkrstSession"}, deivce_code(deivce_code_) { | ||
| 85 | // clang-format off | ||
| 86 | static const FunctionInfo functions[] = { | ||
| 87 | {0, nullptr, "SetClockEnabled"}, | ||
| 88 | {1, nullptr, "SetClockDisabled"}, | ||
| 89 | {2, nullptr, "SetResetAsserted"}, | ||
| 90 | {3, nullptr, "SetResetDeasserted"}, | ||
| 91 | {4, nullptr, "SetPowerEnabled"}, | ||
| 92 | {5, nullptr, "SetPowerDisabled"}, | ||
| 93 | {6, nullptr, "GetState"}, | ||
| 94 | {7, &IClkrstSession::SetClockRate, "SetClockRate"}, | ||
| 95 | {8, &IClkrstSession::GetClockRate, "GetClockRate"}, | ||
| 96 | {9, nullptr, "SetMinVClockRate"}, | ||
| 97 | {10, nullptr, "GetPossibleClockRates"}, | ||
| 98 | {11, nullptr, "GetDvfsTable"}, | ||
| 99 | }; | ||
| 100 | // clang-format on | ||
| 101 | RegisterHandlers(functions); | ||
| 102 | } | ||
| 103 | |||
| 104 | private: | ||
| 105 | void SetClockRate(Kernel::HLERequestContext& ctx) { | ||
| 106 | IPC::RequestParser rp{ctx}; | ||
| 107 | clock_rate = rp.Pop<u32>(); | ||
| 108 | LOG_DEBUG(Service_PCV, "(STUBBED) called, clock_rate={}", clock_rate); | ||
| 109 | |||
| 110 | IPC::ResponseBuilder rb{ctx, 2}; | ||
| 111 | rb.Push(ResultSuccess); | ||
| 112 | } | ||
| 113 | |||
| 114 | void GetClockRate(Kernel::HLERequestContext& ctx) { | ||
| 115 | LOG_DEBUG(Service_PCV, "(STUBBED) called"); | ||
| 116 | |||
| 117 | IPC::ResponseBuilder rb{ctx, 3}; | ||
| 118 | rb.Push(ResultSuccess); | ||
| 119 | rb.Push<u32>(clock_rate); | ||
| 120 | } | ||
| 121 | |||
| 122 | DeviceCode deivce_code; | ||
| 123 | u32 clock_rate{}; | ||
| 124 | }; | ||
| 125 | |||
| 126 | class CLKRST final : public ServiceFramework<CLKRST> { | ||
| 127 | public: | ||
| 128 | explicit CLKRST(Core::System& system_, const char* name) : ServiceFramework{system_, name} { | ||
| 129 | // clang-format off | ||
| 130 | static const FunctionInfo functions[] = { | ||
| 131 | {0, &CLKRST::OpenSession, "OpenSession"}, | ||
| 132 | {1, nullptr, "GetTemperatureThresholds"}, | ||
| 133 | {2, nullptr, "SetTemperature"}, | ||
| 134 | {3, nullptr, "GetModuleStateTable"}, | ||
| 135 | {4, nullptr, "GetModuleStateTableEvent"}, | ||
| 136 | {5, nullptr, "GetModuleStateTableMaxCount"}, | ||
| 137 | }; | ||
| 138 | // clang-format on | ||
| 139 | |||
| 140 | RegisterHandlers(functions); | ||
| 141 | } | ||
| 142 | |||
| 143 | private: | ||
| 144 | void OpenSession(Kernel::HLERequestContext& ctx) { | ||
| 145 | IPC::RequestParser rp{ctx}; | ||
| 146 | const auto device_code = static_cast<DeviceCode>(rp.Pop<u32>()); | ||
| 147 | const auto unkonwn_input = rp.Pop<u32>(); | ||
| 148 | |||
| 149 | LOG_DEBUG(Service_PCV, "called, device_code={}, input={}", device_code, unkonwn_input); | ||
| 150 | |||
| 151 | IPC::ResponseBuilder rb{ctx, 2, 0, 1}; | ||
| 152 | rb.Push(ResultSuccess); | ||
| 153 | rb.PushIpcInterface<IClkrstSession>(system, device_code); | ||
| 154 | } | ||
| 155 | }; | ||
| 156 | |||
| 157 | class CLKRST_A final : public ServiceFramework<CLKRST_A> { | ||
| 158 | public: | ||
| 159 | explicit CLKRST_A(Core::System& system_) : ServiceFramework{system_, "clkrst:a"} { | ||
| 160 | // clang-format off | ||
| 161 | static const FunctionInfo functions[] = { | ||
| 162 | {0, nullptr, "ReleaseControl"}, | ||
| 163 | }; | ||
| 164 | // clang-format on | ||
| 165 | |||
| 166 | RegisterHandlers(functions); | ||
| 167 | } | ||
| 168 | }; | ||
| 169 | |||
| 80 | void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) { | 170 | void InstallInterfaces(SM::ServiceManager& sm, Core::System& system) { |
| 81 | std::make_shared<PCV>(system)->InstallAsService(sm); | 171 | std::make_shared<PCV>(system)->InstallAsService(sm); |
| 82 | std::make_shared<PCV_ARB>(system)->InstallAsService(sm); | 172 | std::make_shared<PCV_ARB>(system)->InstallAsService(sm); |
| 83 | std::make_shared<PCV_IMM>(system)->InstallAsService(sm); | 173 | std::make_shared<PCV_IMM>(system)->InstallAsService(sm); |
| 174 | std::make_shared<CLKRST>(system, "clkrst")->InstallAsService(sm); | ||
| 175 | std::make_shared<CLKRST>(system, "clkrst:i")->InstallAsService(sm); | ||
| 176 | std::make_shared<CLKRST_A>(system)->InstallAsService(sm); | ||
| 84 | } | 177 | } |
| 85 | 178 | ||
| 86 | } // namespace Service::PCV | 179 | } // namespace Service::PCV |
diff --git a/src/core/hle/service/pcv/pcv.h b/src/core/hle/service/pcv/pcv.h index a42e6f8f6..6b26b6fa7 100644 --- a/src/core/hle/service/pcv/pcv.h +++ b/src/core/hle/service/pcv/pcv.h | |||
| @@ -13,6 +13,97 @@ class ServiceManager; | |||
| 13 | 13 | ||
| 14 | namespace Service::PCV { | 14 | namespace Service::PCV { |
| 15 | 15 | ||
| 16 | enum class DeviceCode : u32 { | ||
| 17 | Cpu = 0x40000001, | ||
| 18 | Gpu = 0x40000002, | ||
| 19 | I2s1 = 0x40000003, | ||
| 20 | I2s2 = 0x40000004, | ||
| 21 | I2s3 = 0x40000005, | ||
| 22 | Pwm = 0x40000006, | ||
| 23 | I2c1 = 0x02000001, | ||
| 24 | I2c2 = 0x02000002, | ||
| 25 | I2c3 = 0x02000003, | ||
| 26 | I2c4 = 0x02000004, | ||
| 27 | I2c5 = 0x02000005, | ||
| 28 | I2c6 = 0x02000006, | ||
| 29 | Spi1 = 0x07000000, | ||
| 30 | Spi2 = 0x07000001, | ||
| 31 | Spi3 = 0x07000002, | ||
| 32 | Spi4 = 0x07000003, | ||
| 33 | Disp1 = 0x40000011, | ||
| 34 | Disp2 = 0x40000012, | ||
| 35 | Isp = 0x40000013, | ||
| 36 | Vi = 0x40000014, | ||
| 37 | Sdmmc1 = 0x40000015, | ||
| 38 | Sdmmc2 = 0x40000016, | ||
| 39 | Sdmmc3 = 0x40000017, | ||
| 40 | Sdmmc4 = 0x40000018, | ||
| 41 | Owr = 0x40000019, | ||
| 42 | Csite = 0x4000001A, | ||
| 43 | Tsec = 0x4000001B, | ||
| 44 | Mselect = 0x4000001C, | ||
| 45 | Hda2codec2x = 0x4000001D, | ||
| 46 | Actmon = 0x4000001E, | ||
| 47 | I2cSlow = 0x4000001F, | ||
| 48 | Sor1 = 0x40000020, | ||
| 49 | Sata = 0x40000021, | ||
| 50 | Hda = 0x40000022, | ||
| 51 | XusbCoreHostSrc = 0x40000023, | ||
| 52 | XusbFalconSrc = 0x40000024, | ||
| 53 | XusbFsSrc = 0x40000025, | ||
| 54 | XusbCoreDevSrc = 0x40000026, | ||
| 55 | XusbSsSrc = 0x40000027, | ||
| 56 | UartA = 0x03000001, | ||
| 57 | UartB = 0x35000405, | ||
| 58 | UartC = 0x3500040F, | ||
| 59 | UartD = 0x37000001, | ||
| 60 | Host1x = 0x4000002C, | ||
| 61 | Entropy = 0x4000002D, | ||
| 62 | SocTherm = 0x4000002E, | ||
| 63 | Vic = 0x4000002F, | ||
| 64 | Nvenc = 0x40000030, | ||
| 65 | Nvjpg = 0x40000031, | ||
| 66 | Nvdec = 0x40000032, | ||
| 67 | Qspi = 0x40000033, | ||
| 68 | ViI2c = 0x40000034, | ||
| 69 | Tsecb = 0x40000035, | ||
| 70 | Ape = 0x40000036, | ||
| 71 | AudioDsp = 0x40000037, | ||
| 72 | AudioUart = 0x40000038, | ||
| 73 | Emc = 0x40000039, | ||
| 74 | Plle = 0x4000003A, | ||
| 75 | PlleHwSeq = 0x4000003B, | ||
| 76 | Dsi = 0x4000003C, | ||
| 77 | Maud = 0x4000003D, | ||
| 78 | Dpaux1 = 0x4000003E, | ||
| 79 | MipiCal = 0x4000003F, | ||
| 80 | UartFstMipiCal = 0x40000040, | ||
| 81 | Osc = 0x40000041, | ||
| 82 | SysBus = 0x40000042, | ||
| 83 | SorSafe = 0x40000043, | ||
| 84 | XusbSs = 0x40000044, | ||
| 85 | XusbHost = 0x40000045, | ||
| 86 | XusbDevice = 0x40000046, | ||
| 87 | Extperiph1 = 0x40000047, | ||
| 88 | Ahub = 0x40000048, | ||
| 89 | Hda2hdmicodec = 0x40000049, | ||
| 90 | Gpuaux = 0x4000004A, | ||
| 91 | UsbD = 0x4000004B, | ||
| 92 | Usb2 = 0x4000004C, | ||
| 93 | Pcie = 0x4000004D, | ||
| 94 | Afi = 0x4000004E, | ||
| 95 | PciExClk = 0x4000004F, | ||
| 96 | PExUsbPhy = 0x40000050, | ||
| 97 | XUsbPadCtl = 0x40000051, | ||
| 98 | Apbdma = 0x40000052, | ||
| 99 | Usb2TrkClk = 0x40000053, | ||
| 100 | XUsbIoPll = 0x40000054, | ||
| 101 | XUsbIoPllHwSeq = 0x40000055, | ||
| 102 | Cec = 0x40000056, | ||
| 103 | Extperiph2 = 0x40000057, | ||
| 104 | OscClk = 0x40000080 | ||
| 105 | }; | ||
| 106 | |||
| 16 | void InstallInterfaces(SM::ServiceManager& sm, Core::System& system); | 107 | void InstallInterfaces(SM::ServiceManager& sm, Core::System& system); |
| 17 | 108 | ||
| 18 | } // namespace Service::PCV | 109 | } // namespace Service::PCV |