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