Skip to content

Commit d7c2aca

Browse files
joevtdingusdev
authored andcommitted
maciotwo: Standardize log message format.
1 parent f037f5b commit d7c2aca

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) {
@@ -167,7 +174,8 @@ void MacIoTwo::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int si
167174
if (sub_addr >= 0x60) {
168175
this->nvram->write_byte((offset - 0x60000) >> 4, value);
169176
} else {
170-
LOG_F(WARNING, "Attempting to write to unmapped I/O space: %x", offset);
177+
LOG_F(WARNING, "%s: write @%x.%c = %0*x", this->get_name().c_str(),
178+
offset, SIZE_ARG(size), size * 2, value);
171179
}
172180
}
173181
}
@@ -284,15 +292,18 @@ uint32_t MacIoTwo::mio_ctrl_read(uint32_t offset, int size) {
284292
case MIO_OHARE_ID:
285293
value = (this->fp_id << 24) | (this->mon_id << 16) | (this->mb_id << 8) |
286294
(this->cpu_id | (this->emmo << 4));
295+
LOG_F(9, "%s: read OHARE_ID @%02x = %08x",
296+
this->get_name().c_str(), offset, value);
287297
break;
288298
case MIO_OHARE_FEAT_CTRL:
289-
LOG_F(9, "read from MIO:Feat_Ctrl register");
290299
value = this->feat_ctrl;
300+
LOG_F(9, "%s: read FEAT_CTRL @%02x = %08x",
301+
this->get_name().c_str(), offset, value);
291302
break;
292303
default:
293304
value = 0;
294-
LOG_F(WARNING, "read from unknown MIO register at %x", offset);
295-
break;
305+
LOG_F(WARNING, "%s: read @%02x",
306+
this->get_name().c_str(), offset);
296307
}
297308

298309
return BYTESWAP_32(value);
@@ -323,18 +334,22 @@ void MacIoTwo::mio_ctrl_write(uint32_t offset, uint32_t value, int size) {
323334
clear_cpu_int();
324335
break;
325336
case MIO_OHARE_ID:
326-
LOG_F(WARNING, "Attempted to write %x to MIO:ID at %x", value, offset);
337+
LOG_F(ERROR, "%s: write OHARE_ID @%x.%c = %0*x",
338+
this->get_name().c_str(), offset, SIZE_ARG(size), size * 2, value);
327339
break;
328340
case MIO_OHARE_FEAT_CTRL:
341+
LOG_F(WARNING, "%s: write FEAT_CTRL @%x.%c = %0*x",
342+
this->get_name().c_str(), offset, SIZE_ARG(size), size * 2, value);
329343
this->feature_control(BYTESWAP_32(value));
330344
break;
331345
case MIO_AUX_CTRL:
332-
LOG_F(9, "write %x to MIO:Aux_Ctrl register", value);
346+
LOG_F(9, "%s: write AUX_CTRL @%x.%c = %0*x",
347+
this->get_name().c_str(), offset, SIZE_ARG(size), size * 2, value);
333348
this->aux_ctrl = value;
334349
break;
335350
default:
336-
LOG_F(WARNING, "write %x to unknown MIO register at %x", value, offset);
337-
break;
351+
LOG_F(WARNING, "%s: write @%x.%c = %0*x",
352+
this->get_name().c_str(), offset, SIZE_ARG(size), size * 2, value);
338353
}
339354
}
340355

0 commit comments

Comments
 (0)