]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blob - drivers/net/ethernet/aquantia/atlantic/hw_atl2/hw_atl2_utils.h
Merge series "ASoC: topology: fix error handling flow" from Pierre-Louis Bossart...
[mirror_ubuntu-jammy-kernel.git] / drivers / net / ethernet / aquantia / atlantic / hw_atl2 / hw_atl2_utils.h
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Atlantic Network Driver
3 * Copyright (C) 2020 Marvell International Ltd.
4 */
5
6 #ifndef HW_ATL2_UTILS_H
7 #define HW_ATL2_UTILS_H
8
9 #include "aq_hw.h"
10
11 /* F W A P I */
12
13 struct link_options_s {
14 u8 link_up:1;
15 u8 link_renegotiate:1;
16 u8 minimal_link_speed:1;
17 u8 internal_loopback:1;
18 u8 external_loopback:1;
19 u8 rate_10M_hd:1;
20 u8 rate_100M_hd:1;
21 u8 rate_1G_hd:1;
22
23 u8 rate_10M:1;
24 u8 rate_100M:1;
25 u8 rate_1G:1;
26 u8 rate_2P5G:1;
27 u8 rate_N2P5G:1;
28 u8 rate_5G:1;
29 u8 rate_N5G:1;
30 u8 rate_10G:1;
31
32 u8 eee_100M:1;
33 u8 eee_1G:1;
34 u8 eee_2P5G:1;
35 u8 eee_5G:1;
36 u8 eee_10G:1;
37 u8 rsvd3:3;
38
39 u8 pause_rx:1;
40 u8 pause_tx:1;
41 u8 rsvd4:1;
42 u8 downshift:1;
43 u8 downshift_retry:4;
44 };
45
46 struct link_control_s {
47 u8 mode:4;
48 u8 disable_crc_corruption:1;
49 u8 discard_short_frames:1;
50 u8 flow_control_mode:1;
51 u8 disable_length_check:1;
52
53 u8 discard_errored_frames:1;
54 u8 control_frame_enable:1;
55 u8 enable_tx_padding:1;
56 u8 enable_crc_forwarding:1;
57 u8 enable_frame_padding_removal_rx: 1;
58 u8 promiscuous_mode: 1;
59 u8 rsvd:2;
60
61 u16 rsvd2;
62 };
63
64 struct thermal_shutdown_s {
65 u8 enable:1;
66 u8 warning_enable:1;
67 u8 rsvd:6;
68
69 u8 shutdown_temperature;
70 u8 cold_temperature;
71 u8 warning_temperature;
72 };
73
74 struct mac_address_s {
75 u8 mac_address[6];
76 };
77
78 struct mac_address_aligned_s {
79 struct mac_address_s aligned;
80 u16 rsvd;
81 };
82
83 struct sleep_proxy_s {
84 struct wake_on_lan_s {
85 u8 wake_on_magic_packet:1;
86 u8 wake_on_pattern:1;
87 u8 wake_on_link_up:1;
88 u8 wake_on_link_down:1;
89 u8 wake_on_ping:1;
90 u8 wake_on_timer:1;
91 u8 rsvd:2;
92
93 u8 rsvd2;
94 u16 rsvd3;
95
96 u32 link_up_timeout;
97 u32 link_down_timeout;
98 u32 timer;
99 } wake_on_lan;
100
101 struct {
102 u32 mask[4];
103 u32 crc32;
104 } wake_up_pattern[8];
105
106 struct __packed {
107 u8 arp_responder:1;
108 u8 echo_responder:1;
109 u8 igmp_client:1;
110 u8 echo_truncate:1;
111 u8 address_guard:1;
112 u8 ignore_fragmented:1;
113 u8 rsvd:2;
114
115 u16 echo_max_len;
116 u8 rsvd2;
117 } ipv4_offload;
118
119 u32 ipv4_offload_addr[8];
120 u32 reserved[8];
121
122 struct __packed {
123 u8 ns_responder:1;
124 u8 echo_responder:1;
125 u8 mld_client:1;
126 u8 echo_truncate:1;
127 u8 address_guard:1;
128 u8 rsvd:3;
129
130 u16 echo_max_len;
131 u8 rsvd2;
132 } ipv6_offload;
133
134 u32 ipv6_offload_addr[16][4];
135
136 struct {
137 u16 port[16];
138 } tcp_port_offload;
139
140 struct {
141 u16 port[16];
142 } udp_port_offload;
143
144 struct {
145 u32 retry_count;
146 u32 retry_interval;
147 } ka4_offload;
148
149 struct {
150 u32 timeout;
151 u16 local_port;
152 u16 remote_port;
153 u8 remote_mac_addr[6];
154 u16 rsvd;
155 u32 rsvd2;
156 u32 rsvd3;
157 u16 rsvd4;
158 u16 win_size;
159 u32 seq_num;
160 u32 ack_num;
161 u32 local_ip;
162 u32 remote_ip;
163 } ka4_connection[16];
164
165 struct {
166 u32 retry_count;
167 u32 retry_interval;
168 } ka6_offload;
169
170 struct {
171 u32 timeout;
172 u16 local_port;
173 u16 remote_port;
174 u8 remote_mac_addr[6];
175 u16 rsvd;
176 u32 rsvd2;
177 u32 rsvd3;
178 u16 rsvd4;
179 u16 win_size;
180 u32 seq_num;
181 u32 ack_num;
182 u32 local_ip[4];
183 u32 remote_ip[4];
184 } ka6_connection[16];
185
186 struct {
187 u32 rr_count;
188 u32 rr_buf_len;
189 u32 idx_offset;
190 u32 rr__offset;
191 } mdns_offload;
192 };
193
194 struct pause_quanta_s {
195 u16 quanta_10M;
196 u16 threshold_10M;
197 u16 quanta_100M;
198 u16 threshold_100M;
199 u16 quanta_1G;
200 u16 threshold_1G;
201 u16 quanta_2P5G;
202 u16 threshold_2P5G;
203 u16 quanta_5G;
204 u16 threshold_5G;
205 u16 quanta_10G;
206 u16 threshold_10G;
207 };
208
209 struct data_buffer_status_s {
210 u32 data_offset;
211 u32 data_length;
212 };
213
214 struct device_caps_s {
215 u8 finite_flashless:1;
216 u8 cable_diag:1;
217 u8 ncsi:1;
218 u8 avb:1;
219 u8 rsvd:4;
220
221 u8 rsvd2;
222 u16 rsvd3;
223 u32 rsvd4;
224 };
225
226 struct version_s {
227 struct bundle_version_t {
228 u8 major;
229 u8 minor;
230 u16 build;
231 } bundle;
232 struct mac_version_t {
233 u8 major;
234 u8 minor;
235 u16 build;
236 } mac;
237 struct phy_version_t {
238 u8 major;
239 u8 minor;
240 u16 build;
241 } phy;
242 u32 rsvd;
243 };
244
245 struct link_status_s {
246 u8 link_state:4;
247 u8 link_rate:4;
248
249 u8 pause_tx:1;
250 u8 pause_rx:1;
251 u8 eee:1;
252 u8 duplex:1;
253 u8 rsvd:4;
254
255 u16 rsvd2;
256 };
257
258 struct wol_status_s {
259 u8 wake_count;
260 u8 wake_reason;
261
262 u16 wake_up_packet_length :12;
263 u16 wake_up_pattern_number :3;
264 u16 rsvd:1;
265
266 u32 wake_up_packet[379];
267 };
268
269 struct mac_health_monitor_s {
270 u8 mac_ready:1;
271 u8 mac_fault:1;
272 u8 mac_flashless_finished:1;
273 u8 rsvd:5;
274
275 u8 mac_temperature;
276 u16 mac_heart_beat;
277 u16 mac_fault_code;
278 u16 rsvd2;
279 };
280
281 struct phy_health_monitor_s {
282 u8 phy_ready:1;
283 u8 phy_fault:1;
284 u8 phy_hot_warning:1;
285 u8 rsvd:5;
286
287 u8 phy_temperature;
288 u16 phy_heart_beat;
289 u16 phy_fault_code;
290 u16 rsvd2;
291 };
292
293 struct device_link_caps_s {
294 u8 rsvd:3;
295 u8 internal_loopback:1;
296 u8 external_loopback:1;
297 u8 rate_10M_hd:1;
298 u8 rate_100M_hd:1;
299 u8 rate_1G_hd:1;
300
301 u8 rate_10M:1;
302 u8 rate_100M:1;
303 u8 rate_1G:1;
304 u8 rate_2P5G:1;
305 u8 rate_N2P5G:1;
306 u8 rate_5G:1;
307 u8 rate_N5G:1;
308 u8 rate_10G:1;
309
310 u8 rsvd3:1;
311 u8 eee_100M:1;
312 u8 eee_1G:1;
313 u8 eee_2P5G:1;
314 u8 rsvd4:1;
315 u8 eee_5G:1;
316 u8 rsvd5:1;
317 u8 eee_10G:1;
318
319 u8 pause_rx:1;
320 u8 pause_tx:1;
321 u8 pfc:1;
322 u8 downshift:1;
323 u8 downshift_retry:4;
324 };
325
326 struct sleep_proxy_caps_s {
327 u8 ipv4_offload:1;
328 u8 ipv6_offload:1;
329 u8 tcp_port_offload:1;
330 u8 udp_port_offload:1;
331 u8 ka4_offload:1;
332 u8 ka6_offload:1;
333 u8 mdns_offload:1;
334 u8 wake_on_ping:1;
335
336 u8 wake_on_magic_packet:1;
337 u8 wake_on_pattern:1;
338 u8 wake_on_timer:1;
339 u8 wake_on_link:1;
340 u8 wake_patterns_count:4;
341
342 u8 ipv4_count;
343 u8 ipv6_count;
344
345 u8 tcp_port_offload_count;
346 u8 udp_port_offload_count;
347
348 u8 tcp4_ka_count;
349 u8 tcp6_ka_count;
350
351 u8 igmp_offload:1;
352 u8 mld_offload:1;
353 u8 rsvd:6;
354
355 u8 rsvd2;
356 u16 rsvd3;
357 };
358
359 struct lkp_link_caps_s {
360 u8 rsvd:5;
361 u8 rate_10M_hd:1;
362 u8 rate_100M_hd:1;
363 u8 rate_1G_hd:1;
364
365 u8 rate_10M:1;
366 u8 rate_100M:1;
367 u8 rate_1G:1;
368 u8 rate_2P5G:1;
369 u8 rate_N2P5G:1;
370 u8 rate_5G:1;
371 u8 rate_N5G:1;
372 u8 rate_10G:1;
373
374 u8 rsvd2:1;
375 u8 eee_100M:1;
376 u8 eee_1G:1;
377 u8 eee_2P5G:1;
378 u8 rsvd3:1;
379 u8 eee_5G:1;
380 u8 rsvd4:1;
381 u8 eee_10G:1;
382
383 u8 pause_rx:1;
384 u8 pause_tx:1;
385 u8 rsvd5:6;
386 };
387
388 struct core_dump_s {
389 u32 reg0;
390 u32 reg1;
391 u32 reg2;
392
393 u32 hi;
394 u32 lo;
395
396 u32 regs[32];
397 };
398
399 struct trace_s {
400 u32 sync_counter;
401 u32 mem_buffer[0x1ff];
402 };
403
404 struct cable_diag_control_s {
405 u8 toggle :1;
406 u8 rsvd:7;
407
408 u8 wait_timeout_sec;
409 u16 rsvd2;
410 };
411
412 struct cable_diag_lane_data_s {
413 u8 result_code;
414 u8 dist;
415 u8 far_dist;
416 u8 rsvd;
417 };
418
419 struct cable_diag_status_s {
420 struct cable_diag_lane_data_s lane_data[4];
421 u8 transact_id;
422 u8 status:4;
423 u8 rsvd:4;
424 u16 rsvd2;
425 };
426
427 struct statistics_s {
428 struct {
429 u32 link_up;
430 u32 link_down;
431 } link;
432
433 struct {
434 u64 tx_unicast_octets;
435 u64 tx_multicast_octets;
436 u64 tx_broadcast_octets;
437 u64 rx_unicast_octets;
438 u64 rx_multicast_octets;
439 u64 rx_broadcast_octets;
440
441 u32 tx_unicast_frames;
442 u32 tx_multicast_frames;
443 u32 tx_broadcast_frames;
444 u32 tx_errors;
445
446 u32 rx_unicast_frames;
447 u32 rx_multicast_frames;
448 u32 rx_broadcast_frames;
449 u32 rx_dropped_frames;
450 u32 rx_error_frames;
451
452 u32 tx_good_frames;
453 u32 rx_good_frames;
454 u32 reserve_fw_gap;
455 } msm;
456 u32 main_loop_cycles;
457 u32 reserve_fw_gap;
458 };
459
460 struct filter_caps_s {
461 u8 l2_filters_base_index:6;
462 u8 flexible_filter_mask:2;
463 u8 l2_filter_count;
464 u8 ethertype_filter_base_index;
465 u8 ethertype_filter_count;
466
467 u8 vlan_filter_base_index;
468 u8 vlan_filter_count;
469 u8 l3_ip4_filter_base_index:4;
470 u8 l3_ip4_filter_count:4;
471 u8 l3_ip6_filter_base_index:4;
472 u8 l3_ip6_filter_count:4;
473
474 u8 l4_filter_base_index:4;
475 u8 l4_filter_count:4;
476 u8 l4_flex_filter_base_index:4;
477 u8 l4_flex_filter_count:4;
478 u8 rslv_tbl_base_index;
479 u8 rslv_tbl_count;
480 };
481
482 struct request_policy_s {
483 struct {
484 u8 all:1;
485 u8 mcast:1;
486 u8 rx_queue_tc_index:5;
487 u8 queue_or_tc:1;
488 } promisc;
489
490 struct {
491 u8 accept:1;
492 u8 rsvd:1;
493 u8 rx_queue_tc_index:5;
494 u8 queue_or_tc:1;
495 } bcast;
496
497 struct {
498 u8 accept:1;
499 u8 rsvd:1;
500 u8 rx_queue_tc_index:5;
501 u8 queue_or_tc:1;
502 } mcast;
503
504 u8 rsvd:8;
505 };
506
507 struct fw_interface_in {
508 u32 mtu;
509 u32 rsvd1;
510 struct mac_address_aligned_s mac_address;
511 struct link_control_s link_control;
512 u32 rsvd2;
513 struct link_options_s link_options;
514 u32 rsvd3;
515 struct thermal_shutdown_s thermal_shutdown;
516 u32 rsvd4;
517 struct sleep_proxy_s sleep_proxy;
518 u32 rsvd5;
519 struct pause_quanta_s pause_quanta[8];
520 struct cable_diag_control_s cable_diag_control;
521 u32 rsvd6;
522 struct data_buffer_status_s data_buffer_status;
523 u32 rsvd7;
524 struct request_policy_s request_policy;
525 };
526
527 struct transaction_counter_s {
528 u16 transaction_cnt_a;
529 u16 transaction_cnt_b;
530 };
531
532 struct management_status_s {
533 struct mac_address_s mac_address;
534 u16 vlan;
535
536 struct{
537 u32 enable : 1;
538 u32 rsvd:31;
539 } flags;
540
541 u32 rsvd1;
542 u32 rsvd2;
543 u32 rsvd3;
544 u32 rsvd4;
545 u32 rsvd5;
546 };
547
548 struct fw_interface_out {
549 struct transaction_counter_s transaction_id;
550 struct version_s version;
551 struct link_status_s link_status;
552 struct wol_status_s wol_status;
553 u32 rsvd;
554 u32 rsvd2;
555 struct mac_health_monitor_s mac_health_monitor;
556 u32 rsvd3;
557 u32 rsvd4;
558 struct phy_health_monitor_s phy_health_monitor;
559 u32 rsvd5;
560 u32 rsvd6;
561 struct cable_diag_status_s cable_diag_status;
562 u32 rsvd7;
563 struct device_link_caps_s device_link_caps;
564 u32 rsvd8;
565 struct sleep_proxy_caps_s sleep_proxy_caps;
566 u32 rsvd9;
567 struct lkp_link_caps_s lkp_link_caps;
568 u32 rsvd10;
569 struct core_dump_s core_dump;
570 u32 rsvd11;
571 struct statistics_s stats;
572 u32 rsvd12;
573 struct filter_caps_s filter_caps;
574 struct device_caps_s device_caps;
575 u32 rsvd13;
576 struct management_status_s management_status;
577 u32 reserve[21];
578 struct trace_s trace;
579 };
580
581 #define AQ_A2_FW_LINK_RATE_INVALID 0
582 #define AQ_A2_FW_LINK_RATE_10M 1
583 #define AQ_A2_FW_LINK_RATE_100M 2
584 #define AQ_A2_FW_LINK_RATE_1G 3
585 #define AQ_A2_FW_LINK_RATE_2G5 4
586 #define AQ_A2_FW_LINK_RATE_5G 5
587 #define AQ_A2_FW_LINK_RATE_10G 6
588
589 #define AQ_HOST_MODE_INVALID 0U
590 #define AQ_HOST_MODE_ACTIVE 1U
591 #define AQ_HOST_MODE_SLEEP_PROXY 2U
592 #define AQ_HOST_MODE_LOW_POWER 3U
593 #define AQ_HOST_MODE_SHUTDOWN 4U
594
595 int hw_atl2_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops);
596
597 int hw_atl2_utils_soft_reset(struct aq_hw_s *self);
598
599 u32 hw_atl2_utils_get_fw_version(struct aq_hw_s *self);
600
601 int hw_atl2_utils_get_action_resolve_table_caps(struct aq_hw_s *self,
602 u8 *base_index, u8 *count);
603
604 extern const struct aq_fw_ops aq_a2_fw_ops;
605
606 #endif /* HW_ATL2_UTILS_H */