cxgb4: update dump collection logic to use compression
[linux/fpc-iii.git] / drivers / net / ethernet / chelsio / cxgb4 / cudbg_lib_common.h
blob2e1c8e87c9bdc4f6a0803f9578ec07db48ce88c6
1 /*
2 * Copyright (C) 2017 Chelsio Communications. All rights reserved.
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
13 * The full GNU General Public License is included in this distribution in
14 * the file called "COPYING".
18 #ifndef __CUDBG_LIB_COMMON_H__
19 #define __CUDBG_LIB_COMMON_H__
21 #define CUDBG_SIGNATURE 67856866 /* CUDB in ascii */
23 enum cudbg_dump_type {
24 CUDBG_DUMP_TYPE_MINI = 1,
27 enum cudbg_compression_type {
28 CUDBG_COMPRESSION_NONE = 1,
31 struct cudbg_hdr {
32 u32 signature;
33 u32 hdr_len;
34 u16 major_ver;
35 u16 minor_ver;
36 u32 data_len;
37 u32 hdr_flags;
38 u16 max_entities;
39 u8 chip_ver;
40 u8 dump_type:3;
41 u8 reserved1:1;
42 u8 compress_type:4;
43 u32 reserved[8];
46 struct cudbg_entity_hdr {
47 u32 entity_type;
48 u32 start_offset;
49 u32 size;
50 int hdr_flags;
51 u32 sys_warn;
52 u32 sys_err;
53 u8 num_pad;
54 u8 flag; /* bit 0 is used to indicate ext data */
55 u8 reserved1[2];
56 u32 next_ext_offset; /* pointer to next extended entity meta data */
57 u32 reserved[5];
60 struct cudbg_ver_hdr {
61 u32 signature;
62 u16 revision;
63 u16 size;
66 struct cudbg_buffer {
67 u32 size;
68 u32 offset;
69 char *data;
72 struct cudbg_error {
73 int sys_err;
74 int sys_warn;
75 int app_err;
78 #define CDUMP_MAX_COMP_BUF_SIZE ((64 * 1024) - 1)
79 #define CUDBG_CHUNK_SIZE ((CDUMP_MAX_COMP_BUF_SIZE / 1024) * 1024)
81 int cudbg_get_buff(struct cudbg_init *pdbg_init,
82 struct cudbg_buffer *pdbg_buff, u32 size,
83 struct cudbg_buffer *pin_buff);
84 void cudbg_put_buff(struct cudbg_init *pdbg_init,
85 struct cudbg_buffer *pin_buff);
86 void cudbg_update_buff(struct cudbg_buffer *pin_buff,
87 struct cudbg_buffer *pout_buff);
88 #endif /* __CUDBG_LIB_COMMON_H__ */