opnsense-src/sys/dev/qat/qat_api/freebsd_module.c
Julian Grajkowski 78ee8d1c4c qat: Import a new Intel (R) QAT driver
QAT in-tree driver ported from out-of-tree release available
from 01.org.

The driver exposes complete cryptography and data compression
API in the kernel and integrates with Open Crypto Framework.
Details of supported operations, devices and usage can be found
in man and on 01.org.

Patch co-authored by: Krzysztof Zdziarski <krzysztofx.zdziarski@intel.com>
Patch co-authored by: Michal Jaraczewski <michalx.jaraczewski@intel.com>
Patch co-authored by: Michal Gulbicki <michalx.gulbicki@intel.com>
Patch co-authored by: Julian Grajkowski <julianx.grajkowski@intel.com>
Patch co-authored by: Piotr Kasierski <piotrx.kasierski@intel.com>
Patch co-authored by: Adam Czupryna <adamx.czupryna@intel.com>
Patch co-authored by: Konrad Zelazny <konradx.zelazny@intel.com>
Patch co-authored by: Katarzyna Rucinska <katarzynax.kargol@intel.com>
Patch co-authored by: Lukasz Kolodzinski <lukaszx.kolodzinski@intel.com>
Patch co-authored by: Zbigniew Jedlinski <zbigniewx.jedlinski@intel.com>

Reviewed by:	markj, jhb (OCF integration)
Reviewed by:	debdrup, pauamma (docs)
Sponsored by:	Intel Corporation
Differential Revision: https://reviews.freebsd.org/D34632
2022-07-27 11:12:35 -04:00

68 lines
1.3 KiB
C

/* SPDX-License-Identifier: BSD-3-Clause */
/* Copyright(c) 2007-2022 Intel Corporation */
/* $FreeBSD$ */
#include "adf_cfg.h"
#include "cpa.h"
#include "icp_accel_devices.h"
#include "adf_common_drv.h"
#include "icp_adf_debug.h"
#include "icp_adf_init.h"
#include "lac_sal_ctrl.h"
extern struct mtx *adfDevicesLock;
static int
adf_module_load(void)
{
CpaStatus ret = CPA_STATUS_SUCCESS;
qatUtilsMutexInit(&adfDevicesLock);
ret = SalCtrl_AdfServicesRegister();
if (ret != CPA_STATUS_SUCCESS) {
qatUtilsMutexDestroy(&adfDevicesLock);
return EFAULT;
}
return 0;
}
static int
adf_module_unload(void)
{
CpaStatus ret = CPA_STATUS_SUCCESS;
ret = SalCtrl_AdfServicesUnregister();
if (ret != CPA_STATUS_SUCCESS) {
return EBUSY;
}
qatUtilsMutexDestroy(&adfDevicesLock);
return 0;
}
static int
adf_modevent(module_t mod, int type, void *arg)
{
int error;
switch (type) {
case MOD_LOAD:
error = adf_module_load();
break;
case MOD_UNLOAD:
error = adf_module_unload();
break;
default:
error = EOPNOTSUPP;
break;
}
return (error);
}
static moduledata_t adf_mod = { "qat_api", adf_modevent, 0 };
DECLARE_MODULE(qat_api, adf_mod, SI_SUB_DRIVERS, SI_ORDER_SECOND);
MODULE_VERSION(qat_api, 1);
MODULE_DEPEND(qat_api, qat_common, 1, 1, 1);
MODULE_DEPEND(qat_api, linuxkpi, 1, 1, 1);