Module Name: src
Committed By: ryo
Date: Sat Nov 13 21:38:48 UTC 2021
Modified Files:
src/sys/dev/pci: if_aq.c
Log Message:
firmware ver1 doesn't seem to work with linkstat interrupt, so in this case
also set it to polling mode.
- Make the version acquisition (aq_fw_reset) timing earlier.
- Unmap registers when terminating with attach after failing to set interrupt
To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/pci/if_aq.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/if_aq.c
diff -u src/sys/dev/pci/if_aq.c:1.30 src/sys/dev/pci/if_aq.c:1.31
--- src/sys/dev/pci/if_aq.c:1.30 Thu Nov 11 06:56:56 2021
+++ src/sys/dev/pci/if_aq.c Sat Nov 13 21:38:48 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: if_aq.c,v 1.30 2021/11/11 06:56:56 ryo Exp $ */
+/* $NetBSD: if_aq.c,v 1.31 2021/11/13 21:38:48 ryo Exp $ */
/**
* aQuantia Corporation Network Driver
@@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.30 2021/11/11 06:56:56 ryo Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aq.c,v 1.31 2021/11/13 21:38:48 ryo Exp $");
#ifdef _KERNEL_OPT
#include "opt_if_aq.h"
@@ -1284,6 +1284,10 @@ aq_attach(device_t parent, device_t self
return;
}
+ error = aq_fw_reset(sc);
+ if (error != 0)
+ goto attach_failure;
+
sc->sc_nqueues = MIN(ncpu, AQ_RSSQUEUE_MAX);
/* max queue num is 8, and must be 2^n */
@@ -1325,8 +1329,9 @@ aq_attach(device_t parent, device_t self
sc->sc_msix = false;
}
- /* XXX: on FIBRE, linkstat interrupt does not occur on boot? */
- if (aqp->aq_media_type == AQ_MEDIA_TYPE_FIBRE)
+ /* on FW Ver1 or FIBRE, linkstat interrupt does not occur on boot? */
+ if (aqp->aq_media_type == AQ_MEDIA_TYPE_FIBRE ||
+ FW_VERSION_MAJOR(sc) == 1)
sc->sc_poll_linkstat = true;
#ifdef AQ_FORCE_POLL_LINKSTAT
@@ -1363,7 +1368,7 @@ aq_attach(device_t parent, device_t self
error = aq_setup_legacy(sc, pa, PCI_INTR_TYPE_INTX);
}
if (error != 0)
- return;
+ goto attach_failure;
callout_init(&sc->sc_tick_ch, 0);
callout_setfunc(&sc->sc_tick_ch, aq_tick, sc);
@@ -1379,10 +1384,6 @@ aq_attach(device_t parent, device_t self
if (error != 0)
goto attach_failure;
- error = aq_fw_reset(sc);
- if (error != 0)
- goto attach_failure;
-
error = aq_fw_version_init(sc);
if (error != 0)
goto attach_failure;