service/gsp: Migrate logging macros (#3852)

* service/gsp: Migrate logging macros

* service/gsp: Fix clang format
This commit is contained in:
NarcolepticK 2018-06-21 05:16:10 -04:00 committed by Weiyi Wang
parent 831e3a0b54
commit a955385ec0

View File

@ -120,13 +120,14 @@ static ResultCode WriteHWRegs(u32 base_address, u32 size_in_bytes, const std::ve
const u32 max_size_in_bytes = 0x80; const u32 max_size_in_bytes = 0x80;
if (base_address & 3 || base_address >= 0x420000) { if (base_address & 3 || base_address >= 0x420000) {
LOG_ERROR(Service_GSP, NGLOG_ERROR(
"Write address was out of range or misaligned! (address=0x%08x, size=0x%08x)", Service_GSP,
base_address, size_in_bytes); "Write address was out of range or misaligned! (address=0x{:08x}, size=0x{:08x})",
base_address, size_in_bytes);
return ERR_REGS_OUTOFRANGE_OR_MISALIGNED; return ERR_REGS_OUTOFRANGE_OR_MISALIGNED;
} else if (size_in_bytes <= max_size_in_bytes) { } else if (size_in_bytes <= max_size_in_bytes) {
if (size_in_bytes & 3) { if (size_in_bytes & 3) {
LOG_ERROR(Service_GSP, "Misaligned size 0x%08x", size_in_bytes); NGLOG_ERROR(Service_GSP, "Misaligned size 0x{:08x}", size_in_bytes);
return ERR_REGS_MISALIGNED; return ERR_REGS_MISALIGNED;
} else { } else {
size_t offset = 0; size_t offset = 0;
@ -143,7 +144,7 @@ static ResultCode WriteHWRegs(u32 base_address, u32 size_in_bytes, const std::ve
} }
} else { } else {
LOG_ERROR(Service_GSP, "Out of range size 0x%08x", size_in_bytes); NGLOG_ERROR(Service_GSP, "Out of range size 0x{:08x}", size_in_bytes);
return ERR_REGS_INVALID_SIZE; return ERR_REGS_INVALID_SIZE;
} }
} }
@ -164,13 +165,14 @@ static ResultCode WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes,
const u32 max_size_in_bytes = 0x80; const u32 max_size_in_bytes = 0x80;
if (base_address & 3 || base_address >= 0x420000) { if (base_address & 3 || base_address >= 0x420000) {
LOG_ERROR(Service_GSP, NGLOG_ERROR(
"Write address was out of range or misaligned! (address=0x%08x, size=0x%08x)", Service_GSP,
base_address, size_in_bytes); "Write address was out of range or misaligned! (address=0x{:08x}, size=0x{:08x})",
base_address, size_in_bytes);
return ERR_REGS_OUTOFRANGE_OR_MISALIGNED; return ERR_REGS_OUTOFRANGE_OR_MISALIGNED;
} else if (size_in_bytes <= max_size_in_bytes) { } else if (size_in_bytes <= max_size_in_bytes) {
if (size_in_bytes & 3) { if (size_in_bytes & 3) {
LOG_ERROR(Service_GSP, "Misaligned size 0x%08x", size_in_bytes); NGLOG_ERROR(Service_GSP, "Misaligned size 0x{:08x}", size_in_bytes);
return ERR_REGS_MISALIGNED; return ERR_REGS_MISALIGNED;
} else { } else {
size_t offset = 0; size_t offset = 0;
@ -197,7 +199,7 @@ static ResultCode WriteHWRegsWithMask(u32 base_address, u32 size_in_bytes,
} }
} else { } else {
LOG_ERROR(Service_GSP, "Out of range size 0x%08x", size_in_bytes); NGLOG_ERROR(Service_GSP, "Out of range size 0x{:08x}", size_in_bytes);
return ERR_REGS_INVALID_SIZE; return ERR_REGS_INVALID_SIZE;
} }
} }
@ -235,7 +237,7 @@ void GSP_GPU::ReadHWRegs(Kernel::HLERequestContext& ctx) {
if ((reg_addr % 4) != 0 || reg_addr >= 0x420000) { if ((reg_addr % 4) != 0 || reg_addr >= 0x420000) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ERR_REGS_OUTOFRANGE_OR_MISALIGNED); rb.Push(ERR_REGS_OUTOFRANGE_OR_MISALIGNED);
LOG_ERROR(Service_GSP, "Invalid address 0x%08x", reg_addr); NGLOG_ERROR(Service_GSP, "Invalid address 0x{:08x}", reg_addr);
return; return;
} }
@ -243,7 +245,7 @@ void GSP_GPU::ReadHWRegs(Kernel::HLERequestContext& ctx) {
if ((size % 4) != 0) { if ((size % 4) != 0) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(ERR_REGS_MISALIGNED); rb.Push(ERR_REGS_MISALIGNED);
LOG_ERROR(Service_GSP, "Invalid size 0x%08x", size); NGLOG_ERROR(Service_GSP, "Invalid size 0x{:08x}", size);
return; return;
} }
@ -317,8 +319,8 @@ void GSP_GPU::FlushDataCache(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_DEBUG(Service_GSP, "(STUBBED) called address=0x%08X, size=0x%08X, process=%u", address, NGLOG_DEBUG(Service_GSP, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}",
size, process->process_id); address, size, process->process_id);
} }
void GSP_GPU::SetAxiConfigQoSMode(Kernel::HLERequestContext& ctx) { void GSP_GPU::SetAxiConfigQoSMode(Kernel::HLERequestContext& ctx) {
@ -328,7 +330,7 @@ void GSP_GPU::SetAxiConfigQoSMode(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_DEBUG(Service_GSP, "(STUBBED) called mode=0x%08X", mode); NGLOG_DEBUG(Service_GSP, "(STUBBED) called mode=0x{:08X}", mode);
} }
void GSP_GPU::RegisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) { void GSP_GPU::RegisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) {
@ -358,7 +360,7 @@ void GSP_GPU::RegisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) {
rb.Push(session_data->thread_id); rb.Push(session_data->thread_id);
rb.PushCopyObjects(shared_memory); rb.PushCopyObjects(shared_memory);
LOG_DEBUG(Service_GSP, "called, flags=0x%08X", flags); NGLOG_DEBUG(Service_GSP, "called, flags=0x{:08X}", flags);
} }
void GSP_GPU::UnregisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) { void GSP_GPU::UnregisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) {
@ -371,7 +373,7 @@ void GSP_GPU::UnregisterInterruptRelayQueue(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_DEBUG(Service_GSP, "called"); NGLOG_DEBUG(Service_GSP, "called");
} }
void GSP_GPU::SignalInterruptForThread(InterruptId interrupt_id, u32 thread_id) { void GSP_GPU::SignalInterruptForThread(InterruptId interrupt_id, u32 thread_id) {
@ -381,7 +383,7 @@ void GSP_GPU::SignalInterruptForThread(InterruptId interrupt_id, u32 thread_id)
auto interrupt_event = session_data->interrupt_event; auto interrupt_event = session_data->interrupt_event;
if (interrupt_event == nullptr) { if (interrupt_event == nullptr) {
LOG_WARNING(Service_GSP, "cannot synchronize until GSP event has been created!"); NGLOG_WARNING(Service_GSP, "cannot synchronize until GSP event has been created!");
return; return;
} }
InterruptRelayQueue* interrupt_relay_queue = GetInterruptRelayQueue(shared_memory, thread_id); InterruptRelayQueue* interrupt_relay_queue = GetInterruptRelayQueue(shared_memory, thread_id);
@ -419,7 +421,7 @@ void GSP_GPU::SignalInterruptForThread(InterruptId interrupt_id, u32 thread_id)
*/ */
void GSP_GPU::SignalInterrupt(InterruptId interrupt_id) { void GSP_GPU::SignalInterrupt(InterruptId interrupt_id) {
if (nullptr == shared_memory) { if (nullptr == shared_memory) {
LOG_WARNING(Service_GSP, "cannot synchronize until GSP shared memory has been created!"); NGLOG_WARNING(Service_GSP, "cannot synchronize until GSP shared memory has been created!");
return; return;
} }
@ -566,7 +568,7 @@ static void ExecuteCommand(const Command& command, u32 thread_id) {
} }
default: default:
LOG_ERROR(Service_GSP, "unknown command 0x%08X", (int)command.id.Value()); NGLOG_ERROR(Service_GSP, "unknown command 0x{:08X}", (int)command.id.Value());
} }
if (Pica::g_debug_context) if (Pica::g_debug_context)
@ -651,7 +653,7 @@ void GSP_GPU::ImportDisplayCaptureInfo(Kernel::HLERequestContext& ctx) {
rb.PushRaw(top_entry); rb.PushRaw(top_entry);
rb.PushRaw(bottom_entry); rb.PushRaw(bottom_entry);
LOG_WARNING(Service_GSP, "called"); NGLOG_WARNING(Service_GSP, "called");
} }
void GSP_GPU::AcquireRight(Kernel::HLERequestContext& ctx) { void GSP_GPU::AcquireRight(Kernel::HLERequestContext& ctx) {
@ -662,8 +664,8 @@ void GSP_GPU::AcquireRight(Kernel::HLERequestContext& ctx) {
SessionData* session_data = GetSessionData(ctx.Session()); SessionData* session_data = GetSessionData(ctx.Session());
LOG_WARNING(Service_GSP, "called flag=%08X process=%u thread_id=%u", flag, process->process_id, NGLOG_WARNING(Service_GSP, "called flag={:08X} process={} thread_id={}", flag,
session_data->thread_id); process->process_id, session_data->thread_id);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
@ -696,7 +698,7 @@ void GSP_GPU::ReleaseRight(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_WARNING(Service_GSP, "called"); NGLOG_WARNING(Service_GSP, "called");
} }
void GSP_GPU::StoreDataCache(Kernel::HLERequestContext& ctx) { void GSP_GPU::StoreDataCache(Kernel::HLERequestContext& ctx) {
@ -709,8 +711,8 @@ void GSP_GPU::StoreDataCache(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_DEBUG(Service_GSP, "(STUBBED) called address=0x%08X, size=0x%08X, process=%u", address, NGLOG_DEBUG(Service_GSP, "(STUBBED) called address=0x{:08X}, size=0x{:08X}, process={}",
size, process->process_id); address, size, process->process_id);
} }
void GSP_GPU::SetLedForceOff(Kernel::HLERequestContext& ctx) { void GSP_GPU::SetLedForceOff(Kernel::HLERequestContext& ctx) {
@ -721,7 +723,7 @@ void GSP_GPU::SetLedForceOff(Kernel::HLERequestContext& ctx) {
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0); IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
rb.Push(RESULT_SUCCESS); rb.Push(RESULT_SUCCESS);
LOG_DEBUG(Service_GSP, "(STUBBED) called"); NGLOG_DEBUG(Service_GSP, "(STUBBED) called");
} }
SessionData* GSP_GPU::FindRegisteredThreadData(u32 thread_id) { SessionData* GSP_GPU::FindRegisteredThreadData(u32 thread_id) {