hc
2024-01-04 1543e317f1da31b75942316931e8f491a8920811
kernel/drivers/crypto/qat/qat_common/qat_uclo.c
....@@ -1,53 +1,10 @@
1
-/*
2
- This file is provided under a dual BSD/GPLv2 license. When using or
3
- redistributing this file, you may do so under either license.
4
-
5
- GPL LICENSE SUMMARY
6
- Copyright(c) 2014 Intel Corporation.
7
- This program is free software; you can redistribute it and/or modify
8
- it under the terms of version 2 of the GNU General Public License as
9
- published by the Free Software Foundation.
10
-
11
- This program is distributed in the hope that it will be useful, but
12
- WITHOUT ANY WARRANTY; without even the implied warranty of
13
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- General Public License for more details.
15
-
16
- Contact Information:
17
- qat-linux@intel.com
18
-
19
- BSD LICENSE
20
- Copyright(c) 2014 Intel Corporation.
21
- Redistribution and use in source and binary forms, with or without
22
- modification, are permitted provided that the following conditions
23
- are met:
24
-
25
- * Redistributions of source code must retain the above copyright
26
- notice, this list of conditions and the following disclaimer.
27
- * Redistributions in binary form must reproduce the above copyright
28
- notice, this list of conditions and the following disclaimer in
29
- the documentation and/or other materials provided with the
30
- distribution.
31
- * Neither the name of Intel Corporation nor the names of its
32
- contributors may be used to endorse or promote products derived
33
- from this software without specific prior written permission.
34
-
35
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
36
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
37
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
38
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
39
- OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
42
- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
43
- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
44
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
45
- OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
46
-*/
1
+// SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0-only)
2
+/* Copyright(c) 2014 - 2020 Intel Corporation */
473 #include <linux/slab.h>
484 #include <linux/ctype.h>
495 #include <linux/kernel.h>
506 #include <linux/delay.h>
7
+#include <linux/pci_ids.h>
518 #include "adf_accel_devices.h"
529 #include "adf_common_drv.h"
5310 #include "icp_qat_uclo.h"
....@@ -415,16 +372,16 @@
415372 unsigned int ustore_size;
416373 unsigned int patt_pos;
417374 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle;
418
- uint64_t *fill_data;
375
+ u64 *fill_data;
419376
420377 uof_image = image->img_ptr;
421
- fill_data = kcalloc(ICP_QAT_UCLO_MAX_USTORE, sizeof(uint64_t),
378
+ fill_data = kcalloc(ICP_QAT_UCLO_MAX_USTORE, sizeof(u64),
422379 GFP_KERNEL);
423380 if (!fill_data)
424381 return -ENOMEM;
425382 for (i = 0; i < ICP_QAT_UCLO_MAX_USTORE; i++)
426383 memcpy(&fill_data[i], &uof_image->fill_pattern,
427
- sizeof(uint64_t));
384
+ sizeof(u64));
428385 page = image->page;
429386
430387 for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) {
....@@ -754,11 +711,11 @@
754711 qat_uclo_get_dev_type(struct icp_qat_fw_loader_handle *handle)
755712 {
756713 switch (handle->pci_dev->device) {
757
- case ADF_DH895XCC_PCI_DEVICE_ID:
714
+ case PCI_DEVICE_ID_INTEL_QAT_DH895XCC:
758715 return ICP_QAT_AC_895XCC_DEV_TYPE;
759
- case ADF_C62X_PCI_DEVICE_ID:
716
+ case PCI_DEVICE_ID_INTEL_QAT_C62X:
760717 return ICP_QAT_AC_C62X_DEV_TYPE;
761
- case ADF_C3XXX_PCI_DEVICE_ID:
718
+ case PCI_DEVICE_ID_INTEL_QAT_C3XXX:
762719 return ICP_QAT_AC_C3XXX_DEV_TYPE;
763720 default:
764721 pr_err("QAT: unsupported device 0x%x\n",
....@@ -795,7 +752,7 @@
795752 case ICP_GPA_ABS:
796753 case ICP_GPB_ABS:
797754 ctx_mask = 0;
798
- /* fall through */
755
+ fallthrough;
799756 case ICP_GPA_REL:
800757 case ICP_GPB_REL:
801758 return qat_hal_init_gpr(handle, ae, ctx_mask, reg_type,
....@@ -805,7 +762,7 @@
805762 case ICP_SR_RD_ABS:
806763 case ICP_DR_RD_ABS:
807764 ctx_mask = 0;
808
- /* fall through */
765
+ fallthrough;
809766 case ICP_SR_REL:
810767 case ICP_DR_REL:
811768 case ICP_SR_RD_REL:
....@@ -815,7 +772,7 @@
815772 case ICP_SR_WR_ABS:
816773 case ICP_DR_WR_ABS:
817774 ctx_mask = 0;
818
- /* fall through */
775
+ fallthrough;
819776 case ICP_SR_WR_REL:
820777 case ICP_DR_WR_REL:
821778 return qat_hal_init_wr_xfer(handle, ae, ctx_mask, reg_type,
....@@ -985,7 +942,7 @@
985942 pr_err("QAT: UOF incompatible\n");
986943 return -EINVAL;
987944 }
988
- obj_handle->uword_buf = kcalloc(UWORD_CPYBUF_SIZE, sizeof(uint64_t),
945
+ obj_handle->uword_buf = kcalloc(UWORD_CPYBUF_SIZE, sizeof(u64),
989946 GFP_KERNEL);
990947 if (!obj_handle->uword_buf)
991948 return -ENOMEM;
....@@ -1189,7 +1146,7 @@
11891146 return 0;
11901147 }
11911148
1192
-#define ADD_ADDR(high, low) ((((uint64_t)high) << 32) + low)
1149
+#define ADD_ADDR(high, low) ((((u64)high) << 32) + low)
11931150 #define BITS_IN_DWORD 32
11941151
11951152 static int qat_uclo_auth_fw(struct icp_qat_fw_loader_handle *handle,
....@@ -1434,7 +1391,7 @@
14341391 status = qat_uclo_auth_fw(handle, desc);
14351392 qat_uclo_ummap_auth_fw(handle, &desc);
14361393 } else {
1437
- if (handle->pci_dev->device == ADF_C3XXX_PCI_DEVICE_ID) {
1394
+ if (handle->pci_dev->device == PCI_DEVICE_ID_INTEL_QAT_C3XXX) {
14381395 pr_err("QAT: C3XXX doesn't support unsigned MMP\n");
14391396 return -EINVAL;
14401397 }
....@@ -1518,10 +1475,10 @@
15181475
15191476 static void qat_uclo_fill_uwords(struct icp_qat_uclo_objhandle *obj_handle,
15201477 struct icp_qat_uclo_encap_page *encap_page,
1521
- uint64_t *uword, unsigned int addr_p,
1522
- unsigned int raddr, uint64_t fill)
1478
+ u64 *uword, unsigned int addr_p,
1479
+ unsigned int raddr, u64 fill)
15231480 {
1524
- uint64_t uwrd = 0;
1481
+ u64 uwrd = 0;
15251482 unsigned int i;
15261483
15271484 if (!encap_page) {
....@@ -1551,12 +1508,12 @@
15511508 {
15521509 unsigned int uw_physical_addr, uw_relative_addr, i, words_num, cpylen;
15531510 struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle;
1554
- uint64_t fill_pat;
1511
+ u64 fill_pat;
15551512
15561513 /* load the page starting at appropriate ustore address */
15571514 /* get fill-pattern from an image -- they are all the same */
15581515 memcpy(&fill_pat, obj_handle->ae_uimage[0].img_ptr->fill_pattern,
1559
- sizeof(uint64_t));
1516
+ sizeof(u64));
15601517 uw_physical_addr = encap_page->beg_addr_p;
15611518 uw_relative_addr = 0;
15621519 words_num = encap_page->micro_words_num;