Thu Jun 9 12:04:30 2011 UTC ()
the BCM5785 is a PCIe chip but does not report PCIe capabilities.
Check for this chip explicitely and enable PCIe.
Fixes 'firmware handshake timeout'. Tested with root on nfs.

patch from msaitoh@


(cegger)
diff -r1.197 -r1.198 src/sys/dev/pci/if_bge.c

cvs diff -r1.197 -r1.198 src/sys/dev/pci/if_bge.c (expand / switch to unified diff)

--- src/sys/dev/pci/if_bge.c 2011/06/03 09:51:40 1.197
+++ src/sys/dev/pci/if_bge.c 2011/06/09 12:04:29 1.198
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: if_bge.c,v 1.197 2011/06/03 09:51:40 cegger Exp $ */ 1/* $NetBSD: if_bge.c,v 1.198 2011/06/09 12:04:29 cegger Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2001 Wind River Systems 4 * Copyright (c) 2001 Wind River Systems
5 * Copyright (c) 1997, 1998, 1999, 2001 5 * Copyright (c) 1997, 1998, 1999, 2001
6 * Bill Paul <wpaul@windriver.com>. All rights reserved. 6 * Bill Paul <wpaul@windriver.com>. All rights reserved.
7 * 7 *
8 * Redistribution and use in source and binary forms, with or without 8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions 9 * modification, are permitted provided that the following conditions
10 * are met: 10 * are met:
11 * 1. Redistributions of source code must retain the above copyright 11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer. 12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright 13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the 14 * notice, this list of conditions and the following disclaimer in the
@@ -69,27 +69,27 @@ @@ -69,27 +69,27 @@
69 * does not support external SSRAM. 69 * does not support external SSRAM.
70 * 70 *
71 * Broadcom also produces a variation of the BCM5700 under the "Altima" 71 * Broadcom also produces a variation of the BCM5700 under the "Altima"
72 * brand name, which is functionally similar but lacks PCI-X support. 72 * brand name, which is functionally similar but lacks PCI-X support.
73 * 73 *
74 * Without external SSRAM, you can only have at most 4 TX rings, 74 * Without external SSRAM, you can only have at most 4 TX rings,
75 * and the use of the mini RX ring is disabled. This seems to imply 75 * and the use of the mini RX ring is disabled. This seems to imply
76 * that these features are simply not available on the BCM5701. As a 76 * that these features are simply not available on the BCM5701. As a
77 * result, this driver does not implement any support for the mini RX 77 * result, this driver does not implement any support for the mini RX
78 * ring. 78 * ring.
79 */ 79 */
80 80
81#include <sys/cdefs.h> 81#include <sys/cdefs.h>
82__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.197 2011/06/03 09:51:40 cegger Exp $"); 82__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.198 2011/06/09 12:04:29 cegger Exp $");
83 83
84#include "vlan.h" 84#include "vlan.h"
85#include "rnd.h" 85#include "rnd.h"
86 86
87#include <sys/param.h> 87#include <sys/param.h>
88#include <sys/systm.h> 88#include <sys/systm.h>
89#include <sys/callout.h> 89#include <sys/callout.h>
90#include <sys/sockio.h> 90#include <sys/sockio.h>
91#include <sys/mbuf.h> 91#include <sys/mbuf.h>
92#include <sys/malloc.h> 92#include <sys/malloc.h>
93#include <sys/kernel.h> 93#include <sys/kernel.h>
94#include <sys/device.h> 94#include <sys/device.h>
95#include <sys/socket.h> 95#include <sys/socket.h>
@@ -2607,28 +2607,29 @@ bge_attach(device_t parent, device_t sel @@ -2607,28 +2607,29 @@ bge_attach(device_t parent, device_t sel
2607 else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57761 || 2607 else if (PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57761 ||
2608 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57765 || 2608 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57765 ||
2609 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57781 || 2609 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57781 ||
2610 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57785 || 2610 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57785 ||
2611 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57791 || 2611 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57791 ||
2612 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57795) 2612 PCI_PRODUCT(pa->pa_id) == PCI_PRODUCT_BROADCOM_BCM57795)
2613 sc->bge_chipid = pci_conf_read(pc, pa->pa_tag, 2613 sc->bge_chipid = pci_conf_read(pc, pa->pa_tag,
2614 BGE_PCI_GEN15_PRODID_ASICREV); 2614 BGE_PCI_GEN15_PRODID_ASICREV);
2615 else 2615 else
2616 sc->bge_chipid = pci_conf_read(pc, pa->pa_tag, 2616 sc->bge_chipid = pci_conf_read(pc, pa->pa_tag,
2617 BGE_PCI_PRODID_ASICREV); 2617 BGE_PCI_PRODID_ASICREV);
2618 } 2618 }
2619 2619
2620 if (pci_get_capability(sc->sc_pc, sc->sc_pcitag, PCI_CAP_PCIEXPRESS, 2620 if ((pci_get_capability(sc->sc_pc, sc->sc_pcitag, PCI_CAP_PCIEXPRESS,
2621 &sc->bge_pciecap, NULL) != 0) { 2621 &sc->bge_pciecap, NULL) != 0)
 2622 || (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5785)) {
2622 /* PCIe */ 2623 /* PCIe */
2623 sc->bge_flags |= BGE_PCIE; 2624 sc->bge_flags |= BGE_PCIE;
2624 bge_set_max_readrq(sc); 2625 bge_set_max_readrq(sc);
2625 } else if ((pci_conf_read(sc->sc_pc, sc->sc_pcitag, BGE_PCI_PCISTATE) & 2626 } else if ((pci_conf_read(sc->sc_pc, sc->sc_pcitag, BGE_PCI_PCISTATE) &
2626 BGE_PCISTATE_PCI_BUSMODE) == 0) { 2627 BGE_PCISTATE_PCI_BUSMODE) == 0) {
2627 /* PCI-X */ 2628 /* PCI-X */
2628 sc->bge_flags |= BGE_PCIX; 2629 sc->bge_flags |= BGE_PCIX;
2629 if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_PCIX, 2630 if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_PCIX,
2630 &sc->bge_pcixcap, NULL) == 0) 2631 &sc->bge_pcixcap, NULL) == 0)
2631 aprint_error_dev(sc->bge_dev, 2632 aprint_error_dev(sc->bge_dev,
2632 "unable to find PCIX capability\n"); 2633 "unable to find PCIX capability\n");
2633 } 2634 }
2634 2635