Lines Matching +full:freeze +full:- +full:bridge +full:- +full:controller
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"},
300 * logical-to-physical mapping is required in the
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");
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()
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()
1172 BCE_PRINTF("%s(%d): Unsupported controller " 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()
1310 /* Reset controller and announce to bootcode that driver is present. */ in bce_attach()
1312 BCE_PRINTF("%s(%d): Controller reset failed!\n", in bce_attach()
1318 /* Initialize the controller. */ in bce_attach()
1320 BCE_PRINTF("%s(%d): Controller initialization failed!\n", 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()
1509 /* Stops the controller, resets the controller, and releases resources. */
1523 ifp = sc->bce_ifp; in bce_detach()
1525 /* Stop and reset the controller. */ 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()
1560 /* Stops and resets the controller. */
1575 if (sc->bce_flags & BCE_NO_WOL_FLAG) in bce_shutdown()
1597 u32 val = bus_space_read_4(sc->bce_btag, sc->bce_bhandle, offset); in bce_reg_rd()
1614 bus_space_write_2(sc->bce_btag, sc->bce_bhandle, offset, val); in bce_reg_wr16()
1628 bus_space_write_4(sc->bce_btag, sc->bce_bhandle, offset, val); in bce_reg_wr()
1637 /* reads but is much slower than memory-mapped I/O. */
1646 dev = sc->bce_dev; in bce_reg_rd_ind()
1667 /* writes but is muchh slower than memory-mapped I/O. */
1676 dev = sc->bce_dev; in bce_reg_wr_ind()
1699 bce_reg_wr_ind(sc, sc->bce_shmem_base + offset, val); in bce_shmem_wr()
1713 u32 val = bce_reg_rd_ind(sc, sc->bce_shmem_base + offset); in bce_shmem_rd()
1725 /* The NetXtreme II controller uses context memory to track connection */
1773 /* The NetXtreme II controller uses context memory to track connection */
1836 if ((sc->bce_phy_flags & BCE_PHY_IEEE_CLAUSE_45_FLAG) != 0) { in bce_miibus_read_reg()
1841 if (sc->bce_phy_flags & BCE_PHY_INT_MODE_AUTO_POLLING_FLAG) { in bce_miibus_read_reg()
1878 if (sc->bce_phy_flags & BCE_PHY_INT_MODE_AUTO_POLLING_FLAG) { in bce_miibus_read_reg()
1916 if ((sc->bce_phy_flags & BCE_PHY_IEEE_CLAUSE_45_FLAG) != 0) { in bce_miibus_write_reg()
1921 if (sc->bce_phy_flags & BCE_PHY_INT_MODE_AUTO_POLLING_FLAG) { in bce_miibus_write_reg()
1950 if (sc->bce_phy_flags & BCE_PHY_INT_MODE_AUTO_POLLING_FLAG) { in bce_miibus_write_reg()
1984 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) { in bce_miibus_statchg()
1990 mii = device_get_softc(sc->bce_miibus); in bce_miibus_statchg()
1991 media_active = mii->mii_media_active; in bce_miibus_statchg()
1992 media_status = mii->mii_media_status; in bce_miibus_statchg()
2014 /* fall-through */ in bce_miibus_statchg()
2022 /* fall-through */ in bce_miibus_statchg()
2037 "Setting Half-Duplex interface.\n"); in bce_miibus_statchg()
2041 "Setting Full-Duplex interface.\n"); in bce_miibus_statchg()
2049 sc->bce_flags |= BCE_USING_RX_FLOW_CONTROL; in bce_miibus_statchg()
2054 sc->bce_flags &= ~BCE_USING_RX_FLOW_CONTROL; in bce_miibus_statchg()
2061 sc->bce_flags |= BCE_USING_TX_FLOW_CONTROL; in bce_miibus_statchg()
2066 sc->bce_flags &= ~BCE_USING_TX_FLOW_CONTROL; in bce_miibus_statchg()
2172 if (!(sc->bce_flash_info->flags & BCE_NV_BUFFERED)) { in bce_enable_nvram_write()
2272 /* Non-buffered flash parts require that a page be erased before it is */
2287 if (sc->bce_flash_info->flags & BCE_NV_BUFFERED) in bce_nvram_erase_page()
2328 /* obtained the NVRAM lock and enabled the controller for NVRAM access. */
2346 if (sc->bce_flash_info->flags & BCE_NV_TRANSLATE) { in bce_nvram_read_dword()
2347 offset = ((offset / sc->bce_flash_info->page_size) << in bce_nvram_read_dword()
2348 sc->bce_flash_info->page_bits) + in bce_nvram_read_dword()
2349 (offset % sc->bce_flash_info->page_size); in bce_nvram_read_dword()
2392 /* obtained the NVRAM lock, enabled the controller for NVRAM access, and */
2411 if (sc->bce_flash_info->flags & BCE_NV_TRANSLATE) { in bce_nvram_write_dword()
2412 offset = ((offset / sc->bce_flash_info->page_size) << in bce_nvram_write_dword()
2413 sc->bce_flash_info->page_bits) + in bce_nvram_write_dword()
2414 (offset % sc->bce_flash_info->page_size); in bce_nvram_write_dword()
2418 * Clear the DONE bit separately, convert NVRAM data to big-endian, in bce_nvram_write_dword()
2465 sc->bce_flash_info = &flash_5709; in bce_init_nvram()
2490 (flash->config1 & FLASH_BACKUP_STRAP_MASK)) { in bce_init_nvram()
2491 sc->bce_flash_info = flash; in bce_init_nvram()
2510 if ((val & mask) == (flash->strapping & mask)) { in bce_init_nvram()
2512 sc->bce_flash_info = flash; in bce_init_nvram()
2520 REG_WR(sc, BCE_NVM_CFG1, flash->config1); in bce_init_nvram()
2521 REG_WR(sc, BCE_NVM_CFG2, flash->config2); in bce_init_nvram()
2522 REG_WR(sc, BCE_NVM_CFG3, flash->config3); in bce_init_nvram()
2523 REG_WR(sc, BCE_NVM_WRITE1, flash->write1); in bce_init_nvram()
2534 sc->bce_flash_info = NULL; in bce_init_nvram()
2546 sc->bce_flash_size = val; in bce_init_nvram()
2548 sc->bce_flash_size = sc->bce_flash_info->total_size; in bce_init_nvram()
2551 __FUNCTION__, sc->bce_flash_info->name, in bce_init_nvram()
2552 sc->bce_flash_info->total_size); in bce_init_nvram()
2597 pre_len = 4 - (offset & 3); in bce_nvram_read()
2616 len32 -= pre_len; in bce_nvram_read()
2620 extra = 4 - (len32 & 3); in bce_nvram_read()
2635 memcpy(ret_buf, buf, 4 - extra); in bce_nvram_read()
2651 len32 -= 4; in bce_nvram_read()
2659 len32 -= 4; in bce_nvram_read()
2668 memcpy(ret_buf, buf, 4 - extra); in bce_nvram_read()
2717 align_end = 4 - (len32 & 3); in bce_nvram_write()
2719 if ((rc = bce_nvram_read(sc, offset32 + len32 - 4, in bce_nvram_write()
2738 memcpy(buf + len32 - 4, end, 4); in bce_nvram_write()
2752 page_start -= (page_start % sc->bce_flash_info->page_size); in bce_nvram_write()
2754 page_end = page_start + sc->bce_flash_info->page_size; in bce_nvram_write()
2769 if (!(sc->bce_flash_info->flags & BCE_NV_BUFFERED)) { in bce_nvram_write()
2773 * (non-buffer flash only) */ in bce_nvram_write()
2774 for (j = 0; j < sc->bce_flash_info->page_size; j += 4) { in bce_nvram_write()
2775 if (j == (sc->bce_flash_info->page_size - 4)) { in bce_nvram_write()
2790 /* Enable writes to flash interface (unlock write-protect) */ in bce_nvram_write()
2798 /* Re-enable the write again for the actual write */ in bce_nvram_write()
2804 if (!(sc->bce_flash_info->flags & BCE_NV_BUFFERED)) { in bce_nvram_write()
2819 if ((addr == page_end - 4) || in bce_nvram_write()
2820 ((sc->bce_flash_info->flags & BCE_NV_BUFFERED) && in bce_nvram_write()
2821 (addr == data_end - 4))) { in bce_nvram_write()
2836 if (!(sc->bce_flash_info->flags & BCE_NV_BUFFERED)) { in bce_nvram_write()
2839 if (addr == page_end-4) { in bce_nvram_write()
2852 /* Disable writes to flash interface (lock write-protect) */ in bce_nvram_write()
2860 written += data_end - data_start; in bce_nvram_write()
2967 sc->rx_bd_mbuf_alloc_size = MHLEN; in bce_get_rx_buffer_sizes()
2969 sc->rx_bd_mbuf_align_pad = in bce_get_rx_buffer_sizes()
2970 roundup2(MSIZE - MHLEN, 16) - (MSIZE - MHLEN); in bce_get_rx_buffer_sizes()
2971 sc->rx_bd_mbuf_data_len = sc->rx_bd_mbuf_alloc_size - in bce_get_rx_buffer_sizes()
2972 sc->rx_bd_mbuf_align_pad; in bce_get_rx_buffer_sizes()
2977 sc->rx_bd_mbuf_alloc_size = MJUM9BYTES; in bce_get_rx_buffer_sizes()
2978 sc->rx_bd_mbuf_align_pad = in bce_get_rx_buffer_sizes()
2979 roundup2(MJUM9BYTES, 16) - MJUM9BYTES; in bce_get_rx_buffer_sizes()
2980 sc->rx_bd_mbuf_data_len = in bce_get_rx_buffer_sizes()
2981 sc->rx_bd_mbuf_alloc_size - in bce_get_rx_buffer_sizes()
2982 sc->rx_bd_mbuf_align_pad; in bce_get_rx_buffer_sizes()
2985 sc->rx_bd_mbuf_alloc_size = MCLBYTES; in bce_get_rx_buffer_sizes()
2986 sc->rx_bd_mbuf_align_pad = in bce_get_rx_buffer_sizes()
2987 roundup2(MCLBYTES, 16) - MCLBYTES; in bce_get_rx_buffer_sizes()
2988 sc->rx_bd_mbuf_data_len = in bce_get_rx_buffer_sizes()
2989 sc->rx_bd_mbuf_alloc_size - in bce_get_rx_buffer_sizes()
2990 sc->rx_bd_mbuf_align_pad; in bce_get_rx_buffer_sizes()
2998 sc->rx_bd_mbuf_alloc_size, sc->rx_bd_mbuf_data_len, in bce_get_rx_buffer_sizes()
2999 sc->rx_bd_mbuf_align_pad); in bce_get_rx_buffer_sizes()
3005 /* Identifies the current media type of the controller and sets the PHY */
3019 sc->bce_phy_addr = 1; in bce_get_media()
3037 sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG; in bce_get_media()
3048 if (pci_get_function(sc->bce_dev) == 0) { in bce_get_media()
3055 sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG; in bce_get_media()
3069 sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG; in bce_get_media()
3079 sc->bce_phy_flags |= BCE_PHY_SERDES_FLAG; in bce_get_media()
3081 if (sc->bce_phy_flags & BCE_PHY_SERDES_FLAG) { in bce_get_media()
3082 sc->bce_flags |= BCE_NO_WOL_FLAG; in bce_get_media()
3085 sc->bce_phy_flags |= BCE_PHY_IEEE_CLAUSE_45_FLAG; in bce_get_media()
3089 sc->bce_phy_addr = 2; in bce_get_media()
3093 sc->bce_phy_flags |= in bce_get_media()
3101 sc->bce_phy_flags |= BCE_PHY_CRC_FIX_FLAG; in bce_get_media()
3105 "Using PHY address %d.\n", sc->bce_phy_addr); in bce_get_media()
3120 if ((sc->bce_phy_flags & (BCE_PHY_IEEE_CLAUSE_45_FLAG | in bce_init_media()
3129 /* Select auto-negotiation MMD of the PHY. */ in bce_init_media()
3130 bce_miibus_write_reg(sc->bce_dev, sc->bce_phy_addr, in bce_init_media()
3132 bce_miibus_write_reg(sc->bce_dev, sc->bce_phy_addr, in bce_init_media()
3136 bce_miibus_write_reg(sc->bce_dev, sc->bce_phy_addr, in bce_init_media()
3158 if (sc->status_block_paddr != 0) { in bce_dma_free()
3160 sc->status_tag, in bce_dma_free()
3161 sc->status_map); in bce_dma_free()
3162 sc->status_block_paddr = 0; in bce_dma_free()
3165 if (sc->status_block != NULL) { in bce_dma_free()
3167 sc->status_tag, in bce_dma_free()
3168 sc->status_block, in bce_dma_free()
3169 sc->status_map); in bce_dma_free()
3170 sc->status_block = NULL; in bce_dma_free()
3173 if (sc->status_tag != NULL) { in bce_dma_free()
3174 bus_dma_tag_destroy(sc->status_tag); in bce_dma_free()
3175 sc->status_tag = NULL; in bce_dma_free()
3179 if (sc->stats_block_paddr != 0) { in bce_dma_free()
3181 sc->stats_tag, in bce_dma_free()
3182 sc->stats_map); in bce_dma_free()
3183 sc->stats_block_paddr = 0; in bce_dma_free()
3186 if (sc->stats_block != NULL) { in bce_dma_free()
3188 sc->stats_tag, in bce_dma_free()
3189 sc->stats_block, in bce_dma_free()
3190 sc->stats_map); in bce_dma_free()
3191 sc->stats_block = NULL; in bce_dma_free()
3194 if (sc->stats_tag != NULL) { in bce_dma_free()
3195 bus_dma_tag_destroy(sc->stats_tag); in bce_dma_free()
3196 sc->stats_tag = NULL; in bce_dma_free()
3201 for (i = 0; i < sc->ctx_pages; i++ ) { in bce_dma_free()
3202 if (sc->ctx_paddr[i] != 0) { in bce_dma_free()
3204 sc->ctx_tag, in bce_dma_free()
3205 sc->ctx_map[i]); in bce_dma_free()
3206 sc->ctx_paddr[i] = 0; in bce_dma_free()
3209 if (sc->ctx_block[i] != NULL) { in bce_dma_free()
3211 sc->ctx_tag, in bce_dma_free()
3212 sc->ctx_block[i], in bce_dma_free()
3213 sc->ctx_map[i]); in bce_dma_free()
3214 sc->ctx_block[i] = NULL; in bce_dma_free()
3219 if (sc->ctx_tag != NULL) { in bce_dma_free()
3220 bus_dma_tag_destroy(sc->ctx_tag); in bce_dma_free()
3221 sc->ctx_tag = NULL; in bce_dma_free()
3226 for (i = 0; i < sc->tx_pages; i++ ) { in bce_dma_free()
3227 if (sc->tx_bd_chain_paddr[i] != 0) { in bce_dma_free()
3229 sc->tx_bd_chain_tag, in bce_dma_free()
3230 sc->tx_bd_chain_map[i]); in bce_dma_free()
3231 sc->tx_bd_chain_paddr[i] = 0; in bce_dma_free()
3234 if (sc->tx_bd_chain[i] != NULL) { in bce_dma_free()
3236 sc->tx_bd_chain_tag, in bce_dma_free()
3237 sc->tx_bd_chain[i], in bce_dma_free()
3238 sc->tx_bd_chain_map[i]); in bce_dma_free()
3239 sc->tx_bd_chain[i] = NULL; in bce_dma_free()
3244 if (sc->tx_bd_chain_tag != NULL) { in bce_dma_free()
3245 bus_dma_tag_destroy(sc->tx_bd_chain_tag); in bce_dma_free()
3246 sc->tx_bd_chain_tag = NULL; in bce_dma_free()
3250 for (i = 0; i < sc->rx_pages; i++ ) { in bce_dma_free()
3251 if (sc->rx_bd_chain_paddr[i] != 0) { in bce_dma_free()
3253 sc->rx_bd_chain_tag, in bce_dma_free()
3254 sc->rx_bd_chain_map[i]); in bce_dma_free()
3255 sc->rx_bd_chain_paddr[i] = 0; in bce_dma_free()
3258 if (sc->rx_bd_chain[i] != NULL) { in bce_dma_free()
3260 sc->rx_bd_chain_tag, in bce_dma_free()
3261 sc->rx_bd_chain[i], in bce_dma_free()
3262 sc->rx_bd_chain_map[i]); in bce_dma_free()
3263 sc->rx_bd_chain[i] = NULL; in bce_dma_free()
3268 if (sc->rx_bd_chain_tag != NULL) { in bce_dma_free()
3269 bus_dma_tag_destroy(sc->rx_bd_chain_tag); in bce_dma_free()
3270 sc->rx_bd_chain_tag = NULL; in bce_dma_free()
3275 for (i = 0; i < sc->pg_pages; i++ ) { in bce_dma_free()
3276 if (sc->pg_bd_chain_paddr[i] != 0) { in bce_dma_free()
3278 sc->pg_bd_chain_tag, in bce_dma_free()
3279 sc->pg_bd_chain_map[i]); in bce_dma_free()
3280 sc->pg_bd_chain_paddr[i] = 0; in bce_dma_free()
3283 if (sc->pg_bd_chain[i] != NULL) { in bce_dma_free()
3285 sc->pg_bd_chain_tag, in bce_dma_free()
3286 sc->pg_bd_chain[i], in bce_dma_free()
3287 sc->pg_bd_chain_map[i]); in bce_dma_free()
3288 sc->pg_bd_chain[i] = NULL; in bce_dma_free()
3293 if (sc->pg_bd_chain_tag != NULL) { in bce_dma_free()
3294 bus_dma_tag_destroy(sc->pg_bd_chain_tag); in bce_dma_free()
3295 sc->pg_bd_chain_tag = NULL; in bce_dma_free()
3301 if (sc->tx_mbuf_map[i] != NULL) { in bce_dma_free()
3302 bus_dmamap_unload(sc->tx_mbuf_tag, in bce_dma_free()
3303 sc->tx_mbuf_map[i]); in bce_dma_free()
3304 bus_dmamap_destroy(sc->tx_mbuf_tag, in bce_dma_free()
3305 sc->tx_mbuf_map[i]); in bce_dma_free()
3306 sc->tx_mbuf_map[i] = NULL; in bce_dma_free()
3311 if (sc->tx_mbuf_tag != NULL) { in bce_dma_free()
3312 bus_dma_tag_destroy(sc->tx_mbuf_tag); in bce_dma_free()
3313 sc->tx_mbuf_tag = NULL; in bce_dma_free()
3318 if (sc->rx_mbuf_map[i] != NULL) { in bce_dma_free()
3319 bus_dmamap_unload(sc->rx_mbuf_tag, in bce_dma_free()
3320 sc->rx_mbuf_map[i]); in bce_dma_free()
3321 bus_dmamap_destroy(sc->rx_mbuf_tag, in bce_dma_free()
3322 sc->rx_mbuf_map[i]); in bce_dma_free()
3323 sc->rx_mbuf_map[i] = NULL; in bce_dma_free()
3328 if (sc->rx_mbuf_tag != NULL) { in bce_dma_free()
3329 bus_dma_tag_destroy(sc->rx_mbuf_tag); in bce_dma_free()
3330 sc->rx_mbuf_tag = NULL; in bce_dma_free()
3336 if (sc->pg_mbuf_map[i] != NULL) { in bce_dma_free()
3337 bus_dmamap_unload(sc->pg_mbuf_tag, in bce_dma_free()
3338 sc->pg_mbuf_map[i]); in bce_dma_free()
3339 bus_dmamap_destroy(sc->pg_mbuf_tag, in bce_dma_free()
3340 sc->pg_mbuf_map[i]); in bce_dma_free()
3341 sc->pg_mbuf_map[i] = NULL; in bce_dma_free()
3346 if (sc->pg_mbuf_tag != NULL) { in bce_dma_free()
3347 bus_dma_tag_destroy(sc->pg_mbuf_tag); in bce_dma_free()
3348 sc->pg_mbuf_tag = NULL; in bce_dma_free()
3353 if (sc->parent_tag != NULL) { in bce_dma_free()
3354 bus_dma_tag_destroy(sc->parent_tag); in bce_dma_free()
3355 sc->parent_tag = NULL; in bce_dma_free()
3367 /* (bus_dmamap_load()) so we use the value of map_arg->maxsegs to pass any */
3390 *busaddr = segs->ds_addr; in bce_dma_map_addr()
3401 /* +-----------------+----------+----------+----------+----------+ */
3403 /* +-----------------+----------+----------+----------+----------+ */
3411 /* +-----------------+----------+----------+----------+----------+ */
3434 sc->max_bus_addr, BUS_SPACE_MAXADDR, NULL, NULL, in bce_dma_alloc()
3436 &sc->parent_tag)) { in bce_dma_alloc()
3448 if (bus_dma_tag_create(sc->parent_tag, BCE_DMA_ALIGN, in bce_dma_alloc()
3449 BCE_DMA_BOUNDARY, sc->max_bus_addr, BUS_SPACE_MAXADDR, in bce_dma_alloc()
3451 0, NULL, NULL, &sc->status_tag)) { in bce_dma_alloc()
3458 if(bus_dmamem_alloc(sc->status_tag, (void **)&sc->status_block, in bce_dma_alloc()
3460 &sc->status_map)) { in bce_dma_alloc()
3467 error = bus_dmamap_load(sc->status_tag, sc->status_map, in bce_dma_alloc()
3468 sc->status_block, BCE_STATUS_BLK_SZ, bce_dma_map_addr, in bce_dma_alloc()
3469 &sc->status_block_paddr, BUS_DMA_NOWAIT); in bce_dma_alloc()
3471 if (error || sc->status_block_paddr == 0) { in bce_dma_alloc()
3479 __FUNCTION__, (uintmax_t) sc->status_block_paddr); in bce_dma_alloc()
3486 if (bus_dma_tag_create(sc->parent_tag, BCE_DMA_ALIGN, in bce_dma_alloc()
3487 BCE_DMA_BOUNDARY, sc->max_bus_addr, BUS_SPACE_MAXADDR, in bce_dma_alloc()
3489 0, NULL, NULL, &sc->stats_tag)) { in bce_dma_alloc()
3496 if (bus_dmamem_alloc(sc->stats_tag, (void **)&sc->stats_block, in bce_dma_alloc()
3497 BUS_DMA_NOWAIT | BUS_DMA_ZERO | BUS_DMA_COHERENT, &sc->stats_map)) { in bce_dma_alloc()
3504 error = bus_dmamap_load(sc->stats_tag, sc->stats_map, in bce_dma_alloc()
3505 sc->stats_block, BCE_STATS_BLK_SZ, bce_dma_map_addr, in bce_dma_alloc()
3506 &sc->stats_block_paddr, BUS_DMA_NOWAIT); in bce_dma_alloc()
3508 if (error || sc->stats_block_paddr == 0) { in bce_dma_alloc()
3516 __FUNCTION__, (uintmax_t) sc->stats_block_paddr); in bce_dma_alloc()
3520 sc->ctx_pages = 0x2000 / BCM_PAGE_SIZE; in bce_dma_alloc()
3521 if (sc->ctx_pages == 0) in bce_dma_alloc()
3522 sc->ctx_pages = 1; in bce_dma_alloc()
3524 DBRUNIF((sc->ctx_pages > 512), in bce_dma_alloc()
3526 __FILE__, __LINE__, sc->ctx_pages)); in bce_dma_alloc()
3534 if(bus_dma_tag_create(sc->parent_tag, BCM_PAGE_SIZE, in bce_dma_alloc()
3535 BCE_DMA_BOUNDARY, sc->max_bus_addr, BUS_SPACE_MAXADDR, in bce_dma_alloc()
3537 0, NULL, NULL, &sc->ctx_tag)) { in bce_dma_alloc()
3544 for (i = 0; i < sc->ctx_pages; i++) { in bce_dma_alloc()
3545 if(bus_dmamem_alloc(sc->ctx_tag, in bce_dma_alloc()
3546 (void **)&sc->ctx_block[i], in bce_dma_alloc()
3548 &sc->ctx_map[i])) { in bce_dma_alloc()
3555 error = bus_dmamap_load(sc->ctx_tag, sc->ctx_map[i], in bce_dma_alloc()
3556 sc->ctx_block[i], BCM_PAGE_SIZE, bce_dma_map_addr, in bce_dma_alloc()
3557 &sc->ctx_paddr[i], BUS_DMA_NOWAIT); in bce_dma_alloc()
3559 if (error || sc->ctx_paddr[i] == 0) { in bce_dma_alloc()
3568 (uintmax_t) sc->ctx_paddr[i]); in bce_dma_alloc()
3577 if(bus_dma_tag_create(sc->parent_tag, BCM_PAGE_SIZE, BCE_DMA_BOUNDARY, in bce_dma_alloc()
3578 sc->max_bus_addr, BUS_SPACE_MAXADDR, NULL, NULL, in bce_dma_alloc()
3580 NULL, NULL, &sc->tx_bd_chain_tag)) { in bce_dma_alloc()
3587 for (i = 0; i < sc->tx_pages; i++) { in bce_dma_alloc()
3588 if(bus_dmamem_alloc(sc->tx_bd_chain_tag, in bce_dma_alloc()
3589 (void **)&sc->tx_bd_chain[i], in bce_dma_alloc()
3591 &sc->tx_bd_chain_map[i])) { in bce_dma_alloc()
3598 error = bus_dmamap_load(sc->tx_bd_chain_tag, in bce_dma_alloc()
3599 sc->tx_bd_chain_map[i], sc->tx_bd_chain[i], in bce_dma_alloc()
3601 &sc->tx_bd_chain_paddr[i], BUS_DMA_NOWAIT); in bce_dma_alloc()
3603 if (error || sc->tx_bd_chain_paddr[i] == 0) { in bce_dma_alloc()
3612 (uintmax_t) sc->tx_bd_chain_paddr[i]); in bce_dma_alloc()
3627 if (bus_dma_tag_create(sc->parent_tag, 1, BCE_DMA_BOUNDARY, in bce_dma_alloc()
3628 sc->max_bus_addr, BUS_SPACE_MAXADDR, NULL, NULL, max_size, in bce_dma_alloc()
3629 max_segments, max_seg_size, 0, NULL, NULL, &sc->tx_mbuf_tag)) { in bce_dma_alloc()
3638 if (bus_dmamap_create(sc->tx_mbuf_tag, BUS_DMA_NOWAIT, in bce_dma_alloc()
3639 &sc->tx_mbuf_map[i])) { in bce_dma_alloc()
3652 if (bus_dma_tag_create(sc->parent_tag, BCM_PAGE_SIZE, in bce_dma_alloc()
3654 sc->max_bus_addr, NULL, NULL, in bce_dma_alloc()
3656 0, NULL, NULL, &sc->rx_bd_chain_tag)) { in bce_dma_alloc()
3663 for (i = 0; i < sc->rx_pages; i++) { in bce_dma_alloc()
3664 if (bus_dmamem_alloc(sc->rx_bd_chain_tag, in bce_dma_alloc()
3665 (void **)&sc->rx_bd_chain[i], in bce_dma_alloc()
3667 &sc->rx_bd_chain_map[i])) { in bce_dma_alloc()
3674 error = bus_dmamap_load(sc->rx_bd_chain_tag, in bce_dma_alloc()
3675 sc->rx_bd_chain_map[i], sc->rx_bd_chain[i], in bce_dma_alloc()
3677 &sc->rx_bd_chain_paddr[i], BUS_DMA_NOWAIT); in bce_dma_alloc()
3679 if (error || sc->rx_bd_chain_paddr[i] == 0) { in bce_dma_alloc()
3688 (uintmax_t) sc->rx_bd_chain_paddr[i]); in bce_dma_alloc()
3695 max_size = ((sc->rx_bd_mbuf_alloc_size < MCLBYTES) ? in bce_dma_alloc()
3696 MCLBYTES : sc->rx_bd_mbuf_alloc_size); in bce_dma_alloc()
3703 if (bus_dma_tag_create(sc->parent_tag, BCE_RX_BUF_ALIGN, in bce_dma_alloc()
3704 BCE_DMA_BOUNDARY, sc->max_bus_addr, BUS_SPACE_MAXADDR, NULL, NULL, in bce_dma_alloc()
3705 max_size, 1, max_size, 0, NULL, NULL, &sc->rx_mbuf_tag)) { in bce_dma_alloc()
3714 if (bus_dmamap_create(sc->rx_mbuf_tag, BUS_DMA_NOWAIT, in bce_dma_alloc()
3715 &sc->rx_mbuf_map[i])) { in bce_dma_alloc()
3729 if (bus_dma_tag_create(sc->parent_tag, BCM_PAGE_SIZE, in bce_dma_alloc()
3730 BCE_DMA_BOUNDARY, BUS_SPACE_MAXADDR, sc->max_bus_addr, in bce_dma_alloc()
3732 0, NULL, NULL, &sc->pg_bd_chain_tag)) { in bce_dma_alloc()
3739 for (i = 0; i < sc->pg_pages; i++) { in bce_dma_alloc()
3740 if (bus_dmamem_alloc(sc->pg_bd_chain_tag, in bce_dma_alloc()
3741 (void **)&sc->pg_bd_chain[i], in bce_dma_alloc()
3743 &sc->pg_bd_chain_map[i])) { in bce_dma_alloc()
3751 error = bus_dmamap_load(sc->pg_bd_chain_tag, in bce_dma_alloc()
3752 sc->pg_bd_chain_map[i], sc->pg_bd_chain[i], in bce_dma_alloc()
3754 &sc->pg_bd_chain_paddr[i], BUS_DMA_NOWAIT); in bce_dma_alloc()
3756 if (error || sc->pg_bd_chain_paddr[i] == 0) { in bce_dma_alloc()
3765 (uintmax_t) sc->pg_bd_chain_paddr[i]); in bce_dma_alloc()
3771 if (bus_dma_tag_create(sc->parent_tag, 1, BCE_DMA_BOUNDARY, in bce_dma_alloc()
3772 sc->max_bus_addr, BUS_SPACE_MAXADDR, NULL, NULL, MCLBYTES, in bce_dma_alloc()
3773 1, MCLBYTES, 0, NULL, NULL, &sc->pg_mbuf_tag)) { in bce_dma_alloc()
3782 if (bus_dmamap_create(sc->pg_mbuf_tag, BUS_DMA_NOWAIT, in bce_dma_alloc()
3783 &sc->pg_mbuf_map[i])) { in bce_dma_alloc()
3813 dev = sc->bce_dev; in bce_release_resources()
3817 if (sc->bce_intrhand != NULL) { in bce_release_resources()
3819 bus_teardown_intr(dev, sc->bce_res_irq, sc->bce_intrhand); in bce_release_resources()
3822 if (sc->bce_res_irq != NULL) { in bce_release_resources()
3825 rman_get_rid(sc->bce_res_irq), sc->bce_res_irq); in bce_release_resources()
3828 if (sc->bce_flags & (BCE_USING_MSI_FLAG | BCE_USING_MSIX_FLAG)) { in bce_release_resources()
3829 DBPRINT(sc, BCE_INFO_RESET, "Releasing MSI/MSI-X vector.\n"); in bce_release_resources()
3833 if (sc->bce_res_mem != NULL) { in bce_release_resources()
3836 sc->bce_res_mem); in bce_release_resources()
3839 if (sc->bce_ifp != NULL) { in bce_release_resources()
3841 if_free(sc->bce_ifp); in bce_release_resources()
3844 if (mtx_initialized(&sc->bce_mtx)) in bce_release_resources()
3868 if (sc->bce_fw_timed_out == TRUE) { in bce_fw_sync()
3874 sc->bce_fw_wr_seq++; in bce_fw_sync()
3875 msg_data |= sc->bce_fw_wr_seq; in bce_fw_sync()
3903 sc->bce_fw_timed_out = TRUE; in bce_fw_sync()
3948 /* Reset the processor, un-stall is done later. */ in bce_load_rv2p_fw()
3979 offset = cpu_reg->spad_base + (fw->text_addr - cpu_reg->mips_view_base); in bce_load_cpu_fw()
3980 if (fw->text) { in bce_load_cpu_fw()
3983 for (j = 0; j < (fw->text_len / 4); j++, offset += 4) { in bce_load_cpu_fw()
3984 REG_WR_IND(sc, offset, fw->text[j]); in bce_load_cpu_fw()
3989 offset = cpu_reg->spad_base + (fw->data_addr - cpu_reg->mips_view_base); in bce_load_cpu_fw()
3990 if (fw->data) { in bce_load_cpu_fw()
3993 for (j = 0; j < (fw->data_len / 4); j++, offset += 4) { in bce_load_cpu_fw()
3994 REG_WR_IND(sc, offset, fw->data[j]); in bce_load_cpu_fw()
3999 offset = cpu_reg->spad_base + (fw->sbss_addr - cpu_reg->mips_view_base); in bce_load_cpu_fw()
4000 if (fw->sbss) { in bce_load_cpu_fw()
4003 for (j = 0; j < (fw->sbss_len / 4); j++, offset += 4) { in bce_load_cpu_fw()
4004 REG_WR_IND(sc, offset, fw->sbss[j]); in bce_load_cpu_fw()
4009 offset = cpu_reg->spad_base + (fw->bss_addr - cpu_reg->mips_view_base); in bce_load_cpu_fw()
4010 if (fw->bss) { in bce_load_cpu_fw()
4013 for (j = 0; j < (fw->bss_len/4); j++, offset += 4) { in bce_load_cpu_fw()
4014 REG_WR_IND(sc, offset, fw->bss[j]); in bce_load_cpu_fw()
4018 /* Load the Read-Only area. */ in bce_load_cpu_fw()
4019 offset = cpu_reg->spad_base + in bce_load_cpu_fw()
4020 (fw->rodata_addr - cpu_reg->mips_view_base); in bce_load_cpu_fw()
4021 if (fw->rodata) { in bce_load_cpu_fw()
4024 for (j = 0; j < (fw->rodata_len / 4); j++, offset += 4) { in bce_load_cpu_fw()
4025 REG_WR_IND(sc, offset, fw->rodata[j]); in bce_load_cpu_fw()
4029 /* Clear the pre-fetch instruction and set the FW start address. */ in bce_load_cpu_fw()
4030 REG_WR_IND(sc, cpu_reg->inst, 0); in bce_load_cpu_fw()
4031 REG_WR_IND(sc, cpu_reg->pc, fw->start_addr); in bce_load_cpu_fw()
4052 val = REG_RD_IND(sc, cpu_reg->mode); in bce_start_cpu()
4053 val &= ~cpu_reg->mode_value_halt; in bce_start_cpu()
4054 REG_WR_IND(sc, cpu_reg->state, cpu_reg->state_value_clear); in bce_start_cpu()
4055 REG_WR_IND(sc, cpu_reg->mode, val); in bce_start_cpu()
4074 val = REG_RD_IND(sc, cpu_reg->mode); in bce_halt_cpu()
4075 val |= cpu_reg->mode_value_halt; in bce_halt_cpu()
4076 REG_WR_IND(sc, cpu_reg->mode, val); in bce_halt_cpu()
4077 REG_WR_IND(sc, cpu_reg->state, cpu_reg->state_value_clear); in bce_halt_cpu()
4666 val |= (BCM_PAGE_BITS - 8) << 16; in bce_init_ctx()
4683 for (i = 0; i < sc->ctx_pages; i++) { in bce_init_ctx()
4686 BCE_ADDR_LO(sc->ctx_paddr[i] & 0xfffffff0) | in bce_init_ctx()
4689 BCE_ADDR_HI(sc->ctx_paddr[i])); in bce_init_ctx()
4713 * the controller, so initialize the controller in bce_init_ctx()
4719 vcid_addr -= PHY_CTX_SIZE; in bce_init_ctx()
4738 /* Fetch the permanent MAC address of the controller. */
4752 * power-on and runtime configuration items in a in bce_get_mac_addr()
4766 sc->eaddr[0] = (u_char)(mac_hi >> 8); in bce_get_mac_addr()
4767 sc->eaddr[1] = (u_char)(mac_hi >> 0); in bce_get_mac_addr()
4768 sc->eaddr[2] = (u_char)(mac_lo >> 24); in bce_get_mac_addr()
4769 sc->eaddr[3] = (u_char)(mac_lo >> 16); in bce_get_mac_addr()
4770 sc->eaddr[4] = (u_char)(mac_lo >> 8); in bce_get_mac_addr()
4771 sc->eaddr[5] = (u_char)(mac_lo >> 0); in bce_get_mac_addr()
4775 "address = %6D\n", sc->eaddr, ":"); in bce_get_mac_addr()
4789 u8 *mac_addr = sc->eaddr; in bce_set_mac_addr()
4795 "%6D\n", sc->eaddr, ":"); in bce_set_mac_addr()
4810 /* Stop the controller. */
4824 ifp = sc->bce_ifp; in bce_stop()
4826 callout_stop(&sc->bce_tick_callout); in bce_stop()
4844 sc->watchdog_timer = 0; in bce_stop()
4846 sc->bce_link_up = FALSE; in bce_stop()
4869 * been auto-negotiated. Resetting the chip will clobber those in bce_reset()
4892 sc->bce_fw_timed_out = FALSE; in bce_reset()
4893 sc->bce_drv_cardiac_arrest = FALSE; in bce_reset()
4915 pci_write_config(sc->bce_dev, BCE_PCICFG_MISC_CONFIG, val, 4); in bce_reset()
4952 sc->bce_fw_timed_out = FALSE; in bce_reset()
4953 sc->bce_drv_cardiac_arrest = FALSE; in bce_reset()
5000 if ((sc->bce_flags & BCE_PCIX_FLAG) && (sc->bus_speed_mhz == 133)) in bce_chipinit()
5010 !(sc->bce_flags & BCE_PCIX_FLAG)) in bce_chipinit()
5025 /* Initialize the on-boards CPUs */ in bce_chipinit()
5028 /* Enable management frames (NC-SI) to flow to the MCP. */ in bce_chipinit()
5029 if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { in bce_chipinit()
5057 val = (BCM_PAGE_BITS - 8) << 24; in bce_chipinit()
5063 val |= (BCM_PAGE_BITS - 8) << 24 | 0x40; in bce_chipinit()
5076 /* Initialize the controller in preparation to send/receive traffic. */
5093 val = sc->eaddr[0] + (sc->eaddr[1] << 8) + in bce_blockinit()
5094 (sc->eaddr[2] << 16) + (sc->eaddr[3] ) + in bce_blockinit()
5095 (sc->eaddr[4] << 8) + (sc->eaddr[5] << 16); in bce_blockinit()
5098 sc->last_status_idx = 0; in bce_blockinit()
5099 sc->rx_mode = BCE_EMAC_RX_MODE_SORT_MODE; in bce_blockinit()
5106 BCE_ADDR_LO(sc->status_block_paddr)); in bce_blockinit()
5108 BCE_ADDR_HI(sc->status_block_paddr)); in bce_blockinit()
5112 BCE_ADDR_LO(sc->stats_block_paddr)); in bce_blockinit()
5114 BCE_ADDR_HI(sc->stats_block_paddr)); in bce_blockinit()
5123 (sc->bce_tx_quick_cons_trip_int << 16) | in bce_blockinit()
5124 sc->bce_tx_quick_cons_trip); in bce_blockinit()
5126 (sc->bce_rx_quick_cons_trip_int << 16) | in bce_blockinit()
5127 sc->bce_rx_quick_cons_trip); in bce_blockinit()
5129 (sc->bce_tx_ticks_int << 16) | sc->bce_tx_ticks); in bce_blockinit()
5131 (sc->bce_rx_ticks_int << 16) | sc->bce_rx_ticks); in bce_blockinit()
5132 REG_WR(sc, BCE_HC_STATS_TICKS, sc->bce_stats_ticks & 0xffff00); in bce_blockinit()
5144 /* ToDo: Add MSI-X support. */ in bce_blockinit()
5145 if (sc->bce_flags & BCE_USING_MSIX_FLAG) { in bce_blockinit()
5146 u32 base = ((BCE_TX_VEC - 1) * BCE_HC_SB_CONFIG_SIZE) + in bce_blockinit()
5155 (sc->tx_quick_cons_trip_int << 16) | in bce_blockinit()
5156 sc->tx_quick_cons_trip); in bce_blockinit()
5159 (sc->tx_ticks_int << 16) | sc->tx_ticks); in bce_blockinit()
5166 * INT_MASK bit after an MSI/MSI-X interrupt in bce_blockinit()
5169 if (sc->bce_flags & BCE_ONE_SHOT_MSI_FLAG) in bce_blockinit()
5172 /* Set the MSI-X status blocks to 128 byte boundaries. */ in bce_blockinit()
5173 if (sc->bce_flags & BCE_USING_MSIX_FLAG) in bce_blockinit()
5217 /* Disable management frames (NC-SI) from flowing to the MCP. */ in bce_blockinit()
5218 if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { in bce_blockinit()
5236 sc->hc_command = REG_RD(sc, BCE_HC_COMMAND); in bce_blockinit()
5274 DBRUNIF((sc->free_rx_bd < sc->rx_low_watermark), in bce_get_rx_buf()
5275 sc->rx_low_watermark = sc->free_rx_bd); in bce_get_rx_buf()
5276 DBRUNIF((sc->free_rx_bd == sc->max_rx_bd), in bce_get_rx_buf()
5277 sc->rx_empty_count++); in bce_get_rx_buf()
5281 sc->mbuf_alloc_failed_count++; in bce_get_rx_buf()
5282 sc->mbuf_alloc_failed_sim_count++; in bce_get_rx_buf()
5291 sc->rx_bd_mbuf_alloc_size); in bce_get_rx_buf()
5294 sc->mbuf_alloc_failed_count++; in bce_get_rx_buf()
5299 DBRUN(sc->debug_rx_mbuf_alloc++); in bce_get_rx_buf()
5305 m_new->m_pkthdr.len = m_new->m_len = sc->rx_bd_mbuf_alloc_size; in bce_get_rx_buf()
5306 m_adj(m_new, sc->rx_bd_mbuf_align_pad); in bce_get_rx_buf()
5311 error = bus_dmamap_load_mbuf_sg(sc->rx_mbuf_tag, in bce_get_rx_buf()
5312 sc->rx_mbuf_map[chain_prod], m_new, segs, &nsegs, BUS_DMA_NOWAIT); in bce_get_rx_buf()
5319 sc->dma_map_addr_rx_failed_count++; in bce_get_rx_buf()
5322 DBRUN(sc->debug_rx_mbuf_alloc--); in bce_get_rx_buf()
5333 rxbd = &sc->rx_bd_chain[RX_PAGE(chain_prod)][RX_IDX(chain_prod)]; in bce_get_rx_buf()
5335 rxbd->rx_bd_haddr_lo = htole32(BCE_ADDR_LO(segs[0].ds_addr)); in bce_get_rx_buf()
5336 rxbd->rx_bd_haddr_hi = htole32(BCE_ADDR_HI(segs[0].ds_addr)); in bce_get_rx_buf()
5337 rxbd->rx_bd_len = htole32(segs[0].ds_len); in bce_get_rx_buf()
5338 rxbd->rx_bd_flags = htole32(RX_BD_FLAGS_START | RX_BD_FLAGS_END); in bce_get_rx_buf()
5342 sc->rx_mbuf_ptr[chain_prod] = m_new; in bce_get_rx_buf()
5343 sc->free_rx_bd -= nsegs; in bce_get_rx_buf()
5387 DBRUNIF((sc->free_pg_bd < sc->pg_low_watermark), in bce_get_pg_buf()
5388 sc->pg_low_watermark = sc->free_pg_bd); in bce_get_pg_buf()
5389 DBRUNIF((sc->free_pg_bd == sc->max_pg_bd), sc->pg_empty_count++); in bce_get_pg_buf()
5393 sc->mbuf_alloc_failed_count++; in bce_get_pg_buf()
5394 sc->mbuf_alloc_failed_sim_count++; in bce_get_pg_buf()
5401 sc->mbuf_alloc_failed_count++; in bce_get_pg_buf()
5406 DBRUN(sc->debug_pg_mbuf_alloc++); in bce_get_pg_buf()
5408 m_new->m_len = MCLBYTES; in bce_get_pg_buf()
5413 error = bus_dmamap_load_mbuf_sg(sc->pg_mbuf_tag, in bce_get_pg_buf()
5414 sc->pg_mbuf_map[prod_idx], m_new, segs, &nsegs, BUS_DMA_NOWAIT); in bce_get_pg_buf()
5422 DBRUN(sc->debug_pg_mbuf_alloc--); in bce_get_pg_buf()
5438 pgbd = &sc->pg_bd_chain[PG_PAGE(prod_idx)][PG_IDX(prod_idx)]; in bce_get_pg_buf()
5440 pgbd->rx_bd_haddr_lo = htole32(BCE_ADDR_LO(segs[0].ds_addr)); in bce_get_pg_buf()
5441 pgbd->rx_bd_haddr_hi = htole32(BCE_ADDR_HI(segs[0].ds_addr)); in bce_get_pg_buf()
5442 pgbd->rx_bd_len = htole32(MCLBYTES); in bce_get_pg_buf()
5443 pgbd->rx_bd_flags = htole32(RX_BD_FLAGS_START | RX_BD_FLAGS_END); in bce_get_pg_buf()
5446 sc->pg_mbuf_ptr[prod_idx] = m_new; in bce_get_pg_buf()
5447 sc->free_pg_bd--; in bce_get_pg_buf()
5485 val = BCE_ADDR_HI(sc->tx_bd_chain_paddr[0]); in bce_init_tx_context()
5488 val = BCE_ADDR_LO(sc->tx_bd_chain_paddr[0]); in bce_init_tx_context()
5499 val = BCE_ADDR_HI(sc->tx_bd_chain_paddr[0]); in bce_init_tx_context()
5502 val = BCE_ADDR_LO(sc->tx_bd_chain_paddr[0]); in bce_init_tx_context()
5525 sc->tx_prod = 0; in bce_init_tx_chain()
5526 sc->tx_cons = 0; in bce_init_tx_chain()
5527 sc->tx_prod_bseq = 0; in bce_init_tx_chain()
5528 sc->used_tx_bd = 0; in bce_init_tx_chain()
5529 sc->max_tx_bd = USABLE_TX_BD_ALLOC; in bce_init_tx_chain()
5530 DBRUN(sc->tx_hi_watermark = 0); in bce_init_tx_chain()
5531 DBRUN(sc->tx_full_count = 0); in bce_init_tx_chain()
5534 * The NetXtreme II supports a linked-list structure called in bce_init_tx_chain()
5544 for (i = 0; i < sc->tx_pages; i++) { in bce_init_tx_chain()
5547 txbd = &sc->tx_bd_chain[i][USABLE_TX_BD_PER_PAGE]; in bce_init_tx_chain()
5550 if (i == (sc->tx_pages - 1)) in bce_init_tx_chain()
5555 txbd->tx_bd_haddr_hi = in bce_init_tx_chain()
5556 htole32(BCE_ADDR_HI(sc->tx_bd_chain_paddr[j])); in bce_init_tx_chain()
5557 txbd->tx_bd_haddr_lo = in bce_init_tx_chain()
5558 htole32(BCE_ADDR_LO(sc->tx_bd_chain_paddr[j])); in bce_init_tx_chain()
5584 if (sc->tx_mbuf_ptr[i] != NULL) { in bce_free_tx_chain()
5585 if (sc->tx_mbuf_map[i] != NULL) in bce_free_tx_chain()
5586 bus_dmamap_sync(sc->tx_mbuf_tag, in bce_free_tx_chain()
5587 sc->tx_mbuf_map[i], in bce_free_tx_chain()
5589 m_freem(sc->tx_mbuf_ptr[i]); in bce_free_tx_chain()
5590 sc->tx_mbuf_ptr[i] = NULL; in bce_free_tx_chain()
5591 DBRUN(sc->debug_tx_mbuf_alloc--); in bce_free_tx_chain()
5596 for (i = 0; i < sc->tx_pages; i++) in bce_free_tx_chain()
5597 bzero((char *)sc->tx_bd_chain[i], BCE_TX_CHAIN_PAGE_SZ); in bce_free_tx_chain()
5599 sc->used_tx_bd = 0; in bce_free_tx_chain()
5602 DBRUNIF((sc->debug_tx_mbuf_alloc), in bce_free_tx_chain()
5605 sc->debug_tx_mbuf_alloc)); in bce_free_tx_chain()
5638 if (sc->bce_flags & BCE_USING_TX_FLOW_CONTROL) { in bce_init_rx_context()
5675 val = BCE_ADDR_HI(sc->rx_bd_chain_paddr[0]); in bce_init_rx_context()
5677 val = BCE_ADDR_LO(sc->rx_bd_chain_paddr[0]); in bce_init_rx_context()
5699 sc->rx_prod = 0; in bce_init_rx_chain()
5700 sc->rx_cons = 0; in bce_init_rx_chain()
5701 sc->rx_prod_bseq = 0; in bce_init_rx_chain()
5702 sc->free_rx_bd = USABLE_RX_BD_ALLOC; in bce_init_rx_chain()
5703 sc->max_rx_bd = USABLE_RX_BD_ALLOC; in bce_init_rx_chain()
5706 for (i = 0; i < sc->rx_pages; i++) { in bce_init_rx_chain()
5709 rxbd = &sc->rx_bd_chain[i][USABLE_RX_BD_PER_PAGE]; in bce_init_rx_chain()
5712 if (i == (sc->rx_pages - 1)) in bce_init_rx_chain()
5718 rxbd->rx_bd_haddr_hi = in bce_init_rx_chain()
5719 htole32(BCE_ADDR_HI(sc->rx_bd_chain_paddr[j])); in bce_init_rx_chain()
5720 rxbd->rx_bd_haddr_lo = in bce_init_rx_chain()
5721 htole32(BCE_ADDR_LO(sc->rx_bd_chain_paddr[j])); in bce_init_rx_chain()
5727 DBRUN(sc->rx_low_watermark = USABLE_RX_BD_ALLOC); in bce_init_rx_chain()
5728 DBRUN(sc->rx_empty_count = 0); in bce_init_rx_chain()
5729 for (i = 0; i < sc->rx_pages; i++) { in bce_init_rx_chain()
5730 bus_dmamap_sync(sc->rx_bd_chain_tag, sc->rx_bd_chain_map[i], in bce_init_rx_chain()
5763 prod = sc->rx_prod; in bce_fill_rx_chain()
5764 prod_bseq = sc->rx_prod_bseq; in bce_fill_rx_chain()
5767 while (sc->free_rx_bd > 0) { in bce_fill_rx_chain()
5777 sc->rx_prod = prod; in bce_fill_rx_chain()
5778 sc->rx_prod_bseq = prod_bseq; in bce_fill_rx_chain()
5783 __FUNCTION__, sc->rx_prod)); in bce_fill_rx_chain()
5808 if (sc->rx_mbuf_ptr[i] != NULL) { in bce_free_rx_chain()
5809 if (sc->rx_mbuf_map[i] != NULL) in bce_free_rx_chain()
5810 bus_dmamap_sync(sc->rx_mbuf_tag, in bce_free_rx_chain()
5811 sc->rx_mbuf_map[i], in bce_free_rx_chain()
5813 m_freem(sc->rx_mbuf_ptr[i]); in bce_free_rx_chain()
5814 sc->rx_mbuf_ptr[i] = NULL; in bce_free_rx_chain()
5815 DBRUN(sc->debug_rx_mbuf_alloc--); in bce_free_rx_chain()
5820 for (i = 0; i < sc->rx_pages; i++) in bce_free_rx_chain()
5821 if (sc->rx_bd_chain[i] != NULL) in bce_free_rx_chain()
5822 bzero((char *)sc->rx_bd_chain[i], in bce_free_rx_chain()
5825 sc->free_rx_bd = sc->max_rx_bd; in bce_free_rx_chain()
5828 DBRUNIF((sc->debug_rx_mbuf_alloc), in bce_free_rx_chain()
5830 __FUNCTION__, sc->debug_rx_mbuf_alloc)); in bce_free_rx_chain()
5853 sc->pg_prod = 0; in bce_init_pg_chain()
5854 sc->pg_cons = 0; in bce_init_pg_chain()
5855 sc->free_pg_bd = USABLE_PG_BD_ALLOC; in bce_init_pg_chain()
5856 sc->max_pg_bd = USABLE_PG_BD_ALLOC; in bce_init_pg_chain()
5857 DBRUN(sc->pg_low_watermark = sc->max_pg_bd); in bce_init_pg_chain()
5858 DBRUN(sc->pg_empty_count = 0); in bce_init_pg_chain()
5861 for (i = 0; i < sc->pg_pages; i++) { in bce_init_pg_chain()
5864 pgbd = &sc->pg_bd_chain[i][USABLE_PG_BD_PER_PAGE]; in bce_init_pg_chain()
5867 if (i == (sc->pg_pages - 1)) in bce_init_pg_chain()
5873 pgbd->rx_bd_haddr_hi = in bce_init_pg_chain()
5874 htole32(BCE_ADDR_HI(sc->pg_bd_chain_paddr[j])); in bce_init_pg_chain()
5875 pgbd->rx_bd_haddr_lo = in bce_init_pg_chain()
5876 htole32(BCE_ADDR_LO(sc->pg_bd_chain_paddr[j])); in bce_init_pg_chain()
5886 val = (sc->rx_bd_mbuf_data_len << 16) | MCLBYTES; in bce_init_pg_chain()
5894 val = BCE_ADDR_HI(sc->pg_bd_chain_paddr[0]); in bce_init_pg_chain()
5896 val = BCE_ADDR_LO(sc->pg_bd_chain_paddr[0]); in bce_init_pg_chain()
5902 for (i = 0; i < sc->pg_pages; i++) { in bce_init_pg_chain()
5903 bus_dmamap_sync(sc->pg_bd_chain_tag, sc->pg_bd_chain_map[i], in bce_init_pg_chain()
5930 prod = sc->pg_prod; in bce_fill_pg_chain()
5933 while (sc->free_pg_bd > 0) { in bce_fill_pg_chain()
5943 sc->pg_prod = prod; in bce_fill_pg_chain()
5947 __FUNCTION__, sc->pg_prod)); in bce_fill_pg_chain()
5975 if (sc->pg_mbuf_ptr[i] != NULL) { in bce_free_pg_chain()
5976 if (sc->pg_mbuf_map[i] != NULL) in bce_free_pg_chain()
5977 bus_dmamap_sync(sc->pg_mbuf_tag, in bce_free_pg_chain()
5978 sc->pg_mbuf_map[i], in bce_free_pg_chain()
5980 m_freem(sc->pg_mbuf_ptr[i]); in bce_free_pg_chain()
5981 sc->pg_mbuf_ptr[i] = NULL; in bce_free_pg_chain()
5982 DBRUN(sc->debug_pg_mbuf_alloc--); in bce_free_pg_chain()
5987 for (i = 0; i < sc->pg_pages; i++) in bce_free_pg_chain()
5988 bzero((char *)sc->pg_bd_chain[i], BCE_PG_CHAIN_PAGE_SZ); in bce_free_pg_chain()
5990 sc->free_pg_bd = sc->max_pg_bd; in bce_free_pg_chain()
5993 DBRUNIF((sc->debug_pg_mbuf_alloc), in bce_free_pg_chain()
5995 __FUNCTION__, sc->debug_pg_mbuf_alloc)); in bce_free_pg_chain()
6008 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) != 0) in bce_get_rphy_link()
6041 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0) in bce_get_rphy_link()
6091 sc->bce_link_up = FALSE; in bce_ifmedia_upd_locked()
6092 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) { in bce_ifmedia_upd_locked()
6093 ifm = &sc->bce_ifmedia; in bce_ifmedia_upd_locked()
6094 if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) in bce_ifmedia_upd_locked()
6097 fdx = IFM_OPTIONS(ifm->ifm_media) & IFM_FDX; in bce_ifmedia_upd_locked()
6098 switch(IFM_SUBTYPE(ifm->ifm_media)) { in bce_ifmedia_upd_locked()
6108 if ((sc->bce_phy_flags & in bce_ifmedia_upd_locked()
6122 if ((sc->bce_phy_flags & in bce_ifmedia_upd_locked()
6135 if (sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) in bce_ifmedia_upd_locked()
6143 if (sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) in bce_ifmedia_upd_locked()
6151 if (sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) in bce_ifmedia_upd_locked()
6161 if (IFM_SUBTYPE(ifm->ifm_media) != IFM_AUTO) { in bce_ifmedia_upd_locked()
6164 * Advertise pause capability for full-duplex media. in bce_ifmedia_upd_locked()
6169 if ((sc->bce_phy_flags & in bce_ifmedia_upd_locked()
6178 mii = device_get_softc(sc->bce_miibus); in bce_ifmedia_upd_locked()
6182 LIST_FOREACH(miisc, &mii->mii_phys, mii_list) in bce_ifmedia_upd_locked()
6198 ifp = sc->bce_ifp; in bce_ifmedia_sts_rphy()
6201 ifmr->ifm_status = IFM_AVALID; in bce_ifmedia_sts_rphy()
6202 ifmr->ifm_active = IFM_ETHER; in bce_ifmedia_sts_rphy()
6206 ifmr->ifm_status |= IFM_ACTIVE; in bce_ifmedia_sts_rphy()
6208 ifmr->ifm_active |= IFM_NONE; in bce_ifmedia_sts_rphy()
6214 ifmr->ifm_active |= IFM_10_T | IFM_HDX; in bce_ifmedia_sts_rphy()
6218 ifmr->ifm_active |= IFM_10_T | IFM_FDX; in bce_ifmedia_sts_rphy()
6222 ifmr->ifm_active |= IFM_100_TX | IFM_HDX; in bce_ifmedia_sts_rphy()
6226 ifmr->ifm_active |= IFM_100_TX | IFM_FDX; in bce_ifmedia_sts_rphy()
6230 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0) in bce_ifmedia_sts_rphy()
6231 ifmr->ifm_active |= IFM_1000_T | IFM_HDX; in bce_ifmedia_sts_rphy()
6233 ifmr->ifm_active |= IFM_1000_SX | IFM_HDX; in bce_ifmedia_sts_rphy()
6237 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0) in bce_ifmedia_sts_rphy()
6238 ifmr->ifm_active |= IFM_1000_T | IFM_FDX; in bce_ifmedia_sts_rphy()
6240 ifmr->ifm_active |= IFM_1000_SX | IFM_FDX; in bce_ifmedia_sts_rphy()
6244 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0) { in bce_ifmedia_sts_rphy()
6245 ifmr->ifm_active |= IFM_NONE; in bce_ifmedia_sts_rphy()
6248 ifmr->ifm_active |= IFM_2500_SX | IFM_HDX; in bce_ifmedia_sts_rphy()
6252 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_PORT_FIBER_FLAG) == 0) { in bce_ifmedia_sts_rphy()
6253 ifmr->ifm_active |= IFM_NONE; in bce_ifmedia_sts_rphy()
6256 ifmr->ifm_active |= IFM_2500_SX | IFM_FDX; in bce_ifmedia_sts_rphy()
6260 ifmr->ifm_active |= IFM_NONE; in bce_ifmedia_sts_rphy()
6265 ifmr->ifm_active |= IFM_ETH_RXPAUSE; in bce_ifmedia_sts_rphy()
6267 ifmr->ifm_active |= IFM_ETH_TXPAUSE; in bce_ifmedia_sts_rphy()
6291 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) in bce_ifmedia_sts()
6294 mii = device_get_softc(sc->bce_miibus); in bce_ifmedia_sts()
6296 ifmr->ifm_active = mii->mii_media_active; in bce_ifmedia_sts()
6297 ifmr->ifm_status = mii->mii_media_status; in bce_ifmedia_sts()
6318 DBRUN(sc->phy_interrupts++); in bce_phy_intr()
6320 new_link_state = sc->status_block->status_attn_bits & in bce_phy_intr()
6322 old_link_state = sc->status_block->status_attn_bits_ack & in bce_phy_intr()
6340 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) { in bce_phy_intr()
6343 if_printf(sc->bce_ifp, "link UP\n"); in bce_phy_intr()
6344 if_link_state_change(sc->bce_ifp, in bce_phy_intr()
6348 if_printf(sc->bce_ifp, "link DOWN\n"); in bce_phy_intr()
6349 if_link_state_change(sc->bce_ifp, in bce_phy_intr()
6358 sc->bce_link_up = FALSE; in bce_phy_intr()
6359 callout_stop(&sc->bce_tick_callout); in bce_phy_intr()
6382 hw_cons = sc->status_block->status_rx_quick_consumer_index0; in bce_get_hw_rx_cons()
6398 if_t ifp = sc->bce_ifp; in bce_rx_intr()
6408 DBRUN(sc->interrupts_rx++); in bce_rx_intr()
6411 __FUNCTION__, sc->rx_prod, sc->rx_cons, sc->rx_prod_bseq); in bce_rx_intr()
6414 for (int i = 0; i < sc->rx_pages; i++) in bce_rx_intr()
6415 bus_dmamap_sync(sc->rx_bd_chain_tag, in bce_rx_intr()
6416 sc->rx_bd_chain_map[i], BUS_DMASYNC_POSTREAD); in bce_rx_intr()
6420 for (int i = 0; i < sc->pg_pages; i++) in bce_rx_intr()
6421 bus_dmamap_sync(sc->pg_bd_chain_tag, in bce_rx_intr()
6422 sc->pg_bd_chain_map[i], BUS_DMASYNC_POSTREAD); in bce_rx_intr()
6426 hw_rx_cons = sc->hw_rx_cons = bce_get_hw_rx_cons(sc); in bce_rx_intr()
6429 sw_rx_cons = sc->rx_cons; in bce_rx_intr()
6430 sw_pg_cons = sc->pg_cons; in bce_rx_intr()
6433 DBRUNIF((sc->free_rx_bd < sc->rx_low_watermark), in bce_rx_intr()
6434 sc->rx_low_watermark = sc->free_rx_bd); in bce_rx_intr()
6435 DBRUNIF((sc->free_rx_bd == sc->max_rx_bd), in bce_rx_intr()
6436 sc->rx_empty_count++); in bce_rx_intr()
6448 bus_dmamap_sync(sc->rx_mbuf_tag, in bce_rx_intr()
6449 sc->rx_mbuf_map[sw_rx_cons_idx], in bce_rx_intr()
6451 bus_dmamap_unload(sc->rx_mbuf_tag, in bce_rx_intr()
6452 sc->rx_mbuf_map[sw_rx_cons_idx]); in bce_rx_intr()
6455 m0 = sc->rx_mbuf_ptr[sw_rx_cons_idx]; in bce_rx_intr()
6456 sc->rx_mbuf_ptr[sw_rx_cons_idx] = NULL; in bce_rx_intr()
6457 DBRUN(sc->debug_rx_mbuf_alloc--); in bce_rx_intr()
6458 sc->free_rx_bd++; in bce_rx_intr()
6468 * DMA'd by the controller into the mbuf looks in bce_rx_intr()
6471 * +---------+-----+---------------------+-----+ in bce_rx_intr()
6473 * +---------+-----+---------------------+-----+ in bce_rx_intr()
6482 pkt_len = l2fhdr->l2_fhdr_pkt_len; in bce_rx_intr()
6483 status = l2fhdr->l2_fhdr_status; in bce_rx_intr()
6488 * +---------------------+-----+ in bce_rx_intr()
6490 * +---------------------+-----+ in bce_rx_intr()
6504 * sc->rx_bd_mbuf_data_len bytes). in bce_rx_intr()
6506 if (pkt_len > m0->m_len) { in bce_rx_intr()
6521 DBRUN(sc->split_header_frames_rcvd++); in bce_rx_intr()
6531 m0->m_len = l2fhdr->l2_fhdr_ip_xsum; in bce_rx_intr()
6532 DBRUN(sc->split_header_tcp_frames_rcvd++); in bce_rx_intr()
6535 rem_len = pkt_len - m0->m_len; in bce_rx_intr()
6544 m_pg = sc->pg_mbuf_ptr[sw_pg_cons_idx]; in bce_rx_intr()
6545 sc->pg_mbuf_ptr[sw_pg_cons_idx] = NULL; in bce_rx_intr()
6546 DBRUN(sc->debug_pg_mbuf_alloc--); in bce_rx_intr()
6547 sc->free_pg_bd++; in bce_rx_intr()
6550 bus_dmamap_sync(sc->pg_mbuf_tag, in bce_rx_intr()
6551 sc->pg_mbuf_map[sw_pg_cons_idx], in bce_rx_intr()
6553 bus_dmamap_unload(sc->pg_mbuf_tag, in bce_rx_intr()
6554 sc->pg_mbuf_map[sw_pg_cons_idx]); in bce_rx_intr()
6557 if (rem_len < m_pg->m_len) { in bce_rx_intr()
6559 m_pg->m_len = rem_len; in bce_rx_intr()
6563 rem_len -= m_pg->m_len; in bce_rx_intr()
6573 m0->m_pkthdr.len = pkt_len; in bce_rx_intr()
6587 m0->m_pkthdr.len = m0->m_len = pkt_len; in bce_rx_intr()
6591 m0->m_pkthdr.len = m0->m_len = pkt_len; in bce_rx_intr()
6594 m_adj(m0, -ETHER_CRC_LEN); in bce_rx_intr()
6598 DBRUNIF(((m0->m_len < ETHER_HDR_LEN) | in bce_rx_intr()
6599 (m0->m_pkthdr.len > BCE_MAX_JUMBO_ETHER_MTU_VLAN)), in bce_rx_intr()
6604 sc->l2fhdr_error_sim_count++; in bce_rx_intr()
6612 sc->l2fhdr_error_count++; in bce_rx_intr()
6619 m0->m_pkthdr.rcvif = ifp; in bce_rx_intr()
6622 m0->m_pkthdr.csum_flags = 0; in bce_rx_intr()
6629 m0->m_pkthdr.csum_flags |= CSUM_IP_CHECKED; in bce_rx_intr()
6630 DBRUN(sc->csum_offload_ip++); in bce_rx_intr()
6632 if ((l2fhdr->l2_fhdr_ip_xsum ^ 0xffff) == 0) in bce_rx_intr()
6633 m0->m_pkthdr.csum_flags |= in bce_rx_intr()
6643 DBRUN(sc->csum_offload_tcp_udp++); in bce_rx_intr()
6644 m0->m_pkthdr.csum_data = in bce_rx_intr()
6645 l2fhdr->l2_fhdr_tcp_udp_xsum; in bce_rx_intr()
6646 m0->m_pkthdr.csum_flags |= in bce_rx_intr()
6655 !(sc->rx_mode & BCE_EMAC_RX_MODE_KEEP_VLAN_TAG)) { in bce_rx_intr()
6656 DBRUN(sc->vlan_tagged_frames_rcvd++); in bce_rx_intr()
6658 DBRUN(sc->vlan_tagged_frames_stripped++); in bce_rx_intr()
6659 m0->m_pkthdr.ether_vtag = in bce_rx_intr()
6660 l2fhdr->l2_fhdr_vlan_tag; in bce_rx_intr()
6661 m0->m_flags |= M_VLANTAG; in bce_rx_intr()
6675 mtod(m0, uint8_t *) - ETHER_VLAN_ENCAP_LEN, in bce_rx_intr()
6677 m0->m_data -= ETHER_VLAN_ENCAP_LEN; in bce_rx_intr()
6679 vh->evl_encap_proto = htons(ETHERTYPE_VLAN); in bce_rx_intr()
6680 vh->evl_tag = htons(l2fhdr->l2_fhdr_vlan_tag); in bce_rx_intr()
6681 m0->m_pkthdr.len += ETHER_VLAN_ENCAP_LEN; in bce_rx_intr()
6682 m0->m_len += ETHER_VLAN_ENCAP_LEN; in bce_rx_intr()
6695 sc->rx_cons = sw_rx_cons; in bce_rx_intr()
6696 sc->pg_cons = sw_pg_cons; in bce_rx_intr()
6703 sw_rx_cons = sc->rx_cons; in bce_rx_intr()
6704 sw_pg_cons = sc->pg_cons; in bce_rx_intr()
6709 hw_rx_cons = sc->hw_rx_cons = bce_get_hw_rx_cons(sc); in bce_rx_intr()
6714 sc->pg_cons = sw_pg_cons; in bce_rx_intr()
6719 sc->rx_cons = sw_rx_cons; in bce_rx_intr()
6723 for (int i = 0; i < sc->rx_pages; i++) in bce_rx_intr()
6724 bus_dmamap_sync(sc->rx_bd_chain_tag, in bce_rx_intr()
6725 sc->rx_bd_chain_map[i], BUS_DMASYNC_PREWRITE); in bce_rx_intr()
6728 for (int i = 0; i < sc->pg_pages; i++) in bce_rx_intr()
6729 bus_dmamap_sync(sc->pg_bd_chain_tag, in bce_rx_intr()
6730 sc->pg_bd_chain_map[i], BUS_DMASYNC_PREWRITE); in bce_rx_intr()
6735 __FUNCTION__, sc->rx_prod, sc->rx_cons, sc->rx_prod_bseq); in bce_rx_intr()
6752 hw_cons = sc->status_block->status_tx_quick_consumer_index0; in bce_get_hw_tx_cons()
6768 if_t ifp = sc->bce_ifp; in bce_tx_intr()
6772 DBRUN(sc->interrupts_tx++); in bce_tx_intr()
6775 __FUNCTION__, sc->tx_prod, sc->tx_cons, sc->tx_prod_bseq); in bce_tx_intr()
6780 hw_tx_cons = sc->hw_tx_cons = bce_get_hw_tx_cons(sc); in bce_tx_intr()
6781 sw_tx_cons = sc->tx_cons; in bce_tx_intr()
6784 bus_space_barrier(sc->bce_btag, sc->bce_bhandle, 0, 0, in bce_tx_intr()
6805 DBRUN(txbd = &sc->tx_bd_chain[TX_PAGE(sw_tx_chain_cons)] in bce_tx_intr()
6821 if (sc->tx_mbuf_ptr[sw_tx_chain_cons] != NULL) { in bce_tx_intr()
6823 DBRUNIF((!(txbd->tx_bd_flags & TX_BD_FLAGS_END)), in bce_tx_intr()
6834 bus_dmamap_unload(sc->tx_mbuf_tag, in bce_tx_intr()
6835 sc->tx_mbuf_map[sw_tx_chain_cons]); in bce_tx_intr()
6838 m_freem(sc->tx_mbuf_ptr[sw_tx_chain_cons]); in bce_tx_intr()
6839 sc->tx_mbuf_ptr[sw_tx_chain_cons] = NULL; in bce_tx_intr()
6840 DBRUN(sc->debug_tx_mbuf_alloc--); in bce_tx_intr()
6845 sc->used_tx_bd--; in bce_tx_intr()
6849 hw_tx_cons = sc->hw_tx_cons = bce_get_hw_tx_cons(sc); in bce_tx_intr()
6852 bus_space_barrier(sc->bce_btag, sc->bce_bhandle, 0, 0, in bce_tx_intr()
6857 sc->watchdog_timer = 0; in bce_tx_intr()
6860 if (sc->used_tx_bd < sc->max_tx_bd) { in bce_tx_intr()
6864 __FUNCTION__, sc->used_tx_bd, sc->max_tx_bd)); in bce_tx_intr()
6868 sc->tx_cons = sw_tx_cons; in bce_tx_intr()
6872 __FUNCTION__, sc->tx_prod, sc->tx_cons, sc->tx_prod_bseq); in bce_tx_intr()
6906 BCE_PCICFG_INT_ACK_CMD_MASK_INT | sc->last_status_idx); in bce_enable_intr()
6909 BCE_PCICFG_INT_ACK_CMD_INDEX_VALID | sc->last_status_idx); in bce_enable_intr()
6913 REG_WR(sc, BCE_HC_COMMAND, sc->hc_command | BCE_HC_COMMAND_COAL_NOW); in bce_enable_intr()
6919 /* Handles controller initialization. */
6934 ifp = sc->bce_ifp; in bce_init_locked()
6943 BCE_PRINTF("%s(%d): Controller reset failed!\n", in bce_init_locked()
6949 BCE_PRINTF("%s(%d): Controller initialization failed!\n", in bce_init_locked()
6961 bcopy(if_getlladdr(sc->bce_ifp), sc->eaddr, ETHER_ADDR_LEN); in bce_init_locked()
6975 if (if_getmtu(ifp) <= sc->rx_bd_mbuf_data_len + MCLBYTES) in bce_init_locked()
6976 ether_mtu = sc->rx_bd_mbuf_data_len + in bce_init_locked()
6981 if (if_getmtu(ifp) <= sc->rx_bd_mbuf_data_len) in bce_init_locked()
6982 ether_mtu = sc->rx_bd_mbuf_data_len; in bce_init_locked()
7024 callout_reset(&sc->bce_tick_callout, hz, bce_tick, sc); in bce_init_locked()
7031 /* Initialize the controller just enough so that any management firmware */
7047 if (!(sc->bce_flags & BCE_MFW_ENABLE_FLAG)) { in bce_mgmt_init_locked()
7053 ifp = sc->bce_ifp; in bce_mgmt_init_locked()
7067 /* Handles controller initialization when called from an unlocked routine. */
7102 DBRUN(sc->tso_frames_requested++); in bce_tso_setup()
7105 /* Controller may modify mbuf chains. */ in bce_tso_setup()
7110 sc->mbuf_alloc_failed_count++; in bce_tso_setup()
7118 * For TSO the controller needs two pieces of info, in bce_tso_setup()
7127 etype = ntohs(eh->ether_type); in bce_tso_setup()
7132 ip = (struct ip *)(m->m_data + sizeof(struct ether_header)); in bce_tso_setup()
7134 if (ip->ip_p != IPPROTO_TCP) { in bce_tso_setup()
7135 BCE_PRINTF("%s(%d): TSO enabled for non-TCP frame!.\n", in bce_tso_setup()
7143 ip_hlen = ip->ip_hl << 2; in bce_tso_setup()
7152 ip = (struct ip *)(m->m_data + sizeof(struct ether_header)); in bce_tso_setup()
7154 tcp_hlen = (th->th_off << 2); in bce_tso_setup()
7165 ip = (struct ip *)(m->m_data + sizeof(struct ether_header)); in bce_tso_setup()
7166 ip_len = ip->ip_len; in bce_tso_setup()
7167 ip->ip_len = 0; in bce_tso_setup()
7168 ip->ip_sum = 0; in bce_tso_setup()
7196 *flags |= (((ip_hlen + tcp_hlen - sizeof(struct ip) - in bce_tso_setup()
7199 DBRUN(sc->tso_frames_completed++); in bce_tso_setup()
7205 /* memory visible to the controller. */
7231 if (sc->used_tx_bd >= sc->max_tx_bd) in bce_tx_encap()
7236 if (m0->m_pkthdr.csum_flags) { in bce_tx_encap()
7237 if (m0->m_pkthdr.csum_flags & CSUM_TSO) { in bce_tx_encap()
7240 DBRUN(sc->tso_frames_failed++); in bce_tx_encap()
7243 mss = htole16(m0->m_pkthdr.tso_segsz); in bce_tx_encap()
7245 if (m0->m_pkthdr.csum_flags & CSUM_IP) in bce_tx_encap()
7247 if (m0->m_pkthdr.csum_flags & (CSUM_TCP | CSUM_UDP)) in bce_tx_encap()
7253 if (m0->m_flags & M_VLANTAG) { in bce_tx_encap()
7255 vlan_tag = m0->m_pkthdr.ether_vtag; in bce_tx_encap()
7259 prod = sc->tx_prod; in bce_tx_encap()
7261 map = sc->tx_mbuf_map[chain_prod]; in bce_tx_encap()
7264 error = bus_dmamap_load_mbuf_sg(sc->tx_mbuf_tag, map, m0, in bce_tx_encap()
7269 sc->mbuf_frag_count++; in bce_tx_encap()
7277 sc->mbuf_alloc_failed_count++; in bce_tx_encap()
7284 error = bus_dmamap_load_mbuf_sg(sc->tx_mbuf_tag, in bce_tx_encap()
7290 sc->dma_map_addr_tx_failed_count++; in bce_tx_encap()
7299 sc->dma_map_addr_tx_failed_count++; in bce_tx_encap()
7305 sc->dma_map_addr_tx_failed_count++; in bce_tx_encap()
7311 sc->dma_map_addr_tx_failed_count++; in bce_tx_encap()
7317 if (nsegs > (sc->max_tx_bd - sc->used_tx_bd)) { in bce_tx_encap()
7318 bus_dmamap_unload(sc->tx_mbuf_tag, map); in bce_tx_encap()
7324 prod_bseq = sc->tx_prod_bseq; in bce_tx_encap()
7343 txbd= &sc->tx_bd_chain[TX_PAGE(chain_prod)] in bce_tx_encap()
7346 txbd->tx_bd_haddr_lo = in bce_tx_encap()
7348 txbd->tx_bd_haddr_hi = in bce_tx_encap()
7350 txbd->tx_bd_mss_nbytes = htole32(mss << 16) | in bce_tx_encap()
7352 txbd->tx_bd_vlan_tag = htole16(vlan_tag); in bce_tx_encap()
7353 txbd->tx_bd_flags = htole16(flags); in bce_tx_encap()
7356 txbd->tx_bd_flags |= htole16(TX_BD_FLAGS_START); in bce_tx_encap()
7361 txbd->tx_bd_flags |= htole16(TX_BD_FLAGS_END); in bce_tx_encap()
7375 sc->tx_mbuf_ptr[chain_prod] = m0; in bce_tx_encap()
7376 sc->used_tx_bd += nsegs; in bce_tx_encap()
7379 DBRUNIF((sc->used_tx_bd > sc->tx_hi_watermark), in bce_tx_encap()
7380 sc->tx_hi_watermark = sc->used_tx_bd); in bce_tx_encap()
7381 DBRUNIF((sc->used_tx_bd == sc->max_tx_bd), sc->tx_full_count++); in bce_tx_encap()
7382 DBRUNIF(sc->debug_tx_mbuf_alloc++); in bce_tx_encap()
7387 sc->tx_prod = prod; in bce_tx_encap()
7388 sc->tx_prod_bseq = prod_bseq; in bce_tx_encap()
7392 BCE_L2MQ_TX_HOST_BIDX, sc->tx_prod); in bce_tx_encap()
7394 BCE_L2MQ_TX_HOST_BSEQ, sc->tx_prod_bseq); in bce_tx_encap()
7420 tx_prod = sc->tx_prod; in bce_start_locked()
7426 __FUNCTION__, tx_prod, tx_chain_prod, sc->tx_prod_bseq); in bce_start_locked()
7429 if (sc->bce_link_up == FALSE) { in bce_start_locked()
7444 while (sc->used_tx_bd < sc->max_tx_bd) { in bce_start_locked()
7464 "tx_bd used = %d\n", sc->used_tx_bd); in bce_start_locked()
7485 sc->watchdog_timer = BCE_TX_TIMEOUT; in bce_start_locked()
7534 if ((ifr->ifr_mtu < BCE_MIN_MTU) || in bce_ioctl()
7535 (ifr->ifr_mtu > BCE_MAX_JUMBO_MTU)) { in bce_ioctl()
7542 (int) if_getmtu(ifp), (int) ifr->ifr_mtu); in bce_ioctl()
7545 if_setmtu(ifp, ifr->ifr_mtu); in bce_ioctl()
7573 /* If MFW is running, restart the controller a bit. */ in bce_ioctl()
7574 if (sc->bce_flags & BCE_MFW_ENABLE_FLAG) { in bce_ioctl()
7603 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) in bce_ioctl()
7604 error = ifmedia_ioctl(ifp, ifr, &sc->bce_ifmedia, in bce_ioctl()
7607 mii = device_get_softc(sc->bce_miibus); in bce_ioctl()
7608 error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, in bce_ioctl()
7615 mask = ifr->ifr_reqcap ^ if_getcapenable(ifp); in bce_ioctl()
7694 if (sc->watchdog_timer == 0 || --sc->watchdog_timer) in bce_watchdog()
7699 if ((sc->bce_flags & BCE_USING_RX_FLOW_CONTROL) != 0) { in bce_watchdog()
7705 sc->watchdog_timer = BCE_TX_TIMEOUT; in bce_watchdog()
7714 sc->watchdog_timer = BCE_TX_TIMEOUT; in bce_watchdog()
7718 * Any other condition is unexpected and the controller in bce_watchdog()
7739 if_setdrvflagbits(sc->bce_ifp, 0, IFF_DRV_RUNNING); in bce_watchdog()
7742 sc->watchdog_timeouts++; in bce_watchdog()
7753 /* Main interrupt entry point. Verifies that the controller generated the */
7769 ifp = sc->bce_ifp; in bce_intr()
7777 DBRUN(sc->interrupts_generated++); in bce_intr()
7780 bus_dmamap_sync(sc->status_tag, sc->status_map, BUS_DMASYNC_POSTREAD); in bce_intr()
7788 if ((sc->bce_flags & (BCE_USING_MSI_FLAG | BCE_USING_MSIX_FLAG)) == 0 && in bce_intr()
7789 sc->status_block->status_idx == sc->last_status_idx && in bce_intr()
7808 status_attn_bits = sc->status_block->status_attn_bits; in bce_intr()
7813 sc->unexpected_attention_sim_count++; in bce_intr()
7819 (sc->status_block->status_attn_bits_ack & in bce_intr()
7824 REG_WR(sc, BCE_HC_COMMAND, sc->hc_command | in bce_intr()
7831 (sc->status_block->status_attn_bits_ack & in bce_intr()
7833 sc->unexpected_attention_count++; in bce_intr()
7837 sc->status_block->status_attn_bits); in bce_intr()
7848 if (hw_rx_cons != sc->hw_rx_cons) in bce_intr()
7852 if (hw_tx_cons != sc->hw_tx_cons) in bce_intr()
7856 sc->last_status_idx = sc->status_block->status_idx; in bce_intr()
7862 bus_space_barrier(sc->bce_btag, sc->bce_bhandle, 0, 0, in bce_intr()
7872 if ((hw_rx_cons == sc->hw_rx_cons) && in bce_intr()
7873 (hw_tx_cons == sc->hw_tx_cons)) in bce_intr()
7877 bus_dmamap_sync(sc->status_tag, sc->status_map, BUS_DMASYNC_PREREAD); in bce_intr()
7879 /* Re-enable interrupts. */ in bce_intr()
7923 ifp = sc->bce_ifp; in bce_set_rx_mode()
7926 rx_mode = sc->rx_mode & ~(BCE_EMAC_RX_MODE_PROMISCUOUS | in bce_set_rx_mode()
7935 (!(sc->bce_flags & BCE_MFW_ENABLE_FLAG))) in bce_set_rx_mode()
7969 if (rx_mode != sc->rx_mode) { in bce_set_rx_mode()
7973 sc->rx_mode = rx_mode; in bce_set_rx_mode()
7999 bus_dmamap_sync(sc->stats_tag, sc->stats_map, BUS_DMASYNC_POSTREAD); in bce_stats_update()
8001 stats = (struct statistics_block *) sc->stats_block; in bce_stats_update()
8007 sc->stat_IfHCInOctets = in bce_stats_update()
8008 ((u64) stats->stat_IfHCInOctets_hi << 32) + in bce_stats_update()
8009 (u64) stats->stat_IfHCInOctets_lo; in bce_stats_update()
8011 sc->stat_IfHCInBadOctets = in bce_stats_update()
8012 ((u64) stats->stat_IfHCInBadOctets_hi << 32) + in bce_stats_update()
8013 (u64) stats->stat_IfHCInBadOctets_lo; in bce_stats_update()
8015 sc->stat_IfHCOutOctets = in bce_stats_update()
8016 ((u64) stats->stat_IfHCOutOctets_hi << 32) + in bce_stats_update()
8017 (u64) stats->stat_IfHCOutOctets_lo; in bce_stats_update()
8019 sc->stat_IfHCOutBadOctets = in bce_stats_update()
8020 ((u64) stats->stat_IfHCOutBadOctets_hi << 32) + in bce_stats_update()
8021 (u64) stats->stat_IfHCOutBadOctets_lo; in bce_stats_update()
8023 sc->stat_IfHCInUcastPkts = in bce_stats_update()
8024 ((u64) stats->stat_IfHCInUcastPkts_hi << 32) + in bce_stats_update()
8025 (u64) stats->stat_IfHCInUcastPkts_lo; in bce_stats_update()
8027 sc->stat_IfHCInMulticastPkts = in bce_stats_update()
8028 ((u64) stats->stat_IfHCInMulticastPkts_hi << 32) + in bce_stats_update()
8029 (u64) stats->stat_IfHCInMulticastPkts_lo; in bce_stats_update()
8031 sc->stat_IfHCInBroadcastPkts = in bce_stats_update()
8032 ((u64) stats->stat_IfHCInBroadcastPkts_hi << 32) + in bce_stats_update()
8033 (u64) stats->stat_IfHCInBroadcastPkts_lo; in bce_stats_update()
8035 sc->stat_IfHCOutUcastPkts = in bce_stats_update()
8036 ((u64) stats->stat_IfHCOutUcastPkts_hi << 32) + in bce_stats_update()
8037 (u64) stats->stat_IfHCOutUcastPkts_lo; in bce_stats_update()
8039 sc->stat_IfHCOutMulticastPkts = in bce_stats_update()
8040 ((u64) stats->stat_IfHCOutMulticastPkts_hi << 32) + in bce_stats_update()
8041 (u64) stats->stat_IfHCOutMulticastPkts_lo; in bce_stats_update()
8043 sc->stat_IfHCOutBroadcastPkts = in bce_stats_update()
8044 ((u64) stats->stat_IfHCOutBroadcastPkts_hi << 32) + in bce_stats_update()
8045 (u64) stats->stat_IfHCOutBroadcastPkts_lo; in bce_stats_update()
8048 /* ToDo: Read the statistics from auto-clear regs? */ in bce_stats_update()
8050 sc->stat_emac_tx_stat_dot3statsinternalmactransmiterrors = in bce_stats_update()
8051 stats->stat_emac_tx_stat_dot3statsinternalmactransmiterrors; in bce_stats_update()
8053 sc->stat_Dot3StatsCarrierSenseErrors = in bce_stats_update()
8054 stats->stat_Dot3StatsCarrierSenseErrors; in bce_stats_update()
8056 sc->stat_Dot3StatsFCSErrors = in bce_stats_update()
8057 stats->stat_Dot3StatsFCSErrors; in bce_stats_update()
8059 sc->stat_Dot3StatsAlignmentErrors = in bce_stats_update()
8060 stats->stat_Dot3StatsAlignmentErrors; in bce_stats_update()
8062 sc->stat_Dot3StatsSingleCollisionFrames = in bce_stats_update()
8063 stats->stat_Dot3StatsSingleCollisionFrames; in bce_stats_update()
8065 sc->stat_Dot3StatsMultipleCollisionFrames = in bce_stats_update()
8066 stats->stat_Dot3StatsMultipleCollisionFrames; in bce_stats_update()
8068 sc->stat_Dot3StatsDeferredTransmissions = in bce_stats_update()
8069 stats->stat_Dot3StatsDeferredTransmissions; in bce_stats_update()
8071 sc->stat_Dot3StatsExcessiveCollisions = in bce_stats_update()
8072 stats->stat_Dot3StatsExcessiveCollisions; in bce_stats_update()
8074 sc->stat_Dot3StatsLateCollisions = in bce_stats_update()
8075 stats->stat_Dot3StatsLateCollisions; in bce_stats_update()
8077 sc->stat_EtherStatsCollisions = in bce_stats_update()
8078 stats->stat_EtherStatsCollisions; in bce_stats_update()
8080 sc->stat_EtherStatsFragments = in bce_stats_update()
8081 stats->stat_EtherStatsFragments; in bce_stats_update()
8083 sc->stat_EtherStatsJabbers = in bce_stats_update()
8084 stats->stat_EtherStatsJabbers; in bce_stats_update()
8086 sc->stat_EtherStatsUndersizePkts = in bce_stats_update()
8087 stats->stat_EtherStatsUndersizePkts; in bce_stats_update()
8089 sc->stat_EtherStatsOversizePkts = in bce_stats_update()
8090 stats->stat_EtherStatsOversizePkts; in bce_stats_update()
8092 sc->stat_EtherStatsPktsRx64Octets = in bce_stats_update()
8093 stats->stat_EtherStatsPktsRx64Octets; in bce_stats_update()
8095 sc->stat_EtherStatsPktsRx65Octetsto127Octets = in bce_stats_update()
8096 stats->stat_EtherStatsPktsRx65Octetsto127Octets; in bce_stats_update()
8098 sc->stat_EtherStatsPktsRx128Octetsto255Octets = in bce_stats_update()
8099 stats->stat_EtherStatsPktsRx128Octetsto255Octets; in bce_stats_update()
8101 sc->stat_EtherStatsPktsRx256Octetsto511Octets = in bce_stats_update()
8102 stats->stat_EtherStatsPktsRx256Octetsto511Octets; in bce_stats_update()
8104 sc->stat_EtherStatsPktsRx512Octetsto1023Octets = in bce_stats_update()
8105 stats->stat_EtherStatsPktsRx512Octetsto1023Octets; in bce_stats_update()
8107 sc->stat_EtherStatsPktsRx1024Octetsto1522Octets = in bce_stats_update()
8108 stats->stat_EtherStatsPktsRx1024Octetsto1522Octets; in bce_stats_update()
8110 sc->stat_EtherStatsPktsRx1523Octetsto9022Octets = in bce_stats_update()
8111 stats->stat_EtherStatsPktsRx1523Octetsto9022Octets; in bce_stats_update()
8113 sc->stat_EtherStatsPktsTx64Octets = in bce_stats_update()
8114 stats->stat_EtherStatsPktsTx64Octets; in bce_stats_update()
8116 sc->stat_EtherStatsPktsTx65Octetsto127Octets = in bce_stats_update()
8117 stats->stat_EtherStatsPktsTx65Octetsto127Octets; in bce_stats_update()
8119 sc->stat_EtherStatsPktsTx128Octetsto255Octets = in bce_stats_update()
8120 stats->stat_EtherStatsPktsTx128Octetsto255Octets; in bce_stats_update()
8122 sc->stat_EtherStatsPktsTx256Octetsto511Octets = in bce_stats_update()
8123 stats->stat_EtherStatsPktsTx256Octetsto511Octets; in bce_stats_update()
8125 sc->stat_EtherStatsPktsTx512Octetsto1023Octets = in bce_stats_update()
8126 stats->stat_EtherStatsPktsTx512Octetsto1023Octets; in bce_stats_update()
8128 sc->stat_EtherStatsPktsTx1024Octetsto1522Octets = in bce_stats_update()
8129 stats->stat_EtherStatsPktsTx1024Octetsto1522Octets; in bce_stats_update()
8131 sc->stat_EtherStatsPktsTx1523Octetsto9022Octets = in bce_stats_update()
8132 stats->stat_EtherStatsPktsTx1523Octetsto9022Octets; in bce_stats_update()
8134 sc->stat_XonPauseFramesReceived = in bce_stats_update()
8135 stats->stat_XonPauseFramesReceived; in bce_stats_update()
8137 sc->stat_XoffPauseFramesReceived = in bce_stats_update()
8138 stats->stat_XoffPauseFramesReceived; in bce_stats_update()
8140 sc->stat_OutXonSent = in bce_stats_update()
8141 stats->stat_OutXonSent; in bce_stats_update()
8143 sc->stat_OutXoffSent = in bce_stats_update()
8144 stats->stat_OutXoffSent; in bce_stats_update()
8146 sc->stat_FlowControlDone = in bce_stats_update()
8147 stats->stat_FlowControlDone; in bce_stats_update()
8149 sc->stat_MacControlFramesReceived = in bce_stats_update()
8150 stats->stat_MacControlFramesReceived; in bce_stats_update()
8152 sc->stat_XoffStateEntered = in bce_stats_update()
8153 stats->stat_XoffStateEntered; in bce_stats_update()
8155 sc->stat_IfInFramesL2FilterDiscards = in bce_stats_update()
8156 stats->stat_IfInFramesL2FilterDiscards; in bce_stats_update()
8158 sc->stat_IfInRuleCheckerDiscards = in bce_stats_update()
8159 stats->stat_IfInRuleCheckerDiscards; in bce_stats_update()
8161 sc->stat_IfInFTQDiscards = in bce_stats_update()
8162 stats->stat_IfInFTQDiscards; in bce_stats_update()
8164 sc->stat_IfInMBUFDiscards = in bce_stats_update()
8165 stats->stat_IfInMBUFDiscards; in bce_stats_update()
8167 sc->stat_IfInRuleCheckerP4Hit = in bce_stats_update()
8168 stats->stat_IfInRuleCheckerP4Hit; in bce_stats_update()
8170 sc->stat_CatchupInRuleCheckerDiscards = in bce_stats_update()
8171 stats->stat_CatchupInRuleCheckerDiscards; in bce_stats_update()
8173 sc->stat_CatchupInFTQDiscards = in bce_stats_update()
8174 stats->stat_CatchupInFTQDiscards; in bce_stats_update()
8176 sc->stat_CatchupInMBUFDiscards = in bce_stats_update()
8177 stats->stat_CatchupInMBUFDiscards; in bce_stats_update()
8179 sc->stat_CatchupInRuleCheckerP4Hit = in bce_stats_update()
8180 stats->stat_CatchupInRuleCheckerP4Hit; in bce_stats_update()
8182 sc->com_no_buffers = REG_RD_IND(sc, 0x120084); in bce_stats_update()
8199 return (sc->stat_EtherStatsCollisions); in bce_get_counter()
8201 return (sc->stat_EtherStatsUndersizePkts + in bce_get_counter()
8202 sc->stat_EtherStatsOversizePkts + in bce_get_counter()
8203 sc->stat_IfInMBUFDiscards + in bce_get_counter()
8204 sc->stat_Dot3StatsAlignmentErrors + in bce_get_counter()
8205 sc->stat_Dot3StatsFCSErrors + in bce_get_counter()
8206 sc->stat_IfInRuleCheckerDiscards + in bce_get_counter()
8207 sc->stat_IfInFTQDiscards + in bce_get_counter()
8208 sc->l2fhdr_error_count + in bce_get_counter()
8209 sc->com_no_buffers); in bce_get_counter()
8211 rv = sc->stat_Dot3StatsExcessiveCollisions + in bce_get_counter()
8212 sc->stat_emac_tx_stat_dot3statsinternalmactransmiterrors + in bce_get_counter()
8213 sc->stat_Dot3StatsLateCollisions + in bce_get_counter()
8214 sc->watchdog_timeouts; in bce_get_counter()
8222 rv += sc->stat_Dot3StatsCarrierSenseErrors; in bce_get_counter()
8247 msg = (u32) ++sc->bce_fw_drv_pulse_wr_seq; in bce_pulse()
8251 sc->bc_state = bce_shmem_rd(sc, BCE_BC_STATE_CONDITION); in bce_pulse()
8255 if (sc->bce_drv_cardiac_arrest == FALSE) { in bce_pulse()
8256 if (!(sc->bc_state & BCE_CONDITION_DRV_PRESENT)) { in bce_pulse()
8257 sc->bce_drv_cardiac_arrest = TRUE; in bce_pulse()
8261 __FUNCTION__, sc->bc_state); in bce_pulse()
8268 * controller to clear this condition. in bce_pulse()
8270 if (sc->bc_state & BCE_CONDITION_DRV_PRESENT) { in bce_pulse()
8271 sc->bce_drv_cardiac_arrest = FALSE; in bce_pulse()
8274 __FUNCTION__, sc->bc_state); in bce_pulse()
8280 callout_reset(&sc->bce_pulse_callout, hz, bce_pulse, sc); in bce_pulse()
8299 ifp = sc->bce_ifp; in bce_tick()
8306 callout_reset(&sc->bce_tick_callout, hz, bce_tick, sc); in bce_tick()
8311 /* Ensure page and RX chains get refilled in low-memory situations. */ in bce_tick()
8320 if (sc->bce_link_up == TRUE) in bce_tick()
8324 if ((sc->bce_phy_flags & BCE_PHY_REMOTE_CAP_FLAG) != 0) { in bce_tick()
8329 sc->bce_link_up = TRUE; in bce_tick()
8330 bce_miibus_statchg(sc->bce_dev); in bce_tick()
8333 mii = device_get_softc(sc->bce_miibus); in bce_tick()
8336 if ((mii->mii_media_status & IFM_ACTIVE) && in bce_tick()
8337 (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)) { in bce_tick()
8340 sc->bce_link_up = TRUE; in bce_tick()
8341 if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T || in bce_tick()
8342 IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX || in bce_tick()
8343 IFM_SUBTYPE(mii->mii_media_active) == IFM_2500_SX) && in bce_tick()
8348 if (sc->bce_link_up == TRUE) { in bce_tick()
8375 if ((sc->bce_phy_flags & BCE_PHY_SERDES_FLAG) != 0 && in bce_fw_cap_init()
8377 sc->bce_phy_flags &= ~BCE_PHY_REMOTE_PORT_FIBER_FLAG; in bce_fw_cap_init()
8378 sc->bce_phy_flags |= BCE_PHY_REMOTE_CAP_FLAG; in bce_fw_cap_init()
8381 sc->bce_phy_flags |= BCE_PHY_REMOTE_PORT_FIBER_FLAG; in bce_fw_cap_init()
8404 result = -1; in bce_sysctl_driver_state()
8407 if (error || !req->newptr) in bce_sysctl_driver_state()
8431 result = -1; in bce_sysctl_hw_state()
8434 if (error || !req->newptr) in bce_sysctl_hw_state()
8458 result = -1; in bce_sysctl_status_block()
8461 if (error || !req->newptr) in bce_sysctl_status_block()
8485 result = -1; in bce_sysctl_stats_block()
8488 if (error || !req->newptr) in bce_sysctl_stats_block()
8513 result = -1; in bce_sysctl_stats_clear()
8516 if (error || !req->newptr) in bce_sysctl_stats_clear()
8523 stats = (struct statistics_block *) sc->stats_block; in bce_sysctl_stats_clear()
8525 bus_dmamap_sync(sc->stats_tag, sc->stats_map, in bce_sysctl_stats_clear()
8532 sc->interrupts_rx = in bce_sysctl_stats_clear()
8533 sc->interrupts_tx = 0; in bce_sysctl_stats_clear()
8534 sc->tso_frames_requested = in bce_sysctl_stats_clear()
8535 sc->tso_frames_completed = in bce_sysctl_stats_clear()
8536 sc->tso_frames_failed = 0; in bce_sysctl_stats_clear()
8537 sc->rx_empty_count = in bce_sysctl_stats_clear()
8538 sc->tx_full_count = 0; in bce_sysctl_stats_clear()
8539 sc->rx_low_watermark = USABLE_RX_BD_ALLOC; in bce_sysctl_stats_clear()
8540 sc->tx_hi_watermark = 0; in bce_sysctl_stats_clear()
8541 sc->l2fhdr_error_count = in bce_sysctl_stats_clear()
8542 sc->l2fhdr_error_sim_count = 0; in bce_sysctl_stats_clear()
8543 sc->mbuf_alloc_failed_count = in bce_sysctl_stats_clear()
8544 sc->mbuf_alloc_failed_sim_count = 0; in bce_sysctl_stats_clear()
8545 sc->dma_map_addr_rx_failed_count = in bce_sysctl_stats_clear()
8546 sc->dma_map_addr_tx_failed_count = 0; in bce_sysctl_stats_clear()
8547 sc->mbuf_frag_count = 0; in bce_sysctl_stats_clear()
8548 sc->csum_offload_tcp_udp = in bce_sysctl_stats_clear()
8549 sc->csum_offload_ip = 0; in bce_sysctl_stats_clear()
8550 sc->vlan_tagged_frames_rcvd = in bce_sysctl_stats_clear()
8551 sc->vlan_tagged_frames_stripped = 0; in bce_sysctl_stats_clear()
8552 sc->split_header_frames_rcvd = in bce_sysctl_stats_clear()
8553 sc->split_header_tcp_frames_rcvd = 0; in bce_sysctl_stats_clear()
8576 result = -1; in bce_sysctl_shmem_state()
8579 if (error || !req->newptr) in bce_sysctl_shmem_state()
8603 result = -1; in bce_sysctl_bc_state()
8606 if (error || !req->newptr) in bce_sysctl_bc_state()
8630 result = -1; in bce_sysctl_dump_rx_bd_chain()
8633 if (error || !req->newptr) in bce_sysctl_dump_rx_bd_chain()
8657 result = -1; in bce_sysctl_dump_rx_mbuf_chain()
8660 if (error || !req->newptr) in bce_sysctl_dump_rx_mbuf_chain()
8684 result = -1; in bce_sysctl_dump_tx_chain()
8687 if (error || !req->newptr) in bce_sysctl_dump_tx_chain()
8711 result = -1; in bce_sysctl_dump_pg_chain()
8714 if (error || !req->newptr) in bce_sysctl_dump_pg_chain()
8741 result = -1; in bce_sysctl_nvram_read()
8743 if (error || (req->newptr == NULL)) in bce_sysctl_nvram_read()
8767 result = -1; in bce_sysctl_reg_read()
8769 if (error || (req->newptr == NULL)) in bce_sysctl_reg_read()
8799 result = -1; in bce_sysctl_phy_read()
8801 if (error || (req->newptr == NULL)) in bce_sysctl_phy_read()
8807 dev = sc->bce_dev; in bce_sysctl_phy_read()
8808 val = bce_miibus_read_reg(dev, sc->bce_phy_addr, result); in bce_sysctl_phy_read()
8827 if (sc->nvram_buf == NULL) in bce_sysctl_nvram_dump()
8828 sc->nvram_buf = malloc(sc->bce_flash_size, in bce_sysctl_nvram_dump()
8832 if (req->oldlen == sc->bce_flash_size) { in bce_sysctl_nvram_dump()
8833 for (i = 0; i < sc->bce_flash_size && error == 0; i++) in bce_sysctl_nvram_dump()
8834 error = bce_nvram_read(sc, i, &sc->nvram_buf[i], 1); in bce_sysctl_nvram_dump()
8838 error = SYSCTL_OUT(req, sc->nvram_buf, sc->bce_flash_size); in bce_sysctl_nvram_dump()
8857 if (sc->nvram_buf == NULL) in bce_sysctl_nvram_write()
8858 sc->nvram_buf = malloc(sc->bce_flash_size, in bce_sysctl_nvram_write()
8861 bzero(sc->nvram_buf, sc->bce_flash_size); in bce_sysctl_nvram_write()
8863 error = SYSCTL_IN(req, sc->nvram_buf, sc->bce_flash_size); in bce_sysctl_nvram_write()
8867 if (req->newlen == sc->bce_flash_size) in bce_sysctl_nvram_write()
8868 error = bce_nvram_write(sc, 0, sc->nvram_buf, in bce_sysctl_nvram_write()
8869 sc->bce_flash_size); in bce_sysctl_nvram_write()
8887 result = -1; in bce_sysctl_dump_ctx()
8889 if (error || (req->newptr == NULL)) in bce_sysctl_dump_ctx()
8915 result = -1; in bce_sysctl_breakpoint()
8918 if (error || !req->newptr) in bce_sysctl_breakpoint()
8944 ctx = device_get_sysctl_ctx(sc->bce_dev); in bce_add_sysctls()
8945 children = SYSCTL_CHILDREN(device_get_sysctl_tree(sc->bce_dev)); in bce_add_sysctls()
8955 CTLFLAG_RD, &sc->l2fhdr_error_sim_count, in bce_add_sysctls()
8961 CTLFLAG_RD, &sc->l2fhdr_error_count, in bce_add_sysctls()
8972 CTLFLAG_RD, &sc->mbuf_alloc_failed_sim_count, in bce_add_sysctls()
8978 CTLFLAG_RD, &sc->mbuf_alloc_failed_count, in bce_add_sysctls()
8983 CTLFLAG_RD, &sc->mbuf_frag_count, in bce_add_sysctls()
8995 CTLFLAG_RD, &sc->dma_map_addr_failed_sim_count, in bce_add_sysctls()
9002 CTLFLAG_RD, &sc->dma_map_addr_rx_failed_count, in bce_add_sysctls()
9007 CTLFLAG_RD, &sc->dma_map_addr_tx_failed_count, in bce_add_sysctls()
9018 CTLFLAG_RW, &sc->unexpected_attention_sim_count, in bce_add_sysctls()
9024 CTLFLAG_RW, &sc->unexpected_attention_count, in bce_add_sysctls()
9035 CTLFLAG_RD, &sc->rx_low_watermark, in bce_add_sysctls()
9040 CTLFLAG_RD, &sc->rx_empty_count, in bce_add_sysctls()
9045 CTLFLAG_RD, &sc->tx_hi_watermark, in bce_add_sysctls()
9050 CTLFLAG_RD, &sc->tx_full_count, in bce_add_sysctls()
9055 CTLFLAG_RD, &sc->tso_frames_requested, in bce_add_sysctls()
9060 CTLFLAG_RD, &sc->tso_frames_completed, in bce_add_sysctls()
9065 CTLFLAG_RD, &sc->tso_frames_failed, in bce_add_sysctls()
9070 CTLFLAG_RD, &sc->csum_offload_ip, in bce_add_sysctls()
9075 CTLFLAG_RD, &sc->csum_offload_tcp_udp, in bce_add_sysctls()
9080 CTLFLAG_RD, &sc->vlan_tagged_frames_rcvd, in bce_add_sysctls()
9085 CTLFLAG_RD, &sc->vlan_tagged_frames_stripped, in bce_add_sysctls()
9090 CTLFLAG_RD, &sc->interrupts_rx, in bce_add_sysctls()
9095 CTLFLAG_RD, &sc->interrupts_tx, in bce_add_sysctls()
9101 CTLFLAG_RD, &sc->split_header_frames_rcvd, in bce_add_sysctls()
9106 CTLFLAG_RD, &sc->split_header_tcp_frames_rcvd, in bce_add_sysctls()
9125 CTLFLAG_RD, &sc->stat_IfHCInOctets, in bce_add_sysctls()
9130 CTLFLAG_RD, &sc->stat_IfHCInBadOctets, in bce_add_sysctls()
9135 CTLFLAG_RD, &sc->stat_IfHCOutOctets, in bce_add_sysctls()
9140 CTLFLAG_RD, &sc->stat_IfHCOutBadOctets, in bce_add_sysctls()
9145 CTLFLAG_RD, &sc->stat_IfHCInUcastPkts, in bce_add_sysctls()
9150 CTLFLAG_RD, &sc->stat_IfHCInMulticastPkts, in bce_add_sysctls()
9155 CTLFLAG_RD, &sc->stat_IfHCInBroadcastPkts, in bce_add_sysctls()
9160 CTLFLAG_RD, &sc->stat_IfHCOutUcastPkts, in bce_add_sysctls()
9165 CTLFLAG_RD, &sc->stat_IfHCOutMulticastPkts, in bce_add_sysctls()
9170 CTLFLAG_RD, &sc->stat_IfHCOutBroadcastPkts, in bce_add_sysctls()
9175 CTLFLAG_RD, &sc->stat_emac_tx_stat_dot3statsinternalmactransmiterrors, in bce_add_sysctls()
9180 CTLFLAG_RD, &sc->stat_Dot3StatsCarrierSenseErrors, in bce_add_sysctls()
9185 CTLFLAG_RD, &sc->stat_Dot3StatsFCSErrors, in bce_add_sysctls()
9190 CTLFLAG_RD, &sc->stat_Dot3StatsAlignmentErrors, in bce_add_sysctls()
9195 CTLFLAG_RD, &sc->stat_Dot3StatsSingleCollisionFrames, in bce_add_sysctls()
9200 CTLFLAG_RD, &sc->stat_Dot3StatsMultipleCollisionFrames, in bce_add_sysctls()
9205 CTLFLAG_RD, &sc->stat_Dot3StatsDeferredTransmissions, in bce_add_sysctls()
9210 CTLFLAG_RD, &sc->stat_Dot3StatsExcessiveCollisions, in bce_add_sysctls()
9215 CTLFLAG_RD, &sc->stat_Dot3StatsLateCollisions, in bce_add_sysctls()
9220 CTLFLAG_RD, &sc->stat_EtherStatsCollisions, in bce_add_sysctls()
9225 CTLFLAG_RD, &sc->stat_EtherStatsFragments, in bce_add_sysctls()
9230 CTLFLAG_RD, &sc->stat_EtherStatsJabbers, in bce_add_sysctls()
9235 CTLFLAG_RD, &sc->stat_EtherStatsUndersizePkts, in bce_add_sysctls()
9240 CTLFLAG_RD, &sc->stat_EtherStatsOversizePkts, in bce_add_sysctls()
9245 CTLFLAG_RD, &sc->stat_EtherStatsPktsRx64Octets, in bce_add_sysctls()
9250 CTLFLAG_RD, &sc->stat_EtherStatsPktsRx65Octetsto127Octets, in bce_add_sysctls()
9255 CTLFLAG_RD, &sc->stat_EtherStatsPktsRx128Octetsto255Octets, in bce_add_sysctls()
9260 CTLFLAG_RD, &sc->stat_EtherStatsPktsRx256Octetsto511Octets, in bce_add_sysctls()
9265 CTLFLAG_RD, &sc->stat_EtherStatsPktsRx512Octetsto1023Octets, in bce_add_sysctls()
9270 CTLFLAG_RD, &sc->stat_EtherStatsPktsRx1024Octetsto1522Octets, in bce_add_sysctls()
9275 CTLFLAG_RD, &sc->stat_EtherStatsPktsRx1523Octetsto9022Octets, in bce_add_sysctls()
9280 CTLFLAG_RD, &sc->stat_EtherStatsPktsTx64Octets, in bce_add_sysctls()
9285 CTLFLAG_RD, &sc->stat_EtherStatsPktsTx65Octetsto127Octets, in bce_add_sysctls()
9290 CTLFLAG_RD, &sc->stat_EtherStatsPktsTx128Octetsto255Octets, in bce_add_sysctls()
9295 CTLFLAG_RD, &sc->stat_EtherStatsPktsTx256Octetsto511Octets, in bce_add_sysctls()
9300 CTLFLAG_RD, &sc->stat_EtherStatsPktsTx512Octetsto1023Octets, in bce_add_sysctls()
9305 CTLFLAG_RD, &sc->stat_EtherStatsPktsTx1024Octetsto1522Octets, in bce_add_sysctls()
9310 CTLFLAG_RD, &sc->stat_EtherStatsPktsTx1523Octetsto9022Octets, in bce_add_sysctls()
9315 CTLFLAG_RD, &sc->stat_XonPauseFramesReceived, in bce_add_sysctls()
9320 CTLFLAG_RD, &sc->stat_XoffPauseFramesReceived, in bce_add_sysctls()
9325 CTLFLAG_RD, &sc->stat_OutXonSent, in bce_add_sysctls()
9330 CTLFLAG_RD, &sc->stat_OutXoffSent, in bce_add_sysctls()
9335 CTLFLAG_RD, &sc->stat_FlowControlDone, in bce_add_sysctls()
9340 CTLFLAG_RD, &sc->stat_MacControlFramesReceived, in bce_add_sysctls()
9345 CTLFLAG_RD, &sc->stat_XoffStateEntered, in bce_add_sysctls()
9350 CTLFLAG_RD, &sc->stat_IfInFramesL2FilterDiscards, in bce_add_sysctls()
9355 CTLFLAG_RD, &sc->stat_IfInRuleCheckerDiscards, in bce_add_sysctls()
9360 CTLFLAG_RD, &sc->stat_IfInFTQDiscards, in bce_add_sysctls()
9365 CTLFLAG_RD, &sc->stat_IfInMBUFDiscards, in bce_add_sysctls()
9367 "of controller buffer memory"); in bce_add_sysctls()
9371 CTLFLAG_RD, &sc->stat_IfInRuleCheckerP4Hit, in bce_add_sysctls()
9376 CTLFLAG_RD, &sc->stat_CatchupInRuleCheckerDiscards, in bce_add_sysctls()
9381 CTLFLAG_RD, &sc->stat_CatchupInFTQDiscards, in bce_add_sysctls()
9386 CTLFLAG_RD, &sc->stat_CatchupInMBUFDiscards, in bce_add_sysctls()
9387 0, "Received packets discarded in controller " in bce_add_sysctls()
9392 CTLFLAG_RD, &sc->stat_CatchupInRuleCheckerP4Hit, in bce_add_sysctls()
9397 CTLFLAG_RD, &sc->com_no_buffers, in bce_add_sysctls()
9495 /* Freezes the controller to allow for a cohesive state dump. */
9510 /* Unfreezes the controller after a freeze operation. This may not always */
9511 /* work and the controller will require a reset! */
9545 "-----------------------------" in bce_dump_enet()
9547 "-----------------------------\n"); in bce_dump_enet()
9552 if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) { in bce_dump_enet()
9553 etype = ntohs(eh->evl_proto); in bce_dump_enet()
9556 etype = ntohs(eh->evl_encap_proto); in bce_dump_enet()
9562 eh->evl_dhost, ":", eh->evl_shost, ":", etype, ehlen); in bce_dump_enet()
9566 ip = (struct ip *)(m->m_data + ehlen); in bce_dump_enet()
9567 BCE_PRINTF("--ip: dest = 0x%08X , src = 0x%08X, " in bce_dump_enet()
9569 ntohl(ip->ip_dst.s_addr), ntohl(ip->ip_src.s_addr), in bce_dump_enet()
9570 ntohs(ip->ip_len), ip->ip_p, ntohs(ip->ip_sum)); in bce_dump_enet()
9572 switch (ip->ip_p) { in bce_dump_enet()
9574 th = (struct tcphdr *)((caddr_t)ip + (ip->ip_hl << 2)); in bce_dump_enet()
9575 BCE_PRINTF("-tcp: dest = %d, src = %d, hlen = " in bce_dump_enet()
9577 ntohs(th->th_dport), ntohs(th->th_sport), in bce_dump_enet()
9578 (th->th_off << 2), th->th_flags, in bce_dump_enet()
9580 "\02SYN\01FIN", ntohs(th->th_sum)); in bce_dump_enet()
9583 uh = (struct udphdr *)((caddr_t)ip + (ip->ip_hl << 2)); in bce_dump_enet()
9584 BCE_PRINTF("-udp: dest = %d, src = %d, len = %d " in bce_dump_enet()
9585 "bytes, csum = 0x%04X\n", ntohs(uh->uh_dport), in bce_dump_enet()
9586 ntohs(uh->uh_sport), ntohs(uh->uh_ulen), in bce_dump_enet()
9587 ntohs(uh->uh_sum)); in bce_dump_enet()
9593 BCE_PRINTF("----: Other IP protocol.\n"); in bce_dump_enet()
9600 BCE_PRINTF("-arp: "); in bce_dump_enet()
9601 ah = (struct arphdr *) (m->m_data + ehlen); in bce_dump_enet()
9602 switch (ntohs(ah->ar_op)) { in bce_dump_enet()
9620 BCE_PRINTF("----: Other protocol.\n"); in bce_dump_enet()
9624 "-----------------------------" in bce_dump_enet()
9625 "--------------" in bce_dump_enet()
9626 "-----------------------------\n"); in bce_dump_enet()
9647 "m_data = %p\n", mp, mp->m_len, mp->m_flags, in bce_dump_mbuf()
9648 "\20\1M_EXT\2M_PKTHDR\3M_EOR\4M_RDONLY", mp->m_data); in bce_dump_mbuf()
9650 if (mp->m_flags & M_PKTHDR) { in bce_dump_mbuf()
9651 BCE_PRINTF("- m_pkthdr: len = %d, flags = 0x%b, " in bce_dump_mbuf()
9652 "csum_flags = %b\n", mp->m_pkthdr.len, in bce_dump_mbuf()
9653 mp->m_flags, M_FLAG_PRINTF, in bce_dump_mbuf()
9654 mp->m_pkthdr.csum_flags, CSUM_BITS); in bce_dump_mbuf()
9657 if (mp->m_flags & M_EXT) { in bce_dump_mbuf()
9658 BCE_PRINTF("- m_ext: %p, ext_size = %d, type = ", in bce_dump_mbuf()
9659 mp->m_ext.ext_buf, mp->m_ext.ext_size); in bce_dump_mbuf()
9660 switch (mp->m_ext.ext_type) { in bce_dump_mbuf()
9686 mp = mp->m_next; in bce_dump_mbuf()
9702 "----------------------------" in bce_dump_tx_mbuf_chain()
9704 "----------------------------\n"); in bce_dump_tx_mbuf_chain()
9707 m = sc->tx_mbuf_ptr[chain_prod]; in bce_dump_tx_mbuf_chain()
9714 "----------------------------" in bce_dump_tx_mbuf_chain()
9715 "----------------" in bce_dump_tx_mbuf_chain()
9716 "----------------------------\n"); in bce_dump_tx_mbuf_chain()
9731 "----------------------------" in bce_dump_rx_mbuf_chain()
9733 "----------------------------\n"); in bce_dump_rx_mbuf_chain()
9736 m = sc->rx_mbuf_ptr[chain_prod]; in bce_dump_rx_mbuf_chain()
9743 "----------------------------" in bce_dump_rx_mbuf_chain()
9744 "----------------" in bce_dump_rx_mbuf_chain()
9745 "----------------------------\n"); in bce_dump_rx_mbuf_chain()
9760 "----------------------------" in bce_dump_pg_mbuf_chain()
9762 "----------------------------\n"); in bce_dump_pg_mbuf_chain()
9765 m = sc->pg_mbuf_ptr[chain_prod]; in bce_dump_pg_mbuf_chain()
9772 "----------------------------" in bce_dump_pg_mbuf_chain()
9773 "----------------" in bce_dump_pg_mbuf_chain()
9774 "----------------------------\n"); in bce_dump_pg_mbuf_chain()
9794 "pointer\n", idx, txbd->tx_bd_haddr_hi, in bce_dump_txbd()
9795 txbd->tx_bd_haddr_lo); in bce_dump_txbd()
9800 "0x%04X (", idx, txbd->tx_bd_haddr_hi, in bce_dump_txbd()
9801 txbd->tx_bd_haddr_lo, txbd->tx_bd_mss_nbytes, in bce_dump_txbd()
9802 txbd->tx_bd_vlan_tag, txbd->tx_bd_flags); in bce_dump_txbd()
9804 if (txbd->tx_bd_flags & TX_BD_FLAGS_CONN_FAULT) { in bce_dump_txbd()
9811 if (txbd->tx_bd_flags & TX_BD_FLAGS_TCP_UDP_CKSUM) { in bce_dump_txbd()
9818 if (txbd->tx_bd_flags & TX_BD_FLAGS_IP_CKSUM) { in bce_dump_txbd()
9825 if (txbd->tx_bd_flags & TX_BD_FLAGS_VLAN_TAG) { in bce_dump_txbd()
9832 if (txbd->tx_bd_flags & TX_BD_FLAGS_COAL_NOW) { in bce_dump_txbd()
9839 if (txbd->tx_bd_flags & TX_BD_FLAGS_DONT_GEN_CRC) { in bce_dump_txbd()
9846 if (txbd->tx_bd_flags & TX_BD_FLAGS_START) { in bce_dump_txbd()
9853 if (txbd->tx_bd_flags & TX_BD_FLAGS_END) { in bce_dump_txbd()
9860 if (txbd->tx_bd_flags & TX_BD_FLAGS_SW_LSO) { in bce_dump_txbd()
9867 if (txbd->tx_bd_flags & TX_BD_FLAGS_SW_OPTION_WORD) { in bce_dump_txbd()
9870 printf("SW_OPTION=%d", ((txbd->tx_bd_flags & in bce_dump_txbd()
9874 if (txbd->tx_bd_flags & TX_BD_FLAGS_SW_FLAGS) { in bce_dump_txbd()
9881 if (txbd->tx_bd_flags & TX_BD_FLAGS_SW_SNAP) { in bce_dump_txbd()
9906 "pointer\n", idx, rxbd->rx_bd_haddr_hi, in bce_dump_rxbd()
9907 rxbd->rx_bd_haddr_lo); in bce_dump_rxbd()
9911 "0x%08X, flags = 0x%08X\n", idx, rxbd->rx_bd_haddr_hi, in bce_dump_rxbd()
9912 rxbd->rx_bd_haddr_lo, rxbd->rx_bd_len, in bce_dump_rxbd()
9913 rxbd->rx_bd_flags); in bce_dump_rxbd()
9931 idx, pgbd->rx_bd_haddr_hi, pgbd->rx_bd_haddr_lo); in bce_dump_pgbd()
9936 pgbd->rx_bd_haddr_hi, pgbd->rx_bd_haddr_lo, in bce_dump_pgbd()
9937 pgbd->rx_bd_len, pgbd->rx_bd_flags); in bce_dump_pgbd()
9952 l2fhdr->l2_fhdr_status, BCE_L2FHDR_PRINTFB, in bce_dump_l2fhdr()
9953 l2fhdr->l2_fhdr_pkt_len, l2fhdr->l2_fhdr_vlan_tag, in bce_dump_l2fhdr()
9954 l2fhdr->l2_fhdr_ip_xsum, l2fhdr->l2_fhdr_tcp_udp_xsum); in bce_dump_l2fhdr()
9972 "----------------------------" in bce_dump_ctx()
9974 "----------------------------\n"); in bce_dump_ctx()
9976 BCE_PRINTF(" 0x%04X - (CID) Context ID\n", cid); in bce_dump_ctx()
9979 BCE_PRINTF(" 0x%08X - (L2CTX_RX_HOST_BDIDX) host rx " in bce_dump_ctx()
9982 BCE_PRINTF(" 0x%08X - (L2CTX_RX_HOST_BSEQ) host " in bce_dump_ctx()
9985 BCE_PRINTF(" 0x%08X - (L2CTX_RX_NX_BSEQ) h/w byte sequence\n", in bce_dump_ctx()
9987 BCE_PRINTF(" 0x%08X - (L2CTX_RX_NX_BDHADDR_HI) h/w buffer " in bce_dump_ctx()
9990 BCE_PRINTF(" 0x%08X - (L2CTX_RX_NX_BDHADDR_LO) h/w buffer " in bce_dump_ctx()
9993 BCE_PRINTF(" 0x%08X - (L2CTX_RX_NX_BDIDX) h/w rx consumer " in bce_dump_ctx()
9996 BCE_PRINTF(" 0x%08X - (L2CTX_RX_HOST_PG_BDIDX) host page " in bce_dump_ctx()
9999 BCE_PRINTF(" 0x%08X - (L2CTX_RX_PG_BUF_SIZE) host rx_bd/page " in bce_dump_ctx()
10002 BCE_PRINTF(" 0x%08X - (L2CTX_RX_NX_PG_BDHADDR_HI) h/w page " in bce_dump_ctx()
10005 BCE_PRINTF(" 0x%08X - (L2CTX_RX_NX_PG_BDHADDR_LO) h/w page " in bce_dump_ctx()
10008 BCE_PRINTF(" 0x%08X - (L2CTX_RX_NX_PG_BDIDX) h/w page " in bce_dump_ctx()
10013 BCE_PRINTF(" 0x%08X - (L2CTX_TX_TYPE_XI) ctx type\n", in bce_dump_ctx()
10016 BCE_PRINTF(" 0x%08X - (L2CTX_CMD_TX_TYPE_XI) ctx " in bce_dump_ctx()
10019 BCE_PRINTF(" 0x%08X - (L2CTX_TX_TBDR_BDHADDR_HI_XI) " in bce_dump_ctx()
10023 BCE_PRINTF(" 0x%08X - (L2CTX_TX_TBDR_BHADDR_LO_XI) " in bce_dump_ctx()
10027 BCE_PRINTF(" 0x%08X - (L2CTX_TX_HOST_BIDX_XI) " in bce_dump_ctx()
10031 BCE_PRINTF(" 0x%08X - (L2CTX_TX_HOST_BSEQ_XI) " in bce_dump_ctx()
10036 BCE_PRINTF(" 0x%08X - (L2CTX_TX_TYPE) ctx type\n", in bce_dump_ctx()
10038 BCE_PRINTF(" 0x%08X - (L2CTX_TX_CMD_TYPE) ctx cmd\n", in bce_dump_ctx()
10041 BCE_PRINTF(" 0x%08X - (L2CTX_TX_TBDR_BDHADDR_HI) " in bce_dump_ctx()
10045 BCE_PRINTF(" 0x%08X - (L2CTX_TX_TBDR_BHADDR_LO) " in bce_dump_ctx()
10049 BCE_PRINTF(" 0x%08X - (L2CTX_TX_HOST_BIDX) host " in bce_dump_ctx()
10052 BCE_PRINTF(" 0x%08X - (L2CTX_TX_HOST_BSEQ) host byte " in bce_dump_ctx()
10059 "----------------------------" in bce_dump_ctx()
10061 "----------------------------\n"); in bce_dump_ctx()
10072 "----------------------------" in bce_dump_ctx()
10073 "----------------" in bce_dump_ctx()
10074 "----------------------------\n"); in bce_dump_ctx()
10089 "----------------------------" in bce_dump_ftqs()
10091 "----------------------------\n"); in bce_dump_ftqs()
10095 BCE_PRINTF(" ------- ---------- ---------- ---------- " in bce_dump_ftqs()
10096 "---------- ----------\n"); in bce_dump_ftqs()
10222 /* Input queue to the Transmit Patch-Up Processor */ in bce_dump_ftqs()
10317 "----------------------------" in bce_dump_ftqs()
10318 "----------------" in bce_dump_ftqs()
10319 "----------------------------\n"); in bce_dump_ftqs()
10335 "----------------------------" in bce_dump_tx_chain()
10337 "----------------------------\n"); in bce_dump_tx_chain()
10340 (u32) BCM_PAGE_SIZE, (u32) sc->tx_pages); in bce_dump_tx_chain()
10346 "----------------------------" in bce_dump_tx_chain()
10348 "----------------------------\n"); in bce_dump_tx_chain()
10352 txbd = &sc->tx_bd_chain[TX_PAGE(tx_prod)][TX_IDX(tx_prod)]; in bce_dump_tx_chain()
10358 "----------------------------" in bce_dump_tx_chain()
10359 "----------------" in bce_dump_tx_chain()
10360 "----------------------------\n"); in bce_dump_tx_chain()
10376 "----------------------------" in bce_dump_rx_bd_chain()
10378 "----------------------------\n"); in bce_dump_rx_bd_chain()
10381 (u32) BCM_PAGE_SIZE, (u32) sc->rx_pages); in bce_dump_rx_bd_chain()
10389 "----------------------------" in bce_dump_rx_bd_chain()
10391 "----------------------------\n"); in bce_dump_rx_bd_chain()
10395 rxbd = &sc->rx_bd_chain[RX_PAGE(rx_prod)][RX_IDX(rx_prod)]; in bce_dump_rx_bd_chain()
10401 "----------------------------" in bce_dump_rx_bd_chain()
10402 "----------------" in bce_dump_rx_bd_chain()
10403 "----------------------------\n"); in bce_dump_rx_bd_chain()
10419 "----------------------------" in bce_dump_pg_chain()
10421 "----------------------------\n"); in bce_dump_pg_chain()
10424 (u32) BCM_PAGE_SIZE, (u32) sc->pg_pages); in bce_dump_pg_chain()
10432 "----------------------------" in bce_dump_pg_chain()
10434 "----------------------------\n"); in bce_dump_pg_chain()
10438 pgbd = &sc->pg_bd_chain[PG_PAGE(pg_prod)][PG_IDX(pg_prod)]; in bce_dump_pg_chain()
10444 "----------------------------" in bce_dump_pg_chain()
10445 "----------------" in bce_dump_pg_chain()
10446 "----------------------------\n"); in bce_dump_pg_chain()
10450 if (sblk->status_rx_quick_consumer_index##arg) \
10451 BCE_PRINTF("0x%04X(0x%04X) - rx_quick_consumer_index%d\n", \
10452 sblk->status_rx_quick_consumer_index##arg, (u16) \
10453 RX_CHAIN_IDX(sblk->status_rx_quick_consumer_index##arg), \
10457 if (sblk->status_tx_quick_consumer_index##arg) \
10458 BCE_PRINTF("0x%04X(0x%04X) - tx_quick_consumer_index%d\n", \
10459 sblk->status_tx_quick_consumer_index##arg, (u16) \
10460 TX_CHAIN_IDX(sblk->status_tx_quick_consumer_index##arg), \
10474 bus_dmamap_sync(sc->status_tag, sc->status_map, BUS_DMASYNC_POSTREAD); in bce_dump_status_block()
10476 sblk = sc->status_block; in bce_dump_status_block()
10479 "----------------------------" in bce_dump_status_block()
10481 "----------------------------\n"); in bce_dump_status_block()
10484 BCE_PRINTF(" 0x%08X - attn_bits\n", in bce_dump_status_block()
10485 sblk->status_attn_bits); in bce_dump_status_block()
10487 BCE_PRINTF(" 0x%08X - attn_bits_ack\n", in bce_dump_status_block()
10488 sblk->status_attn_bits_ack); in bce_dump_status_block()
10493 BCE_PRINTF(" 0x%04X - status_idx\n", sblk->status_idx); in bce_dump_status_block()
10504 if (sblk->status_completion_producer_index || in bce_dump_status_block()
10505 sblk->status_cmd_consumer_index) in bce_dump_status_block()
10507 sblk->status_completion_producer_index, in bce_dump_status_block()
10508 sblk->status_cmd_consumer_index); in bce_dump_status_block()
10511 "----------------------------" in bce_dump_status_block()
10512 "----------------" in bce_dump_status_block()
10513 "----------------------------\n"); in bce_dump_status_block()
10517 if (sblk->arg##_lo || sblk->arg##_hi) \
10518 BCE_PRINTF("0x%08X:%08X : %s\n", sblk->arg##_hi, \
10519 sblk->arg##_lo, #arg);
10522 if (sblk->arg) \
10524 sblk->arg, #arg);
10537 bus_dmamap_sync(sc->stats_tag, sc->stats_map, BUS_DMASYNC_POSTREAD); in bce_dump_stats_block()
10539 sblk = sc->stats_block; in bce_dump_stats_block()
10542 "---------------" in bce_dump_stats_block()
10544 "---------------\n"); in bce_dump_stats_block()
10603 "----------------------------" in bce_dump_stats_block()
10604 "----------------" in bce_dump_stats_block()
10605 "----------------------------\n"); in bce_dump_stats_block()
10620 "-----------------------------" in bce_dump_driver_state()
10622 "-----------------------------\n"); in bce_dump_driver_state()
10626 BCE_PRINTF("0x%08X:%08X - (sc) driver softc structure virtual " in bce_dump_driver_state()
10629 val_hi = BCE_ADDR_HI(sc->bce_vhandle); in bce_dump_driver_state()
10630 val_lo = BCE_ADDR_LO(sc->bce_vhandle); in bce_dump_driver_state()
10631 BCE_PRINTF("0x%08X:%08X - (sc->bce_vhandle) PCI BAR virtual " in bce_dump_driver_state()
10634 val_hi = BCE_ADDR_HI(sc->status_block); in bce_dump_driver_state()
10635 val_lo = BCE_ADDR_LO(sc->status_block); in bce_dump_driver_state()
10636 BCE_PRINTF("0x%08X:%08X - (sc->status_block) status block " in bce_dump_driver_state()
10639 val_hi = BCE_ADDR_HI(sc->stats_block); in bce_dump_driver_state()
10640 val_lo = BCE_ADDR_LO(sc->stats_block); in bce_dump_driver_state()
10641 BCE_PRINTF("0x%08X:%08X - (sc->stats_block) statistics block " in bce_dump_driver_state()
10644 val_hi = BCE_ADDR_HI(sc->tx_bd_chain); in bce_dump_driver_state()
10645 val_lo = BCE_ADDR_LO(sc->tx_bd_chain); in bce_dump_driver_state()
10646 BCE_PRINTF("0x%08X:%08X - (sc->tx_bd_chain) tx_bd chain " in bce_dump_driver_state()
10649 val_hi = BCE_ADDR_HI(sc->rx_bd_chain); in bce_dump_driver_state()
10650 val_lo = BCE_ADDR_LO(sc->rx_bd_chain); in bce_dump_driver_state()
10651 BCE_PRINTF("0x%08X:%08X - (sc->rx_bd_chain) rx_bd chain " in bce_dump_driver_state()
10655 val_hi = BCE_ADDR_HI(sc->pg_bd_chain); in bce_dump_driver_state()
10656 val_lo = BCE_ADDR_LO(sc->pg_bd_chain); in bce_dump_driver_state()
10657 BCE_PRINTF("0x%08X:%08X - (sc->pg_bd_chain) page chain " in bce_dump_driver_state()
10661 val_hi = BCE_ADDR_HI(sc->tx_mbuf_ptr); in bce_dump_driver_state()
10662 val_lo = BCE_ADDR_LO(sc->tx_mbuf_ptr); in bce_dump_driver_state()
10663 BCE_PRINTF("0x%08X:%08X - (sc->tx_mbuf_ptr) tx mbuf chain " in bce_dump_driver_state()
10666 val_hi = BCE_ADDR_HI(sc->rx_mbuf_ptr); in bce_dump_driver_state()
10667 val_lo = BCE_ADDR_LO(sc->rx_mbuf_ptr); in bce_dump_driver_state()
10668 BCE_PRINTF("0x%08X:%08X - (sc->rx_mbuf_ptr) rx mbuf chain " in bce_dump_driver_state()
10672 val_hi = BCE_ADDR_HI(sc->pg_mbuf_ptr); in bce_dump_driver_state()
10673 val_lo = BCE_ADDR_LO(sc->pg_mbuf_ptr); in bce_dump_driver_state()
10674 BCE_PRINTF("0x%08X:%08X - (sc->pg_mbuf_ptr) page mbuf chain " in bce_dump_driver_state()
10678 BCE_PRINTF(" 0x%016llX - (sc->interrupts_generated) " in bce_dump_driver_state()
10680 (long long unsigned int) sc->interrupts_generated); in bce_dump_driver_state()
10682 BCE_PRINTF(" 0x%016llX - (sc->interrupts_rx) " in bce_dump_driver_state()
10684 (long long unsigned int) sc->interrupts_rx); in bce_dump_driver_state()
10686 BCE_PRINTF(" 0x%016llX - (sc->interrupts_tx) " in bce_dump_driver_state()
10688 (long long unsigned int) sc->interrupts_tx); in bce_dump_driver_state()
10690 BCE_PRINTF(" 0x%016llX - (sc->phy_interrupts) " in bce_dump_driver_state()
10692 (long long unsigned int) sc->phy_interrupts); in bce_dump_driver_state()
10694 BCE_PRINTF(" 0x%08X - (sc->last_status_idx) " in bce_dump_driver_state()
10695 "status block index\n", sc->last_status_idx); in bce_dump_driver_state()
10697 BCE_PRINTF(" 0x%04X(0x%04X) - (sc->tx_prod) tx producer " in bce_dump_driver_state()
10698 "index\n", sc->tx_prod, (u16) TX_CHAIN_IDX(sc->tx_prod)); in bce_dump_driver_state()
10700 BCE_PRINTF(" 0x%04X(0x%04X) - (sc->tx_cons) tx consumer " in bce_dump_driver_state()
10701 "index\n", sc->tx_cons, (u16) TX_CHAIN_IDX(sc->tx_cons)); in bce_dump_driver_state()
10703 BCE_PRINTF(" 0x%08X - (sc->tx_prod_bseq) tx producer " in bce_dump_driver_state()
10704 "byte seq index\n", sc->tx_prod_bseq); in bce_dump_driver_state()
10706 BCE_PRINTF(" 0x%08X - (sc->debug_tx_mbuf_alloc) tx " in bce_dump_driver_state()
10707 "mbufs allocated\n", sc->debug_tx_mbuf_alloc); in bce_dump_driver_state()
10709 BCE_PRINTF(" 0x%08X - (sc->used_tx_bd) used " in bce_dump_driver_state()
10710 "tx_bd's\n", sc->used_tx_bd); in bce_dump_driver_state()
10712 BCE_PRINTF(" 0x%04X/0x%04X - (sc->tx_hi_watermark)/" in bce_dump_driver_state()
10713 "(sc->max_tx_bd)\n", sc->tx_hi_watermark, sc->max_tx_bd); in bce_dump_driver_state()
10715 BCE_PRINTF(" 0x%04X(0x%04X) - (sc->rx_prod) rx producer " in bce_dump_driver_state()
10716 "index\n", sc->rx_prod, (u16) RX_CHAIN_IDX(sc->rx_prod)); in bce_dump_driver_state()
10718 BCE_PRINTF(" 0x%04X(0x%04X) - (sc->rx_cons) rx consumer " in bce_dump_driver_state()
10719 "index\n", sc->rx_cons, (u16) RX_CHAIN_IDX(sc->rx_cons)); in bce_dump_driver_state()
10721 BCE_PRINTF(" 0x%08X - (sc->rx_prod_bseq) rx producer " in bce_dump_driver_state()
10722 "byte seq index\n", sc->rx_prod_bseq); in bce_dump_driver_state()
10724 BCE_PRINTF(" 0x%04X/0x%04X - (sc->rx_low_watermark)/" in bce_dump_driver_state()
10725 "(sc->max_rx_bd)\n", sc->rx_low_watermark, sc->max_rx_bd); in bce_dump_driver_state()
10727 BCE_PRINTF(" 0x%08X - (sc->debug_rx_mbuf_alloc) rx " in bce_dump_driver_state()
10728 "mbufs allocated\n", sc->debug_rx_mbuf_alloc); in bce_dump_driver_state()
10730 BCE_PRINTF(" 0x%08X - (sc->free_rx_bd) free " in bce_dump_driver_state()
10731 "rx_bd's\n", sc->free_rx_bd); in bce_dump_driver_state()
10734 BCE_PRINTF(" 0x%04X(0x%04X) - (sc->pg_prod) page producer " in bce_dump_driver_state()
10735 "index\n", sc->pg_prod, (u16) PG_CHAIN_IDX(sc->pg_prod)); in bce_dump_driver_state()
10737 BCE_PRINTF(" 0x%04X(0x%04X) - (sc->pg_cons) page consumer " in bce_dump_driver_state()
10738 "index\n", sc->pg_cons, (u16) PG_CHAIN_IDX(sc->pg_cons)); in bce_dump_driver_state()
10740 BCE_PRINTF(" 0x%08X - (sc->debug_pg_mbuf_alloc) page " in bce_dump_driver_state()
10741 "mbufs allocated\n", sc->debug_pg_mbuf_alloc); in bce_dump_driver_state()
10744 BCE_PRINTF(" 0x%08X - (sc->free_pg_bd) free page " in bce_dump_driver_state()
10745 "rx_bd's\n", sc->free_pg_bd); in bce_dump_driver_state()
10747 BCE_PRINTF(" 0x%04X/0x%04X - (sc->pg_low_watermark)/" in bce_dump_driver_state()
10748 "(sc->max_pg_bd)\n", sc->pg_low_watermark, sc->max_pg_bd); in bce_dump_driver_state()
10750 BCE_PRINTF(" 0x%08X - (sc->mbuf_alloc_failed_count) " in bce_dump_driver_state()
10751 "mbuf alloc failures\n", sc->mbuf_alloc_failed_count); in bce_dump_driver_state()
10753 BCE_PRINTF(" 0x%08X - (sc->bce_flags) " in bce_dump_driver_state()
10754 "bce mac flags\n", sc->bce_flags); in bce_dump_driver_state()
10756 BCE_PRINTF(" 0x%08X - (sc->bce_phy_flags) " in bce_dump_driver_state()
10757 "bce phy flags\n", sc->bce_phy_flags); in bce_dump_driver_state()
10760 "----------------------------" in bce_dump_driver_state()
10761 "----------------" in bce_dump_driver_state()
10762 "----------------------------\n"); in bce_dump_driver_state()
10778 "----------------------------" in bce_dump_hw_state()
10780 "----------------------------\n"); in bce_dump_hw_state()
10782 BCE_PRINTF("%s - bootcode version\n", sc->bce_bc_ver); in bce_dump_hw_state()
10785 BCE_PRINTF("0x%08X - (0x%06X) misc_enable_status_bits\n", in bce_dump_hw_state()
10789 BCE_PRINTF("0x%08X - (0x%06X) dma_status\n", in bce_dump_hw_state()
10793 BCE_PRINTF("0x%08X - (0x%06X) ctx_status\n", in bce_dump_hw_state()
10797 BCE_PRINTF("0x%08X - (0x%06X) emac_status\n", in bce_dump_hw_state()
10801 BCE_PRINTF("0x%08X - (0x%06X) rpm_status\n", in bce_dump_hw_state()
10806 BCE_PRINTF("0x%08X - (0x%06X) rlup_status\n", in bce_dump_hw_state()
10810 BCE_PRINTF("0x%08X - (0x%06X) rv2p_status\n", in bce_dump_hw_state()
10815 BCE_PRINTF("0x%08X - (0x%06X) rdma_status\n", in bce_dump_hw_state()
10819 BCE_PRINTF("0x%08X - (0x%06X) tbdr_status\n", in bce_dump_hw_state()
10823 BCE_PRINTF("0x%08X - (0x%06X) tdma_status\n", in bce_dump_hw_state()
10827 BCE_PRINTF("0x%08X - (0x%06X) hc_status\n", in bce_dump_hw_state()
10831 BCE_PRINTF("0x%08X - (0x%06X) txp_cpu_state\n", in bce_dump_hw_state()
10835 BCE_PRINTF("0x%08X - (0x%06X) tpat_cpu_state\n", in bce_dump_hw_state()
10839 BCE_PRINTF("0x%08X - (0x%06X) rxp_cpu_state\n", in bce_dump_hw_state()
10843 BCE_PRINTF("0x%08X - (0x%06X) com_cpu_state\n", in bce_dump_hw_state()
10847 BCE_PRINTF("0x%08X - (0x%06X) mcp_cpu_state\n", in bce_dump_hw_state()
10851 BCE_PRINTF("0x%08X - (0x%06X) cp_cpu_state\n", in bce_dump_hw_state()
10855 "----------------------------" in bce_dump_hw_state()
10856 "----------------" in bce_dump_hw_state()
10857 "----------------------------\n"); in bce_dump_hw_state()
10860 "----------------------------" in bce_dump_hw_state()
10862 "----------------------------\n"); in bce_dump_hw_state()
10871 "----------------------------" in bce_dump_hw_state()
10872 "----------------" in bce_dump_hw_state()
10873 "----------------------------\n"); in bce_dump_hw_state()
10887 "----------------------------" in bce_dump_shmem_state()
10889 "----------------------------\n"); in bce_dump_shmem_state()
10891 BCE_PRINTF("0x%08X - Shared memory base address\n", in bce_dump_shmem_state()
10892 sc->bce_shmem_base); in bce_dump_shmem_state()
10893 BCE_PRINTF("%s - bootcode version\n", in bce_dump_shmem_state()
10894 sc->bce_bc_ver); in bce_dump_shmem_state()
10897 "----------------------------" in bce_dump_shmem_state()
10899 "----------------------------\n"); in bce_dump_shmem_state()
10908 "----------------------------" in bce_dump_shmem_state()
10909 "----------------" in bce_dump_shmem_state()
10910 "----------------------------\n"); in bce_dump_shmem_state()
10923 "----------------------------" in bce_dump_mq_regs()
10925 "----------------------------\n"); in bce_dump_mq_regs()
10928 "----------------------------" in bce_dump_mq_regs()
10929 "----------------" in bce_dump_mq_regs()
10930 "----------------------------\n"); in bce_dump_mq_regs()
10939 "----------------------------" in bce_dump_mq_regs()
10940 "----------------" in bce_dump_mq_regs()
10941 "----------------------------\n"); in bce_dump_mq_regs()
10956 "----------------------------" in bce_dump_bc_state()
10958 "----------------------------\n"); in bce_dump_bc_state()
10960 BCE_PRINTF("%s - bootcode version\n", sc->bce_bc_ver); in bce_dump_bc_state()
10963 BCE_PRINTF("0x%08X - (0x%06X) reset_type\n", in bce_dump_bc_state()
10967 BCE_PRINTF("0x%08X - (0x%06X) state\n", in bce_dump_bc_state()
10971 BCE_PRINTF("0x%08X - (0x%06X) condition\n", in bce_dump_bc_state()
10975 BCE_PRINTF("0x%08X - (0x%06X) debug_cmd\n", in bce_dump_bc_state()
10979 "----------------------------" in bce_dump_bc_state()
10980 "----------------" in bce_dump_bc_state()
10981 "----------------------------\n"); in bce_dump_bc_state()
10997 "----------------------------" in bce_dump_txp_state()
10999 "----------------------------\n"); in bce_dump_txp_state()
11004 BCE_PRINTF("Firmware version - %s\n", (char *) fw_version); in bce_dump_txp_state()
11007 BCE_PRINTF("0x%08X - (0x%06X) txp_cpu_mode\n", in bce_dump_txp_state()
11011 BCE_PRINTF("0x%08X - (0x%06X) txp_cpu_state\n", in bce_dump_txp_state()
11015 BCE_PRINTF("0x%08X - (0x%06X) txp_cpu_event_mask\n", in bce_dump_txp_state()
11020 "----------------------------" in bce_dump_txp_state()
11022 "----------------------------\n"); in bce_dump_txp_state()
11037 "----------------------------" in bce_dump_txp_state()
11038 "----------------" in bce_dump_txp_state()
11039 "----------------------------\n"); in bce_dump_txp_state()
11055 "----------------------------" in bce_dump_rxp_state()
11057 "----------------------------\n"); in bce_dump_rxp_state()
11063 BCE_PRINTF("Firmware version - %s\n", (char *) fw_version); in bce_dump_rxp_state()
11066 BCE_PRINTF("0x%08X - (0x%06X) rxp_cpu_mode\n", in bce_dump_rxp_state()
11070 BCE_PRINTF("0x%08X - (0x%06X) rxp_cpu_state\n", in bce_dump_rxp_state()
11074 BCE_PRINTF("0x%08X - (0x%06X) rxp_cpu_event_mask\n", in bce_dump_rxp_state()
11079 "----------------------------" in bce_dump_rxp_state()
11081 "----------------------------\n"); in bce_dump_rxp_state()
11096 "----------------------------" in bce_dump_rxp_state()
11097 "----------------" in bce_dump_rxp_state()
11098 "----------------------------\n"); in bce_dump_rxp_state()
11114 "----------------------------" in bce_dump_tpat_state()
11116 "----------------------------\n"); in bce_dump_tpat_state()
11122 BCE_PRINTF("Firmware version - %s\n", (char *) fw_version); in bce_dump_tpat_state()
11125 BCE_PRINTF("0x%08X - (0x%06X) tpat_cpu_mode\n", in bce_dump_tpat_state()
11129 BCE_PRINTF("0x%08X - (0x%06X) tpat_cpu_state\n", in bce_dump_tpat_state()
11133 BCE_PRINTF("0x%08X - (0x%06X) tpat_cpu_event_mask\n", in bce_dump_tpat_state()
11138 "----------------------------" in bce_dump_tpat_state()
11140 "----------------------------\n"); in bce_dump_tpat_state()
11155 "----------------------------" in bce_dump_tpat_state()
11156 "----------------" in bce_dump_tpat_state()
11157 "----------------------------\n"); in bce_dump_tpat_state()
11173 "----------------------------" in bce_dump_cp_state()
11175 "----------------------------\n"); in bce_dump_cp_state()
11181 BCE_PRINTF("Firmware version - %s\n", (char *) fw_version); in bce_dump_cp_state()
11184 BCE_PRINTF("0x%08X - (0x%06X) cp_cpu_mode\n", in bce_dump_cp_state()
11188 BCE_PRINTF("0x%08X - (0x%06X) cp_cpu_state\n", in bce_dump_cp_state()
11192 BCE_PRINTF("0x%08X - (0x%06X) cp_cpu_event_mask\n", val, in bce_dump_cp_state()
11197 "----------------------------" in bce_dump_cp_state()
11199 "----------------------------\n"); in bce_dump_cp_state()
11214 "----------------------------" in bce_dump_cp_state()
11215 "----------------" in bce_dump_cp_state()
11216 "----------------------------\n"); in bce_dump_cp_state()
11232 "----------------------------" in bce_dump_com_state()
11234 "----------------------------\n"); in bce_dump_com_state()
11240 BCE_PRINTF("Firmware version - %s\n", (char *) fw_version); in bce_dump_com_state()
11243 BCE_PRINTF("0x%08X - (0x%06X) com_cpu_mode\n", in bce_dump_com_state()
11247 BCE_PRINTF("0x%08X - (0x%06X) com_cpu_state\n", in bce_dump_com_state()
11251 BCE_PRINTF("0x%08X - (0x%06X) com_cpu_event_mask\n", val, in bce_dump_com_state()
11256 "----------------------------" in bce_dump_com_state()
11258 "----------------------------\n"); in bce_dump_com_state()
11271 "----------------------------" in bce_dump_com_state()
11272 "----------------" in bce_dump_com_state()
11273 "----------------------------\n"); in bce_dump_com_state()
11288 "----------------------------" in bce_dump_rv2p_state()
11290 "----------------------------\n"); in bce_dump_rv2p_state()
11303 BCE_PRINTF("RV2P1 Firmware version - 0x%08X:0x%08X\n", in bce_dump_rv2p_state()
11311 BCE_PRINTF("RV2P2 Firmware version - 0x%08X:0x%08X\n", in bce_dump_rv2p_state()
11325 BCE_PRINTF("0x%08X - RV2P1 program counter (1st read)\n", pc1); in bce_dump_rv2p_state()
11326 BCE_PRINTF("0x%08X - RV2P2 program counter (1st read)\n", pc2); in bce_dump_rv2p_state()
11334 BCE_PRINTF("0x%08X - RV2P1 program counter (2nd read)\n", pc1); in bce_dump_rv2p_state()
11335 BCE_PRINTF("0x%08X - RV2P2 program counter (2nd read)\n", pc2); in bce_dump_rv2p_state()
11338 "----------------------------" in bce_dump_rv2p_state()
11339 "----------------" in bce_dump_rv2p_state()
11340 "----------------------------\n"); in bce_dump_rv2p_state()