1 /* SPDX-License-Identifier: BSD-3-Clause */
2 /* Copyright(c) 2007-2022 Intel Corporation */
3 #include "qat_freebsd.h"
4 #include "adf_common_drv.h"
5 
6 static int __init
7 qat_common_register(void)
8 {
9 	if (adf_init_aer())
10 		return EFAULT;
11 
12 	if (adf_init_fatal_error_wq())
13 		return EFAULT;
14 
15 	if (adf_register_ctl_device_driver())
16 		return EFAULT;
17 
18 	return 0;
19 }
20 
21 static void __exit
22 qat_common_unregister(void)
23 {
24 	adf_exit_vf_wq();
25 	adf_exit_aer();
26 	adf_exit_fatal_error_wq();
27 	adf_unregister_ctl_device_driver();
28 }
29 
30 static int
31 qat_common_modevent(module_t mod, int type, void *data)
32 {
33 	switch (type) {
34 	case MOD_LOAD:
35 		return qat_common_register();
36 	case MOD_UNLOAD:
37 		qat_common_unregister();
38 		return 0;
39 	default:
40 		return EOPNOTSUPP;
41 	}
42 }
43 
44 static moduledata_t qat_common_mod = { "qat_common", qat_common_modevent, 0 };
45 
46 DECLARE_MODULE(qat_common, qat_common_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);
47 MODULE_VERSION(qat_common, 1);
48 MODULE_DEPEND(qat_common, firmware, 1, 1, 1);
49 MODULE_DEPEND(qat_common, linuxkpi, 1, 1, 1);
50