aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/qlxgbe/ql_minidump.h
blob: 3c77f1a3b678d25a8de3f704e30d0abe1390c500 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
/*
 * Copyright (c) 2013-2016 Qlogic Corporation
 * All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions
 *  are met:
 *
 *  1. Redistributions of source code must retain the above copyright
 *     notice, this list of conditions and the following disclaimer.
 *  2. Redistributions in binary form must reproduce the above copyright
 *     notice, this list of conditions and the following disclaimer in the
 *     documentation and/or other materials provided with the distribution.
 *
 *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 *  POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * File: ql_minidump.h
 *
 * $FreeBSD$
 */
#ifndef _QL_MINIDUMP_H_
#define _QL_MINIDUMP_H_

#define QL_DBG_STATE_ARRAY_LEN          16
#define QL_DBG_CAP_SIZE_ARRAY_LEN       8
#define QL_NO_OF_OCM_WINDOWS            16


typedef struct ql_mdump_tmplt_hdr {
        uint32_t  entry_type ;
        uint32_t  first_entry_offset ;
        uint32_t  size_of_template ;
        uint32_t  recommended_capture_mask;

        uint32_t  num_of_entries ;
        uint32_t  version ;
        uint32_t  driver_timestamp ;
        uint32_t  checksum ;

        uint32_t  driver_capture_mask ;
        uint32_t  driver_info_word2 ;
        uint32_t  driver_info_word3 ;
        uint32_t  driver_info_word4 ;

        uint32_t  saved_state_array[QL_DBG_STATE_ARRAY_LEN] ;
        uint32_t  capture_size_array[QL_DBG_CAP_SIZE_ARRAY_LEN] ;

        uint32_t ocm_window_array[QL_NO_OF_OCM_WINDOWS] ;
} ql_minidump_template_hdr_t ;

/*
 * MIU AGENT ADDRESSES.
 */

#define MD_TA_CTL_ENABLE                0x2
#define MD_TA_CTL_START                 0x1
#define MD_TA_CTL_BUSY                  0x8
#define MD_TA_CTL_CHECK                 1000

#define MD_MIU_TEST_AGT_CTRL            0x41000090
#define MD_MIU_TEST_AGT_ADDR_LO         0x41000094
#define MD_MIU_TEST_AGT_ADDR_HI         0x41000098

#define MD_MIU_TEST_AGT_RDDATA_0_31     0x410000A8
#define MD_MIU_TEST_AGT_RDDATA_32_63    0x410000AC
#define MD_MIU_TEST_AGT_RDDATA_64_95    0x410000B8
#define MD_MIU_TEST_AGT_RDDATA_96_127   0x410000BC

#define MD_MIU_TEST_AGT_WRDATA_0_31     0x410000A0
#define MD_MIU_TEST_AGT_WRDATA_32_63    0x410000A4
#define MD_MIU_TEST_AGT_WRDATA_64_95    0x410000B0
#define MD_MIU_TEST_AGT_WRDATA_96_127   0x410000B4

/*
 * ROM Read Address
 */

#define MD_DIRECT_ROM_WINDOW            0x42110030
#define MD_DIRECT_ROM_READ_BASE         0x42150000

/*
 * Entry Type Defines
 */

#define RDNOP			0
#define RDCRB			1
#define	RDMUX			2
#define QUEUE			3
#define BOARD			4
#define RDOCM			6
#define L1DAT			11
#define L1INS			12
#define L2DTG                  	21
#define L2ITG                  	22
#define L2DAT                  	23
#define L2INS                  	24
#define POLLRD                  35
#define RDMUX2                  36
#define POLLRDMWR               37
#define RDROM                  	71
#define RDMEM                  	72
#define CNTRL                  	98
#define TLHDR                  	99
#define RDEND			255

/*
 * Index of State Table.  The Template header maintains
 * an array of 8 (0..7) words that is used to store some
 * "State Information" from the board.
 */

#define QL_PCIE_FUNC_INDX       0
#define QL_CLK_STATE_INDX       1
#define QL_SRE_STATE_INDX       2
#define QL_OCM0_ADDR_INDX       3

#define QL_REVID_STATE_INDX     4
#define QL_MAJVER_STATE_INDX    5
#define QL_MINVER_STATE_INDX    6
#define QL_SUBVER_STATE_INDX    7

