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