Lines Matching +full:0 +full:x00000000 +full:- +full:0 +full:x03ffffff

1 // SPDX-License-Identifier: GPL-2.0-only
4 * Copyright 2005-2006 Fen Systems Ltd.
5 * Copyright 2006-2013 Solarflare Communications Inc.
37 struct efx_nic *efx = channel->efx; in siena_push_irq_moderation()
40 if (channel->irq_moderation_us) { in siena_push_irq_moderation()
43 ticks = efx_siena_usecs_to_ticks(efx, channel->irq_moderation_us); in siena_push_irq_moderation()
48 ticks - 1); in siena_push_irq_moderation()
53 FRF_CZ_TC_TIMER_VAL, 0); in siena_push_irq_moderation()
55 efx_writed_page_locked(channel->efx, &timer_cmd, FR_BZ_TIMER_COMMAND_P0, in siena_push_irq_moderation()
56 channel->channel); in siena_push_irq_moderation()
61 if (efx->fc_disable++ == 0) in efx_siena_prepare_flush()
67 if (--efx->fc_disable == 0) in siena_finish_flush()
73 EFX_OWORD32(0x0003FFFF, 0x0003FFFF, 0x0003FFFF, 0x0003FFFF) },
75 EFX_OWORD32(0x000103FF, 0x00000000, 0x00000000, 0x00000000) },
77 EFX_OWORD32(0xFFFFFFFE, 0xFFFFFFFF, 0x0003FFFF, 0x00000000) },
79 EFX_OWORD32(0x7FFF0037, 0xFFFF8000, 0xFFFFFFFF, 0x03FFFFFF) },
81 EFX_OWORD32(0xFFFEFE80, 0x1FFFFFFF, 0x020000FE, 0x007FFFFF) },
83 EFX_OWORD32(0x001FFFFF, 0x00000000, 0x00000000, 0x00000000) },
85 EFX_OWORD32(0x00000003, 0x00000000, 0x00000000, 0x00000000) },
87 EFX_OWORD32(0x000003FF, 0x00000000, 0x00000000, 0x00000000) },
89 EFX_OWORD32(0x00000FFF, 0x00000000, 0x00000000, 0x00000000) },
91 EFX_OWORD32(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF) },
93 EFX_OWORD32(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF) },
95 EFX_OWORD32(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF) },
97 EFX_OWORD32(0xFFFFFFFF, 0xFFFFFFFF, 0x00000007, 0x00000000) },
114 tests->registers = in siena_test_chip()
117 ? -1 : 1; in siena_test_chip()
121 rc2 = efx_siena_reset_up(efx, reset_method, rc == 0); in siena_test_chip()
143 switch (init->rx_filter) { in siena_ptp_set_ts_config()
147 init->tx_type != HWTSTAMP_TX_OFF, in siena_ptp_set_ts_config()
152 init->rx_filter = HWTSTAMP_FILTER_PTP_V1_L4_EVENT; in siena_ptp_set_ts_config()
157 init->rx_filter = HWTSTAMP_FILTER_PTP_V2_L4_EVENT; in siena_ptp_set_ts_config()
160 /* bug 33070 - old versions of the firmware do not support the in siena_ptp_set_ts_config()
165 if (rc != 0) in siena_ptp_set_ts_config()
170 return -ERANGE; in siena_ptp_set_ts_config()
203 return -EINVAL; in siena_map_reset_flags()
215 struct eeh_dev *eehdev = pci_dev_to_eeh_dev(efx->pci_dev); in siena_monitor()
223 u32 caps = 0; in siena_probe_nvconfig()
226 rc = efx_siena_mcdi_get_board_cfg(efx, efx->net_dev->perm_addr, NULL, in siena_probe_nvconfig()
229 efx->timer_quantum_ns = in siena_probe_nvconfig()
232 efx->timer_max_ns = efx->type->timer_period_max * in siena_probe_nvconfig()
233 efx->timer_quantum_ns; in siena_probe_nvconfig()
245 return 0; in siena_dimension_resources()
248 /* On all Falcon-architecture NICs, PFs use BAR 0 for I/O space and BAR 2(&3)
271 return -ENOMEM; in siena_probe_nic()
272 nic_data->efx = efx; in siena_probe_nic()
273 efx->nic_data = nic_data; in siena_probe_nic()
275 if (efx_farch_fpga_ver(efx) != 0) { in siena_probe_nic()
276 netif_err(efx, probe, efx->net_dev, in siena_probe_nic()
278 rc = -ENODEV; in siena_probe_nic()
282 efx->max_channels = EFX_MAX_CHANNELS; in siena_probe_nic()
283 efx->max_vis = EFX_MAX_CHANNELS; in siena_probe_nic()
284 efx->max_tx_channels = EFX_MAX_CHANNELS; in siena_probe_nic()
285 efx->tx_queues_per_channel = 4; in siena_probe_nic()
288 efx->port_num = EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1; in siena_probe_nic()
297 netif_err(efx, probe, efx->net_dev, "failed to reset NIC\n"); in siena_probe_nic()
304 rc = efx_siena_alloc_buffer(efx, &efx->irq_status, sizeof(efx_oword_t), in siena_probe_nic()
308 BUG_ON(efx->irq_status.dma_addr & 0x0f); in siena_probe_nic()
310 netif_dbg(efx, probe, efx->net_dev, in siena_probe_nic()
312 (unsigned long long)efx->irq_status.dma_addr, in siena_probe_nic()
313 efx->irq_status.addr, in siena_probe_nic()
314 (unsigned long long)virt_to_phys(efx->irq_status.addr)); in siena_probe_nic()
316 /* Read in the non-volatile configuration */ in siena_probe_nic()
318 if (rc == -EINVAL) { in siena_probe_nic()
319 netif_err(efx, probe, efx->net_dev, in siena_probe_nic()
321 efx->phy_type = PHY_TYPE_NONE; in siena_probe_nic()
322 efx->mdio.prtad = MDIO_PRTAD_NONE; in siena_probe_nic()
336 return 0; in siena_probe_nic()
339 efx_siena_free_buffer(efx, &efx->irq_status); in siena_probe_nic()
345 kfree(efx->nic_data); in siena_probe_nic()
358 memcpy(efx->rss_context.rx_hash_key, &temp, sizeof(temp)); in siena_rx_pull_rss_config()
360 memcpy(efx->rss_context.rx_hash_key + sizeof(temp), &temp, sizeof(temp)); in siena_rx_pull_rss_config()
362 memcpy(efx->rss_context.rx_hash_key + 2 * sizeof(temp), &temp, in siena_rx_pull_rss_config()
365 return 0; in siena_rx_pull_rss_config()
375 memcpy(efx->rss_context.rx_hash_key, key, sizeof(temp)); in siena_rx_push_rss_config()
376 memcpy(&temp, efx->rss_context.rx_hash_key, sizeof(temp)); in siena_rx_push_rss_config()
380 BUILD_BUG_ON(sizeof(efx->rss_context.rx_hash_key) < in siena_rx_push_rss_config()
382 FRF_CZ_RX_RSS_IPV6_TKEY_HI_LBN != 0); in siena_rx_push_rss_config()
383 memcpy(&temp, efx->rss_context.rx_hash_key, sizeof(temp)); in siena_rx_push_rss_config()
385 memcpy(&temp, efx->rss_context.rx_hash_key + sizeof(temp), sizeof(temp)); in siena_rx_push_rss_config()
389 memcpy(&temp, efx->rss_context.rx_hash_key + 2 * sizeof(temp), in siena_rx_push_rss_config()
393 memcpy(efx->rss_context.rx_indir_table, rx_indir_table, in siena_rx_push_rss_config()
394 sizeof(efx->rss_context.rx_indir_table)); in siena_rx_push_rss_config()
397 return 0; in siena_rx_push_rss_config()
400 /* This call performs hardware-specific global initialisation, such as
409 /* Recover from a failed assertion post-reset */ in siena_init_nic()
423 EFX_SET_OWORD_FIELD(temp, FRF_AZ_TX_NO_EOP_DISC_EN, 0); in siena_init_nic()
428 EFX_SET_OWORD_FIELD(temp, FRF_BZ_RX_DESC_PUSH_EN, 0); in siena_init_nic()
440 siena_rx_push_rss_config(efx, false, efx->rss_context.rx_indir_table, NULL); in siena_init_nic()
441 efx->rss_context.context_id = 0; /* indicates RSS is active */ in siena_init_nic()
444 rc = efx_siena_mcdi_log_ctrl(efx, true, false, 0); in siena_init_nic()
449 EFX_POPULATE_OWORD_1(temp, FRF_BZ_FLS_EVQ_ID, 0); in siena_init_nic()
456 return 0; in siena_init_nic()
463 efx_siena_free_buffer(efx, &efx->irq_status); in siena_remove_nic()
471 kfree(efx->nic_data); in siena_remove_nic()
472 efx->nic_data = NULL; in siena_remove_nic()
479 [SIENA_STAT_ ## ext_name] = { #ext_name, 0, 0 }
481 [GENERIC_STAT_ ## ext_name] = { #ext_name, 0, 0 }
545 [0 ... BITS_TO_LONGS(SIENA_STAT_COUNT) - 1] = ~0UL,
556 struct siena_nic_data *nic_data = efx->nic_data; in siena_try_update_nic_stats()
557 u64 *stats = nic_data->stats; in siena_try_update_nic_stats()
561 dma_stats = efx->stats_buffer.addr; in siena_try_update_nic_stats()
563 generation_end = dma_stats[efx->num_mac_stats - 1]; in siena_try_update_nic_stats()
565 return 0; in siena_try_update_nic_stats()
568 stats, efx->stats_buffer.addr, false); in siena_try_update_nic_stats()
572 return -EAGAIN; in siena_try_update_nic_stats()
578 stats[SIENA_STAT_tx_bytes] - in siena_try_update_nic_stats()
586 stats[SIENA_STAT_rx_bytes] - in siena_try_update_nic_stats()
589 return 0; in siena_try_update_nic_stats()
595 struct siena_nic_data *nic_data = efx->nic_data; in siena_update_nic_stats()
596 u64 *stats = nic_data->stats; in siena_update_nic_stats()
601 for (retry = 0; retry < 100; ++retry) { in siena_update_nic_stats()
602 if (siena_try_update_nic_stats(efx) == 0) in siena_update_nic_stats()
611 core_stats->rx_packets = stats[SIENA_STAT_rx_packets]; in siena_update_nic_stats()
612 core_stats->tx_packets = stats[SIENA_STAT_tx_packets]; in siena_update_nic_stats()
613 core_stats->rx_bytes = stats[SIENA_STAT_rx_bytes]; in siena_update_nic_stats()
614 core_stats->tx_bytes = stats[SIENA_STAT_tx_bytes]; in siena_update_nic_stats()
615 core_stats->rx_dropped = stats[SIENA_STAT_rx_nodesc_drop_cnt] + in siena_update_nic_stats()
618 core_stats->multicast = stats[SIENA_STAT_rx_multicast]; in siena_update_nic_stats()
619 core_stats->collisions = stats[SIENA_STAT_tx_collision]; in siena_update_nic_stats()
620 core_stats->rx_length_errors = in siena_update_nic_stats()
623 core_stats->rx_crc_errors = stats[SIENA_STAT_rx_bad]; in siena_update_nic_stats()
624 core_stats->rx_frame_errors = stats[SIENA_STAT_rx_align_error]; in siena_update_nic_stats()
625 core_stats->rx_fifo_errors = stats[SIENA_STAT_rx_overflow]; in siena_update_nic_stats()
626 core_stats->tx_window_errors = in siena_update_nic_stats()
629 core_stats->rx_errors = (core_stats->rx_length_errors + in siena_update_nic_stats()
630 core_stats->rx_crc_errors + in siena_update_nic_stats()
631 core_stats->rx_frame_errors + in siena_update_nic_stats()
633 core_stats->tx_errors = (core_stats->tx_window_errors + in siena_update_nic_stats()
647 sizeof(efx->multicast_hash)); in siena_mac_reconfigure()
651 WARN_ON(!mutex_is_locked(&efx->mac_lock)); in siena_mac_reconfigure()
654 if (rc != 0) in siena_mac_reconfigure()
658 efx->multicast_hash.byte, sizeof(efx->multicast_hash)); in siena_mac_reconfigure()
660 inbuf, sizeof(inbuf), NULL, 0, NULL); in siena_mac_reconfigure()
672 struct siena_nic_data *nic_data = efx->nic_data; in siena_get_wol()
674 wol->supported = WAKE_MAGIC; in siena_get_wol()
675 if (nic_data->wol_filter_id != -1) in siena_get_wol()
676 wol->wolopts = WAKE_MAGIC; in siena_get_wol()
678 wol->wolopts = 0; in siena_get_wol()
679 memset(&wol->sopass, 0, sizeof(wol->sopass)); in siena_get_wol()
685 struct siena_nic_data *nic_data = efx->nic_data; in siena_set_wol()
689 return -EINVAL; in siena_set_wol()
692 if (nic_data->wol_filter_id != -1) in siena_set_wol()
694 nic_data->wol_filter_id); in siena_set_wol()
696 efx->net_dev->dev_addr, in siena_set_wol()
697 &nic_data->wol_filter_id); in siena_set_wol()
701 pci_wake_from_d3(efx->pci_dev, true); in siena_set_wol()
704 nic_data->wol_filter_id = -1; in siena_set_wol()
705 pci_wake_from_d3(efx->pci_dev, false); in siena_set_wol()
710 return 0; in siena_set_wol()
712 netif_err(efx, hw, efx->net_dev, "%s failed: type=%d rc=%d\n", in siena_set_wol()
720 struct siena_nic_data *nic_data = efx->nic_data; in siena_init_wol()
723 rc = efx_siena_mcdi_wol_filter_get_magic(efx, &nic_data->wol_filter_id); in siena_init_wol()
725 if (rc != 0) { in siena_init_wol()
729 nic_data->wol_filter_id = -1; in siena_init_wol()
730 } else if (nic_data->wol_filter_id != -1) { in siena_init_wol()
731 pci_wake_from_d3(efx->pci_dev, true); in siena_init_wol()
762 for (i = 0; i < inlen_dw; i++) in siena_mcdi_request()
769 _efx_writed(efx, (__force __le32) 0x45789abc, doorbell); in siena_mcdi_request()
783 return EFX_DWORD_FIELD(hdr, EFX_DWORD_0) != 0xffffffff && in siena_mcdi_poll_response()
794 for (i = 0; i < outlen_dw; i++) in siena_mcdi_read_response()
800 struct siena_nic_data *nic_data = efx->nic_data; in siena_mcdi_poll_reboot()
808 if (value == 0) in siena_mcdi_poll_reboot()
809 return 0; in siena_mcdi_poll_reboot()
817 nic_data->stats[SIENA_STAT_tx_good_bytes] = 0; in siena_mcdi_poll_reboot()
818 nic_data->stats[SIENA_STAT_rx_good_bytes] = 0; in siena_mcdi_poll_reboot()
821 return -EINTR; in siena_mcdi_poll_reboot()
823 return -EIO; in siena_mcdi_poll_reboot()
841 [MC_CMD_NVRAM_TYPE_DISABLED_CALLISTO] = { 0, "sfc_dummy_phy" },
842 [MC_CMD_NVRAM_TYPE_MC_FW] = { 0, "sfc_mcfw" },
843 [MC_CMD_NVRAM_TYPE_MC_FW_BACKUP] = { 0, "sfc_mcfw_backup" },
844 [MC_CMD_NVRAM_TYPE_STATIC_CFG_PORT0] = { 0, "sfc_static_cfg" },
846 [MC_CMD_NVRAM_TYPE_DYNAMIC_CFG_PORT0] = { 0, "sfc_dynamic_cfg" },
848 [MC_CMD_NVRAM_TYPE_EXP_ROM] = { 0, "sfc_exp_rom" },
849 [MC_CMD_NVRAM_TYPE_EXP_ROM_CFG_PORT0] = { 0, "sfc_exp_rom_cfg" },
851 [MC_CMD_NVRAM_TYPE_PHY_PORT0] = { 0, "sfc_phy_fw" },
853 [MC_CMD_NVRAM_TYPE_FPGA] = { 0, "sfc_fpga" },
867 return -ENODEV; in siena_mtd_probe_partition()
871 if (info->port != efx_port_num(efx)) in siena_mtd_probe_partition()
872 return -ENODEV; in siena_mtd_probe_partition()
879 return -ENODEV; /* hide it */ in siena_mtd_probe_partition()
881 part->nvram_type = type; in siena_mtd_probe_partition()
882 part->common.dev_type_name = "Siena NVRAM manager"; in siena_mtd_probe_partition()
883 part->common.type_name = info->name; in siena_mtd_probe_partition()
885 part->common.mtd.type = MTD_NORFLASH; in siena_mtd_probe_partition()
886 part->common.mtd.flags = MTD_CAP_NORFLASH; in siena_mtd_probe_partition()
887 part->common.mtd.size = size; in siena_mtd_probe_partition()
888 part->common.mtd.erasesize = erase_size; in siena_mtd_probe_partition()
890 return 0; in siena_mtd_probe_partition()
906 for (i = 0; i < n_parts; i++) in siena_mtd_get_fw_subtypes()
909 return 0; in siena_mtd_get_fw_subtypes()
928 return -ENOMEM; in siena_mtd_probe()
930 type = 0; in siena_mtd_probe()
931 n_parts = 0; in siena_mtd_probe()
933 while (nvram_types != 0) { in siena_mtd_probe()
937 if (rc == 0) in siena_mtd_probe()
939 else if (rc != -ENODEV) in siena_mtd_probe()
950 rc = efx_siena_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts)); in siena_mtd_probe()
963 return 0; in siena_check_caps()
974 * Revision-dependent attributes used by efx.c and nic.c
1097 .rx_buffer_padding = 0,