1/*
2 * HND Run Time Environment debug info area
3 *
4 * Copyright (C) 2015, Broadcom Corporation. All Rights Reserved.
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_MAGIC 0x50504244  	/* DBPP */
26
27#ifndef _LANGUAGE_ASSEMBLY
28
29/* Includes only when building dongle code */
30
31
32#define NUM_EVENT_LOG_SETS 4
33
34/* We use explicit sizes here since this gets included from different
35 * systems.  The sizes must be the size of the creating system
36 * (currently 32 bit ARM) since this is gleaned from  dump.
37 */
38
39/* Define pointers for use on other systems */
40#define _HD_EVLOG_P	uint32
41#define _HD_CONS_P	uint32
42#define _HD_TRAP_P	uint32
43
44typedef struct hndrte_debug {
45	uint32	magic;
46#define HNDRTE_DEBUG_MAGIC 0x47424544	/* 'DEBG' */
47
48	uint32	version;		/* Debug struct version */
49#define HNDRTE_DEBUG_VERSION 1
50
51	uint32	fwid;			/* 4 bytes of fw info */
52	char	epivers[32];
53
54	_HD_TRAP_P trap_ptr;		/* trap_t data struct */
55	_HD_CONS_P console;		/* Console  */
56
57	uint32	ram_base;
58	uint32	ram_size;
59
60	uint32	rom_base;
61	uint32	rom_size;
62
63	_HD_EVLOG_P event_log_top;
64
65} hndrte_debug_t;
66
67/*
68 * timeval_t and prstatus_t are copies of the Linux structures.
69 * Included here because we need the definitions for the target processor
70 * (32 bits) and not the definition on the host this is running on
71 * (which could be 64 bits).
72 */
73
74typedef struct             {    /* Time value with microsecond resolution    */
75	uint32 tv_sec;	/* Seconds                                   */
76	uint32 tv_usec;	/* Microseconds                              */
77} timeval_t;
78
79
80/* Linux/ARM 32 prstatus for notes section */
81typedef struct prstatus {
82	  int32 si_signo; 	/* Signal number */
83	  int32 si_code; 	/* Extra code */
84	  int32 si_errno; 	/* Errno */
85	  uint16 pr_cursig; 	/* Current signal.  */
86	  uint16 unused;
87	  uint32 pr_sigpend;	/* Set of pending signals.  */
88	  uint32 pr_sighold;	/* Set of held signals.  */
89	  uint32 pr_pid;
90	  uint32 pr_ppid;
91	  uint32 pr_pgrp;
92	  uint32 pr_sid;
93	  timeval_t pr_utime;	/* User time.  */
94	  timeval_t pr_stime;	/* System time.  */
95	  timeval_t pr_cutime;	/* Cumulative user time.  */
96	  timeval_t pr_cstime;	/* Cumulative system time.  */
97	  uint32 uregs[18];
98	  int32 pr_fpvalid;	/* True if math copro being used.  */
99} prstatus_t;
100
101#ifdef __GNUC__
102extern hndrte_debug_t hndrte_debug_info __attribute__ ((weak));
103#endif /* __GNUC__ */
104
105#endif /* !LANGUAGE_ASSEMBLY */
106
107#endif /* _HNDRTE_DEBUG_H */
108