1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 #ifndef _UAPI_LINUX_SWITCHTEC_IOCTL_H
18 #define _UAPI_LINUX_SWITCHTEC_IOCTL_H
19
20 #include <linux/types.h>
21
22 #define SWITCHTEC_IOCTL_PART_CFG0 0
23 #define SWITCHTEC_IOCTL_PART_CFG1 1
24 #define SWITCHTEC_IOCTL_PART_IMG0 2
25 #define SWITCHTEC_IOCTL_PART_IMG1 3
26 #define SWITCHTEC_IOCTL_PART_NVLOG 4
27 #define SWITCHTEC_IOCTL_PART_VENDOR0 5
28 #define SWITCHTEC_IOCTL_PART_VENDOR1 6
29 #define SWITCHTEC_IOCTL_PART_VENDOR2 7
30 #define SWITCHTEC_IOCTL_PART_VENDOR3 8
31 #define SWITCHTEC_IOCTL_PART_VENDOR4 9
32 #define SWITCHTEC_IOCTL_PART_VENDOR5 10
33 #define SWITCHTEC_IOCTL_PART_VENDOR6 11
34 #define SWITCHTEC_IOCTL_PART_VENDOR7 12
35 #define SWITCHTEC_IOCTL_NUM_PARTITIONS 13
36
37 struct switchtec_ioctl_flash_info {
38 __u64 flash_length;
39 __u32 num_partitions;
40 __u32 padding;
41 };
42
43 #define SWITCHTEC_IOCTL_PART_ACTIVE 1
44 #define SWITCHTEC_IOCTL_PART_RUNNING 2
45
46 struct switchtec_ioctl_flash_part_info {
47 __u32 flash_partition;
48 __u32 address;
49 __u32 length;
50 __u32 active;
51 };
52
53 struct switchtec_ioctl_event_summary_legacy {
54 __u64 global;
55 __u64 part_bitmap;
56 __u32 local_part;
57 __u32 padding;
58 __u32 part[48];
59 __u32 pff[48];
60 };
61
62 struct switchtec_ioctl_event_summary {
63 __u64 global;
64 __u64 part_bitmap;
65 __u32 local_part;
66 __u32 padding;
67 __u32 part[48];
68 __u32 pff[255];
69 };
70
71 #define SWITCHTEC_IOCTL_EVENT_STACK_ERROR 0
72 #define SWITCHTEC_IOCTL_EVENT_PPU_ERROR 1
73 #define SWITCHTEC_IOCTL_EVENT_ISP_ERROR 2
74 #define SWITCHTEC_IOCTL_EVENT_SYS_RESET 3
75 #define SWITCHTEC_IOCTL_EVENT_FW_EXC 4
76 #define SWITCHTEC_IOCTL_EVENT_FW_NMI 5
77 #define SWITCHTEC_IOCTL_EVENT_FW_NON_FATAL 6
78 #define SWITCHTEC_IOCTL_EVENT_FW_FATAL 7
79 #define SWITCHTEC_IOCTL_EVENT_TWI_MRPC_COMP 8
80 #define SWITCHTEC_IOCTL_EVENT_TWI_MRPC_COMP_ASYNC 9
81 #define SWITCHTEC_IOCTL_EVENT_CLI_MRPC_COMP 10
82 #define SWITCHTEC_IOCTL_EVENT_CLI_MRPC_COMP_ASYNC 11
83 #define SWITCHTEC_IOCTL_EVENT_GPIO_INT 12
84 #define SWITCHTEC_IOCTL_EVENT_PART_RESET 13
85 #define SWITCHTEC_IOCTL_EVENT_MRPC_COMP 14
86 #define SWITCHTEC_IOCTL_EVENT_MRPC_COMP_ASYNC 15
87 #define SWITCHTEC_IOCTL_EVENT_DYN_PART_BIND_COMP 16
88 #define SWITCHTEC_IOCTL_EVENT_AER_IN_P2P 17
89 #define SWITCHTEC_IOCTL_EVENT_AER_IN_VEP 18
90 #define SWITCHTEC_IOCTL_EVENT_DPC 19
91 #define SWITCHTEC_IOCTL_EVENT_CTS 20
92 #define SWITCHTEC_IOCTL_EVENT_HOTPLUG 21
93 #define SWITCHTEC_IOCTL_EVENT_IER 22
94 #define SWITCHTEC_IOCTL_EVENT_THRESH 23
95 #define SWITCHTEC_IOCTL_EVENT_POWER_MGMT 24
96 #define SWITCHTEC_IOCTL_EVENT_TLP_THROTTLING 25
97 #define SWITCHTEC_IOCTL_EVENT_FORCE_SPEED 26
98 #define SWITCHTEC_IOCTL_EVENT_CREDIT_TIMEOUT 27
99 #define SWITCHTEC_IOCTL_EVENT_LINK_STATE 28
100 #define SWITCHTEC_IOCTL_EVENT_GFMS 29
101 #define SWITCHTEC_IOCTL_MAX_EVENTS 30
102
103 #define SWITCHTEC_IOCTL_EVENT_LOCAL_PART_IDX -1
104 #define SWITCHTEC_IOCTL_EVENT_IDX_ALL -2
105
106 #define SWITCHTEC_IOCTL_EVENT_FLAG_CLEAR (1 << 0)
107 #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_POLL (1 << 1)
108 #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_LOG (1 << 2)
109 #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_CLI (1 << 3)
110 #define SWITCHTEC_IOCTL_EVENT_FLAG_EN_FATAL (1 << 4)
111 #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_POLL (1 << 5)
112 #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_LOG (1 << 6)
113 #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_CLI (1 << 7)
114 #define SWITCHTEC_IOCTL_EVENT_FLAG_DIS_FATAL (1 << 8)
115 #define SWITCHTEC_IOCTL_EVENT_FLAG_UNUSED (~0x1ff)
116
117 struct switchtec_ioctl_event_ctl {
118 __u32 event_id;
119 __s32 index;
120 __u32 flags;
121 __u32 occurred;
122 __u32 count;
123 __u32 data[5];
124 };
125
126 #define SWITCHTEC_IOCTL_PFF_VEP 100
127 struct switchtec_ioctl_pff_port {
128 __u32 pff;
129 __u32 partition;
130 __u32 port;
131 };
132
133 #define SWITCHTEC_IOCTL_FLASH_INFO \
134 _IOR('W', 0x40, struct switchtec_ioctl_flash_info)
135 #define SWITCHTEC_IOCTL_FLASH_PART_INFO \
136 _IOWR('W', 0x41, struct switchtec_ioctl_flash_part_info)
137 #define SWITCHTEC_IOCTL_EVENT_SUMMARY \
138 _IOR('W', 0x42, struct switchtec_ioctl_event_summary)
139 #define SWITCHTEC_IOCTL_EVENT_SUMMARY_LEGACY \
140 _IOR('W', 0x42, struct switchtec_ioctl_event_summary_legacy)
141 #define SWITCHTEC_IOCTL_EVENT_CTL \
142 _IOWR('W', 0x43, struct switchtec_ioctl_event_ctl)
143 #define SWITCHTEC_IOCTL_PFF_TO_PORT \
144 _IOWR('W', 0x44, struct switchtec_ioctl_pff_port)
145 #define SWITCHTEC_IOCTL_PORT_TO_PFF \
146 _IOWR('W', 0x45, struct switchtec_ioctl_pff_port)
147
148 #endif