hc
2023-11-06 e3e12f52b214121840b44c91de5b3e5af5d3eb84
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
/*
 * Broadcom Event protocol definitions
 *
 * Dependencies: bcmeth.h
 *
 * Copyright (C) 2020, Broadcom.
 *
 *      Unless you and Broadcom execute a separate written software license
 * agreement governing use of this software, this software is licensed to you
 * under the terms of the GNU General Public License version 2 (the "GPL"),
 * available at http://www.broadcom.com/licenses/GPLv2.php, with the
 * following added to such license:
 *
 *      As a special exception, the copyright holders of this software give you
 * permission to link this software with independent modules, and to copy and
 * distribute the resulting executable under terms of your choice, provided that
 * you also meet, for each linked independent module, the terms and conditions of
 * the license of that module.  An independent module is a module which is not
 * derived from this software.  The special exception does not apply to any
 * modifications of the software.
 *
 *
 * <<Broadcom-WL-IPTag/Dual:>>
 *
 * -----------------------------------------------------------------------------
 *
 */
 
/*
 * Broadcom dngl Ethernet Events protocol defines
 *
 */
 
#ifndef _DNGLEVENT_H_
#define _DNGLEVENT_H_
 
#ifndef _TYPEDEFS_H_
#include <typedefs.h>
#endif
#include <bcmeth.h>
#include <ethernet.h>
#ifdef HEALTH_CHECK
#include <dngl_defs.h>
#endif /* HEALTH_CHECK */
 
/* This marks the start of a packed structure section. */
#include <packed_section_start.h>
#define BCM_DNGL_EVENT_MSG_VERSION        1
#define DNGL_E_RSRVD_1                0x0
#define DNGL_E_RSRVD_2                0x1
#define DNGL_E_SOCRAM_IND            0x2
#define DNGL_E_PROFILE_DATA_IND            0x3
typedef BWL_PRE_PACKED_STRUCT struct
{
   uint16  version; /* Current version is 1 */
   uint16  reserved; /* reserved for any future extension */
   uint16  event_type; /* DNGL_E_SOCRAM_IND */
   uint16  datalen; /* Length of the event payload */
} BWL_POST_PACKED_STRUCT bcm_dngl_event_msg_t;
 
typedef BWL_PRE_PACKED_STRUCT struct bcm_dngl_event {
   struct ether_header eth;
   bcmeth_hdr_t        bcm_hdr;
   bcm_dngl_event_msg_t      dngl_event;
   /* data portion follows */
} BWL_POST_PACKED_STRUCT bcm_dngl_event_t;
 
typedef BWL_PRE_PACKED_STRUCT struct bcm_dngl_socramind {
   uint16            tag;    /* data tag */
   uint16            length; /* data length */
   uint8            value[1]; /* data value with variable length specified by length */
} BWL_POST_PACKED_STRUCT bcm_dngl_socramind_t;
 
typedef BWL_PRE_PACKED_STRUCT struct bcm_dngl_profile_data_ind_t {
   uint16 tag;
   uint16 length;
   uint8 value[];
} BWL_POST_PACKED_STRUCT bcm_dngl_profile_data_ind_t;
 
typedef BWL_PRE_PACKED_STRUCT struct bcm_dngl_arm_event {
   uint32 type;
   uint32 value;
} BWL_POST_PACKED_STRUCT bcm_dngl_arm_event_t;
 
#define PROFILE_DATA_IND_INFO 0x1
 
#define PROFILE_SUB_TYPE_ARM_STATS_INFO 0x1
 
typedef BWL_PRE_PACKED_STRUCT struct bcm_dngl_arm_stats_ind {
   uint16    tag;
   uint16    length;
   uint8    value[];
} BWL_POST_PACKED_STRUCT bcm_dngl_arm_stats_ind_t;
 
typedef BWL_PRE_PACKED_STRUCT struct bcm_dngl_arm_stats {
   uint32    cycles;
   uint32    timestamp;
   uint16    freq;
   uint16    roh;
   uint16    num_events;
   uint16  seq_no;
   uint8    value[];
} BWL_POST_PACKED_STRUCT bcm_dngl_arm_stats_t;
 
/* SOCRAM_IND type tags */
typedef enum socram_ind_tag {
   SOCRAM_IND_ASSERT_TAG = 1,
   SOCRAM_IND_TAG_HEALTH_CHECK = 2
} socram_ind_tag_t;
 
/* Health check top level module tags */
typedef BWL_PRE_PACKED_STRUCT struct bcm_dngl_healthcheck {
   uint16            top_module_tag;    /* top level module tag */
   uint16            top_module_len; /* Type of PCIE issue indication */
   uint8            value[1]; /* data value with variable length specified by length */
} BWL_POST_PACKED_STRUCT bcm_dngl_healthcheck_t;
 
