Lines Matching full:bar

215 	 * Set the root complex BAR configuration register:  in cdns_pcie_host_init_root_port()
249 enum cdns_pcie_rp_bar bar, in cdns_pcie_host_bar_ib_config() argument
256 if (!rc->avail_ib_bar[bar]) in cdns_pcie_host_bar_ib_config()
259 rc->avail_ib_bar[bar] = false; in cdns_pcie_host_bar_ib_config()
265 cdns_pcie_writel(pcie, CDNS_PCIE_AT_IB_RP_BAR_ADDR0(bar), addr0); in cdns_pcie_host_bar_ib_config()
266 cdns_pcie_writel(pcie, CDNS_PCIE_AT_IB_RP_BAR_ADDR1(bar), addr1); in cdns_pcie_host_bar_ib_config()
268 if (bar == RP_NO_BAR) in cdns_pcie_host_bar_ib_config()
272 value &= ~(LM_RC_BAR_CFG_CTRL_MEM_64BITS(bar) | in cdns_pcie_host_bar_ib_config()
273 LM_RC_BAR_CFG_CTRL_PREF_MEM_64BITS(bar) | in cdns_pcie_host_bar_ib_config()
274 LM_RC_BAR_CFG_CTRL_MEM_32BITS(bar) | in cdns_pcie_host_bar_ib_config()
275 LM_RC_BAR_CFG_CTRL_PREF_MEM_32BITS(bar) | in cdns_pcie_host_bar_ib_config()
276 LM_RC_BAR_CFG_APERTURE(bar, bar_aperture_mask[bar] + 2)); in cdns_pcie_host_bar_ib_config()
279 value |= LM_RC_BAR_CFG_CTRL_MEM_64BITS(bar); in cdns_pcie_host_bar_ib_config()
280 value |= LM_RC_BAR_CFG_CTRL_PREF_MEM_64BITS(bar); in cdns_pcie_host_bar_ib_config()
283 value |= LM_RC_BAR_CFG_CTRL_MEM_32BITS(bar); in cdns_pcie_host_bar_ib_config()
284 value |= LM_RC_BAR_CFG_CTRL_PREF_MEM_32BITS(bar); in cdns_pcie_host_bar_ib_config()
287 value |= LM_RC_BAR_CFG_APERTURE(bar, aperture); in cdns_pcie_host_bar_ib_config()
296 enum cdns_pcie_rp_bar bar, sel_bar; in cdns_pcie_host_find_min_bar() local
299 for (bar = RP_BAR0; bar <= RP_NO_BAR; bar++) { in cdns_pcie_host_find_min_bar()
300 if (!rc->avail_ib_bar[bar]) in cdns_pcie_host_find_min_bar()
303 if (size <= bar_max_size[bar]) { in cdns_pcie_host_find_min_bar()
305 sel_bar = bar; in cdns_pcie_host_find_min_bar()
309 if (bar_max_size[bar] < bar_max_size[sel_bar]) in cdns_pcie_host_find_min_bar()
310 sel_bar = bar; in cdns_pcie_host_find_min_bar()
320 enum cdns_pcie_rp_bar bar, sel_bar; in cdns_pcie_host_find_max_bar() local
323 for (bar = RP_BAR0; bar <= RP_NO_BAR; bar++) { in cdns_pcie_host_find_max_bar()
324 if (!rc->avail_ib_bar[bar]) in cdns_pcie_host_find_max_bar()
327 if (size >= bar_max_size[bar]) { in cdns_pcie_host_find_max_bar()
329 sel_bar = bar; in cdns_pcie_host_find_max_bar()
333 if (bar_max_size[bar] > bar_max_size[sel_bar]) in cdns_pcie_host_find_max_bar()
334 sel_bar = bar; in cdns_pcie_host_find_max_bar()
347 enum cdns_pcie_rp_bar bar; in cdns_pcie_host_bar_config() local
364 * Try to find a minimum BAR whose size is greater than in cdns_pcie_host_bar_config()
368 * If a minimum BAR is found, IB ATU will be configured and in cdns_pcie_host_bar_config()
371 bar = cdns_pcie_host_find_min_bar(rc, size); in cdns_pcie_host_bar_config()
372 if (bar != RP_BAR_UNDEFINED) { in cdns_pcie_host_bar_config()
373 ret = cdns_pcie_host_bar_ib_config(rc, bar, cpu_addr, in cdns_pcie_host_bar_config()
376 dev_err(dev, "IB BAR: %d config failed\n", bar); in cdns_pcie_host_bar_config()
382 * resource_entry size cannot be fitted in a single BAR. So we in cdns_pcie_host_bar_config()
383 * find a maximum BAR whose size is less than or equal to the in cdns_pcie_host_bar_config()
386 * BAR. The remaining size would be fitted during the next in cdns_pcie_host_bar_config()
388 * If a maximum BAR is not found, there is no way we can fit in cdns_pcie_host_bar_config()
391 bar = cdns_pcie_host_find_max_bar(rc, size); in cdns_pcie_host_bar_config()
392 if (bar == RP_BAR_UNDEFINED) { in cdns_pcie_host_bar_config()
393 dev_err(dev, "No free BAR to map cpu_addr %llx\n", in cdns_pcie_host_bar_config()
398 winsize = bar_max_size[bar]; in cdns_pcie_host_bar_config()
399 ret = cdns_pcie_host_bar_ib_config(rc, bar, cpu_addr, winsize, in cdns_pcie_host_bar_config()
402 dev_err(dev, "IB BAR: %d config failed\n", bar); in cdns_pcie_host_bar_config()
427 enum cdns_pcie_rp_bar bar; in cdns_pcie_host_unmap_dma_ranges() local
431 for (bar = RP_BAR0; bar <= RP_NO_BAR; bar++) { in cdns_pcie_host_unmap_dma_ranges()
432 if (rc->avail_ib_bar[bar]) in cdns_pcie_host_unmap_dma_ranges()
435 cdns_pcie_writel(pcie, CDNS_PCIE_AT_IB_RP_BAR_ADDR0(bar), 0); in cdns_pcie_host_unmap_dma_ranges()
436 cdns_pcie_writel(pcie, CDNS_PCIE_AT_IB_RP_BAR_ADDR1(bar), 0); in cdns_pcie_host_unmap_dma_ranges()
438 if (bar == RP_NO_BAR) in cdns_pcie_host_unmap_dma_ranges()
441 value = ~(LM_RC_BAR_CFG_CTRL_MEM_64BITS(bar) | in cdns_pcie_host_unmap_dma_ranges()
442 LM_RC_BAR_CFG_CTRL_PREF_MEM_64BITS(bar) | in cdns_pcie_host_unmap_dma_ranges()
443 LM_RC_BAR_CFG_CTRL_MEM_32BITS(bar) | in cdns_pcie_host_unmap_dma_ranges()
444 LM_RC_BAR_CFG_CTRL_PREF_MEM_32BITS(bar) | in cdns_pcie_host_unmap_dma_ranges()
445 LM_RC_BAR_CFG_APERTURE(bar, bar_aperture_mask[bar] + 2)); in cdns_pcie_host_unmap_dma_ranges()
465 of_property_read_u32(np, "cdns,no-bar-match-nbits", in cdns_pcie_host_map_dma_ranges()
470 dev_err(dev, "IB BAR: %d config failed\n", RP_NO_BAR); in cdns_pcie_host_map_dma_ranges()
637 enum cdns_pcie_rp_bar bar; in cdns_pcie_host_setup() local
671 for (bar = RP_BAR0; bar <= RP_NO_BAR; bar++) in cdns_pcie_host_setup()
672 rc->avail_ib_bar[bar] = true; in cdns_pcie_host_setup()