ioat_test.h revision 290021
1287117Scem/*-
2287117Scem * Copyright (C) 2012 Intel Corporation
3287117Scem * All rights reserved.
4287117Scem *
5287117Scem * Redistribution and use in source and binary forms, with or without
6287117Scem * modification, are permitted provided that the following conditions
7287117Scem * are met:
8287117Scem * 1. Redistributions of source code must retain the above copyright
9287117Scem *    notice, this list of conditions and the following disclaimer.
10287117Scem * 2. Redistributions in binary form must reproduce the above copyright
11287117Scem *    notice, this list of conditions and the following disclaimer in the
12287117Scem *    documentation and/or other materials provided with the distribution.
13287117Scem *
14287117Scem * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15287117Scem * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16287117Scem * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17287117Scem * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18287117Scem * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19287117Scem * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20287117Scem * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21287117Scem * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22287117Scem * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23287117Scem * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24287117Scem * SUCH DAMAGE.
25287117Scem */
26287117Scem
27287117Scem__FBSDID("$FreeBSD: head/sys/dev/ioat/ioat_test.h 290021 2015-10-26 19:34:12Z cem $");
28287117Scem
29287117Scem#ifndef __IOAT_TEST_H__
30287117Scem#define __IOAT_TEST_H__
31287117Scem
32289733Scemenum ioat_res {
33289733Scem	IOAT_TEST_OK = 0,
34289733Scem	IOAT_TEST_NO_DMA_ENGINE,
35289733Scem	IOAT_TEST_NO_MEMORY,
36289733Scem	IOAT_TEST_MISCOMPARE,
37290021Scem	IOAT_TEST_INVALID_INPUT,
38289733Scem	IOAT_NUM_RES
39289733Scem};
40289733Scem
41290021Scemenum ioat_test_kind {
42290021Scem	IOAT_TEST_FILL = 0,
43290021Scem	IOAT_TEST_DMA,
44290021Scem	IOAT_NUM_TESTKINDS
45290021Scem};
46290021Scem
47289733Scemstruct test_transaction;
48289733Scem
49287117Scemstruct ioat_test {
50289733Scem	volatile uint32_t status[IOAT_NUM_RES];
51287117Scem	uint32_t channel_index;
52289733Scem
53290021Scem	enum ioat_test_kind testkind;
54290021Scem
55289733Scem	/* HW max of 1MB */
56289733Scem	uint32_t buffer_size;
57289733Scem	uint32_t chain_depth;
58289733Scem	uint32_t transactions;
59289733Scem
60289733Scem	/*
61289733Scem	 * If non-zero, duration is time in ms;
62289733Scem	 * If zero, bounded by 'transactions' above.
63289733Scem	 */
64289733Scem	uint32_t duration;
65289733Scem
66289733Scem	/* If true, check for miscompares after a copy. */
67289733Scem	bool verify;
68289733Scem
69289733Scem	/* Internal usage -- not test inputs */
70289733Scem	TAILQ_HEAD(, test_transaction) free_q;
71289733Scem	TAILQ_HEAD(, test_transaction) pend_q;
72289733Scem	volatile bool too_late;
73287117Scem};
74287117Scem
75287117Scem#define	IOAT_DMATEST	_IOWR('i', 0, struct ioat_test)
76287117Scem
77287117Scem#endif /* __IOAT_TEST_H__ */
78