Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci Print some information (ASIC revision, PCI statu...
details: https://anonhg.NetBSD.org/src/rev/b181af80c52c
branches: trunk
changeset: 330261:b181af80c52c
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Tue Jul 01 17:11:35 2014 +0000
description:
Print some information (ASIC revision, PCI status, etc). From FreeBSD.
diffstat:
sys/dev/pci/if_bnx.c | 105 ++++++++++++++++++++++++++++++++++++++++++++++-
sys/dev/pci/if_bnxreg.h | 15 ++----
sys/dev/pci/if_bnxvar.h | 13 +++++-
3 files changed, 118 insertions(+), 15 deletions(-)
diffs (217 lines):
diff -r 8a2622a02c9b -r b181af80c52c sys/dev/pci/if_bnx.c
--- a/sys/dev/pci/if_bnx.c Tue Jul 01 16:29:57 2014 +0000
+++ b/sys/dev/pci/if_bnx.c Tue Jul 01 17:11:35 2014 +0000
@@ -1,8 +1,8 @@
-/* $NetBSD: if_bnx.c,v 1.55 2014/07/01 15:23:35 msaitoh Exp $ */
+/* $NetBSD: if_bnx.c,v 1.56 2014/07/01 17:11:35 msaitoh Exp $ */
/* $OpenBSD: if_bnx.c,v 1.85 2009/11/09 14:32:41 dlg Exp $ */
/*-
- * Copyright (c) 2006 Broadcom Corporation
+ * Copyright (c) 2006-2010 Broadcom Corporation
* David Christensen <davidch%broadcom.com@localhost>. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@
#if 0
__FBSDID("$FreeBSD: src/sys/dev/bce/if_bce.c,v 1.3 2006/04/13 14:12:26 ru Exp $");
#endif
-__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.55 2014/07/01 15:23:35 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bnx.c,v 1.56 2014/07/01 17:11:35 msaitoh Exp $");
/*
* The following controllers are supported by this driver:
@@ -360,6 +360,8 @@
struct fw_info *);
void bnx_init_cpus(struct bnx_softc *);
+static void bnx_print_adapter_info(struct bnx_softc *);
+static void bnx_probe_pci_caps(struct bnx_softc *);
void bnx_stop(struct ifnet *, int);
int bnx_reset(struct bnx_softc *, uint32_t);
int bnx_chipinit(struct bnx_softc *);
@@ -445,6 +447,99 @@
}
/****************************************************************************/
+/* PCI Capabilities Probe Function. */
+/* */
+/* Walks the PCI capabiites list for the device to find what features are */
+/* supported. */
+/* */
+/* Returns: */
+/* None. */
+/****************************************************************************/
+static void
+bnx_print_adapter_info(struct bnx_softc *sc)
+{
+
+ aprint_normal_dev(sc->bnx_dev, "ASIC BCM%x %c%d %s(0x%08x)\n",
+ BNXNUM(sc), 'A' + BNXREV(sc), BNXMETAL(sc),
+ (BNX_CHIP_BOND_ID(sc) == BNX_CHIP_BOND_ID_SERDES_BIT)
+ ? "Serdes " : "", sc->bnx_chipid);
+
+ /* Bus info. */
+ if (sc->bnx_flags & BNX_PCIE_FLAG) {
+ aprint_normal_dev(sc->bnx_dev, "PCIe x%d ",
+ sc->link_width);
+ switch (sc->link_speed) {
+ case 1: aprint_normal("2.5Gbps\n"); break;
+ case 2: aprint_normal("5Gbps\n"); break;
+ default: aprint_normal("Unknown link speed\n");
+ }
+ } else {
+ aprint_normal_dev(sc->bnx_dev, "PCI%s %dbit %dMHz\n",
+ ((sc->bnx_flags & BNX_PCIX_FLAG) ? "-X" : ""),
+ (sc->bnx_flags & BNX_PCI_32BIT_FLAG) ? 32 : 64,
+ sc->bus_speed_mhz);
+ }
+
+ aprint_normal_dev(sc->bnx_dev,
+ "Coal (RX:%d,%d,%d,%d; TX:%d,%d,%d,%d)\n",
+ sc->bnx_rx_quick_cons_trip_int,
+ sc->bnx_rx_quick_cons_trip,
+ sc->bnx_rx_ticks_int,
+ sc->bnx_rx_ticks,
+ sc->bnx_tx_quick_cons_trip_int,
+ sc->bnx_tx_quick_cons_trip,
+ sc->bnx_tx_ticks_int,
+ sc->bnx_tx_ticks);
+}
+
+
+/****************************************************************************/
+/* PCI Capabilities Probe Function. */
+/* */
+/* Walks the PCI capabiites list for the device to find what features are */
+/* supported. */
+/* */
+/* Returns: */
+/* None. */
+/****************************************************************************/
+static void
+bnx_probe_pci_caps(struct bnx_softc *sc)
+{
+ struct pci_attach_args *pa = &(sc->bnx_pa);
+ pcireg_t reg;
+
+ /* Check if PCI-X capability is enabled. */
+ if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_PCIX, ®,
+ NULL) != 0) {
+ sc->bnx_cap_flags |= BNX_PCIX_CAPABLE_FLAG;
+ }
+
+ /* Check if PCIe capability is enabled. */
+ if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_PCIEXPRESS, ®,
+ NULL) != 0) {
+ pcireg_t link_status = pci_conf_read(pa->pa_pc, pa->pa_tag,
+ reg + PCIE_LCSR);
+ DBPRINT(sc, BNX_INFO_LOAD, "PCIe link_status = "
+ "0x%08X\n", link_status);
+ sc->link_speed = (link_status & PCIE_LCSR_LINKSPEED) >> 16;
+ sc->link_width = (link_status & PCIE_LCSR_NLW) >> 20;
+ sc->bnx_cap_flags |= BNX_PCIE_CAPABLE_FLAG;
+ sc->bnx_flags |= BNX_PCIE_FLAG;
+ }
+
+ /* Check if MSI capability is enabled. */
+ if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_MSI, ®,
+ NULL) != 0)
+ sc->bnx_cap_flags |= BNX_MSI_CAPABLE_FLAG;
+
+ /* Check if MSI-X capability is enabled. */
+ if (pci_get_capability(pa->pa_pc, pa->pa_tag, PCI_CAP_MSIX, ®,
+ NULL) != 0)
+ sc->bnx_cap_flags |= BNX_MSIX_CAPABLE_FLAG;
+}
+
+
+/****************************************************************************/
/* Device attach function. */
/* */
/* Allocates device resources, performs secondary chip identification, */
@@ -552,6 +647,8 @@
sc->bnx_flags = 0;
sc->bnx_phy_flags = 0;
+ bnx_probe_pci_caps(sc);
+
/* Get PCI bus information (speed and type). */
val = REG_RD(sc, BNX_PCICFG_MISC_STATUS);
if (val & BNX_PCICFG_MISC_STATUS_PCIX_DET) {
@@ -755,6 +852,8 @@
else
aprint_error_dev(self, "couldn't establish power handler\n");
+ /* Finally, print some useful adapter info */
+ bnx_print_adapter_info(sc);
/* Print some important debugging info. */
DBRUN(BNX_INFO, bnx_dump_driver_state(sc));
diff -r 8a2622a02c9b -r b181af80c52c sys/dev/pci/if_bnxreg.h
--- a/sys/dev/pci/if_bnxreg.h Tue Jul 01 16:29:57 2014 +0000
+++ b/sys/dev/pci/if_bnxreg.h Tue Jul 01 17:11:35 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_bnxreg.h,v 1.17 2014/07/01 15:23:35 msaitoh Exp $ */
+/* $NetBSD: if_bnxreg.h,v 1.18 2014/07/01 17:11:35 msaitoh Exp $ */
/* $OpenBSD: if_bnxreg.h,v 1.33 2009/09/05 16:02:28 claudio Exp $ */
/*-
@@ -44,6 +44,7 @@
#define BNX_MFW_ENABLE_FLAG 0x40
#define BNX_ACTIVE_FLAG 0x80
#define BNX_ALLOC_PKTS_FLAG 0x100
+#define BNX_PCIE_FLAG 0x200
/* PHY specific flags -- bnx_phy_flags element in bnx_softc */
#define BNX_PHY_SERDES_FLAG 0x001
@@ -236,15 +237,9 @@
/* shorthand one */
-#define BNX_ASICREV(x) ((x) >> 28)
-#define BNX_ASICREV_BCM5700 0x06
-
-/* chip revisions */
-#define BNX_CHIPREV(x) ((x) >> 24)
-#define BNX_CHIPREV_5700_AX 0x70
-#define BNX_CHIPREV_5700_BX 0x71
-#define BNX_CHIPREV_5700_CX 0x72
-#define BNX_CHIPREV_5701_AX 0x00
+#define BNXNUM(sc) (BNX_CHIP_NUM(sc) >> 16)
+#define BNXREV(sc) (BNX_CHIP_REV(sc) >> 12)
+#define BNXMETAL(sc) (BNX_CHIP_METAL(sc) >> 4)
struct bnx_type {
uint16_t bnx_vid;
diff -r 8a2622a02c9b -r b181af80c52c sys/dev/pci/if_bnxvar.h
--- a/sys/dev/pci/if_bnxvar.h Tue Jul 01 16:29:57 2014 +0000
+++ b/sys/dev/pci/if_bnxvar.h Tue Jul 01 17:11:35 2014 +0000
@@ -135,6 +135,13 @@
/* General controller flags. */
uint32_t bnx_flags;
+ /* Controller capability flags. */
+ uint32_t bnx_cap_flags;
+#define BNX_MSI_CAPABLE_FLAG 0x00000001
+#define BNX_MSIX_CAPABLE_FLAG 0x00000002
+#define BNX_PCIE_CAPABLE_FLAG 0x00000004
+#define BNX_PCIX_CAPABLE_FLAG 0x00000008
+
/* PHY specific flags. */
uint32_t bnx_phy_flags;
@@ -143,9 +150,11 @@
uint32_t bnx_port_hw_cfg;
uint16_t bus_speed_mhz; /* PCI bus speed */
- struct flash_spec *bnx_flash_info; /* Flash NVRAM settings */
+ uint16_t link_width; /* PCIe link width */
+ uint16_t link_speed; /* PCIe link speed */
+ struct flash_spec *bnx_flash_info; /* Flash NVRAM settings */
uint32_t bnx_flash_size; /* Flash NVRAM size */
- uint32_t bnx_shmem_base; /* Shared Memory base address */
+ uint32_t bnx_shmem_base;/* Shared Memory base address */
char * bnx_name; /* Name string */
/* Tracks the version of bootcode firmware. */
Home |
Main Index |
Thread Index |
Old Index