1 #ifndef TARGET_CORE_RD_H 2 #define TARGET_CORE_RD_H 3 4 #include <linux/module.h> 5 #include <linux/types.h> 6 #include <target/target_core_base.h> 7 8 #define RD_HBA_VERSION "v4.0" 9 #define RD_MCP_VERSION "4.0" 10 11 /* Largest piece of memory kmalloc can allocate */ 12 #define RD_MAX_ALLOCATION_SIZE 65536 13 #define RD_DEVICE_QUEUE_DEPTH 32 14 #define RD_MAX_DEVICE_QUEUE_DEPTH 128 15 #define RD_BLOCKSIZE 512 16 17 /* Used in target_core_init_configfs() for virtual LUN 0 access */ 18 int __init rd_module_init(void); 19 void rd_module_exit(void); 20 21 struct rd_dev_sg_table { 22 u32 page_start_offset; 23 u32 page_end_offset; 24 u32 rd_sg_count; 25 struct scatterlist *sg_table; 26 } ____cacheline_aligned; 27 28 #define RDF_HAS_PAGE_COUNT 0x01 29 #define RDF_NULLIO 0x02 30 31 struct rd_dev { 32 struct se_device dev; 33 u32 rd_flags; 34 /* Unique Ramdisk Device ID in Ramdisk HBA */ 35 u32 rd_dev_id; 36 /* Total page count for ramdisk device */ 37 u32 rd_page_count; 38 /* Number of SG tables in sg_table_array */ 39 u32 sg_table_count; 40 /* Number of SG tables in sg_prot_array */ 41 u32 sg_prot_count; 42 /* Array of rd_dev_sg_table_t containing scatterlists */ 43 struct rd_dev_sg_table *sg_table_array; 44 /* Array of rd_dev_sg_table containing protection scatterlists */ 45 struct rd_dev_sg_table *sg_prot_array; 46 /* Ramdisk HBA device is connected to */ 47 struct rd_host *rd_host; 48 } ____cacheline_aligned; 49 50 struct rd_host { 51 u32 rd_host_dev_id_count; 52 u32 rd_host_id; /* Unique Ramdisk Host ID */ 53 } ____cacheline_aligned; 54 55 #endif /* TARGET_CORE_RD_H */ 56