xref: /openbmc/linux/drivers/target/target_core_xcopy.h (revision e4781421e883340b796da5a724bda7226817990b)
1 #include <target/target_core_base.h>
2 
3 #define XCOPY_TARGET_DESC_LEN		32
4 #define XCOPY_SEGMENT_DESC_LEN		28
5 #define XCOPY_NAA_IEEE_REGEX_LEN	16
6 #define XCOPY_MAX_SECTORS		1024
7 
8 enum xcopy_origin_list {
9 	XCOL_SOURCE_RECV_OP = 0x01,
10 	XCOL_DEST_RECV_OP = 0x02,
11 };
12 
13 struct xcopy_pt_cmd;
14 
15 struct xcopy_op {
16 	int op_origin;
17 
18 	struct se_cmd *xop_se_cmd;
19 	struct se_device *src_dev;
20 	unsigned char src_tid_wwn[XCOPY_NAA_IEEE_REGEX_LEN];
21 	struct se_device *dst_dev;
22 	unsigned char dst_tid_wwn[XCOPY_NAA_IEEE_REGEX_LEN];
23 	unsigned char local_dev_wwn[XCOPY_NAA_IEEE_REGEX_LEN];
24 
25 	sector_t src_lba;
26 	sector_t dst_lba;
27 	unsigned short stdi;
28 	unsigned short dtdi;
29 	unsigned short nolb;
30 	unsigned int dbl;
31 
32 	struct xcopy_pt_cmd *src_pt_cmd;
33 	struct xcopy_pt_cmd *dst_pt_cmd;
34 
35 	u32 xop_data_nents;
36 	struct scatterlist *xop_data_sg;
37 	struct work_struct xop_work;
38 };
39 
40 /*
41  * Receive Copy Results Sevice Actions
42  */
43 #define RCR_SA_COPY_STATUS		0x00
44 #define RCR_SA_RECEIVE_DATA		0x01
45 #define RCR_SA_OPERATING_PARAMETERS	0x03
46 #define RCR_SA_FAILED_SEGMENT_DETAILS	0x04
47 
48 /*
49  * Receive Copy Results defs for Operating Parameters
50  */
51 #define RCR_OP_MAX_TARGET_DESC_COUNT	0x2
52 #define RCR_OP_MAX_SG_DESC_COUNT	0x1
53 #define RCR_OP_MAX_DESC_LIST_LEN	1024
54 #define RCR_OP_MAX_SEGMENT_LEN		268435456 /* 256 MB */
55 #define RCR_OP_TOTAL_CONCURR_COPIES	0x1 /* Must be <= 16384 */
56 #define RCR_OP_MAX_CONCURR_COPIES	0x1 /* Must be <= 255 */
57 #define RCR_OP_DATA_SEG_GRAN_LOG2	9 /* 512 bytes in log 2 */
58 #define RCR_OP_INLINE_DATA_GRAN_LOG2	9 /* 512 bytes in log 2 */
59 #define RCR_OP_HELD_DATA_GRAN_LOG2	9 /* 512 bytes in log 2 */
60 
61 extern int target_xcopy_setup_pt(void);
62 extern void target_xcopy_release_pt(void);
63 extern sense_reason_t target_do_xcopy(struct se_cmd *);
64 extern sense_reason_t target_do_receive_copy_results(struct se_cmd *);
65