1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Intel MIC Platform Software Stack (MPSS)
5 * Copyright(c) 2013 Intel Corporation.
7 * Intel MIC Host driver.
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.
17 void (*init)(struct mic_device *mdev);
18 void (*set)(struct mic_device *mdev, dma_addr_t dma_addr, u8 index);
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.
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.
38 struct mic_smpt_hw_info {
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).
54 struct mic_smpt_info {
55 struct mic_smpt *entry;
57 struct mic_smpt_hw_info info;
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);
72 * mic_map_error - Check a MIC address for errors.
74 * @mdev: pointer to mic_device instance.
76 * returns Whether there was an error during mic_map..(..) APIs.
78 static inline bool mic_map_error(dma_addr_t mic_addr)
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);