Fix a minor thinko in ascertaining whether or not a bge(4) device is

attached via PCI-Express:

The previous code first checked that the bge ASIC-revision matched the
5750 ASIC-revisoin (the bcm5721 has the same ASIC revision). However, the
bcm5752 is also a PCI-Express device, but has a different ASIC revision.
Thus, we were setting sc->bge_pcie to zero for bcm5752s, which in turn
causes bge_reset() to not perform required PCI-Express setup.

The test for a 5750 ASIC revision may (or may not) have been carried
across from the FreeBSD bge(4) driver. FreeBSD's bge(4) does not
properly detect or handle post-5750 bge devices. Instead, FreeBSD's
bge(4) keeps a sofc copy of the ASIC revision, and for post-5750
devices (5752, 5714, ...) overwrites that softc copy of the
ASIC-revision with the 5750 ASIC revision.  Thus, the test (mutatis
mutandis, using FreeBDS's softc asic-revision field), was correct for
FreeBSD; but manifestly incorrect for NetBSD.

Mark Davies (mark at mcs.vuw.ac..nz) has confirmed via private email
that this change fixes PR kern/kern/33509: his bcm5752 now works.
This commit is contained in:
jonathan 2006-06-01 01:46:41 +00:00
parent 4c3245cf01
commit e8c37e204d
1 changed files with 4 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: if_bge.c,v 1.107 2006/05/28 13:07:21 blymn Exp $ */
/* $NetBSD: if_bge.c,v 1.108 2006/06/01 01:46:41 jonathan Exp $ */
/*
* Copyright (c) 2001 Wind River Systems
@ -79,7 +79,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.107 2006/05/28 13:07:21 blymn Exp $");
__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.108 2006/06/01 01:46:41 jonathan Exp $");
#include "bpfilter.h"
#include "vlan.h"
@ -2406,9 +2406,8 @@ bge_attach(device_t parent, device_t self, void *aux)
* Detect PCI-Express devices
* XXX: guessed from Linux/FreeBSD; no documentation
*/
if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5750 &&
pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_PCIEXPRESS,
NULL, NULL) != 0)
if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_PCIEXPRESS,
NULL, NULL) != 0)
sc->bge_pcie = 1;
else
sc->bge_pcie = 0;