11// SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
22/* Copyright(c) 2014 - 2020 Intel Corporation */
33#include <linux/align.h>
4+ #include <linux/bitops.h>
45#include <linux/slab.h>
56#include <linux/ctype.h>
67#include <linux/kernel.h>
@@ -1205,7 +1206,6 @@ static int qat_uclo_map_suof(struct icp_qat_fw_loader_handle *handle,
12051206}
12061207
12071208#define ADD_ADDR (high , low ) ((((u64)high) << 32) + low)
1208- #define BITS_IN_DWORD 32
12091209
12101210static int qat_uclo_auth_fw (struct icp_qat_fw_loader_handle * handle ,
12111211 struct icp_qat_fw_auth_desc * desc )
@@ -1223,7 +1223,7 @@ static int qat_uclo_auth_fw(struct icp_qat_fw_loader_handle *handle,
12231223 fcu_dram_hi_csr = handle -> chip_info -> fcu_dram_addr_hi ;
12241224 fcu_dram_lo_csr = handle -> chip_info -> fcu_dram_addr_lo ;
12251225
1226- SET_CAP_CSR (handle , fcu_dram_hi_csr , ( bus_addr >> BITS_IN_DWORD ));
1226+ SET_CAP_CSR (handle , fcu_dram_hi_csr , bus_addr >> BITS_PER_TYPE ( u32 ));
12271227 SET_CAP_CSR (handle , fcu_dram_lo_csr , bus_addr );
12281228 SET_CAP_CSR (handle , fcu_ctl_csr , FCU_CTRL_CMD_AUTH );
12291229
@@ -1438,7 +1438,7 @@ static int qat_uclo_map_auth_fw(struct icp_qat_fw_loader_handle *handle,
14381438 virt_base = (uintptr_t )img_desc .dram_base_addr_v + simg_offset ;
14391439 bus_addr = img_desc .dram_bus_addr + simg_offset ;
14401440 auth_desc = img_desc .dram_base_addr_v ;
1441- auth_desc -> css_hdr_high = (unsigned int )(bus_addr >> BITS_IN_DWORD );
1441+ auth_desc -> css_hdr_high = (unsigned int )(bus_addr >> BITS_PER_TYPE ( u32 ) );
14421442 auth_desc -> css_hdr_low = (unsigned int )bus_addr ;
14431443 virt_addr = virt_base ;
14441444
@@ -1448,7 +1448,7 @@ static int qat_uclo_map_auth_fw(struct icp_qat_fw_loader_handle *handle,
14481448 sizeof (* css_hdr );
14491449 virt_addr = virt_addr + sizeof (* css_hdr );
14501450
1451- auth_desc -> fwsk_pub_high = (unsigned int )(bus_addr >> BITS_IN_DWORD );
1451+ auth_desc -> fwsk_pub_high = (unsigned int )(bus_addr >> BITS_PER_TYPE ( u32 ) );
14521452 auth_desc -> fwsk_pub_low = (unsigned int )bus_addr ;
14531453
14541454 memcpy ((void * )(uintptr_t )virt_addr ,
@@ -1470,7 +1470,7 @@ static int qat_uclo_map_auth_fw(struct icp_qat_fw_loader_handle *handle,
14701470 auth_desc -> fwsk_pub_low ) +
14711471 ICP_QAT_CSS_FWSK_PUB_LEN (handle );
14721472 virt_addr = virt_addr + ICP_QAT_CSS_FWSK_PUB_LEN (handle );
1473- auth_desc -> signature_high = (unsigned int )(bus_addr >> BITS_IN_DWORD );
1473+ auth_desc -> signature_high = (unsigned int )(bus_addr >> BITS_PER_TYPE ( u32 ) );
14741474 auth_desc -> signature_low = (unsigned int )bus_addr ;
14751475
14761476 memcpy ((void * )(uintptr_t )virt_addr ,
@@ -1484,7 +1484,7 @@ static int qat_uclo_map_auth_fw(struct icp_qat_fw_loader_handle *handle,
14841484 ICP_QAT_CSS_SIGNATURE_LEN (handle );
14851485 virt_addr += ICP_QAT_CSS_SIGNATURE_LEN (handle );
14861486
1487- auth_desc -> img_high = (unsigned int )(bus_addr >> BITS_IN_DWORD );
1487+ auth_desc -> img_high = (unsigned int )(bus_addr >> BITS_PER_TYPE ( u32 ) );
14881488 auth_desc -> img_low = (unsigned int )bus_addr ;
14891489 auth_desc -> img_len = size - ICP_QAT_AE_IMG_OFFSET (handle );
14901490 if (bus_addr + auth_desc -> img_len > img_desc .dram_bus_addr +
@@ -1507,12 +1507,12 @@ static int qat_uclo_map_auth_fw(struct icp_qat_fw_loader_handle *handle,
15071507 auth_desc -> img_ae_mode_data_low ) +
15081508 sizeof (struct icp_qat_simg_ae_mode );
15091509
1510- auth_desc -> img_ae_init_data_high = ( unsigned int )
1511- (bus_addr >> BITS_IN_DWORD );
1510+ auth_desc -> img_ae_init_data_high =
1511+ ( unsigned int ) (bus_addr >> BITS_PER_TYPE ( u32 ) );
15121512 auth_desc -> img_ae_init_data_low = (unsigned int )bus_addr ;
15131513 bus_addr += ICP_QAT_SIMG_AE_INIT_SEQ_LEN ;
1514- auth_desc -> img_ae_insts_high = ( unsigned int )
1515- (bus_addr >> BITS_IN_DWORD );
1514+ auth_desc -> img_ae_insts_high =
1515+ ( unsigned int ) (bus_addr >> BITS_PER_TYPE ( u32 ) );
15161516 auth_desc -> img_ae_insts_low = (unsigned int )bus_addr ;
15171517 virt_addr += sizeof (struct icp_qat_css_hdr );
15181518 virt_addr += ICP_QAT_CSS_FWSK_PUB_LEN (handle );
0 commit comments