1 /*
2  * HND Run Time Environment debug info area
3  *
4  * Copyright (C) 1999-2013, Broadcom Corporation
5  *
6  * Permission to use, copy, modify, and/or distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
13  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
15  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  *
18  * $Id: hndrte_debug.h 342211 2012-07-02 02:23:04Z $
19  */
20 
21 #ifndef	_HNDRTE_DEBUG_H
22 #define	_HNDRTE_DEBUG_H
23 
24 /* Magic number at a magic location to find HNDRTE_DEBUG pointers */
25 #define HNDRTE_DEBUG_PTR_PTR_ADDR 0xf8
26 #define HNDRTE_DEBUG_PTR_PTR_MAGIC 0x50504244  	/* DBPP */
27 
28 #ifndef _LANGUAGE_ASSEMBLY
29 
30 /* Includes only when building dongle code */
31 
32 
33 #define NUM_EVENT_LOG_SETS 4
34 
35 /* We use explicit sizes here since this gets included from different
36  * systems.  The sizes must be the size of the creating system
37  * (currently 32 bit ARM) since this is gleaned from  dump.
38  */
39 
40 /* Define pointers for use on other systems */
41 #define _HD_EVLOG_P	uint32
42 #define _HD_CONS_P	uint32
43 #define _HD_TRAP_P	uint32
44 
45 typedef struct hndrte_debug {
46 	uint32	magic;
47 #define HNDRTE_DEBUG_MAGIC 0x47424544	/* 'DEBG' */
48 
49 	uint32	version;		/* Debug struct version */
50 #define HNDRTE_DEBUG_VERSION 1
51 
52 	uint32	fwid;			/* 4 bytes of fw info */
53 	char	epivers[32];
54 
55 	_HD_TRAP_P trap_ptr;		/* trap_t data struct */
56 	_HD_CONS_P console;		/* Console  */
57 
58 	uint32	ram_base;
59 	uint32	ram_size;
60 
61 	uint32	rom_base;
62 	uint32	rom_size;
63 
64 	_HD_EVLOG_P event_log_top;
65 
66 } hndrte_debug_t;
67 
68 /*
69  * timeval_t and prstatus_t are copies of the Linux structures.
70  * Included here because we need the definitions for the target processor
71  * (32 bits) and not the definition on the host this is running on
72  * (which could be 64 bits).
73  */
74 
75 typedef struct             {    /* Time value with microsecond resolution    */
76 	uint32 tv_sec;	/* Seconds                                   */
77 	uint32 tv_usec;	/* Microseconds                              */
78 } timeval_t;
79 
80 
81 /* Linux/ARM 32 prstatus for notes section */
82 typedef struct prstatus {
83 	  int32 si_signo; 	/* Signal number */
84 	  int32 si_code; 	/* Extra code */
85 	  int32 si_errno; 	/* Errno */
86 	  uint16 pr_cursig; 	/* Current signal.  */
87 	  uint16 unused;
88 	  uint32 pr_sigpend;	/* Set of pending signals.  */
89 	  uint32 pr_sighold;	/* Set of held signals.  */
90 	  uint32 pr_pid;
91 	  uint32 pr_ppid;
92 	  uint32 pr_pgrp;
93 	  uint32 pr_sid;
94 	  timeval_t pr_utime;	/* User time.  */
95 	  timeval_t pr_stime;	/* System time.  */
96 	  timeval_t pr_cutime;	/* Cumulative user time.  */
97 	  timeval_t pr_cstime;	/* Cumulative system time.  */
98 	  uint32 uregs[18];
99 	  int32 pr_fpvalid;	/* True if math copro being used.  */
100 } prstatus_t;
101 
102 #ifdef DUMP_INFO
103 extern hndrte_debug_t hndrte_debug_info __attribute__ ((weak));
104 #endif
105 
106 #endif /* LANGUAGE_ASSEMBLY */
107 
108 #endif /* _HNDRTE_DEBUG_H */
109