• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3  * Broadcom Event protocol definitions
4  *
5  * Dependencies: bcmeth.h
6  *
7  * Copyright (C) 1999-2019, Broadcom.
8  *
9  *      Unless you and Broadcom execute a separate written software license
10  * agreement governing use of this software, this software is licensed to you
11  * under the terms of the GNU General Public License version 2 (the "GPL"),
12  * available at http://www.broadcom.com/licenses/GPLv2.php, with the
13  * following added to such license:
14  *
15  *      As a special exception, the copyright holders of this software give you
16  * permission to link this software with independent modules, and to copy and
17  * distribute the resulting executable under terms of your choice, provided that
18  * you also meet, for each linked independent module, the terms and conditions of
19  * the license of that module.  An independent module is a module which is not
20  * derived from this software.  The special exception does not apply to any
21  * modifications of the software.
22  *
23  *      Notwithstanding the above, under no circumstances may you combine this
24  * software in any way with any other Broadcom software provided under a license
25  * other than the GPL, without Broadcom's express prior written consent.
26  *
27  *
28  * <<Broadcom-WL-IPTag/Open:>>
29  *
30  * $Id: dnglevent.h $
31  *
32  * -----------------------------------------------------------------------------
33  *
34  */
35 
36 /*
37  * Broadcom dngl Ethernet Events protocol defines
38  *
39  */
40 
41 #ifndef _DNGLEVENT_H_
42 #define _DNGLEVENT_H_
43 
44 #ifndef _TYPEDEFS_H_
45 #include <typedefs.h>
46 #endif // endif
47 #include <bcmeth.h>
48 #include <ethernet.h>
49 
50 /* This marks the start of a packed structure section. */
51 #include <packed_section_start.h>
52 #define BCM_DNGL_EVENT_MSG_VERSION		1
53 #define DNGL_E_RSRVD_1				0x0
54 #define DNGL_E_RSRVD_2				0x1
55 #define DNGL_E_SOCRAM_IND			0x2
56 typedef BWL_PRE_PACKED_STRUCT struct
57 {
58 	uint16  version; /* Current version is 1 */
59 	uint16  reserved; /* reserved for any future extension */
60 	uint16  event_type; /* DNGL_E_SOCRAM_IND */
61 	uint16  datalen; /* Length of the event payload */
62 } BWL_POST_PACKED_STRUCT bcm_dngl_event_msg_t;
63 
64 typedef BWL_PRE_PACKED_STRUCT struct bcm_dngl_event {
65 	struct ether_header eth;
66 	bcmeth_hdr_t        bcm_hdr;
67 	bcm_dngl_event_msg_t      dngl_event;
68 	/* data portion follows */
69 } BWL_POST_PACKED_STRUCT bcm_dngl_event_t;
70 
71 typedef BWL_PRE_PACKED_STRUCT struct bcm_dngl_socramind {
72 	uint16			tag;	/* data tag */
73 	uint16			length; /* data length */
74 	uint8			value[1]; /* data value with variable length specified by length */
75 } BWL_POST_PACKED_STRUCT bcm_dngl_socramind_t;
76 
77 /* SOCRAM_IND type tags */
78 typedef enum socram_ind_tag {
79 	SOCRAM_IND_ASSERT_TAG = 1,
80 	SOCRAM_IND_TAG_HEALTH_CHECK = 2
81 } socram_ind_tag_t;
82 
83 /* Health check top level module tags */
84 typedef BWL_PRE_PACKED_STRUCT struct bcm_dngl_healthcheck {
85 	uint16			top_module_tag;	/* top level module tag */
86 	uint16			top_module_len; /* Type of PCIE issue indication */
87 	uint8			value[1]; /* data value with variable length specified by length */
88 } BWL_POST_PACKED_STRUCT bcm_dngl_healthcheck_t;
89 
90 /* Health check top level module tags */
91 #define HEALTH_CHECK_TOP_LEVEL_MODULE_PCIEDEV_RTE 1
92 #define HEALTH_CHECK_PCIEDEV_VERSION_1	1
93 #define HEALTH_CHECK_PCIEDEV_FLAG_IN_D3_SHIFT	0
94 #define HEALTH_CHECK_PCIEDEV_FLAG_AER_SHIFT		1
95 #define HEALTH_CHECK_PCIEDEV_FLAG_LINKDOWN_SHIFT		2
96 #define HEALTH_CHECK_PCIEDEV_FLAG_MSI_INT_SHIFT			3
97 #define HEALTH_CHECK_PCIEDEV_FLAG_NODS_SHIFT			4
98 #define HEALTH_CHECK_PCIEDEV_FLAG_NO_HOST_WAKE_SHIFT		5
99 #define HEALTH_CHECK_PCIEDEV_FLAG_IN_D3	1 << HEALTH_CHECK_PCIEDEV_FLAG_IN_D3_SHIFT
100 #define HEALTH_CHECK_PCIEDEV_FLAG_AER	1 << HEALTH_CHECK_PCIEDEV_FLAG_AER_SHIFT
101 #define HEALTH_CHECK_PCIEDEV_FLAG_LINKDOWN	1 << HEALTH_CHECK_PCIEDEV_FLAG_LINKDOWN_SHIFT
102 #define HEALTH_CHECK_PCIEDEV_FLAG_MSI_INT	1 << HEALTH_CHECK_PCIEDEV_FLAG_MSI_INT_SHIFT
103 #define HEALTH_CHECK_PCIEDEV_FLAG_NODS	1 << HEALTH_CHECK_PCIEDEV_FLAG_NODS_SHIFT
104 #define HEALTH_CHECK_PCIEDEV_FLAG_NO_HOST_WAKE	1 << HEALTH_CHECK_PCIEDEV_FLAG_NO_HOST_WAKE_SHIFT
105 /* PCIE Module TAGs */
106 #define HEALTH_CHECK_PCIEDEV_INDUCED_IND	0x1
107 #define HEALTH_CHECK_PCIEDEV_H2D_DMA_IND	0x2
108 #define HEALTH_CHECK_PCIEDEV_D2H_DMA_IND	0x3
109 #define HEALTH_CHECK_PCIEDEV_IOCTL_STALL_IND	0x4
110 #define HEALTH_CHECK_PCIEDEV_D3ACK_STALL_IND	0x5
111 #define HEALTH_CHECK_PCIEDEV_NODS_IND	0x6
112 #define HEALTH_CHECK_PCIEDEV_LINKSPEED_FALLBACK_IND	0x7
113 #define HEALTH_CHECK_PCIEDEV_DSACK_STALL_IND	0x8
114 
115 #define HC_PCIEDEV_CONFIG_REGLIST_MAX	25
116 typedef BWL_PRE_PACKED_STRUCT struct bcm_dngl_pcie_hc {
117 	uint16			version; /* HEALTH_CHECK_PCIEDEV_VERSION_1 */
118 	uint16			reserved;
119 	uint16			pcie_err_ind_type; /* PCIE Module TAGs */
120 	uint16			pcie_flag;
121 	uint32			pcie_control_reg;
122 	uint32			pcie_config_regs[HC_PCIEDEV_CONFIG_REGLIST_MAX];
123 } BWL_POST_PACKED_STRUCT bcm_dngl_pcie_hc_t;
124 
125 #ifdef HCHK_COMMON_SW_EVENT
126 /* Enumerating top level SW entities for use by health check */
127 typedef enum {
128 	HCHK_SW_ENTITY_UNDEFINED = 0,
129 	HCHK_SW_ENTITY_PCIE = 1,
130 	HCHK_SW_ENTITY_SDIO = 2,
131 	HCHK_SW_ENTITY_USB = 3,
132 	HCHK_SW_ENTITY_RTE = 4,
133 	HCHK_SW_ENTITY_WL_PRIMARY = 5, /* WL instance 0 */
134 	HCHK_SW_ENTITY_WL_SECONDARY = 6, /* WL instance 1 */
135 	HCHK_SW_ENTITY_MAX
136 } hchk_sw_entity_t;
137 #endif /* HCHK_COMMON_SW_EVENT */
138 
139 /* This marks the end of a packed structure section. */
140 #include <packed_section_end.h>
141 
142 #endif /* _DNGLEVENT_H_ */
143