blob: 6a7584f1d6d96cf17c875d6a70e819b60f7739b4 [file] [log] [blame]
Marius Vlad0268d732016-12-01 21:45:47 +00001/*
2 * Copyright © 2016 Intel Corporation
3 *
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:
10 *
11 * The above copyright notice and this permission notice (including the next
12 * paragraph) shall be included in all copies or substantial portions of the
13 * Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21 * IN THE SOFTWARE.
22 */
23
24#ifndef IGT_KMOD_H
25#define IGT_KMOD_H
26
Arkadiusz Hiler53e7f532017-04-12 09:42:47 +020027#ifdef ANDROID
28#include <libkmod/libkmod.h>
29#else
Marius Vlad0268d732016-12-01 21:45:47 +000030#include <libkmod.h>
Arkadiusz Hiler53e7f532017-04-12 09:42:47 +020031#endif
Marius Vlad0268d732016-12-01 21:45:47 +000032
Chris Wilson137360f2017-03-23 17:09:26 +000033#include "igt_aux.h"
34
Marius Vlad0268d732016-12-01 21:45:47 +000035bool igt_kmod_is_loaded(const char *mod_name);
36void igt_kmod_list_loaded(void);
37
38int igt_kmod_load(const char *mod_name, const char *opts);
39int igt_kmod_unload(const char *mod_name, unsigned int flags);
40
41int igt_i915_driver_load(const char *opts);
42int igt_i915_driver_unload(void);
43
Chris Wilsonae492962016-12-07 11:16:54 +000044void igt_kselftests(const char *module_name,
45 const char *module_options,
Chris Wilsone6d52312016-12-22 18:05:16 +000046 const char *result_option,
Chris Wilson7a805c22017-03-13 15:00:33 +000047 const char *filter);
Marius Vlad0268d732016-12-01 21:45:47 +000048
Chris Wilson8b5453b2017-02-07 16:08:10 +000049struct igt_kselftest {
50 struct kmod_module *kmod;
51 char *module_name;
52 int kmsg;
53};
54
55struct igt_kselftest_list {
56 struct igt_list link;
57 unsigned int number;
58 char *name;
59 char param[];
60};
61
62int igt_kselftest_init(struct igt_kselftest *tst,
63 const char *module_name);
64int igt_kselftest_begin(struct igt_kselftest *tst);
65
66void igt_kselftest_get_tests(struct kmod_module *kmod,
67 const char *filter,
68 struct igt_list *tests);
69int igt_kselftest_execute(struct igt_kselftest *tst,
70 struct igt_kselftest_list *tl,
71 const char *module_options,
72 const char *result);
73
74void igt_kselftest_end(struct igt_kselftest *tst);
75void igt_kselftest_fini(struct igt_kselftest *tst);
76
Marius Vlad0268d732016-12-01 21:45:47 +000077#endif /* IGT_KMOD_H */