cudbg_lib_common.h 2.1 KB

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