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
1 changed files with 16 additions and 13 deletions

View File

@ -1,6 +1,6 @@
/*
DingusPPC - The Experimental PowerPC Macintosh emulator
Copyright (C) 2018-23 divingkatae and maximum
Copyright (C) 2018-24 divingkatae and maximum
(theweirdo) spatium
(Contact divingkatae#1017 or powermax#2286 on Discord for more info)
@ -32,7 +32,7 @@ using namespace Hammerhead;
HammerheadCtrl::HammerheadCtrl() : MemCtrlBase()
{
this->name = "Hammerhead Memory Controller";
this->name = "Hammerhead";
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
break;
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;
}
@ -98,35 +99,37 @@ void HammerheadCtrl::write(uint32_t rgn_start, uint32_t offset, uint32_t value,
} else { // update the MSB part
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;
}
switch (offset) {
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;
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;
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;
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;
case HammerheadReg::ARBITER_CONFIG:
this->arb_config = value;
break;
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)
{
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) {
@ -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;
break;
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];
}
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)) {
ABORT_F("Hammerhead: could not allocate physical RAM storage");
ABORT_F("%s: could not allocate physical RAM storage", this->name.c_str());
}
}