xref: /titanic_41/usr/src/uts/common/sys/fibre-channel/fca/emlxs/emlxs_dump.h (revision d478d0a82b5f273f7eac89c8df47960d9d22820b)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at
9  * http://www.opensource.org/licenses/cddl1.txt.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 
22 /*
23  * Copyright (c) 2004-2011 Emulex. All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _EMLXS_DUMP_H
28 #define	_EMLXS_DUMP_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 typedef struct emlxs_file
35 {
36 	uint8_t *buffer;
37 	uint8_t *ptr;
38 	uint32_t size;
39 
40 } emlxs_file_t;
41 
42 typedef struct dump_temp_event
43 {
44 	struct emlxs_hba *hba;
45 	uint32_t type;
46 	uint32_t temp;
47 
48 } dump_temp_event_t;
49 
50 #define	EMLXS_TXT_FILE_SIZE	(1024*1024)
51 #define	EMLXS_DMP_FILE_SIZE	((8*1024*1024)+0x100)
52 /* #define	EMLXS_DMP_FILE_SIZE	(4*1024*1024) */
53 #define	EMLXS_CEE_FILE_SIZE	(1024*1024)
54 
55 /* Maximum BC for DUMP w/o MBX Extension */
56 #define	DUMP_BC_MAX		(0x18 * 4)
57 
58 /* Conditional Compile Symbols */
59 
60 #define	CC_DUMP_FW_BUG_1	1	/* 1 = workaround for FW Bug */
61 #define	CC_DUMP_ENABLE_PAD	1	/* 1 = enable DMP File Padding */
62 
63 /* The following define controls whether the Dump Routines, */
64 /* in the Port Memory Dump, */
65 /* use all (potentially up to 3) Dump Tables, or only Dump Table #1. */
66 /* This is a diagnostic feature only, and is not compiled in releases. */
67 /* If enabled, this feature provides a way to test all the FW Dump Tables, */
68 /* a debugging courtesy to the FW group. */
69 
70 /* 1 = all Dump Tables; 0 = Table 1 Only */
71 #define	CC_DUMP_USE_ALL_TABLES	1
72 
73 /* Dump Type: loaded into gDumpType; controls */
74 /* operation of many dump functions */
75 #define	DUMP_TYPE_USER		0	/* User-Initiated Dump */
76 #define	DUMP_TYPE_DRIVER	1	/* Normal Driver-Initiated Dump */
77 #define	DUMP_TYPE_TEMP		2	/* Driver-Initiated Temp Event Dump */
78 
79 /* Dump Temperature  tempType Event codes (from DFC) */
80 #define	TEMP_TYPE_CRITICAL	1
81 #define	TEMP_TYPE_THRESHOLD	2
82 #define	TEMP_TYPE_NORMAL	3
83 
84 /* Misc Defines */
85 
86 #define	DUMP_SEMAPHORE_RETRY	200	/* times to retry acquiring sema */
87 
88 #define	DUMP_RETENTION_CNT_DEF	10	/* files to retain before purging */
89 #define	DUMP_RETENTION_CNT_MAX	500	/* (Linux KW ID 122) */
90 
91 #define	DUMP_TXT_FILE		0
92 #define	DUMP_DMP_FILE		1
93 #define	DUMP_CEE_FILE		2
94 
95 /* Driver Name Strings */
96 #define	DUMP_DRV_UNK		"Unknown"
97 #define	DUMP_DRV_LEADVILLE	"Solaris " DRIVER_NAME
98 
99 /* SIDs (Dump File Segment Identifiers) */
100 
101 /* SID Control Bits */
102 #define	SID_MULT_ELEM		0x20	/* indicates structures, not bytes */
103 
104 /* This set of SIDs is defined in "LightPulse Dump Facility Design Guide" */
105 #define	SID_NULL		0x00	/* Null SID */
106 #define	SID_ID01		0x01	/* Dump Table Identification */
107 #define	SID_ID02		0x02	/* Dump Table Identification */
108 #define	SID_ID03		0x03	/* Dump Table Identification */
109 #define	SID_TERM		0x04	/* Dump Table Termination */
110 #define	SID_SLIM		0x05	/* SLIM */
111 #define	SID_05			0x06	/* reserved */
112 #define	SID_PCI_CONFIG		0x07	/* PCI Cfg Registers (Direct) */
113 #define	SID_SLI_REGS		0x08	/* SLI Registers (Direct) */
114 #define	SID_29			0x29	/* reserved */
115 #define	SID_PCI_CONFIG_I	0x47	/* PCI Cfg Registers (Indirect) */
116 #define	SID_SLI_I		0x48	/* SLI Registers (Indirect) */
117 #define	SID_DUMP_ID_LE		0x80	/* Dump Id, Little-endian system. */
118 #define	SID_DUMP_ID_BE		0x81	/* Dump Id, Big-endian system. */
119 #define	SID_DUMP_TERM		0x82	/* Dump Termination. Last byte */
120 #define	SID_LEGEND		0x83	/* Legend */
121 #define	SID_PCB			0x84	/* PCB */
122 #define	SID_MBX			0x86	/* Mailbox */
123 #define	SID_HOST_PTRS		0x87	/* Host Put/Get Pointer Array */
124 #define	SID_PORT_PTRS		0x88	/* Port Get/Put Pointer Array */
125 #define	SID_RINGS		0xA9	/* Command/Response Rings */
126 #define	SID_PCB_A		0xC4	/* PCB */
127 #define	SID_MBX_A		0xC6	/* Mailbox */
128 #define	SID_HOST_PTRS_A		0xC7	/* Host Put/Get Pointer Array */
129 #define	SID_PORT_PTRS_A		0xC8	/* Port Get/Put Pointer Array */
130 #define	SID_BUFFER_LISTS	0xCA	/* Buffer Lists */
131 #define	SID_RINGS_A		0xE9	/* Command/Response Rings */
132 #define	SID_BUFFER_LISTS_A	0xEA	/* Buffer Lists */
133 
134 /* This set of SIDs is defined in "HBAnyware v2.3 */
135 /* Dump Feature Design Specification" */
136 
137 #define	SID_HBA_MEM_DUMP	0x11	/* HBA Memory Dump */
138 #define	SID_REV_INFO		0x90	/* Revision Information */
139 #define	SID_HBA_INFO		0x91	/* HBA Information */
140 #define	SID_DP_TABLE		0x92	/* Driver Parm Table */
141 #define	SID_DP_UNIX		0x93	/* Driver Parm, config (Unix) */
142 #define	SID_DP_WINDOWS		0x94	/* Driver Parm, Reg Entries (Win) */
143 #define	SID_INTERNAL_MP		0x95	/* Driver-specific Intrnl, Miniport */
144 #define	SID_INTERNAL_SP		0x96	/* Driver-specific Intrnl, Storport */
145 #define	SID_INTERNAL_SOL	0x97	/* Driver-specific Intrnl, Solaris */
146 #define	SID_INTERNAL_L7X	0x98	/* Driver-specific Intrnl, Lnx 7x */
147 #define	SID_INTERNAL_L8X	0x99	/* Driver-specific Intrnl, Lnx 8x */
148 #define	SID_CONFIG_REGION	0x9A	/* Config Region Data */
149 #define	SID_NON_VOLATILE_LOG	0x9B	/* NV Log (Enterprise only) */
150 
151 /* Legend Strings */
152 
153 #define	LEGEND_CONFIG_REGION		"Config Region Data"
154 #define	LEGEND_HBA_MEM_DUMP		"HBA Memory Dump"
155 #define	LEGEND_REV_INFO			"Revision Information"
156 #define	LEGEND_HBA_INFO			"HBA Information"
157 #define	LEGEND_DP_TABLE			"Driver Parameters: Table"
158 #define	LEGEND_DP_UNIX		"Driver Parameters: Config File Entries"
159 #define	LEGEND_DP_WINDOWS	"Driver Parameters: Registry Entries"
160 #define	LEGEND_INTERNAL_MP	"Driver-specific Internal Structures, Miniport"
161 #define	LEGEND_INTERNAL_SP	"Driver-specific Internal Structures, Storport"
162 #define	LEGEND_INTERNAL_SOL	"Driver-specific Internal Structures, Solaris"
163 #define	LEGEND_INTERNAL_L7X	"Driver-specific Internal Structures, Linux 7x"
164 #define	LEGEND_INTERNAL_L8X	"Driver-specific Internal Structures, Linux 8x"
165 #define	LEGEND_SLI_STRUCTURES		"SLI Interface Structures"
166 #define	LEGEND_MENLO_LOG_CONFIG		"Converged Enhanced Ethernet (CEE) Log"
167 #define	LEGEND_MENLO_LOG_PANIC_REGS	"\n\nPanic Log Registers\n"
168 #define	LEGEND_MENLO_LOG_PANIC_LOGS	"\n\nPanic Log Entries\n"
169 #define	LEGEND_NON_VOLATILE_LOG		"Non-Volatile Log Data"
170 
171 /* Sub-Legends associated with SID_HBA_MEM_DUMP // HBA Memory Dump */
172 #define	LEGEND_HBA_MEM_DUMP_TABLE	"Dump Table"
173 #define	LEGEND_HBA_MEM_DUMP_REGION	"Dump Region"
174 
175 /* Sub-Legends associated with SID_REV_INFO // Revision Information */
176 #define	LEGEND_REV_OS_VERSION		"OS Version"
177 #define	LEGEND_REV_DRV_VERSION		"Driver Version"
178 #define	LEGEND_REV_UTIL_VERSION		"HBAnyware Version"
179 #define	LEGEND_REV_DFCLIB_VERSION	"DFC Lib Version"
180 
181 /* Sub-Legends associated with SID_HBA_INFO // Adapter Information */
182 #define	LEGEND_HBA_MODEL		"Adapter Model"
183 #define	LEGEND_HBA_WWN			"Adapter WWN"
184 #define	LEGEND_HBA_SN			"Adapter Serial Number"
185 #define	LEGEND_HBA_FW_VERSION		"Firmware Version"
186 #define	LEGEND_HBA_FW_OPVERSION		"Operational FW Version"
187 #define	LEGEND_HBA_FW_SLI1VERSION	"SLI-1 FW Version"
188 #define	LEGEND_HBA_FW_SLI2VERSION	"SLI-2 FW Version"
189 #define	LEGEND_HBA_FW_SLI3VERSION	"SLI-3 FW Version"
190 #define	LEGEND_HBA_FW_KERNELVERSION	"Kernel FW Version"
191 #define	LEGEND_HBA_BB_STATE		"Boot Bios State"
192 #define	LEGEND_HBA_BB_VERSION		"Boot Bios Version"
193 #define	LEGEND_HBA_LMSD_A0		"Link Module Serial Data: Page A0"
194 #define	LEGEND_HBA_LMSD_A2		"Link Module Serial Data: Page A2"
195 
196 /* Sub-Legends associated with SID_CONFIG_REGION // Configuration Region */
197 #define	LEGEND_CONFIG_REGION_0	"Config Region 0: Non-volatile Params"
198 #define	LEGEND_CONFIG_REGION_1	"Config Region 1: reserved"
199 #define	LEGEND_CONFIG_REGION_2	"Config Region 2: reserved"
200 #define	LEGEND_CONFIG_REGION_3	"Config Region 3: reserved"
201 #define	LEGEND_CONFIG_REGION_4	"Config Region 4: Wake-up Params"
202 #define	LEGEND_CONFIG_REGION_5	"Config Region 5: PCI Config, Default"
203 #define	LEGEND_CONFIG_REGION_6	"Config Region 6: PCI Config, Alternate 1"
204 #define	LEGEND_CONFIG_REGION_7	"Config Region 7: PCI Config, Alternate 2"
205 #define	LEGEND_CONFIG_REGION_8	"Config Region 8: Boot Params, x86, Basic"
206 #define	LEGEND_CONFIG_REGION_9	"Config Region 9: Boot Params, x86, Extended"
207 #define	LEGEND_CONFIG_REGION_10	"Config Region 10: Boot Params, EFI"
208 #define	LEGEND_CONFIG_REGION_11	"Config Region 11: reserved"
209 #define	LEGEND_CONFIG_REGION_12	"Config Region 12: reserved"
210 #define	LEGEND_CONFIG_REGION_13	"Config Region 13: reserved"
211 #define	LEGEND_CONFIG_REGION_14	"Config Region 14: VPD"
212 #define	LEGEND_CONFIG_REGION_15	"Config Region 15: Diagnostic Trace"
213 #define	LEGEND_CONFIG_REGION_16	"Config Region 16: reserved"
214 #define	LEGEND_CONFIG_REGION_17	\
215 	"Config Region 17: Physical Environment NV Params"
216 #define	LEGEND_CONFIG_REGION_18	"Config Region 18: reserved"
217 #define	LEGEND_CONFIG_REGION_19	"Config Region 19: reserved"
218 #define	LEGEND_CONFIG_REGION_20	"Config Region 20: reserved"
219 #define	LEGEND_CONFIG_REGION_21	"Config Region 21: Saved Wakeup Params"
220 #define	LEGEND_CONFIG_REGION_22	"Config Region 22: reserved"
221 #define	LEGEND_CONFIG_REGION_23	"Config Region 23: reserved"
222 #define	LEGEND_CONFIG_REGION_24	"Config Region 24: reserved"
223 #define	LEGEND_CONFIG_REGION_25	"Config Region 25: reserved"
224 #define	LEGEND_CONFIG_REGION_26	"Config Region 26: reserved"
225 #define	LEGEND_CONFIG_REGION_27	"Config Region 27: reserved"
226 #define	LEGEND_CONFIG_REGION_28	"Config Region 28: reserved"
227 #define	LEGEND_CONFIG_REGION_29	"Config Region 29: reserved"
228 #define	LEGEND_CONFIG_REGION_30	"Config Region 30: reserved"
229 #define	LEGEND_CONFIG_REGION_31	"Config Region 31: reserved"
230 #define	LEGEND_CONFIG_REGION_32	"Config Region 32: IEEE Address"
231 
232 /* Additional Sub-Legends for Region 4 */
233 #define	LEGEND_CR4_INITIAL_LOAD		"Initial Load"
234 #define	LEGEND_CR4_FLAGS		"Flags       "
235 #define	LEGEND_CR4_BOOT_BIOS_ID		"Boot Bios ID"
236 #define	LEGEND_CR4_SLI1_ID		"SLI-1 ID    "
237 #define	LEGEND_CR4_SLI2_ID		"SLI-2 ID    "
238 #define	LEGEND_CR4_SLI3_ID		"SLI-3 ID    "
239 #define	LEGEND_CR4_SLI4_ID		"SLI-4 ID    "
240 #define	LEGEND_CR4_EROM_ID		"E-Rom ID    "
241 
242 /* Sub-Legends associated with SLI Interface Structures */
243 #define	LEGEND_SLI_REGS		"SLI Registers"
244 #define	LEGEND_SLIM		"SLIM"
245 #define	LEGEND_PCB		"PCB"
246 #define	LEGEND_MBX		"Mailbox"
247 #define	LEGEND_HOST_PTRS	"Host Pointers"
248 #define	LEGEND_PORT_PTRS	"Port Pointers"
249 #define	LEGEND_RINGS		"Cmd/Rsp Rings"
250 #define	LEGEND_DRIVER_SPEC	"Driver-Specific Internal Structures"
251 
252 /* Misc Legend Data */
253 #define	LEGEND_NULL	""
254 #define	LEGEND_NV_LOG_DRIVER_NOT_SUPPORTED \
255 	"NV Log not supported by the driver"
256 #define	LEGEND_NV_LOG_STATUS_ERROR \
257 	"Error in getting NV Log status"
258 #define	LEGEND_NV_LOG_ERROR \
259 	"Error in getting NV Log"
260 
261 #define	NV_LOG_NOT_INCLUDED_IN_DMP \
262 	"Non-Volatile Log Dump is not included in the DMP file"
263 #define	NV_LOG_INCLUDED_IN_DMP \
264 	"Non-Volatile Log Dump is included in the DMP file"
265 
266 #define	NV_LOG_NOT_INCLUDED_IN_FAT \
267 	"Non-Volatile Log Dump is not included in the FAT file"
268 #define	NV_LOG_INCLUDED_IN_FAT \
269 	"Non-Volatile Log Dump is included in the FAT file"
270 
271 /* Dump Regions Definitions */
272 #define	DR_SLI_REGS	0x0000
273 #define	DR_SLIM		0x0001
274 #define	DR_PCB		0x0002
275 #define	DR_MBX		0x0003
276 #define	DR_HOST_PTRS	0x0004
277 #define	DR_PORT_PTRS	0x0005
278 #define	DR_RINGS	0x0006
279 #define	DR_INTERNAL	0x0007
280 
281 /* DFC_GetDriverDumpRegions Status */
282 #define	GDDR_ST_SUCCESS		0
283 #define	GDDR_ST_ERROR		1	/* General Error */
284 #define	GDDR_ST_BAD_ID		2	/* Bad Region Identifier */
285 #define	GDDR_ST_BUF_OVERFLOW	3	/* Buffer Overflow */
286 #define	GDDR_ST_ID_NA		4	/* Region Identifier Not Applicable */
287 
288 /* Max size supported by dump Config Region routines */
289 #define	DUMP_MAX_CONFIG_REGION_LENGTH   1000
290 
291 
292 /* This is a simplified form of the wakeup params structure, */
293 /* w/o all the bit fields, */
294 /* for ease of displaying in the Dump File. */
295 typedef struct _DUMP_WAKE_UP_PARAMS
296 {
297 	uint32_t InitialId[2];
298 	uint32_t Flags;
299 	uint32_t BootBiosId[2];
300 	uint32_t Sli1Id[2];
301 	uint32_t Sli2Id[2];
302 	uint32_t Sli3Id[2];
303 	uint32_t Sli4Id[2];
304 	uint32_t EromId[2];
305 } DUMP_WAKE_UP_PARAMS;
306 
307 
308 typedef struct _DUMP_TABLE_ENTRY_PORT_STRUCT
309 {
310 	union
311 	{
312 		uint32_t w[2];
313 		struct
314 		{
315 #ifdef EMLXS_LITTLE_ENDIAN
316 			uint32_t count:16;	/* structure repeat count */
317 			uint32_t length:8;	/* structure length */
318 			uint32_t sid:8;	/* SID */
319 #else
320 			uint32_t sid:8;	/* SID */
321 			uint32_t length:8;	/* structure length */
322 			uint32_t count:16;	/* structure repeat count */
323 #endif
324 			uint32_t addr;	/* address */
325 		} s;
326 
327 	} un;
328 
329 } DUMP_TABLE_ENTRY_PORT_STRUCT;
330 
331 
332 /* This is a simplified form of the Dump Table Entry structures. */
333 typedef struct _DUMP_TABLE_ENTRY_PORT_BLK
334 {
335 	union
336 	{
337 		uint32_t w[2];
338 		struct
339 		{
340 
341 #ifdef EMLXS_LITTLE_ENDIAN
342 			uint32_t bc:24;	/* byte count */
343 			uint32_t sid:8;	/* SID */
344 #else
345 			uint32_t sid:8;	/* SID */
346 			uint32_t bc:24;	/* byte count */
347 #endif
348 			uint32_t addr;	/* address */
349 		} s;
350 
351 	} un;
352 
353 } DUMP_TABLE_ENTRY_PORT_BLK;
354 
355 
356 typedef struct _DUMP_TABLE_ENTRY
357 {
358 	union
359 	{
360 		DUMP_TABLE_ENTRY_PORT_BLK PortBlock;
361 		DUMP_TABLE_ENTRY_PORT_STRUCT PortStruct;
362 
363 	} un;
364 
365 } DUMP_TABLE_ENTRY;
366 
367 /* VPD Data Defines */
368 
369 #define	VPD_TAG_82  0x82	/* start of VPD Data: Device Name */
370 #define	VPD_TAG_90  0x90	/* start of Read-Only Area */
371 #define	VPD_TAG_FF  0x0F	/* end tag */
372 
373 #ifdef	__cplusplus
374 }
375 #endif
376 
377 #endif	/* _EMLXS_DUMP_H */
378