.. | .. |
---|
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 */ |
---|
47 | 3 | #include <linux/slab.h> |
---|
48 | 4 | #include <linux/ctype.h> |
---|
49 | 5 | #include <linux/kernel.h> |
---|
50 | 6 | #include <linux/delay.h> |
---|
| 7 | +#include <linux/pci_ids.h> |
---|
51 | 8 | #include "adf_accel_devices.h" |
---|
52 | 9 | #include "adf_common_drv.h" |
---|
53 | 10 | #include "icp_qat_uclo.h" |
---|
.. | .. |
---|
415 | 372 | unsigned int ustore_size; |
---|
416 | 373 | unsigned int patt_pos; |
---|
417 | 374 | struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; |
---|
418 | | - uint64_t *fill_data; |
---|
| 375 | + u64 *fill_data; |
---|
419 | 376 | |
---|
420 | 377 | 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), |
---|
422 | 379 | GFP_KERNEL); |
---|
423 | 380 | if (!fill_data) |
---|
424 | 381 | return -ENOMEM; |
---|
425 | 382 | for (i = 0; i < ICP_QAT_UCLO_MAX_USTORE; i++) |
---|
426 | 383 | memcpy(&fill_data[i], &uof_image->fill_pattern, |
---|
427 | | - sizeof(uint64_t)); |
---|
| 384 | + sizeof(u64)); |
---|
428 | 385 | page = image->page; |
---|
429 | 386 | |
---|
430 | 387 | for (ae = 0; ae < handle->hal_handle->ae_max_num; ae++) { |
---|
.. | .. |
---|
754 | 711 | qat_uclo_get_dev_type(struct icp_qat_fw_loader_handle *handle) |
---|
755 | 712 | { |
---|
756 | 713 | switch (handle->pci_dev->device) { |
---|
757 | | - case ADF_DH895XCC_PCI_DEVICE_ID: |
---|
| 714 | + case PCI_DEVICE_ID_INTEL_QAT_DH895XCC: |
---|
758 | 715 | return ICP_QAT_AC_895XCC_DEV_TYPE; |
---|
759 | | - case ADF_C62X_PCI_DEVICE_ID: |
---|
| 716 | + case PCI_DEVICE_ID_INTEL_QAT_C62X: |
---|
760 | 717 | return ICP_QAT_AC_C62X_DEV_TYPE; |
---|
761 | | - case ADF_C3XXX_PCI_DEVICE_ID: |
---|
| 718 | + case PCI_DEVICE_ID_INTEL_QAT_C3XXX: |
---|
762 | 719 | return ICP_QAT_AC_C3XXX_DEV_TYPE; |
---|
763 | 720 | default: |
---|
764 | 721 | pr_err("QAT: unsupported device 0x%x\n", |
---|
.. | .. |
---|
795 | 752 | case ICP_GPA_ABS: |
---|
796 | 753 | case ICP_GPB_ABS: |
---|
797 | 754 | ctx_mask = 0; |
---|
798 | | - /* fall through */ |
---|
| 755 | + fallthrough; |
---|
799 | 756 | case ICP_GPA_REL: |
---|
800 | 757 | case ICP_GPB_REL: |
---|
801 | 758 | return qat_hal_init_gpr(handle, ae, ctx_mask, reg_type, |
---|
.. | .. |
---|
805 | 762 | case ICP_SR_RD_ABS: |
---|
806 | 763 | case ICP_DR_RD_ABS: |
---|
807 | 764 | ctx_mask = 0; |
---|
808 | | - /* fall through */ |
---|
| 765 | + fallthrough; |
---|
809 | 766 | case ICP_SR_REL: |
---|
810 | 767 | case ICP_DR_REL: |
---|
811 | 768 | case ICP_SR_RD_REL: |
---|
.. | .. |
---|
815 | 772 | case ICP_SR_WR_ABS: |
---|
816 | 773 | case ICP_DR_WR_ABS: |
---|
817 | 774 | ctx_mask = 0; |
---|
818 | | - /* fall through */ |
---|
| 775 | + fallthrough; |
---|
819 | 776 | case ICP_SR_WR_REL: |
---|
820 | 777 | case ICP_DR_WR_REL: |
---|
821 | 778 | return qat_hal_init_wr_xfer(handle, ae, ctx_mask, reg_type, |
---|
.. | .. |
---|
985 | 942 | pr_err("QAT: UOF incompatible\n"); |
---|
986 | 943 | return -EINVAL; |
---|
987 | 944 | } |
---|
988 | | - obj_handle->uword_buf = kcalloc(UWORD_CPYBUF_SIZE, sizeof(uint64_t), |
---|
| 945 | + obj_handle->uword_buf = kcalloc(UWORD_CPYBUF_SIZE, sizeof(u64), |
---|
989 | 946 | GFP_KERNEL); |
---|
990 | 947 | if (!obj_handle->uword_buf) |
---|
991 | 948 | return -ENOMEM; |
---|
.. | .. |
---|
1189 | 1146 | return 0; |
---|
1190 | 1147 | } |
---|
1191 | 1148 | |
---|
1192 | | -#define ADD_ADDR(high, low) ((((uint64_t)high) << 32) + low) |
---|
| 1149 | +#define ADD_ADDR(high, low) ((((u64)high) << 32) + low) |
---|
1193 | 1150 | #define BITS_IN_DWORD 32 |
---|
1194 | 1151 | |
---|
1195 | 1152 | static int qat_uclo_auth_fw(struct icp_qat_fw_loader_handle *handle, |
---|
.. | .. |
---|
1434 | 1391 | status = qat_uclo_auth_fw(handle, desc); |
---|
1435 | 1392 | qat_uclo_ummap_auth_fw(handle, &desc); |
---|
1436 | 1393 | } else { |
---|
1437 | | - if (handle->pci_dev->device == ADF_C3XXX_PCI_DEVICE_ID) { |
---|
| 1394 | + if (handle->pci_dev->device == PCI_DEVICE_ID_INTEL_QAT_C3XXX) { |
---|
1438 | 1395 | pr_err("QAT: C3XXX doesn't support unsigned MMP\n"); |
---|
1439 | 1396 | return -EINVAL; |
---|
1440 | 1397 | } |
---|
.. | .. |
---|
1518 | 1475 | |
---|
1519 | 1476 | static void qat_uclo_fill_uwords(struct icp_qat_uclo_objhandle *obj_handle, |
---|
1520 | 1477 | 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) |
---|
1523 | 1480 | { |
---|
1524 | | - uint64_t uwrd = 0; |
---|
| 1481 | + u64 uwrd = 0; |
---|
1525 | 1482 | unsigned int i; |
---|
1526 | 1483 | |
---|
1527 | 1484 | if (!encap_page) { |
---|
.. | .. |
---|
1551 | 1508 | { |
---|
1552 | 1509 | unsigned int uw_physical_addr, uw_relative_addr, i, words_num, cpylen; |
---|
1553 | 1510 | struct icp_qat_uclo_objhandle *obj_handle = handle->obj_handle; |
---|
1554 | | - uint64_t fill_pat; |
---|
| 1511 | + u64 fill_pat; |
---|
1555 | 1512 | |
---|
1556 | 1513 | /* load the page starting at appropriate ustore address */ |
---|
1557 | 1514 | /* get fill-pattern from an image -- they are all the same */ |
---|
1558 | 1515 | memcpy(&fill_pat, obj_handle->ae_uimage[0].img_ptr->fill_pattern, |
---|
1559 | | - sizeof(uint64_t)); |
---|
| 1516 | + sizeof(u64)); |
---|
1560 | 1517 | uw_physical_addr = encap_page->beg_addr_p; |
---|
1561 | 1518 | uw_relative_addr = 0; |
---|
1562 | 1519 | words_num = encap_page->micro_words_num; |
---|