blob: 8b88f9b14c3f40e4d1739110461bf8774e812f5b [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Nicholas Bellingerc66ac9d2010-12-17 11:11:26 -08002#ifndef TARGET_CORE_RD_H
3#define TARGET_CORE_RD_H
4
Bart Van Assche8dcf07b2016-11-14 15:47:14 -08005#include <linux/module.h>
6#include <linux/types.h>
7#include <target/target_core_base.h>
8
Nicholas Bellingerc66ac9d2010-12-17 11:11:26 -08009#define RD_HBA_VERSION "v4.0"
Nicholas Bellingerc66ac9d2010-12-17 11:11:26 -080010#define RD_MCP_VERSION "4.0"
11
12/* Largest piece of memory kmalloc can allocate */
13#define RD_MAX_ALLOCATION_SIZE 65536
Nicholas Bellingerc66ac9d2010-12-17 11:11:26 -080014#define RD_DEVICE_QUEUE_DEPTH 32
15#define RD_MAX_DEVICE_QUEUE_DEPTH 128
16#define RD_BLOCKSIZE 512
Nicholas Bellingerc66ac9d2010-12-17 11:11:26 -080017
Nicholas Bellingerc66ac9d2010-12-17 11:11:26 -080018/* Used in target_core_init_configfs() for virtual LUN 0 access */
19int __init rd_module_init(void);
20void rd_module_exit(void);
21
Nicholas Bellingerc66ac9d2010-12-17 11:11:26 -080022struct rd_dev_sg_table {
23 u32 page_start_offset;
24 u32 page_end_offset;
25 u32 rd_sg_count;
26 struct scatterlist *sg_table;
27} ____cacheline_aligned;
28
29#define RDF_HAS_PAGE_COUNT 0x01
Nicholas Bellinger52c07422013-05-11 16:16:49 -070030#define RDF_NULLIO 0x02
Nicholas Bellingerc66ac9d2010-12-17 11:11:26 -080031
32struct rd_dev {
Christoph Hellwig0fd97cc2012-10-08 00:03:19 -040033 struct se_device dev;
Nicholas Bellingerc66ac9d2010-12-17 11:11:26 -080034 u32 rd_flags;
35 /* Unique Ramdisk Device ID in Ramdisk HBA */
36 u32 rd_dev_id;
37 /* Total page count for ramdisk device */
38 u32 rd_page_count;
39 /* Number of SG tables in sg_table_array */
40 u32 sg_table_count;
Nicholas Bellingerd7e8eb52014-01-07 23:24:14 +000041 /* Number of SG tables in sg_prot_array */
42 u32 sg_prot_count;
Nicholas Bellingerc66ac9d2010-12-17 11:11:26 -080043 /* Array of rd_dev_sg_table_t containing scatterlists */
44 struct rd_dev_sg_table *sg_table_array;
Nicholas Bellingerd7e8eb52014-01-07 23:24:14 +000045 /* Array of rd_dev_sg_table containing protection scatterlists */
46 struct rd_dev_sg_table *sg_prot_array;
Nicholas Bellingerc66ac9d2010-12-17 11:11:26 -080047 /* Ramdisk HBA device is connected to */
48 struct rd_host *rd_host;
49} ____cacheline_aligned;
50
51struct rd_host {
52 u32 rd_host_dev_id_count;
53 u32 rd_host_id; /* Unique Ramdisk Host ID */
54} ____cacheline_aligned;
55
56#endif /* TARGET_CORE_RD_H */