Lines Matching refs:ioda
123 phb->ioda.pe_array[pe_no].phb = phb; in pnv_ioda_init_pe()
124 phb->ioda.pe_array[pe_no].pe_number = pe_no; in pnv_ioda_init_pe()
125 phb->ioda.pe_array[pe_no].dma_setup_done = false; in pnv_ioda_init_pe()
138 return &phb->ioda.pe_array[pe_no]; in pnv_ioda_init_pe()
143 if (!(pe_no >= 0 && pe_no < phb->ioda.total_pe_num)) { in pnv_ioda_reserve_pe()
149 mutex_lock(&phb->ioda.pe_alloc_mutex); in pnv_ioda_reserve_pe()
150 if (test_and_set_bit(pe_no, phb->ioda.pe_alloc)) in pnv_ioda_reserve_pe()
153 mutex_unlock(&phb->ioda.pe_alloc_mutex); in pnv_ioda_reserve_pe()
163 mutex_lock(&phb->ioda.pe_alloc_mutex); in pnv_ioda_alloc_pe()
166 for (pe = phb->ioda.total_pe_num - 1; pe >= 0; pe--) { in pnv_ioda_alloc_pe()
167 if (test_bit(pe, phb->ioda.pe_alloc)) { in pnv_ioda_alloc_pe()
180 set_bit(i, phb->ioda.pe_alloc); in pnv_ioda_alloc_pe()
183 ret = &phb->ioda.pe_array[pe]; in pnv_ioda_alloc_pe()
186 mutex_unlock(&phb->ioda.pe_alloc_mutex); in pnv_ioda_alloc_pe()
198 mutex_lock(&phb->ioda.pe_alloc_mutex); in pnv_ioda_free_pe()
199 clear_bit(pe_num, phb->ioda.pe_alloc); in pnv_ioda_free_pe()
200 mutex_unlock(&phb->ioda.pe_alloc_mutex); in pnv_ioda_free_pe()
213 phb->ioda.m64_bar_idx, in pnv_ioda2_init_m64()
214 phb->ioda.m64_base, in pnv_ioda2_init_m64()
216 phb->ioda.m64_size); in pnv_ioda2_init_m64()
225 phb->ioda.m64_bar_idx, in pnv_ioda2_init_m64()
237 if (phb->ioda.reserved_pe_idx == 0) in pnv_ioda2_init_m64()
238 r->start += (2 * phb->ioda.m64_segsize); in pnv_ioda2_init_m64()
239 else if (phb->ioda.reserved_pe_idx == (phb->ioda.total_pe_num - 1)) in pnv_ioda2_init_m64()
240 r->end -= (2 * phb->ioda.m64_segsize); in pnv_ioda2_init_m64()
243 phb->ioda.reserved_pe_idx); in pnv_ioda2_init_m64()
249 rc, desc, phb->ioda.m64_bar_idx); in pnv_ioda2_init_m64()
252 phb->ioda.m64_bar_idx, in pnv_ioda2_init_m64()
265 base = phb->ioda.m64_base; in pnv_ioda_reserve_dev_m64_pe()
266 sgsz = phb->ioda.m64_segsize; in pnv_ioda_reserve_dev_m64_pe()
294 unsigned long base, segsz = phb->ioda.m64_segsize; in pnv_ioda1_init_m64()
297 base = phb->ioda.m64_base + in pnv_ioda1_init_m64()
318 for (index = 0; index < phb->ioda.total_pe_num; index++) { in pnv_ioda1_init_m64()
345 if (phb->ioda.reserved_pe_idx == 0) in pnv_ioda1_init_m64()
346 r->start += (2 * phb->ioda.m64_segsize); in pnv_ioda1_init_m64()
347 else if (phb->ioda.reserved_pe_idx == (phb->ioda.total_pe_num - 1)) in pnv_ioda1_init_m64()
348 r->end -= (2 * phb->ioda.m64_segsize); in pnv_ioda1_init_m64()
351 phb->ioda.reserved_pe_idx, phb->hose->global_number); in pnv_ioda1_init_m64()
390 size = ALIGN(phb->ioda.total_pe_num / 8, sizeof(unsigned long)); in pnv_ioda_pick_m64_pe()
406 if (bitmap_empty(pe_alloc, phb->ioda.total_pe_num)) { in pnv_ioda_pick_m64_pe()
417 while ((i = find_next_bit(pe_alloc, phb->ioda.total_pe_num, i + 1)) < in pnv_ioda_pick_m64_pe()
418 phb->ioda.total_pe_num) { in pnv_ioda_pick_m64_pe()
419 pe = &phb->ioda.pe_array[i]; in pnv_ioda_pick_m64_pe()
421 phb->ioda.m64_segmap[pe->pe_number] = pe->pe_number; in pnv_ioda_pick_m64_pe()
495 phb->ioda.m64_size = resource_size(res); in pnv_ioda_parse_m64_window()
496 phb->ioda.m64_segsize = phb->ioda.m64_size / phb->ioda.total_pe_num; in pnv_ioda_parse_m64_window()
497 phb->ioda.m64_base = pci_addr; in pnv_ioda_parse_m64_window()
505 phb->ioda.m64_bar_alloc = (unsigned long)-1; in pnv_ioda_parse_m64_window()
509 phb->ioda.m64_bar_idx = m64_range[0] + m64_range[1]; in pnv_ioda_parse_m64_window()
511 pr_info(" Using M64 #%d as default window\n", phb->ioda.m64_bar_idx); in pnv_ioda_parse_m64_window()
515 clear_bit(i, &phb->ioda.m64_bar_alloc); in pnv_ioda_parse_m64_window()
529 struct pnv_ioda_pe *pe = &phb->ioda.pe_array[pe_no]; in pnv_ioda_freeze_pe()
573 pe = &phb->ioda.pe_array[pe_no]; in pnv_ioda_unfreeze_pe()
615 if (pe_no < 0 || pe_no >= phb->ioda.total_pe_num) in pnv_ioda_get_pe_state()
622 pe = &phb->ioda.pe_array[pe_no]; in pnv_ioda_get_pe_state()
671 int pe_number = phb->ioda.pe_rmap[bdfn]; in pnv_pci_bdfn_to_pe()
676 return &phb->ioda.pe_array[pe_number]; in pnv_pci_bdfn_to_pe()
688 return &phb->ioda.pe_array[pdn->pe_number]; in pnv_ioda_get_pe()
783 parent = &phb->ioda.pe_array[pdn->pe_number]; in pnv_ioda_set_peltv()
871 phb->ioda.pe_rmap[rid] = IODA_INVALID_PE; in pnv_ioda_deconfigure_pe()
953 phb->ioda.pe_rmap[rid] = pe->pe_number; in pnv_ioda_configure_pe()
1027 mutex_lock(&phb->ioda.pe_list_mutex); in pnv_ioda_setup_dev_PE()
1028 list_add_tail(&pe->list, &phb->ioda.pe_list); in pnv_ioda_setup_dev_PE()
1029 mutex_unlock(&phb->ioda.pe_list_mutex); in pnv_ioda_setup_dev_PE()
1049 pe_num = phb->ioda.pe_rmap[bus->number << 8]; in pnv_ioda_setup_bus_PE()
1051 pe = &phb->ioda.pe_array[pe_num]; in pnv_ioda_setup_bus_PE()
1057 pe = &phb->ioda.pe_array[phb->ioda.root_pe_idx]; in pnv_ioda_setup_bus_PE()
1095 list_add_tail(&pe->list, &phb->ioda.pe_list); in pnv_ioda_setup_bus_PE()
1241 pe = &phb->ioda.pe_array[pdn->pe_number]; in pnv_pci_ioda_iommu_bypass_supported()
1524 segs = (weight * phb->ioda.dma32_count) / total_weight; in pnv_pci_ioda1_setup_dma_pe()
1535 for (base = 0; base <= phb->ioda.dma32_count - segs; base++) { in pnv_pci_ioda1_setup_dma_pe()
1537 if (phb->ioda.dma32_segmap[i] == in pnv_pci_ioda1_setup_dma_pe()
1602 phb->ioda.dma32_segmap[i] = pe->pe_number; in pnv_pci_ioda1_setup_dma_pe()
1778 if (window_size > pe->phb->ioda.m32_pci_base) { in pnv_pci_ioda2_setup_default_config()
1779 res_start = pe->phb->ioda.m32_pci_base >> tbl->it_page_shift; in pnv_pci_ioda2_setup_default_config()
1937 phb->ioda.m32_pci_base); in pnv_pci_ioda2_setup_dma_pe()
1941 pe->table_group.tce32_size = phb->ioda.m32_pci_base; in pnv_pci_ioda2_setup_dma_pe()
2002 if (!phb->ioda.irq_chip_init) { in pnv_set_msi_irq_chip()
2009 phb->ioda.irq_chip_init = 1; in pnv_set_msi_irq_chip()
2010 phb->ioda.irq_chip = *ichip; in pnv_set_msi_irq_chip()
2011 phb->ioda.irq_chip.irq_eoi = pnv_ioda2_msi_eoi; in pnv_set_msi_irq_chip()
2013 irq_set_chip(virq, &phb->ioda.irq_chip); in pnv_set_msi_irq_chip()
2332 region.start = res->start - phb->ioda.io_pci_base; in pnv_ioda_setup_pe_res()
2333 region.end = res->end - phb->ioda.io_pci_base; in pnv_ioda_setup_pe_res()
2334 index = region.start / phb->ioda.io_segsize; in pnv_ioda_setup_pe_res()
2336 while (index < phb->ioda.total_pe_num && in pnv_ioda_setup_pe_res()
2338 phb->ioda.io_segmap[index] = pe->pe_number; in pnv_ioda_setup_pe_res()
2347 region.start += phb->ioda.io_segsize; in pnv_ioda_setup_pe_res()
2354 phb->ioda.m32_pci_base; in pnv_ioda_setup_pe_res()
2357 phb->ioda.m32_pci_base; in pnv_ioda_setup_pe_res()
2358 index = region.start / phb->ioda.m32_segsize; in pnv_ioda_setup_pe_res()
2360 while (index < phb->ioda.total_pe_num && in pnv_ioda_setup_pe_res()
2362 phb->ioda.m32_segmap[index] = pe->pe_number; in pnv_ioda_setup_pe_res()
2371 region.start += phb->ioda.m32_segsize; in pnv_ioda_setup_pe_res()
2436 for (pe_num = 0; pe_num < phb->ioda.total_pe_num; pe_num++) { in pnv_pci_ioda_pe_dump()
2437 struct pnv_ioda_pe *pe = &phb->ioda.pe_array[pe_num]; in pnv_pci_ioda_pe_dump()
2439 if (!test_bit(pe_num, phb->ioda.pe_alloc)) in pnv_pci_ioda_pe_dump()
2562 if (phb->ioda.m64_segsize && pnv_pci_is_m64_flags(type)) in pnv_pci_window_alignment()
2563 return phb->ioda.m64_segsize; in pnv_pci_window_alignment()
2565 return phb->ioda.m32_segsize; in pnv_pci_window_alignment()
2567 return phb->ioda.io_segsize; in pnv_pci_window_alignment()
2604 phb->ioda.m64_segsize) in pnv_pci_fixup_bridge_resources()
2703 for (idx = 0; idx < phb->ioda.dma32_count; idx++) { in pnv_pci_ioda1_unset_window()
2704 if (phb->ioda.dma32_segmap[idx] != pe->pe_number) in pnv_pci_ioda1_unset_window()
2715 phb->ioda.dma32_segmap[idx] = IODA_INVALID_PE; in pnv_pci_ioda1_unset_window()
2773 for (idx = 0; idx < phb->ioda.total_pe_num; idx++) { in pnv_ioda_free_pe_seg()
2778 phb->ioda.reserved_pe_idx, win, 0, idx); in pnv_ioda_free_pe_seg()
2794 phb->ioda.io_segmap); in pnv_ioda_release_pe_seg()
2796 phb->ioda.m32_segmap); in pnv_ioda_release_pe_seg()
2800 phb->ioda.m32_segmap); in pnv_ioda_release_pe_seg()
2811 mutex_lock(&phb->ioda.pe_list_mutex); in pnv_ioda_release_pe()
2813 mutex_unlock(&phb->ioda.pe_list_mutex); in pnv_ioda_release_pe()
2845 if (phb->ioda.root_pe_idx == pe->pe_number) in pnv_ioda_release_pe()
2882 pe = &phb->ioda.pe_array[pdn->pe_number]; in pnv_pci_release_device()
2903 list_for_each_entry(pe, &phb->ioda.pe_list, list) { in pnv_pci_ioda_dma_bus_setup()
2995 mutex_init(&phb->ioda.pe_alloc_mutex); in pnv_pci_init_ioda_phb()
3029 phb->ioda.total_pe_num = 1; in pnv_pci_init_ioda_phb()
3032 phb->ioda.total_pe_num = be32_to_cpup(prop32); in pnv_pci_init_ioda_phb()
3035 phb->ioda.reserved_pe_idx = be32_to_cpup(prop32); in pnv_pci_init_ioda_phb()
3038 for (segno = 0; segno < ARRAY_SIZE(phb->ioda.pe_rmap); segno++) in pnv_pci_init_ioda_phb()
3039 phb->ioda.pe_rmap[segno] = IODA_INVALID_PE; in pnv_pci_init_ioda_phb()
3044 phb->ioda.m32_size = resource_size(&hose->mem_resources[0]); in pnv_pci_init_ioda_phb()
3046 phb->ioda.m32_size += 0x10000; in pnv_pci_init_ioda_phb()
3048 phb->ioda.m32_segsize = phb->ioda.m32_size / phb->ioda.total_pe_num; in pnv_pci_init_ioda_phb()
3049 phb->ioda.m32_pci_base = hose->mem_resources[0].start - hose->mem_offset[0]; in pnv_pci_init_ioda_phb()
3050 phb->ioda.io_size = hose->pci_io_size; in pnv_pci_init_ioda_phb()
3051 phb->ioda.io_segsize = phb->ioda.io_size / phb->ioda.total_pe_num; in pnv_pci_init_ioda_phb()
3052 phb->ioda.io_pci_base = 0; /* XXX calculate this ? */ in pnv_pci_init_ioda_phb()
3055 phb->ioda.dma32_count = phb->ioda.m32_pci_base / in pnv_pci_init_ioda_phb()
3059 size = ALIGN(max_t(unsigned, phb->ioda.total_pe_num, 8) / 8, in pnv_pci_init_ioda_phb()
3062 size += phb->ioda.total_pe_num * sizeof(phb->ioda.m64_segmap[0]); in pnv_pci_init_ioda_phb()
3064 size += phb->ioda.total_pe_num * sizeof(phb->ioda.m32_segmap[0]); in pnv_pci_init_ioda_phb()
3067 size += phb->ioda.total_pe_num * sizeof(phb->ioda.io_segmap[0]); in pnv_pci_init_ioda_phb()
3069 size += phb->ioda.dma32_count * in pnv_pci_init_ioda_phb()
3070 sizeof(phb->ioda.dma32_segmap[0]); in pnv_pci_init_ioda_phb()
3073 size += phb->ioda.total_pe_num * sizeof(struct pnv_ioda_pe); in pnv_pci_init_ioda_phb()
3078 phb->ioda.pe_alloc = aux; in pnv_pci_init_ioda_phb()
3079 phb->ioda.m64_segmap = aux + m64map_off; in pnv_pci_init_ioda_phb()
3080 phb->ioda.m32_segmap = aux + m32map_off; in pnv_pci_init_ioda_phb()
3081 for (segno = 0; segno < phb->ioda.total_pe_num; segno++) { in pnv_pci_init_ioda_phb()
3082 phb->ioda.m64_segmap[segno] = IODA_INVALID_PE; in pnv_pci_init_ioda_phb()
3083 phb->ioda.m32_segmap[segno] = IODA_INVALID_PE; in pnv_pci_init_ioda_phb()
3086 phb->ioda.io_segmap = aux + iomap_off; in pnv_pci_init_ioda_phb()
3087 for (segno = 0; segno < phb->ioda.total_pe_num; segno++) in pnv_pci_init_ioda_phb()
3088 phb->ioda.io_segmap[segno] = IODA_INVALID_PE; in pnv_pci_init_ioda_phb()
3090 phb->ioda.dma32_segmap = aux + dma32map_off; in pnv_pci_init_ioda_phb()
3091 for (segno = 0; segno < phb->ioda.dma32_count; segno++) in pnv_pci_init_ioda_phb()
3092 phb->ioda.dma32_segmap[segno] = IODA_INVALID_PE; in pnv_pci_init_ioda_phb()
3094 phb->ioda.pe_array = aux + pemap_off; in pnv_pci_init_ioda_phb()
3101 pnv_ioda_reserve_pe(phb, phb->ioda.reserved_pe_idx); in pnv_pci_init_ioda_phb()
3102 if (phb->ioda.reserved_pe_idx == 0) { in pnv_pci_init_ioda_phb()
3103 phb->ioda.root_pe_idx = 1; in pnv_pci_init_ioda_phb()
3104 pnv_ioda_reserve_pe(phb, phb->ioda.root_pe_idx); in pnv_pci_init_ioda_phb()
3105 } else if (phb->ioda.reserved_pe_idx == (phb->ioda.total_pe_num - 1)) { in pnv_pci_init_ioda_phb()
3106 phb->ioda.root_pe_idx = phb->ioda.reserved_pe_idx - 1; in pnv_pci_init_ioda_phb()
3107 pnv_ioda_reserve_pe(phb, phb->ioda.root_pe_idx); in pnv_pci_init_ioda_phb()
3111 phb->ioda.root_pe_idx = root_pe->pe_number; in pnv_pci_init_ioda_phb()
3114 INIT_LIST_HEAD(&phb->ioda.pe_list); in pnv_pci_init_ioda_phb()
3115 mutex_init(&phb->ioda.pe_list_mutex); in pnv_pci_init_ioda_phb()
3118 phb->ioda.dma32_count = phb->ioda.m32_pci_base / in pnv_pci_init_ioda_phb()
3131 phb->ioda.total_pe_num, phb->ioda.reserved_pe_idx, in pnv_pci_init_ioda_phb()
3132 phb->ioda.m32_size, phb->ioda.m32_segsize); in pnv_pci_init_ioda_phb()
3133 if (phb->ioda.m64_size) in pnv_pci_init_ioda_phb()
3135 phb->ioda.m64_size, phb->ioda.m64_segsize); in pnv_pci_init_ioda_phb()
3136 if (phb->ioda.io_size) in pnv_pci_init_ioda_phb()
3138 phb->ioda.io_size, phb->ioda.io_segsize); in pnv_pci_init_ioda_phb()