summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Morph2021-06-15 03:59:17 -0400
committerGravatar Morph2021-06-16 01:46:45 -0400
commit8ba83c4c2a4062d0d6a623a71a8a04312807b242 (patch)
tree9fc66f662ab2388b290c837be114445fabb3b121 /src
parenthle: api_version: Add HLE API version constants (diff)
downloadyuzu-8ba83c4c2a4062d0d6a623a71a8a04312807b242.tar.gz
yuzu-8ba83c4c2a4062d0d6a623a71a8a04312807b242.tar.xz
yuzu-8ba83c4c2a4062d0d6a623a71a8a04312807b242.zip
spl: Implement spl::GetConfig
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/spl/module.cpp87
-rw-r--r--src/core/hle/service/spl/module.h4
2 files changed, 90 insertions, 1 deletions
diff --git a/src/core/hle/service/spl/module.cpp b/src/core/hle/service/spl/module.cpp
index eabf2e319..11a44edbb 100644
--- a/src/core/hle/service/spl/module.cpp
+++ b/src/core/hle/service/spl/module.cpp
@@ -10,6 +10,7 @@
10#include <vector> 10#include <vector>
11#include "common/logging/log.h" 11#include "common/logging/log.h"
12#include "common/settings.h" 12#include "common/settings.h"
13#include "core/hle/api_version.h"
13#include "core/hle/ipc_helpers.h" 14#include "core/hle/ipc_helpers.h"
14#include "core/hle/service/spl/csrng.h" 15#include "core/hle/service/spl/csrng.h"
15#include "core/hle/service/spl/module.h" 16#include "core/hle/service/spl/module.h"
@@ -24,7 +25,30 @@ Module::Interface::Interface(Core::System& system_, std::shared_ptr<Module> modu
24 25
25Module::Interface::~Interface() = default; 26Module::Interface::~Interface() = default;
26 27
27void Module::Interface::GetConfig(Kernel::HLERequestContext& ctx) {} 28void Module::Interface::GetConfig(Kernel::HLERequestContext& ctx) {
29 IPC::RequestParser rp{ctx};
30 const auto config_item = rp.PopEnum<ConfigItem>();
31
32 // This should call svcCallSecureMonitor with the appropriate args.
33 // Since we do not have it implemented yet, we will use this for now.
34 const auto smc_result = GetConfigImpl(config_item);
35 const auto result_code = smc_result.Code();
36
37 if (smc_result.Failed()) {
38 LOG_ERROR(Service_SPL, "called, config_item={}, result_code={}", config_item,
39 result_code.raw);
40
41 IPC::ResponseBuilder rb{ctx, 2};
42 rb.Push(result_code);
43 }
44
45 LOG_DEBUG(Service_SPL, "called, config_item={}, result_code={}, smc_result={}", config_item,
46 result_code.raw, *smc_result);
47
48 IPC::ResponseBuilder rb{ctx, 4};
49 rb.Push(result_code);
50 rb.Push(*smc_result);
51}
28 52
29void Module::Interface::ModularExponentiate(Kernel::HLERequestContext& ctx) {} 53void Module::Interface::ModularExponentiate(Kernel::HLERequestContext& ctx) {}
30 54
@@ -51,6 +75,67 @@ void Module::Interface::SetBootReason(Kernel::HLERequestContext& ctx) {}
51 75
52void Module::Interface::GetBootReason(Kernel::HLERequestContext& ctx) {} 76void Module::Interface::GetBootReason(Kernel::HLERequestContext& ctx) {}
53 77
78ResultVal<u64> Module::Interface::GetConfigImpl(ConfigItem config_item) const {
79 switch (config_item) {
80 case ConfigItem::DisableProgramVerification:
81 case ConfigItem::DramId:
82 case ConfigItem::SecurityEngineInterruptNumber:
83 case ConfigItem::FuseVersion:
84 case ConfigItem::HardwareType:
85 case ConfigItem::HardwareState:
86 case ConfigItem::IsRecoveryBoot:
87 case ConfigItem::DeviceId:
88 case ConfigItem::BootReason:
89 case ConfigItem::MemoryMode:
90 case ConfigItem::IsDevelopmentFunctionEnabled:
91 case ConfigItem::KernelConfiguration:
92 case ConfigItem::IsChargerHiZModeEnabled:
93 case ConfigItem::QuestState:
94 case ConfigItem::RegulatorType:
95 case ConfigItem::DeviceUniqueKeyGeneration:
96 case ConfigItem::Package2Hash:
97 return ResultSecureMonitorNotImplemented;
98 case ConfigItem::ExosphereApiVersion:
99 // Get information about the current exosphere version.
100 return MakeResult((u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MAJOR} << 56) |
101 (u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MINOR} << 48) |
102 (u64{HLE::ApiVersion::ATMOSPHERE_RELEASE_VERSION_MICRO} << 40) |
103 (static_cast<u64>(HLE::ApiVersion::GetTargetFirmware())));
104 case ConfigItem::ExosphereNeedsReboot:
105 // We are executing, so we aren't in the process of rebooting.
106 return MakeResult(u64{0});
107 case ConfigItem::ExosphereNeedsShutdown:
108 // We are executing, so we aren't in the process of shutting down.
109 return MakeResult(u64{0});
110 case ConfigItem::ExosphereGitCommitHash:
111 // Get information about the current exosphere git commit hash.
112 return MakeResult(u64{0});
113 case ConfigItem::ExosphereHasRcmBugPatch:
114 // Get information about whether this unit has the RCM bug patched.
115 return MakeResult(u64{0});
116 case ConfigItem::ExosphereBlankProdInfo:
117 // Get whether this unit should simulate a "blanked" PRODINFO.
118 return MakeResult(u64{0});
119 case ConfigItem::ExosphereAllowCalWrites:
120 // Get whether this unit should allow writing to the calibration partition.
121 return MakeResult(u64{0});
122 case ConfigItem::ExosphereEmummcType:
123 // Get what kind of emummc this unit has active.
124 return MakeResult(u64{0});
125 case ConfigItem::ExospherePayloadAddress:
126 // Gets the physical address of the reboot payload buffer, if one exists.
127 return ResultSecureMonitorNotInitialized;
128 case ConfigItem::ExosphereLogConfiguration:
129 // Get the log configuration.
130 return MakeResult(u64{0});
131 case ConfigItem::ExosphereForceEnableUsb30:
132 // Get whether usb 3.0 should be force-enabled.
133 return MakeResult(u64{0});
134 default:
135 return ResultSecureMonitorInvalidArgument;
136 }
137}
138
54void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) { 139void InstallInterfaces(SM::ServiceManager& service_manager, Core::System& system) {
55 auto module = std::make_shared<Module>(); 140 auto module = std::make_shared<Module>();
56 std::make_shared<CSRNG>(system, module)->InstallAsService(service_manager); 141 std::make_shared<CSRNG>(system, module)->InstallAsService(service_manager);
diff --git a/src/core/hle/service/spl/module.h b/src/core/hle/service/spl/module.h
index 67f7657e9..61630df80 100644
--- a/src/core/hle/service/spl/module.h
+++ b/src/core/hle/service/spl/module.h
@@ -6,6 +6,8 @@
6 6
7#include <random> 7#include <random>
8#include "core/hle/service/service.h" 8#include "core/hle/service/service.h"
9#include "core/hle/service/spl/spl_results.h"
10#include "core/hle/service/spl/spl_types.h"
9 11
10namespace Core { 12namespace Core {
11class System; 13class System;
@@ -34,6 +36,8 @@ public:
34 std::shared_ptr<Module> module; 36 std::shared_ptr<Module> module;
35 37
36 private: 38 private:
39 ResultVal<u64> GetConfigImpl(ConfigItem config_item) const;
40
37 std::mt19937 rng; 41 std::mt19937 rng;
38 }; 42 };
39}; 43};