xref: /freebsd/sys/dev/aq/aq_fw.h (revision 493d26c58e732dcfcdd87993ef71880adfe9d0cb)
1*493d26c5SEd Maste /**
2*493d26c5SEd Maste  * aQuantia Corporation Network Driver
3*493d26c5SEd Maste  * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
4*493d26c5SEd Maste  *
5*493d26c5SEd Maste  * Redistribution and use in source and binary forms, with or without
6*493d26c5SEd Maste  * modification, are permitted provided that the following conditions
7*493d26c5SEd Maste  * are met:
8*493d26c5SEd Maste  *
9*493d26c5SEd Maste  *   (1) Redistributions of source code must retain the above
10*493d26c5SEd Maste  *   copyright notice, this list of conditions and the following
11*493d26c5SEd Maste  *   disclaimer.
12*493d26c5SEd Maste  *
13*493d26c5SEd Maste  *   (2) Redistributions in binary form must reproduce the above
14*493d26c5SEd Maste  *   copyright notice, this list of conditions and the following
15*493d26c5SEd Maste  *   disclaimer in the documentation and/or other materials provided
16*493d26c5SEd Maste  *   with the distribution.
17*493d26c5SEd Maste  *
18*493d26c5SEd Maste  *   (3) The name of the author may not be used to endorse or promote
19*493d26c5SEd Maste  *   products derived from this software without specific prior
20*493d26c5SEd Maste  *   written permission.
21*493d26c5SEd Maste  *
22*493d26c5SEd Maste  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
23*493d26c5SEd Maste  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24*493d26c5SEd Maste  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25*493d26c5SEd Maste  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
26*493d26c5SEd Maste  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27*493d26c5SEd Maste  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
28*493d26c5SEd Maste  * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29*493d26c5SEd Maste  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
30*493d26c5SEd Maste  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31*493d26c5SEd Maste  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
32*493d26c5SEd Maste  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33*493d26c5SEd Maste  */
34*493d26c5SEd Maste #ifndef AQ_FW_H
35*493d26c5SEd Maste #define AQ_FW_H
36*493d26c5SEd Maste 
37*493d26c5SEd Maste struct aq_hw;
38*493d26c5SEd Maste 
39*493d26c5SEd Maste typedef enum aq_fw_link_speed
40*493d26c5SEd Maste {
41*493d26c5SEd Maste     aq_fw_none  = 0,
42*493d26c5SEd Maste     aq_fw_100M  = (1 << 0),
43*493d26c5SEd Maste     aq_fw_1G    = (1 << 1),
44*493d26c5SEd Maste     aq_fw_2G5   = (1 << 2),
45*493d26c5SEd Maste     aq_fw_5G    = (1 << 3),
46*493d26c5SEd Maste     aq_fw_10G   = (1 << 4),
47*493d26c5SEd Maste } aq_fw_link_speed_t;
48*493d26c5SEd Maste 
49*493d26c5SEd Maste typedef enum aq_fw_link_fc
50*493d26c5SEd Maste {
51*493d26c5SEd Maste     aq_fw_fc_none  = 0,
52*493d26c5SEd Maste     aq_fw_fc_ENABLE_RX = BIT(0),
53*493d26c5SEd Maste     aq_fw_fc_ENABLE_TX = BIT(1),
54*493d26c5SEd Maste     aq_fw_fc_ENABLE_ALL = aq_fw_fc_ENABLE_RX | aq_fw_fc_ENABLE_TX,
55*493d26c5SEd Maste } aq_fw_link_fc_t;
56*493d26c5SEd Maste 
57*493d26c5SEd Maste #define aq_fw_speed_auto (aq_fw_100M | aq_fw_1G | aq_fw_2G5 | aq_fw_5G | aq_fw_10G)
58*493d26c5SEd Maste 
59*493d26c5SEd Maste struct aq_firmware_ops
60*493d26c5SEd Maste {
61*493d26c5SEd Maste     int (*reset)(struct aq_hw* hal);
62*493d26c5SEd Maste 
63*493d26c5SEd Maste     int (*set_mode)(struct aq_hw* hal, enum aq_hw_fw_mpi_state_e mode, aq_fw_link_speed_t speed);
64*493d26c5SEd Maste     int (*get_mode)(struct aq_hw* hal, enum aq_hw_fw_mpi_state_e* mode, aq_fw_link_speed_t* speed, aq_fw_link_fc_t* fc);
65*493d26c5SEd Maste 
66*493d26c5SEd Maste     int (*get_mac_addr)(struct aq_hw* hal, u8* mac_addr);
67*493d26c5SEd Maste     int (*get_stats)(struct aq_hw* hal, struct aq_hw_stats_s* stats);
68*493d26c5SEd Maste 
69*493d26c5SEd Maste     int (*led_control)(struct aq_hw* hal, u32 mode);
70*493d26c5SEd Maste };
71*493d26c5SEd Maste 
72*493d26c5SEd Maste 
73*493d26c5SEd Maste int aq_fw_reset(struct aq_hw* hw);
74*493d26c5SEd Maste int aq_fw_ops_init(struct aq_hw* hw);
75*493d26c5SEd Maste 
76*493d26c5SEd Maste #endif // AQ_FW_H
77