Sat Feb 8 07:19:09 2020 UTC ()
constify


(maxv)
diff -r1.7 -r1.8 src/sys/dev/pci/if_aq.c

cvs diff -r1.7 -r1.8 src/sys/dev/pci/if_aq.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_aq.c 2020/02/04 05:44:14 1.7
+++ src/sys/dev/pci/if_aq.c 2020/02/08 07:19:09 1.8
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_aq.c,v 1.7 2020/02/04 05:44:14 thorpej Exp $ */ 1/* $NetBSD: if_aq.c,v 1.8 2020/02/08 07:19:09 maxv Exp $ */
2 2
3/** 3/**
4 * aQuantia Corporation Network Driver 4 * aQuantia Corporation Network Driver
5 * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved 5 * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
11 * (1) Redistributions of source code must retain the above 11 * (1) Redistributions of source code must retain the above
12 * copyright notice, this list of conditions and the following 12 * copyright notice, this list of conditions and the following
13 * disclaimer. 13 * disclaimer.
14 * 14 *
@@ -52,27 +52,27 @@ @@ -52,27 +52,27 @@
52 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 52 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
53 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 53 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
54 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 54 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
55 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 55 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
56 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 56 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
57 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 57 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
58 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 58 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
59 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 59 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
60 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 60 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
61 * POSSIBILITY OF SUCH DAMAGE. 61 * POSSIBILITY OF SUCH DAMAGE.
62 */ 62 */
63 63
64#include <sys/cdefs.h> 64#include <sys/cdefs.h>
65__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.7 2020/02/04 05:44:14 thorpej Exp $"); 65__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.8 2020/02/08 07:19:09 maxv Exp $");
66 66
67#ifdef _KERNEL_OPT 67#ifdef _KERNEL_OPT
68#include "opt_if_aq.h" 68#include "opt_if_aq.h"
69#include "sysmon_envsys.h" 69#include "sysmon_envsys.h"
70#endif 70#endif
71 71
72#include <sys/param.h> 72#include <sys/param.h>
73#include <sys/types.h> 73#include <sys/types.h>
74#include <sys/bitops.h> 74#include <sys/bitops.h>
75#include <sys/cprng.h> 75#include <sys/cprng.h>
76#include <sys/cpu.h> 76#include <sys/cpu.h>
77#include <sys/interrupt.h> 77#include <sys/interrupt.h>
78#include <sys/module.h> 78#include <sys/module.h>
@@ -963,27 +963,27 @@ struct aq_softc { @@ -963,27 +963,27 @@ struct aq_softc {
963 bool sc_msix; 963 bool sc_msix;
964 964
965 struct aq_queue sc_queue[AQ_RSSQUEUE_MAX]; 965 struct aq_queue sc_queue[AQ_RSSQUEUE_MAX];
966 int sc_nqueues; 966 int sc_nqueues;
967 967
968 pci_chipset_tag_t sc_pc; 968 pci_chipset_tag_t sc_pc;
969 pcitag_t sc_pcitag; 969 pcitag_t sc_pcitag;
970 uint16_t sc_product; 970 uint16_t sc_product;
971 uint16_t sc_revision; 971 uint16_t sc_revision;
972 972
973 kmutex_t sc_mutex; 973 kmutex_t sc_mutex;
974 kmutex_t sc_mpi_mutex; 974 kmutex_t sc_mpi_mutex;
975 975
976 struct aq_firmware_ops *sc_fw_ops; 976 const struct aq_firmware_ops *sc_fw_ops;
977 uint64_t sc_fw_caps; 977 uint64_t sc_fw_caps;
978 enum aq_media_type sc_media_type; 978 enum aq_media_type sc_media_type;
979 aq_link_speed_t sc_available_rates; 979 aq_link_speed_t sc_available_rates;
980 980
981 aq_link_speed_t sc_link_rate; 981 aq_link_speed_t sc_link_rate;
982 aq_link_fc_t sc_link_fc; 982 aq_link_fc_t sc_link_fc;
983 aq_link_eee_t sc_link_eee; 983 aq_link_eee_t sc_link_eee;
984 984
985 uint32_t sc_fw_version; 985 uint32_t sc_fw_version;
986#define FW_VERSION_MAJOR(sc) (((sc)->sc_fw_version >> 24) & 0xff) 986#define FW_VERSION_MAJOR(sc) (((sc)->sc_fw_version >> 24) & 0xff)
987#define FW_VERSION_MINOR(sc) (((sc)->sc_fw_version >> 16) & 0xff) 987#define FW_VERSION_MINOR(sc) (((sc)->sc_fw_version >> 16) & 0xff)
988#define FW_VERSION_BUILD(sc) ((sc)->sc_fw_version & 0xffff) 988#define FW_VERSION_BUILD(sc) ((sc)->sc_fw_version & 0xffff)
989 uint32_t sc_features; 989 uint32_t sc_features;
@@ -1103,37 +1103,37 @@ static int fw1x_get_mode(struct aq_softc @@ -1103,37 +1103,37 @@ static int fw1x_get_mode(struct aq_softc
1103 aq_link_speed_t *, aq_link_fc_t *, aq_link_eee_t *); 1103 aq_link_speed_t *, aq_link_fc_t *, aq_link_eee_t *);
1104static int fw1x_get_stats(struct aq_softc *, aq_hw_stats_s_t *); 1104static int fw1x_get_stats(struct aq_softc *, aq_hw_stats_s_t *);
1105 1105
1106static int fw2x_reset(struct aq_softc *); 1106static int fw2x_reset(struct aq_softc *);
1107static int fw2x_set_mode(struct aq_softc *, aq_hw_fw_mpi_state_t, 1107static int fw2x_set_mode(struct aq_softc *, aq_hw_fw_mpi_state_t,
1108 aq_link_speed_t, aq_link_fc_t, aq_link_eee_t); 1108 aq_link_speed_t, aq_link_fc_t, aq_link_eee_t);
1109static int fw2x_get_mode(struct aq_softc *, aq_hw_fw_mpi_state_t *, 1109static int fw2x_get_mode(struct aq_softc *, aq_hw_fw_mpi_state_t *,
1110 aq_link_speed_t *, aq_link_fc_t *, aq_link_eee_t *); 1110 aq_link_speed_t *, aq_link_fc_t *, aq_link_eee_t *);
1111static int fw2x_get_stats(struct aq_softc *, aq_hw_stats_s_t *); 1111static int fw2x_get_stats(struct aq_softc *, aq_hw_stats_s_t *);
1112#if NSYSMON_ENVSYS > 0 1112#if NSYSMON_ENVSYS > 0
1113static int fw2x_get_temperature(struct aq_softc *, uint32_t *); 1113static int fw2x_get_temperature(struct aq_softc *, uint32_t *);
1114#endif 1114#endif
1115 1115
1116static struct aq_firmware_ops aq_fw1x_ops = { 1116static const struct aq_firmware_ops aq_fw1x_ops = {
1117 .reset = fw1x_reset, 1117 .reset = fw1x_reset,
1118 .set_mode = fw1x_set_mode, 1118 .set_mode = fw1x_set_mode,
1119 .get_mode = fw1x_get_mode, 1119 .get_mode = fw1x_get_mode,
1120 .get_stats = fw1x_get_stats, 1120 .get_stats = fw1x_get_stats,
1121#if NSYSMON_ENVSYS > 0 1121#if NSYSMON_ENVSYS > 0
1122 .get_temperature = NULL 1122 .get_temperature = NULL
1123#endif 1123#endif
1124}; 1124};
1125 1125
1126static struct aq_firmware_ops aq_fw2x_ops = { 1126static const struct aq_firmware_ops aq_fw2x_ops = {
1127 .reset = fw2x_reset, 1127 .reset = fw2x_reset,
1128 .set_mode = fw2x_set_mode, 1128 .set_mode = fw2x_set_mode,
1129 .get_mode = fw2x_get_mode, 1129 .get_mode = fw2x_get_mode,
1130 .get_stats = fw2x_get_stats, 1130 .get_stats = fw2x_get_stats,
1131#if NSYSMON_ENVSYS > 0 1131#if NSYSMON_ENVSYS > 0
1132 .get_temperature = fw2x_get_temperature 1132 .get_temperature = fw2x_get_temperature
1133#endif 1133#endif
1134}; 1134};
1135 1135
1136CFATTACH_DECL3_NEW(aq, sizeof(struct aq_softc), 1136CFATTACH_DECL3_NEW(aq, sizeof(struct aq_softc),
1137 aq_match, aq_attach, aq_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN); 1137 aq_match, aq_attach, aq_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN);
1138 1138
1139static const struct aq_product { 1139static const struct aq_product {