/* Health check top level module tags */
#define HEALTH_CHECK_TOP_LEVEL_MODULE_PCIEDEV_RTE 1
#define HEALTH_CHECK_PCIEDEV_VERSION_1    1
#define HEALTH_CHECK_PCIEDEV_FLAG_IN_D3_SHIFT    0
#define HEALTH_CHECK_PCIEDEV_FLAG_AER_SHIFT        1
#define HEALTH_CHECK_PCIEDEV_FLAG_LINKDOWN_SHIFT        2
#define HEALTH_CHECK_PCIEDEV_FLAG_MSI_INT_SHIFT            3
#define HEALTH_CHECK_PCIEDEV_FLAG_NODS_SHIFT            4
#define HEALTH_CHECK_PCIEDEV_FLAG_NO_HOST_WAKE_SHIFT        5
#define HEALTH_CHECK_PCIEDEV_FLAG_IN_D3    1 << HEALTH_CHECK_PCIEDEV_FLAG_IN_D3_SHIFT
#define HEALTH_CHECK_PCIEDEV_FLAG_AER    1 << HEALTH_CHECK_PCIEDEV_FLAG_AER_SHIFT
#define HEALTH_CHECK_PCIEDEV_FLAG_LINKDOWN    1 << HEALTH_CHECK_PCIEDEV_FLAG_LINKDOWN_SHIFT
#define HEALTH_CHECK_PCIEDEV_FLAG_MSI_INT    1 << HEALTH_CHECK_PCIEDEV_FLAG_MSI_INT_SHIFT
#define HEALTH_CHECK_PCIEDEV_FLAG_NODS    1 << HEALTH_CHECK_PCIEDEV_FLAG_NODS_SHIFT
#define HEALTH_CHECK_PCIEDEV_FLAG_NO_HOST_WAKE    1 << HEALTH_CHECK_PCIEDEV_FLAG_NO_HOST_WAKE_SHIFT
/* PCIE Module TAGs */
#define HEALTH_CHECK_PCIEDEV_INDUCED_IND    0x1
#define HEALTH_CHECK_PCIEDEV_H2D_DMA_IND    0x2
#define HEALTH_CHECK_PCIEDEV_D2H_DMA_IND    0x3
#define HEALTH_CHECK_PCIEDEV_IOCTL_STALL_IND    0x4
#define HEALTH_CHECK_PCIEDEV_D3ACK_STALL_IND    0x5
#define HEALTH_CHECK_PCIEDEV_NODS_IND    0x6
#define HEALTH_CHECK_PCIEDEV_LINKSPEED_FALLBACK_IND    0x7
#define HEALTH_CHECK_PCIEDEV_DSACK_STALL_IND    0x8
#define HEALTH_CHECK_PCIEDEV_FLOWRING_IND    0x9
#define HEALTH_CHECK_PCIEDEV_HW_ASSERT_LONG_IND 0xA
#define HEALTH_CHECK_PCIEDEV_RXPOST_LONG_IND    0xB
 
#define HC_PCIEDEV_CONFIG_REGLIST_MAX    25
typedef BWL_PRE_PACKED_STRUCT struct bcm_dngl_pcie_hc {
   uint16            version; /* HEALTH_CHECK_PCIEDEV_VERSION_1 */
   uint16            reserved;
   uint16            pcie_err_ind_type; /* PCIE Module TAGs */
   uint16            pcie_flag;
   uint32            pcie_control_reg;
   uint32            pcie_config_regs[HC_PCIEDEV_CONFIG_REGLIST_MAX];
} BWL_POST_PACKED_STRUCT bcm_dngl_pcie_hc_t;
 
/* define to avoid compile issues in older branches which define hchk_sw_entity_t */
#ifdef HCHK_COMMON_SW_EVENT
/* Enumerating top level SW entities for use by health check */
typedef enum {
   HCHK_SW_ENTITY_UNDEFINED = 0,
   HCHK_SW_ENTITY_PCIE = 1,
   HCHK_SW_ENTITY_SDIO = 2,
   HCHK_SW_ENTITY_USB = 3,
   HCHK_SW_ENTITY_RTE = 4,
   HCHK_SW_ENTITY_WL_PRIMARY = 5, /* WL instance 0 */
   HCHK_SW_ENTITY_WL_SECONDARY = 6, /* WL instance 1 */
   HCHK_SW_ENTITY_MAX
} hchk_sw_entity_t;
#endif /* HCHK_COMMON_SW_EVENT */
 
/* This marks the end of a packed structure section. */
#include <packed_section_end.h>
 
#endif /* _DNGLEVENT_H_ */