/*
 * Opcodes for Control Entries.
 * These Flags are bit fields.
 */

#define QL_DBG_OPCODE_WR        0x01
#define QL_DBG_OPCODE_RW        0x02
#define QL_DBG_OPCODE_AND       0x04
#define QL_DBG_OPCODE_OR        0x08
#define QL_DBG_OPCODE_POLL      0x10
#define QL_DBG_OPCODE_RDSTATE   0x20
#define QL_DBG_OPCODE_WRSTATE   0x40
#define QL_DBG_OPCODE_MDSTATE   0x80

typedef struct ql_minidump_entry_hdr_s {
        uint32_t      entry_type ;
        uint32_t      entry_size ;
        uint32_t      entry_capture_size ;
    	union {
        	struct {
            		uint8_t   entry_capture_mask ;
            		uint8_t   entry_code ;
            		uint8_t   driver_code ;
            		uint8_t   driver_flags ;
        	};
        	uint32_t entry_ctrl_word ;
    	};
} ql_minidump_entry_hdr_t ;

/*
 * Driver Flags
 */
#define QL_DBG_SKIPPED_FLAG	0x80 /*  driver skipped this entry  */
#define QL_DBG_SIZE_ERR_FLAG    0x40 /*  entry size vs capture size mismatch*/

/*
 * Generic Entry Including Header
 */

typedef struct ql_minidump_entry_s {
        ql_minidump_entry_hdr_t hdr ;

    uint32_t entry_data00 ;
    uint32_t entry_data01 ;
    uint32_t entry_data02 ;
    uint32_t entry_data03 ;

    uint32_t entry_data04 ;
    uint32_t entry_data05 ;
    uint32_t entry_data06 ;
    uint32_t entry_data07 ;
} ql_minidump_entry_t;

/*
 *  Read CRB Entry Header
 */

typedef struct ql_minidump_entry_rdcrb_s {
        ql_minidump_entry_hdr_t h;

        uint32_t addr ;
    union {
        struct {
            uint8_t  addr_stride ;
            uint8_t  rsvd_0;
            uint16_t rsvd_1 ;
        } ;
            uint32_t addr_cntrl  ;
    } ;

        uint32_t data_size ;
        uint32_t op_count;

    uint32_t    rsvd_2 ;
    uint32_t    rsvd_3 ;
    uint32_t    rsvd_4 ;
    uint32_t    rsvd_5 ;

} ql_minidump_entry_rdcrb_t ;

/*
 * Cache Entry Header
 */

typedef struct ql_minidump_entry_cache_s {
        ql_minidump_entry_hdr_t h;

        uint32_t tag_reg_addr ;
    	union {
        	struct {
            		uint16_t   tag_value_stride ;
            		uint16_t  init_tag_value ;
        	} ;
            	uint32_t select_addr_cntrl  ;
    	} ;

        uint32_t data_size ;
        uint32_t op_count;

    	uint32_t control_addr ;
    	union {
        	struct {
            		uint16_t  write_value ;
            		uint8_t   poll_mask ;
            		uint8_t   poll_wait ;
        	};
        	uint32_t control_value ;
    	} ;

    	uint32_t read_addr ;
    	union {
        	struct {
            		uint8_t   read_addr_stride ;
            		uint8_t   read_addr_cnt ;
            		uint16_t  rsvd_1 ;
        	} ;
            	uint32_t read_addr_cntrl  ;
    	} ;
} ql_minidump_entry_cache_t ;


/*
 * Read OCM Entry Header
 */

typedef struct ql_minidump_entry_rdocm_s {
        ql_minidump_entry_hdr_t h;

        uint32_t rsvd_0 ;
        uint32_t rsvd_1 ;

        uint32_t data_size ;
        uint32_t op_count;

    uint32_t rsvd_2 ;
    uint32_t rsvd_3 ;

    uint32_t read_addr ;
    uint32_t read_addr_stride ;

} ql_minidump_entry_rdocm_t ;

/*
 * Read MEM Entry Header
 */

typedef struct ql_minidump_entry_rdmem_s {
        ql_minidump_entry_hdr_t h;

    uint32_t rsvd_0[6] ;

    uint32_t read_addr ;
    uint32_t read_data_size ;

} ql_minidump_entry_rdmem_t ;

