1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright (C) 2023-2026 Intel Corporation */ 3 #ifndef _ISSEI_DMA_H_ 4 #define _ISSEI_DMA_H_ 5 6 #include <linux/types.h> 7 8 struct issei_device; 9 10 /** 11 * struct issei_dma_length - sizes of DMA memory portions 12 * @h2f: host to firmware buffer size 13 * @f2h: firmware to host buffer size 14 * @ctl: control buffer size 15 */ 16 struct issei_dma_length { 17 size_t h2f; 18 size_t f2h; 19 size_t ctl; 20 }; 21 22 /** 23 * struct issei_dma - DMA memory structure 24 * @vaddr: virtual address 25 * @daddr: physical address 26 * @length: memory sizes structure 27 */ 28 struct issei_dma { 29 void *vaddr; 30 dma_addr_t daddr; 31 struct issei_dma_length length; 32 }; 33 34 /* Operation statuses */ 35 #define HAMS_SUCCESS 0x00 36 #define HAMS_PROTOCOL_NOT_SUPPORTED 0x01 37 #define HAMS_DEPRECATED_BUS_MSG 0x02 38 #define HAMS_CLIENT_NOT_EXISTS 0x03 39 #define HAMS_MSG_TOO_BIG 0x04 40 #define HAMS_MSG_NOT_CONSUMED 0x05 41 #define HAMS_CORRUPTED_BUS_MSG 0x06 42 #define HAMS_CORRUPTED_HEADER 0x07 43 #define HAMS_INVALID_LENGTH 0x08 44 #define HAMS_SHARED_MEMORY_SIZE_UNSUPPORTED 0x09 45 #define HAMS_GENERAL_FATAL_ERROR 0xff 46 47 /** 48 * struct issei_dma_data - data passed through channel 49 * @fw_id: firmware client id 50 * @host_id: host client id 51 * @flags: flags bitmap 52 * @status: operation status 53 * @length: data length 54 * @buf: pointer to data buffer 55 */ 56 struct issei_dma_data { 57 u16 fw_id; 58 u16 host_id; 59 u32 flags; 60 u32 status; 61 u32 length; 62 void *buf; 63 }; 64 65 int issei_dmam_setup(struct issei_device *idev); 66 int issei_dma_write(struct issei_device *idev, const struct issei_dma_data *data); 67 int issei_dma_read(struct issei_device *idev, struct issei_dma_data *data); 68 69 #endif /*_ISSEI_DMA_H_*/ 70