Lines Matching refs:efx
31 static void siena_init_wol(struct efx_nic *efx);
49 efx_writed_page_locked(channel->efx, &timer_cmd, FR_BZ_TIMER_COMMAND_P0, in siena_push_irq_moderation()
53 void siena_prepare_flush(struct efx_nic *efx) in siena_prepare_flush() argument
55 if (efx->fc_disable++ == 0) in siena_prepare_flush()
56 efx_mcdi_set_mac(efx); in siena_prepare_flush()
59 void siena_finish_flush(struct efx_nic *efx) in siena_finish_flush() argument
61 if (--efx->fc_disable == 0) in siena_finish_flush()
62 efx_mcdi_set_mac(efx); in siena_finish_flush()
94 static int siena_test_chip(struct efx_nic *efx, struct efx_self_tests *tests) in siena_test_chip() argument
99 efx_reset_down(efx, reset_method); in siena_test_chip()
104 rc = efx_mcdi_reset(efx, reset_method); in siena_test_chip()
109 efx_farch_test_registers(efx, siena_register_tests, in siena_test_chip()
113 rc = efx_mcdi_reset(efx, reset_method); in siena_test_chip()
115 rc2 = efx_reset_up(efx, reset_method, rc == 0); in siena_test_chip()
126 static void siena_ptp_write_host_time(struct efx_nic *efx, u32 host_time) in siena_ptp_write_host_time() argument
128 _efx_writed(efx, cpu_to_le32(host_time), in siena_ptp_write_host_time()
132 static int siena_ptp_set_ts_config(struct efx_nic *efx, in siena_ptp_set_ts_config() argument
140 return efx_ptp_change_mode(efx, in siena_ptp_set_ts_config()
142 efx_ptp_get_mode(efx)); in siena_ptp_set_ts_config()
147 return efx_ptp_change_mode(efx, true, MC_CMD_PTP_MODE_V1); in siena_ptp_set_ts_config()
152 rc = efx_ptp_change_mode(efx, true, in siena_ptp_set_ts_config()
160 rc = efx_ptp_change_mode(efx, true, MC_CMD_PTP_MODE_V2); in siena_ptp_set_ts_config()
206 static void siena_monitor(struct efx_nic *efx) in siena_monitor() argument
208 struct eeh_dev *eehdev = pci_dev_to_eeh_dev(efx->pci_dev); in siena_monitor()
214 static int siena_probe_nvconfig(struct efx_nic *efx) in siena_probe_nvconfig() argument
219 rc = efx_mcdi_get_board_cfg(efx, efx->net_dev->perm_addr, NULL, &caps); in siena_probe_nvconfig()
221 efx->timer_quantum_ns = in siena_probe_nvconfig()
227 static int siena_dimension_resources(struct efx_nic *efx) in siena_dimension_resources() argument
233 efx_farch_dimension_resources(efx, FR_CZ_BUF_FULL_TBL_ROWS / 2); in siena_dimension_resources()
237 static unsigned int siena_mem_map_size(struct efx_nic *efx) in siena_mem_map_size() argument
243 static int siena_probe_nic(struct efx_nic *efx) in siena_probe_nic() argument
253 nic_data->efx = efx; in siena_probe_nic()
254 efx->nic_data = nic_data; in siena_probe_nic()
256 if (efx_farch_fpga_ver(efx) != 0) { in siena_probe_nic()
257 netif_err(efx, probe, efx->net_dev, in siena_probe_nic()
263 efx->max_channels = EFX_MAX_CHANNELS; in siena_probe_nic()
265 efx_reado(efx, ®, FR_AZ_CS_DEBUG); in siena_probe_nic()
266 efx->port_num = EFX_OWORD_FIELD(reg, FRF_CZ_CS_PORT_NUM) - 1; in siena_probe_nic()
268 rc = efx_mcdi_init(efx); in siena_probe_nic()
273 rc = efx_mcdi_reset(efx, RESET_TYPE_ALL); in siena_probe_nic()
275 netif_err(efx, probe, efx->net_dev, "failed to reset NIC\n"); in siena_probe_nic()
279 siena_init_wol(efx); in siena_probe_nic()
282 rc = efx_nic_alloc_buffer(efx, &efx->irq_status, sizeof(efx_oword_t), in siena_probe_nic()
286 BUG_ON(efx->irq_status.dma_addr & 0x0f); in siena_probe_nic()
288 netif_dbg(efx, probe, efx->net_dev, in siena_probe_nic()
290 (unsigned long long)efx->irq_status.dma_addr, in siena_probe_nic()
291 efx->irq_status.addr, in siena_probe_nic()
292 (unsigned long long)virt_to_phys(efx->irq_status.addr)); in siena_probe_nic()
295 rc = siena_probe_nvconfig(efx); in siena_probe_nic()
297 netif_err(efx, probe, efx->net_dev, in siena_probe_nic()
299 efx->phy_type = PHY_TYPE_NONE; in siena_probe_nic()
300 efx->mdio.prtad = MDIO_PRTAD_NONE; in siena_probe_nic()
305 rc = efx_mcdi_mon_probe(efx); in siena_probe_nic()
309 efx_siena_sriov_probe(efx); in siena_probe_nic()
310 efx_ptp_defer_probe_with_channel(efx); in siena_probe_nic()
315 efx_nic_free_buffer(efx, &efx->irq_status); in siena_probe_nic()
318 efx_mcdi_fini(efx); in siena_probe_nic()
320 kfree(efx->nic_data); in siena_probe_nic()
324 static void siena_rx_push_rss_config(struct efx_nic *efx) in siena_rx_push_rss_config() argument
329 memcpy(&temp, efx->rx_hash_key, sizeof(temp)); in siena_rx_push_rss_config()
330 efx_writeo(efx, &temp, FR_BZ_RX_RSS_TKEY); in siena_rx_push_rss_config()
333 BUILD_BUG_ON(sizeof(efx->rx_hash_key) < in siena_rx_push_rss_config()
336 memcpy(&temp, efx->rx_hash_key, sizeof(temp)); in siena_rx_push_rss_config()
337 efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG1); in siena_rx_push_rss_config()
338 memcpy(&temp, efx->rx_hash_key + sizeof(temp), sizeof(temp)); in siena_rx_push_rss_config()
339 efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG2); in siena_rx_push_rss_config()
342 memcpy(&temp, efx->rx_hash_key + 2 * sizeof(temp), in siena_rx_push_rss_config()
344 efx_writeo(efx, &temp, FR_CZ_RX_RSS_IPV6_REG3); in siena_rx_push_rss_config()
346 efx_farch_rx_push_indir_table(efx); in siena_rx_push_rss_config()
353 static int siena_init_nic(struct efx_nic *efx) in siena_init_nic() argument
359 rc = efx_mcdi_handle_assertion(efx); in siena_init_nic()
364 efx_reado(efx, &temp, FR_AZ_TX_RESERVED); in siena_init_nic()
366 efx_writeo(efx, &temp, FR_AZ_TX_RESERVED); in siena_init_nic()
371 efx_reado(efx, &temp, FR_AZ_TX_CFG); in siena_init_nic()
374 efx_writeo(efx, &temp, FR_AZ_TX_CFG); in siena_init_nic()
376 efx_reado(efx, &temp, FR_AZ_RX_CFG); in siena_init_nic()
387 efx_writeo(efx, &temp, FR_AZ_RX_CFG); in siena_init_nic()
389 siena_rx_push_rss_config(efx); in siena_init_nic()
392 rc = efx_mcdi_log_ctrl(efx, true, false, 0); in siena_init_nic()
398 efx_writeo(efx, &temp, FR_BZ_DP_CTRL); in siena_init_nic()
401 efx_writeo(efx, &temp, FR_CZ_USR_EV_CFG); in siena_init_nic()
403 efx_farch_init_common(efx); in siena_init_nic()
407 static void siena_remove_nic(struct efx_nic *efx) in siena_remove_nic() argument
409 efx_mcdi_mon_remove(efx); in siena_remove_nic()
411 efx_nic_free_buffer(efx, &efx->irq_status); in siena_remove_nic()
413 efx_mcdi_reset(efx, RESET_TYPE_ALL); in siena_remove_nic()
415 efx_mcdi_fini(efx); in siena_remove_nic()
418 kfree(efx->nic_data); in siena_remove_nic()
419 efx->nic_data = NULL; in siena_remove_nic()
495 static size_t siena_describe_nic_stats(struct efx_nic *efx, u8 *names) in siena_describe_nic_stats() argument
501 static int siena_try_update_nic_stats(struct efx_nic *efx) in siena_try_update_nic_stats() argument
503 struct siena_nic_data *nic_data = efx->nic_data; in siena_try_update_nic_stats()
508 dma_stats = efx->stats_buffer.addr; in siena_try_update_nic_stats()
515 stats, efx->stats_buffer.addr, false); in siena_try_update_nic_stats()
522 efx_nic_fix_nodesc_drop_stat(efx, in siena_try_update_nic_stats()
535 efx_update_sw_stats(efx, stats); in siena_try_update_nic_stats()
539 static size_t siena_update_nic_stats(struct efx_nic *efx, u64 *full_stats, in siena_update_nic_stats() argument
542 struct siena_nic_data *nic_data = efx->nic_data; in siena_update_nic_stats()
549 if (siena_try_update_nic_stats(efx) == 0) in siena_update_nic_stats()
587 static int siena_mac_reconfigure(struct efx_nic *efx) in siena_mac_reconfigure() argument
594 sizeof(efx->multicast_hash)); in siena_mac_reconfigure()
596 efx_farch_filter_sync_rx_mode(efx); in siena_mac_reconfigure()
598 WARN_ON(!mutex_is_locked(&efx->mac_lock)); in siena_mac_reconfigure()
600 rc = efx_mcdi_set_mac(efx); in siena_mac_reconfigure()
605 efx->multicast_hash.byte, sizeof(efx->multicast_hash)); in siena_mac_reconfigure()
606 return efx_mcdi_rpc(efx, MC_CMD_SET_MCAST_HASH, in siena_mac_reconfigure()
617 static void siena_get_wol(struct efx_nic *efx, struct ethtool_wolinfo *wol) in siena_get_wol() argument
619 struct siena_nic_data *nic_data = efx->nic_data; in siena_get_wol()
630 static int siena_set_wol(struct efx_nic *efx, u32 type) in siena_set_wol() argument
632 struct siena_nic_data *nic_data = efx->nic_data; in siena_set_wol()
640 efx_mcdi_wol_filter_remove(efx, in siena_set_wol()
642 rc = efx_mcdi_wol_filter_set_magic(efx, efx->net_dev->dev_addr, in siena_set_wol()
647 pci_wake_from_d3(efx->pci_dev, true); in siena_set_wol()
649 rc = efx_mcdi_wol_filter_reset(efx); in siena_set_wol()
651 pci_wake_from_d3(efx->pci_dev, false); in siena_set_wol()
658 netif_err(efx, hw, efx->net_dev, "%s failed: type=%d rc=%d\n", in siena_set_wol()
664 static void siena_init_wol(struct efx_nic *efx) in siena_init_wol() argument
666 struct siena_nic_data *nic_data = efx->nic_data; in siena_init_wol()
669 rc = efx_mcdi_wol_filter_get_magic(efx, &nic_data->wol_filter_id); in siena_init_wol()
674 efx_mcdi_wol_filter_reset(efx); in siena_init_wol()
677 pci_wake_from_d3(efx->pci_dev, true); in siena_init_wol()
688 #define MCDI_PDU(efx) \ argument
689 (efx_port_num(efx) ? MC_SMEM_P1_PDU_OFST : MC_SMEM_P0_PDU_OFST)
690 #define MCDI_DOORBELL(efx) \ argument
691 (efx_port_num(efx) ? MC_SMEM_P1_DOORBELL_OFST : MC_SMEM_P0_DOORBELL_OFST)
692 #define MCDI_STATUS(efx) \ argument
693 (efx_port_num(efx) ? MC_SMEM_P1_STATUS_OFST : MC_SMEM_P0_STATUS_OFST)
695 static void siena_mcdi_request(struct efx_nic *efx, in siena_mcdi_request() argument
699 unsigned pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); in siena_mcdi_request()
700 unsigned doorbell = FR_CZ_MC_TREG_SMEM + MCDI_DOORBELL(efx); in siena_mcdi_request()
706 efx_writed(efx, hdr, pdu); in siena_mcdi_request()
709 efx_writed(efx, &sdu[i], pdu + hdr_len + 4 * i); in siena_mcdi_request()
715 _efx_writed(efx, (__force __le32) 0x45789abc, doorbell); in siena_mcdi_request()
718 static bool siena_mcdi_poll_response(struct efx_nic *efx) in siena_mcdi_poll_response() argument
720 unsigned int pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); in siena_mcdi_poll_response()
723 efx_readd(efx, &hdr, pdu); in siena_mcdi_poll_response()
733 static void siena_mcdi_read_response(struct efx_nic *efx, efx_dword_t *outbuf, in siena_mcdi_read_response() argument
736 unsigned int pdu = FR_CZ_MC_TREG_SMEM + MCDI_PDU(efx); in siena_mcdi_read_response()
741 efx_readd(efx, &outbuf[i], pdu + offset + 4 * i); in siena_mcdi_read_response()
744 static int siena_mcdi_poll_reboot(struct efx_nic *efx) in siena_mcdi_poll_reboot() argument
746 struct siena_nic_data *nic_data = efx->nic_data; in siena_mcdi_poll_reboot()
747 unsigned int addr = FR_CZ_MC_TREG_SMEM + MCDI_STATUS(efx); in siena_mcdi_poll_reboot()
751 efx_readd(efx, ®, addr); in siena_mcdi_poll_reboot()
758 efx_writed(efx, ®, addr); in siena_mcdi_poll_reboot()
802 static int siena_mtd_probe_partition(struct efx_nic *efx, in siena_mtd_probe_partition() argument
817 if (info->port != efx_port_num(efx)) in siena_mtd_probe_partition()
820 rc = efx_mcdi_nvram_info(efx, type, &size, &erase_size, &protected); in siena_mtd_probe_partition()
838 static int siena_mtd_get_fw_subtypes(struct efx_nic *efx, in siena_mtd_get_fw_subtypes() argument
847 rc = efx_mcdi_get_board_cfg(efx, NULL, fw_subtype_list, NULL); in siena_mtd_get_fw_subtypes()
857 static int siena_mtd_probe(struct efx_nic *efx) in siena_mtd_probe() argument
867 rc = efx_mcdi_nvram_types(efx, &nvram_types); in siena_mtd_probe()
880 rc = siena_mtd_probe_partition(efx, &parts[n_parts], in siena_mtd_probe()
891 rc = siena_mtd_get_fw_subtypes(efx, parts, n_parts); in siena_mtd_probe()
895 rc = efx_mtd_add(efx, &parts[0].common, n_parts, sizeof(*parts)); in siena_mtd_probe()