The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/dev/qat/qat_api/common/utils/lac_mem.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /* SPDX-License-Identifier: BSD-3-Clause */
    2 /* Copyright(c) 2007-2022 Intel Corporation */
    3 /* $FreeBSD$ */
    4 /**
    5  *****************************************************************************
    6  * @file lac_mem.c  Implementation of Memory Functions
    7  *
    8  * @ingroup LacMem
    9  *
   10  *****************************************************************************/
   11 
   12 /*
   13 *******************************************************************************
   14 * Include header files
   15 *******************************************************************************
   16 */
   17 #include "qat_utils.h"
   18 #include "cpa.h"
   19 
   20 #include "icp_accel_devices.h"
   21 #include "icp_adf_init.h"
   22 #include "icp_adf_transport.h"
   23 #include "icp_adf_debug.h"
   24 #include "icp_sal_iommu.h"
   25 
   26 #include "lac_mem.h"
   27 #include "lac_mem_pools.h"
   28 #include "lac_common.h"
   29 #include "lac_list.h"
   30 #include "icp_qat_fw_la.h"
   31 #include "lac_sal_types.h"
   32 
   33 /*
   34 ********************************************************************************
   35 * Static Variables
   36 ********************************************************************************
   37 */
   38 
   39 #define MAX_BUFFER_SIZE (LAC_BITS_TO_BYTES(4096))
   40 /**< @ingroup LacMem
   41  * Maximum size of the buffers used in the resize function */
   42 
   43 /*
   44 *******************************************************************************
   45 * Define public/global function definitions
   46 *******************************************************************************
   47 */
   48 /**
   49  * @ingroup LacMem
   50  */
   51 CpaStatus
   52 icp_LacBufferRestore(Cpa8U *pUserBuffer,
   53                      Cpa32U userLen,
   54                      Cpa8U *pWorkingBuffer,
   55                      Cpa32U workingLen,
   56                      CpaBoolean copyBuf)
   57 {
   58         Cpa32U padSize = 0;
   59 
   60         /* NULL is a valid value for working buffer as this function may be
   61          * called to clean up in an error case where all the resize operations
   62          * were not completed */
   63         if (NULL == pWorkingBuffer) {
   64                 return CPA_STATUS_SUCCESS;
   65         }
   66 
   67         if (workingLen < userLen) {
   68                 QAT_UTILS_LOG("Invalid buffer sizes\n");
   69                 return CPA_STATUS_INVALID_PARAM;
   70         }
   71 
   72         if (pUserBuffer != pWorkingBuffer) {
   73 
   74                 if (CPA_TRUE == copyBuf) {
   75                         /* Copy from internal buffer to user buffer */
   76                         padSize = workingLen - userLen;
   77                         memcpy(pUserBuffer, pWorkingBuffer + padSize, userLen);
   78                 }
   79 
   80                 Lac_MemPoolEntryFree(pWorkingBuffer);
   81         }
   82         return CPA_STATUS_SUCCESS;
   83 }
   84 
   85 /**
   86  * @ingroup LacMem
   87  */
   88 CpaPhysicalAddr
   89 SalMem_virt2PhysExternal(void *pVirtAddr, void *pServiceGen)
   90 {
   91         sal_service_t *pService = (sal_service_t *)pServiceGen;
   92 
   93         if (NULL != pService->virt2PhysClient) {
   94                 return pService->virt2PhysClient(pVirtAddr);
   95         } else {
   96                 /* Use internal QAT Utils virt to phys */
   97                 /* Ok for kernel space probably should not use for user */
   98                 return LAC_OS_VIRT_TO_PHYS_INTERNAL(pVirtAddr);
   99         }
  100 }
  101 
  102 size_t
  103 icp_sal_iommu_get_remap_size(size_t size)
  104 {
  105         return size;
  106 }
  107 
  108 CpaStatus
  109 icp_sal_iommu_map(Cpa64U phaddr, Cpa64U iova, size_t size)
  110 {
  111         return CPA_STATUS_SUCCESS;
  112 }
  113 
  114 CpaStatus
  115 icp_sal_iommu_unmap(Cpa64U iova, size_t size)
  116 {
  117         return CPA_STATUS_SUCCESS;
  118 }

Cache object: 20fdf1e9701d463e711722483489a667


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.