xref: /openbmc/linux/include/scsi/fc/fc_ms.h (revision 49d3e599)
1a61127c2SThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */
2d4fd6347SChristoph Hellwig /*
3d4fd6347SChristoph Hellwig  * Copyright(c) 2011 Intel Corporation. All rights reserved.
4d78c317fSNeerav Parikh  *
5d78c317fSNeerav Parikh  * Maintained at www.Open-FCoE.org
6d78c317fSNeerav Parikh  */
7d78c317fSNeerav Parikh 
8d78c317fSNeerav Parikh #ifndef _FC_MS_H_
9d78c317fSNeerav Parikh #define	_FC_MS_H_
10d78c317fSNeerav Parikh 
11d78c317fSNeerav Parikh #include <linux/types.h>
12d78c317fSNeerav Parikh 
13d78c317fSNeerav Parikh /*
14d78c317fSNeerav Parikh  * Fibre Channel Services - Management Service (MS)
15d78c317fSNeerav Parikh  * From T11.org FC-GS-4 Rev 7.91 February 4, 2004
16d78c317fSNeerav Parikh  */
17d78c317fSNeerav Parikh 
18d78c317fSNeerav Parikh /*
19d78c317fSNeerav Parikh  * Fabric Device Management Interface
20d78c317fSNeerav Parikh  */
21d78c317fSNeerav Parikh 
22d78c317fSNeerav Parikh /*
23d78c317fSNeerav Parikh  * Common-transport sub-type for FDMI
24d78c317fSNeerav Parikh  */
25d78c317fSNeerav Parikh #define	FC_FDMI_SUBTYPE	    0x10 /* fs_ct_hdr.ct_fs_subtype */
26d78c317fSNeerav Parikh 
27d78c317fSNeerav Parikh /*
28*49d3e599SJaved Hasan  * Management server FDMI specifications.
29*49d3e599SJaved Hasan  */
30*49d3e599SJaved Hasan #define	FDMI_V1	    1 /* FDMI version 1 specifications */
31*49d3e599SJaved Hasan #define	FDMI_V2	    2 /* FDMI version 2 specifications */
32*49d3e599SJaved Hasan 
33*49d3e599SJaved Hasan /*
34d78c317fSNeerav Parikh  * Management server FDMI Requests.
35d78c317fSNeerav Parikh  */
36d78c317fSNeerav Parikh enum fc_fdmi_req {
37d78c317fSNeerav Parikh 	FC_FDMI_GRHL = 0x0100,	/* Get Registered HBA List */
38d78c317fSNeerav Parikh 	FC_FDMI_GHAT = 0x0101,	/* Get HBA Attributes */
39d78c317fSNeerav Parikh 	FC_FDMI_GRPL = 0x0102,	/* Get Registered Port List */
40d78c317fSNeerav Parikh 	FC_FDMI_GPAT = 0x0110,	/* Get Port Attributes */
41d78c317fSNeerav Parikh 	FC_FDMI_RHBA = 0x0200,	/* Register HBA */
42d78c317fSNeerav Parikh 	FC_FDMI_RHAT = 0x0201,	/* Register HBA Attributes */
43d78c317fSNeerav Parikh 	FC_FDMI_RPRT = 0x0210,	/* Register Port */
44d78c317fSNeerav Parikh 	FC_FDMI_RPA = 0x0211,	/* Register Port Attributes */
45d78c317fSNeerav Parikh 	FC_FDMI_DHBA = 0x0300,	/* Deregister HBA */
46d78c317fSNeerav Parikh 	FC_FDMI_DHAT = 0x0301,	/* Deregister HBA Attributes */
47d78c317fSNeerav Parikh 	FC_FDMI_DPRT = 0x0310,	/* Deregister Port */
48d78c317fSNeerav Parikh 	FC_FDMI_DPA = 0x0311,	/* Deregister Port Attributes */
49d78c317fSNeerav Parikh };
50d78c317fSNeerav Parikh 
51d78c317fSNeerav Parikh /*
52d78c317fSNeerav Parikh  * HBA Attribute Entry Type
53d78c317fSNeerav Parikh  */
54d78c317fSNeerav Parikh enum fc_fdmi_hba_attr_type {
55d78c317fSNeerav Parikh 	FC_FDMI_HBA_ATTR_NODENAME = 0x0001,
56d78c317fSNeerav Parikh 	FC_FDMI_HBA_ATTR_MANUFACTURER = 0x0002,
57d78c317fSNeerav Parikh 	FC_FDMI_HBA_ATTR_SERIALNUMBER = 0x0003,
58d78c317fSNeerav Parikh 	FC_FDMI_HBA_ATTR_MODEL = 0x0004,
59d78c317fSNeerav Parikh 	FC_FDMI_HBA_ATTR_MODELDESCRIPTION = 0x0005,
60d78c317fSNeerav Parikh 	FC_FDMI_HBA_ATTR_HARDWAREVERSION = 0x0006,
61d78c317fSNeerav Parikh 	FC_FDMI_HBA_ATTR_DRIVERVERSION = 0x0007,
62d78c317fSNeerav Parikh 	FC_FDMI_HBA_ATTR_OPTIONROMVERSION = 0x0008,
63d78c317fSNeerav Parikh 	FC_FDMI_HBA_ATTR_FIRMWAREVERSION = 0x0009,
64d78c317fSNeerav Parikh 	FC_FDMI_HBA_ATTR_OSNAMEVERSION = 0x000A,
65d78c317fSNeerav Parikh 	FC_FDMI_HBA_ATTR_MAXCTPAYLOAD = 0x000B,
66*49d3e599SJaved Hasan 	FC_FDMI_HBA_ATTR_NODESYMBLNAME = 0x000C,
67*49d3e599SJaved Hasan 	FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO = 0x000D,
68*49d3e599SJaved Hasan 	FC_FDMI_HBA_ATTR_NUMBEROFPORTS = 0x000E,
69*49d3e599SJaved Hasan 	FC_FDMI_HBA_ATTR_FABRICNAME = 0x000F,
70*49d3e599SJaved Hasan 	FC_FDMI_HBA_ATTR_BIOSVERSION = 0x0010,
71*49d3e599SJaved Hasan 	FC_FDMI_HBA_ATTR_BIOSSTATE = 0x0011,
72*49d3e599SJaved Hasan 	FC_FDMI_HBA_ATTR_VENDORIDENTIFIER = 0x00E0,
73d78c317fSNeerav Parikh };
74d78c317fSNeerav Parikh 
75d78c317fSNeerav Parikh /*
76d78c317fSNeerav Parikh  * HBA Attribute Length
77d78c317fSNeerav Parikh  */
78d78c317fSNeerav Parikh #define FC_FDMI_HBA_ATTR_NODENAME_LEN		8
7940445fd2SJaved Hasan #define FC_FDMI_HBA_ATTR_MANUFACTURER_LEN	64
8040445fd2SJaved Hasan #define FC_FDMI_HBA_ATTR_SERIALNUMBER_LEN	64
81*49d3e599SJaved Hasan #define FC_FDMI_HBA_ATTR_MODEL_LEN		64
82*49d3e599SJaved Hasan #define FC_FDMI_HBA_ATTR_MODELDESCR_LEN		64
83*49d3e599SJaved Hasan #define FC_FDMI_HBA_ATTR_HARDWAREVERSION_LEN	64
84*49d3e599SJaved Hasan #define FC_FDMI_HBA_ATTR_DRIVERVERSION_LEN	64
85*49d3e599SJaved Hasan #define FC_FDMI_HBA_ATTR_OPTIONROMVERSION_LEN	64
86*49d3e599SJaved Hasan #define FC_FDMI_HBA_ATTR_FIRMWAREVERSION_LEN	64
87*49d3e599SJaved Hasan #define FC_FDMI_HBA_ATTR_OSNAMEVERSION_LEN	128
88d78c317fSNeerav Parikh #define FC_FDMI_HBA_ATTR_MAXCTPAYLOAD_LEN	4
89*49d3e599SJaved Hasan #define FC_FDMI_HBA_ATTR_NODESYMBLNAME_LEN	64
90*49d3e599SJaved Hasan #define FC_FDMI_HBA_ATTR_VENDORSPECIFICINFO_LEN	4
91*49d3e599SJaved Hasan #define FC_FDMI_HBA_ATTR_NUMBEROFPORTS_LEN	4
92*49d3e599SJaved Hasan #define FC_FDMI_HBA_ATTR_FABRICNAME_LEN	8
93*49d3e599SJaved Hasan #define FC_FDMI_HBA_ATTR_BIOSVERSION_LEN	64
94*49d3e599SJaved Hasan #define FC_FDMI_HBA_ATTR_BIOSSTATE_LEN    4
95*49d3e599SJaved Hasan #define FC_FDMI_HBA_ATTR_VENDORIDENTIFIER_LEN 8
96d78c317fSNeerav Parikh 
97d78c317fSNeerav Parikh /*
98d78c317fSNeerav Parikh  * Port Attribute Type
99d78c317fSNeerav Parikh  */
100d78c317fSNeerav Parikh enum fc_fdmi_port_attr_type {
101d78c317fSNeerav Parikh 	FC_FDMI_PORT_ATTR_FC4TYPES = 0x0001,
102d78c317fSNeerav Parikh 	FC_FDMI_PORT_ATTR_SUPPORTEDSPEED = 0x0002,
103d78c317fSNeerav Parikh 	FC_FDMI_PORT_ATTR_CURRENTPORTSPEED = 0x0003,
104d78c317fSNeerav Parikh 	FC_FDMI_PORT_ATTR_MAXFRAMESIZE = 0x0004,
105d78c317fSNeerav Parikh 	FC_FDMI_PORT_ATTR_OSDEVICENAME = 0x0005,
106d78c317fSNeerav Parikh 	FC_FDMI_PORT_ATTR_HOSTNAME = 0x0006,
107*49d3e599SJaved Hasan 	FC_FDMI_PORT_ATTR_NODENAME = 0x0007,
108*49d3e599SJaved Hasan 	FC_FDMI_PORT_ATTR_PORTNAME = 0x0008,
109*49d3e599SJaved Hasan 	FC_FDMI_PORT_ATTR_SYMBOLICNAME = 0x0009,
110*49d3e599SJaved Hasan 	FC_FDMI_PORT_ATTR_PORTTYPE = 0x000A,
111*49d3e599SJaved Hasan 	FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC = 0x000B,
112*49d3e599SJaved Hasan 	FC_FDMI_PORT_ATTR_FABRICNAME = 0x000C,
113*49d3e599SJaved Hasan 	FC_FDMI_PORT_ATTR_CURRENTFC4TYPE = 0x000D,
114*49d3e599SJaved Hasan 	FC_FDMI_PORT_ATTR_PORTSTATE = 0x101,
115*49d3e599SJaved Hasan 	FC_FDMI_PORT_ATTR_DISCOVEREDPORTS = 0x102,
116*49d3e599SJaved Hasan 	FC_FDMI_PORT_ATTR_PORTID = 0x103,
117d78c317fSNeerav Parikh };
118d78c317fSNeerav Parikh 
119d78c317fSNeerav Parikh /*
120d78c317fSNeerav Parikh  * Port Attribute Length
121d78c317fSNeerav Parikh  */
122d78c317fSNeerav Parikh #define FC_FDMI_PORT_ATTR_FC4TYPES_LEN		32
123d78c317fSNeerav Parikh #define FC_FDMI_PORT_ATTR_SUPPORTEDSPEED_LEN	4
124d78c317fSNeerav Parikh #define FC_FDMI_PORT_ATTR_CURRENTPORTSPEED_LEN	4
125d78c317fSNeerav Parikh #define FC_FDMI_PORT_ATTR_MAXFRAMESIZE_LEN	4
126d78c317fSNeerav Parikh #define FC_FDMI_PORT_ATTR_OSDEVICENAME_LEN	256
127d78c317fSNeerav Parikh #define FC_FDMI_PORT_ATTR_HOSTNAME_LEN		256
128*49d3e599SJaved Hasan #define FC_FDMI_PORT_ATTR_NODENAME_LEN		8
129*49d3e599SJaved Hasan #define FC_FDMI_PORT_ATTR_PORTNAME_LEN		8
130*49d3e599SJaved Hasan #define FC_FDMI_PORT_ATTR_SYMBOLICNAME_LEN	256
131*49d3e599SJaved Hasan #define FC_FDMI_PORT_ATTR_PORTTYPE_LEN		4
132*49d3e599SJaved Hasan #define FC_FDMI_PORT_ATTR_SUPPORTEDCLASSSRVC_LEN	4
133*49d3e599SJaved Hasan #define FC_FDMI_PORT_ATTR_FABRICNAME_LEN	8
134*49d3e599SJaved Hasan #define FC_FDMI_PORT_ATTR_CURRENTFC4TYPE_LEN	32
135*49d3e599SJaved Hasan #define FC_FDMI_PORT_ATTR_PORTSTATE_LEN		4
136*49d3e599SJaved Hasan #define FC_FDMI_PORT_ATTR_DISCOVEREDPORTS_LEN	4
137*49d3e599SJaved Hasan #define FC_FDMI_PORT_ATTR_PORTID_LEN		4
138*49d3e599SJaved Hasan 
139d78c317fSNeerav Parikh 
140d78c317fSNeerav Parikh /*
141d78c317fSNeerav Parikh  * HBA Attribute ID
142d78c317fSNeerav Parikh  */
143d78c317fSNeerav Parikh struct fc_fdmi_hba_identifier {
144d78c317fSNeerav Parikh 	__be64		id;
145d78c317fSNeerav Parikh };
146d78c317fSNeerav Parikh 
147d78c317fSNeerav Parikh /*
148d78c317fSNeerav Parikh  * Port Name
149d78c317fSNeerav Parikh  */
150d78c317fSNeerav Parikh struct fc_fdmi_port_name {
151d78c317fSNeerav Parikh 	__be64		portname;
152d78c317fSNeerav Parikh };
153d78c317fSNeerav Parikh 
154d78c317fSNeerav Parikh /*
155d78c317fSNeerav Parikh  * Attribute Entry Block for HBA/Port Attributes
156d78c317fSNeerav Parikh  */
157d78c317fSNeerav Parikh #define FC_FDMI_ATTR_ENTRY_HEADER_LEN	4
158d78c317fSNeerav Parikh struct fc_fdmi_attr_entry {
159d78c317fSNeerav Parikh 	__be16		type;
160d78c317fSNeerav Parikh 	__be16		len;
161d78c317fSNeerav Parikh 	__u8		value[1];
162d78c317fSNeerav Parikh } __attribute__((__packed__));
163d78c317fSNeerav Parikh 
164d78c317fSNeerav Parikh /*
165d78c317fSNeerav Parikh  * Common for HBA/Port Attributes
166d78c317fSNeerav Parikh  */
167d78c317fSNeerav Parikh struct fs_fdmi_attrs {
168d78c317fSNeerav Parikh 	__be32				numattrs;
169d78c317fSNeerav Parikh 	struct fc_fdmi_attr_entry	attr[1];
170d78c317fSNeerav Parikh } __attribute__((__packed__));
171d78c317fSNeerav Parikh 
172d78c317fSNeerav Parikh /*
173d78c317fSNeerav Parikh  * Registered Port List
174d78c317fSNeerav Parikh  */
175d78c317fSNeerav Parikh struct fc_fdmi_rpl {
176d78c317fSNeerav Parikh 	__be32				numport;
177d78c317fSNeerav Parikh 	struct fc_fdmi_port_name	port[1];
178d78c317fSNeerav Parikh } __attribute__((__packed__));
179d78c317fSNeerav Parikh 
180d78c317fSNeerav Parikh /*
181d78c317fSNeerav Parikh  * Register HBA (RHBA)
182d78c317fSNeerav Parikh  */
183d78c317fSNeerav Parikh struct fc_fdmi_rhba {
184d78c317fSNeerav Parikh 	struct fc_fdmi_hba_identifier hbaid;
185d78c317fSNeerav Parikh 	struct fc_fdmi_rpl		 port;
186d78c317fSNeerav Parikh 	struct fs_fdmi_attrs		 hba_attrs;
187d78c317fSNeerav Parikh } __attribute__((__packed__));
188d78c317fSNeerav Parikh 
189d78c317fSNeerav Parikh /*
190d78c317fSNeerav Parikh  * Register HBA Attributes (RHAT)
191d78c317fSNeerav Parikh  */
192d78c317fSNeerav Parikh struct fc_fdmi_rhat {
193d78c317fSNeerav Parikh 	struct fc_fdmi_hba_identifier hbaid;
194d78c317fSNeerav Parikh 	struct fs_fdmi_attrs		 hba_attrs;
195d78c317fSNeerav Parikh } __attribute__((__packed__));
196d78c317fSNeerav Parikh 
197d78c317fSNeerav Parikh /*
198d78c317fSNeerav Parikh  * Register Port (RPRT)
199d78c317fSNeerav Parikh  */
200d78c317fSNeerav Parikh struct fc_fdmi_rprt {
201d78c317fSNeerav Parikh 	struct fc_fdmi_hba_identifier hbaid;
202d78c317fSNeerav Parikh 	struct fc_fdmi_port_name	 port;
203d78c317fSNeerav Parikh 	struct fs_fdmi_attrs		 hba_attrs;
204d78c317fSNeerav Parikh } __attribute__((__packed__));
205d78c317fSNeerav Parikh 
206d78c317fSNeerav Parikh /*
207d78c317fSNeerav Parikh  * Register Port Attributes (RPA)
208d78c317fSNeerav Parikh  */
209d78c317fSNeerav Parikh struct fc_fdmi_rpa {
210d78c317fSNeerav Parikh 	struct fc_fdmi_port_name	 port;
211d78c317fSNeerav Parikh 	struct fs_fdmi_attrs		 hba_attrs;
212d78c317fSNeerav Parikh } __attribute__((__packed__));
213d78c317fSNeerav Parikh 
214d78c317fSNeerav Parikh /*
215d78c317fSNeerav Parikh  * Deregister Port (DPRT)
216d78c317fSNeerav Parikh  */
217d78c317fSNeerav Parikh struct fc_fdmi_dprt {
218d78c317fSNeerav Parikh 	struct fc_fdmi_port_name	 port;
219d78c317fSNeerav Parikh } __attribute__((__packed__));
220d78c317fSNeerav Parikh 
221d78c317fSNeerav Parikh /*
222d78c317fSNeerav Parikh  * Deregister Port Attributes (DPA)
223d78c317fSNeerav Parikh  */
224d78c317fSNeerav Parikh struct fc_fdmi_dpa {
225d78c317fSNeerav Parikh 	struct fc_fdmi_port_name	 port;
226d78c317fSNeerav Parikh 	struct fs_fdmi_attrs		 hba_attrs;
227d78c317fSNeerav Parikh } __attribute__((__packed__));
228d78c317fSNeerav Parikh 
229d78c317fSNeerav Parikh /*
230d78c317fSNeerav Parikh  * Deregister HBA Attributes (DHAT)
231d78c317fSNeerav Parikh  */
232d78c317fSNeerav Parikh struct fc_fdmi_dhat {
233d78c317fSNeerav Parikh 	struct fc_fdmi_hba_identifier hbaid;
234d78c317fSNeerav Parikh } __attribute__((__packed__));
235d78c317fSNeerav Parikh 
236d78c317fSNeerav Parikh /*
237d78c317fSNeerav Parikh  * Deregister HBA (DHBA)
238d78c317fSNeerav Parikh  */
239d78c317fSNeerav Parikh struct fc_fdmi_dhba {
240d78c317fSNeerav Parikh 	struct fc_fdmi_hba_identifier hbaid;
241d78c317fSNeerav Parikh } __attribute__((__packed__));
242d78c317fSNeerav Parikh 
243d78c317fSNeerav Parikh #endif /* _FC_MS_H_ */
244