thermal/drivers/hisi: Set the thermal zone private data to the sensor pointer
[linux/fpc-iii.git] / drivers / scsi / fnic / fcpio.h
blob12d770d885c54c440f1798b7f14289d00a84c0dd
1 /*
2 * Copyright 2008 Cisco Systems, Inc. All rights reserved.
3 * Copyright 2007 Nuova Systems, Inc. All rights reserved.
5 * This program is free software; you may redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; version 2 of the License.
9 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
10 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
11 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
12 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
13 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
14 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
15 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
16 * SOFTWARE.
18 #ifndef _FCPIO_H_
19 #define _FCPIO_H_
21 #include <linux/if_ether.h>
24 * This header file includes all of the data structures used for
25 * communication by the host driver to the fcp firmware.
29 * Exchange and sequence id space allocated to the host driver
31 #define FCPIO_HOST_EXCH_RANGE_START 0x1000
32 #define FCPIO_HOST_EXCH_RANGE_END 0x1fff
33 #define FCPIO_HOST_SEQ_ID_RANGE_START 0x80
34 #define FCPIO_HOST_SEQ_ID_RANGE_END 0xff
37 * Command entry type
39 enum fcpio_type {
41 * Initiator request types
43 FCPIO_ICMND_16 = 0x1,
44 FCPIO_ICMND_32,
45 FCPIO_ICMND_CMPL,
46 FCPIO_ITMF,
47 FCPIO_ITMF_CMPL,
50 * Target request types
52 FCPIO_TCMND_16 = 0x11,
53 FCPIO_TCMND_32,
54 FCPIO_TDATA,
55 FCPIO_TXRDY,
56 FCPIO_TRSP,
57 FCPIO_TDRSP_CMPL,
58 FCPIO_TTMF,
59 FCPIO_TTMF_ACK,
60 FCPIO_TABORT,
61 FCPIO_TABORT_CMPL,
64 * Misc request types
66 FCPIO_ACK = 0x20,
67 FCPIO_RESET,
68 FCPIO_RESET_CMPL,
69 FCPIO_FLOGI_REG,
70 FCPIO_FLOGI_REG_CMPL,
71 FCPIO_ECHO,
72 FCPIO_ECHO_CMPL,
73 FCPIO_LUNMAP_CHNG,
74 FCPIO_LUNMAP_REQ,
75 FCPIO_LUNMAP_REQ_CMPL,
76 FCPIO_FLOGI_FIP_REG,
77 FCPIO_FLOGI_FIP_REG_CMPL,
81 * Header status codes from the firmware
83 enum fcpio_status {
84 FCPIO_SUCCESS = 0, /* request was successful */
87 * If a request to the firmware is rejected, the original request
88 * header will be returned with the status set to one of the following:
90 FCPIO_INVALID_HEADER, /* header contains invalid data */
91 FCPIO_OUT_OF_RESOURCE, /* out of resources to complete request */
92 FCPIO_INVALID_PARAM, /* some parameter in request is invalid */
93 FCPIO_REQ_NOT_SUPPORTED, /* request type is not supported */
94 FCPIO_IO_NOT_FOUND, /* requested I/O was not found */
97 * Once a request is processed, the firmware will usually return
98 * a cmpl message type. In cases where errors occurred,
99 * the header status field would be filled in with one of the following:
101 FCPIO_ABORTED = 0x41, /* request was aborted */
102 FCPIO_TIMEOUT, /* request was timed out */
103 FCPIO_SGL_INVALID, /* request was aborted due to sgl error */
104 FCPIO_MSS_INVALID, /* request was aborted due to mss error */
105 FCPIO_DATA_CNT_MISMATCH, /* recv/sent more/less data than exp. */
106 FCPIO_FW_ERR, /* request was terminated due to fw error */
107 FCPIO_ITMF_REJECTED, /* itmf req was rejected by remote node */
108 FCPIO_ITMF_FAILED, /* itmf req was failed by remote node */
109 FCPIO_ITMF_INCORRECT_LUN, /* itmf req targeted incorrect LUN */
110 FCPIO_CMND_REJECTED, /* request was invalid and rejected */
111 FCPIO_NO_PATH_AVAIL, /* no paths to the lun was available */
112 FCPIO_PATH_FAILED, /* i/o sent to current path failed */
113 FCPIO_LUNMAP_CHNG_PEND, /* i/o rejected due to lunmap change */
117 * The header command tag. All host requests will use the "tag" field
118 * to mark commands with a unique tag. When the firmware responds to
119 * a host request, it will copy the tag field into the response.
121 * The only firmware requests that will use the rx_id/ox_id fields instead
122 * of the tag field will be the target command and target task management
123 * requests. These two requests do not have corresponding host requests
124 * since they come directly from the FC initiator on the network.
126 struct fcpio_tag {
127 union {
128 u32 req_id;
129 struct {
130 u16 rx_id;
131 u16 ox_id;
132 } ex_id;
133 } u;
136 static inline void
137 fcpio_tag_id_enc(struct fcpio_tag *tag, u32 id)
139 tag->u.req_id = id;
142 static inline void
143 fcpio_tag_id_dec(struct fcpio_tag *tag, u32 *id)
145 *id = tag->u.req_id;
148 static inline void
149 fcpio_tag_exid_enc(struct fcpio_tag *tag, u16 ox_id, u16 rx_id)
151 tag->u.ex_id.rx_id = rx_id;
152 tag->u.ex_id.ox_id = ox_id;
155 static inline void
156 fcpio_tag_exid_dec(struct fcpio_tag *tag, u16 *ox_id, u16 *rx_id)
158 *rx_id = tag->u.ex_id.rx_id;
159 *ox_id = tag->u.ex_id.ox_id;
163 * The header for an fcpio request, whether from the firmware or from the
164 * host driver
166 struct fcpio_header {
167 u8 type; /* enum fcpio_type */
168 u8 status; /* header status entry */
169 u16 _resvd; /* reserved */
170 struct fcpio_tag tag; /* header tag */
173 static inline void
174 fcpio_header_enc(struct fcpio_header *hdr,
175 u8 type, u8 status,
176 struct fcpio_tag tag)
178 hdr->type = type;
179 hdr->status = status;
180 hdr->_resvd = 0;
181 hdr->tag = tag;
184 static inline void
185 fcpio_header_dec(struct fcpio_header *hdr,
186 u8 *type, u8 *status,
187 struct fcpio_tag *tag)
189 *type = hdr->type;
190 *status = hdr->status;
191 *tag = hdr->tag;
194 #define CDB_16 16
195 #define CDB_32 32
196 #define LUN_ADDRESS 8
199 * fcpio_icmnd_16: host -> firmware request
201 * used for sending out an initiator SCSI 16-byte command
203 struct fcpio_icmnd_16 {
204 u32 lunmap_id; /* index into lunmap table */
205 u8 special_req_flags; /* special exchange request flags */
206 u8 _resvd0[3]; /* reserved */
207 u32 sgl_cnt; /* scatter-gather list count */
208 u32 sense_len; /* sense buffer length */
209 u64 sgl_addr; /* scatter-gather list addr */
210 u64 sense_addr; /* sense buffer address */
211 u8 crn; /* SCSI Command Reference No. */
212 u8 pri_ta; /* SCSI Priority and Task attribute */
213 u8 _resvd1; /* reserved: should be 0 */
214 u8 flags; /* command flags */
215 u8 scsi_cdb[CDB_16]; /* SCSI Cmnd Descriptor Block */
216 u32 data_len; /* length of data expected */
217 u8 lun[LUN_ADDRESS]; /* FC vNIC only: LUN address */
218 u8 _resvd2; /* reserved */
219 u8 d_id[3]; /* FC vNIC only: Target D_ID */
220 u16 mss; /* FC vNIC only: max burst */
221 u16 _resvd3; /* reserved */
222 u32 r_a_tov; /* FC vNIC only: Res. Alloc Timeout */
223 u32 e_d_tov; /* FC vNIC only: Err Detect Timeout */
227 * Special request flags
229 #define FCPIO_ICMND_SRFLAG_RETRY 0x01 /* Enable Retry handling on exchange */
232 * Priority/Task Attribute settings
234 #define FCPIO_ICMND_PTA_SIMPLE 0 /* simple task attribute */
235 #define FCPIO_ICMND_PTA_HEADQ 1 /* head of queue task attribute */
236 #define FCPIO_ICMND_PTA_ORDERED 2 /* ordered task attribute */
237 #define FCPIO_ICMND_PTA_ACA 4 /* auto contingent allegiance */
238 #define FCPIO_ICMND_PRI_SHIFT 3 /* priority field starts in bit 3 */
241 * Command flags
243 #define FCPIO_ICMND_RDDATA 0x02 /* read data */
244 #define FCPIO_ICMND_WRDATA 0x01 /* write data */
247 * fcpio_icmnd_32: host -> firmware request
249 * used for sending out an initiator SCSI 32-byte command
251 struct fcpio_icmnd_32 {
252 u32 lunmap_id; /* index into lunmap table */
253 u8 special_req_flags; /* special exchange request flags */
254 u8 _resvd0[3]; /* reserved */
255 u32 sgl_cnt; /* scatter-gather list count */
256 u32 sense_len; /* sense buffer length */
257 u64 sgl_addr; /* scatter-gather list addr */
258 u64 sense_addr; /* sense buffer address */
259 u8 crn; /* SCSI Command Reference No. */
260 u8 pri_ta; /* SCSI Priority and Task attribute */
261 u8 _resvd1; /* reserved: should be 0 */
262 u8 flags; /* command flags */
263 u8 scsi_cdb[CDB_32]; /* SCSI Cmnd Descriptor Block */
264 u32 data_len; /* length of data expected */
265 u8 lun[LUN_ADDRESS]; /* FC vNIC only: LUN address */
266 u8 _resvd2; /* reserved */
267 u8 d_id[3]; /* FC vNIC only: Target D_ID */
268 u16 mss; /* FC vNIC only: max burst */
269 u16 _resvd3; /* reserved */
270 u32 r_a_tov; /* FC vNIC only: Res. Alloc Timeout */
271 u32 e_d_tov; /* FC vNIC only: Error Detect Timeout */
275 * fcpio_itmf: host -> firmware request
277 * used for requesting the firmware to abort a request and/or send out
278 * a task management function
280 * The t_tag field is only needed when the request type is ABT_TASK.
282 struct fcpio_itmf {
283 u32 lunmap_id; /* index into lunmap table */
284 u32 tm_req; /* SCSI Task Management request */
285 u32 t_tag; /* header tag of fcpio to be aborted */
286 u32 _resvd; /* _reserved */
287 u8 lun[LUN_ADDRESS]; /* FC vNIC only: LUN address */
288 u8 _resvd1; /* reserved */
289 u8 d_id[3]; /* FC vNIC only: Target D_ID */
290 u32 r_a_tov; /* FC vNIC only: R_A_TOV in msec */
291 u32 e_d_tov; /* FC vNIC only: E_D_TOV in msec */
295 * Task Management request
297 enum fcpio_itmf_tm_req_type {
298 FCPIO_ITMF_ABT_TASK_TERM = 0x01, /* abort task and terminate */
299 FCPIO_ITMF_ABT_TASK, /* abort task and issue abts */
300 FCPIO_ITMF_ABT_TASK_SET, /* abort task set */
301 FCPIO_ITMF_CLR_TASK_SET, /* clear task set */
302 FCPIO_ITMF_LUN_RESET, /* logical unit reset task mgmt */
303 FCPIO_ITMF_CLR_ACA, /* Clear ACA condition */
307 * fcpio_tdata: host -> firmware request
309 * used for requesting the firmware to send out a read data transfer for a
310 * target command
312 struct fcpio_tdata {
313 u16 rx_id; /* FC rx_id of target command */
314 u16 flags; /* command flags */
315 u32 rel_offset; /* data sequence relative offset */
316 u32 sgl_cnt; /* scatter-gather list count */
317 u32 data_len; /* length of data expected to send */
318 u64 sgl_addr; /* scatter-gather list address */
322 * Command flags
324 #define FCPIO_TDATA_SCSI_RSP 0x01 /* send a scsi resp. after last frame */
327 * fcpio_txrdy: host -> firmware request
329 * used for requesting the firmware to send out a write data transfer for a
330 * target command
332 struct fcpio_txrdy {
333 u16 rx_id; /* FC rx_id of target command */
334 u16 _resvd0; /* reserved */
335 u32 rel_offset; /* data sequence relative offset */
336 u32 sgl_cnt; /* scatter-gather list count */
337 u32 data_len; /* length of data expected to send */
338 u64 sgl_addr; /* scatter-gather list address */
342 * fcpio_trsp: host -> firmware request
344 * used for requesting the firmware to send out a response for a target
345 * command
347 struct fcpio_trsp {
348 u16 rx_id; /* FC rx_id of target command */
349 u16 _resvd0; /* reserved */
350 u32 sense_len; /* sense data buffer length */
351 u64 sense_addr; /* sense data buffer address */
352 u16 _resvd1; /* reserved */
353 u8 flags; /* response request flags */
354 u8 scsi_status; /* SCSI status */
355 u32 residual; /* SCSI data residual value of I/O */
359 * resposnse request flags
361 #define FCPIO_TRSP_RESID_UNDER 0x08 /* residual is valid and is underflow */
362 #define FCPIO_TRSP_RESID_OVER 0x04 /* residual is valid and is overflow */
365 * fcpio_ttmf_ack: host -> firmware response
367 * used by the host to indicate to the firmware it has received and processed
368 * the target tmf request
370 struct fcpio_ttmf_ack {
371 u16 rx_id; /* FC rx_id of target command */
372 u16 _resvd0; /* reserved */
373 u32 tmf_status; /* SCSI task management status */
377 * fcpio_tabort: host -> firmware request
379 * used by the host to request the firmware to abort a target request that was
380 * received by the firmware
382 struct fcpio_tabort {
383 u16 rx_id; /* rx_id of the target request */
387 * fcpio_reset: host -> firmware request
389 * used by the host to signal a reset of the driver to the firmware
390 * and to request firmware to clean up all outstanding I/O
392 struct fcpio_reset {
393 u32 _resvd;
396 enum fcpio_flogi_reg_format_type {
397 FCPIO_FLOGI_REG_DEF_DEST = 0, /* Use the oui | s_id mac format */
398 FCPIO_FLOGI_REG_GW_DEST, /* Use the fixed gateway mac */
402 * fcpio_flogi_reg: host -> firmware request
404 * fc vnic only
405 * used by the host to notify the firmware of the lif's s_id
406 * and destination mac address format
408 struct fcpio_flogi_reg {
409 u8 format;
410 u8 s_id[3]; /* FC vNIC only: Source S_ID */
411 u8 gateway_mac[ETH_ALEN]; /* Destination gateway mac */
412 u16 _resvd;
413 u32 r_a_tov; /* R_A_TOV in msec */
414 u32 e_d_tov; /* E_D_TOV in msec */
418 * fcpio_echo: host -> firmware request
420 * sends a heartbeat echo request to the firmware
422 struct fcpio_echo {
423 u32 _resvd;
427 * fcpio_lunmap_req: host -> firmware request
429 * scsi vnic only
430 * sends a request to retrieve the lunmap table for scsi vnics
432 struct fcpio_lunmap_req {
433 u64 addr; /* address of the buffer */
434 u32 len; /* len of the buffer */
438 * fcpio_flogi_fip_reg: host -> firmware request
440 * fc vnic only
441 * used by the host to notify the firmware of the lif's s_id
442 * and destination mac address format
444 struct fcpio_flogi_fip_reg {
445 u8 _resvd0;
446 u8 s_id[3]; /* FC vNIC only: Source S_ID */
447 u8 fcf_mac[ETH_ALEN]; /* FCF Target destination mac */
448 u16 _resvd1;
449 u32 r_a_tov; /* R_A_TOV in msec */
450 u32 e_d_tov; /* E_D_TOV in msec */
451 u8 ha_mac[ETH_ALEN]; /* Host adapter source mac */
452 u16 _resvd2;
456 * Basic structure for all fcpio structures that are sent from the host to the
457 * firmware. They are 128 bytes per structure.
459 #define FCPIO_HOST_REQ_LEN 128 /* expected length of host requests */
461 struct fcpio_host_req {
462 struct fcpio_header hdr;
464 union {
466 * Defines space needed for request
468 u8 buf[FCPIO_HOST_REQ_LEN - sizeof(struct fcpio_header)];
471 * Initiator host requests
473 struct fcpio_icmnd_16 icmnd_16;
474 struct fcpio_icmnd_32 icmnd_32;
475 struct fcpio_itmf itmf;
478 * Target host requests
480 struct fcpio_tdata tdata;
481 struct fcpio_txrdy txrdy;
482 struct fcpio_trsp trsp;
483 struct fcpio_ttmf_ack ttmf_ack;
484 struct fcpio_tabort tabort;
487 * Misc requests
489 struct fcpio_reset reset;
490 struct fcpio_flogi_reg flogi_reg;
491 struct fcpio_echo echo;
492 struct fcpio_lunmap_req lunmap_req;
493 struct fcpio_flogi_fip_reg flogi_fip_reg;
494 } u;
498 * fcpio_icmnd_cmpl: firmware -> host response
500 * used for sending the host a response to an initiator command
502 struct fcpio_icmnd_cmpl {
503 u8 _resvd0[6]; /* reserved */
504 u8 flags; /* response flags */
505 u8 scsi_status; /* SCSI status */
506 u32 residual; /* SCSI data residual length */
507 u32 sense_len; /* SCSI sense length */
511 * response flags
513 #define FCPIO_ICMND_CMPL_RESID_UNDER 0x08 /* resid under and valid */
514 #define FCPIO_ICMND_CMPL_RESID_OVER 0x04 /* resid over and valid */
517 * fcpio_itmf_cmpl: firmware -> host response
519 * used for sending the host a response for a itmf request
521 struct fcpio_itmf_cmpl {
522 u32 _resvd; /* reserved */
526 * fcpio_tcmnd_16: firmware -> host request
528 * used by the firmware to notify the host of an incoming target SCSI 16-Byte
529 * request
531 struct fcpio_tcmnd_16 {
532 u8 lun[LUN_ADDRESS]; /* FC vNIC only: LUN address */
533 u8 crn; /* SCSI Command Reference No. */
534 u8 pri_ta; /* SCSI Priority and Task attribute */
535 u8 _resvd2; /* reserved: should be 0 */
536 u8 flags; /* command flags */
537 u8 scsi_cdb[CDB_16]; /* SCSI Cmnd Descriptor Block */
538 u32 data_len; /* length of data expected */
539 u8 _resvd1; /* reserved */
540 u8 s_id[3]; /* FC vNIC only: Source S_ID */
544 * Priority/Task Attribute settings
546 #define FCPIO_TCMND_PTA_SIMPLE 0 /* simple task attribute */
547 #define FCPIO_TCMND_PTA_HEADQ 1 /* head of queue task attribute */
548 #define FCPIO_TCMND_PTA_ORDERED 2 /* ordered task attribute */
549 #define FCPIO_TCMND_PTA_ACA 4 /* auto contingent allegiance */
550 #define FCPIO_TCMND_PRI_SHIFT 3 /* priority field starts in bit 3 */
553 * Command flags
555 #define FCPIO_TCMND_RDDATA 0x02 /* read data */
556 #define FCPIO_TCMND_WRDATA 0x01 /* write data */
559 * fcpio_tcmnd_32: firmware -> host request
561 * used by the firmware to notify the host of an incoming target SCSI 32-Byte
562 * request
564 struct fcpio_tcmnd_32 {
565 u8 lun[LUN_ADDRESS]; /* FC vNIC only: LUN address */
566 u8 crn; /* SCSI Command Reference No. */
567 u8 pri_ta; /* SCSI Priority and Task attribute */
568 u8 _resvd2; /* reserved: should be 0 */
569 u8 flags; /* command flags */
570 u8 scsi_cdb[CDB_32]; /* SCSI Cmnd Descriptor Block */
571 u32 data_len; /* length of data expected */
572 u8 _resvd0; /* reserved */
573 u8 s_id[3]; /* FC vNIC only: Source S_ID */
577 * fcpio_tdrsp_cmpl: firmware -> host response
579 * used by the firmware to notify the host of a response to a host target
580 * command
582 struct fcpio_tdrsp_cmpl {
583 u16 rx_id; /* rx_id of the target request */
584 u16 _resvd0; /* reserved */
588 * fcpio_ttmf: firmware -> host request
590 * used by the firmware to notify the host of an incoming task management
591 * function request
593 struct fcpio_ttmf {
594 u8 _resvd0; /* reserved */
595 u8 s_id[3]; /* FC vNIC only: Source S_ID */
596 u8 lun[LUN_ADDRESS]; /* FC vNIC only: LUN address */
597 u8 crn; /* SCSI Command Reference No. */
598 u8 _resvd2[3]; /* reserved */
599 u32 tmf_type; /* task management request type */
603 * Task Management request
605 #define FCPIO_TTMF_CLR_ACA 0x40 /* Clear ACA condition */
606 #define FCPIO_TTMF_LUN_RESET 0x10 /* logical unit reset task mgmt */
607 #define FCPIO_TTMF_CLR_TASK_SET 0x04 /* clear task set */
608 #define FCPIO_TTMF_ABT_TASK_SET 0x02 /* abort task set */
609 #define FCPIO_TTMF_ABT_TASK 0x01 /* abort task */
612 * fcpio_tabort_cmpl: firmware -> host response
614 * used by the firmware to respond to a host's tabort request
616 struct fcpio_tabort_cmpl {
617 u16 rx_id; /* rx_id of the target request */
618 u16 _resvd0; /* reserved */
622 * fcpio_ack: firmware -> host response
624 * used by firmware to notify the host of the last work request received
626 struct fcpio_ack {
627 u16 request_out; /* last host entry received */
628 u16 _resvd;
632 * fcpio_reset_cmpl: firmware -> host response
634 * use by firmware to respond to the host's reset request
636 struct fcpio_reset_cmpl {
637 u16 vnic_id;
641 * fcpio_flogi_reg_cmpl: firmware -> host response
643 * fc vnic only
644 * response to the fcpio_flogi_reg request
646 struct fcpio_flogi_reg_cmpl {
647 u32 _resvd;
651 * fcpio_echo_cmpl: firmware -> host response
653 * response to the fcpio_echo request
655 struct fcpio_echo_cmpl {
656 u32 _resvd;
660 * fcpio_lunmap_chng: firmware -> host notification
662 * scsi vnic only
663 * notifies the host that the lunmap tables have changed
665 struct fcpio_lunmap_chng {
666 u32 _resvd;
670 * fcpio_lunmap_req_cmpl: firmware -> host response
672 * scsi vnic only
673 * response for lunmap table request from the host
675 struct fcpio_lunmap_req_cmpl {
676 u32 _resvd;
680 * Basic structure for all fcpio structures that are sent from the firmware to
681 * the host. They are 64 bytes per structure.
683 #define FCPIO_FW_REQ_LEN 64 /* expected length of fw requests */
684 struct fcpio_fw_req {
685 struct fcpio_header hdr;
687 union {
689 * Defines space needed for request
691 u8 buf[FCPIO_FW_REQ_LEN - sizeof(struct fcpio_header)];
694 * Initiator firmware responses
696 struct fcpio_icmnd_cmpl icmnd_cmpl;
697 struct fcpio_itmf_cmpl itmf_cmpl;
700 * Target firmware new requests
702 struct fcpio_tcmnd_16 tcmnd_16;
703 struct fcpio_tcmnd_32 tcmnd_32;
706 * Target firmware responses
708 struct fcpio_tdrsp_cmpl tdrsp_cmpl;
709 struct fcpio_ttmf ttmf;
710 struct fcpio_tabort_cmpl tabort_cmpl;
713 * Firmware response to work received
715 struct fcpio_ack ack;
718 * Misc requests
720 struct fcpio_reset_cmpl reset_cmpl;
721 struct fcpio_flogi_reg_cmpl flogi_reg_cmpl;
722 struct fcpio_echo_cmpl echo_cmpl;
723 struct fcpio_lunmap_chng lunmap_chng;
724 struct fcpio_lunmap_req_cmpl lunmap_req_cmpl;
725 } u;
729 * Access routines to encode and decode the color bit, which is the most
730 * significant bit of the MSB of the structure
732 static inline void fcpio_color_enc(struct fcpio_fw_req *fw_req, u8 color)
734 u8 *c = ((u8 *) fw_req) + sizeof(struct fcpio_fw_req) - 1;
736 if (color)
737 *c |= 0x80;
738 else
739 *c &= ~0x80;
742 static inline void fcpio_color_dec(struct fcpio_fw_req *fw_req, u8 *color)
744 u8 *c = ((u8 *) fw_req) + sizeof(struct fcpio_fw_req) - 1;
746 *color = *c >> 7;
749 * Make sure color bit is read from desc *before* other fields
750 * are read from desc. Hardware guarantees color bit is last
751 * bit (byte) written. Adding the rmb() prevents the compiler
752 * and/or CPU from reordering the reads which would potentially
753 * result in reading stale values.
756 rmb();
761 * Lunmap table entry for scsi vnics
763 #define FCPIO_LUNMAP_TABLE_SIZE 256
764 #define FCPIO_FLAGS_LUNMAP_VALID 0x80
765 #define FCPIO_FLAGS_BOOT 0x01
766 struct fcpio_lunmap_entry {
767 u8 bus;
768 u8 target;
769 u8 lun;
770 u8 path_cnt;
771 u16 flags;
772 u16 update_cnt;
775 struct fcpio_lunmap_tbl {
776 u32 update_cnt;
777 struct fcpio_lunmap_entry lunmaps[FCPIO_LUNMAP_TABLE_SIZE];
780 #endif /* _FCPIO_H_ */