From e8c37e204d040dcd86c5b7a2cd47f9d45ed68a51 Mon Sep 17 00:00:00 2001 From: jonathan Date: Thu, 1 Jun 2006 01:46:41 +0000 Subject: [PATCH] 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. --- sys/dev/pci/if_bge.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/dev/pci/if_bge.c b/sys/dev/pci/if_bge.c index c7d7a2219627..619d2ea4f3fc 100644 --- a/sys/dev/pci/if_bge.c +++ b/sys/dev/pci/if_bge.c @@ -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 -__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;