hw: edu: some fixes
v2 cover hw: edu: some fixes
Recently I am considering write a driver for edu device. After reading the spec, I found these three small issue. Two first two related the MMIO access and the third is related the DMA operation.
Change since v1:
Fix format compile error on Windows
Li Qiang (3):
tests: fw_cfg: add splash time test case
edu: mmio: set 'max_access_size' to 8
edu: mmio: allow mmio read dispatch accept 8 bytes
hw/misc/edu.c | 13 +++++++++++++ tests/fw_cfg-test.c | 19 +++++++++++++++++++ 2 files changed, 32 insertions(+)
Signature · 1 line
2.17.1
PATCH v2 1/3 tests: fw_cfg: add splash time test case
--- tests/fw_cfg-test.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
tests/fw_cfg-test.c +19 -0
@@ -192,6 +192,24 @@ static void test_fw_cfg_reboot_timeout(void)qtest_quit (s); } +static void test_fw_cfg_splash_time (void ) +{ +QFWCFG *fw_cfg; +QTestState *s; +uint16_t splash_time =0 ; +size_t filesize; + + s =qtest_init ("-boot splash-time=12" ); + fw_cfg =pc_fw_cfg_init (s); + + filesize =qfw_cfg_get_file (fw_cfg,"etc/boot-menu-wait" , + &splash_time,sizeof (splash_time)); + g_assert_cmpint(filesize, ==, sizeof(splash_time)); + g_assert_cmpint(splash_time, ==, 12); +pc_fw_cfg_uninit (fw_cfg); +qtest_quit (s); +} +int main (int argc,char **argv) {int ret;
@@ -214,6 +232,7 @@ int main(int argc, char **argv)qtest_add_func ("fw_cfg/numa" , test_fw_cfg_numa);qtest_add_func ("fw_cfg/boot_menu" , test_fw_cfg_boot_menu);qtest_add_func ("fw_cfg/reboot_timeout" , test_fw_cfg_reboot_timeout); +qtest_add_func ("fw_cfg/splash_time" , test_fw_cfg_splash_time); ret =g_test_run ();
Signature · 1 line
2.17.1
PATCH v2 3/3 edu: mmio: allow mmio read dispatch accept 8 bytes
In reply to Li QiangThe edu spec said when address >= 0x80, the MMIO area can be accessed by 8 bytes.
---
Change since v1:
Fix format compile error on Windows
hw/misc/edu.c | 4 ++++ 1 file changed, 4 insertions(+)
hw/misc/edu.c +4 -0
@@ -189,6 +189,10 @@ static uint64_t edu_mmio_read(void *opaque, hwaddr addr, unsigned size)return val; } +if (addr >=0x80 && size !=4 && size !=8 ) { +return val; + } +switch (addr) {case 0x00 : val =0x010000edu ;
Signature · 1 line
2.17.1
PATCH v2 2/3 edu: mmio: set 'max_access_size' to 8
In reply to Li QiangThe edu spec said, the MMIO area can be accessed by 8 bytes. However currently the 'max_access_size' is not so the MMIO access dispatch can only access 4 bytes one time. This patch fixes this to respect the spec.
Notice: here the 'min_access_size' is not a must, I set this for completement.
--- hw/misc/edu.c | 9 +++++++++ 1 file changed, 9 insertions(+)
hw/misc/edu.c +9 -0
@@ -289,6 +289,15 @@ static const MemoryRegionOps edu_mmio_ops = { .read = edu_mmio_read, .write = edu_mmio_write, .endianness = DEVICE_NATIVE_ENDIAN, + .valid = { + .min_access_size = 4, + .max_access_size = 8, + }, + .impl = { + .min_access_size = 4, + .max_access_size = 8, + }, + };/*
Signature · 1 line
2.17.1