xref: /openbmc/linux/drivers/scsi/lpfc/lpfc_nl.h (revision 0883c2c0)
1 /*******************************************************************
2  * This file is part of the Emulex Linux Device Driver for         *
3  * Fibre Channel Host Bus Adapters.                                *
4  * Copyright (C) 2010 Emulex.  All rights reserved.                *
5  * EMULEX and SLI are trademarks of Emulex.                        *
6  * www.emulex.com                                                  *
7  *                                                                 *
8  * This program is free software; you can redistribute it and/or   *
9  * modify it under the terms of version 2 of the GNU General       *
10  * Public License as published by the Free Software Foundation.    *
11  * This program is distributed in the hope that it will be useful. *
12  * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND          *
13  * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,  *
14  * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE      *
15  * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
16  * TO BE LEGALLY INVALID.  See the GNU General Public License for  *
17  * more details, a copy of which can be found in the file COPYING  *
18  * included with this package.                                     *
19  *******************************************************************/
20 
21 /* Event definitions for RegisterForEvent */
22 #define FC_REG_LINK_EVENT		0x0001	/* link up / down events */
23 #define FC_REG_RSCN_EVENT		0x0002	/* RSCN events */
24 #define FC_REG_CT_EVENT			0x0004	/* CT request events */
25 #define FC_REG_DUMP_EVENT		0x0010	/* Dump events */
26 #define FC_REG_TEMPERATURE_EVENT	0x0020	/* temperature events */
27 #define FC_REG_VPORTRSCN_EVENT		0x0040	/* Vport RSCN events */
28 #define FC_REG_ELS_EVENT		0x0080	/* lpfc els events */
29 #define FC_REG_FABRIC_EVENT		0x0100	/* lpfc fabric events */
30 #define FC_REG_SCSI_EVENT		0x0200	/* lpfc scsi events */
31 #define FC_REG_BOARD_EVENT		0x0400	/* lpfc board events */
32 #define FC_REG_ADAPTER_EVENT		0x0800	/* lpfc adapter events */
33 #define FC_REG_EVENT_MASK		(FC_REG_LINK_EVENT | \
34 						FC_REG_RSCN_EVENT | \
35 						FC_REG_CT_EVENT | \
36 						FC_REG_DUMP_EVENT | \
37 						FC_REG_TEMPERATURE_EVENT | \
38 						FC_REG_VPORTRSCN_EVENT | \
39 						FC_REG_ELS_EVENT | \
40 						FC_REG_FABRIC_EVENT | \
41 						FC_REG_SCSI_EVENT | \
42 						FC_REG_BOARD_EVENT | \
43 						FC_REG_ADAPTER_EVENT)
44 /* Temperature events */
45 #define LPFC_CRIT_TEMP		0x1
46 #define LPFC_THRESHOLD_TEMP	0x2
47 #define LPFC_NORMAL_TEMP	0x3
48 /*
49  * All net link event payloads will begin with and event type
50  * and subcategory. The event type must come first.
51  * The subcategory further defines the data that follows in the rest
52  * of the payload. Each category will have its own unique header plus
53  * any additional data unique to the subcategory.
54  * The payload sent via the fc transport is one-way driver->application.
55  */
56 
57 /* RSCN event header */
58 struct lpfc_rscn_event_header {
59 	uint32_t event_type;
60 	uint32_t payload_length; /* RSCN data length in bytes */
61 	uint32_t rscn_payload[];
62 };
63 
64 /* els event header */
65 struct lpfc_els_event_header {
66 	uint32_t event_type;
67 	uint32_t subcategory;
68 	uint8_t wwpn[8];
69 	uint8_t wwnn[8];
70 };
71 
72 /* subcategory codes for FC_REG_ELS_EVENT */
73 #define LPFC_EVENT_PLOGI_RCV		0x01
74 #define LPFC_EVENT_PRLO_RCV		0x02
75 #define LPFC_EVENT_ADISC_RCV		0x04
76 #define LPFC_EVENT_LSRJT_RCV		0x08
77 #define LPFC_EVENT_LOGO_RCV		0x10
78 
79 /* special els lsrjt event */
80 struct lpfc_lsrjt_event {
81 	struct lpfc_els_event_header header;
82 	uint32_t command;
83 	uint32_t reason_code;
84 	uint32_t explanation;
85 };
86 
87 /* special els logo event */
88 struct lpfc_logo_event {
89 	struct lpfc_els_event_header header;
90 	uint8_t logo_wwpn[8];
91 };
92 
93 /* fabric event header */
94 struct lpfc_fabric_event_header {
95 	uint32_t event_type;
96 	uint32_t subcategory;
97 	uint8_t wwpn[8];
98 	uint8_t wwnn[8];
99 };
100 
101 /* subcategory codes for FC_REG_FABRIC_EVENT */
102 #define LPFC_EVENT_FABRIC_BUSY		0x01
103 #define LPFC_EVENT_PORT_BUSY		0x02
104 #define LPFC_EVENT_FCPRDCHKERR		0x04
105 
106 /* special case fabric fcprdchkerr event */
107 struct lpfc_fcprdchkerr_event {
108 	struct lpfc_fabric_event_header header;
109 	uint32_t lun;
110 	uint32_t opcode;
111 	uint32_t fcpiparam;
112 };
113 
114 
115 /* scsi event header */
116 struct lpfc_scsi_event_header {
117 	uint32_t event_type;
118 	uint32_t subcategory;
119 	uint32_t lun;
120 	uint8_t wwpn[8];
121 	uint8_t wwnn[8];
122 };
123 
124 /* subcategory codes for FC_REG_SCSI_EVENT */
125 #define LPFC_EVENT_QFULL	0x0001
126 #define LPFC_EVENT_DEVBSY	0x0002
127 #define LPFC_EVENT_CHECK_COND	0x0004
128 #define LPFC_EVENT_LUNRESET	0x0008
129 #define LPFC_EVENT_TGTRESET	0x0010
130 #define LPFC_EVENT_BUSRESET	0x0020
131 #define LPFC_EVENT_VARQUEDEPTH	0x0040
132 
133 /* special case scsi varqueuedepth event */
134 struct lpfc_scsi_varqueuedepth_event {
135 	struct lpfc_scsi_event_header scsi_event;
136 	uint32_t oldval;
137 	uint32_t newval;
138 };
139 
140 /* special case scsi check condition event */
141 struct lpfc_scsi_check_condition_event {
142 	struct lpfc_scsi_event_header scsi_event;
143 	uint8_t opcode;
144 	uint8_t sense_key;
145 	uint8_t asc;
146 	uint8_t ascq;
147 };
148 
149 /* event codes for FC_REG_BOARD_EVENT */
150 #define LPFC_EVENT_PORTINTERR		0x01
151 
152 /* board event header */
153 struct lpfc_board_event_header {
154 	uint32_t event_type;
155 	uint32_t subcategory;
156 };
157 
158 
159 /* event codes for FC_REG_ADAPTER_EVENT */
160 #define LPFC_EVENT_ARRIVAL	0x01
161 
162 /* adapter event header */
163 struct lpfc_adapter_event_header {
164 	uint32_t event_type;
165 	uint32_t subcategory;
166 };
167 
168 
169 /* event codes for temp_event */
170 #define LPFC_CRIT_TEMP		0x1
171 #define LPFC_THRESHOLD_TEMP	0x2
172 #define LPFC_NORMAL_TEMP	0x3
173 
174 struct temp_event {
175 	uint32_t event_type;
176 	uint32_t event_code;
177 	uint32_t data;
178 };
179 
180