Linux-libre 2.6.32.58-gnu1
[librecmc/linux-libre.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 <defs/bfa_defs_ioc.h>
23 #include <defs/bfa_defs_iocfc.h>
24 #include <defs/bfa_defs_boot.h>
25
26 #pragma pack(1)
27
28 enum bfi_iocfc_h2i_msgs {
29         BFI_IOCFC_H2I_CFG_REQ           = 1,
30         BFI_IOCFC_H2I_GET_STATS_REQ     = 2,
31         BFI_IOCFC_H2I_CLEAR_STATS_REQ   = 3,
32         BFI_IOCFC_H2I_SET_INTR_REQ      = 4,
33         BFI_IOCFC_H2I_UPDATEQ_REQ = 5,
34 };
35
36 enum bfi_iocfc_i2h_msgs {
37         BFI_IOCFC_I2H_CFG_REPLY         = BFA_I2HM(1),
38         BFI_IOCFC_I2H_GET_STATS_RSP     = BFA_I2HM(2),
39         BFI_IOCFC_I2H_CLEAR_STATS_RSP   = BFA_I2HM(3),
40         BFI_IOCFC_I2H_UPDATEQ_RSP = BFA_I2HM(5),
41 };
42
43 struct bfi_iocfc_cfg_s {
44         u8         num_cqs;     /*  Number of CQs to be used     */
45         u8         sense_buf_len;       /*  SCSI sense length            */
46         u8         trunk_enabled;       /*  port trunking enabled        */
47         u8         trunk_ports; /*  trunk ports bit map          */
48         u32        endian_sig;  /*  endian signature of host     */
49
50         /**
51          * Request and response circular queue base addresses, size and
52          * shadow index pointers.
53          */
54         union bfi_addr_u  req_cq_ba[BFI_IOC_MAX_CQS];
55         union bfi_addr_u  req_shadow_ci[BFI_IOC_MAX_CQS];
56         u16    req_cq_elems[BFI_IOC_MAX_CQS];
57         union bfi_addr_u  rsp_cq_ba[BFI_IOC_MAX_CQS];
58         union bfi_addr_u  rsp_shadow_pi[BFI_IOC_MAX_CQS];
59         u16    rsp_cq_elems[BFI_IOC_MAX_CQS];
60
61         union bfi_addr_u  stats_addr;   /*  DMA-able address for stats    */
62         union bfi_addr_u  cfgrsp_addr;  /*  config response dma address  */
63         union bfi_addr_u  ioim_snsbase;  /*  IO sense buffer base address */
64         struct bfa_iocfc_intr_attr_s intr_attr; /*  IOC interrupt attributes */
65 };
66
67 /**
68  * Boot target wwn information for this port. This contains either the stored
69  * or discovered boot target port wwns for the port.
70  */
71 struct bfi_iocfc_bootwwns {
72         wwn_t           wwn[BFA_BOOT_BOOTLUN_MAX];
73         u8              nwwns;
74         u8              rsvd[7];
75 };
76
77 struct bfi_iocfc_cfgrsp_s {
78         struct bfa_iocfc_fwcfg_s        fwcfg;
79         struct bfa_iocfc_intr_attr_s    intr_attr;
80         struct bfi_iocfc_bootwwns       bootwwns;
81 };
82
83 /**
84  * BFI_IOCFC_H2I_CFG_REQ message
85  */
86 struct bfi_iocfc_cfg_req_s {
87         struct bfi_mhdr_s      mh;
88         union bfi_addr_u      ioc_cfg_dma_addr;
89 };
90
91 /**
92  * BFI_IOCFC_I2H_CFG_REPLY message
93  */
94 struct bfi_iocfc_cfg_reply_s {
95         struct bfi_mhdr_s  mh;          /*  Common msg header          */
96         u8         cfg_success; /*  cfg reply status           */
97         u8         lpu_bm;              /*  LPUs assigned for this IOC */
98         u8         rsvd[2];
99 };
100
101 /**
102  *  BFI_IOCFC_H2I_GET_STATS_REQ & BFI_IOCFC_H2I_CLEAR_STATS_REQ messages
103  */
104 struct bfi_iocfc_stats_req_s {
105         struct bfi_mhdr_s mh;           /*  msg header            */
106         u32        msgtag;              /*  msgtag for reply      */
107 };
108
109 /**
110  * BFI_IOCFC_I2H_GET_STATS_RSP & BFI_IOCFC_I2H_CLEAR_STATS_RSP messages
111  */
112 struct bfi_iocfc_stats_rsp_s {
113         struct bfi_mhdr_s mh;           /*  common msg header     */
114         u8         status;              /*  reply status          */
115         u8         rsvd[3];
116         u32        msgtag;              /*  msgtag for reply      */
117 };
118
119 /**
120  * BFI_IOCFC_H2I_SET_INTR_REQ message
121  */
122 struct bfi_iocfc_set_intr_req_s {
123         struct bfi_mhdr_s mh;           /*  common msg header     */
124         u8              coalesce;       /*  enable intr coalescing*/
125         u8         rsvd[3];
126         u16     delay;          /*  delay timer 0..1125us  */
127         u16     latency;        /*  latency timer 0..225us */
128 };
129
130 /**
131  * BFI_IOCFC_H2I_UPDATEQ_REQ message
132  */
133 struct bfi_iocfc_updateq_req_s {
134         struct bfi_mhdr_s mh;           /*  common msg header     */
135         u32 reqq_ba;                    /*  reqq base addr        */
136         u32 rspq_ba;                    /*  rspq base addr        */
137         u32 reqq_sci;                   /*  reqq shadow ci        */
138         u32 rspq_spi;                   /*  rspq shadow pi        */
139 };
140
141 /**
142  * BFI_IOCFC_I2H_UPDATEQ_RSP message
143  */
144 struct bfi_iocfc_updateq_rsp_s {
145         struct bfi_mhdr_s mh;           /*  common msg header     */
146         u8         status;              /*  updateq  status       */
147         u8         rsvd[3];
148 };
149
150 /**
151  * H2I Messages
152  */
153 union bfi_iocfc_h2i_msg_u {
154         struct bfi_mhdr_s               mh;
155         struct bfi_iocfc_cfg_req_s      cfg_req;
156         struct bfi_iocfc_stats_req_s stats_get;
157         struct bfi_iocfc_stats_req_s stats_clr;
158         struct bfi_iocfc_updateq_req_s updateq_req;
159         u32                             mboxmsg[BFI_IOC_MSGSZ];
160 };
161
162 /**
163  * I2H Messages
164  */
165 union bfi_iocfc_i2h_msg_u {
166         struct bfi_mhdr_s               mh;
167         struct bfi_iocfc_cfg_reply_s            cfg_reply;
168         struct bfi_iocfc_stats_rsp_s stats_get_rsp;
169         struct bfi_iocfc_stats_rsp_s stats_clr_rsp;
170         struct bfi_iocfc_updateq_rsp_s updateq_rsp;
171         u32                             mboxmsg[BFI_IOC_MSGSZ];
172 };
173
174 #pragma pack()
175
176 #endif /* __BFI_IOCFC_H__ */
177