1 /* 2 * Copyright (C) 2022 Intel Corporation. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 #ifndef _TCC_BUFFER_H_ 8 #define _TCC__BUFFER_H_ 9 10 #include <linux/ioctl.h> 11 #include <stdlib.h> 12 13 #define TCC_BUFFER_DEVNODE "/dev/tcc/tcc_buffer" 14 #define UNDEFINED_DEVNODE 0x55555555 15 /* 16 * IOCTL MAGIC number 17 */ 18 #define IOCTL_TCC_MAGIC 'T' 19 20 /* 21 * IN: 22 * id: Software SRAM region id from which user request for attribute. 23 * OUT: 24 * latency: delay in cpu clocks 25 * type: the type of the memory software SRAM region 26 * size: total size in bytes 27 * ways: the cache ways used to create the software SRAM region. 28 * cpu_mask_p: affinity bitmask of the logical cores available for access to the software SRAM region 29 */ 30 struct tcc_mem_region_config { 31 unsigned int id; 32 unsigned int latency; 33 size_t size; 34 int type; 35 unsigned int ways; 36 void *cpu_mask_p; 37 }; 38 39 /* 40 * IN: 41 * id: Software SRAM region id, from which user request for buffer 42 * size: buffer size (bytes). 43 * OUT: 44 * devnode: driver returns device node to user 45 */ 46 struct tcc_buf_mem_req { 47 unsigned int id; 48 size_t size; 49 unsigned int devnode_id; 50 }; 51 52 enum ioctl_index { 53 IOCTL_TCC_GET_REGION_COUNT = 1, 54 IOCTL_TCC_GET_MEMORY_CONFIG, 55 IOCTL_TCC_REQ_BUFFER, 56 IOCTL_TCC_QUERY_RTCT_SIZE, 57 IOCTL_TCC_GET_RTCT, 58 }; 59 60 /* 61 * User to get software SRAM region counts 62 */ 63 #define TCC_GET_REGION_COUNT _IOR(IOCTL_TCC_MAGIC, IOCTL_TCC_GET_REGION_COUNT, unsigned int *) 64 65 /* 66 * For regions with software SRAM mem_type, user library asks for memory config 67 */ 68 #define TCC_GET_MEMORY_CONFIG _IOWR(IOCTL_TCC_MAGIC, IOCTL_TCC_GET_MEMORY_CONFIG, struct tcc_buf_mem_config_s *) 69 70 /* 71 * User to get software SRAM region counts 72 */ 73 #define TCC_QUERY_RTCT_SIZE _IOR(IOCTL_TCC_MAGIC, IOCTL_TCC_QUERY_RTCT_SIZE, unsigned int *) 74 75 /* 76 * User to get software SRAM region counts 77 */ 78 #define TCC_GET_RTCT _IOR(IOCTL_TCC_MAGIC, IOCTL_TCC_GET_RTCT, unsigned int *) 79 80 /* 81 * User request tcc buffer; obtain device node 82 */ 83 #define TCC_REQ_BUFFER _IOWR(IOCTL_TCC_MAGIC, IOCTL_TCC_REQ_BUFFER, struct tcc_buf_mem_req *) 84 85 #endif 86