1 /*
2  * This file is auto-generated. Modifications will be lost.
3  *
4  * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/
5  * for more information.
6  */
7 #ifndef SCSI_BSG_FC_H
8 #define SCSI_BSG_FC_H
9 #include <linux/types.h>
10 #define FC_DEFAULT_BSG_TIMEOUT (10 * HZ)
11 #define FC_BSG_CLS_MASK 0xF0000000
12 #define FC_BSG_HST_MASK 0x80000000
13 #define FC_BSG_RPT_MASK 0x40000000
14 #define FC_BSG_HST_ADD_RPORT (FC_BSG_HST_MASK | 0x00000001)
15 #define FC_BSG_HST_DEL_RPORT (FC_BSG_HST_MASK | 0x00000002)
16 #define FC_BSG_HST_ELS_NOLOGIN (FC_BSG_HST_MASK | 0x00000003)
17 #define FC_BSG_HST_CT (FC_BSG_HST_MASK | 0x00000004)
18 #define FC_BSG_HST_VENDOR (FC_BSG_HST_MASK | 0x000000FF)
19 #define FC_BSG_RPT_ELS (FC_BSG_RPT_MASK | 0x00000001)
20 #define FC_BSG_RPT_CT (FC_BSG_RPT_MASK | 0x00000002)
21 struct fc_bsg_host_add_rport {
22   __u8 reserved;
23   __u8 port_id[3];
24 };
25 struct fc_bsg_host_del_rport {
26   __u8 reserved;
27   __u8 port_id[3];
28 };
29 struct fc_bsg_host_els {
30   __u8 command_code;
31   __u8 port_id[3];
32 };
33 #define FC_CTELS_STATUS_OK 0x00000000
34 #define FC_CTELS_STATUS_REJECT 0x00000001
35 #define FC_CTELS_STATUS_P_RJT 0x00000002
36 #define FC_CTELS_STATUS_F_RJT 0x00000003
37 #define FC_CTELS_STATUS_P_BSY 0x00000004
38 #define FC_CTELS_STATUS_F_BSY 0x00000006
39 struct fc_bsg_ctels_reply {
40   __u32 status;
41   struct {
42     __u8 action;
43     __u8 reason_code;
44     __u8 reason_explanation;
45     __u8 vendor_unique;
46   } rjt_data;
47 };
48 struct fc_bsg_host_ct {
49   __u8 reserved;
50   __u8 port_id[3];
51   __u32 preamble_word0;
52   __u32 preamble_word1;
53   __u32 preamble_word2;
54 };
55 struct fc_bsg_host_vendor {
56   __u64 vendor_id;
57   __u32 vendor_cmd[];
58 };
59 struct fc_bsg_host_vendor_reply {
60   __DECLARE_FLEX_ARRAY(__u32, vendor_rsp);
61 };
62 struct fc_bsg_rport_els {
63   __u8 els_code;
64 };
65 struct fc_bsg_rport_ct {
66   __u32 preamble_word0;
67   __u32 preamble_word1;
68   __u32 preamble_word2;
69 };
70 struct fc_bsg_request {
71   __u32 msgcode;
72   union {
73     struct fc_bsg_host_add_rport h_addrport;
74     struct fc_bsg_host_del_rport h_delrport;
75     struct fc_bsg_host_els h_els;
76     struct fc_bsg_host_ct h_ct;
77     struct fc_bsg_host_vendor h_vendor;
78     struct fc_bsg_rport_els r_els;
79     struct fc_bsg_rport_ct r_ct;
80   } rqst_data;
81 } __attribute__((packed));
82 struct fc_bsg_reply {
83   __u32 result;
84   __u32 reply_payload_rcv_len;
85   union {
86     struct fc_bsg_host_vendor_reply vendor_reply;
87     struct fc_bsg_ctels_reply ctels_reply;
88   } reply_data;
89 };
90 #endif
91