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