hammerhead: use instance name in logging messages.

This commit is contained in:
Maxim Poliakovski 2024-04-07 18:31:26 +02:00
parent 19dcb43658
commit 7972a0f2a8

View File

@ -1,6 +1,6 @@
/* /*
DingusPPC - The Experimental PowerPC Macintosh emulator DingusPPC - The Experimental PowerPC Macintosh emulator
Copyright (C) 2018-23 divingkatae and maximum Copyright (C) 2018-24 divingkatae and maximum
(theweirdo) spatium (theweirdo) spatium
(Contact divingkatae#1017 or powermax#2286 on Discord for more info) (Contact divingkatae#1017 or powermax#2286 on Discord for more info)
@ -32,7 +32,7 @@ using namespace Hammerhead;
HammerheadCtrl::HammerheadCtrl() : MemCtrlBase() HammerheadCtrl::HammerheadCtrl() : MemCtrlBase()
{ {
this->name = "Hammerhead Memory Controller"; this->name = "Hammerhead";
supports_types(HWCompType::MEM_CTRL | HWCompType::MMIO_DEV); supports_types(HWCompType::MEM_CTRL | HWCompType::MMIO_DEV);
@ -75,7 +75,8 @@ uint32_t HammerheadCtrl::read(uint32_t rgn_start, uint32_t offset, int size)
result = 0; // say there is no L2 cache result = 0; // say there is no L2 cache
break; break;
default: default:
LOG_F(WARNING, "Hammerhead: unknown register read at offset 0x%X", offset); LOG_F(WARNING, "%s: unknown register read at offset 0x%X", this->name.c_str(),
offset);
return 0; return 0;
} }
@ -98,35 +99,37 @@ void HammerheadCtrl::write(uint32_t rgn_start, uint32_t offset, uint32_t value,
} else { // update the MSB part } else { // update the MSB part
bank_base[offset >> 1] = (bank_base[offset >> 1] & 0x00FFU) | (value << 8); bank_base[offset >> 1] = (bank_base[offset >> 1] & 0x00FFU) | (value << 8);
} }
LOG_F(INFO, "Hammerhead: bank base #%d set to 0x%X", offset >> 1, bank_base[offset >> 1]); LOG_F(INFO, "%s: bank base #%d set to 0x%X", this->name.c_str(),
offset >> 1, bank_base[offset >> 1]);
return; return;
} }
switch (offset) { switch (offset) {
case HammerheadReg::MEM_TIMING_0: case HammerheadReg::MEM_TIMING_0:
LOG_F(9, "Hammerhead: MEM_TIMING_0 set to 0x%X", value); LOG_F(9, "%s: MEM_TIMING_0 set to 0x%X", this->name.c_str(), value);
break; break;
case HammerheadReg::MEM_TIMING_1: case HammerheadReg::MEM_TIMING_1:
LOG_F(9, "Hammerhead: MEM_TIMING_1 set to 0x%X", value); LOG_F(9, "%s: MEM_TIMING_1 set to 0x%X", this->name.c_str(), value);
break; break;
case HammerheadReg::REFRESH_TIMING: case HammerheadReg::REFRESH_TIMING:
LOG_F(9, "Hammerhead: REFRESH_TIMING set to 0x%X", value); LOG_F(9, "%s: REFRESH_TIMING set to 0x%X", this->name.c_str(), value);
break; break;
case HammerheadReg::ROM_TIMING: case HammerheadReg::ROM_TIMING:
LOG_F(9, "Hammerhead: ROM_TIMING set to 0x%X", value); LOG_F(9, "%s: ROM_TIMING set to 0x%X", this->name.c_str(), value);
break; break;
case HammerheadReg::ARBITER_CONFIG: case HammerheadReg::ARBITER_CONFIG:
this->arb_config = value; this->arb_config = value;
break; break;
default: default:
LOG_F(WARNING, "Hammerhead: unknown register write at offset 0x%X", offset); LOG_F(WARNING, "%s: unknown register write at offset 0x%X", this->name.c_str(),
offset);
} }
} }
void HammerheadCtrl::insert_ram_dimm(int slot_num, uint32_t capacity) void HammerheadCtrl::insert_ram_dimm(int slot_num, uint32_t capacity)
{ {
if (slot_num < 0 || slot_num >= 26) { if (slot_num < 0 || slot_num >= 26) {
ABORT_F("Hammerhead: invalid DIMM slot number %d", slot_num); ABORT_F("%s: invalid DIMM slot number %d", this->name.c_str(), slot_num);
} }
switch (capacity) { switch (capacity) {
@ -143,7 +146,7 @@ void HammerheadCtrl::insert_ram_dimm(int slot_num, uint32_t capacity)
this->bank_size[slot_num * 2 + 1] = DRAM_CAP_64MB; this->bank_size[slot_num * 2 + 1] = DRAM_CAP_64MB;
break; break;
default: default:
ABORT_F("Hammerhead: unsupported DRAM capacity %d", capacity); ABORT_F("%s: unsupported DRAM capacity %d", this->name.c_str(), capacity);
} }
} }
@ -155,10 +158,10 @@ void HammerheadCtrl::map_phys_ram()
total_ram += this->bank_size[i]; total_ram += this->bank_size[i];
} }
LOG_F(INFO, "Hammerhead: total RAM size = %d bytes", total_ram); LOG_F(INFO, "%s: total RAM size = %d bytes", this->name.c_str(), total_ram);
if (!add_ram_region(0x00000000, total_ram)) { if (!add_ram_region(0x00000000, total_ram)) {
ABORT_F("Hammerhead: could not allocate physical RAM storage"); ABORT_F("%s: could not allocate physical RAM storage", this->name.c_str());
} }
} }