diff options
Diffstat (limited to 'sys/dev/ioat/ioat_test.c')
-rw-r--r-- | sys/dev/ioat/ioat_test.c | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/sys/dev/ioat/ioat_test.c b/sys/dev/ioat/ioat_test.c index 215b0363e429..3f88ed98a689 100644 --- a/sys/dev/ioat/ioat_test.c +++ b/sys/dev/ioat/ioat_test.c @@ -123,11 +123,26 @@ test_transaction *ioat_test_transaction_create(unsigned num_buffers, static bool ioat_compare_ok(struct test_transaction *tx) { - uint32_t i; + struct ioat_test *test; + char *dst, *src; + uint32_t i, j; + + test = tx->test; for (i = 0; i < tx->depth; i++) { - if (memcmp(tx->buf[2*i], tx->buf[2*i+1], tx->length) != 0) - return (false); + dst = tx->buf[2 * i + 1]; + src = tx->buf[2 * i]; + + if (test->testkind == IOAT_TEST_FILL) { + for (j = 0; j < tx->length; j += sizeof(uint64_t)) { + if (memcmp(src, &dst[j], + MIN(sizeof(uint64_t), tx->length - j)) + != 0) + return (false); + } + } else if (test->testkind == IOAT_TEST_DMA) + if (memcmp(src, dst, tx->length) != 0) + return (false); } return (true); } @@ -208,8 +223,11 @@ ioat_test_submit_1_tx(struct ioat_test *test, bus_dmaengine_t dma) struct bus_dmadesc *desc; bus_dmaengine_callback_t cb; bus_addr_t src, dest; + uint64_t fillpattern; uint32_t i, flags; + desc = NULL; + IT_LOCK(); while (TAILQ_EMPTY(&test->free_q)) msleep(&test->free_q, &ioat_test_lk, 0, "test_submit", 0); @@ -232,7 +250,15 @@ ioat_test_submit_1_tx(struct ioat_test *test, bus_dmaengine_t dma) flags = 0; } - desc = ioat_copy(dma, src, dest, tx->length, cb, tx, flags); + if (test->testkind == IOAT_TEST_DMA) + desc = ioat_copy(dma, dest, src, tx->length, cb, tx, + flags); + else if (test->testkind == IOAT_TEST_FILL) { + fillpattern = *(uint64_t *)tx->buf[2*i]; + desc = ioat_blockfill(dma, dest, fillpattern, + tx->length, cb, tx, flags); + } + if (desc == NULL) panic("Failed to allocate a ring slot " "-- this shouldn't happen!"); @@ -279,6 +305,13 @@ ioat_dma_test(void *arg) return; } + if (test->testkind >= IOAT_NUM_TESTKINDS) { + ioat_test_log(0, "Invalid kind %u\n", + (unsigned)test->testkind); + test->status[IOAT_TEST_INVALID_INPUT]++; + return; + } + dmaengine = ioat_get_dmaengine(test->channel_index); if (dmaengine == NULL) { ioat_test_log(0, "Couldn't acquire dmaengine\n"); |