2 * Copyright 2014 Advanced Micro Devices, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20 * OTHER DEALINGS IN THE SOFTWARE.
24 #ifndef _AMDGPU_TEST_H_
25 #define _AMDGPU_TEST_H_
30 * Define max. number of card in system which we are able to handle
32 #define MAX_CARDS_SUPPORTED 4
34 /* Forward reference for array to keep "drm" handles */
35 extern int drm_amdgpu[MAX_CARDS_SUPPORTED];
37 /************************* Basic test suite ********************************/
40 * Define basic test suite to serve as the starting point for future testing
44 * Initialize basic test suite
46 int suite_basic_tests_init();
49 * Deinitialize basic test suite
51 int suite_basic_tests_clean();
54 * Tests in basic test suite
56 extern CU_TestInfo basic_tests[];
59 * Initialize bo test suite
61 int suite_bo_tests_init();
64 * Deinitialize bo test suite
66 int suite_bo_tests_clean();
69 * Tests in bo test suite
71 extern CU_TestInfo bo_tests[];
74 * Initialize cs test suite
76 int suite_cs_tests_init();
79 * Deinitialize cs test suite
81 int suite_cs_tests_clean();
84 * Tests in cs test suite
86 extern CU_TestInfo cs_tests[];
91 static inline amdgpu_bo_handle gpu_mem_alloc(
92 amdgpu_device_handle device_handle,
99 struct amdgpu_bo_alloc_request req = {0};
100 struct amdgpu_bo_alloc_result res = {0};
103 CU_ASSERT_NOT_EQUAL(vmc_addr, NULL);
105 req.alloc_size = size;
106 req.phys_alignment = alignment;
107 req.preferred_heap = type;
110 r = amdgpu_bo_alloc(device_handle, &req, &res);
111 CU_ASSERT_EQUAL(r, 0);
113 CU_ASSERT_NOT_EQUAL(res.virtual_mc_base_address, 0);
114 CU_ASSERT_NOT_EQUAL(res.buf_handle, NULL);
115 *vmc_addr = res.virtual_mc_base_address;
116 return res.buf_handle;
119 #endif /* #ifdef _AMDGPU_TEST_H_ */