summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-05-21 06:54:27 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2017-05-25 06:06:00 +0200
commit743d18f0e463aa25af53ceaa25231800453810ea (patch)
tree63855ef6247eaf0566da4ac1d82315c82442c003
parentFileSys: Move all result description to errors.h (diff)
downloadyuzu-743d18f0e463aa25af53ceaa25231800453810ea.tar
yuzu-743d18f0e463aa25af53ceaa25231800453810ea.tar.gz
yuzu-743d18f0e463aa25af53ceaa25231800453810ea.tar.bz2
yuzu-743d18f0e463aa25af53ceaa25231800453810ea.tar.lz
yuzu-743d18f0e463aa25af53ceaa25231800453810ea.tar.xz
yuzu-743d18f0e463aa25af53ceaa25231800453810ea.tar.zst
yuzu-743d18f0e463aa25af53ceaa25231800453810ea.zip
-rw-r--r--src/core/hle/result.h3
-rw-r--r--src/core/hle/service/gsp_gpu.cpp37
2 files changed, 23 insertions, 17 deletions
diff --git a/src/core/hle/result.h b/src/core/hle/result.h
index b066b7d4e..e76be606e 100644
--- a/src/core/hle/result.h
+++ b/src/core/hle/result.h
@@ -26,9 +26,6 @@ enum class ErrorDescription : u32 {
OS_InvalidBufferDescriptor = 48,
MaxConnectionsReached = 52,
WrongAddress = 53,
- OutofRangeOrMisalignedAddress =
- 513, // TODO(purpasmart): Check if this name fits its actual usage
- GPU_FirstInitialization = 519,
// Codes 1000 and above are considered "well-known" and have common values between all modules.
InvalidSection = 1000,
diff --git a/src/core/hle/service/gsp_gpu.cpp b/src/core/hle/service/gsp_gpu.cpp
index a960778a7..46c4ed01a 100644
--- a/src/core/hle/service/gsp_gpu.cpp
+++ b/src/core/hle/service/gsp_gpu.cpp
@@ -25,13 +25,24 @@ namespace GSP {
// Beginning address of HW regs
const u32 REGS_BEGIN = 0x1EB00000;
-const ResultCode ERR_GSP_REGS_OUTOFRANGE_OR_MISALIGNED(
- ErrorDescription::OutofRangeOrMisalignedAddress, ErrorModule::GX, ErrorSummary::InvalidArgument,
- ErrorLevel::Usage); // 0xE0E02A01
-const ResultCode ERR_GSP_REGS_MISALIGNED(ErrorDescription::MisalignedSize, ErrorModule::GX,
+namespace ErrCodes {
+enum {
+ // TODO(purpasmart): Check if this name fits its actual usage
+ OutofRangeOrMisalignedAddress = 513,
+ FirstInitialization = 519,
+};
+}
+
+constexpr ResultCode RESULT_FIRST_INITIALIZATION(ErrCodes::FirstInitialization, ErrorModule::GX,
+ ErrorSummary::Success, ErrorLevel::Success);
+constexpr ResultCode ERR_REGS_OUTOFRANGE_OR_MISALIGNED(ErrCodes::OutofRangeOrMisalignedAddress,
+ ErrorModule::GX,
+ ErrorSummary::InvalidArgument,
+ ErrorLevel::Usage); // 0xE0E02A01
+constexpr ResultCode ERR_REGS_MISALIGNED(ErrorDescription::MisalignedSize, ErrorModule::GX,
ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E02BF2
-const ResultCode ERR_GSP_REGS_INVALID_SIZE(ErrorDescription::InvalidSize, ErrorModule::GX,
+constexpr ResultCode ERR_REGS_INVALID_SIZE(ErrorDescription::InvalidSize, ErrorModule::GX,
ErrorSummary::InvalidArgument,
ErrorLevel::Usage); // 0xE0E02BEC
@@ -93,11 +104,11 @@ static ResultCode WriteHWRegs(u32 base_address, u32 size_in_bytes, VAddr data_va
LOG_ERROR(Service_GSP,
"Write address was out of range or misaligned! (address=0x%08x, size=0x%08x)",
base_address, size_in_bytes);
- return ERR_GSP_REGS_OUTOFRANGE_OR_MISALIGNED;
+ return ERR_REGS_OUTOFRANGE_OR_MISALIGNED;
} else if (size_in_bytes <= max_size_in_bytes) {
if (size_in_bytes & 3) {
LOG_ERROR(Service_GSP, "Misaligned size 0x%08x", size_in_bytes);
- return ERR_GSP_REGS_MISALIGNED;
+ return ERR_REGS_MISALIGNED;
} else {
while (size_in_bytes > 0) {
WriteSingleHWReg(base_address, Memory::Read32(data_vaddr));
@@ -111,7 +122,7 @@ static ResultCode WriteHWRegs(u32 base_address, u32 size_in_bytes, VAddr data_va
} else {
LOG_ERROR(Service_GSP, "Out of range size 0x%08x", size_in_bytes);
- return ERR_GSP_REGS_INVALID_SIZE;
+ return ERR_REGS_INVALID_SIZE;
}
}
@@ -134,11 +145,11 @@ static ResultCode WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes, VAddr
LOG_ERROR(Service_GSP,
"Write address was out of range or misaligned! (address=0x%08x, size=0x%08x)",
base_address, size_in_bytes);
- return ERR_GSP_REGS_OUTOFRANGE_OR_MISALIGNED;
+ return ERR_REGS_OUTOFRANGE_OR_MISALIGNED;
} else if (size_in_bytes <= max_size_in_bytes) {
if (size_in_bytes & 3) {
LOG_ERROR(Service_GSP, "Misaligned size 0x%08x", size_in_bytes);
- return ERR_GSP_REGS_MISALIGNED;
+ return ERR_REGS_MISALIGNED;
} else {
while (size_in_bytes > 0) {
const u32 reg_address = base_address + REGS_BEGIN;
@@ -164,7 +175,7 @@ static ResultCode WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes, VAddr
} else {
LOG_ERROR(Service_GSP, "Out of range size 0x%08x", size_in_bytes);
- return ERR_GSP_REGS_INVALID_SIZE;
+ return ERR_REGS_INVALID_SIZE;
}
}
@@ -372,9 +383,7 @@ static void RegisterInterruptRelayQueue(Interface* self) {
if (first_initialization) {
// This specific code is required for a successful initialization, rather than 0
first_initialization = false;
- cmd_buff[1] = ResultCode(ErrorDescription::GPU_FirstInitialization, ErrorModule::GX,
- ErrorSummary::Success, ErrorLevel::Success)
- .raw;
+ cmd_buff[1] = RESULT_FIRST_INITIALIZATION.raw;
} else {
cmd_buff[1] = RESULT_SUCCESS.raw;
}