linux/drivers/net/ethernet/chelsio/cxgb4/cudbg_lib_common.h
<<
>>
Prefs
   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
  23enum cudbg_dump_type {
  24        CUDBG_DUMP_TYPE_MINI = 1,
  25};
  26
  27enum cudbg_compression_type {
  28        CUDBG_COMPRESSION_NONE = 1,
  29        CUDBG_COMPRESSION_ZLIB,
  30};
  31
  32struct cudbg_hdr {
  33        u32 signature;
  34        u32 hdr_len;
  35        u16 major_ver;
  36        u16 minor_ver;
  37        u32 data_len;
  38        u32 hdr_flags;
  39        u16 max_entities;
  40        u8 chip_ver;
  41        u8 dump_type:3;
  42        u8 reserved1:1;
  43        u8 compress_type:4;
  44        u32 reserved[8];
  45};
  46
  47struct cudbg_entity_hdr {
  48        u32 entity_type;
  49        u32 start_offset;
  50        u32 size;
  51        int hdr_flags;
  52        u32 sys_warn;
  53        u32 sys_err;
  54        u8 num_pad;
  55        u8 flag;             /* bit 0 is used to indicate ext data */
  56        u8 reserved1[2];
  57        u32 next_ext_offset; /* pointer to next extended entity meta data */
  58        u32 reserved[5];
  59};
  60
  61struct cudbg_ver_hdr {
  62        u32 signature;
  63        u16 revision;
  64        u16 size;
  65};
  66
  67struct cudbg_buffer {
  68        u32 size;
  69        u32 offset;
  70        char *data;
  71};
  72
  73struct cudbg_error {
  74        int sys_err;
  75        int sys_warn;
  76        int app_err;
  77};
  78
  79#define CDUMP_MAX_COMP_BUF_SIZE ((64 * 1024) - 1)
  80#define CUDBG_CHUNK_SIZE ((CDUMP_MAX_COMP_BUF_SIZE / 1024) * 1024)
  81
  82int cudbg_get_buff(struct cudbg_init *pdbg_init,
  83                   struct cudbg_buffer *pdbg_buff, u32 size,
  84                   struct cudbg_buffer *pin_buff);
  85void cudbg_put_buff(struct cudbg_init *pdbg_init,
  86                    struct cudbg_buffer *pin_buff);
  87void cudbg_update_buff(struct cudbg_buffer *pin_buff,
  88                       struct cudbg_buffer *pout_buff);
  89#endif /* __CUDBG_LIB_COMMON_H__ */
  90