Cc: Andrew Jones <[email protected]>
Signed-off-by: Alexander Gordeev <[email protected]>
---
 lib/pci-testdev.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/lib/pci-testdev.c b/lib/pci-testdev.c
index de97f82..dd6a5ac 100644
--- a/lib/pci-testdev.c
+++ b/lib/pci-testdev.c
@@ -113,6 +113,9 @@ static bool pci_testdev_one(struct pci_test_dev_hdr *test,
                            struct pci_testdev_ops *ops)
 {
        u8 width;
+       u32 sig, off;
+       const int nr_writes = 16;
+       int i;
 
        ops->write8(test_nr, &test->test);
        assert(ops->read32(&test->count) == 0);
@@ -121,6 +124,19 @@ static bool pci_testdev_one(struct pci_test_dev_hdr *test,
        if ((width != 1) && (width != 2) && (width != 4))
                return false;
 
+       sig = ops->read32(&test->data);
+       off = ops->read32(&test->offset);
+
+       for (i = 0; i < nr_writes; i++) {
+               switch (width) {
+                       case 1: ops->write8 (sig, (void*)test + off); break;
+                       case 2: ops->write16(sig, (void*)test + off); break;
+                       case 4: ops->write32(sig, (void*)test + off); break;
+               }
+       }
+
+       assert((int)ops->read32(&test->count) == nr_writes);
+
        return true;
 }
 
-- 
1.8.3.1

_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

Reply via email to