[SCSI] bfa: Brocade BFA FC SCSI driver
[safe/jmp/linux-2.6] / drivers / scsi / bfa / include / protocol / fdmi.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 __FDMI_H__
19 #define __FDMI_H__
20
21 #include <protocol/types.h>
22 #include <protocol/fc.h>
23 #include <protocol/ct.h>
24
25 #pragma pack(1)
26
27 /*
28  * FDMI Command Codes
29  */
30 #define FDMI_GRHL               0x0100
31 #define FDMI_GHAT               0x0101
32 #define FDMI_GRPL               0x0102
33 #define FDMI_GPAT               0x0110
34 #define FDMI_RHBA               0x0200
35 #define FDMI_RHAT               0x0201
36 #define FDMI_RPRT               0x0210
37 #define FDMI_RPA                0x0211
38 #define FDMI_DHBA               0x0300
39 #define FDMI_DPRT               0x0310
40
41 /*
42  * FDMI reason codes
43  */
44 #define FDMI_NO_ADDITIONAL_EXP          0x00
45 #define FDMI_HBA_ALREADY_REG            0x10
46 #define FDMI_HBA_ATTRIB_NOT_REG         0x11
47 #define FDMI_HBA_ATTRIB_MULTIPLE        0x12
48 #define FDMI_HBA_ATTRIB_LENGTH_INVALID  0x13
49 #define FDMI_HBA_ATTRIB_NOT_PRESENT     0x14
50 #define FDMI_PORT_ORIG_NOT_IN_LIST      0x15
51 #define FDMI_PORT_HBA_NOT_IN_LIST       0x16
52 #define FDMI_PORT_ATTRIB_NOT_REG        0x20
53 #define FDMI_PORT_NOT_REG               0x21
54 #define FDMI_PORT_ATTRIB_MULTIPLE       0x22
55 #define FDMI_PORT_ATTRIB_LENGTH_INVALID 0x23
56 #define FDMI_PORT_ALREADY_REGISTEREED   0x24
57
58 /*
59  * FDMI Transmission Speed Mask values
60  */
61 #define FDMI_TRANS_SPEED_1G             0x00000001
62 #define FDMI_TRANS_SPEED_2G             0x00000002
63 #define FDMI_TRANS_SPEED_10G            0x00000004
64 #define FDMI_TRANS_SPEED_4G             0x00000008
65 #define FDMI_TRANS_SPEED_8G             0x00000010
66 #define FDMI_TRANS_SPEED_16G            0x00000020
67 #define FDMI_TRANS_SPEED_UNKNOWN        0x00008000
68
69 /*
70  * FDMI HBA attribute types
71  */
72 enum fdmi_hba_attribute_type {
73         FDMI_HBA_ATTRIB_NODENAME = 1,   /* 0x0001 */
74         FDMI_HBA_ATTRIB_MANUFACTURER,   /* 0x0002 */
75         FDMI_HBA_ATTRIB_SERIALNUM,      /* 0x0003 */
76         FDMI_HBA_ATTRIB_MODEL,          /* 0x0004 */
77         FDMI_HBA_ATTRIB_MODEL_DESC,     /* 0x0005 */
78         FDMI_HBA_ATTRIB_HW_VERSION,     /* 0x0006 */
79         FDMI_HBA_ATTRIB_DRIVER_VERSION, /* 0x0007 */
80         FDMI_HBA_ATTRIB_ROM_VERSION,    /* 0x0008 */
81         FDMI_HBA_ATTRIB_FW_VERSION,     /* 0x0009 */
82         FDMI_HBA_ATTRIB_OS_NAME,        /* 0x000A */
83         FDMI_HBA_ATTRIB_MAX_CT,         /* 0x000B */
84
85         FDMI_HBA_ATTRIB_MAX_TYPE
86 };
87
88 /*
89  * FDMI Port attribute types
90  */
91 enum fdmi_port_attribute_type {
92         FDMI_PORT_ATTRIB_FC4_TYPES = 1, /* 0x0001 */
93         FDMI_PORT_ATTRIB_SUPP_SPEED,    /* 0x0002 */
94         FDMI_PORT_ATTRIB_PORT_SPEED,    /* 0x0003 */
95         FDMI_PORT_ATTRIB_FRAME_SIZE,    /* 0x0004 */
96         FDMI_PORT_ATTRIB_DEV_NAME,      /* 0x0005 */
97         FDMI_PORT_ATTRIB_HOST_NAME,     /* 0x0006 */
98
99         FDMI_PORT_ATTR_MAX_TYPE
100 };
101
102 /*
103  * FDMI attribute
104  */
105 struct fdmi_attr_s {
106         u16        type;
107         u16        len;
108         u8         value[1];
109 };
110
111 /*
112  * HBA Attribute Block
113  */
114 struct fdmi_hba_attr_s {
115         u32        attr_count;  /* # of attributes */
116         struct fdmi_attr_s     hba_attr;        /* n attributes */
117 };
118
119 /*
120  * Registered Port List
121  */
122 struct fdmi_port_list_s {
123         u32        num_ports;   /* number Of Port Entries */
124         wwn_t           port_entry;     /* one or more */
125 };
126
127 /*
128  * Port Attribute Block
129  */
130 struct fdmi_port_attr_s {
131         u32        attr_count;  /* # of attributes */
132         struct fdmi_attr_s     port_attr;       /* n attributes */
133 };
134
135 /*
136  * FDMI Register HBA Attributes
137  */
138 struct fdmi_rhba_s {
139         wwn_t           hba_id;         /* HBA Identifier */
140         struct fdmi_port_list_s port_list;      /* Registered Port List */
141         struct fdmi_hba_attr_s hba_attr_blk;    /* HBA attribute block */
142 };
143
144 /*
145  * FDMI Register Port
146  */
147 struct fdmi_rprt_s {
148         wwn_t           hba_id;         /* HBA Identifier */
149         wwn_t           port_name;      /* Port wwn */
150         struct fdmi_port_attr_s port_attr_blk;  /* Port Attr Block */
151 };
152
153 /*
154  * FDMI Register Port Attributes
155  */
156 struct fdmi_rpa_s {
157         wwn_t           port_name;      /* port wwn */
158         struct fdmi_port_attr_s port_attr_blk;  /* Port Attr Block */
159 };
160
161 #pragma pack()
162
163 #endif