upload tizen1.0 source
[kernel/linux-2.6.36.git] / drivers / scsi / bfa / include / bfi / bfi_iocfc.h
1 /*
2  * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
3  * All rights reserved
4  * www.brocade.com
5  *
6  * Linux driver for Brocade Fibre Channel Host Bus Adapter.
7  *
8  * This program is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU General Public License (GPL) Version 2 as
10  * published by the Free Software Foundation
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  */
17
18 #ifndef __BFI_IOCFC_H__
19 #define __BFI_IOCFC_H__
20
21 #include "bfi.h"
22 #include <bfi/bfi_pbc.h>
23 #include <defs/bfa_defs_ioc.h>
24 #include <defs/bfa_defs_iocfc.h>
25 #include <defs/bfa_defs_boot.h>
26
27 #pragma pack(1)
28
29 enum bfi_iocfc_h2i_msgs {
30         BFI_IOCFC_H2I_CFG_REQ           = 1,
31         BFI_IOCFC_H2I_GET_STATS_REQ     = 2,
32         BFI_IOCFC_H2I_CLEAR_STATS_REQ   = 3,
33         BFI_IOCFC_H2I_SET_INTR_REQ      = 4,
34         BFI_IOCFC_H2I_UPDATEQ_REQ = 5,
35 };
36
37 enum bfi_iocfc_i2h_msgs {
38         BFI_IOCFC_I2H_CFG_REPLY         = BFA_I2HM(1),
39         BFI_IOCFC_I2H_GET_STATS_RSP     = BFA_I2HM(2),
40         BFI_IOCFC_I2H_CLEAR_STATS_RSP   = BFA_I2HM(3),
41         BFI_IOCFC_I2H_UPDATEQ_RSP = BFA_I2HM(5),
42 };
43
44 struct bfi_iocfc_cfg_s {
45         u8         num_cqs;     /*  Number of CQs to be used     */
46         u8         sense_buf_len;       /*  SCSI sense length            */
47         u8         trunk_enabled;       /*  port trunking enabled        */
48         u8         trunk_ports; /*  trunk ports bit map          */
49         u32        endian_sig;  /*  endian signature of host     */
50
51         /**
52          * Request and response circular queue base addresses, size and
53          * shadow index pointers.
54          */
55         union bfi_addr_u  req_cq_ba[BFI_IOC_MAX_CQS];
56         union bfi_addr_u  req_shadow_ci[BFI_IOC_MAX_CQS];
57         u16    req_cq_elems[BFI_IOC_MAX_CQS];
58         union bfi_addr_u  rsp_cq_ba[BFI_IOC_MAX_CQS];
59         union bfi_addr_u  rsp_shadow_pi[BFI_IOC_MAX_CQS];
60         u16    rsp_cq_elems[BFI_IOC_MAX_CQS];
61
62         union bfi_addr_u  stats_addr;   /*  DMA-able address for stats    */
63         union bfi_addr_u  cfgrsp_addr;  /*  config response dma address  */
64         union bfi_addr_u  ioim_snsbase;  /*  IO sense buffer base address */
65         struct bfa_iocfc_intr_attr_s intr_attr; /*  IOC interrupt attributes */
66 };
67
68 /**
69  * Boot target wwn information for this port. This contains either the stored
70  * or discovered boot target port wwns for the port.
71  */
72 struct bfi_iocfc_bootwwns {
73         wwn_t           wwn[BFA_BOOT_BOOTLUN_MAX];
74         u8              nwwns;
75         u8              rsvd[7];
76 };
77
78 struct bfi_iocfc_cfgrsp_s {
79         struct bfa_iocfc_fwcfg_s        fwcfg;
80         struct bfa_iocfc_intr_attr_s    intr_attr;
81         struct bfi_iocfc_bootwwns       bootwwns;
82         struct bfi_pbc_s                pbc_cfg;
83 };
84
85 /**
86  * BFI_IOCFC_H2I_CFG_REQ message
87  */
88 struct bfi_iocfc_cfg_req_s {
89         struct bfi_mhdr_s      mh;
90         union bfi_addr_u      ioc_cfg_dma_addr;
91 };
92
93 /**
94  * BFI_IOCFC_I2H_CFG_REPLY message
95  */
96 struct bfi_iocfc_cfg_reply_s {
97         struct bfi_mhdr_s  mh;          /*  Common msg header          */
98         u8         cfg_success; /*  cfg reply status           */
99         u8         lpu_bm;              /*  LPUs assigned for this IOC */
100         u8         rsvd[2];
101 };
102
103 /**
104  *  BFI_IOCFC_H2I_GET_STATS_REQ & BFI_IOCFC_H2I_CLEAR_STATS_REQ messages
105  */
106 struct bfi_iocfc_stats_req_s {
107         struct bfi_mhdr_s mh;           /*  msg header            */
108         u32        msgtag;              /*  msgtag for reply      */
109 };
110
111 /**
112  * BFI_IOCFC_I2H_GET_STATS_RSP & BFI_IOCFC_I2H_CLEAR_STATS_RSP messages
113  */
114 struct bfi_iocfc_stats_rsp_s {
115         struct bfi_mhdr_s mh;           /*  common msg header     */
116         u8         status;              /*  reply status          */
117         u8         rsvd[3];
118         u32        msgtag;              /*  msgtag for reply      */
119 };
120
121 /**
122  * BFI_IOCFC_H2I_SET_INTR_REQ message
123  */
124 struct bfi_iocfc_set_intr_req_s {
125         struct bfi_mhdr_s mh;           /*  common msg header     */
126         u8              coalesce;       /*  enable intr coalescing*/
127         u8         rsvd[3];
128         u16     delay;          /*  delay timer 0..1125us  */
129         u16     latency;        /*  latency timer 0..225us */
130 };
131
132 /**
133  * BFI_IOCFC_H2I_UPDATEQ_REQ message
134  */
135 struct bfi_iocfc_updateq_req_s {
136         struct bfi_mhdr_s mh;           /*  common msg header     */
137         u32 reqq_ba;                    /*  reqq base addr        */
138         u32 rspq_ba;                    /*  rspq base addr        */
139         u32 reqq_sci;                   /*  reqq shadow ci        */
140         u32 rspq_spi;                   /*  rspq shadow pi        */
141 };
142
143 /**
144  * BFI_IOCFC_I2H_UPDATEQ_RSP message
145  */
146 struct bfi_iocfc_updateq_rsp_s {
147         struct bfi_mhdr_s mh;           /*  common msg header     */
148         u8         status;              /*  updateq  status       */
149         u8         rsvd[3];
150 };
151
152 /**
153  * H2I Messages
154  */
155 union bfi_iocfc_h2i_msg_u {
156         struct bfi_mhdr_s               mh;
157         struct bfi_iocfc_cfg_req_s      cfg_req;
158         struct bfi_iocfc_stats_req_s stats_get;
159         struct bfi_iocfc_stats_req_s stats_clr;
160         struct bfi_iocfc_updateq_req_s updateq_req;
161         u32                             mboxmsg[BFI_IOC_MSGSZ];
162 };
163
164 /**
165  * I2H Messages
166  */
167 union bfi_iocfc_i2h_msg_u {
168         struct bfi_mhdr_s               mh;
169         struct bfi_iocfc_cfg_reply_s            cfg_reply;
170         struct bfi_iocfc_stats_rsp_s stats_get_rsp;
171         struct bfi_iocfc_stats_rsp_s stats_clr_rsp;
172         struct bfi_iocfc_updateq_rsp_s updateq_rsp;
173         u32                             mboxmsg[BFI_IOC_MSGSZ];
174 };
175
176 #pragma pack()
177
178 #endif /* __BFI_IOCFC_H__ */
179