422a5ceedd2e5c5441f54c8959d86634e3d6f5eb
[linux-2.6-microblaze.git] / drivers / net / ethernet / chelsio / cxgb4 / cudbg_lib_common.h
1 /*
2  *  Copyright (C) 2017 Chelsio Communications.  All rights reserved.
3  *
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.
7  *
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.
12  *
13  *  The full GNU General Public License is included in this distribution in
14  *  the file called "COPYING".
15  *
16  */
17
18 #ifndef __CUDBG_LIB_COMMON_H__
19 #define __CUDBG_LIB_COMMON_H__
20
21 #define CUDBG_SIGNATURE 67856866 /* CUDB in ascii */
22
23 enum cudbg_dump_type {
24         CUDBG_DUMP_TYPE_MINI = 1,
25 };
26
27 enum cudbg_compression_type {
28         CUDBG_COMPRESSION_NONE = 1,
29 };
30
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];
44 };
45
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];
58 };
59
60 struct cudbg_buffer {
61         u32 size;
62         u32 offset;
63         char *data;
64 };
65
66 struct cudbg_error {
67         int sys_err;
68         int sys_warn;
69         int app_err;
70 };
71
72 int cudbg_get_buff(struct cudbg_buffer *pdbg_buff, u32 size,
73                    struct cudbg_buffer *pin_buff);
74 void cudbg_put_buff(struct cudbg_buffer *pin_buff,
75                     struct cudbg_buffer *pdbg_buff);
76 void cudbg_update_buff(struct cudbg_buffer *pin_buff,
77                        struct cudbg_buffer *pout_buff);
78 #endif /* __CUDBG_LIB_COMMON_H__ */