Lines Matching refs:efx
42 static int ef100_pci_walk_xilinx_table(struct efx_nic *efx, u64 offset,
51 static u32 _ef100_pci_get_bar_bits_with_width(struct efx_nic *efx, in _ef100_pci_get_bar_bits_with_width() argument
57 efx_readd(efx, &dword, structure_start + ROUND_DOWN_TO_DWORD(lbn)); in _ef100_pci_get_bar_bits_with_width()
62 #define ef100_pci_get_bar_bits(efx, entry_location, bitdef) \ argument
63 _ef100_pci_get_bar_bits_with_width(efx, entry_location, \
67 static int ef100_pci_parse_ef100_entry(struct efx_nic *efx, int entry_location, in ef100_pci_parse_ef100_entry() argument
70 u64 offset = ef100_pci_get_bar_bits(efx, entry_location, EF100_FUNC_CTL_WIN_OFF) << in ef100_pci_parse_ef100_entry()
72 u32 bar = ef100_pci_get_bar_bits(efx, entry_location, EF100_BAR); in ef100_pci_parse_ef100_entry()
74 netif_dbg(efx, probe, efx->net_dev, in ef100_pci_parse_ef100_entry()
79 netif_err(efx, probe, efx->net_dev, in ef100_pci_parse_ef100_entry()
86 netif_err(efx, probe, efx->net_dev, in ef100_pci_parse_ef100_entry()
98 static bool ef100_pci_does_bar_overflow(struct efx_nic *efx, int bar, in ef100_pci_does_bar_overflow() argument
102 pci_resource_len(efx->pci_dev, bar); in ef100_pci_does_bar_overflow()
108 static int ef100_pci_parse_continue_entry(struct efx_nic *efx, int entry_location, in ef100_pci_parse_continue_entry() argument
117 efx_reado(efx, &entry, entry_location); in ef100_pci_parse_continue_entry()
124 previous_bar = efx->mem_bar; in ef100_pci_parse_continue_entry()
128 netif_err(efx, probe, efx->net_dev, in ef100_pci_parse_continue_entry()
135 efx_fini_io(efx); in ef100_pci_parse_continue_entry()
137 if (ef100_pci_does_bar_overflow(efx, bar, offset)) { in ef100_pci_parse_continue_entry()
138 netif_err(efx, probe, efx->net_dev, in ef100_pci_parse_continue_entry()
145 rc = efx_init_io(efx, bar, in ef100_pci_parse_continue_entry()
147 pci_resource_len(efx->pci_dev, bar)); in ef100_pci_parse_continue_entry()
149 netif_err(efx, probe, efx->net_dev, in ef100_pci_parse_continue_entry()
155 rc = ef100_pci_walk_xilinx_table(efx, offset, result); in ef100_pci_parse_continue_entry()
160 efx_fini_io(efx); in ef100_pci_parse_continue_entry()
163 rc = efx_init_io(efx, previous_bar, in ef100_pci_parse_continue_entry()
165 pci_resource_len(efx->pci_dev, previous_bar)); in ef100_pci_parse_continue_entry()
167 netif_err(efx, probe, efx->net_dev, in ef100_pci_parse_continue_entry()
180 static int ef100_pci_walk_xilinx_table(struct efx_nic *efx, u64 offset, in ef100_pci_walk_xilinx_table() argument
187 u32 id = ef100_pci_get_bar_bits(efx, current_entry, ENTRY_FORMAT); in ef100_pci_walk_xilinx_table()
188 u32 last = ef100_pci_get_bar_bits(efx, current_entry, ENTRY_LAST); in ef100_pci_walk_xilinx_table()
189 u32 rev = ef100_pci_get_bar_bits(efx, current_entry, ENTRY_REV); in ef100_pci_walk_xilinx_table()
195 entry_size = ef100_pci_get_bar_bits(efx, current_entry, ENTRY_SIZE); in ef100_pci_walk_xilinx_table()
197 netif_dbg(efx, probe, efx->net_dev, in ef100_pci_walk_xilinx_table()
199 id, entry_size, current_entry, efx->mem_bar); in ef100_pci_walk_xilinx_table()
202 netif_err(efx, probe, efx->net_dev, in ef100_pci_walk_xilinx_table()
211 netif_err(efx, probe, efx->net_dev, in ef100_pci_walk_xilinx_table()
217 rc = ef100_pci_parse_ef100_entry(efx, current_entry, in ef100_pci_walk_xilinx_table()
224 netif_err(efx, probe, efx->net_dev, in ef100_pci_walk_xilinx_table()
230 rc = ef100_pci_parse_continue_entry(efx, current_entry, result); in ef100_pci_walk_xilinx_table()
244 if (ef100_pci_does_bar_overflow(efx, efx->mem_bar, current_entry)) { in ef100_pci_walk_xilinx_table()
245 netif_err(efx, probe, efx->net_dev, in ef100_pci_walk_xilinx_table()
253 static int _ef100_pci_get_config_bits_with_width(struct efx_nic *efx, in _ef100_pci_get_config_bits_with_width() argument
260 rc = pci_read_config_dword(efx->pci_dev, pos, &temp); in _ef100_pci_get_config_bits_with_width()
262 netif_err(efx, probe, efx->net_dev, in _ef100_pci_get_config_bits_with_width()
273 #define ef100_pci_get_config_bits(efx, entry_location, bitdef, result) \ argument
274 _ef100_pci_get_config_bits_with_width(efx, entry_location, \
281 static int ef100_pci_parse_xilinx_cap(struct efx_nic *efx, int vndr_cap, in ef100_pci_parse_xilinx_cap() argument
291 rc = ef100_pci_get_config_bits(efx, vndr_cap, TBL_BAR, &bar); in ef100_pci_parse_xilinx_cap()
293 netif_err(efx, probe, efx->net_dev, in ef100_pci_parse_xilinx_cap()
301 netif_err(efx, probe, efx->net_dev, in ef100_pci_parse_xilinx_cap()
307 rc = ef100_pci_get_config_bits(efx, vndr_cap, TBL_OFF_LO, &offset_lo); in ef100_pci_parse_xilinx_cap()
309 netif_err(efx, probe, efx->net_dev, in ef100_pci_parse_xilinx_cap()
317 rc = ef100_pci_get_config_bits(efx, vndr_cap, TBL_OFF_HI, &offset_high); in ef100_pci_parse_xilinx_cap()
319 netif_err(efx, probe, efx->net_dev, in ef100_pci_parse_xilinx_cap()
329 if (offset > pci_resource_len(efx->pci_dev, bar) - sizeof(u32) * 2) { in ef100_pci_parse_xilinx_cap()
330 netif_err(efx, probe, efx->net_dev, in ef100_pci_parse_xilinx_cap()
337 rc = efx_init_io(efx, bar, in ef100_pci_parse_xilinx_cap()
339 pci_resource_len(efx->pci_dev, bar)); in ef100_pci_parse_xilinx_cap()
341 netif_err(efx, probe, efx->net_dev, in ef100_pci_parse_xilinx_cap()
346 rc = ef100_pci_walk_xilinx_table(efx, offset, result); in ef100_pci_parse_xilinx_cap()
349 efx_fini_io(efx); in ef100_pci_parse_xilinx_cap()
356 static int ef100_pci_find_func_ctrl_window(struct efx_nic *efx, in ef100_pci_find_func_ctrl_window() argument
364 while ((cap = pci_find_next_ext_capability(efx->pci_dev, cap, PCI_EXT_CAP_ID_VNDR)) != 0) { in ef100_pci_find_func_ctrl_window()
373 rc = ef100_pci_get_config_bits(efx, vndr_cap, ID, &vsec_id); in ef100_pci_find_func_ctrl_window()
375 netif_err(efx, probe, efx->net_dev, in ef100_pci_find_func_ctrl_window()
381 rc = ef100_pci_get_config_bits(efx, vndr_cap, VER, &vsec_ver); in ef100_pci_find_func_ctrl_window()
383 netif_err(efx, probe, efx->net_dev, in ef100_pci_find_func_ctrl_window()
390 rc = ef100_pci_get_config_bits(efx, vndr_cap, LEN, &vsec_len); in ef100_pci_find_func_ctrl_window()
392 netif_err(efx, probe, efx->net_dev, in ef100_pci_find_func_ctrl_window()
403 rc = ef100_pci_parse_xilinx_cap(efx, vndr_cap, in ef100_pci_find_func_ctrl_window()
411 netif_err(efx, probe, efx->net_dev, in ef100_pci_find_func_ctrl_window()
426 struct efx_nic *efx = pci_get_drvdata(pci_dev); in ef100_pci_remove() local
429 if (!efx) in ef100_pci_remove()
432 probe_data = container_of(efx, struct efx_probe_data, efx); in ef100_pci_remove()
435 efx_fini_struct_tc(efx); in ef100_pci_remove()
438 ef100_remove(efx); in ef100_pci_remove()
439 efx_fini_io(efx); in ef100_pci_remove()
446 efx_fini_struct(efx); in ef100_pci_remove()
455 struct efx_nic *efx; in ef100_pci_probe() local
463 efx = &probe_data->efx; in ef100_pci_probe()
465 efx->type = (const struct efx_nic_type *)entry->driver_data; in ef100_pci_probe()
467 efx->pci_dev = pci_dev; in ef100_pci_probe()
468 pci_set_drvdata(pci_dev, efx); in ef100_pci_probe()
469 rc = efx_init_struct(efx, pci_dev); in ef100_pci_probe()
473 efx->vi_stride = EF100_DEFAULT_VI_STRIDE; in ef100_pci_probe()
476 rc = ef100_pci_find_func_ctrl_window(efx, &fcw); in ef100_pci_probe()
491 if (fcw.offset > pci_resource_len(efx->pci_dev, fcw.bar) - ESE_GZ_FCW_LEN) { in ef100_pci_probe()
498 rc = efx_init_io(efx, fcw.bar, in ef100_pci_probe()
500 pci_resource_len(efx->pci_dev, fcw.bar)); in ef100_pci_probe()
504 efx->reg_base = fcw.offset; in ef100_pci_probe()
506 rc = efx->type->probe(efx); in ef100_pci_probe()
510 efx->state = STATE_PROBED; in ef100_pci_probe()
527 struct efx_nic *efx = pci_get_drvdata(dev); in ef100_pci_sriov_configure() local
530 if (efx->type->sriov_configure) { in ef100_pci_sriov_configure()
531 rc = efx->type->sriov_configure(efx, num_vfs); in ef100_pci_sriov_configure()