Lines Matching +full:buffered +full:- +full:positive

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
4 * Copyright (c) 2006-2014 QLogic Corporation
42 * BCM5706C A0, A1 (pre-production)
43 * BCM5706S A0, A1 (pre-production)
44 * BCM5708C A0, B0 (pre-production)
45 * BCM5708S A0, B0 (pre-production)
46 * BCM5709C A0 B0, B1, B2 (pre-production)
47 * BCM5709S A0, B0, B1, B2 (pre-production)
153 "QLogic NetXtreme II BCM5706 1000Base-T" },
159 "QLogic NetXtreme II BCM5706 1000Base-SX" },
169 "QLogic NetXtreme II BCM5708 1000Base-T" },
179 "QLogic NetXtreme II BCM5708 1000Base-SX" },
187 "QLogic NetXtreme II BCM5709 1000Base-T" },
191 "HP NC382m DP 1GbE Multifunction BL-c Adapter" },
195 "QLogic NetXtreme II BCM5709 1000Base-SX" },
199 "QLogic NetXtreme II BCM5716 1000Base-T" },
215 "EEPROM - slow"},
221 /* Saifun SA25F010 (non-buffered flash) */
226 "Non-buffered flash (128kB)"},
227 /* Saifun SA25F020 (non-buffered flash) */
232 "Non-buffered flash (256kB)"},
238 /* Entry 0101: ST M45PE10 (non-buffered flash, TetonII B0) */
242 "Entry 0101: ST M45PE10 (128kB non-buffered)"},
243 /* Entry 0110: ST M45PE20 (non-buffered flash)*/
247 "Entry 0110: ST M45PE20 (256kB non-buffered)"},
248 /* Saifun SA25F005 (non-buffered flash) */
253 "Non-buffered flash (64kB)"},
258 "EEPROM - fast"},
269 /* ATMEL AT45DB011B (buffered flash) */
273 "Buffered flash (128kB)"},
289 /* ATMEL AT45DB021B (buffered flash) */
293 "Buffered flash (256kB)"},
300 * logical-to-physical mapping is required in the
309 .name = "5709/5716 buffered flash (256kB)",
523 bce_devs, nitems(bce_devs) - 1);
541 /* Allowable values are 0 (IRQ), 1 (MSI/IRQ), and 2 (MSI-X/MSI/IRQ) */
542 /* ToDo: Add MSI-X support. */
545 "MSI-X|MSI|INTx selector");
667 /* BUS_PROBE_DEFAULT on success, positive value on failure. */
679 sc->bce_unit = device_get_unit(dev); in bce_probe()
680 sc->bce_dev = dev; in bce_probe()
693 while(t->bce_name != NULL) { in bce_probe()
694 if ((vid == t->bce_vid) && (did == t->bce_did) && in bce_probe()
695 ((svid == t->bce_svid) || (t->bce_svid == PCI_ANY_ID)) && in bce_probe()
696 ((sdid == t->bce_sdid) || (t->bce_sdid == PCI_ANY_ID))) { in bce_probe()
698 t->bce_name, (((pci_read_config(dev, in bce_probe()
726 BCE_PRINTF("ASIC (0x%08X); ", sc->bce_chipid); in bce_print_adapter_info()
731 if (sc->bce_flags & BCE_PCIE_FLAG) { in bce_print_adapter_info()
732 printf("Bus (PCIe x%d, ", sc->link_width); in bce_print_adapter_info()
733 switch (sc->link_speed) { in bce_print_adapter_info()
740 ((sc->bce_flags & BCE_PCIX_FLAG) ? "-X" : ""), in bce_print_adapter_info()
741 ((sc->bce_flags & BCE_PCI_32BIT_FLAG) ? in bce_print_adapter_info()
742 "32-bit" : "64-bit"), sc->bus_speed_mhz); in bce_print_adapter_info()
747 sc->bce_bc_ver, sc->rx_pages, sc->tx_pages, in bce_print_adapter_info()
748 (bce_hdr_split == TRUE ? sc->pg_pages: 0)); in bce_print_adapter_info()
755 if (sc->bce_flags & BCE_USING_MSI_FLAG) { in bce_print_adapter_info()
760 if (sc->bce_flags & BCE_USING_MSIX_FLAG) { in bce_print_adapter_info()
762 printf("MSI-X"); i++; in bce_print_adapter_info()
765 if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) { in bce_print_adapter_info()
770 if (sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) { in bce_print_adapter_info()
773 sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG ? in bce_print_adapter_info()
777 if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { in bce_print_adapter_info()
779 printf("MFW); MFW (%s)\n", sc->bce_mfw_ver); in bce_print_adapter_info()
785 sc->bce_rx_quick_cons_trip_int, in bce_print_adapter_info()
786 sc->bce_rx_quick_cons_trip, in bce_print_adapter_info()
787 sc->bce_rx_ticks_int, in bce_print_adapter_info()
788 sc->bce_rx_ticks, in bce_print_adapter_info()
789 sc->bce_tx_quick_cons_trip_int, in bce_print_adapter_info()
790 sc->bce_tx_quick_cons_trip, in bce_print_adapter_info()
791 sc->bce_tx_ticks_int, in bce_print_adapter_info()
792 sc->bce_tx_ticks); in bce_print_adapter_info()
814 /* Check if PCI-X capability is enabled. */ in bce_probe_pci_caps()
817 sc->bce_cap_flags |= BCE_PCIX_CAPABLE_FLAG; in bce_probe_pci_caps()
826 sc->link_speed = link_status & 0xf; in bce_probe_pci_caps()
827 sc->link_width = (link_status >> 4) & 0x3f; in bce_probe_pci_caps()
828 sc->bce_cap_flags |= BCE_PCIE_CAPABLE_FLAG; in bce_probe_pci_caps()
829 sc->bce_flags |= BCE_PCIE_FLAG; in bce_probe_pci_caps()
836 sc->bce_cap_flags |= BCE_MSI_CAPABLE_FLAG; in bce_probe_pci_caps()
839 /* Check if MSI-X capability is enabled. */ in bce_probe_pci_caps()
842 sc->bce_cap_flags |= BCE_MSIX_CAPABLE_FLAG; in bce_probe_pci_caps()
860 /* fall-through */ in bce_set_tunables()
862 /* fall-through */ in bce_set_tunables()
864 /* fall-through */ in bce_set_tunables()
866 sc->rx_pages = bce_rx_pages; in bce_set_tunables()
869 sc->rx_pages = DEFAULT_RX_PAGES; in bce_set_tunables()
876 sc->pg_pages = min((sc->rx_pages * 4), MAX_PG_PAGES); in bce_set_tunables()
881 /* fall-through */ in bce_set_tunables()
883 /* fall-through */ in bce_set_tunables()
885 /* fall-through */ in bce_set_tunables()
887 sc->tx_pages = bce_tx_pages; in bce_set_tunables()
890 sc->tx_pages = DEFAULT_TX_PAGES; in bce_set_tunables()
902 sc->bce_tx_quick_cons_trip_int = in bce_set_tunables()
909 sc->bce_tx_quick_cons_trip_int = in bce_set_tunables()
914 sc->bce_tx_quick_cons_trip = in bce_set_tunables()
921 sc->bce_tx_quick_cons_trip = in bce_set_tunables()
932 sc->bce_tx_ticks_int = in bce_set_tunables()
939 sc->bce_tx_ticks_int = in bce_set_tunables()
944 sc->bce_tx_ticks = in bce_set_tunables()
951 sc->bce_tx_ticks = in bce_set_tunables()
961 sc->bce_rx_quick_cons_trip_int = in bce_set_tunables()
968 sc->bce_rx_quick_cons_trip_int = in bce_set_tunables()
973 sc->bce_rx_quick_cons_trip = in bce_set_tunables()
980 sc->bce_rx_quick_cons_trip = in bce_set_tunables()
991 sc->bce_rx_ticks_int = bce_rx_ticks_int; in bce_set_tunables()
997 sc->bce_rx_ticks_int = DEFAULT_RX_TICKS_INT; in bce_set_tunables()
1001 sc->bce_rx_ticks = bce_rx_ticks; in bce_set_tunables()
1007 sc->bce_rx_ticks = DEFAULT_RX_TICKS; in bce_set_tunables()
1015 sc->bce_rx_ticks = DEFAULT_RX_TICKS; in bce_set_tunables()
1016 sc->bce_rx_quick_cons_trip = DEFAULT_RX_QUICK_CONS_TRIP; in bce_set_tunables()
1024 sc->bce_tx_ticks = DEFAULT_TX_TICKS; in bce_set_tunables()
1025 sc->bce_tx_quick_cons_trip = DEFAULT_TX_QUICK_CONS_TRIP; in bce_set_tunables()
1037 /* 0 on success, positive value on failure. */
1048 sc->bce_dev = dev; in bce_attach()
1052 sc->bce_unit = device_get_unit(dev); in bce_attach()
1055 sc->bce_flags = 0; in bce_attach()
1056 sc->bce_phy_flags = 0; in bce_attach()
1064 sc->bce_res_mem = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in bce_attach()
1067 if (sc->bce_res_mem == NULL) { in bce_attach()
1075 sc->bce_btag = rman_get_bustag(sc->bce_res_mem); in bce_attach()
1076 sc->bce_bhandle = rman_get_bushandle(sc->bce_res_mem); in bce_attach()
1077 sc->bce_vhandle = (vm_offset_t) rman_get_virtual(sc->bce_res_mem); in bce_attach()
1084 /* Try allocating MSI-X interrupts. */ in bce_attach()
1085 if ((sc->bce_cap_flags & BCE_MSIX_CAPABLE_FLAG) && in bce_attach()
1087 ((sc->bce_res_irq = bus_alloc_resource_any(dev, SYS_RES_MEMORY, in bce_attach()
1093 BCE_PRINTF("%s(%d): MSI-X allocation failed! Requested = %d," in bce_attach()
1099 sc->bce_res_irq); in bce_attach()
1100 sc->bce_res_irq = NULL; in bce_attach()
1102 DBPRINT(sc, BCE_INFO_LOAD, "%s(): Using MSI-X interrupt.\n", in bce_attach()
1104 sc->bce_flags |= BCE_USING_MSIX_FLAG; in bce_attach()
1110 if ((sc->bce_cap_flags & BCE_MSI_CAPABLE_FLAG) && in bce_attach()
1121 sc->bce_flags |= BCE_USING_MSI_FLAG; in bce_attach()
1123 sc->bce_flags |= BCE_ONE_SHOT_MSI_FLAG; in bce_attach()
1135 sc->bce_res_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, in bce_attach()
1139 if (sc->bce_res_irq == NULL) { in bce_attach()
1160 sc->bce_chipid = REG_RD(sc, BCE_MISC_ID); in bce_attach()
1162 /* Weed out any non-production controller revisions. */ in bce_attach()
1182 * The embedded PCIe to PCI-X bridge (EPB) in bce_attach()
1187 sc->max_bus_addr = BCE_BUS_SPACE_MAXADDR; in bce_attach()
1189 sc->max_bus_addr = BUS_SPACE_MAXADDR; in bce_attach()
1198 /* Multi-port devices use different offsets in shared memory. */ in bce_attach()
1199 sc->bce_shmem_base = REG_RD_IND(sc, BCE_SHM_HDR_ADDR_0 + in bce_attach()
1200 (pci_get_function(sc->bce_dev) << 2)); in bce_attach()
1202 sc->bce_shmem_base = HOST_VIEW_SHMEM_BASE; in bce_attach()
1205 __FUNCTION__, sc->bce_shmem_base); in bce_attach()
1212 num = (u8) (val >> (24 - (i * 8))); in bce_attach()
1215 sc->bce_bc_ver[j++] = (num / k) + '0'; in bce_attach()
1221 sc->bce_bc_ver[j++] = '.'; in bce_attach()
1227 sc->bce_flags |= BCE_MFW_ENABLE_FLAG; in bce_attach()
1249 memcpy(&sc->bce_mfw_ver[i], &val, 4); in bce_attach()
1256 strcpy(sc->bce_mfw_ver, "NOT RUNNING!"); in bce_attach()
1267 sc->bce_flags |= BCE_PCIX_FLAG; in bce_attach()
1274 sc->bus_speed_mhz = 133; in bce_attach()
1278 sc->bus_speed_mhz = 100; in bce_attach()
1283 sc->bus_speed_mhz = 66; in bce_attach()
1288 sc->bus_speed_mhz = 50; in bce_attach()
1294 sc->bus_speed_mhz = 33; in bce_attach()
1299 sc->bus_speed_mhz = 66; in bce_attach()
1301 sc->bus_speed_mhz = 33; in bce_attach()
1305 sc->bce_flags |= BCE_PCI_32BIT_FLAG; in bce_attach()
1338 sc->bce_stats_ticks = 1000000 & 0xffff00; in bce_attach()
1341 sc->bce_shared_hw_cfg = bce_shmem_rd(sc, BCE_SHARED_HW_CFG_CONFIG); in bce_attach()
1342 sc->bce_port_hw_cfg = bce_shmem_rd(sc, BCE_PORT_HW_CFG_CONFIG); in bce_attach()
1353 ifp = sc->bce_ifp = if_alloc(IFT_ETHER); in bce_attach()
1374 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) in bce_attach()
1385 (ETHER_MAX_LEN - ETHER_HDR_LEN - ETHER_CRC_LEN)); in bce_attach()
1391 if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) in bce_attach()
1399 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) { in bce_attach()
1400 ifmedia_init(&sc->bce_ifmedia, IFM_IMASK, bce_ifmedia_upd, in bce_attach()
1407 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) != 0) { in bce_attach()
1408 if (sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG) { in bce_attach()
1409 ifmedia_add(&sc->bce_ifmedia, in bce_attach()
1411 ifmedia_add(&sc->bce_ifmedia, in bce_attach()
1414 ifmedia_add(&sc->bce_ifmedia, in bce_attach()
1416 ifmedia_add(&sc->bce_ifmedia, in bce_attach()
1419 ifmedia_add(&sc->bce_ifmedia, in bce_attach()
1421 ifmedia_add(&sc->bce_ifmedia, in bce_attach()
1423 ifmedia_add(&sc->bce_ifmedia, in bce_attach()
1425 ifmedia_add(&sc->bce_ifmedia, in bce_attach()
1427 ifmedia_add(&sc->bce_ifmedia, in bce_attach()
1429 ifmedia_add(&sc->bce_ifmedia, in bce_attach()
1432 ifmedia_add(&sc->bce_ifmedia, IFM_ETHER | IFM_AUTO, 0, NULL); in bce_attach()
1433 ifmedia_set(&sc->bce_ifmedia, IFM_ETHER | IFM_AUTO); in bce_attach()
1434 sc->bce_ifmedia.ifm_media = sc->bce_ifmedia.ifm_cur->ifm_media; in bce_attach()
1437 rc = mii_attach(dev, &sc->bce_miibus, ifp, bce_ifmedia_upd, in bce_attach()
1438 bce_ifmedia_sts, BMSR_DEFCAPMASK, sc->bce_phy_addr, in bce_attach()
1448 ether_ifattach(ifp, sc->eaddr); in bce_attach()
1450 callout_init_mtx(&sc->bce_tick_callout, &sc->bce_mtx, 0); in bce_attach()
1451 callout_init_mtx(&sc->bce_pulse_callout, &sc->bce_mtx, 0); in bce_attach()
1454 rc = bus_setup_intr(dev, sc->bce_res_irq, INTR_TYPE_NET | INTR_MPSAFE, in bce_attach()
1455 NULL, bce_intr, sc, &sc->bce_intrhand); in bce_attach()
1512 /* 0 on success, positive value on failure. */
1523 ifp = sc->bce_ifp; in bce_detach()
1529 callout_stop(&sc->bce_pulse_callout); in bce_detach()
1532 if (sc->bce_flags & BCE_NO_WOL_FLAG) in bce_detach()
1543 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) in bce_detach()
1544 ifmedia_removeall(&sc->bce_ifmedia); in bce_detach()
1547 device_delete_child(dev, sc->bce_miibus); in bce_detach()
1564 /* 0 on success, positive value on failure. */
1576 if (sc->bce_flags & BCE_NO_WOL_FLAG) in bce_shutdown()
1638 /* reads but is much slower than memory-mapped I/O. */
1647 dev = sc->bce_dev; in bce_reg_rd_ind()
1668 /* writes but is muchh slower than memory-mapped I/O. */
1677 dev = sc->bce_dev; in bce_reg_wr_ind()
1700 bce_reg_wr_ind(sc, sc->bce_shmem_base + offset, val); in bce_shmem_wr()
1714 u32 val = bce_reg_rd_ind(sc, sc->bce_shmem_base + offset); in bce_shmem_rd()
1837 if ((sc->bce_phy_flags & BCE_PHY_IEEE_CLAUSE_45_FLAG) != 0) { in bce_miibus_read_reg()
1842 if (sc->bce_phy_flags & BCE_PHY_INT_MODE_AUTO_POLLING_FLAG) { in bce_miibus_read_reg()
1879 if (sc->bce_phy_flags & BCE_PHY_INT_MODE_AUTO_POLLING_FLAG) { in bce_miibus_read_reg()
1917 if ((sc->bce_phy_flags & BCE_PHY_IEEE_CLAUSE_45_FLAG) != 0) { in bce_miibus_write_reg()
1922 if (sc->bce_phy_flags & BCE_PHY_INT_MODE_AUTO_POLLING_FLAG) { in bce_miibus_write_reg()
1951 if (sc->bce_phy_flags & BCE_PHY_INT_MODE_AUTO_POLLING_FLAG) { in bce_miibus_write_reg()
1985 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) { in bce_miibus_statchg()
1991 mii = device_get_softc(sc->bce_miibus); in bce_miibus_statchg()
1992 media_active = mii->mii_media_active; in bce_miibus_statchg()
1993 media_status = mii->mii_media_status; in bce_miibus_statchg()
2015 /* fall-through */ in bce_miibus_statchg()
2023 /* fall-through */ in bce_miibus_statchg()
2038 "Setting Half-Duplex interface.\n"); in bce_miibus_statchg()
2042 "Setting Full-Duplex interface.\n"); in bce_miibus_statchg()
2050 sc->bce_flags |= BCE_USING_RX_FLOW_CONTROL; in bce_miibus_statchg()
2055 sc->bce_flags &= ~BCE_USING_RX_FLOW_CONTROL; in bce_miibus_statchg()
2062 sc->bce_flags |= BCE_USING_TX_FLOW_CONTROL; in bce_miibus_statchg()
2067 sc->bce_flags &= ~BCE_USING_TX_FLOW_CONTROL; in bce_miibus_statchg()
2084 /* 0 on success, positive value on failure. */
2121 /* 0 on success, positive value on failure. */
2160 /* 0 on success, positive value on failure. */
2173 if (!(sc->bce_flash_info->flags & BCE_NV_BUFFERED)) { in bce_enable_nvram_write()
2273 /* Non-buffered flash parts require that a page be erased before it is */
2277 /* 0 on success, positive value on failure. */
2287 /* Buffered flash doesn't require an erase. */ in bce_nvram_erase_page()
2288 if (sc->bce_flash_info->flags & BCE_NV_BUFFERED) in bce_nvram_erase_page()
2332 /* 0 on success and the 32 bit value read, positive value on failure. */
2346 /* Calculate the offset for buffered flash if translation is used. */ in bce_nvram_read_dword()
2347 if (sc->bce_flash_info->flags & BCE_NV_TRANSLATE) { in bce_nvram_read_dword()
2348 offset = ((offset / sc->bce_flash_info->page_size) << in bce_nvram_read_dword()
2349 sc->bce_flash_info->page_bits) + in bce_nvram_read_dword()
2350 (offset % sc->bce_flash_info->page_size); in bce_nvram_read_dword()
2397 /* 0 on success, positive value on failure. */
2411 /* Calculate the offset for buffered flash if translation is used. */ in bce_nvram_write_dword()
2412 if (sc->bce_flash_info->flags & BCE_NV_TRANSLATE) { in bce_nvram_write_dword()
2413 offset = ((offset / sc->bce_flash_info->page_size) << in bce_nvram_write_dword()
2414 sc->bce_flash_info->page_bits) + in bce_nvram_write_dword()
2415 (offset % sc->bce_flash_info->page_size); in bce_nvram_write_dword()
2419 * Clear the DONE bit separately, convert NVRAM data to big-endian, in bce_nvram_write_dword()
2454 /* 0 on success, positive value on failure. */
2466 sc->bce_flash_info = &flash_5709; in bce_init_nvram()
2491 (flash->config1 & FLASH_BACKUP_STRAP_MASK)) { in bce_init_nvram()
2492 sc->bce_flash_info = flash; in bce_init_nvram()
2511 if ((val & mask) == (flash->strapping & mask)) { in bce_init_nvram()
2513 sc->bce_flash_info = flash; in bce_init_nvram()
2521 REG_WR(sc, BCE_NVM_CFG1, flash->config1); in bce_init_nvram()
2522 REG_WR(sc, BCE_NVM_CFG2, flash->config2); in bce_init_nvram()
2523 REG_WR(sc, BCE_NVM_CFG3, flash->config3); in bce_init_nvram()
2524 REG_WR(sc, BCE_NVM_WRITE1, flash->write1); in bce_init_nvram()
2535 sc->bce_flash_info = NULL; in bce_init_nvram()
2547 sc->bce_flash_size = val; in bce_init_nvram()
2549 sc->bce_flash_size = sc->bce_flash_info->total_size; in bce_init_nvram()
2552 __FUNCTION__, sc->bce_flash_info->name, in bce_init_nvram()
2553 sc->bce_flash_info->total_size); in bce_init_nvram()
2566 /* 0 on success and the data read, positive value on failure. */
2598 pre_len = 4 - (offset & 3); in bce_nvram_read()
2617 len32 -= pre_len; in bce_nvram_read()
2621 extra = 4 - (len32 & 3); in bce_nvram_read()
2636 memcpy(ret_buf, buf, 4 - extra); in bce_nvram_read()
2652 len32 -= 4; in bce_nvram_read()
2660 len32 -= 4; in bce_nvram_read()
2669 memcpy(ret_buf, buf, 4 - extra); in bce_nvram_read()
2691 /* 0 on success, positive value on failure. */
2718 align_end = 4 - (len32 & 3); in bce_nvram_write()
2720 if ((rc = bce_nvram_read(sc, offset32 + len32 - 4, in bce_nvram_write()
2739 memcpy(buf + len32 - 4, end, 4); in bce_nvram_write()
2753 page_start -= (page_start % sc->bce_flash_info->page_size); in bce_nvram_write()
2755 page_end = page_start + sc->bce_flash_info->page_size; in bce_nvram_write()
2770 if (!(sc->bce_flash_info->flags & BCE_NV_BUFFERED)) { in bce_nvram_write()
2774 * (non-buffer flash only) */ in bce_nvram_write()
2775 for (j = 0; j < sc->bce_flash_info->page_size; j += 4) { in bce_nvram_write()
2776 if (j == (sc->bce_flash_info->page_size - 4)) { in bce_nvram_write()
2791 /* Enable writes to flash interface (unlock write-protect) */ in bce_nvram_write()
2799 /* Re-enable the write again for the actual write */ in bce_nvram_write()
2805 if (!(sc->bce_flash_info->flags & BCE_NV_BUFFERED)) { in bce_nvram_write()
2820 if ((addr == page_end - 4) || in bce_nvram_write()
2821 ((sc->bce_flash_info->flags & BCE_NV_BUFFERED) && in bce_nvram_write()
2822 (addr == data_end - 4))) { in bce_nvram_write()
2837 if (!(sc->bce_flash_info->flags & BCE_NV_BUFFERED)) { in bce_nvram_write()
2840 if (addr == page_end-4) { in bce_nvram_write()
2853 /* Disable writes to flash interface (lock write-protect) */ in bce_nvram_write()
2861 written += data_end - data_start; in bce_nvram_write()
2887 /* 0 on success, positive value on failure. */
2968 sc->rx_bd_mbuf_alloc_size = MHLEN; in bce_get_rx_buffer_sizes()
2970 sc->rx_bd_mbuf_align_pad = in bce_get_rx_buffer_sizes()
2971 roundup2(MSIZE - MHLEN, 16) - (MSIZE - MHLEN); in bce_get_rx_buffer_sizes()
2972 sc->rx_bd_mbuf_data_len = sc->rx_bd_mbuf_alloc_size - in bce_get_rx_buffer_sizes()
2973 sc->rx_bd_mbuf_align_pad; in bce_get_rx_buffer_sizes()
2978 sc->rx_bd_mbuf_alloc_size = MJUM9BYTES; in bce_get_rx_buffer_sizes()
2979 sc->rx_bd_mbuf_align_pad = in bce_get_rx_buffer_sizes()
2980 roundup2(MJUM9BYTES, 16) - MJUM9BYTES; in bce_get_rx_buffer_sizes()
2981 sc->rx_bd_mbuf_data_len = in bce_get_rx_buffer_sizes()
2982 sc->rx_bd_mbuf_alloc_size - in bce_get_rx_buffer_sizes()
2983 sc->rx_bd_mbuf_align_pad; in bce_get_rx_buffer_sizes()
2986 sc->rx_bd_mbuf_alloc_size = MCLBYTES; in bce_get_rx_buffer_sizes()
2987 sc->rx_bd_mbuf_align_pad = in bce_get_rx_buffer_sizes()
2988 roundup2(MCLBYTES, 16) - MCLBYTES; in bce_get_rx_buffer_sizes()
2989 sc->rx_bd_mbuf_data_len = in bce_get_rx_buffer_sizes()
2990 sc->rx_bd_mbuf_alloc_size - in bce_get_rx_buffer_sizes()
2991 sc->rx_bd_mbuf_align_pad; in bce_get_rx_buffer_sizes()
2999 sc->rx_bd_mbuf_alloc_size, sc->rx_bd_mbuf_data_len, in bce_get_rx_buffer_sizes()
3000 sc->rx_bd_mbuf_align_pad); in bce_get_rx_buffer_sizes()
3020 sc->bce_phy_addr = 1; in bce_get_media()
3038 sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG; in bce_get_media()
3049 if (pci_get_function(sc->bce_dev) == 0) { in bce_get_media()
3056 sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG; in bce_get_media()
3070 sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG; in bce_get_media()
3080 sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG; in bce_get_media()
3082 if (sc->bce_phy_flags & BCE_PHY_SERDES_FLAG) { in bce_get_media()
3083 sc->bce_flags |= BCE_NO_WOL_FLAG; in bce_get_media()
3086 sc->bce_phy_flags |= BCE_PHY_IEEE_CLAUSE_45_FLAG; in bce_get_media()
3090 sc->bce_phy_addr = 2; in bce_get_media()
3094 sc->bce_phy_flags |= in bce_get_media()
3102 sc->bce_phy_flags |= BCE_PHY_CRC_FIX_FLAG; in bce_get_media()
3106 "Using PHY address %d.\n", sc->bce_phy_addr); in bce_get_media()
3121 if ((sc->bce_phy_flags & (BCE_PHY_IEEE_CLAUSE_45_FLAG | in bce_init_media()
3130 /* Select auto-negotiation MMD of the PHY. */ in bce_init_media()
3131 bce_miibus_write_reg(sc->bce_dev, sc->bce_phy_addr, in bce_init_media()
3133 bce_miibus_write_reg(sc->bce_dev, sc->bce_phy_addr, in bce_init_media()
3137 bce_miibus_write_reg(sc->bce_dev, sc->bce_phy_addr, in bce_init_media()
3159 if (sc->status_block_paddr != 0) { in bce_dma_free()
3161 sc->status_tag, in bce_dma_free()
3162 sc->status_map); in bce_dma_free()
3163 sc->status_block_paddr = 0; in bce_dma_free()
3166 if (sc->status_block != NULL) { in bce_dma_free()
3168 sc->status_tag, in bce_dma_free()
3169 sc->status_block, in bce_dma_free()
3170 sc->status_map); in bce_dma_free()
3171 sc->status_block = NULL; in bce_dma_free()
3174 if (sc->status_tag != NULL) { in bce_dma_free()
3175 bus_dma_tag_destroy(sc->status_tag); in bce_dma_free()
3176 sc->status_tag = NULL; in bce_dma_free()
3180 if (sc->stats_block_paddr != 0) { in bce_dma_free()
3182 sc->stats_tag, in bce_dma_free()
3183 sc->stats_map); in bce_dma_free()
3184 sc->stats_block_paddr = 0; in bce_dma_free()
3187 if (sc->stats_block != NULL) { in bce_dma_free()
3189 sc->stats_tag, in bce_dma_free()
3190 sc->stats_block, in bce_dma_free()
3191 sc->stats_map); in bce_dma_free()
3192 sc->stats_block = NULL; in bce_dma_free()
3195 if (sc->stats_tag != NULL) { in bce_dma_free()
3196 bus_dma_tag_destroy(sc->stats_tag); in bce_dma_free()
3197 sc->stats_tag = NULL; in bce_dma_free()
3202 for (i = 0; i < sc->ctx_pages; i++ ) { in bce_dma_free()
3203 if (sc->ctx_paddr[i] != 0) { in bce_dma_free()
3205 sc->ctx_tag, in bce_dma_free()
3206 sc->ctx_map[i]); in bce_dma_free()
3207 sc->ctx_paddr[i] = 0; in bce_dma_free()
3210 if (sc->ctx_block[i] != NULL) { in bce_dma_free()
3212 sc->ctx_tag, in bce_dma_free()
3213 sc->ctx_block[i], in bce_dma_free()
3214 sc->ctx_map[i]); in bce_dma_free()
3215 sc->ctx_block[i] = NULL; in bce_dma_free()
3220 if (sc->ctx_tag != NULL) { in bce_dma_free()
3221 bus_dma_tag_destroy(sc->ctx_tag); in bce_dma_free()
3222 sc->ctx_tag = NULL; in bce_dma_free()
3227 for (i = 0; i < sc->tx_pages; i++ ) { in bce_dma_free()
3228 if (sc->tx_bd_chain_paddr[i] != 0) { in bce_dma_free()
3230 sc->tx_bd_chain_tag, in bce_dma_free()
3231 sc->tx_bd_chain_map[i]); in bce_dma_free()
3232 sc->tx_bd_chain_paddr[i] = 0; in bce_dma_free()
3235 if (sc->tx_bd_chain[i] != NULL) { in bce_dma_free()
3237 sc->tx_bd_chain_tag, in bce_dma_free()
3238 sc->tx_bd_chain[i], in bce_dma_free()
3239 sc->tx_bd_chain_map[i]); in bce_dma_free()
3240 sc->tx_bd_chain[i] = NULL; in bce_dma_free()
3245 if (sc->tx_bd_chain_tag != NULL) { in bce_dma_free()
3246 bus_dma_tag_destroy(sc->tx_bd_chain_tag); in bce_dma_free()
3247 sc->tx_bd_chain_tag = NULL; in bce_dma_free()
3251 for (i = 0; i < sc->rx_pages; i++ ) { in bce_dma_free()
3252 if (sc->rx_bd_chain_paddr[i] != 0) { in bce_dma_free()
3254 sc->rx_bd_chain_tag, in bce_dma_free()
3255 sc->rx_bd_chain_map[i]); in bce_dma_free()
3256 sc->rx_bd_chain_paddr[i] = 0; in bce_dma_free()
3259 if (sc->rx_bd_chain[i] != NULL) { in bce_dma_free()
3261 sc->rx_bd_chain_tag, in bce_dma_free()
3262 sc->rx_bd_chain[i], in bce_dma_free()
3263 sc->rx_bd_chain_map[i]); in bce_dma_free()
3264 sc->rx_bd_chain[i] = NULL; in bce_dma_free()
3269 if (sc->rx_bd_chain_tag != NULL) { in bce_dma_free()
3270 bus_dma_tag_destroy(sc->rx_bd_chain_tag); in bce_dma_free()
3271 sc->rx_bd_chain_tag = NULL; in bce_dma_free()
3276 for (i = 0; i < sc->pg_pages; i++ ) { in bce_dma_free()
3277 if (sc->pg_bd_chain_paddr[i] != 0) { in bce_dma_free()
3279 sc->pg_bd_chain_tag, in bce_dma_free()
3280 sc->pg_bd_chain_map[i]); in bce_dma_free()
3281 sc->pg_bd_chain_paddr[i] = 0; in bce_dma_free()
3284 if (sc->pg_bd_chain[i] != NULL) { in bce_dma_free()
3286 sc->pg_bd_chain_tag, in bce_dma_free()
3287 sc->pg_bd_chain[i], in bce_dma_free()
3288 sc->pg_bd_chain_map[i]); in bce_dma_free()
3289 sc->pg_bd_chain[i] = NULL; in bce_dma_free()
3294 if (sc->pg_bd_chain_tag != NULL) { in bce_dma_free()
3295 bus_dma_tag_destroy(sc->pg_bd_chain_tag); in bce_dma_free()
3296 sc->pg_bd_chain_tag = NULL; in bce_dma_free()
3302 if (sc->tx_mbuf_map[i] != NULL) { in bce_dma_free()
3303 bus_dmamap_unload(sc->tx_mbuf_tag, in bce_dma_free()
3304 sc->tx_mbuf_map[i]); in bce_dma_free()
3305 bus_dmamap_destroy(sc->tx_mbuf_tag, in bce_dma_free()
3306 sc->tx_mbuf_map[i]); in bce_dma_free()
3307 sc->tx_mbuf_map[i] = NULL; in bce_dma_free()
3312 if (sc->tx_mbuf_tag != NULL) { in bce_dma_free()
3313 bus_dma_tag_destroy(sc->tx_mbuf_tag); in bce_dma_free()
3314 sc->tx_mbuf_tag = NULL; in bce_dma_free()
3319 if (sc->rx_mbuf_map[i] != NULL) { in bce_dma_free()
3320 bus_dmamap_unload(sc->rx_mbuf_tag, in bce_dma_free()
3321 sc->rx_mbuf_map[i]); in bce_dma_free()
3322 bus_dmamap_destroy(sc->rx_mbuf_tag, in bce_dma_free()
3323 sc->rx_mbuf_map[i]); in bce_dma_free()
3324 sc->rx_mbuf_map[i] = NULL; in bce_dma_free()
3329 if (sc->rx_mbuf_tag != NULL) { in bce_dma_free()
3330 bus_dma_tag_destroy(sc->rx_mbuf_tag); in bce_dma_free()
3331 sc->rx_mbuf_tag = NULL; in bce_dma_free()
3337 if (sc->pg_mbuf_map[i] != NULL) { in bce_dma_free()
3338 bus_dmamap_unload(sc->pg_mbuf_tag, in bce_dma_free()
3339 sc->pg_mbuf_map[i]); in bce_dma_free()
3340 bus_dmamap_destroy(sc->pg_mbuf_tag, in bce_dma_free()
3341 sc->pg_mbuf_map[i]); in bce_dma_free()
3342 sc->pg_mbuf_map[i] = NULL; in bce_dma_free()
3347 if (sc->pg_mbuf_tag != NULL) { in bce_dma_free()
3348 bus_dma_tag_destroy(sc->pg_mbuf_tag); in bce_dma_free()
3349 sc->pg_mbuf_tag = NULL; in bce_dma_free()
3354 if (sc->parent_tag != NULL) { in bce_dma_free()
3355 bus_dma_tag_destroy(sc->parent_tag); in bce_dma_free()
3356 sc->parent_tag = NULL; in bce_dma_free()
3368 /* (bus_dmamap_load()) so we use the value of map_arg->maxsegs to pass any */
3391 *busaddr = segs->ds_addr; in bce_dma_map_addr()
3402 /* +-----------------+----------+----------+----------+----------+ */
3404 /* +-----------------+----------+----------+----------+----------+ */
3412 /* +-----------------+----------+----------+----------+----------+ */
3417 /* 0 for success, positive value for failure. */
3435 sc->max_bus_addr, BUS_SPACE_MAXADDR, NULL, NULL, in bce_dma_alloc()
3437 &sc->parent_tag)) { in bce_dma_alloc()
3449 if (bus_dma_tag_create(sc->parent_tag, BCE_DMA_ALIGN, in bce_dma_alloc()
3450 BCE_DMA_BOUNDARY, sc->max_bus_addr, BUS_SPACE_MAXADDR, in bce_dma_alloc()
3452 0, NULL, NULL, &sc->status_tag)) { in bce_dma_alloc()
3459 if(bus_dmamem_alloc(sc->status_tag, (void **)&sc->status_block, in bce_dma_alloc()
3461 &sc->status_map)) { in bce_dma_alloc()
3468 error = bus_dmamap_load(sc->status_tag, sc->status_map, in bce_dma_alloc()
3469 sc->status_block, BCE_STATUS_BLK_SZ, bce_dma_map_addr, in bce_dma_alloc()
3470 &sc->status_block_paddr, BUS_DMA_NOWAIT); in bce_dma_alloc()
3472 if (error || sc->status_block_paddr == 0) { in bce_dma_alloc()
3480 __FUNCTION__, (uintmax_t) sc->status_block_paddr); in bce_dma_alloc()
3487 if (bus_dma_tag_create(sc->parent_tag, BCE_DMA_ALIGN, in bce_dma_alloc()
3488 BCE_DMA_BOUNDARY, sc->max_bus_addr, BUS_SPACE_MAXADDR, in bce_dma_alloc()
3490 0, NULL, NULL, &sc->stats_tag)) { in bce_dma_alloc()
3497 if (bus_dmamem_alloc(sc->stats_tag, (void **)&sc->stats_block, in bce_dma_alloc()
3498 BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, &sc->stats_map)) { in bce_dma_alloc()
3505 error = bus_dmamap_load(sc->stats_tag, sc->stats_map, in bce_dma_alloc()
3506 sc->stats_block, BCE_STATS_BLK_SZ, bce_dma_map_addr, in bce_dma_alloc()
3507 &sc->stats_block_paddr, BUS_DMA_NOWAIT); in bce_dma_alloc()
3509 if (error || sc->stats_block_paddr == 0) { in bce_dma_alloc()
3517 __FUNCTION__, (uintmax_t) sc->stats_block_paddr); in bce_dma_alloc()
3521 sc->ctx_pages = 0x2000 / BCM_PAGE_SIZE; in bce_dma_alloc()
3522 if (sc->ctx_pages == 0) in bce_dma_alloc()
3523 sc->ctx_pages = 1; in bce_dma_alloc()
3525 DBRUNIF((sc->ctx_pages > 512), in bce_dma_alloc()
3527 __FILE__, __LINE__, sc->ctx_pages)); in bce_dma_alloc()
3535 if(bus_dma_tag_create(sc->parent_tag, BCM_PAGE_SIZE, in bce_dma_alloc()
3536 BCE_DMA_BOUNDARY, sc->max_bus_addr, BUS_SPACE_MAXADDR, in bce_dma_alloc()
3538 0, NULL, NULL, &sc->ctx_tag)) { in bce_dma_alloc()
3545 for (i = 0; i < sc->ctx_pages; i++) { in bce_dma_alloc()
3546 if(bus_dmamem_alloc(sc->ctx_tag, in bce_dma_alloc()
3547 (void **)&sc->ctx_block[i], in bce_dma_alloc()
3549 &sc->ctx_map[i])) { in bce_dma_alloc()
3556 error = bus_dmamap_load(sc->ctx_tag, sc->ctx_map[i], in bce_dma_alloc()
3557 sc->ctx_block[i], BCM_PAGE_SIZE, bce_dma_map_addr, in bce_dma_alloc()
3558 &sc->ctx_paddr[i], BUS_DMA_NOWAIT); in bce_dma_alloc()
3560 if (error || sc->ctx_paddr[i] == 0) { in bce_dma_alloc()
3569 (uintmax_t) sc->ctx_paddr[i]); in bce_dma_alloc()
3578 if(bus_dma_tag_create(sc->parent_tag, BCM_PAGE_SIZE, BCE_DMA_BOUNDARY, in bce_dma_alloc()
3579 sc->max_bus_addr, BUS_SPACE_MAXADDR, NULL, NULL, in bce_dma_alloc()
3581 NULL, NULL, &sc->tx_bd_chain_tag)) { in bce_dma_alloc()
3588 for (i = 0; i < sc->tx_pages; i++) { in bce_dma_alloc()
3589 if(bus_dmamem_alloc(sc->tx_bd_chain_tag, in bce_dma_alloc()
3590 (void **)&sc->tx_bd_chain[i], in bce_dma_alloc()
3592 &sc->tx_bd_chain_map[i])) { in bce_dma_alloc()
3599 error = bus_dmamap_load(sc->tx_bd_chain_tag, in bce_dma_alloc()
3600 sc->tx_bd_chain_map[i], sc->tx_bd_chain[i], in bce_dma_alloc()
3602 &sc->tx_bd_chain_paddr[i], BUS_DMA_NOWAIT); in bce_dma_alloc()
3604 if (error || sc->tx_bd_chain_paddr[i] == 0) { in bce_dma_alloc()
3613 (uintmax_t) sc->tx_bd_chain_paddr[i]); in bce_dma_alloc()
3628 if (bus_dma_tag_create(sc->parent_tag, 1, BCE_DMA_BOUNDARY, in bce_dma_alloc()
3629 sc->max_bus_addr, BUS_SPACE_MAXADDR, NULL, NULL, max_size, in bce_dma_alloc()
3630 max_segments, max_seg_size, 0, NULL, NULL, &sc->tx_mbuf_tag)) { in bce_dma_alloc()
3639 if (bus_dmamap_create(sc->tx_mbuf_tag, BUS_DMA_NOWAIT, in bce_dma_alloc()
3640 &sc->tx_mbuf_map[i])) { in bce_dma_alloc()
3653 if (bus_dma_tag_create(sc->parent_tag, BCM_PAGE_SIZE, in bce_dma_alloc()
3655 sc->max_bus_addr, NULL, NULL, in bce_dma_alloc()
3657 0, NULL, NULL, &sc->rx_bd_chain_tag)) { in bce_dma_alloc()
3664 for (i = 0; i < sc->rx_pages; i++) { in bce_dma_alloc()
3665 if (bus_dmamem_alloc(sc->rx_bd_chain_tag, in bce_dma_alloc()
3666 (void **)&sc->rx_bd_chain[i], in bce_dma_alloc()
3668 &sc->rx_bd_chain_map[i])) { in bce_dma_alloc()
3675 error = bus_dmamap_load(sc->rx_bd_chain_tag, in bce_dma_alloc()
3676 sc->rx_bd_chain_map[i], sc->rx_bd_chain[i], in bce_dma_alloc()
3678 &sc->rx_bd_chain_paddr[i], BUS_DMA_NOWAIT); in bce_dma_alloc()
3680 if (error || sc->rx_bd_chain_paddr[i] == 0) { in bce_dma_alloc()
3689 (uintmax_t) sc->rx_bd_chain_paddr[i]); in bce_dma_alloc()
3696 max_size = ((sc->rx_bd_mbuf_alloc_size < MCLBYTES) ? in bce_dma_alloc()
3697 MCLBYTES : sc->rx_bd_mbuf_alloc_size); in bce_dma_alloc()
3704 if (bus_dma_tag_create(sc->parent_tag, BCE_RX_BUF_ALIGN, in bce_dma_alloc()
3705 BCE_DMA_BOUNDARY, sc->max_bus_addr, BUS_SPACE_MAXADDR, NULL, NULL, in bce_dma_alloc()
3706 max_size, 1, max_size, 0, NULL, NULL, &sc->rx_mbuf_tag)) { in bce_dma_alloc()
3715 if (bus_dmamap_create(sc->rx_mbuf_tag, BUS_DMA_NOWAIT, in bce_dma_alloc()
3716 &sc->rx_mbuf_map[i])) { in bce_dma_alloc()
3730 if (bus_dma_tag_create(sc->parent_tag, BCM_PAGE_SIZE, in bce_dma_alloc()
3731 BCE_DMA_BOUNDARY, BUS_SPACE_MAXADDR, sc->max_bus_addr, in bce_dma_alloc()
3733 0, NULL, NULL, &sc->pg_bd_chain_tag)) { in bce_dma_alloc()
3740 for (i = 0; i < sc->pg_pages; i++) { in bce_dma_alloc()
3741 if (bus_dmamem_alloc(sc->pg_bd_chain_tag, in bce_dma_alloc()
3742 (void **)&sc->pg_bd_chain[i], in bce_dma_alloc()
3744 &sc->pg_bd_chain_map[i])) { in bce_dma_alloc()
3752 error = bus_dmamap_load(sc->pg_bd_chain_tag, in bce_dma_alloc()
3753 sc->pg_bd_chain_map[i], sc->pg_bd_chain[i], in bce_dma_alloc()
3755 &sc->pg_bd_chain_paddr[i], BUS_DMA_NOWAIT); in bce_dma_alloc()
3757 if (error || sc->pg_bd_chain_paddr[i] == 0) { in bce_dma_alloc()
3766 (uintmax_t) sc->pg_bd_chain_paddr[i]); in bce_dma_alloc()
3772 if (bus_dma_tag_create(sc->parent_tag, 1, BCE_DMA_BOUNDARY, in bce_dma_alloc()
3773 sc->max_bus_addr, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, in bce_dma_alloc()
3774 1, MCLBYTES, 0, NULL, NULL, &sc->pg_mbuf_tag)) { in bce_dma_alloc()
3783 if (bus_dmamap_create(sc->pg_mbuf_tag, BUS_DMA_NOWAIT, in bce_dma_alloc()
3784 &sc->pg_mbuf_map[i])) { in bce_dma_alloc()
3814 dev = sc->bce_dev; in bce_release_resources()
3818 if (sc->bce_intrhand != NULL) { in bce_release_resources()
3820 bus_teardown_intr(dev, sc->bce_res_irq, sc->bce_intrhand); in bce_release_resources()
3823 if (sc->bce_res_irq != NULL) { in bce_release_resources()
3826 rman_get_rid(sc->bce_res_irq), sc->bce_res_irq); in bce_release_resources()
3829 if (sc->bce_flags & (BCE_USING_MSI_FLAG | BCE_USING_MSIX_FLAG)) { in bce_release_resources()
3830 DBPRINT(sc, BCE_INFO_RESET, "Releasing MSI/MSI-X vector.\n"); in bce_release_resources()
3834 if (sc->bce_res_mem != NULL) { in bce_release_resources()
3837 sc->bce_res_mem); in bce_release_resources()
3840 if (sc->bce_ifp != NULL) { in bce_release_resources()
3842 if_free(sc->bce_ifp); in bce_release_resources()
3845 if (mtx_initialized(&sc->bce_mtx)) in bce_release_resources()
3858 /* 0 for success, positive value for failure. */
3869 if (sc->bce_fw_timed_out == TRUE) { in bce_fw_sync()
3875 sc->bce_fw_wr_seq++; in bce_fw_sync()
3876 msg_data |= sc->bce_fw_wr_seq; in bce_fw_sync()
3904 sc->bce_fw_timed_out = TRUE; in bce_fw_sync()
3949 /* Reset the processor, un-stall is done later. */ in bce_load_rv2p_fw()
3980 offset = cpu_reg->spad_base + (fw->text_addr - cpu_reg->mips_view_base); in bce_load_cpu_fw()
3981 if (fw->text) { in bce_load_cpu_fw()
3984 for (j = 0; j < (fw->text_len / 4); j++, offset += 4) { in bce_load_cpu_fw()
3985 REG_WR_IND(sc, offset, fw->text[j]); in bce_load_cpu_fw()
3990 offset = cpu_reg->spad_base + (fw->data_addr - cpu_reg->mips_view_base); in bce_load_cpu_fw()
3991 if (fw->data) { in bce_load_cpu_fw()
3994 for (j = 0; j < (fw->data_len / 4); j++, offset += 4) { in bce_load_cpu_fw()
3995 REG_WR_IND(sc, offset, fw->data[j]); in bce_load_cpu_fw()
4000 offset = cpu_reg->spad_base + (fw->sbss_addr - cpu_reg->mips_view_base); in bce_load_cpu_fw()
4001 if (fw->sbss) { in bce_load_cpu_fw()
4004 for (j = 0; j < (fw->sbss_len / 4); j++, offset += 4) { in bce_load_cpu_fw()
4005 REG_WR_IND(sc, offset, fw->sbss[j]); in bce_load_cpu_fw()
4010 offset = cpu_reg->spad_base + (fw->bss_addr - cpu_reg->mips_view_base); in bce_load_cpu_fw()
4011 if (fw->bss) { in bce_load_cpu_fw()
4014 for (j = 0; j < (fw->bss_len/4); j++, offset += 4) { in bce_load_cpu_fw()
4015 REG_WR_IND(sc, offset, fw->bss[j]); in bce_load_cpu_fw()
4019 /* Load the Read-Only area. */ in bce_load_cpu_fw()
4020 offset = cpu_reg->spad_base + in bce_load_cpu_fw()
4021 (fw->rodata_addr - cpu_reg->mips_view_base); in bce_load_cpu_fw()
4022 if (fw->rodata) { in bce_load_cpu_fw()
4025 for (j = 0; j < (fw->rodata_len / 4); j++, offset += 4) { in bce_load_cpu_fw()
4026 REG_WR_IND(sc, offset, fw->rodata[j]); in bce_load_cpu_fw()
4030 /* Clear the pre-fetch instruction and set the FW start address. */ in bce_load_cpu_fw()
4031 REG_WR_IND(sc, cpu_reg->inst, 0); in bce_load_cpu_fw()
4032 REG_WR_IND(sc, cpu_reg->pc, fw->start_addr); in bce_load_cpu_fw()
4053 val = REG_RD_IND(sc, cpu_reg->mode); in bce_start_cpu()
4054 val &= ~cpu_reg->mode_value_halt; in bce_start_cpu()
4055 REG_WR_IND(sc, cpu_reg->state, cpu_reg->state_value_clear); in bce_start_cpu()
4056 REG_WR_IND(sc, cpu_reg->mode, val); in bce_start_cpu()
4075 val = REG_RD_IND(sc, cpu_reg->mode); in bce_halt_cpu()
4076 val |= cpu_reg->mode_value_halt; in bce_halt_cpu()
4077 REG_WR_IND(sc, cpu_reg->mode, val); in bce_halt_cpu()
4078 REG_WR_IND(sc, cpu_reg->state, cpu_reg->state_value_clear); in bce_halt_cpu()
4667 val |= (BCM_PAGE_BITS - 8) << 16; in bce_init_ctx()
4684 for (i = 0; i < sc->ctx_pages; i++) { in bce_init_ctx()
4687 BCE_ADDR_LO(sc->ctx_paddr[i] & 0xfffffff0) | in bce_init_ctx()
4690 BCE_ADDR_HI(sc->ctx_paddr[i])); in bce_init_ctx()
4720 vcid_addr -= PHY_CTX_SIZE; in bce_init_ctx()
4753 * power-on and runtime configuration items in a in bce_get_mac_addr()
4767 sc->eaddr[0] = (u_char)(mac_hi >> 8); in bce_get_mac_addr()
4768 sc->eaddr[1] = (u_char)(mac_hi >> 0); in bce_get_mac_addr()
4769 sc->eaddr[2] = (u_char)(mac_lo >> 24); in bce_get_mac_addr()
4770 sc->eaddr[3] = (u_char)(mac_lo >> 16); in bce_get_mac_addr()
4771 sc->eaddr[4] = (u_char)(mac_lo >> 8); in bce_get_mac_addr()
4772 sc->eaddr[5] = (u_char)(mac_lo >> 0); in bce_get_mac_addr()
4776 "address = %6D\n", sc->eaddr, ":"); in bce_get_mac_addr()
4790 u8 *mac_addr = sc->eaddr; in bce_set_mac_addr()
4796 "%6D\n", sc->eaddr, ":"); in bce_set_mac_addr()
4825 ifp = sc->bce_ifp; in bce_stop()
4827 callout_stop(&sc->bce_tick_callout); in bce_stop()
4845 sc->watchdog_timer = 0; in bce_stop()
4847 sc->bce_link_up = FALSE; in bce_stop()
4870 * been auto-negotiated. Resetting the chip will clobber those in bce_reset()
4893 sc->bce_fw_timed_out = FALSE; in bce_reset()
4894 sc->bce_drv_cardiac_arrest = FALSE; in bce_reset()
4916 pci_write_config(sc->bce_dev, BCE_PCICFG_MISC_CONFIG, val, 4); in bce_reset()
4953 sc->bce_fw_timed_out = FALSE; in bce_reset()
4954 sc->bce_drv_cardiac_arrest = FALSE; in bce_reset()
5001 if ((sc->bce_flags & BCE_PCIX_FLAG) && (sc->bus_speed_mhz == 133)) in bce_chipinit()
5011 !(sc->bce_flags & BCE_PCIX_FLAG)) in bce_chipinit()
5026 /* Initialize the on-boards CPUs */ in bce_chipinit()
5029 /* Enable management frames (NC-SI) to flow to the MCP. */ in bce_chipinit()
5030 if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { in bce_chipinit()
5058 val = (BCM_PAGE_BITS - 8) << 24; in bce_chipinit()
5064 val |= (BCM_PAGE_BITS - 8) << 24 | 0x40; in bce_chipinit()
5080 /* 0 for success, positive value for failure. */
5094 val = sc->eaddr[0] + (sc->eaddr[1] << 8) + in bce_blockinit()
5095 (sc->eaddr[2] << 16) + (sc->eaddr[3] ) + in bce_blockinit()
5096 (sc->eaddr[4] << 8) + (sc->eaddr[5] << 16); in bce_blockinit()
5099 sc->last_status_idx = 0; in bce_blockinit()
5100 sc->rx_mode = BCE_EMAC_RX_MODE_SORT_MODE; in bce_blockinit()
5107 BCE_ADDR_LO(sc->status_block_paddr)); in bce_blockinit()
5109 BCE_ADDR_HI(sc->status_block_paddr)); in bce_blockinit()
5113 BCE_ADDR_LO(sc->stats_block_paddr)); in bce_blockinit()
5115 BCE_ADDR_HI(sc->stats_block_paddr)); in bce_blockinit()
5124 (sc->bce_tx_quick_cons_trip_int << 16) | in bce_blockinit()
5125 sc->bce_tx_quick_cons_trip); in bce_blockinit()
5127 (sc->bce_rx_quick_cons_trip_int << 16) | in bce_blockinit()
5128 sc->bce_rx_quick_cons_trip); in bce_blockinit()
5130 (sc->bce_tx_ticks_int << 16) | sc->bce_tx_ticks); in bce_blockinit()
5132 (sc->bce_rx_ticks_int << 16) | sc->bce_rx_ticks); in bce_blockinit()
5133 REG_WR(sc, BCE_HC_STATS_TICKS, sc->bce_stats_ticks & 0xffff00); in bce_blockinit()
5145 /* ToDo: Add MSI-X support. */ in bce_blockinit()
5146 if (sc->bce_flags & BCE_USING_MSIX_FLAG) { in bce_blockinit()
5147 u32 base = ((BCE_TX_VEC - 1) * BCE_HC_SB_CONFIG_SIZE) + in bce_blockinit()
5156 (sc->tx_quick_cons_trip_int << 16) | in bce_blockinit()
5157 sc->tx_quick_cons_trip); in bce_blockinit()
5160 (sc->tx_ticks_int << 16) | sc->tx_ticks); in bce_blockinit()
5167 * INT_MASK bit after an MSI/MSI-X interrupt in bce_blockinit()
5170 if (sc->bce_flags & BCE_ONE_SHOT_MSI_FLAG) in bce_blockinit()
5173 /* Set the MSI-X status blocks to 128 byte boundaries. */ in bce_blockinit()
5174 if (sc->bce_flags & BCE_USING_MSIX_FLAG) in bce_blockinit()
5218 /* Disable management frames (NC-SI) from flowing to the MCP. */ in bce_blockinit()
5219 if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { in bce_blockinit()
5237 sc->hc_command = REG_RD(sc, BCE_HC_COMMAND); in bce_blockinit()
5249 /* 0 for success, positive value for failure. */
5275 DBRUNIF((sc->free_rx_bd < sc->rx_low_watermark), in bce_get_rx_buf()
5276 sc->rx_low_watermark = sc->free_rx_bd); in bce_get_rx_buf()
5277 DBRUNIF((sc->free_rx_bd == sc->max_rx_bd), in bce_get_rx_buf()
5278 sc->rx_empty_count++); in bce_get_rx_buf()
5282 sc->mbuf_alloc_failed_count++; in bce_get_rx_buf()
5283 sc->mbuf_alloc_failed_sim_count++; in bce_get_rx_buf()
5292 sc->rx_bd_mbuf_alloc_size); in bce_get_rx_buf()
5295 sc->mbuf_alloc_failed_count++; in bce_get_rx_buf()
5300 DBRUN(sc->debug_rx_mbuf_alloc++); in bce_get_rx_buf()
5306 m_new->m_pkthdr.len = m_new->m_len = sc->rx_bd_mbuf_alloc_size; in bce_get_rx_buf()
5307 m_adj(m_new, sc->rx_bd_mbuf_align_pad); in bce_get_rx_buf()
5312 error = bus_dmamap_load_mbuf_sg(sc->rx_mbuf_tag, in bce_get_rx_buf()
5313 sc->rx_mbuf_map[chain_prod], m_new, segs, &nsegs, BUS_DMA_NOWAIT); in bce_get_rx_buf()
5320 sc->dma_map_addr_rx_failed_count++; in bce_get_rx_buf()
5323 DBRUN(sc->debug_rx_mbuf_alloc--); in bce_get_rx_buf()
5334 rxbd = &sc->rx_bd_chain[RX_PAGE(chain_prod)][RX_IDX(chain_prod)]; in bce_get_rx_buf()
5336 rxbd->rx_bd_haddr_lo = htole32(BCE_ADDR_LO(segs[0].ds_addr)); in bce_get_rx_buf()
5337 rxbd->rx_bd_haddr_hi = htole32(BCE_ADDR_HI(segs[0].ds_addr)); in bce_get_rx_buf()
5338 rxbd->rx_bd_len = htole32(segs[0].ds_len); in bce_get_rx_buf()
5339 rxbd->rx_bd_flags = htole32(RX_BD_FLAGS_START | RX_BD_FLAGS_END); in bce_get_rx_buf()
5343 sc->rx_mbuf_ptr[chain_prod] = m_new; in bce_get_rx_buf()
5344 sc->free_rx_bd -= nsegs; in bce_get_rx_buf()
5363 /* 0 for success, positive value for failure. */
5388 DBRUNIF((sc->free_pg_bd < sc->pg_low_watermark), in bce_get_pg_buf()
5389 sc->pg_low_watermark = sc->free_pg_bd); in bce_get_pg_buf()
5390 DBRUNIF((sc->free_pg_bd == sc->max_pg_bd), sc->pg_empty_count++); in bce_get_pg_buf()
5394 sc->mbuf_alloc_failed_count++; in bce_get_pg_buf()
5395 sc->mbuf_alloc_failed_sim_count++; in bce_get_pg_buf()
5402 sc->mbuf_alloc_failed_count++; in bce_get_pg_buf()
5407 DBRUN(sc->debug_pg_mbuf_alloc++); in bce_get_pg_buf()
5409 m_new->m_len = MCLBYTES; in bce_get_pg_buf()
5414 error = bus_dmamap_load_mbuf_sg(sc->pg_mbuf_tag, in bce_get_pg_buf()
5415 sc->pg_mbuf_map[prod_idx], m_new, segs, &nsegs, BUS_DMA_NOWAIT); in bce_get_pg_buf()
5423 DBRUN(sc->debug_pg_mbuf_alloc--); in bce_get_pg_buf()
5439 pgbd = &sc->pg_bd_chain[PG_PAGE(prod_idx)][PG_IDX(prod_idx)]; in bce_get_pg_buf()
5441 pgbd->rx_bd_haddr_lo = htole32(BCE_ADDR_LO(segs[0].ds_addr)); in bce_get_pg_buf()
5442 pgbd->rx_bd_haddr_hi = htole32(BCE_ADDR_HI(segs[0].ds_addr)); in bce_get_pg_buf()
5443 pgbd->rx_bd_len = htole32(MCLBYTES); in bce_get_pg_buf()
5444 pgbd->rx_bd_flags = htole32(RX_BD_FLAGS_START | RX_BD_FLAGS_END); in bce_get_pg_buf()
5447 sc->pg_mbuf_ptr[prod_idx] = m_new; in bce_get_pg_buf()
5448 sc->free_pg_bd--; in bce_get_pg_buf()
5486 val = BCE_ADDR_HI(sc->tx_bd_chain_paddr[0]); in bce_init_tx_context()
5489 val = BCE_ADDR_LO(sc->tx_bd_chain_paddr[0]); in bce_init_tx_context()
5500 val = BCE_ADDR_HI(sc->tx_bd_chain_paddr[0]); in bce_init_tx_context()
5503 val = BCE_ADDR_LO(sc->tx_bd_chain_paddr[0]); in bce_init_tx_context()
5515 /* 0 for success, positive value for failure. */
5526 sc->tx_prod = 0; in bce_init_tx_chain()
5527 sc->tx_cons = 0; in bce_init_tx_chain()
5528 sc->tx_prod_bseq = 0; in bce_init_tx_chain()
5529 sc->used_tx_bd = 0; in bce_init_tx_chain()
5530 sc->max_tx_bd = USABLE_TX_BD_ALLOC; in bce_init_tx_chain()
5531 DBRUN(sc->tx_hi_watermark = 0); in bce_init_tx_chain()
5532 DBRUN(sc->tx_full_count = 0); in bce_init_tx_chain()
5535 * The NetXtreme II supports a linked-list structure called in bce_init_tx_chain()
5545 for (i = 0; i < sc->tx_pages; i++) { in bce_init_tx_chain()
5548 txbd = &sc->tx_bd_chain[i][USABLE_TX_BD_PER_PAGE]; in bce_init_tx_chain()
5551 if (i == (sc->tx_pages - 1)) in bce_init_tx_chain()
5556 txbd->tx_bd_haddr_hi = in bce_init_tx_chain()
5557 htole32(BCE_ADDR_HI(sc->tx_bd_chain_paddr[j])); in bce_init_tx_chain()
5558 txbd->tx_bd_haddr_lo = in bce_init_tx_chain()
5559 htole32(BCE_ADDR_LO(sc->tx_bd_chain_paddr[j])); in bce_init_tx_chain()
5585 if (sc->tx_mbuf_ptr[i] != NULL) { in bce_free_tx_chain()
5586 if (sc->tx_mbuf_map[i] != NULL) in bce_free_tx_chain()
5587 bus_dmamap_sync(sc->tx_mbuf_tag, in bce_free_tx_chain()
5588 sc->tx_mbuf_map[i], in bce_free_tx_chain()
5590 m_freem(sc->tx_mbuf_ptr[i]); in bce_free_tx_chain()
5591 sc->tx_mbuf_ptr[i] = NULL; in bce_free_tx_chain()
5592 DBRUN(sc->debug_tx_mbuf_alloc--); in bce_free_tx_chain()
5597 for (i = 0; i < sc->tx_pages; i++) in bce_free_tx_chain()
5598 bzero((char *)sc->tx_bd_chain[i], BCE_TX_CHAIN_PAGE_SZ); in bce_free_tx_chain()
5600 sc->used_tx_bd = 0; in bce_free_tx_chain()
5603 DBRUNIF((sc->debug_tx_mbuf_alloc), in bce_free_tx_chain()
5606 sc->debug_tx_mbuf_alloc)); in bce_free_tx_chain()
5639 if (sc->bce_flags & BCE_USING_TX_FLOW_CONTROL) { in bce_init_rx_context()
5676 val = BCE_ADDR_HI(sc->rx_bd_chain_paddr[0]); in bce_init_rx_context()
5678 val = BCE_ADDR_LO(sc->rx_bd_chain_paddr[0]); in bce_init_rx_context()
5688 /* 0 for success, positive value for failure. */
5700 sc->rx_prod = 0; in bce_init_rx_chain()
5701 sc->rx_cons = 0; in bce_init_rx_chain()
5702 sc->rx_prod_bseq = 0; in bce_init_rx_chain()
5703 sc->free_rx_bd = USABLE_RX_BD_ALLOC; in bce_init_rx_chain()
5704 sc->max_rx_bd = USABLE_RX_BD_ALLOC; in bce_init_rx_chain()
5707 for (i = 0; i < sc->rx_pages; i++) { in bce_init_rx_chain()
5710 rxbd = &sc->rx_bd_chain[i][USABLE_RX_BD_PER_PAGE]; in bce_init_rx_chain()
5713 if (i == (sc->rx_pages - 1)) in bce_init_rx_chain()
5719 rxbd->rx_bd_haddr_hi = in bce_init_rx_chain()
5720 htole32(BCE_ADDR_HI(sc->rx_bd_chain_paddr[j])); in bce_init_rx_chain()
5721 rxbd->rx_bd_haddr_lo = in bce_init_rx_chain()
5722 htole32(BCE_ADDR_LO(sc->rx_bd_chain_paddr[j])); in bce_init_rx_chain()
5728 DBRUN(sc->rx_low_watermark = USABLE_RX_BD_ALLOC); in bce_init_rx_chain()
5729 DBRUN(sc->rx_empty_count = 0); in bce_init_rx_chain()
5730 for (i = 0; i < sc->rx_pages; i++) { in bce_init_rx_chain()
5731 bus_dmamap_sync(sc->rx_bd_chain_tag, sc->rx_bd_chain_map[i], in bce_init_rx_chain()
5764 prod = sc->rx_prod; in bce_fill_rx_chain()
5765 prod_bseq = sc->rx_prod_bseq; in bce_fill_rx_chain()
5768 while (sc->free_rx_bd > 0) { in bce_fill_rx_chain()
5778 sc->rx_prod = prod; in bce_fill_rx_chain()
5779 sc->rx_prod_bseq = prod_bseq; in bce_fill_rx_chain()
5809 if (sc->rx_mbuf_ptr[i] != NULL) { in bce_free_rx_chain()
5810 if (sc->rx_mbuf_map[i] != NULL) in bce_free_rx_chain()
5811 bus_dmamap_sync(sc->rx_mbuf_tag, in bce_free_rx_chain()
5812 sc->rx_mbuf_map[i], in bce_free_rx_chain()
5814 m_freem(sc->rx_mbuf_ptr[i]); in bce_free_rx_chain()
5815 sc->rx_mbuf_ptr[i] = NULL; in bce_free_rx_chain()
5816 DBRUN(sc->debug_rx_mbuf_alloc--); in bce_free_rx_chain()
5821 for (i = 0; i < sc->rx_pages; i++) in bce_free_rx_chain()
5822 if (sc->rx_bd_chain[i] != NULL) in bce_free_rx_chain()
5823 bzero((char *)sc->rx_bd_chain[i], in bce_free_rx_chain()
5826 sc->free_rx_bd = sc->max_rx_bd; in bce_free_rx_chain()
5829 DBRUNIF((sc->debug_rx_mbuf_alloc), in bce_free_rx_chain()
5831 __FUNCTION__, sc->debug_rx_mbuf_alloc)); in bce_free_rx_chain()
5841 /* 0 for success, positive value for failure. */
5854 sc->pg_prod = 0; in bce_init_pg_chain()
5855 sc->pg_cons = 0; in bce_init_pg_chain()
5856 sc->free_pg_bd = USABLE_PG_BD_ALLOC; in bce_init_pg_chain()
5857 sc->max_pg_bd = USABLE_PG_BD_ALLOC; in bce_init_pg_chain()
5858 DBRUN(sc->pg_low_watermark = sc->max_pg_bd); in bce_init_pg_chain()
5859 DBRUN(sc->pg_empty_count = 0); in bce_init_pg_chain()
5862 for (i = 0; i < sc->pg_pages; i++) { in bce_init_pg_chain()
5865 pgbd = &sc->pg_bd_chain[i][USABLE_PG_BD_PER_PAGE]; in bce_init_pg_chain()
5868 if (i == (sc->pg_pages - 1)) in bce_init_pg_chain()
5874 pgbd->rx_bd_haddr_hi = in bce_init_pg_chain()
5875 htole32(BCE_ADDR_HI(sc->pg_bd_chain_paddr[j])); in bce_init_pg_chain()
5876 pgbd->rx_bd_haddr_lo = in bce_init_pg_chain()
5877 htole32(BCE_ADDR_LO(sc->pg_bd_chain_paddr[j])); in bce_init_pg_chain()
5887 val = (sc->rx_bd_mbuf_data_len << 16) | MCLBYTES; in bce_init_pg_chain()
5895 val = BCE_ADDR_HI(sc->pg_bd_chain_paddr[0]); in bce_init_pg_chain()
5897 val = BCE_ADDR_LO(sc->pg_bd_chain_paddr[0]); in bce_init_pg_chain()
5903 for (i = 0; i < sc->pg_pages; i++) { in bce_init_pg_chain()
5904 bus_dmamap_sync(sc->pg_bd_chain_tag, sc->pg_bd_chain_map[i], in bce_init_pg_chain()
5931 prod = sc->pg_prod; in bce_fill_pg_chain()
5934 while (sc->free_pg_bd > 0) { in bce_fill_pg_chain()
5944 sc->pg_prod = prod; in bce_fill_pg_chain()
5976 if (sc->pg_mbuf_ptr[i] != NULL) { in bce_free_pg_chain()
5977 if (sc->pg_mbuf_map[i] != NULL) in bce_free_pg_chain()
5978 bus_dmamap_sync(sc->pg_mbuf_tag, in bce_free_pg_chain()
5979 sc->pg_mbuf_map[i], in bce_free_pg_chain()
5981 m_freem(sc->pg_mbuf_ptr[i]); in bce_free_pg_chain()
5982 sc->pg_mbuf_ptr[i] = NULL; in bce_free_pg_chain()
5983 DBRUN(sc->debug_pg_mbuf_alloc--); in bce_free_pg_chain()
5988 for (i = 0; i < sc->pg_pages; i++) in bce_free_pg_chain()
5989 bzero((char *)sc->pg_bd_chain[i], BCE_PG_CHAIN_PAGE_SZ); in bce_free_pg_chain()
5991 sc->free_pg_bd = sc->max_pg_bd; in bce_free_pg_chain()
5994 DBRUNIF((sc->debug_pg_mbuf_alloc), in bce_free_pg_chain()
5996 __FUNCTION__, sc->debug_pg_mbuf_alloc)); in bce_free_pg_chain()
6009 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) != 0) in bce_get_rphy_link()
6042 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0) in bce_get_rphy_link()
6053 /* 0 for success, positive value for failure. */
6092 sc->bce_link_up = FALSE; in bce_ifmedia_upd_locked()
6093 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) { in bce_ifmedia_upd_locked()
6094 ifm = &sc->bce_ifmedia; in bce_ifmedia_upd_locked()
6095 if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) in bce_ifmedia_upd_locked()
6098 fdx = IFM_OPTIONS(ifm->ifm_media) & IFM_FDX; in bce_ifmedia_upd_locked()
6099 switch(IFM_SUBTYPE(ifm->ifm_media)) { in bce_ifmedia_upd_locked()
6109 if ((sc->bce_phy_flags & in bce_ifmedia_upd_locked()
6123 if ((sc->bce_phy_flags & in bce_ifmedia_upd_locked()
6136 if (sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) in bce_ifmedia_upd_locked()
6144 if (sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) in bce_ifmedia_upd_locked()
6152 if (sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) in bce_ifmedia_upd_locked()
6162 if (IFM_SUBTYPE(ifm->ifm_media) != IFM_AUTO) { in bce_ifmedia_upd_locked()
6165 * Advertise pause capability for full-duplex media. in bce_ifmedia_upd_locked()
6170 if ((sc->bce_phy_flags & in bce_ifmedia_upd_locked()
6179 mii = device_get_softc(sc->bce_miibus); in bce_ifmedia_upd_locked()
6183 LIST_FOREACH(miisc, &mii->mii_phys, mii_list) in bce_ifmedia_upd_locked()
6199 ifp = sc->bce_ifp; in bce_ifmedia_sts_rphy()
6202 ifmr->ifm_status = IFM_AVALID; in bce_ifmedia_sts_rphy()
6203 ifmr->ifm_active = IFM_ETHER; in bce_ifmedia_sts_rphy()
6207 ifmr->ifm_status |= IFM_ACTIVE; in bce_ifmedia_sts_rphy()
6209 ifmr->ifm_active |= IFM_NONE; in bce_ifmedia_sts_rphy()
6215 ifmr->ifm_active |= IFM_10_T | IFM_HDX; in bce_ifmedia_sts_rphy()
6219 ifmr->ifm_active |= IFM_10_T | IFM_FDX; in bce_ifmedia_sts_rphy()
6223 ifmr->ifm_active |= IFM_100_TX | IFM_HDX; in bce_ifmedia_sts_rphy()
6227 ifmr->ifm_active |= IFM_100_TX | IFM_FDX; in bce_ifmedia_sts_rphy()
6231 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0) in bce_ifmedia_sts_rphy()
6232 ifmr->ifm_active |= IFM_1000_T | IFM_HDX; in bce_ifmedia_sts_rphy()
6234 ifmr->ifm_active |= IFM_1000_SX | IFM_HDX; in bce_ifmedia_sts_rphy()
6238 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0) in bce_ifmedia_sts_rphy()
6239 ifmr->ifm_active |= IFM_1000_T | IFM_FDX; in bce_ifmedia_sts_rphy()
6241 ifmr->ifm_active |= IFM_1000_SX | IFM_FDX; in bce_ifmedia_sts_rphy()
6245 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0) { in bce_ifmedia_sts_rphy()
6246 ifmr->ifm_active |= IFM_NONE; in bce_ifmedia_sts_rphy()
6249 ifmr->ifm_active |= IFM_2500_SX | IFM_HDX; in bce_ifmedia_sts_rphy()
6253 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0) { in bce_ifmedia_sts_rphy()
6254 ifmr->ifm_active |= IFM_NONE; in bce_ifmedia_sts_rphy()
6257 ifmr->ifm_active |= IFM_2500_SX | IFM_FDX; in bce_ifmedia_sts_rphy()
6261 ifmr->ifm_active |= IFM_NONE; in bce_ifmedia_sts_rphy()
6266 ifmr->ifm_active |= IFM_ETH_RXPAUSE; in bce_ifmedia_sts_rphy()
6268 ifmr->ifm_active |= IFM_ETH_TXPAUSE; in bce_ifmedia_sts_rphy()
6292 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) in bce_ifmedia_sts()
6295 mii = device_get_softc(sc->bce_miibus); in bce_ifmedia_sts()
6297 ifmr->ifm_active = mii->mii_media_active; in bce_ifmedia_sts()
6298 ifmr->ifm_status = mii->mii_media_status; in bce_ifmedia_sts()
6319 DBRUN(sc->phy_interrupts++); in bce_phy_intr()
6321 new_link_state = sc->status_block->status_attn_bits & in bce_phy_intr()
6323 old_link_state = sc->status_block->status_attn_bits_ack & in bce_phy_intr()
6341 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) { in bce_phy_intr()
6344 if_printf(sc->bce_ifp, "link UP\n"); in bce_phy_intr()
6345 if_link_state_change(sc->bce_ifp, in bce_phy_intr()
6349 if_printf(sc->bce_ifp, "link DOWN\n"); in bce_phy_intr()
6350 if_link_state_change(sc->bce_ifp, in bce_phy_intr()
6359 sc->bce_link_up = FALSE; in bce_phy_intr()
6360 callout_stop(&sc->bce_tick_callout); in bce_phy_intr()
6383 hw_cons = sc->status_block->status_rx_quick_consumer_index0; in bce_get_hw_rx_cons()
6399 if_t ifp = sc->bce_ifp; in bce_rx_intr()
6409 DBRUN(sc->interrupts_rx++); in bce_rx_intr()
6412 __FUNCTION__, sc->rx_prod, sc->rx_cons, sc->rx_prod_bseq); in bce_rx_intr()
6415 for (int i = 0; i < sc->rx_pages; i++) in bce_rx_intr()
6416 bus_dmamap_sync(sc->rx_bd_chain_tag, in bce_rx_intr()
6417 sc->rx_bd_chain_map[i], BUS_DMASYNC_POSTREAD); in bce_rx_intr()
6421 for (int i = 0; i < sc->pg_pages; i++) in bce_rx_intr()
6422 bus_dmamap_sync(sc->pg_bd_chain_tag, in bce_rx_intr()
6423 sc->pg_bd_chain_map[i], BUS_DMASYNC_POSTREAD); in bce_rx_intr()
6427 hw_rx_cons = sc->hw_rx_cons = bce_get_hw_rx_cons(sc); in bce_rx_intr()
6430 sw_rx_cons = sc->rx_cons; in bce_rx_intr()
6431 sw_pg_cons = sc->pg_cons; in bce_rx_intr()
6434 DBRUNIF((sc->free_rx_bd < sc->rx_low_watermark), in bce_rx_intr()
6435 sc->rx_low_watermark = sc->free_rx_bd); in bce_rx_intr()
6436 DBRUNIF((sc->free_rx_bd == sc->max_rx_bd), in bce_rx_intr()
6437 sc->rx_empty_count++); in bce_rx_intr()
6449 bus_dmamap_sync(sc->rx_mbuf_tag, in bce_rx_intr()
6450 sc->rx_mbuf_map[sw_rx_cons_idx], in bce_rx_intr()
6452 bus_dmamap_unload(sc->rx_mbuf_tag, in bce_rx_intr()
6453 sc->rx_mbuf_map[sw_rx_cons_idx]); in bce_rx_intr()
6456 m0 = sc->rx_mbuf_ptr[sw_rx_cons_idx]; in bce_rx_intr()
6457 sc->rx_mbuf_ptr[sw_rx_cons_idx] = NULL; in bce_rx_intr()
6458 DBRUN(sc->debug_rx_mbuf_alloc--); in bce_rx_intr()
6459 sc->free_rx_bd++; in bce_rx_intr()
6472 * +---------+-----+---------------------+-----+ in bce_rx_intr()
6474 * +---------+-----+---------------------+-----+ in bce_rx_intr()
6483 pkt_len = l2fhdr->l2_fhdr_pkt_len; in bce_rx_intr()
6484 status = l2fhdr->l2_fhdr_status; in bce_rx_intr()
6489 * +---------------------+-----+ in bce_rx_intr()
6491 * +---------------------+-----+ in bce_rx_intr()
6505 * sc->rx_bd_mbuf_data_len bytes). in bce_rx_intr()
6507 if (pkt_len > m0->m_len) { in bce_rx_intr()
6522 DBRUN(sc->split_header_frames_rcvd++); in bce_rx_intr()
6532 m0->m_len = l2fhdr->l2_fhdr_ip_xsum; in bce_rx_intr()
6533 DBRUN(sc->split_header_tcp_frames_rcvd++); in bce_rx_intr()
6536 rem_len = pkt_len - m0->m_len; in bce_rx_intr()
6545 m_pg = sc->pg_mbuf_ptr[sw_pg_cons_idx]; in bce_rx_intr()
6546 sc->pg_mbuf_ptr[sw_pg_cons_idx] = NULL; in bce_rx_intr()
6547 DBRUN(sc->debug_pg_mbuf_alloc--); in bce_rx_intr()
6548 sc->free_pg_bd++; in bce_rx_intr()
6551 bus_dmamap_sync(sc->pg_mbuf_tag, in bce_rx_intr()
6552 sc->pg_mbuf_map[sw_pg_cons_idx], in bce_rx_intr()
6554 bus_dmamap_unload(sc->pg_mbuf_tag, in bce_rx_intr()
6555 sc->pg_mbuf_map[sw_pg_cons_idx]); in bce_rx_intr()
6558 if (rem_len < m_pg->m_len) { in bce_rx_intr()
6560 m_pg->m_len = rem_len; in bce_rx_intr()
6564 rem_len -= m_pg->m_len; in bce_rx_intr()
6574 m0->m_pkthdr.len = pkt_len; in bce_rx_intr()
6588 m0->m_pkthdr.len = m0->m_len = pkt_len; in bce_rx_intr()
6592 m0->m_pkthdr.len = m0->m_len = pkt_len; in bce_rx_intr()
6595 m_adj(m0, -ETHER_CRC_LEN); in bce_rx_intr()
6599 DBRUNIF(((m0->m_len < ETHER_HDR_LEN) | in bce_rx_intr()
6600 (m0->m_pkthdr.len > BCE_MAX_JUMBO_ETHER_MTU_VLAN)), in bce_rx_intr()
6605 sc->l2fhdr_error_sim_count++; in bce_rx_intr()
6613 sc->l2fhdr_error_count++; in bce_rx_intr()
6620 m0->m_pkthdr.rcvif = ifp; in bce_rx_intr()
6623 m0->m_pkthdr.csum_flags = 0; in bce_rx_intr()
6630 m0->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; in bce_rx_intr()
6631 DBRUN(sc->csum_offload_ip++); in bce_rx_intr()
6633 if ((l2fhdr->l2_fhdr_ip_xsum ^ 0xffff) == 0) in bce_rx_intr()
6634 m0->m_pkthdr.csum_flags |= in bce_rx_intr()
6644 DBRUN(sc->csum_offload_tcp_udp++); in bce_rx_intr()
6645 m0->m_pkthdr.csum_data = in bce_rx_intr()
6646 l2fhdr->l2_fhdr_tcp_udp_xsum; in bce_rx_intr()
6647 m0->m_pkthdr.csum_flags |= in bce_rx_intr()
6656 !(sc->rx_mode & BCE_EMAC_RX_MODE_KEEP_VLAN_TAG)) { in bce_rx_intr()
6657 DBRUN(sc->vlan_tagged_frames_rcvd++); in bce_rx_intr()
6659 DBRUN(sc->vlan_tagged_frames_stripped++); in bce_rx_intr()
6660 m0->m_pkthdr.ether_vtag = in bce_rx_intr()
6661 l2fhdr->l2_fhdr_vlan_tag; in bce_rx_intr()
6662 m0->m_flags |= M_VLANTAG; in bce_rx_intr()
6676 mtod(m0, uint8_t *) - ETHER_VLAN_ENCAP_LEN, in bce_rx_intr()
6678 m0->m_data -= ETHER_VLAN_ENCAP_LEN; in bce_rx_intr()
6680 vh->evl_encap_proto = htons(ETHERTYPE_VLAN); in bce_rx_intr()
6681 vh->evl_tag = htons(l2fhdr->l2_fhdr_vlan_tag); in bce_rx_intr()
6682 m0->m_pkthdr.len += ETHER_VLAN_ENCAP_LEN; in bce_rx_intr()
6683 m0->m_len += ETHER_VLAN_ENCAP_LEN; in bce_rx_intr()
6696 sc->rx_cons = sw_rx_cons; in bce_rx_intr()
6697 sc->pg_cons = sw_pg_cons; in bce_rx_intr()
6704 sw_rx_cons = sc->rx_cons; in bce_rx_intr()
6705 sw_pg_cons = sc->pg_cons; in bce_rx_intr()
6710 hw_rx_cons = sc->hw_rx_cons = bce_get_hw_rx_cons(sc); in bce_rx_intr()
6715 sc->pg_cons = sw_pg_cons; in bce_rx_intr()
6720 sc->rx_cons = sw_rx_cons; in bce_rx_intr()
6724 for (int i = 0; i < sc->rx_pages; i++) in bce_rx_intr()
6725 bus_dmamap_sync(sc->rx_bd_chain_tag, in bce_rx_intr()
6726 sc->rx_bd_chain_map[i], BUS_DMASYNC_PREWRITE); in bce_rx_intr()
6729 for (int i = 0; i < sc->pg_pages; i++) in bce_rx_intr()
6730 bus_dmamap_sync(sc->pg_bd_chain_tag, in bce_rx_intr()
6731 sc->pg_bd_chain_map[i], BUS_DMASYNC_PREWRITE); in bce_rx_intr()
6736 __FUNCTION__, sc->rx_prod, sc->rx_cons, sc->rx_prod_bseq); in bce_rx_intr()
6753 hw_cons = sc->status_block->status_tx_quick_consumer_index0; in bce_get_hw_tx_cons()
6769 if_t ifp = sc->bce_ifp; in bce_tx_intr()
6773 DBRUN(sc->interrupts_tx++); in bce_tx_intr()
6776 __FUNCTION__, sc->tx_prod, sc->tx_cons, sc->tx_prod_bseq); in bce_tx_intr()
6781 hw_tx_cons = sc->hw_tx_cons = bce_get_hw_tx_cons(sc); in bce_tx_intr()
6782 sw_tx_cons = sc->tx_cons; in bce_tx_intr()
6785 bus_space_barrier(sc->bce_btag, sc->bce_bhandle, 0, 0, in bce_tx_intr()
6806 DBRUN(txbd = &sc->tx_bd_chain[TX_PAGE(sw_tx_chain_cons)] in bce_tx_intr()
6822 if (sc->tx_mbuf_ptr[sw_tx_chain_cons] != NULL) { in bce_tx_intr()
6824 DBRUNIF((!(txbd->tx_bd_flags & TX_BD_FLAGS_END)), in bce_tx_intr()
6835 bus_dmamap_unload(sc->tx_mbuf_tag, in bce_tx_intr()
6836 sc->tx_mbuf_map[sw_tx_chain_cons]); in bce_tx_intr()
6839 m_freem(sc->tx_mbuf_ptr[sw_tx_chain_cons]); in bce_tx_intr()
6840 sc->tx_mbuf_ptr[sw_tx_chain_cons] = NULL; in bce_tx_intr()
6841 DBRUN(sc->debug_tx_mbuf_alloc--); in bce_tx_intr()
6846 sc->used_tx_bd--; in bce_tx_intr()
6850 hw_tx_cons = sc->hw_tx_cons = bce_get_hw_tx_cons(sc); in bce_tx_intr()
6853 bus_space_barrier(sc->bce_btag, sc->bce_bhandle, 0, 0, in bce_tx_intr()
6858 sc->watchdog_timer = 0; in bce_tx_intr()
6861 if (sc->used_tx_bd < sc->max_tx_bd) { in bce_tx_intr()
6865 __FUNCTION__, sc->used_tx_bd, sc->max_tx_bd)); in bce_tx_intr()
6869 sc->tx_cons = sw_tx_cons; in bce_tx_intr()
6873 __FUNCTION__, sc->tx_prod, sc->tx_cons, sc->tx_prod_bseq); in bce_tx_intr()
6907 BCE_PCICFG_INT_ACK_CMD_MASK_INT | sc->last_status_idx); in bce_enable_intr()
6910 BCE_PCICFG_INT_ACK_CMD_INDEX_VALID | sc->last_status_idx); in bce_enable_intr()
6914 REG_WR(sc, BCE_HC_COMMAND, sc->hc_command | BCE_HC_COMMAND_COAL_NOW); in bce_enable_intr()
6935 ifp = sc->bce_ifp; in bce_init_locked()
6962 bcopy(if_getlladdr(sc->bce_ifp), sc->eaddr, ETHER_ADDR_LEN); in bce_init_locked()
6976 if (if_getmtu(ifp) <= sc->rx_bd_mbuf_data_len + MCLBYTES) in bce_init_locked()
6977 ether_mtu = sc->rx_bd_mbuf_data_len + in bce_init_locked()
6982 if (if_getmtu(ifp) <= sc->rx_bd_mbuf_data_len) in bce_init_locked()
6983 ether_mtu = sc->rx_bd_mbuf_data_len; in bce_init_locked()
7025 callout_reset(&sc->bce_tick_callout, hz, bce_tick, sc); in bce_init_locked()
7048 if (!(sc->bce_flags & BCE_MFW_ENABLE_FLAG)) { in bce_mgmt_init_locked()
7054 ifp = sc->bce_ifp; in bce_mgmt_init_locked()
7103 DBRUN(sc->tso_frames_requested++); in bce_tso_setup()
7111 sc->mbuf_alloc_failed_count++; in bce_tso_setup()
7128 etype = ntohs(eh->ether_type); in bce_tso_setup()
7133 ip = (struct ip *)(m->m_data + sizeof(struct ether_header)); in bce_tso_setup()
7135 if (ip->ip_p != IPPROTO_TCP) { in bce_tso_setup()
7136 BCE_PRINTF("%s(%d): TSO enabled for non-TCP frame!.\n", in bce_tso_setup()
7144 ip_hlen = ip->ip_hl << 2; in bce_tso_setup()
7153 ip = (struct ip *)(m->m_data + sizeof(struct ether_header)); in bce_tso_setup()
7155 tcp_hlen = (th->th_off << 2); in bce_tso_setup()
7166 ip = (struct ip *)(m->m_data + sizeof(struct ether_header)); in bce_tso_setup()
7167 ip_len = ip->ip_len; in bce_tso_setup()
7168 ip->ip_len = 0; in bce_tso_setup()
7169 ip->ip_sum = 0; in bce_tso_setup()
7197 *flags |= (((ip_hlen + tcp_hlen - sizeof(struct ip) - in bce_tso_setup()
7200 DBRUN(sc->tso_frames_completed++); in bce_tso_setup()
7209 /* 0 for success, positive value for failure. */
7232 if (sc->used_tx_bd >= sc->max_tx_bd) in bce_tx_encap()
7237 if (m0->m_pkthdr.csum_flags) { in bce_tx_encap()
7238 if (m0->m_pkthdr.csum_flags & CSUM_TSO) { in bce_tx_encap()
7241 DBRUN(sc->tso_frames_failed++); in bce_tx_encap()
7244 mss = htole16(m0->m_pkthdr.tso_segsz); in bce_tx_encap()
7246 if (m0->m_pkthdr.csum_flags & CSUM_IP) in bce_tx_encap()
7248 if (m0->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)) in bce_tx_encap()
7254 if (m0->m_flags & M_VLANTAG) { in bce_tx_encap()
7256 vlan_tag = m0->m_pkthdr.ether_vtag; in bce_tx_encap()
7260 prod = sc->tx_prod; in bce_tx_encap()
7262 map = sc->tx_mbuf_map[chain_prod]; in bce_tx_encap()
7265 error = bus_dmamap_load_mbuf_sg(sc->tx_mbuf_tag, map, m0, in bce_tx_encap()
7270 sc->mbuf_frag_count++; in bce_tx_encap()
7278 sc->mbuf_alloc_failed_count++; in bce_tx_encap()
7285 error = bus_dmamap_load_mbuf_sg(sc->tx_mbuf_tag, in bce_tx_encap()
7291 sc->dma_map_addr_tx_failed_count++; in bce_tx_encap()
7300 sc->dma_map_addr_tx_failed_count++; in bce_tx_encap()
7306 sc->dma_map_addr_tx_failed_count++; in bce_tx_encap()
7312 sc->dma_map_addr_tx_failed_count++; in bce_tx_encap()
7318 if (nsegs > (sc->max_tx_bd - sc->used_tx_bd)) { in bce_tx_encap()
7319 bus_dmamap_unload(sc->tx_mbuf_tag, map); in bce_tx_encap()
7325 prod_bseq = sc->tx_prod_bseq; in bce_tx_encap()
7344 txbd= &sc->tx_bd_chain[TX_PAGE(chain_prod)] in bce_tx_encap()
7347 txbd->tx_bd_haddr_lo = in bce_tx_encap()
7349 txbd->tx_bd_haddr_hi = in bce_tx_encap()
7351 txbd->tx_bd_mss_nbytes = htole32(mss << 16) | in bce_tx_encap()
7353 txbd->tx_bd_vlan_tag = htole16(vlan_tag); in bce_tx_encap()
7354 txbd->tx_bd_flags = htole16(flags); in bce_tx_encap()
7357 txbd->tx_bd_flags |= htole16(TX_BD_FLAGS_START); in bce_tx_encap()
7362 txbd->tx_bd_flags |= htole16(TX_BD_FLAGS_END); in bce_tx_encap()
7376 sc->tx_mbuf_ptr[chain_prod] = m0; in bce_tx_encap()
7377 sc->used_tx_bd += nsegs; in bce_tx_encap()
7380 DBRUNIF((sc->used_tx_bd > sc->tx_hi_watermark), in bce_tx_encap()
7381 sc->tx_hi_watermark = sc->used_tx_bd); in bce_tx_encap()
7382 DBRUNIF((sc->used_tx_bd == sc->max_tx_bd), sc->tx_full_count++); in bce_tx_encap()
7383 DBRUNIF(sc->debug_tx_mbuf_alloc++); in bce_tx_encap()
7388 sc->tx_prod = prod; in bce_tx_encap()
7389 sc->tx_prod_bseq = prod_bseq; in bce_tx_encap()
7393 BCE_L2MQ_TX_HOST_BIDX, sc->tx_prod); in bce_tx_encap()
7395 BCE_L2MQ_TX_HOST_BSEQ, sc->tx_prod_bseq); in bce_tx_encap()
7421 tx_prod = sc->tx_prod; in bce_start_locked()
7427 __FUNCTION__, tx_prod, tx_chain_prod, sc->tx_prod_bseq); in bce_start_locked()
7430 if (sc->bce_link_up == FALSE) { in bce_start_locked()
7445 while (sc->used_tx_bd < sc->max_tx_bd) { in bce_start_locked()
7465 "tx_bd used = %d\n", sc->used_tx_bd); in bce_start_locked()
7486 sc->watchdog_timer = BCE_TX_TIMEOUT; in bce_start_locked()
7519 /* 0 for success, positive value for failure. */
7535 if ((ifr->ifr_mtu < BCE_MIN_MTU) || in bce_ioctl()
7536 (ifr->ifr_mtu > BCE_MAX_JUMBO_MTU)) { in bce_ioctl()
7543 (int) if_getmtu(ifp), (int) ifr->ifr_mtu); in bce_ioctl()
7546 if_setmtu(ifp, ifr->ifr_mtu); in bce_ioctl()
7575 if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { in bce_ioctl()
7604 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) in bce_ioctl()
7605 error = ifmedia_ioctl(ifp, ifr, &sc->bce_ifmedia, in bce_ioctl()
7608 mii = device_get_softc(sc->bce_miibus); in bce_ioctl()
7609 error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, in bce_ioctl()
7616 mask = ifr->ifr_reqcap ^ if_getcapenable(ifp); in bce_ioctl()
7695 if (sc->watchdog_timer == 0 || --sc->watchdog_timer) in bce_watchdog()
7700 if ((sc->bce_flags & BCE_USING_RX_FLOW_CONTROL) != 0) { in bce_watchdog()
7706 sc->watchdog_timer = BCE_TX_TIMEOUT; in bce_watchdog()
7715 sc->watchdog_timer = BCE_TX_TIMEOUT; in bce_watchdog()
7740 if_setdrvflagbits(sc->bce_ifp, 0, IFF_DRV_RUNNING); in bce_watchdog()
7743 sc->watchdog_timeouts++; in bce_watchdog()
7770 ifp = sc->bce_ifp; in bce_intr()
7778 DBRUN(sc->interrupts_generated++); in bce_intr()
7781 bus_dmamap_sync(sc->status_tag, sc->status_map, BUS_DMASYNC_POSTREAD); in bce_intr()
7789 if ((sc->bce_flags & (BCE_USING_MSI_FLAG | BCE_USING_MSIX_FLAG)) == 0 && in bce_intr()
7790 sc->status_block->status_idx == sc->last_status_idx && in bce_intr()
7809 status_attn_bits = sc->status_block->status_attn_bits; in bce_intr()
7814 sc->unexpected_attention_sim_count++; in bce_intr()
7820 (sc->status_block->status_attn_bits_ack & in bce_intr()
7825 REG_WR(sc, BCE_HC_COMMAND, sc->hc_command | in bce_intr()
7832 (sc->status_block->status_attn_bits_ack & in bce_intr()
7834 sc->unexpected_attention_count++; in bce_intr()
7838 sc->status_block->status_attn_bits); in bce_intr()
7849 if (hw_rx_cons != sc->hw_rx_cons) in bce_intr()
7853 if (hw_tx_cons != sc->hw_tx_cons) in bce_intr()
7857 sc->last_status_idx = sc->status_block->status_idx; in bce_intr()
7863 bus_space_barrier(sc->bce_btag, sc->bce_bhandle, 0, 0, in bce_intr()
7873 if ((hw_rx_cons == sc->hw_rx_cons) && in bce_intr()
7874 (hw_tx_cons == sc->hw_tx_cons)) in bce_intr()
7878 bus_dmamap_sync(sc->status_tag, sc->status_map, BUS_DMASYNC_PREREAD); in bce_intr()
7880 /* Re-enable interrupts. */ in bce_intr()
7924 ifp = sc->bce_ifp; in bce_set_rx_mode()
7927 rx_mode = sc->rx_mode & ~(BCE_EMAC_RX_MODE_PROMISCUOUS | in bce_set_rx_mode()
7936 (!(sc->bce_flags & BCE_MFW_ENABLE_FLAG))) in bce_set_rx_mode()
7970 if (rx_mode != sc->rx_mode) { in bce_set_rx_mode()
7974 sc->rx_mode = rx_mode; in bce_set_rx_mode()
8000 bus_dmamap_sync(sc->stats_tag, sc->stats_map, BUS_DMASYNC_POSTREAD); in bce_stats_update()
8002 stats = (struct statistics_block *) sc->stats_block; in bce_stats_update()
8008 sc->stat_IfHCInOctets = in bce_stats_update()
8009 ((u64) stats->stat_IfHCInOctets_hi << 32) + in bce_stats_update()
8010 (u64) stats->stat_IfHCInOctets_lo; in bce_stats_update()
8012 sc->stat_IfHCInBadOctets = in bce_stats_update()
8013 ((u64) stats->stat_IfHCInBadOctets_hi << 32) + in bce_stats_update()
8014 (u64) stats->stat_IfHCInBadOctets_lo; in bce_stats_update()
8016 sc->stat_IfHCOutOctets = in bce_stats_update()
8017 ((u64) stats->stat_IfHCOutOctets_hi << 32) + in bce_stats_update()
8018 (u64) stats->stat_IfHCOutOctets_lo; in bce_stats_update()
8020 sc->stat_IfHCOutBadOctets = in bce_stats_update()
8021 ((u64) stats->stat_IfHCOutBadOctets_hi << 32) + in bce_stats_update()
8022 (u64) stats->stat_IfHCOutBadOctets_lo; in bce_stats_update()
8024 sc->stat_IfHCInUcastPkts = in bce_stats_update()
8025 ((u64) stats->stat_IfHCInUcastPkts_hi << 32) + in bce_stats_update()
8026 (u64) stats->stat_IfHCInUcastPkts_lo; in bce_stats_update()
8028 sc->stat_IfHCInMulticastPkts = in bce_stats_update()
8029 ((u64) stats->stat_IfHCInMulticastPkts_hi << 32) + in bce_stats_update()
8030 (u64) stats->stat_IfHCInMulticastPkts_lo; in bce_stats_update()
8032 sc->stat_IfHCInBroadcastPkts = in bce_stats_update()
8033 ((u64) stats->stat_IfHCInBroadcastPkts_hi << 32) + in bce_stats_update()
8034 (u64) stats->stat_IfHCInBroadcastPkts_lo; in bce_stats_update()
8036 sc->stat_IfHCOutUcastPkts = in bce_stats_update()
8037 ((u64) stats->stat_IfHCOutUcastPkts_hi << 32) + in bce_stats_update()
8038 (u64) stats->stat_IfHCOutUcastPkts_lo; in bce_stats_update()
8040 sc->stat_IfHCOutMulticastPkts = in bce_stats_update()
8041 ((u64) stats->stat_IfHCOutMulticastPkts_hi << 32) + in bce_stats_update()
8042 (u64) stats->stat_IfHCOutMulticastPkts_lo; in bce_stats_update()
8044 sc->stat_IfHCOutBroadcastPkts = in bce_stats_update()
8045 ((u64) stats->stat_IfHCOutBroadcastPkts_hi << 32) + in bce_stats_update()
8046 (u64) stats->stat_IfHCOutBroadcastPkts_lo; in bce_stats_update()
8049 /* ToDo: Read the statistics from auto-clear regs? */ in bce_stats_update()
8051 sc->stat_emac_tx_stat_dot3statsinternalmactransmiterrors = in bce_stats_update()
8052 stats->stat_emac_tx_stat_dot3statsinternalmactransmiterrors; in bce_stats_update()
8054 sc->stat_Dot3StatsCarrierSenseErrors = in bce_stats_update()
8055 stats->stat_Dot3StatsCarrierSenseErrors; in bce_stats_update()
8057 sc->stat_Dot3StatsFCSErrors = in bce_stats_update()
8058 stats->stat_Dot3StatsFCSErrors; in bce_stats_update()
8060 sc->stat_Dot3StatsAlignmentErrors = in bce_stats_update()
8061 stats->stat_Dot3StatsAlignmentErrors; in bce_stats_update()
8063 sc->stat_Dot3StatsSingleCollisionFrames = in bce_stats_update()
8064 stats->stat_Dot3StatsSingleCollisionFrames; in bce_stats_update()
8066 sc->stat_Dot3StatsMultipleCollisionFrames = in bce_stats_update()
8067 stats->stat_Dot3StatsMultipleCollisionFrames; in bce_stats_update()
8069 sc->stat_Dot3StatsDeferredTransmissions = in bce_stats_update()
8070 stats->stat_Dot3StatsDeferredTransmissions; in bce_stats_update()
8072 sc->stat_Dot3StatsExcessiveCollisions = in bce_stats_update()
8073 stats->stat_Dot3StatsExcessiveCollisions; in bce_stats_update()
8075 sc->stat_Dot3StatsLateCollisions = in bce_stats_update()
8076 stats->stat_Dot3StatsLateCollisions; in bce_stats_update()
8078 sc->stat_EtherStatsCollisions = in bce_stats_update()
8079 stats->stat_EtherStatsCollisions; in bce_stats_update()
8081 sc->stat_EtherStatsFragments = in bce_stats_update()
8082 stats->stat_EtherStatsFragments; in bce_stats_update()
8084 sc->stat_EtherStatsJabbers = in bce_stats_update()
8085 stats->stat_EtherStatsJabbers; in bce_stats_update()
8087 sc->stat_EtherStatsUndersizePkts = in bce_stats_update()
8088 stats->stat_EtherStatsUndersizePkts; in bce_stats_update()
8090 sc->stat_EtherStatsOversizePkts = in bce_stats_update()
8091 stats->stat_EtherStatsOversizePkts; in bce_stats_update()
8093 sc->stat_EtherStatsPktsRx64Octets = in bce_stats_update()
8094 stats->stat_EtherStatsPktsRx64Octets; in bce_stats_update()
8096 sc->stat_EtherStatsPktsRx65Octetsto127Octets = in bce_stats_update()
8097 stats->stat_EtherStatsPktsRx65Octetsto127Octets; in bce_stats_update()
8099 sc->stat_EtherStatsPktsRx128Octetsto255Octets = in bce_stats_update()
8100 stats->stat_EtherStatsPktsRx128Octetsto255Octets; in bce_stats_update()
8102 sc->stat_EtherStatsPktsRx256Octetsto511Octets = in bce_stats_update()
8103 stats->stat_EtherStatsPktsRx256Octetsto511Octets; in bce_stats_update()
8105 sc->stat_EtherStatsPktsRx512Octetsto1023Octets = in bce_stats_update()
8106 stats->stat_EtherStatsPktsRx512Octetsto1023Octets; in bce_stats_update()
8108 sc->stat_EtherStatsPktsRx1024Octetsto1522Octets = in bce_stats_update()
8109 stats->stat_EtherStatsPktsRx1024Octetsto1522Octets; in bce_stats_update()
8111 sc->stat_EtherStatsPktsRx1523Octetsto9022Octets = in bce_stats_update()
8112 stats->stat_EtherStatsPktsRx1523Octetsto9022Octets; in bce_stats_update()
8114 sc->stat_EtherStatsPktsTx64Octets = in bce_stats_update()
8115 stats->stat_EtherStatsPktsTx64Octets; in bce_stats_update()
8117 sc->stat_EtherStatsPktsTx65Octetsto127Octets = in bce_stats_update()
8118 stats->stat_EtherStatsPktsTx65Octetsto127Octets; in bce_stats_update()
8120 sc->stat_EtherStatsPktsTx128Octetsto255Octets = in bce_stats_update()
8121 stats->stat_EtherStatsPktsTx128Octetsto255Octets; in bce_stats_update()
8123 sc->stat_EtherStatsPktsTx256Octetsto511Octets = in bce_stats_update()
8124 stats->stat_EtherStatsPktsTx256Octetsto511Octets; in bce_stats_update()
8126 sc->stat_EtherStatsPktsTx512Octetsto1023Octets = in bce_stats_update()
8127 stats->stat_EtherStatsPktsTx512Octetsto1023Octets; in bce_stats_update()
8129 sc->stat_EtherStatsPktsTx1024Octetsto1522Octets = in bce_stats_update()
8130 stats->stat_EtherStatsPktsTx1024Octetsto1522Octets; in bce_stats_update()
8132 sc->stat_EtherStatsPktsTx1523Octetsto9022Octets = in bce_stats_update()
8133 stats->stat_EtherStatsPktsTx1523Octetsto9022Octets; in bce_stats_update()
8135 sc->stat_XonPauseFramesReceived = in bce_stats_update()
8136 stats->stat_XonPauseFramesReceived; in bce_stats_update()
8138 sc->stat_XoffPauseFramesReceived = in bce_stats_update()
8139 stats->stat_XoffPauseFramesReceived; in bce_stats_update()
8141 sc->stat_OutXonSent = in bce_stats_update()
8142 stats->stat_OutXonSent; in bce_stats_update()
8144 sc->stat_OutXoffSent = in bce_stats_update()
8145 stats->stat_OutXoffSent; in bce_stats_update()
8147 sc->stat_FlowControlDone = in bce_stats_update()
8148 stats->stat_FlowControlDone; in bce_stats_update()
8150 sc->stat_MacControlFramesReceived = in bce_stats_update()
8151 stats->stat_MacControlFramesReceived; in bce_stats_update()
8153 sc->stat_XoffStateEntered = in bce_stats_update()
8154 stats->stat_XoffStateEntered; in bce_stats_update()
8156 sc->stat_IfInFramesL2FilterDiscards = in bce_stats_update()
8157 stats->stat_IfInFramesL2FilterDiscards; in bce_stats_update()
8159 sc->stat_IfInRuleCheckerDiscards = in bce_stats_update()
8160 stats->stat_IfInRuleCheckerDiscards; in bce_stats_update()
8162 sc->stat_IfInFTQDiscards = in bce_stats_update()
8163 stats->stat_IfInFTQDiscards; in bce_stats_update()
8165 sc->stat_IfInMBUFDiscards = in bce_stats_update()
8166 stats->stat_IfInMBUFDiscards; in bce_stats_update()
8168 sc->stat_IfInRuleCheckerP4Hit = in bce_stats_update()
8169 stats->stat_IfInRuleCheckerP4Hit; in bce_stats_update()
8171 sc->stat_CatchupInRuleCheckerDiscards = in bce_stats_update()
8172 stats->stat_CatchupInRuleCheckerDiscards; in bce_stats_update()
8174 sc->stat_CatchupInFTQDiscards = in bce_stats_update()
8175 stats->stat_CatchupInFTQDiscards; in bce_stats_update()
8177 sc->stat_CatchupInMBUFDiscards = in bce_stats_update()
8178 stats->stat_CatchupInMBUFDiscards; in bce_stats_update()
8180 sc->stat_CatchupInRuleCheckerP4Hit = in bce_stats_update()
8181 stats->stat_CatchupInRuleCheckerP4Hit; in bce_stats_update()
8183 sc->com_no_buffers = REG_RD_IND(sc, 0x120084); in bce_stats_update()
8200 return (sc->stat_EtherStatsCollisions); in bce_get_counter()
8202 return (sc->stat_EtherStatsUndersizePkts + in bce_get_counter()
8203 sc->stat_EtherStatsOversizePkts + in bce_get_counter()
8204 sc->stat_IfInMBUFDiscards + in bce_get_counter()
8205 sc->stat_Dot3StatsAlignmentErrors + in bce_get_counter()
8206 sc->stat_Dot3StatsFCSErrors + in bce_get_counter()
8207 sc->stat_IfInRuleCheckerDiscards + in bce_get_counter()
8208 sc->stat_IfInFTQDiscards + in bce_get_counter()
8209 sc->l2fhdr_error_count + in bce_get_counter()
8210 sc->com_no_buffers); in bce_get_counter()
8212 rv = sc->stat_Dot3StatsExcessiveCollisions + in bce_get_counter()
8213 sc->stat_emac_tx_stat_dot3statsinternalmactransmiterrors + in bce_get_counter()
8214 sc->stat_Dot3StatsLateCollisions + in bce_get_counter()
8215 sc->watchdog_timeouts; in bce_get_counter()
8223 rv += sc->stat_Dot3StatsCarrierSenseErrors; in bce_get_counter()
8248 msg = (u32) ++sc->bce_fw_drv_pulse_wr_seq; in bce_pulse()
8252 sc->bc_state = bce_shmem_rd(sc, BCE_BC_STATE_CONDITION); in bce_pulse()
8256 if (sc->bce_drv_cardiac_arrest == FALSE) { in bce_pulse()
8257 if (!(sc->bc_state & BCE_CONDITION_DRV_PRESENT)) { in bce_pulse()
8258 sc->bce_drv_cardiac_arrest = TRUE; in bce_pulse()
8262 __FUNCTION__, sc->bc_state); in bce_pulse()
8271 if (sc->bc_state & BCE_CONDITION_DRV_PRESENT) { in bce_pulse()
8272 sc->bce_drv_cardiac_arrest = FALSE; in bce_pulse()
8275 __FUNCTION__, sc->bc_state); in bce_pulse()
8281 callout_reset(&sc->bce_pulse_callout, hz, bce_pulse, sc); in bce_pulse()
8300 ifp = sc->bce_ifp; in bce_tick()
8307 callout_reset(&sc->bce_tick_callout, hz, bce_tick, sc); in bce_tick()
8312 /* Ensure page and RX chains get refilled in low-memory situations. */ in bce_tick()
8321 if (sc->bce_link_up == TRUE) in bce_tick()
8325 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) { in bce_tick()
8330 sc->bce_link_up = TRUE; in bce_tick()
8331 bce_miibus_statchg(sc->bce_dev); in bce_tick()
8334 mii = device_get_softc(sc->bce_miibus); in bce_tick()
8337 if ((mii->mii_media_status & IFM_ACTIVE) && in bce_tick()
8338 (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)) { in bce_tick()
8341 sc->bce_link_up = TRUE; in bce_tick()
8342 if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T || in bce_tick()
8343 IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX || in bce_tick()
8344 IFM_SUBTYPE(mii->mii_media_active) == IFM_2500_SX) && in bce_tick()
8349 if (sc->bce_link_up == TRUE) { in bce_tick()
8376 if ((sc->bce_phy_flags & BCE_PHY_SERDES_FLAG) != 0 && in bce_fw_cap_init()
8378 sc->bce_phy_flags &= ~BCE_PHY_REMOTE_PORT_FIBER_FLAG; in bce_fw_cap_init()
8379 sc->bce_phy_flags |= BCE_PHY_REMOTE_CAP_FLAG; in bce_fw_cap_init()
8382 sc->bce_phy_flags |= BCE_PHY_REMOTE_PORT_FIBER_FLAG; in bce_fw_cap_init()
8396 /* 0 for success, positive value for failure. */
8405 result = -1; in bce_sysctl_driver_state()
8408 if (error || !req->newptr) in bce_sysctl_driver_state()
8423 /* 0 for success, positive value for failure. */
8432 result = -1; in bce_sysctl_hw_state()
8435 if (error || !req->newptr) in bce_sysctl_hw_state()
8450 /* 0 for success, positive value for failure. */
8459 result = -1; in bce_sysctl_status_block()
8462 if (error || !req->newptr) in bce_sysctl_status_block()
8477 /* 0 for success, positive value for failure. */
8486 result = -1; in bce_sysctl_stats_block()
8489 if (error || !req->newptr) in bce_sysctl_stats_block()
8505 /* 0 for success, positive value for failure. */
8514 result = -1; in bce_sysctl_stats_clear()
8517 if (error || !req->newptr) in bce_sysctl_stats_clear()
8524 stats = (struct statistics_block *) sc->stats_block; in bce_sysctl_stats_clear()
8526 bus_dmamap_sync(sc->stats_tag, sc->stats_map, in bce_sysctl_stats_clear()
8533 sc->interrupts_rx = in bce_sysctl_stats_clear()
8534 sc->interrupts_tx = 0; in bce_sysctl_stats_clear()
8535 sc->tso_frames_requested = in bce_sysctl_stats_clear()
8536 sc->tso_frames_completed = in bce_sysctl_stats_clear()
8537 sc->tso_frames_failed = 0; in bce_sysctl_stats_clear()
8538 sc->rx_empty_count = in bce_sysctl_stats_clear()
8539 sc->tx_full_count = 0; in bce_sysctl_stats_clear()
8540 sc->rx_low_watermark = USABLE_RX_BD_ALLOC; in bce_sysctl_stats_clear()
8541 sc->tx_hi_watermark = 0; in bce_sysctl_stats_clear()
8542 sc->l2fhdr_error_count = in bce_sysctl_stats_clear()
8543 sc->l2fhdr_error_sim_count = 0; in bce_sysctl_stats_clear()
8544 sc->mbuf_alloc_failed_count = in bce_sysctl_stats_clear()
8545 sc->mbuf_alloc_failed_sim_count = 0; in bce_sysctl_stats_clear()
8546 sc->dma_map_addr_rx_failed_count = in bce_sysctl_stats_clear()
8547 sc->dma_map_addr_tx_failed_count = 0; in bce_sysctl_stats_clear()
8548 sc->mbuf_frag_count = 0; in bce_sysctl_stats_clear()
8549 sc->csum_offload_tcp_udp = in bce_sysctl_stats_clear()
8550 sc->csum_offload_ip = 0; in bce_sysctl_stats_clear()
8551 sc->vlan_tagged_frames_rcvd = in bce_sysctl_stats_clear()
8552 sc->vlan_tagged_frames_stripped = 0; in bce_sysctl_stats_clear()
8553 sc->split_header_frames_rcvd = in bce_sysctl_stats_clear()
8554 sc->split_header_tcp_frames_rcvd = 0; in bce_sysctl_stats_clear()
8568 /* 0 for success, positive value for failure. */
8577 result = -1; in bce_sysctl_shmem_state()
8580 if (error || !req->newptr) in bce_sysctl_shmem_state()
8595 /* 0 for success, positive value for failure. */
8604 result = -1; in bce_sysctl_bc_state()
8607 if (error || !req->newptr) in bce_sysctl_bc_state()
8622 /* 0 for success, positive value for failure. */
8631 result = -1; in bce_sysctl_dump_rx_bd_chain()
8634 if (error || !req->newptr) in bce_sysctl_dump_rx_bd_chain()
8649 /* 0 for success, positive value for failure. */
8658 result = -1; in bce_sysctl_dump_rx_mbuf_chain()
8661 if (error || !req->newptr) in bce_sysctl_dump_rx_mbuf_chain()
8676 /* 0 for success, positive value for failure. */
8685 result = -1; in bce_sysctl_dump_tx_chain()
8688 if (error || !req->newptr) in bce_sysctl_dump_tx_chain()
8703 /* 0 for success, positive value for failure. */
8712 result = -1; in bce_sysctl_dump_pg_chain()
8715 if (error || !req->newptr) in bce_sysctl_dump_pg_chain()
8731 /* 0 for success, positive value for failure. */
8742 result = -1; in bce_sysctl_nvram_read()
8744 if (error || (req->newptr == NULL)) in bce_sysctl_nvram_read()
8759 /* 0 for success, positive value for failure. */
8768 result = -1; in bce_sysctl_reg_read()
8770 if (error || (req->newptr == NULL)) in bce_sysctl_reg_read()
8790 /* 0 for success, positive value for failure. */
8800 result = -1; in bce_sysctl_phy_read()
8802 if (error || (req->newptr == NULL)) in bce_sysctl_phy_read()
8808 dev = sc->bce_dev; in bce_sysctl_phy_read()
8809 val = bce_miibus_read_reg(dev, sc->bce_phy_addr, result); in bce_sysctl_phy_read()
8820 /* 0 for success, positive errno for failure. */
8828 if (sc->nvram_buf == NULL) in bce_sysctl_nvram_dump()
8829 sc->nvram_buf = malloc(sc->bce_flash_size, in bce_sysctl_nvram_dump()
8833 if (req->oldlen == sc->bce_flash_size) { in bce_sysctl_nvram_dump()
8834 for (i = 0; i < sc->bce_flash_size && error == 0; i++) in bce_sysctl_nvram_dump()
8835 error = bce_nvram_read(sc, i, &sc->nvram_buf[i], 1); in bce_sysctl_nvram_dump()
8839 error = SYSCTL_OUT(req, sc->nvram_buf, sc->bce_flash_size); in bce_sysctl_nvram_dump()
8850 /* 0 for success, positive errno for failure. */
8858 if (sc->nvram_buf == NULL) in bce_sysctl_nvram_write()
8859 sc->nvram_buf = malloc(sc->bce_flash_size, in bce_sysctl_nvram_write()
8862 bzero(sc->nvram_buf, sc->bce_flash_size); in bce_sysctl_nvram_write()
8864 error = SYSCTL_IN(req, sc->nvram_buf, sc->bce_flash_size); in bce_sysctl_nvram_write()
8868 if (req->newlen == sc->bce_flash_size) in bce_sysctl_nvram_write()
8869 error = bce_nvram_write(sc, 0, sc->nvram_buf, in bce_sysctl_nvram_write()
8870 sc->bce_flash_size); in bce_sysctl_nvram_write()
8880 /* 0 for success, positive value for failure. */
8888 result = -1; in bce_sysctl_dump_ctx()
8890 if (error || (req->newptr == NULL)) in bce_sysctl_dump_ctx()
8907 /* 0 for success, positive value for failure. */
8916 result = -1; in bce_sysctl_breakpoint()
8919 if (error || !req->newptr) in bce_sysctl_breakpoint()
8935 /* 0 for success, positive value for failure. */
8945 ctx = device_get_sysctl_ctx(sc->bce_dev); in bce_add_sysctls()
8946 children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->bce_dev)); in bce_add_sysctls()
8956 CTLFLAG_RD, &sc->l2fhdr_error_sim_count, in bce_add_sysctls()
8962 CTLFLAG_RD, &sc->l2fhdr_error_count, in bce_add_sysctls()
8973 CTLFLAG_RD, &sc->mbuf_alloc_failed_sim_count, in bce_add_sysctls()
8979 CTLFLAG_RD, &sc->mbuf_alloc_failed_count, in bce_add_sysctls()
8984 CTLFLAG_RD, &sc->mbuf_frag_count, in bce_add_sysctls()
8996 CTLFLAG_RD, &sc->dma_map_addr_failed_sim_count, in bce_add_sysctls()
9003 CTLFLAG_RD, &sc->dma_map_addr_rx_failed_count, in bce_add_sysctls()
9008 CTLFLAG_RD, &sc->dma_map_addr_tx_failed_count, in bce_add_sysctls()
9019 CTLFLAG_RW, &sc->unexpected_attention_sim_count, in bce_add_sysctls()
9025 CTLFLAG_RW, &sc->unexpected_attention_count, in bce_add_sysctls()
9036 CTLFLAG_RD, &sc->rx_low_watermark, in bce_add_sysctls()
9041 CTLFLAG_RD, &sc->rx_empty_count, in bce_add_sysctls()
9046 CTLFLAG_RD, &sc->tx_hi_watermark, in bce_add_sysctls()
9051 CTLFLAG_RD, &sc->tx_full_count, in bce_add_sysctls()
9056 CTLFLAG_RD, &sc->tso_frames_requested, in bce_add_sysctls()
9061 CTLFLAG_RD, &sc->tso_frames_completed, in bce_add_sysctls()
9066 CTLFLAG_RD, &sc->tso_frames_failed, in bce_add_sysctls()
9071 CTLFLAG_RD, &sc->csum_offload_ip, in bce_add_sysctls()
9076 CTLFLAG_RD, &sc->csum_offload_tcp_udp, in bce_add_sysctls()
9081 CTLFLAG_RD, &sc->vlan_tagged_frames_rcvd, in bce_add_sysctls()
9086 CTLFLAG_RD, &sc->vlan_tagged_frames_stripped, in bce_add_sysctls()
9091 CTLFLAG_RD, &sc->interrupts_rx, in bce_add_sysctls()
9096 CTLFLAG_RD, &sc->interrupts_tx, in bce_add_sysctls()
9102 CTLFLAG_RD, &sc->split_header_frames_rcvd, in bce_add_sysctls()
9107 CTLFLAG_RD, &sc->split_header_tcp_frames_rcvd, in bce_add_sysctls()
9126 CTLFLAG_RD, &sc->stat_IfHCInOctets, in bce_add_sysctls()
9131 CTLFLAG_RD, &sc->stat_IfHCInBadOctets, in bce_add_sysctls()
9136 CTLFLAG_RD, &sc->stat_IfHCOutOctets, in bce_add_sysctls()
9141 CTLFLAG_RD, &sc->stat_IfHCOutBadOctets, in bce_add_sysctls()
9146 CTLFLAG_RD, &sc->stat_IfHCInUcastPkts, in bce_add_sysctls()
9151 CTLFLAG_RD, &sc->stat_IfHCInMulticastPkts, in bce_add_sysctls()
9156 CTLFLAG_RD, &sc->stat_IfHCInBroadcastPkts, in bce_add_sysctls()
9161 CTLFLAG_RD, &sc->stat_IfHCOutUcastPkts, in bce_add_sysctls()
9166 CTLFLAG_RD, &sc->stat_IfHCOutMulticastPkts, in bce_add_sysctls()
9171 CTLFLAG_RD, &sc->stat_IfHCOutBroadcastPkts, in bce_add_sysctls()
9176 CTLFLAG_RD, &sc->stat_emac_tx_stat_dot3statsinternalmactransmiterrors, in bce_add_sysctls()
9181 CTLFLAG_RD, &sc->stat_Dot3StatsCarrierSenseErrors, in bce_add_sysctls()
9186 CTLFLAG_RD, &sc->stat_Dot3StatsFCSErrors, in bce_add_sysctls()
9191 CTLFLAG_RD, &sc->stat_Dot3StatsAlignmentErrors, in bce_add_sysctls()
9196 CTLFLAG_RD, &sc->stat_Dot3StatsSingleCollisionFrames, in bce_add_sysctls()
9201 CTLFLAG_RD, &sc->stat_Dot3StatsMultipleCollisionFrames, in bce_add_sysctls()
9206 CTLFLAG_RD, &sc->stat_Dot3StatsDeferredTransmissions, in bce_add_sysctls()
9211 CTLFLAG_RD, &sc->stat_Dot3StatsExcessiveCollisions, in bce_add_sysctls()
9216 CTLFLAG_RD, &sc->stat_Dot3StatsLateCollisions, in bce_add_sysctls()
9221 CTLFLAG_RD, &sc->stat_EtherStatsCollisions, in bce_add_sysctls()
9226 CTLFLAG_RD, &sc->stat_EtherStatsFragments, in bce_add_sysctls()
9231 CTLFLAG_RD, &sc->stat_EtherStatsJabbers, in bce_add_sysctls()
9236 CTLFLAG_RD, &sc->stat_EtherStatsUndersizePkts, in bce_add_sysctls()
9241 CTLFLAG_RD, &sc->stat_EtherStatsOversizePkts, in bce_add_sysctls()
9246 CTLFLAG_RD, &sc->stat_EtherStatsPktsRx64Octets, in bce_add_sysctls()
9251 CTLFLAG_RD, &sc->stat_EtherStatsPktsRx65Octetsto127Octets, in bce_add_sysctls()
9256 CTLFLAG_RD, &sc->stat_EtherStatsPktsRx128Octetsto255Octets, in bce_add_sysctls()
9261 CTLFLAG_RD, &sc->stat_EtherStatsPktsRx256Octetsto511Octets, in bce_add_sysctls()
9266 CTLFLAG_RD, &sc->stat_EtherStatsPktsRx512Octetsto1023Octets, in bce_add_sysctls()
9271 CTLFLAG_RD, &sc->stat_EtherStatsPktsRx1024Octetsto1522Octets, in bce_add_sysctls()
9276 CTLFLAG_RD, &sc->stat_EtherStatsPktsRx1523Octetsto9022Octets, in bce_add_sysctls()
9281 CTLFLAG_RD, &sc->stat_EtherStatsPktsTx64Octets, in bce_add_sysctls()
9286 CTLFLAG_RD, &sc->stat_EtherStatsPktsTx65Octetsto127Octets, in bce_add_sysctls()
9291 CTLFLAG_RD, &sc->stat_EtherStatsPktsTx128Octetsto255Octets, in bce_add_sysctls()
9296 CTLFLAG_RD, &sc->stat_EtherStatsPktsTx256Octetsto511Octets, in bce_add_sysctls()
9301 CTLFLAG_RD, &sc->stat_EtherStatsPktsTx512Octetsto1023Octets, in bce_add_sysctls()
9306 CTLFLAG_RD, &sc->stat_EtherStatsPktsTx1024Octetsto1522Octets, in bce_add_sysctls()
9311 CTLFLAG_RD, &sc->stat_EtherStatsPktsTx1523Octetsto9022Octets, in bce_add_sysctls()
9316 CTLFLAG_RD, &sc->stat_XonPauseFramesReceived, in bce_add_sysctls()
9321 CTLFLAG_RD, &sc->stat_XoffPauseFramesReceived, in bce_add_sysctls()
9326 CTLFLAG_RD, &sc->stat_OutXonSent, in bce_add_sysctls()
9331 CTLFLAG_RD, &sc->stat_OutXoffSent, in bce_add_sysctls()
9336 CTLFLAG_RD, &sc->stat_FlowControlDone, in bce_add_sysctls()
9341 CTLFLAG_RD, &sc->stat_MacControlFramesReceived, in bce_add_sysctls()
9346 CTLFLAG_RD, &sc->stat_XoffStateEntered, in bce_add_sysctls()
9351 CTLFLAG_RD, &sc->stat_IfInFramesL2FilterDiscards, in bce_add_sysctls()
9356 CTLFLAG_RD, &sc->stat_IfInRuleCheckerDiscards, in bce_add_sysctls()
9361 CTLFLAG_RD, &sc->stat_IfInFTQDiscards, in bce_add_sysctls()
9366 CTLFLAG_RD, &sc->stat_IfInMBUFDiscards, in bce_add_sysctls()
9372 CTLFLAG_RD, &sc->stat_IfInRuleCheckerP4Hit, in bce_add_sysctls()
9377 CTLFLAG_RD, &sc->stat_CatchupInRuleCheckerDiscards, in bce_add_sysctls()
9382 CTLFLAG_RD, &sc->stat_CatchupInFTQDiscards, in bce_add_sysctls()
9387 CTLFLAG_RD, &sc->stat_CatchupInMBUFDiscards, in bce_add_sysctls()
9393 CTLFLAG_RD, &sc->stat_CatchupInRuleCheckerP4Hit, in bce_add_sysctls()
9398 CTLFLAG_RD, &sc->com_no_buffers, in bce_add_sysctls()
9546 "-----------------------------" in bce_dump_enet()
9548 "-----------------------------\n"); in bce_dump_enet()
9553 if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { in bce_dump_enet()
9554 etype = ntohs(eh->evl_proto); in bce_dump_enet()
9557 etype = ntohs(eh->evl_encap_proto); in bce_dump_enet()
9563 eh->evl_dhost, ":", eh->evl_shost, ":", etype, ehlen); in bce_dump_enet()
9567 ip = (struct ip *)(m->m_data + ehlen); in bce_dump_enet()
9568 BCE_PRINTF("--ip: dest = 0x%08X , src = 0x%08X, " in bce_dump_enet()
9570 ntohl(ip->ip_dst.s_addr), ntohl(ip->ip_src.s_addr), in bce_dump_enet()
9571 ntohs(ip->ip_len), ip->ip_p, ntohs(ip->ip_sum)); in bce_dump_enet()
9573 switch (ip->ip_p) { in bce_dump_enet()
9575 th = (struct tcphdr *)((caddr_t)ip + (ip->ip_hl << 2)); in bce_dump_enet()
9576 BCE_PRINTF("-tcp: dest = %d, src = %d, hlen = " in bce_dump_enet()
9578 ntohs(th->th_dport), ntohs(th->th_sport), in bce_dump_enet()
9579 (th->th_off << 2), th->th_flags, in bce_dump_enet()
9581 "\02SYN\01FIN", ntohs(th->th_sum)); in bce_dump_enet()
9584 uh = (struct udphdr *)((caddr_t)ip + (ip->ip_hl << 2)); in bce_dump_enet()
9585 BCE_PRINTF("-udp: dest = %d, src = %d, len = %d " in bce_dump_enet()
9586 "bytes, csum = 0x%04X\n", ntohs(uh->uh_dport), in bce_dump_enet()
9587 ntohs(uh->uh_sport), ntohs(uh->uh_ulen), in bce_dump_enet()
9588 ntohs(uh->uh_sum)); in bce_dump_enet()
9594 BCE_PRINTF("----: Other IP protocol.\n"); in bce_dump_enet()
9601 BCE_PRINTF("-arp: "); in bce_dump_enet()
9602 ah = (struct arphdr *) (m->m_data + ehlen); in bce_dump_enet()
9603 switch (ntohs(ah->ar_op)) { in bce_dump_enet()
9621 BCE_PRINTF("----: Other protocol.\n"); in bce_dump_enet()
9625 "-----------------------------" in bce_dump_enet()
9626 "--------------" in bce_dump_enet()
9627 "-----------------------------\n"); in bce_dump_enet()
9648 "m_data = %p\n", mp, mp->m_len, mp->m_flags, in bce_dump_mbuf()
9649 "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY", mp->m_data); in bce_dump_mbuf()
9651 if (mp->m_flags & M_PKTHDR) { in bce_dump_mbuf()
9652 BCE_PRINTF("- m_pkthdr: len = %d, flags = 0x%b, " in bce_dump_mbuf()
9653 "csum_flags = %b\n", mp->m_pkthdr.len, in bce_dump_mbuf()
9654 mp->m_flags, M_FLAG_PRINTF, in bce_dump_mbuf()
9655 mp->m_pkthdr.csum_flags, CSUM_BITS); in bce_dump_mbuf()
9658 if (mp->m_flags & M_EXT) { in bce_dump_mbuf()
9659 BCE_PRINTF("- m_ext: %p, ext_size = %d, type = ", in bce_dump_mbuf()
9660 mp->m_ext.ext_buf, mp->m_ext.ext_size); in bce_dump_mbuf()
9661 switch (mp->m_ext.ext_type) { in bce_dump_mbuf()
9687 mp = mp->m_next; in bce_dump_mbuf()
9703 "----------------------------" in bce_dump_tx_mbuf_chain()
9705 "----------------------------\n"); in bce_dump_tx_mbuf_chain()
9708 m = sc->tx_mbuf_ptr[chain_prod]; in bce_dump_tx_mbuf_chain()
9715 "----------------------------" in bce_dump_tx_mbuf_chain()
9716 "----------------" in bce_dump_tx_mbuf_chain()
9717 "----------------------------\n"); in bce_dump_tx_mbuf_chain()
9732 "----------------------------" in bce_dump_rx_mbuf_chain()
9734 "----------------------------\n"); in bce_dump_rx_mbuf_chain()
9737 m = sc->rx_mbuf_ptr[chain_prod]; in bce_dump_rx_mbuf_chain()
9744 "----------------------------" in bce_dump_rx_mbuf_chain()
9745 "----------------" in bce_dump_rx_mbuf_chain()
9746 "----------------------------\n"); in bce_dump_rx_mbuf_chain()
9761 "----------------------------" in bce_dump_pg_mbuf_chain()
9763 "----------------------------\n"); in bce_dump_pg_mbuf_chain()
9766 m = sc->pg_mbuf_ptr[chain_prod]; in bce_dump_pg_mbuf_chain()
9773 "----------------------------" in bce_dump_pg_mbuf_chain()
9774 "----------------" in bce_dump_pg_mbuf_chain()
9775 "----------------------------\n"); in bce_dump_pg_mbuf_chain()
9795 "pointer\n", idx, txbd->tx_bd_haddr_hi, in bce_dump_txbd()
9796 txbd->tx_bd_haddr_lo); in bce_dump_txbd()
9801 "0x%04X (", idx, txbd->tx_bd_haddr_hi, in bce_dump_txbd()
9802 txbd->tx_bd_haddr_lo, txbd->tx_bd_mss_nbytes, in bce_dump_txbd()
9803 txbd->tx_bd_vlan_tag, txbd->tx_bd_flags); in bce_dump_txbd()
9805 if (txbd->tx_bd_flags & TX_BD_FLAGS_CONN_FAULT) { in bce_dump_txbd()
9812 if (txbd->tx_bd_flags & TX_BD_FLAGS_TCP_UDP_CKSUM) { in bce_dump_txbd()
9819 if (txbd->tx_bd_flags & TX_BD_FLAGS_IP_CKSUM) { in bce_dump_txbd()
9826 if (txbd->tx_bd_flags & TX_BD_FLAGS_VLAN_TAG) { in bce_dump_txbd()
9833 if (txbd->tx_bd_flags & TX_BD_FLAGS_COAL_NOW) { in bce_dump_txbd()
9840 if (txbd->tx_bd_flags & TX_BD_FLAGS_DONT_GEN_CRC) { in bce_dump_txbd()
9847 if (txbd->tx_bd_flags & TX_BD_FLAGS_START) { in bce_dump_txbd()
9854 if (txbd->tx_bd_flags & TX_BD_FLAGS_END) { in bce_dump_txbd()
9861 if (txbd->tx_bd_flags & TX_BD_FLAGS_SW_LSO) { in bce_dump_txbd()
9868 if (txbd->tx_bd_flags & TX_BD_FLAGS_SW_OPTION_WORD) { in bce_dump_txbd()
9871 printf("SW_OPTION=%d", ((txbd->tx_bd_flags & in bce_dump_txbd()
9875 if (txbd->tx_bd_flags & TX_BD_FLAGS_SW_FLAGS) { in bce_dump_txbd()
9882 if (txbd->tx_bd_flags & TX_BD_FLAGS_SW_SNAP) { in bce_dump_txbd()
9907 "pointer\n", idx, rxbd->rx_bd_haddr_hi, in bce_dump_rxbd()
9908 rxbd->rx_bd_haddr_lo); in bce_dump_rxbd()
9912 "0x%08X, flags = 0x%08X\n", idx, rxbd->rx_bd_haddr_hi, in bce_dump_rxbd()
9913 rxbd->rx_bd_haddr_lo, rxbd->rx_bd_len, in bce_dump_rxbd()
9914 rxbd->rx_bd_flags); in bce_dump_rxbd()
9932 idx, pgbd->rx_bd_haddr_hi, pgbd->rx_bd_haddr_lo); in bce_dump_pgbd()
9937 pgbd->rx_bd_haddr_hi, pgbd->rx_bd_haddr_lo, in bce_dump_pgbd()
9938 pgbd->rx_bd_len, pgbd->rx_bd_flags); in bce_dump_pgbd()
9953 l2fhdr->l2_fhdr_status, BCE_L2FHDR_PRINTFB, in bce_dump_l2fhdr()
9954 l2fhdr->l2_fhdr_pkt_len, l2fhdr->l2_fhdr_vlan_tag, in bce_dump_l2fhdr()
9955 l2fhdr->l2_fhdr_ip_xsum, l2fhdr->l2_fhdr_tcp_udp_xsum); in bce_dump_l2fhdr()
9973 "----------------------------" in bce_dump_ctx()
9975 "----------------------------\n"); in bce_dump_ctx()
9977 BCE_PRINTF(" 0x%04X - (CID) Context ID\n", cid); in bce_dump_ctx()
9980 BCE_PRINTF(" 0x%08X - (L2CTX_RX_HOST_BDIDX) host rx " in bce_dump_ctx()
9983 BCE_PRINTF(" 0x%08X - (L2CTX_RX_HOST_BSEQ) host " in bce_dump_ctx()
9986 BCE_PRINTF(" 0x%08X - (L2CTX_RX_NX_BSEQ) h/w byte sequence\n", in bce_dump_ctx()
9988 BCE_PRINTF(" 0x%08X - (L2CTX_RX_NX_BDHADDR_HI) h/w buffer " in bce_dump_ctx()
9991 BCE_PRINTF(" 0x%08X - (L2CTX_RX_NX_BDHADDR_LO) h/w buffer " in bce_dump_ctx()
9994 BCE_PRINTF(" 0x%08X - (L2CTX_RX_NX_BDIDX) h/w rx consumer " in bce_dump_ctx()
9997 BCE_PRINTF(" 0x%08X - (L2CTX_RX_HOST_PG_BDIDX) host page " in bce_dump_ctx()
10000 BCE_PRINTF(" 0x%08X - (L2CTX_RX_PG_BUF_SIZE) host rx_bd/page " in bce_dump_ctx()
10003 BCE_PRINTF(" 0x%08X - (L2CTX_RX_NX_PG_BDHADDR_HI) h/w page " in bce_dump_ctx()
10006 BCE_PRINTF(" 0x%08X - (L2CTX_RX_NX_PG_BDHADDR_LO) h/w page " in bce_dump_ctx()
10009 BCE_PRINTF(" 0x%08X - (L2CTX_RX_NX_PG_BDIDX) h/w page " in bce_dump_ctx()
10014 BCE_PRINTF(" 0x%08X - (L2CTX_TX_TYPE_XI) ctx type\n", in bce_dump_ctx()
10017 BCE_PRINTF(" 0x%08X - (L2CTX_CMD_TX_TYPE_XI) ctx " in bce_dump_ctx()
10020 BCE_PRINTF(" 0x%08X - (L2CTX_TX_TBDR_BDHADDR_HI_XI) " in bce_dump_ctx()
10024 BCE_PRINTF(" 0x%08X - (L2CTX_TX_TBDR_BHADDR_LO_XI) " in bce_dump_ctx()
10028 BCE_PRINTF(" 0x%08X - (L2CTX_TX_HOST_BIDX_XI) " in bce_dump_ctx()
10032 BCE_PRINTF(" 0x%08X - (L2CTX_TX_HOST_BSEQ_XI) " in bce_dump_ctx()
10037 BCE_PRINTF(" 0x%08X - (L2CTX_TX_TYPE) ctx type\n", in bce_dump_ctx()
10039 BCE_PRINTF(" 0x%08X - (L2CTX_TX_CMD_TYPE) ctx cmd\n", in bce_dump_ctx()
10042 BCE_PRINTF(" 0x%08X - (L2CTX_TX_TBDR_BDHADDR_HI) " in bce_dump_ctx()
10046 BCE_PRINTF(" 0x%08X - (L2CTX_TX_TBDR_BHADDR_LO) " in bce_dump_ctx()
10050 BCE_PRINTF(" 0x%08X - (L2CTX_TX_HOST_BIDX) host " in bce_dump_ctx()
10053 BCE_PRINTF(" 0x%08X - (L2CTX_TX_HOST_BSEQ) host byte " in bce_dump_ctx()
10060 "----------------------------" in bce_dump_ctx()
10062 "----------------------------\n"); in bce_dump_ctx()
10073 "----------------------------" in bce_dump_ctx()
10074 "----------------" in bce_dump_ctx()
10075 "----------------------------\n"); in bce_dump_ctx()
10090 "----------------------------" in bce_dump_ftqs()
10092 "----------------------------\n"); in bce_dump_ftqs()
10096 BCE_PRINTF(" ------- ---------- ---------- ---------- " in bce_dump_ftqs()
10097 "---------- ----------\n"); in bce_dump_ftqs()
10223 /* Input queue to the Transmit Patch-Up Processor */ in bce_dump_ftqs()
10318 "----------------------------" in bce_dump_ftqs()
10319 "----------------" in bce_dump_ftqs()
10320 "----------------------------\n"); in bce_dump_ftqs()
10336 "----------------------------" in bce_dump_tx_chain()
10338 "----------------------------\n"); in bce_dump_tx_chain()
10341 (u32) BCM_PAGE_SIZE, (u32) sc->tx_pages); in bce_dump_tx_chain()
10347 "----------------------------" in bce_dump_tx_chain()
10349 "----------------------------\n"); in bce_dump_tx_chain()
10353 txbd = &sc->tx_bd_chain[TX_PAGE(tx_prod)][TX_IDX(tx_prod)]; in bce_dump_tx_chain()
10359 "----------------------------" in bce_dump_tx_chain()
10360 "----------------" in bce_dump_tx_chain()
10361 "----------------------------\n"); in bce_dump_tx_chain()
10377 "----------------------------" in bce_dump_rx_bd_chain()
10379 "----------------------------\n"); in bce_dump_rx_bd_chain()
10382 (u32) BCM_PAGE_SIZE, (u32) sc->rx_pages); in bce_dump_rx_bd_chain()
10390 "----------------------------" in bce_dump_rx_bd_chain()
10392 "----------------------------\n"); in bce_dump_rx_bd_chain()
10396 rxbd = &sc->rx_bd_chain[RX_PAGE(rx_prod)][RX_IDX(rx_prod)]; in bce_dump_rx_bd_chain()
10402 "----------------------------" in bce_dump_rx_bd_chain()
10403 "----------------" in bce_dump_rx_bd_chain()
10404 "----------------------------\n"); in bce_dump_rx_bd_chain()
10420 "----------------------------" in bce_dump_pg_chain()
10422 "----------------------------\n"); in bce_dump_pg_chain()
10425 (u32) BCM_PAGE_SIZE, (u32) sc->pg_pages); in bce_dump_pg_chain()
10433 "----------------------------" in bce_dump_pg_chain()
10435 "----------------------------\n"); in bce_dump_pg_chain()
10439 pgbd = &sc->pg_bd_chain[PG_PAGE(pg_prod)][PG_IDX(pg_prod)]; in bce_dump_pg_chain()
10445 "----------------------------" in bce_dump_pg_chain()
10446 "----------------" in bce_dump_pg_chain()
10447 "----------------------------\n"); in bce_dump_pg_chain()
10451 if (sblk->status_rx_quick_consumer_index##arg) \
10452 BCE_PRINTF("0x%04X(0x%04X) - rx_quick_consumer_index%d\n", \
10453 sblk->status_rx_quick_consumer_index##arg, (u16) \
10454 RX_CHAIN_IDX(sblk->status_rx_quick_consumer_index##arg), \
10458 if (sblk->status_tx_quick_consumer_index##arg) \
10459 BCE_PRINTF("0x%04X(0x%04X) - tx_quick_consumer_index%d\n", \
10460 sblk->status_tx_quick_consumer_index##arg, (u16) \
10461 TX_CHAIN_IDX(sblk->status_tx_quick_consumer_index##arg), \
10475 bus_dmamap_sync(sc->status_tag, sc->status_map, BUS_DMASYNC_POSTREAD); in bce_dump_status_block()
10477 sblk = sc->status_block; in bce_dump_status_block()
10480 "----------------------------" in bce_dump_status_block()
10482 "----------------------------\n"); in bce_dump_status_block()
10485 BCE_PRINTF(" 0x%08X - attn_bits\n", in bce_dump_status_block()
10486 sblk->status_attn_bits); in bce_dump_status_block()
10488 BCE_PRINTF(" 0x%08X - attn_bits_ack\n", in bce_dump_status_block()
10489 sblk->status_attn_bits_ack); in bce_dump_status_block()
10494 BCE_PRINTF(" 0x%04X - status_idx\n", sblk->status_idx); in bce_dump_status_block()
10505 if (sblk->status_completion_producer_index || in bce_dump_status_block()
10506 sblk->status_cmd_consumer_index) in bce_dump_status_block()
10508 sblk->status_completion_producer_index, in bce_dump_status_block()
10509 sblk->status_cmd_consumer_index); in bce_dump_status_block()
10512 "----------------------------" in bce_dump_status_block()
10513 "----------------" in bce_dump_status_block()
10514 "----------------------------\n"); in bce_dump_status_block()
10518 if (sblk->arg##_lo || sblk->arg##_hi) \
10519 BCE_PRINTF("0x%08X:%08X : %s\n", sblk->arg##_hi, \
10520 sblk->arg##_lo, #arg);
10523 if (sblk->arg) \
10525 sblk->arg, #arg);
10538 bus_dmamap_sync(sc->stats_tag, sc->stats_map, BUS_DMASYNC_POSTREAD); in bce_dump_stats_block()
10540 sblk = sc->stats_block; in bce_dump_stats_block()
10543 "---------------" in bce_dump_stats_block()
10545 "---------------\n"); in bce_dump_stats_block()
10604 "----------------------------" in bce_dump_stats_block()
10605 "----------------" in bce_dump_stats_block()
10606 "----------------------------\n"); in bce_dump_stats_block()
10621 "-----------------------------" in bce_dump_driver_state()
10623 "-----------------------------\n"); in bce_dump_driver_state()
10627 BCE_PRINTF("0x%08X:%08X - (sc) driver softc structure virtual " in bce_dump_driver_state()
10630 val_hi = BCE_ADDR_HI(sc->bce_vhandle); in bce_dump_driver_state()
10631 val_lo = BCE_ADDR_LO(sc->bce_vhandle); in bce_dump_driver_state()
10632 BCE_PRINTF("0x%08X:%08X - (sc->bce_vhandle) PCI BAR virtual " in bce_dump_driver_state()
10635 val_hi = BCE_ADDR_HI(sc->status_block); in bce_dump_driver_state()
10636 val_lo = BCE_ADDR_LO(sc->status_block); in bce_dump_driver_state()
10637 BCE_PRINTF("0x%08X:%08X - (sc->status_block) status block " in bce_dump_driver_state()
10640 val_hi = BCE_ADDR_HI(sc->stats_block); in bce_dump_driver_state()
10641 val_lo = BCE_ADDR_LO(sc->stats_block); in bce_dump_driver_state()
10642 BCE_PRINTF("0x%08X:%08X - (sc->stats_block) statistics block " in bce_dump_driver_state()
10645 val_hi = BCE_ADDR_HI(sc->tx_bd_chain); in bce_dump_driver_state()
10646 val_lo = BCE_ADDR_LO(sc->tx_bd_chain); in bce_dump_driver_state()
10647 BCE_PRINTF("0x%08X:%08X - (sc->tx_bd_chain) tx_bd chain " in bce_dump_driver_state()
10650 val_hi = BCE_ADDR_HI(sc->rx_bd_chain); in bce_dump_driver_state()
10651 val_lo = BCE_ADDR_LO(sc->rx_bd_chain); in bce_dump_driver_state()
10652 BCE_PRINTF("0x%08X:%08X - (sc->rx_bd_chain) rx_bd chain " in bce_dump_driver_state()
10656 val_hi = BCE_ADDR_HI(sc->pg_bd_chain); in bce_dump_driver_state()
10657 val_lo = BCE_ADDR_LO(sc->pg_bd_chain); in bce_dump_driver_state()
10658 BCE_PRINTF("0x%08X:%08X - (sc->pg_bd_chain) page chain " in bce_dump_driver_state()
10662 val_hi = BCE_ADDR_HI(sc->tx_mbuf_ptr); in bce_dump_driver_state()
10663 val_lo = BCE_ADDR_LO(sc->tx_mbuf_ptr); in bce_dump_driver_state()
10664 BCE_PRINTF("0x%08X:%08X - (sc->tx_mbuf_ptr) tx mbuf chain " in bce_dump_driver_state()
10667 val_hi = BCE_ADDR_HI(sc->rx_mbuf_ptr); in bce_dump_driver_state()
10668 val_lo = BCE_ADDR_LO(sc->rx_mbuf_ptr); in bce_dump_driver_state()
10669 BCE_PRINTF("0x%08X:%08X - (sc->rx_mbuf_ptr) rx mbuf chain " in bce_dump_driver_state()
10673 val_hi = BCE_ADDR_HI(sc->pg_mbuf_ptr); in bce_dump_driver_state()
10674 val_lo = BCE_ADDR_LO(sc->pg_mbuf_ptr); in bce_dump_driver_state()
10675 BCE_PRINTF("0x%08X:%08X - (sc->pg_mbuf_ptr) page mbuf chain " in bce_dump_driver_state()
10679 BCE_PRINTF(" 0x%016llX - (sc->interrupts_generated) " in bce_dump_driver_state()
10681 (long long unsigned int) sc->interrupts_generated); in bce_dump_driver_state()
10683 BCE_PRINTF(" 0x%016llX - (sc->interrupts_rx) " in bce_dump_driver_state()
10685 (long long unsigned int) sc->interrupts_rx); in bce_dump_driver_state()
10687 BCE_PRINTF(" 0x%016llX - (sc->interrupts_tx) " in bce_dump_driver_state()
10689 (long long unsigned int) sc->interrupts_tx); in bce_dump_driver_state()
10691 BCE_PRINTF(" 0x%016llX - (sc->phy_interrupts) " in bce_dump_driver_state()
10693 (long long unsigned int) sc->phy_interrupts); in bce_dump_driver_state()
10695 BCE_PRINTF(" 0x%08X - (sc->last_status_idx) " in bce_dump_driver_state()
10696 "status block index\n", sc->last_status_idx); in bce_dump_driver_state()
10698 BCE_PRINTF(" 0x%04X(0x%04X) - (sc->tx_prod) tx producer " in bce_dump_driver_state()
10699 "index\n", sc->tx_prod, (u16) TX_CHAIN_IDX(sc->tx_prod)); in bce_dump_driver_state()
10701 BCE_PRINTF(" 0x%04X(0x%04X) - (sc->tx_cons) tx consumer " in bce_dump_driver_state()
10702 "index\n", sc->tx_cons, (u16) TX_CHAIN_IDX(sc->tx_cons)); in bce_dump_driver_state()
10704 BCE_PRINTF(" 0x%08X - (sc->tx_prod_bseq) tx producer " in bce_dump_driver_state()
10705 "byte seq index\n", sc->tx_prod_bseq); in bce_dump_driver_state()
10707 BCE_PRINTF(" 0x%08X - (sc->debug_tx_mbuf_alloc) tx " in bce_dump_driver_state()
10708 "mbufs allocated\n", sc->debug_tx_mbuf_alloc); in bce_dump_driver_state()
10710 BCE_PRINTF(" 0x%08X - (sc->used_tx_bd) used " in bce_dump_driver_state()
10711 "tx_bd's\n", sc->used_tx_bd); in bce_dump_driver_state()
10713 BCE_PRINTF(" 0x%04X/0x%04X - (sc->tx_hi_watermark)/" in bce_dump_driver_state()
10714 "(sc->max_tx_bd)\n", sc->tx_hi_watermark, sc->max_tx_bd); in bce_dump_driver_state()
10716 BCE_PRINTF(" 0x%04X(0x%04X) - (sc->rx_prod) rx producer " in bce_dump_driver_state()
10717 "index\n", sc->rx_prod, (u16) RX_CHAIN_IDX(sc->rx_prod)); in bce_dump_driver_state()
10719 BCE_PRINTF(" 0x%04X(0x%04X) - (sc->rx_cons) rx consumer " in bce_dump_driver_state()
10720 "index\n", sc->rx_cons, (u16) RX_CHAIN_IDX(sc->rx_cons)); in bce_dump_driver_state()
10722 BCE_PRINTF(" 0x%08X - (sc->rx_prod_bseq) rx producer " in bce_dump_driver_state()
10723 "byte seq index\n", sc->rx_prod_bseq); in bce_dump_driver_state()
10725 BCE_PRINTF(" 0x%04X/0x%04X - (sc->rx_low_watermark)/" in bce_dump_driver_state()
10726 "(sc->max_rx_bd)\n", sc->rx_low_watermark, sc->max_rx_bd); in bce_dump_driver_state()
10728 BCE_PRINTF(" 0x%08X - (sc->debug_rx_mbuf_alloc) rx " in bce_dump_driver_state()
10729 "mbufs allocated\n", sc->debug_rx_mbuf_alloc); in bce_dump_driver_state()
10731 BCE_PRINTF(" 0x%08X - (sc->free_rx_bd) free " in bce_dump_driver_state()
10732 "rx_bd's\n", sc->free_rx_bd); in bce_dump_driver_state()
10735 BCE_PRINTF(" 0x%04X(0x%04X) - (sc->pg_prod) page producer " in bce_dump_driver_state()
10736 "index\n", sc->pg_prod, (u16) PG_CHAIN_IDX(sc->pg_prod)); in bce_dump_driver_state()
10738 BCE_PRINTF(" 0x%04X(0x%04X) - (sc->pg_cons) page consumer " in bce_dump_driver_state()
10739 "index\n", sc->pg_cons, (u16) PG_CHAIN_IDX(sc->pg_cons)); in bce_dump_driver_state()
10741 BCE_PRINTF(" 0x%08X - (sc->debug_pg_mbuf_alloc) page " in bce_dump_driver_state()
10742 "mbufs allocated\n", sc->debug_pg_mbuf_alloc); in bce_dump_driver_state()
10745 BCE_PRINTF(" 0x%08X - (sc->free_pg_bd) free page " in bce_dump_driver_state()
10746 "rx_bd's\n", sc->free_pg_bd); in bce_dump_driver_state()
10748 BCE_PRINTF(" 0x%04X/0x%04X - (sc->pg_low_watermark)/" in bce_dump_driver_state()
10749 "(sc->max_pg_bd)\n", sc->pg_low_watermark, sc->max_pg_bd); in bce_dump_driver_state()
10751 BCE_PRINTF(" 0x%08X - (sc->mbuf_alloc_failed_count) " in bce_dump_driver_state()
10752 "mbuf alloc failures\n", sc->mbuf_alloc_failed_count); in bce_dump_driver_state()
10754 BCE_PRINTF(" 0x%08X - (sc->bce_flags) " in bce_dump_driver_state()
10755 "bce mac flags\n", sc->bce_flags); in bce_dump_driver_state()
10757 BCE_PRINTF(" 0x%08X - (sc->bce_phy_flags) " in bce_dump_driver_state()
10758 "bce phy flags\n", sc->bce_phy_flags); in bce_dump_driver_state()
10761 "----------------------------" in bce_dump_driver_state()
10762 "----------------" in bce_dump_driver_state()
10763 "----------------------------\n"); in bce_dump_driver_state()
10779 "----------------------------" in bce_dump_hw_state()
10781 "----------------------------\n"); in bce_dump_hw_state()
10783 BCE_PRINTF("%s - bootcode version\n", sc->bce_bc_ver); in bce_dump_hw_state()
10786 BCE_PRINTF("0x%08X - (0x%06X) misc_enable_status_bits\n", in bce_dump_hw_state()
10790 BCE_PRINTF("0x%08X - (0x%06X) dma_status\n", in bce_dump_hw_state()
10794 BCE_PRINTF("0x%08X - (0x%06X) ctx_status\n", in bce_dump_hw_state()
10798 BCE_PRINTF("0x%08X - (0x%06X) emac_status\n", in bce_dump_hw_state()
10802 BCE_PRINTF("0x%08X - (0x%06X) rpm_status\n", in bce_dump_hw_state()
10807 BCE_PRINTF("0x%08X - (0x%06X) rlup_status\n", in bce_dump_hw_state()
10811 BCE_PRINTF("0x%08X - (0x%06X) rv2p_status\n", in bce_dump_hw_state()
10816 BCE_PRINTF("0x%08X - (0x%06X) rdma_status\n", in bce_dump_hw_state()
10820 BCE_PRINTF("0x%08X - (0x%06X) tbdr_status\n", in bce_dump_hw_state()
10824 BCE_PRINTF("0x%08X - (0x%06X) tdma_status\n", in bce_dump_hw_state()
10828 BCE_PRINTF("0x%08X - (0x%06X) hc_status\n", in bce_dump_hw_state()
10832 BCE_PRINTF("0x%08X - (0x%06X) txp_cpu_state\n", in bce_dump_hw_state()
10836 BCE_PRINTF("0x%08X - (0x%06X) tpat_cpu_state\n", in bce_dump_hw_state()
10840 BCE_PRINTF("0x%08X - (0x%06X) rxp_cpu_state\n", in bce_dump_hw_state()
10844 BCE_PRINTF("0x%08X - (0x%06X) com_cpu_state\n", in bce_dump_hw_state()
10848 BCE_PRINTF("0x%08X - (0x%06X) mcp_cpu_state\n", in bce_dump_hw_state()
10852 BCE_PRINTF("0x%08X - (0x%06X) cp_cpu_state\n", in bce_dump_hw_state()
10856 "----------------------------" in bce_dump_hw_state()
10857 "----------------" in bce_dump_hw_state()
10858 "----------------------------\n"); in bce_dump_hw_state()
10861 "----------------------------" in bce_dump_hw_state()
10863 "----------------------------\n"); in bce_dump_hw_state()
10872 "----------------------------" in bce_dump_hw_state()
10873 "----------------" in bce_dump_hw_state()
10874 "----------------------------\n"); in bce_dump_hw_state()
10888 "----------------------------" in bce_dump_shmem_state()
10890 "----------------------------\n"); in bce_dump_shmem_state()
10892 BCE_PRINTF("0x%08X - Shared memory base address\n", in bce_dump_shmem_state()
10893 sc->bce_shmem_base); in bce_dump_shmem_state()
10894 BCE_PRINTF("%s - bootcode version\n", in bce_dump_shmem_state()
10895 sc->bce_bc_ver); in bce_dump_shmem_state()
10898 "----------------------------" in bce_dump_shmem_state()
10900 "----------------------------\n"); in bce_dump_shmem_state()
10909 "----------------------------" in bce_dump_shmem_state()
10910 "----------------" in bce_dump_shmem_state()
10911 "----------------------------\n"); in bce_dump_shmem_state()
10924 "----------------------------" in bce_dump_mq_regs()
10926 "----------------------------\n"); in bce_dump_mq_regs()
10929 "----------------------------" in bce_dump_mq_regs()
10930 "----------------" in bce_dump_mq_regs()
10931 "----------------------------\n"); in bce_dump_mq_regs()
10940 "----------------------------" in bce_dump_mq_regs()
10941 "----------------" in bce_dump_mq_regs()
10942 "----------------------------\n"); in bce_dump_mq_regs()
10957 "----------------------------" in bce_dump_bc_state()
10959 "----------------------------\n"); in bce_dump_bc_state()
10961 BCE_PRINTF("%s - bootcode version\n", sc->bce_bc_ver); in bce_dump_bc_state()
10964 BCE_PRINTF("0x%08X - (0x%06X) reset_type\n", in bce_dump_bc_state()
10968 BCE_PRINTF("0x%08X - (0x%06X) state\n", in bce_dump_bc_state()
10972 BCE_PRINTF("0x%08X - (0x%06X) condition\n", in bce_dump_bc_state()
10976 BCE_PRINTF("0x%08X - (0x%06X) debug_cmd\n", in bce_dump_bc_state()
10980 "----------------------------" in bce_dump_bc_state()
10981 "----------------" in bce_dump_bc_state()
10982 "----------------------------\n"); in bce_dump_bc_state()
10998 "----------------------------" in bce_dump_txp_state()
11000 "----------------------------\n"); in bce_dump_txp_state()
11005 BCE_PRINTF("Firmware version - %s\n", (char *) fw_version); in bce_dump_txp_state()
11008 BCE_PRINTF("0x%08X - (0x%06X) txp_cpu_mode\n", in bce_dump_txp_state()
11012 BCE_PRINTF("0x%08X - (0x%06X) txp_cpu_state\n", in bce_dump_txp_state()
11016 BCE_PRINTF("0x%08X - (0x%06X) txp_cpu_event_mask\n", in bce_dump_txp_state()
11021 "----------------------------" in bce_dump_txp_state()
11023 "----------------------------\n"); in bce_dump_txp_state()
11038 "----------------------------" in bce_dump_txp_state()
11039 "----------------" in bce_dump_txp_state()
11040 "----------------------------\n"); in bce_dump_txp_state()
11056 "----------------------------" in bce_dump_rxp_state()
11058 "----------------------------\n"); in bce_dump_rxp_state()
11064 BCE_PRINTF("Firmware version - %s\n", (char *) fw_version); in bce_dump_rxp_state()
11067 BCE_PRINTF("0x%08X - (0x%06X) rxp_cpu_mode\n", in bce_dump_rxp_state()
11071 BCE_PRINTF("0x%08X - (0x%06X) rxp_cpu_state\n", in bce_dump_rxp_state()
11075 BCE_PRINTF("0x%08X - (0x%06X) rxp_cpu_event_mask\n", in bce_dump_rxp_state()
11080 "----------------------------" in bce_dump_rxp_state()
11082 "----------------------------\n"); in bce_dump_rxp_state()
11097 "----------------------------" in bce_dump_rxp_state()
11098 "----------------" in bce_dump_rxp_state()
11099 "----------------------------\n"); in bce_dump_rxp_state()
11115 "----------------------------" in bce_dump_tpat_state()
11117 "----------------------------\n"); in bce_dump_tpat_state()
11123 BCE_PRINTF("Firmware version - %s\n", (char *) fw_version); in bce_dump_tpat_state()
11126 BCE_PRINTF("0x%08X - (0x%06X) tpat_cpu_mode\n", in bce_dump_tpat_state()
11130 BCE_PRINTF("0x%08X - (0x%06X) tpat_cpu_state\n", in bce_dump_tpat_state()
11134 BCE_PRINTF("0x%08X - (0x%06X) tpat_cpu_event_mask\n", in bce_dump_tpat_state()
11139 "----------------------------" in bce_dump_tpat_state()
11141 "----------------------------\n"); in bce_dump_tpat_state()
11156 "----------------------------" in bce_dump_tpat_state()
11157 "----------------" in bce_dump_tpat_state()
11158 "----------------------------\n"); in bce_dump_tpat_state()
11174 "----------------------------" in bce_dump_cp_state()
11176 "----------------------------\n"); in bce_dump_cp_state()
11182 BCE_PRINTF("Firmware version - %s\n", (char *) fw_version); in bce_dump_cp_state()
11185 BCE_PRINTF("0x%08X - (0x%06X) cp_cpu_mode\n", in bce_dump_cp_state()
11189 BCE_PRINTF("0x%08X - (0x%06X) cp_cpu_state\n", in bce_dump_cp_state()
11193 BCE_PRINTF("0x%08X - (0x%06X) cp_cpu_event_mask\n", val, in bce_dump_cp_state()
11198 "----------------------------" in bce_dump_cp_state()
11200 "----------------------------\n"); in bce_dump_cp_state()
11215 "----------------------------" in bce_dump_cp_state()
11216 "----------------" in bce_dump_cp_state()
11217 "----------------------------\n"); in bce_dump_cp_state()
11233 "----------------------------" in bce_dump_com_state()
11235 "----------------------------\n"); in bce_dump_com_state()
11241 BCE_PRINTF("Firmware version - %s\n", (char *) fw_version); in bce_dump_com_state()
11244 BCE_PRINTF("0x%08X - (0x%06X) com_cpu_mode\n", in bce_dump_com_state()
11248 BCE_PRINTF("0x%08X - (0x%06X) com_cpu_state\n", in bce_dump_com_state()
11252 BCE_PRINTF("0x%08X - (0x%06X) com_cpu_event_mask\n", val, in bce_dump_com_state()
11257 "----------------------------" in bce_dump_com_state()
11259 "----------------------------\n"); in bce_dump_com_state()
11272 "----------------------------" in bce_dump_com_state()
11273 "----------------" in bce_dump_com_state()
11274 "----------------------------\n"); in bce_dump_com_state()
11289 "----------------------------" in bce_dump_rv2p_state()
11291 "----------------------------\n"); in bce_dump_rv2p_state()
11304 BCE_PRINTF("RV2P1 Firmware version - 0x%08X:0x%08X\n", in bce_dump_rv2p_state()
11312 BCE_PRINTF("RV2P2 Firmware version - 0x%08X:0x%08X\n", in bce_dump_rv2p_state()
11326 BCE_PRINTF("0x%08X - RV2P1 program counter (1st read)\n", pc1); in bce_dump_rv2p_state()
11327 BCE_PRINTF("0x%08X - RV2P2 program counter (1st read)\n", pc2); in bce_dump_rv2p_state()
11335 BCE_PRINTF("0x%08X - RV2P1 program counter (2nd read)\n", pc1); in bce_dump_rv2p_state()
11336 BCE_PRINTF("0x%08X - RV2P2 program counter (2nd read)\n", pc2); in bce_dump_rv2p_state()
11339 "----------------------------" in bce_dump_rv2p_state()
11340 "----------------" in bce_dump_rv2p_state()
11341 "----------------------------\n"); in bce_dump_rv2p_state()