control: Support unaligned read and size != 4.

This commit is contained in:
joevt 2024-01-24 00:53:51 -08:00 committed by dingusdev
parent c42e1f28d6
commit aa33a1644c

View File

@ -280,10 +280,15 @@ uint32_t ControlVideo::read(uint32_t rgn_start, uint32_t offset, int size)
value = 0;
}
if (offset & 3)
LOG_F(WARNING, "Control: unaligned read from register 0x%X", offset >> 4);
AccessDetails details;
details.size = size;
details.offset = offset & 3;
uint32_t result = pci_conv_rd_data(value, value, details);
if ((offset & 3) || (size != 4)) {
LOG_F(WARNING, "%s: read %s %03x.%c = %08x -> %0*x", this->name.c_str(), get_name_controlreg(offset), offset, SIZE_ARG(size), value, size * 2, result);
}
return BYTESWAP_SIZED(value, size);;
return result;
}
return 0;