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