root/drivers/misc/mic/host/mic_smpt.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. mic_map_error

   1 /* SPDX-License-Identifier: GPL-2.0-only */
   2 /*
   3  * Intel MIC Platform Software Stack (MPSS)
   4  *
   5  * Copyright(c) 2013 Intel Corporation.
   6  *
   7  * Intel MIC Host driver.
   8  */
   9 #ifndef MIC_SMPT_H
  10 #define MIC_SMPT_H
  11 /**
  12  * struct mic_smpt_ops - MIC HW specific SMPT operations.
  13  * @init: Initialize hardware specific SMPT information in mic_smpt_hw_info.
  14  * @set: Set the value for a particular SMPT entry.
  15  */
  16 struct mic_smpt_ops {
  17         void (*init)(struct mic_device *mdev);
  18         void (*set)(struct mic_device *mdev, dma_addr_t dma_addr, u8 index);
  19 };
  20 
  21 /**
  22  * struct mic_smpt - MIC SMPT entry information.
  23  * @dma_addr: Base DMA address for this SMPT entry.
  24  * @ref_count: Number of active mappings for this SMPT entry in bytes.
  25  */
  26 struct mic_smpt {
  27         dma_addr_t dma_addr;
  28         s64 ref_count;
  29 };
  30 
  31 /**
  32  * struct mic_smpt_hw_info - MIC SMPT hardware specific information.
  33  * @num_reg: Number of SMPT registers.
  34  * @page_shift: System memory page shift.
  35  * @page_size: System memory page size.
  36  * @base: System address base.
  37  */
  38 struct mic_smpt_hw_info {
  39         u8 num_reg;
  40         u8 page_shift;
  41         u64 page_size;
  42         u64 base;
  43 };
  44 
  45 /**
  46  * struct mic_smpt_info - MIC SMPT information.
  47  * @entry: Array of SMPT entries.
  48  * @smpt_lock: Spin lock protecting access to SMPT data structures.
  49  * @info: Hardware specific SMPT information.
  50  * @ref_count: Number of active SMPT mappings (for debug).
  51  * @map_count: Number of SMPT mappings created (for debug).
  52  * @unmap_count: Number of SMPT mappings destroyed (for debug).
  53  */
  54 struct mic_smpt_info {
  55         struct mic_smpt *entry;
  56         spinlock_t smpt_lock;
  57         struct mic_smpt_hw_info info;
  58         s64 ref_count;
  59         s64 map_count;
  60         s64 unmap_count;
  61 };
  62 
  63 dma_addr_t mic_map_single(struct mic_device *mdev, void *va, size_t size);
  64 void mic_unmap_single(struct mic_device *mdev,
  65         dma_addr_t mic_addr, size_t size);
  66 dma_addr_t mic_map(struct mic_device *mdev,
  67         dma_addr_t dma_addr, size_t size);
  68 void mic_unmap(struct mic_device *mdev, dma_addr_t mic_addr, size_t size);
  69 dma_addr_t mic_to_dma_addr(struct mic_device *mdev, dma_addr_t mic_addr);
  70 
  71 /**
  72  * mic_map_error - Check a MIC address for errors.
  73  *
  74  * @mdev: pointer to mic_device instance.
  75  *
  76  * returns Whether there was an error during mic_map..(..) APIs.
  77  */
  78 static inline bool mic_map_error(dma_addr_t mic_addr)
  79 {
  80         return !mic_addr;
  81 }
  82 
  83 int mic_smpt_init(struct mic_device *mdev);
  84 void mic_smpt_uninit(struct mic_device *mdev);
  85 void mic_smpt_restore(struct mic_device *mdev);
  86 
  87 #endif

/* [<][>][^][v][top][bottom][index][help] */