Marius Vlad | 0268d73 | 2016-12-01 21:45:47 +0000 | [diff] [blame] | 1 | /* |
| 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 Hiler | 53e7f53 | 2017-04-12 09:42:47 +0200 | [diff] [blame] | 27 | #ifdef ANDROID |
| 28 | #include <libkmod/libkmod.h> |
| 29 | #else |
Marius Vlad | 0268d73 | 2016-12-01 21:45:47 +0000 | [diff] [blame] | 30 | #include <libkmod.h> |
Arkadiusz Hiler | 53e7f53 | 2017-04-12 09:42:47 +0200 | [diff] [blame] | 31 | #endif |
Marius Vlad | 0268d73 | 2016-12-01 21:45:47 +0000 | [diff] [blame] | 32 | |
Chris Wilson | 137360f | 2017-03-23 17:09:26 +0000 | [diff] [blame] | 33 | #include "igt_aux.h" |
| 34 | |
Marius Vlad | 0268d73 | 2016-12-01 21:45:47 +0000 | [diff] [blame] | 35 | bool igt_kmod_is_loaded(const char *mod_name); |
| 36 | void igt_kmod_list_loaded(void); |
| 37 | |
| 38 | int igt_kmod_load(const char *mod_name, const char *opts); |
| 39 | int igt_kmod_unload(const char *mod_name, unsigned int flags); |
| 40 | |
| 41 | int igt_i915_driver_load(const char *opts); |
| 42 | int igt_i915_driver_unload(void); |
| 43 | |
Chris Wilson | ae49296 | 2016-12-07 11:16:54 +0000 | [diff] [blame] | 44 | void igt_kselftests(const char *module_name, |
| 45 | const char *module_options, |
Chris Wilson | e6d5231 | 2016-12-22 18:05:16 +0000 | [diff] [blame] | 46 | const char *result_option, |
Chris Wilson | 7a805c2 | 2017-03-13 15:00:33 +0000 | [diff] [blame] | 47 | const char *filter); |
Marius Vlad | 0268d73 | 2016-12-01 21:45:47 +0000 | [diff] [blame] | 48 | |
Chris Wilson | 8b5453b | 2017-02-07 16:08:10 +0000 | [diff] [blame] | 49 | struct igt_kselftest { |
| 50 | struct kmod_module *kmod; |
| 51 | char *module_name; |
| 52 | int kmsg; |
| 53 | }; |
| 54 | |
| 55 | struct igt_kselftest_list { |
| 56 | struct igt_list link; |
| 57 | unsigned int number; |
| 58 | char *name; |
| 59 | char param[]; |
| 60 | }; |
| 61 | |
| 62 | int igt_kselftest_init(struct igt_kselftest *tst, |
| 63 | const char *module_name); |
| 64 | int igt_kselftest_begin(struct igt_kselftest *tst); |
| 65 | |
| 66 | void igt_kselftest_get_tests(struct kmod_module *kmod, |
| 67 | const char *filter, |
| 68 | struct igt_list *tests); |
| 69 | int igt_kselftest_execute(struct igt_kselftest *tst, |
| 70 | struct igt_kselftest_list *tl, |
| 71 | const char *module_options, |
| 72 | const char *result); |
| 73 | |
| 74 | void igt_kselftest_end(struct igt_kselftest *tst); |
| 75 | void igt_kselftest_fini(struct igt_kselftest *tst); |
| 76 | |
Marius Vlad | 0268d73 | 2016-12-01 21:45:47 +0000 | [diff] [blame] | 77 | #endif /* IGT_KMOD_H */ |