/*
 * Read ROM Entry Header
 */

typedef struct ql_minidump_entry_rdrom_s {
        ql_minidump_entry_hdr_t h;

    uint32_t rsvd_0[6] ;

    uint32_t read_addr ;
    uint32_t read_data_size ;

} ql_minidump_entry_rdrom_t ;

/*
 * Read MUX Entry Header
 */

typedef struct ql_minidump_entry_mux_s {
        ql_minidump_entry_hdr_t h;

        uint32_t select_addr ;
    union {
        struct {
            uint32_t rsvd_0 ;
        } ;
            uint32_t select_addr_cntrl  ;
    } ;

        uint32_t data_size ;
        uint32_t op_count;

    uint32_t select_value ;
    uint32_t select_value_stride ;

    uint32_t read_addr ;
    uint32_t rsvd_1 ;

} ql_minidump_entry_mux_t ;

/*
 * Read MUX2 Entry Header
 */

typedef struct ql_minidump_entry_mux2_s {
        ql_minidump_entry_hdr_t h;

        uint32_t select_addr_1;
        uint32_t select_addr_2;
        uint32_t select_value_1;
        uint32_t select_value_2;
        uint32_t select_value_count;
        uint32_t select_value_mask;
        uint32_t read_addr;
        union {
                struct {
                        uint8_t select_value_stride;
                        uint8_t data_size;
                        uint8_t reserved_0;
                        uint8_t reserved_1;
                };
                uint32_t select_addr_value_cntrl;
        };

} ql_minidump_entry_mux2_t;

/*
 * Read QUEUE Entry Header
 */

typedef struct ql_minidump_entry_queue_s {
        ql_minidump_entry_hdr_t h;

        uint32_t select_addr ;
    union {
        struct {
            uint16_t  queue_id_stride ;
            uint16_t  rsvd_0 ;
        } ;
            uint32_t select_addr_cntrl  ;
    } ;

        uint32_t data_size ;
        uint32_t op_count ;

    uint32_t rsvd_1 ;
    uint32_t rsvd_2 ;

    uint32_t read_addr ;
    union {
        struct {
            uint8_t   read_addr_stride ;
            uint8_t   read_addr_cnt ;
            uint16_t  rsvd_3 ;
        } ;
            uint32_t read_addr_cntrl  ;
    } ;

} ql_minidump_entry_queue_t ;

/*
 * Control Entry Header
 */

typedef struct ql_minidump_entry_cntrl_s {
        ql_minidump_entry_hdr_t h;

        uint32_t addr ;
    union {
        struct {
            uint8_t  addr_stride ;
            uint8_t  state_index_a ;
            uint16_t poll_timeout ;
        } ;
            uint32_t addr_cntrl  ;
    } ;

        uint32_t data_size ;
        uint32_t op_count;

    union {
        struct {
            uint8_t opcode ;
            uint8_t state_index_v ;
            uint8_t shl ;
            uint8_t shr ;
        } ;
        uint32_t control_value ;
    } ;

    uint32_t value_1 ;
    uint32_t value_2 ;
    uint32_t value_3 ;
} ql_minidump_entry_cntrl_t ;

/*
 * Read with poll.
 */

typedef struct ql_minidump_entry_rdcrb_with_poll_s {
        ql_minidump_entry_hdr_t h;

        uint32_t select_addr;
        uint32_t read_addr;
        uint32_t select_value;
        union {
                struct {
                        uint16_t select_value_stride;
                        uint16_t op_count;
                };
                uint32_t select_value_cntrl;
        };

        uint32_t poll;
        uint32_t mask;

        uint32_t data_size;
        uint32_t rsvd_0;

} ql_minidump_entry_pollrd_t;

/*
 * Read_Modify_Write with poll.
 */

typedef struct ql_minidump_entry_rd_modify_wr_with_poll_s {
        ql_minidump_entry_hdr_t h;

        uint32_t addr_1;
        uint32_t addr_2;
        uint32_t value_1;
        uint32_t value_2;
        uint32_t poll;
        uint32_t mask;
        uint32_t modify_mask;
        uint32_t data_size;

} ql_minidump_entry_rd_modify_wr_with_poll_t;

#endif /* #ifndef _QL_MINIDUMP_H_ */