forked from Minki/linux
crypto: qat - target fw images to specific AEs
Introduce support for devices that require multiple firmware images. If a device requires more than a firmware image to operate, load the image to the appropriate Acceleration Engine (AE). Signed-off-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com> Reviewed-by: Fiona Trahe <fiona.trahe@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
ff81072003
commit
e73916f208
@ -175,6 +175,9 @@ struct adf_hw_device_data {
|
||||
void (*enable_ints)(struct adf_accel_dev *accel_dev);
|
||||
int (*enable_vf2pf_comms)(struct adf_accel_dev *accel_dev);
|
||||
void (*reset_device)(struct adf_accel_dev *accel_dev);
|
||||
char *(*uof_get_name)(u32 obj_num);
|
||||
u32 (*uof_get_num_objs)(void);
|
||||
u32 (*uof_get_ae_mask)(u32 obj_num);
|
||||
struct adf_hw_csr_ops csr_ops;
|
||||
const char *fw_name;
|
||||
const char *fw_mmp_name;
|
||||
|
@ -7,12 +7,55 @@
|
||||
#include "adf_common_drv.h"
|
||||
#include "icp_qat_uclo.h"
|
||||
|
||||
static int adf_ae_fw_load_images(struct adf_accel_dev *accel_dev, void *fw_addr,
|
||||
u32 fw_size)
|
||||
{
|
||||
struct adf_fw_loader_data *loader_data = accel_dev->fw_loader;
|
||||
struct adf_hw_device_data *hw_device = accel_dev->hw_device;
|
||||
struct icp_qat_fw_loader_handle *loader;
|
||||
char *obj_name;
|
||||
u32 num_objs;
|
||||
u32 ae_mask;
|
||||
int i;
|
||||
|
||||
loader = loader_data->fw_loader;
|
||||
num_objs = hw_device->uof_get_num_objs();
|
||||
|
||||
for (i = 0; i < num_objs; i++) {
|
||||
obj_name = hw_device->uof_get_name(i);
|
||||
ae_mask = hw_device->uof_get_ae_mask(i);
|
||||
|
||||
if (qat_uclo_set_cfg_ae_mask(loader, ae_mask)) {
|
||||
dev_err(&GET_DEV(accel_dev),
|
||||
"Invalid mask for UOF image\n");
|
||||
goto out_err;
|
||||
}
|
||||
if (qat_uclo_map_obj(loader, fw_addr, fw_size, obj_name)) {
|
||||
dev_err(&GET_DEV(accel_dev),
|
||||
"Failed to map UOF firmware\n");
|
||||
goto out_err;
|
||||
}
|
||||
if (qat_uclo_wr_all_uimage(loader)) {
|
||||
dev_err(&GET_DEV(accel_dev),
|
||||
"Failed to load UOF firmware\n");
|
||||
goto out_err;
|
||||
}
|
||||
qat_uclo_del_obj(loader);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
out_err:
|
||||
adf_ae_fw_release(accel_dev);
|
||||
return -EFAULT;
|
||||
}
|
||||
|
||||
int adf_ae_fw_load(struct adf_accel_dev *accel_dev)
|
||||
{
|
||||
struct adf_fw_loader_data *loader_data = accel_dev->fw_loader;
|
||||
struct adf_hw_device_data *hw_device = accel_dev->hw_device;
|
||||
void *uof_addr, *mmp_addr;
|
||||
u32 uof_size, mmp_size;
|
||||
void *fw_addr, *mmp_addr;
|
||||
u32 fw_size, mmp_size;
|
||||
|
||||
if (!hw_device->fw_name)
|
||||
return 0;
|
||||
@ -30,15 +73,20 @@ int adf_ae_fw_load(struct adf_accel_dev *accel_dev)
|
||||
goto out_err;
|
||||
}
|
||||
|
||||
uof_size = loader_data->uof_fw->size;
|
||||
uof_addr = (void *)loader_data->uof_fw->data;
|
||||
fw_size = loader_data->uof_fw->size;
|
||||
fw_addr = (void *)loader_data->uof_fw->data;
|
||||
mmp_size = loader_data->mmp_fw->size;
|
||||
mmp_addr = (void *)loader_data->mmp_fw->data;
|
||||
|
||||
if (qat_uclo_wr_mimage(loader_data->fw_loader, mmp_addr, mmp_size)) {
|
||||
dev_err(&GET_DEV(accel_dev), "Failed to load MMP\n");
|
||||
goto out_err;
|
||||
}
|
||||
if (qat_uclo_map_obj(loader_data->fw_loader, uof_addr, uof_size, NULL)) {
|
||||
|
||||
if (hw_device->uof_get_num_objs)
|
||||
return adf_ae_fw_load_images(accel_dev, fw_addr, fw_size);
|
||||
|
||||
if (qat_uclo_map_obj(loader_data->fw_loader, fw_addr, fw_size, NULL)) {
|
||||
dev_err(&GET_DEV(accel_dev), "Failed to map FW\n");
|
||||
goto out_err;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user