Lines Matching refs:ioda
120 phb->ioda.pe_array[pe_no].phb = phb; in pnv_ioda_init_pe()
121 phb->ioda.pe_array[pe_no].pe_number = pe_no; in pnv_ioda_init_pe()
122 phb->ioda.pe_array[pe_no].dma_setup_done = false; in pnv_ioda_init_pe()
135 return &phb->ioda.pe_array[pe_no]; in pnv_ioda_init_pe()
140 if (!(pe_no >= 0 && pe_no < phb->ioda.total_pe_num)) { in pnv_ioda_reserve_pe()
146 mutex_lock(&phb->ioda.pe_alloc_mutex); in pnv_ioda_reserve_pe()
147 if (test_and_set_bit(pe_no, phb->ioda.pe_alloc)) in pnv_ioda_reserve_pe()
150 mutex_unlock(&phb->ioda.pe_alloc_mutex); in pnv_ioda_reserve_pe()
160 mutex_lock(&phb->ioda.pe_alloc_mutex); in pnv_ioda_alloc_pe()
163 for (pe = phb->ioda.total_pe_num - 1; pe >= 0; pe--) { in pnv_ioda_alloc_pe()
164 if (test_bit(pe, phb->ioda.pe_alloc)) { in pnv_ioda_alloc_pe()
177 set_bit(i, phb->ioda.pe_alloc); in pnv_ioda_alloc_pe()
180 ret = &phb->ioda.pe_array[pe]; in pnv_ioda_alloc_pe()
183 mutex_unlock(&phb->ioda.pe_alloc_mutex); in pnv_ioda_alloc_pe()
195 mutex_lock(&phb->ioda.pe_alloc_mutex); in pnv_ioda_free_pe()
196 clear_bit(pe_num, phb->ioda.pe_alloc); in pnv_ioda_free_pe()
197 mutex_unlock(&phb->ioda.pe_alloc_mutex); in pnv_ioda_free_pe()
210 phb->ioda.m64_bar_idx, in pnv_ioda2_init_m64()
211 phb->ioda.m64_base, in pnv_ioda2_init_m64()
213 phb->ioda.m64_size); in pnv_ioda2_init_m64()
222 phb->ioda.m64_bar_idx, in pnv_ioda2_init_m64()
234 if (phb->ioda.reserved_pe_idx == 0) in pnv_ioda2_init_m64()
235 r->start += (2 * phb->ioda.m64_segsize); in pnv_ioda2_init_m64()
236 else if (phb->ioda.reserved_pe_idx == (phb->ioda.total_pe_num - 1)) in pnv_ioda2_init_m64()
237 r->end -= (2 * phb->ioda.m64_segsize); in pnv_ioda2_init_m64()
240 phb->ioda.reserved_pe_idx); in pnv_ioda2_init_m64()
246 rc, desc, phb->ioda.m64_bar_idx); in pnv_ioda2_init_m64()
249 phb->ioda.m64_bar_idx, in pnv_ioda2_init_m64()
262 base = phb->ioda.m64_base; in pnv_ioda_reserve_dev_m64_pe()
263 sgsz = phb->ioda.m64_segsize; in pnv_ioda_reserve_dev_m64_pe()
307 size = ALIGN(phb->ioda.total_pe_num / 8, sizeof(unsigned long)); in pnv_ioda_pick_m64_pe()
323 if (bitmap_empty(pe_alloc, phb->ioda.total_pe_num)) { in pnv_ioda_pick_m64_pe()
334 while ((i = find_next_bit(pe_alloc, phb->ioda.total_pe_num, i + 1)) < in pnv_ioda_pick_m64_pe()
335 phb->ioda.total_pe_num) { in pnv_ioda_pick_m64_pe()
336 pe = &phb->ioda.pe_array[i]; in pnv_ioda_pick_m64_pe()
338 phb->ioda.m64_segmap[pe->pe_number] = pe->pe_number; in pnv_ioda_pick_m64_pe()
412 phb->ioda.m64_size = resource_size(res); in pnv_ioda_parse_m64_window()
413 phb->ioda.m64_segsize = phb->ioda.m64_size / phb->ioda.total_pe_num; in pnv_ioda_parse_m64_window()
414 phb->ioda.m64_base = pci_addr; in pnv_ioda_parse_m64_window()
422 phb->ioda.m64_bar_alloc = (unsigned long)-1; in pnv_ioda_parse_m64_window()
426 phb->ioda.m64_bar_idx = m64_range[0] + m64_range[1]; in pnv_ioda_parse_m64_window()
428 pr_info(" Using M64 #%d as default window\n", phb->ioda.m64_bar_idx); in pnv_ioda_parse_m64_window()
432 clear_bit(i, &phb->ioda.m64_bar_alloc); in pnv_ioda_parse_m64_window()
443 struct pnv_ioda_pe *pe = &phb->ioda.pe_array[pe_no]; in pnv_ioda_freeze_pe()
487 pe = &phb->ioda.pe_array[pe_no]; in pnv_ioda_unfreeze_pe()
529 if (pe_no < 0 || pe_no >= phb->ioda.total_pe_num) in pnv_ioda_get_pe_state()
536 pe = &phb->ioda.pe_array[pe_no]; in pnv_ioda_get_pe_state()
585 int pe_number = phb->ioda.pe_rmap[bdfn]; in pnv_pci_bdfn_to_pe()
590 return &phb->ioda.pe_array[pe_number]; in pnv_pci_bdfn_to_pe()
602 return &phb->ioda.pe_array[pdn->pe_number]; in pnv_ioda_get_pe()
697 parent = &phb->ioda.pe_array[pdn->pe_number]; in pnv_ioda_set_peltv()
785 phb->ioda.pe_rmap[rid] = IODA_INVALID_PE; in pnv_ioda_deconfigure_pe()
867 phb->ioda.pe_rmap[rid] = pe->pe_number; in pnv_ioda_configure_pe()
920 mutex_lock(&phb->ioda.pe_list_mutex); in pnv_ioda_setup_dev_PE()
921 list_add_tail(&pe->list, &phb->ioda.pe_list); in pnv_ioda_setup_dev_PE()
922 mutex_unlock(&phb->ioda.pe_list_mutex); in pnv_ioda_setup_dev_PE()
942 pe_num = phb->ioda.pe_rmap[bus->number << 8]; in pnv_ioda_setup_bus_PE()
944 pe = &phb->ioda.pe_array[pe_num]; in pnv_ioda_setup_bus_PE()
950 pe = &phb->ioda.pe_array[phb->ioda.root_pe_idx]; in pnv_ioda_setup_bus_PE()
988 list_add_tail(&pe->list, &phb->ioda.pe_list); in pnv_ioda_setup_bus_PE()
1128 pe = &phb->ioda.pe_array[pdn->pe_number]; in pnv_pci_ioda_iommu_bypass_supported()
1427 if (window_size > pe->phb->ioda.m32_pci_base) { in pnv_pci_ioda2_setup_default_config()
1428 res_start = pe->phb->ioda.m32_pci_base >> tbl->it_page_shift; in pnv_pci_ioda2_setup_default_config()
1600 phb->ioda.m32_pci_base); in pnv_pci_ioda2_setup_dma_pe()
1604 pe->table_group.tce32_size = phb->ioda.m32_pci_base; in pnv_pci_ioda2_setup_dma_pe()
1665 if (!phb->ioda.irq_chip_init) { in pnv_set_msi_irq_chip()
1672 phb->ioda.irq_chip_init = 1; in pnv_set_msi_irq_chip()
1673 phb->ioda.irq_chip = *ichip; in pnv_set_msi_irq_chip()
1674 phb->ioda.irq_chip.irq_eoi = pnv_ioda2_msi_eoi; in pnv_set_msi_irq_chip()
1676 irq_set_chip(virq, &phb->ioda.irq_chip); in pnv_set_msi_irq_chip()
1996 region.start = res->start - phb->ioda.io_pci_base; in pnv_ioda_setup_pe_res()
1997 region.end = res->end - phb->ioda.io_pci_base; in pnv_ioda_setup_pe_res()
1998 index = region.start / phb->ioda.io_segsize; in pnv_ioda_setup_pe_res()
2000 while (index < phb->ioda.total_pe_num && in pnv_ioda_setup_pe_res()
2002 phb->ioda.io_segmap[index] = pe->pe_number; in pnv_ioda_setup_pe_res()
2011 region.start += phb->ioda.io_segsize; in pnv_ioda_setup_pe_res()
2018 phb->ioda.m32_pci_base; in pnv_ioda_setup_pe_res()
2021 phb->ioda.m32_pci_base; in pnv_ioda_setup_pe_res()
2022 index = region.start / phb->ioda.m32_segsize; in pnv_ioda_setup_pe_res()
2024 while (index < phb->ioda.total_pe_num && in pnv_ioda_setup_pe_res()
2026 phb->ioda.m32_segmap[index] = pe->pe_number; in pnv_ioda_setup_pe_res()
2035 region.start += phb->ioda.m32_segsize; in pnv_ioda_setup_pe_res()
2100 for (pe_num = 0; pe_num < phb->ioda.total_pe_num; pe_num++) { in pnv_pci_ioda_pe_dump()
2101 struct pnv_ioda_pe *pe = &phb->ioda.pe_array[pe_num]; in pnv_pci_ioda_pe_dump()
2103 if (!test_bit(pe_num, phb->ioda.pe_alloc)) in pnv_pci_ioda_pe_dump()
2226 if (phb->ioda.m64_segsize && pnv_pci_is_m64_flags(type)) in pnv_pci_window_alignment()
2227 return phb->ioda.m64_segsize; in pnv_pci_window_alignment()
2229 return phb->ioda.m32_segsize; in pnv_pci_window_alignment()
2231 return phb->ioda.io_segsize; in pnv_pci_window_alignment()
2268 phb->ioda.m64_segsize) in pnv_pci_fixup_bridge_resources()
2386 for (idx = 0; idx < phb->ioda.total_pe_num; idx++) { in pnv_ioda_free_pe_seg()
2391 phb->ioda.reserved_pe_idx, win, 0, idx); in pnv_ioda_free_pe_seg()
2407 phb->ioda.m32_segmap); in pnv_ioda_release_pe_seg()
2418 mutex_lock(&phb->ioda.pe_list_mutex); in pnv_ioda_release_pe()
2420 mutex_unlock(&phb->ioda.pe_list_mutex); in pnv_ioda_release_pe()
2449 if (phb->ioda.root_pe_idx == pe->pe_number) in pnv_ioda_release_pe()
2486 pe = &phb->ioda.pe_array[pdn->pe_number]; in pnv_pci_release_device()
2507 list_for_each_entry(pe, &phb->ioda.pe_list, list) { in pnv_pci_ioda_dma_bus_setup()
2622 mutex_init(&phb->ioda.pe_alloc_mutex); in pnv_pci_init_ioda_phb()
2656 phb->ioda.total_pe_num = 1; in pnv_pci_init_ioda_phb()
2659 phb->ioda.total_pe_num = be32_to_cpup(prop32); in pnv_pci_init_ioda_phb()
2662 phb->ioda.reserved_pe_idx = be32_to_cpup(prop32); in pnv_pci_init_ioda_phb()
2665 for (segno = 0; segno < ARRAY_SIZE(phb->ioda.pe_rmap); segno++) in pnv_pci_init_ioda_phb()
2666 phb->ioda.pe_rmap[segno] = IODA_INVALID_PE; in pnv_pci_init_ioda_phb()
2671 phb->ioda.m32_size = resource_size(&hose->mem_resources[0]); in pnv_pci_init_ioda_phb()
2673 phb->ioda.m32_size += 0x10000; in pnv_pci_init_ioda_phb()
2675 phb->ioda.m32_segsize = phb->ioda.m32_size / phb->ioda.total_pe_num; in pnv_pci_init_ioda_phb()
2676 phb->ioda.m32_pci_base = hose->mem_resources[0].start - hose->mem_offset[0]; in pnv_pci_init_ioda_phb()
2677 phb->ioda.io_size = hose->pci_io_size; in pnv_pci_init_ioda_phb()
2678 phb->ioda.io_segsize = phb->ioda.io_size / phb->ioda.total_pe_num; in pnv_pci_init_ioda_phb()
2679 phb->ioda.io_pci_base = 0; /* XXX calculate this ? */ in pnv_pci_init_ioda_phb()
2682 size = ALIGN(max_t(unsigned, phb->ioda.total_pe_num, 8) / 8, in pnv_pci_init_ioda_phb()
2685 size += phb->ioda.total_pe_num * sizeof(phb->ioda.m64_segmap[0]); in pnv_pci_init_ioda_phb()
2687 size += phb->ioda.total_pe_num * sizeof(phb->ioda.m32_segmap[0]); in pnv_pci_init_ioda_phb()
2689 size += phb->ioda.total_pe_num * sizeof(struct pnv_ioda_pe); in pnv_pci_init_ioda_phb()
2694 phb->ioda.pe_alloc = aux; in pnv_pci_init_ioda_phb()
2695 phb->ioda.m64_segmap = aux + m64map_off; in pnv_pci_init_ioda_phb()
2696 phb->ioda.m32_segmap = aux + m32map_off; in pnv_pci_init_ioda_phb()
2697 for (segno = 0; segno < phb->ioda.total_pe_num; segno++) { in pnv_pci_init_ioda_phb()
2698 phb->ioda.m64_segmap[segno] = IODA_INVALID_PE; in pnv_pci_init_ioda_phb()
2699 phb->ioda.m32_segmap[segno] = IODA_INVALID_PE; in pnv_pci_init_ioda_phb()
2701 phb->ioda.pe_array = aux + pemap_off; in pnv_pci_init_ioda_phb()
2708 pnv_ioda_reserve_pe(phb, phb->ioda.reserved_pe_idx); in pnv_pci_init_ioda_phb()
2709 if (phb->ioda.reserved_pe_idx == 0) { in pnv_pci_init_ioda_phb()
2710 phb->ioda.root_pe_idx = 1; in pnv_pci_init_ioda_phb()
2711 pnv_ioda_reserve_pe(phb, phb->ioda.root_pe_idx); in pnv_pci_init_ioda_phb()
2712 } else if (phb->ioda.reserved_pe_idx == (phb->ioda.total_pe_num - 1)) { in pnv_pci_init_ioda_phb()
2713 phb->ioda.root_pe_idx = phb->ioda.reserved_pe_idx - 1; in pnv_pci_init_ioda_phb()
2714 pnv_ioda_reserve_pe(phb, phb->ioda.root_pe_idx); in pnv_pci_init_ioda_phb()
2718 phb->ioda.root_pe_idx = root_pe->pe_number; in pnv_pci_init_ioda_phb()
2721 INIT_LIST_HEAD(&phb->ioda.pe_list); in pnv_pci_init_ioda_phb()
2722 mutex_init(&phb->ioda.pe_list_mutex); in pnv_pci_init_ioda_phb()
2734 phb->ioda.total_pe_num, phb->ioda.reserved_pe_idx, in pnv_pci_init_ioda_phb()
2735 phb->ioda.m32_size, phb->ioda.m32_segsize); in pnv_pci_init_ioda_phb()
2736 if (phb->ioda.m64_size) in pnv_pci_init_ioda_phb()
2738 phb->ioda.m64_size, phb->ioda.m64_segsize); in pnv_pci_init_ioda_phb()
2739 if (phb->ioda.io_size) in pnv_pci_init_ioda_phb()
2741 phb->ioda.io_size, phb->ioda.io_segsize); in pnv_pci_init_ioda_phb()