hnd_debug.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /*
  2. * HND Run Time Environment debug info area
  3. *
  4. * Portions of this code are copyright (c) 2020 Cypress Semiconductor Corporation
  5. *
  6. * Copyright (C) 1999-2020, Broadcom Corporation
  7. *
  8. * Unless you and Broadcom execute a separate written software license
  9. * agreement governing use of this software, this software is licensed to you
  10. * under the terms of the GNU General Public License version 2 (the "GPL"),
  11. * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  12. * following added to such license:
  13. *
  14. * As a special exception, the copyright holders of this software give you
  15. * permission to link this software with independent modules, and to copy and
  16. * distribute the resulting executable under terms of your choice, provided that
  17. * you also meet, for each linked independent module, the terms and conditions of
  18. * the license of that module. An independent module is a module which is not
  19. * derived from this software. The special exception does not apply to any
  20. * modifications of the software.
  21. *
  22. * Notwithstanding the above, under no circumstances may you combine this
  23. * software in any way with any other Broadcom software provided under a license
  24. * other than the GPL, without Broadcom's express prior written consent.
  25. *
  26. *
  27. * <<Broadcom-WL-IPTag/Open:>>
  28. *
  29. * $Id: hnd_debug.h 688714 2017-03-07 12:15:33Z $
  30. */
  31. #ifndef _HND_DEBUG_H
  32. #define _HND_DEBUG_H
  33. /* Magic number at a magic location to find HND_DEBUG pointers */
  34. #define HND_DEBUG_PTR_PTR_MAGIC 0x50504244 /* DBPP */
  35. /* Magic number at a magic location to find RAM size */
  36. #define HND_RAMSIZE_PTR_MAGIC 0x534d4152 /* RAMS */
  37. #ifndef _LANGUAGE_ASSEMBLY
  38. /* Includes only when building dongle code */
  39. /* We use explicit sizes here since this gets included from different
  40. * systems. The sizes must be the size of the creating system
  41. * (currently 32 bit ARM) since this is gleaned from dump.
  42. */
  43. #ifdef FWID
  44. extern uint32 gFWID;
  45. #endif // endif
  46. /* Define pointers for use on other systems */
  47. #define _HD_EVLOG_P uint32
  48. #define _HD_CONS_P uint32
  49. #define _HD_TRAP_P uint32
  50. /* This struct is placed at a well-defined location, and contains a pointer to hnd_debug. */
  51. typedef struct hnd_debug_ptr {
  52. uint32 magic;
  53. /* RAM address of 'hnd_debug'. For legacy versions of this struct, it is a 0-indexed
  54. * offset instead.
  55. */
  56. uint32 hnd_debug_addr;
  57. /* Base address of RAM. This field does not exist for legacy versions of this struct. */
  58. uint32 ram_base_addr;
  59. } hnd_debug_ptr_t;
  60. /* This struct is placed at a well-defined location. */
  61. typedef struct hnd_ramsize_ptr {
  62. uint32 magic; /* 'RAMS' */
  63. /* RAM size information. */
  64. uint32 ram_size;
  65. } hnd_ramsize_ptr_t;
  66. #define HND_DEBUG_EPIVERS_MAX_STR_LEN 32
  67. #define HND_DEBUG_BUILD_SIGNATURE_FWID_LEN 17
  68. #define HND_DEBUG_BUILD_SIGNATURE_VER_LEN 22
  69. typedef struct hnd_debug {
  70. uint32 magic;
  71. #define HND_DEBUG_MAGIC 0x47424544 /* 'DEBG' */
  72. uint32 version; /* Debug struct version */
  73. #define HND_DEBUG_VERSION 1
  74. uint32 fwid; /* 4 bytes of fw info */
  75. char epivers[HND_DEBUG_EPIVERS_MAX_STR_LEN];
  76. _HD_TRAP_P trap_ptr; /* trap_t data struct */
  77. _HD_CONS_P console; /* Console */
  78. uint32 ram_base;
  79. uint32 ram_size;
  80. uint32 rom_base;
  81. uint32 rom_size;
  82. _HD_EVLOG_P event_log_top;
  83. /* To populated fields below,
  84. * INCLUDE_BUILD_SIGNATURE_IN_SOCRAM needs to be enabled
  85. */
  86. char fwid_signature[HND_DEBUG_BUILD_SIGNATURE_FWID_LEN]; /* fwid=<FWID> */
  87. char ver_signature[HND_DEBUG_BUILD_SIGNATURE_VER_LEN]; /* ver=abc.abc.abc.abc */
  88. } hnd_debug_t;
  89. /*
  90. * timeval_t and prstatus_t are copies of the Linux structures.
  91. * Included here because we need the definitions for the target processor
  92. * (32 bits) and not the definition on the host this is running on
  93. * (which could be 64 bits).
  94. */
  95. typedef struct { /* Time value with microsecond resolution */
  96. uint32 tv_sec; /* Seconds */
  97. uint32 tv_usec; /* Microseconds */
  98. } timeval_t;
  99. /* Linux/ARM 32 prstatus for notes section */
  100. typedef struct prstatus {
  101. int32 si_signo; /* Signal number */
  102. int32 si_code; /* Extra code */
  103. int32 si_errno; /* Errno */
  104. uint16 pr_cursig; /* Current signal. */
  105. uint16 unused;
  106. uint32 pr_sigpend; /* Set of pending signals. */
  107. uint32 pr_sighold; /* Set of held signals. */
  108. uint32 pr_pid;
  109. uint32 pr_ppid;
  110. uint32 pr_pgrp;
  111. uint32 pr_sid;
  112. timeval_t pr_utime; /* User time. */
  113. timeval_t pr_stime; /* System time. */
  114. timeval_t pr_cutime; /* Cumulative user time. */
  115. timeval_t pr_cstime; /* Cumulative system time. */
  116. uint32 uregs[18];
  117. int32 pr_fpvalid; /* True if math copro being used. */
  118. } prstatus_t;
  119. /* for mkcore and other utilities use */
  120. #define DUMP_INFO_PTR_PTR_0 0x74
  121. #define DUMP_INFO_PTR_PTR_1 0x78
  122. #define DUMP_INFO_PTR_PTR_2 0xf0
  123. #define DUMP_INFO_PTR_PTR_3 0xf8
  124. #define DUMP_INFO_PTR_PTR_4 0x874
  125. #define DUMP_INFO_PTR_PTR_5 0x878
  126. #define DUMP_INFO_PTR_PTR_END 0xffffffff
  127. #define DUMP_INFO_PTR_PTR_LIST DUMP_INFO_PTR_PTR_0, \
  128. DUMP_INFO_PTR_PTR_1, \
  129. DUMP_INFO_PTR_PTR_2, \
  130. DUMP_INFO_PTR_PTR_3, \
  131. DUMP_INFO_PTR_PTR_4, \
  132. DUMP_INFO_PTR_PTR_5, \
  133. DUMP_INFO_PTR_PTR_END
  134. /* for DHD driver to get dongle ram size info. */
  135. #define RAMSIZE_PTR_PTR_0 0x6c
  136. #define RAMSIZE_PTR_PTR_END 0xffffffff
  137. #define RAMSIZE_PTR_PTR_LIST RAMSIZE_PTR_PTR_0, \
  138. RAMSIZE_PTR_PTR_END
  139. #endif /* !LANGUAGE_ASSEMBLY */
  140. #endif /* _HND_DEBUG_H */