[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/5] tests: fw_cfg: Support read/write of fw_cfg registers on aar
From: |
Xiang Zheng |
Subject: |
[PATCH 2/5] tests: fw_cfg: Support read/write of fw_cfg registers on aarch64 |
Date: |
Tue, 3 Dec 2019 20:27:50 +0800 |
Refer to the fw_cfg registers locations of x86 and arm in
docs/specs/fw_cfg.txt, the test codes need to differ on the addresses
for read/write.
Besides, fix the endian problems in mm_fw_cfg_select().
Signed-off-by: Xiang Zheng <address@hidden>
---
tests/libqos/fw_cfg.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/tests/libqos/fw_cfg.c b/tests/libqos/fw_cfg.c
index 1f46258f96..c1518c5e81 100644
--- a/tests/libqos/fw_cfg.c
+++ b/tests/libqos/fw_cfg.c
@@ -57,7 +57,14 @@ uint64_t qfw_cfg_get_u64(QFWCFG *fw_cfg, uint16_t key)
static void mm_fw_cfg_select(QFWCFG *fw_cfg, uint16_t key)
{
- qtest_writew(fw_cfg->qts, fw_cfg->base, key);
+ const char *arch = qtest_get_arch();
+ uint64_t offset = 0;
+
+ if (!strcmp(arch, "aarch64")) {
+ offset = 8;
+ }
+
+ qtest_writew(fw_cfg->qts, fw_cfg->base + offset, cpu_to_be16(key));
}
/*
@@ -108,9 +115,15 @@ static void mm_fw_cfg_read(QFWCFG *fw_cfg, void *data,
size_t len)
{
uint8_t *ptr = data;
int i;
+ uint64_t offset = 2;
+ const char *arch = qtest_get_arch();
+
+ if (!strcmp(arch, "aarch64")) {
+ offset = 0;
+ }
for (i = 0; i < len; i++) {
- ptr[i] = qtest_readb(fw_cfg->qts, fw_cfg->base + 2);
+ ptr[i] = qtest_readb(fw_cfg->qts, fw_cfg->base + offset);
}
}
--
2.19.1
- [PATCH 0/5] tests: Enable fw_cfg tests on AArch64, Xiang Zheng, 2019/12/03
- [PATCH 4/5] hw/arm/virt: Add FW_CFG_RAM_SIZE and FW_CFG_MAX_CPUS into fw_cfg, Xiang Zheng, 2019/12/03
- [PATCH 2/5] tests: fw_cfg: Support read/write of fw_cfg registers on aarch64,
Xiang Zheng <=
- [PATCH 5/5] tests: Enable fw_cfg test on aarch64, Xiang Zheng, 2019/12/03
- [PATCH 3/5] tests: fw_cfg: Use virt as default machine in fw_cfg-test.c, Xiang Zheng, 2019/12/03
- [PATCH 1/5] tests: fw_cfg: Rename pc_fw_cfg_* to fw_cfg_*, Xiang Zheng, 2019/12/03
- Re: [PATCH 0/5] tests: Enable fw_cfg tests on AArch64, Thomas Huth, 2019/12/03