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