1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /* Atlantic Network Driver
3 * Copyright (C) 2020 Marvell International Ltd.
6 #ifndef HW_ATL2_UTILS_H
7 #define HW_ATL2_UTILS_H
13 struct link_options_s
{
15 u8 link_renegotiate
:1;
16 u8 minimal_link_speed
:1;
17 u8 internal_loopback
:1;
18 u8 external_loopback
:1;
46 struct link_control_s
{
48 u8 disable_crc_corruption
:1;
49 u8 discard_short_frames
:1;
50 u8 flow_control_mode
:1;
51 u8 disable_length_check
:1;
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;
64 struct thermal_shutdown_s
{
69 u8 shutdown_temperature
;
71 u8 warning_temperature
;
74 struct mac_address_s
{
78 struct mac_address_aligned_s
{
79 struct mac_address_s aligned
;
83 struct sleep_proxy_s
{
84 struct wake_on_lan_s
{
85 u8 wake_on_magic_packet
:1;
88 u8 wake_on_link_down
:1;
97 u32 link_down_timeout
;
104 } wake_up_pattern
[8];
112 u8 ignore_fragmented
:1;
119 u32 ipv4_offload_addr
[8];
134 u32 ipv6_offload_addr
[16][4];
153 u8 remote_mac_addr
[6];
163 } ka4_connection
[16];
174 u8 remote_mac_addr
[6];
184 } ka6_connection
[16];
194 struct pause_quanta_s
{
209 struct data_buffer_status_s
{
214 struct device_caps_s
{
215 u8 finite_flashless
:1;
227 struct bundle_version_t
{
232 struct mac_version_t
{
237 struct phy_version_t
{
246 struct link_status_s
{
259 struct wol_status_s
{
263 u16 wake_up_packet_length
:12;
264 u16 wake_up_pattern_number
:3;
267 u32 wake_up_packet
[379];
270 struct mac_health_monitor_s
{
273 u8 mac_flashless_finished
:1;
282 struct phy_health_monitor_s
{
285 u8 phy_hot_warning
:1;
294 struct device_link_caps_s
{
296 u8 internal_loopback
:1;
297 u8 external_loopback
:1;
324 u8 downshift_retry
:4;
327 struct sleep_proxy_caps_s
{
330 u8 tcp_port_offload
:1;
331 u8 udp_port_offload
:1;
337 u8 wake_on_magic_packet
:1;
338 u8 wake_on_pattern
:1;
341 u8 wake_patterns_count
:4;
346 u8 tcp_port_offload_count
;
347 u8 udp_port_offload_count
;
360 struct lkp_link_caps_s
{
402 u32 mem_buffer
[0x1ff];
405 struct cable_diag_control_s
{
413 struct cable_diag_lane_data_s
{
420 struct cable_diag_status_s
{
421 struct cable_diag_lane_data_s lane_data
[4];
428 struct statistics_a0_s
{
435 u64 tx_unicast_octets
;
436 u64 tx_multicast_octets
;
437 u64 tx_broadcast_octets
;
438 u64 rx_unicast_octets
;
439 u64 rx_multicast_octets
;
440 u64 rx_broadcast_octets
;
442 u32 tx_unicast_frames
;
443 u32 tx_multicast_frames
;
444 u32 tx_broadcast_frames
;
447 u32 rx_unicast_frames
;
448 u32 rx_multicast_frames
;
449 u32 rx_broadcast_frames
;
450 u32 rx_dropped_frames
;
457 u32 main_loop_cycles
;
461 struct __packed statistics_b0_s
{
466 u64 rx_unicast_frames
;
467 u64 rx_multicast_frames
;
468 u64 rx_broadcast_frames
;
474 u64 tx_unicast_frames
;
475 u64 tx_multicast_frames
;
476 u64 tx_broadcast_frames
;
478 u32 main_loop_cycles
;
481 struct __packed statistics_s
{
483 struct statistics_a0_s a0
;
484 struct statistics_b0_s b0
;
488 struct filter_caps_s
{
489 u8 l2_filters_base_index
:6;
490 u8 flexible_filter_mask
:2;
492 u8 ethertype_filter_base_index
;
493 u8 ethertype_filter_count
;
495 u8 vlan_filter_base_index
;
496 u8 vlan_filter_count
;
497 u8 l3_ip4_filter_base_index
:4;
498 u8 l3_ip4_filter_count
:4;
499 u8 l3_ip6_filter_base_index
:4;
500 u8 l3_ip6_filter_count
:4;
502 u8 l4_filter_base_index
:4;
503 u8 l4_filter_count
:4;
504 u8 l4_flex_filter_base_index
:4;
505 u8 l4_flex_filter_count
:4;
506 u8 rslv_tbl_base_index
;
510 struct request_policy_s
{
514 u8 rx_queue_tc_index
:5;
521 u8 rx_queue_tc_index
:5;
528 u8 rx_queue_tc_index
:5;
535 struct fw_interface_in
{
538 struct mac_address_aligned_s mac_address
;
539 struct link_control_s link_control
;
541 struct link_options_s link_options
;
543 struct thermal_shutdown_s thermal_shutdown
;
545 struct sleep_proxy_s sleep_proxy
;
547 struct pause_quanta_s pause_quanta
[8];
548 struct cable_diag_control_s cable_diag_control
;
550 struct data_buffer_status_s data_buffer_status
;
552 struct request_policy_s request_policy
;
555 struct transaction_counter_s
{
556 u16 transaction_cnt_a
;
557 u16 transaction_cnt_b
;
560 struct management_status_s
{
561 struct mac_address_s mac_address
;
576 struct __packed fw_interface_out
{
577 struct transaction_counter_s transaction_id
;
578 struct version_s version
;
579 struct link_status_s link_status
;
580 struct wol_status_s wol_status
;
583 struct mac_health_monitor_s mac_health_monitor
;
586 struct phy_health_monitor_s phy_health_monitor
;
589 struct cable_diag_status_s cable_diag_status
;
591 struct device_link_caps_s device_link_caps
;
593 struct sleep_proxy_caps_s sleep_proxy_caps
;
595 struct lkp_link_caps_s lkp_link_caps
;
597 struct core_dump_s core_dump
;
599 struct statistics_s stats
;
600 struct filter_caps_s filter_caps
;
601 struct device_caps_s device_caps
;
603 struct management_status_s management_status
;
605 struct trace_s trace
;
608 #define AQ_A2_FW_LINK_RATE_INVALID 0
609 #define AQ_A2_FW_LINK_RATE_10M 1
610 #define AQ_A2_FW_LINK_RATE_100M 2
611 #define AQ_A2_FW_LINK_RATE_1G 3
612 #define AQ_A2_FW_LINK_RATE_2G5 4
613 #define AQ_A2_FW_LINK_RATE_5G 5
614 #define AQ_A2_FW_LINK_RATE_10G 6
616 #define AQ_HOST_MODE_INVALID 0U
617 #define AQ_HOST_MODE_ACTIVE 1U
618 #define AQ_HOST_MODE_SLEEP_PROXY 2U
619 #define AQ_HOST_MODE_LOW_POWER 3U
620 #define AQ_HOST_MODE_SHUTDOWN 4U
622 #define AQ_A2_FW_INTERFACE_A0 0
623 #define AQ_A2_FW_INTERFACE_B0 1
625 int hw_atl2_utils_initfw(struct aq_hw_s
*self
, const struct aq_fw_ops
**fw_ops
);
627 int hw_atl2_utils_soft_reset(struct aq_hw_s
*self
);
629 u32
hw_atl2_utils_get_fw_version(struct aq_hw_s
*self
);
631 int hw_atl2_utils_get_action_resolve_table_caps(struct aq_hw_s
*self
,
632 u8
*base_index
, u8
*count
);
634 extern const struct aq_fw_ops aq_a2_fw_ops
;
636 #endif /* HW_ATL2_UTILS_H */