Skip to content

Commit 1fae4d2

Browse files
joevtmaximumspatium
authored andcommitted
maciotwo: Standardize log message format.
1 parent 881c0f7 commit 1fae4d2

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

devices/ioctrl/maciotwo.cpp

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ MacIoTwo::MacIoTwo(std::string name, uint16_t dev_id) : MacIoBase(name, dev_id)
5757
uint32_t MacIoTwo::read(uint32_t rgn_start, uint32_t offset, int size) {
5858
uint32_t value;
5959

60+
LOG_F(9, "%s: read @%x.%c", this->get_name().c_str(),
61+
offset, SIZE_ARG(size));
62+
6063
unsigned sub_addr = (offset >> 12) & 0x7F;
6164

6265
switch (sub_addr) {
@@ -108,14 +111,18 @@ uint32_t MacIoTwo::read(uint32_t rgn_start, uint32_t offset, int size) {
108111
value = this->nvram->read_byte((offset >> 4) & 0x1FFF);
109112
} else {
110113
value = 0;
111-
LOG_F(WARNING, "Attempting to read from unmapped I/O space: %x", offset);
114+
LOG_F(WARNING, "%s: read @%x.%c", this->get_name().c_str(),
115+
offset, SIZE_ARG(size));
112116
}
113117
}
114118

115119
return value;
116120
}
117121

118122
void MacIoTwo::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size) {
123+
LOG_F(9, "%s: write @%x.%c = %0*x", this->get_name().c_str(),
124+
offset, SIZE_ARG(size), size * 2, value);
125+
119126
unsigned sub_addr = (offset >> 12) & 0x7F;
120127

121128
switch (sub_addr) {
@@ -165,7 +172,8 @@ void MacIoTwo::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int si
165172
if (sub_addr >= 0x60) {
166173
this->nvram->write_byte((offset - 0x60000) >> 4, value);
167174
} else {
168-
LOG_F(WARNING, "Attempting to write to unmapped I/O space: %x", offset);
175+
LOG_F(WARNING, "%s: write @%x.%c = %0*x", this->get_name().c_str(),
176+
offset, SIZE_ARG(size), size * 2, value);
169177
}
170178
}
171179
}
@@ -280,15 +288,18 @@ uint32_t MacIoTwo::mio_ctrl_read(uint32_t offset, int size) {
280288
case MIO_OHARE_ID:
281289
value = (this->fp_id << 24) | (this->mon_id << 16) | (this->mb_id << 8) |
282290
(this->cpu_id | (this->emmo << 4));
291+
LOG_F(9, "%s: read OHARE_ID @%02x = %08x",
292+
this->get_name().c_str(), offset, value);
283293
break;
284294
case MIO_OHARE_FEAT_CTRL:
285-
LOG_F(9, "read from MIO:Feat_Ctrl register");
286295
value = this->feat_ctrl;
296+
LOG_F(9, "%s: read FEAT_CTRL @%02x = %08x",
297+
this->get_name().c_str(), offset, value);
287298
break;
288299
default:
289300
value = 0;
290-
LOG_F(WARNING, "read from unknown MIO register at %x", offset);
291-
break;
301+
LOG_F(WARNING, "%s: read @%02x",
302+
this->get_name().c_str(), offset);
292303
}
293304

294305
return BYTESWAP_32(value);
@@ -319,18 +330,22 @@ void MacIoTwo::mio_ctrl_write(uint32_t offset, uint32_t value, int size) {
319330
clear_cpu_int();
320331
break;
321332
case MIO_OHARE_ID:
322-
LOG_F(WARNING, "Attempted to write %x to MIO:ID at %x", value, offset);
333+
LOG_F(ERROR, "%s: write OHARE_ID @%x.%c = %0*x",
334+
this->get_name().c_str(), offset, SIZE_ARG(size), size * 2, value);
323335
break;
324336
case MIO_OHARE_FEAT_CTRL:
337+
LOG_F(WARNING, "%s: write FEAT_CTRL @%x.%c = %0*x",
338+
this->get_name().c_str(), offset, SIZE_ARG(size), size * 2, value);
325339
this->feature_control(BYTESWAP_32(value));
326340
break;
327341
case MIO_AUX_CTRL:
328-
LOG_F(9, "write %x to MIO:Aux_Ctrl register", value);
342+
LOG_F(9, "%s: write AUX_CTRL @%x.%c = %0*x",
343+
this->get_name().c_str(), offset, SIZE_ARG(size), size * 2, value);
329344
this->aux_ctrl = value;
330345
break;
331346
default:
332-
LOG_F(WARNING, "write %x to unknown MIO register at %x", value, offset);
333-
break;
347+
LOG_F(WARNING, "%s: write @%x.%c = %0*x",
348+
this->get_name().c_str(), offset, SIZE_ARG(size), size * 2, value);
334349
}
335350
}
336351

0 commit comments

Comments
 (0)