net/atlantic: implement firmware operations
[dpdk.git] / drivers / net / atlantic / atl_types.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2018 Aquantia Corporation
3  */
4 #ifndef ATL_TYPES_H
5 #define ATL_TYPES_H
6
7 #include <stdint.h>
8 #include <stddef.h>
9 #include <inttypes.h>
10 #include <string.h>
11 #include <stdbool.h>
12
13
14 typedef uint8_t         u8;
15 typedef int8_t          s8;
16 typedef uint16_t        u16;
17 typedef int16_t         s16;
18 typedef uint32_t        u32;
19 typedef int32_t         s32;
20 typedef uint64_t        u64;
21
22 #define min(a, b)       RTE_MIN(a, b)
23 #define max(a, b)       RTE_MAX(a, b)
24
25 #include "hw_atl/hw_atl_utils.h"
26
27 struct aq_hw_link_status_s {
28         unsigned int mbps;
29 };
30
31 struct aq_stats_s {
32         u64 uprc;
33         u64 mprc;
34         u64 bprc;
35         u64 erpt;
36         u64 uptc;
37         u64 mptc;
38         u64 bptc;
39         u64 erpr;
40         u64 mbtc;
41         u64 bbtc;
42         u64 mbrc;
43         u64 bbrc;
44         u64 ubrc;
45         u64 ubtc;
46         u64 dpc;
47         u64 dma_pkt_rc;
48         u64 dma_pkt_tc;
49         u64 dma_oct_rc;
50         u64 dma_oct_tc;
51 };
52
53 struct aq_hw_cfg_s {
54         bool is_lro;
55         int wol;
56
57         int link_speed_msk;
58         int irq_type;
59         int irq_mask;
60         unsigned int vecs;
61
62         uint32_t flow_control;
63 };
64
65 struct aq_hw_s {
66         u8 rbl_enabled:1;
67         struct aq_hw_cfg_s *aq_nic_cfg;
68         const struct aq_fw_ops *aq_fw_ops;
69         void *mmio;
70
71         struct aq_hw_link_status_s aq_link_status;
72
73         struct hw_aq_atl_utils_mbox mbox;
74         struct hw_atl_stats_s last_stats;
75         struct aq_stats_s curr_stats;
76
77         unsigned int chip_features;
78         u32 fw_ver_actual;
79         u32 mbox_addr;
80         u32 rpc_addr;
81         u32 rpc_tid;
82         struct hw_aq_atl_utils_fw_rpc rpc;
83 };
84
85 struct aq_fw_ops {
86         int (*init)(struct aq_hw_s *self);
87
88         int (*deinit)(struct aq_hw_s *self);
89
90         int (*reset)(struct aq_hw_s *self);
91
92         int (*get_mac_permanent)(struct aq_hw_s *self, u8 *mac);
93
94         int (*set_link_speed)(struct aq_hw_s *self, u32 speed);
95
96         int (*set_state)(struct aq_hw_s *self,
97                         enum hal_atl_utils_fw_state_e state);
98
99         int (*update_link_status)(struct aq_hw_s *self);
100
101         int (*update_stats)(struct aq_hw_s *self);
102
103         int (*set_power)(struct aq_hw_s *self, unsigned int power_state,
104                         u8 *mac);
105
106         int (*get_temp)(struct aq_hw_s *self, int *temp);
107
108         int (*get_cable_len)(struct aq_hw_s *self, int *cable_len);
109
110         int (*set_eee_rate)(struct aq_hw_s *self, u32 speed);
111
112         int (*get_eee_rate)(struct aq_hw_s *self, u32 *rate,
113                         u32 *supported_rates);
114
115         int (*set_flow_control)(struct aq_hw_s *self);
116
117         int (*led_control)(struct aq_hw_s *self, u32 mode);
118
119         int (*get_eeprom)(struct aq_hw_s *self, u32 *data, u32 len);
120
121         int (*set_eeprom)(struct aq_hw_s *self, u32 *data, u32 len);
122 };
123
124 #endif