7 * Fibre Channel Protocol
11 FILE_LICENCE ( GPL2_OR_LATER );
15 #include <ipxe/fcels.h>
16 #include <ipxe/scsi.h>
18 /** An FCP command IU */
22 /** Command reference number */
24 /** Priority and task attributes */
26 /** Task management flags */
34 } __attribute__ (( packed ));
36 /** Command includes data-out */
37 #define FCP_CMND_WRDATA 0x01
39 /** Command includes data-in */
40 #define FCP_CMND_RDDATA 0x02
42 /** FCP tag magic marker */
43 #define FCP_TAG_MAGIC 0x18ae0000
45 /** An FCP transfer ready IU */
47 /** Relative offset of data */
53 } __attribute__ (( packed ));
55 /** An FCP response IU */
59 /** Retry delay timer */
63 /** SCSI status code */
65 /** Residual data count */
67 /** Sense data length */
69 /** Response data length */
70 uint32_t response_len;
71 } __attribute__ (( packed ));
73 /** Response length field is valid */
74 #define FCP_RSP_RESPONSE_LEN_VALID 0x01
76 /** Sense length field is valid */
77 #define FCP_RSP_SENSE_LEN_VALID 0x02
79 /** Residual represents overrun */
80 #define FCP_RSP_RESIDUAL_OVERRUN 0x04
82 /** Residual represents underrun */
83 #define FCP_RSP_RESIDUAL_UNDERRUN 0x08
86 * Get response data portion of FCP response
89 * @ret response_data Response data, or NULL if not present
91 static inline void * fcp_rsp_response_data ( struct fcp_rsp *rsp ) {
92 return ( ( rsp->flags & FCP_RSP_RESPONSE_LEN_VALID ) ?
93 ( ( ( void * ) rsp ) + sizeof ( *rsp ) ) : NULL );
97 * Get length of response data portion of FCP response
100 * @ret response_data_len Response data length
102 static inline size_t fcp_rsp_response_data_len ( struct fcp_rsp *rsp ) {
103 return ( ( rsp->flags & FCP_RSP_RESPONSE_LEN_VALID ) ?
104 ntohl ( rsp->response_len ) : 0 );
108 * Get sense data portion of FCP response
110 * @v rsp FCP response
111 * @ret sense_data Sense data, or NULL if not present
113 static inline void * fcp_rsp_sense_data ( struct fcp_rsp *rsp ) {
114 return ( ( rsp->flags & FCP_RSP_SENSE_LEN_VALID ) ?
115 ( ( ( void * ) rsp ) + sizeof ( *rsp ) +
116 fcp_rsp_response_data_len ( rsp ) ) : NULL );
120 * Get length of sense data portion of FCP response
122 * @v rsp FCP response
123 * @ret sense_data_len Sense data length
125 static inline size_t fcp_rsp_sense_data_len ( struct fcp_rsp *rsp ) {
126 return ( ( rsp->flags & FCP_RSP_SENSE_LEN_VALID ) ?
127 ntohl ( rsp->sense_len ) : 0 );
130 /** An FCP PRLI service parameter page */
131 struct fcp_prli_service_parameters {
134 } __attribute__ (( packed ));
136 /** Write FCP_XFER_RDY disabled */
137 #define FCP_PRLI_NO_WRITE_RDY 0x0001
139 /** Read FCP_XFER_RDY disabled */
140 #define FCP_PRLI_NO_READ_RDY 0x0002
142 /** Has target functionality */
143 #define FCP_PRLI_TARGET 0x0010
145 /** Has initiator functionality */
146 #define FCP_PRLI_INITIATOR 0x0020
148 /** Data overlay allowed */
149 #define FCP_PRLI_OVERLAY 0x0040
151 /** Confirm completion allowed */
152 #define FCP_PRLI_CONF 0x0080
154 /** Retransmission supported */
155 #define FCP_PRLI_RETRY 0x0100
157 /** Task retry identification */
158 #define FCP_PRLI_TASK_RETRY 0x0200
160 /** REC ELS supported */
161 #define FCP_PRLI_REC 0x0400
163 /** Enhanced discovery supported */
164 #define FCP_PRLI_ENH_DISC 0x0800
166 #endif /* _IPXE_FCP_H */