• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6/drivers/parisc/

Lines Matching defs:ioc

224 struct ioc {
252 struct ioc *next; /* Linked list of discovered iocs */
254 unsigned int hw_path; /* the hardware path this ioc is associatd with */
259 static struct ioc *ioc_list;
294 #define CCIO_SEARCH_LOOP(ioc, res_idx, mask, size) \
298 idx = (unsigned int)((unsigned long)res_ptr - (unsigned long)ioc->res_map); \
303 ioc->res_hint = res_idx + (size >> 3); \
309 u##size *res_ptr = (u##size *)&((ioc)->res_map[ioa->res_hint & ~((size >> 3) - 1)]); \
310 u##size *res_end = (u##size *)&(ioc)->res_map[ioa->res_size]; \
311 CCIO_SEARCH_LOOP(ioc, res_idx, mask, size); \
312 res_ptr = (u##size *)&(ioc)->res_map[0]; \
330 * ccio_alloc_range - Allocate pages in the ioc's resource map.
331 * @ioc: The I/O Controller.
335 * This function searches the resource map of the ioc to locate a range
339 ccio_alloc_range(struct ioc *ioc, struct device *dev, size_t size)
368 CCIO_FIND_FREE_MAPPING(ioc, res_idx, 0xff, 8);
370 CCIO_FIND_FREE_MAPPING(ioc, res_idx, 0xffff, 16);
372 CCIO_FIND_FREE_MAPPING(ioc, res_idx, ~(unsigned int)0, 32);
375 CCIO_FIND_FREE_MAPPING(ioc, res_idx, ~0UL, 64);
388 __func__, res_idx, ioc->res_hint);
397 ioc->avg_search[ioc->avg_idx++] = cr_start;
398 ioc->avg_idx &= CCIO_SEARCH_SAMPLE - 1;
399 ioc->used_pages += pages_needed;
407 #define CCIO_FREE_MAPPINGS(ioc, res_idx, mask, size) \
408 u##size *res_ptr = (u##size *)&((ioc)->res_map[res_idx]); \
413 * ccio_free_range - Free pages from the ioc's resource map.
414 * @ioc: The I/O Controller.
422 ccio_free_range(struct ioc *ioc, dma_addr_t iova, unsigned long pages_mapped)
435 ioc->used_pages -= pages_mapped;
439 CCIO_FREE_MAPPINGS(ioc, res_idx, 0xffUL, 8);
441 CCIO_FREE_MAPPINGS(ioc, res_idx, 0xffffUL, 16);
443 CCIO_FREE_MAPPINGS(ioc, res_idx, ~(unsigned int)0, 32);
446 CCIO_FREE_MAPPINGS(ioc, res_idx, ~0UL, 64);
568 ccio_clear_io_tlb(struct ioc *ioc, dma_addr_t iovp, size_t byte_cnt)
570 u32 chain_size = 1 << ioc->chainid_shift;
576 WRITE_U32(CMD_TLB_PURGE | iovp, &ioc->ioc_regs->io_command);
583 ccio_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
594 char *pdir_ptr = (char *) &(ioc->pdir_base[idx]);
596 BUG_ON(idx >= (ioc->pdir_size / sizeof(u64)));
605 ccio_clear_io_tlb(ioc, CCIO_IOVP(iova), saved_byte_cnt);
648 struct ioc *ioc;
656 ioc = GET_IOC(dev);
665 spin_lock_irqsave(&ioc->res_lock, flags);
668 ioc->msingle_calls++;
669 ioc->msingle_pages += size >> IOVP_SHIFT;
672 idx = ccio_alloc_range(ioc, dev, size);
675 pdir_start = &(ioc->pdir_base[idx]);
696 spin_unlock_irqrestore(&ioc->res_lock, flags);
715 struct ioc *ioc;
720 ioc = GET_IOC(dev);
729 spin_lock_irqsave(&ioc->res_lock, flags);
732 ioc->usingle_calls++;
733 ioc->usingle_pages += size >> IOVP_SHIFT;
736 ccio_mark_invalid(ioc, iova, size);
737 ccio_free_range(ioc, iova, (size >> IOVP_SHIFT));
738 spin_unlock_irqrestore(&ioc->res_lock, flags);
805 struct ioc *ioc;
813 ioc = GET_IOC(dev);
829 spin_lock_irqsave(&ioc->res_lock, flags);
832 ioc->msg_calls++;
843 coalesced = iommu_coalesce_chunks(ioc, dev, sglist, nents, ccio_alloc_range);
853 filled = iommu_fill_pdir(ioc, sglist, nents, hint, ccio_io_pdir_entry);
855 spin_unlock_irqrestore(&ioc->res_lock, flags);
882 struct ioc *ioc;
885 ioc = GET_IOC(dev);
891 ioc->usg_calls++;
897 ioc->usg_pages += sg_dma_len(sglist) >> PAGE_SHIFT;
926 struct ioc *ioc = ioc_list;
928 while (ioc != NULL) {
929 unsigned int total_pages = ioc->res_size << 3;
935 len += seq_printf(m, "%s\n", ioc->name);
938 (ioc->cujo20_bug ? "yes" : "no"));
945 total_pages - ioc->used_pages, ioc->used_pages,
946 (int)(ioc->used_pages * 100 / total_pages));
950 ioc->res_size, total_pages);
953 min = max = ioc->avg_search[0];
955 avg += ioc->avg_search[j];
956 if(ioc->avg_search[j] > max)
957 max = ioc->avg_search[j];
958 if(ioc->avg_search[j] < min)
959 min = ioc->avg_search[j];
966 ioc->msingle_calls, ioc->msingle_pages,
967 (int)((ioc->msingle_pages * 1000)/ioc->msingle_calls));
970 min = ioc->usingle_calls - ioc->usg_calls;
971 max = ioc->usingle_pages - ioc->usg_pages;
976 ioc->msg_calls, ioc->msg_pages,
977 (int)((ioc->msg_pages * 1000)/ioc->msg_calls));
980 ioc->usg_calls, ioc->usg_pages,
981 (int)((ioc->usg_pages * 1000)/ioc->usg_calls));
984 ioc = ioc->next;
1006 struct ioc *ioc = ioc_list;
1008 while (ioc != NULL) {
1009 u32 *res_ptr = (u32 *)ioc->res_map;
1012 for (j = 0; j < (ioc->res_size / sizeof(u32)); j++) {
1019 ioc = ioc->next;
1041 * ccio_find_ioc - Find the ioc in the ioc_list
1042 * @hw_path: The hardware path of the ioc.
1044 * This function searches the ioc_list for an ioc that matches
1047 static struct ioc * ccio_find_ioc(int hw_path)
1050 struct ioc *ioc;
1052 ioc = ioc_list;
1054 if (ioc->hw_path == hw_path)
1055 return ioc;
1057 ioc = ioc->next;
1089 struct ioc *ioc = ccio_get_iommu(dev);
1092 ioc->cujo20_bug = 1;
1093 res_ptr = ioc->res_map;
1096 while (idx < ioc->res_size) {
1124 * @ioc: The I/O Controller.
1131 ccio_ioc_init(struct ioc *ioc)
1178 ioc->pdir_size = (iova_space_size / IOVP_SIZE) * sizeof(u64);
1180 BUG_ON(ioc->pdir_size > 8 * 1024 * 1024); /* max pdir size <= 8MB */
1183 BUG_ON((1 << get_order(ioc->pdir_size)) != (ioc->pdir_size >> PAGE_SHIFT));
1186 __func__, ioc->ioc_regs,
1191 ioc->pdir_base = (u64 *)__get_free_pages(GFP_KERNEL,
1192 get_order(ioc->pdir_size));
1193 if(NULL == ioc->pdir_base) {
1196 memset(ioc->pdir_base, 0, ioc->pdir_size);
1198 BUG_ON((((unsigned long)ioc->pdir_base) & PAGE_MASK) != (unsigned long)ioc->pdir_base);
1199 DBG_INIT(" base %p\n", ioc->pdir_base);
1202 ioc->res_size = (ioc->pdir_size / sizeof(u64)) >> 3;
1203 DBG_INIT("%s() res_size 0x%x\n", __func__, ioc->res_size);
1205 ioc->res_map = (u8 *)__get_free_pages(GFP_KERNEL,
1206 get_order(ioc->res_size));
1207 if(NULL == ioc->res_map) {
1210 memset(ioc->res_map, 0, ioc->res_size);
1213 ioc->res_hint = 16;
1216 spin_lock_init(&ioc->res_lock);
1222 ioc->chainid_shift = get_order(iova_space_size) + PAGE_SHIFT - CCIO_CHAINID_SHIFT;
1223 DBG_INIT(" chainid_shift 0x%x\n", ioc->chainid_shift);
1228 WRITE_U32(CCIO_CHAINID_MASK << ioc->chainid_shift,
1229 &ioc->ioc_regs->io_chain_id_mask);
1231 WRITE_U32(virt_to_phys(ioc->pdir_base),
1232 &ioc->ioc_regs->io_pdir_base);
1237 WRITE_U32(IOA_NORMAL_MODE, &ioc->ioc_regs->io_control);
1242 WRITE_U32(0, &ioc->ioc_regs->io_tlb_entry_m);
1243 WRITE_U32(0, &ioc->ioc_regs->io_tlb_entry_l);
1246 WRITE_U32((CMD_TLB_DIRECT_WRITE | (i << ioc->chainid_shift)),
1247 &ioc->ioc_regs->io_command);
1284 static void __init ccio_init_resources(struct ioc *ioc)
1286 struct resource *res = ioc->mmio_region;
1289 snprintf(name, 14, "GSC Bus [%d/]", ioc->hw_path);
1291 ccio_init_resource(res, name, &ioc->ioc_regs->io_io_low);
1292 ccio_init_resource(res + 1, name, &ioc->ioc_regs->io_io_low_hv);
1344 * Some other issues: one of the resources in the ioc may be unassigned.
1351 struct ioc *ioc = ccio_get_iommu(dev);
1352 if (!ioc)
1355 parent = ioc->mmio_region;
1367 &ioc->ioc_regs->io_io_low);
1369 &ioc->ioc_regs->io_io_high);
1373 &ioc->ioc_regs->io_io_low_hv);
1375 &ioc->ioc_regs->io_io_high_hv);
1388 struct ioc *ioc = ccio_get_iommu(dev);
1390 if (!ioc) {
1392 } else if ((ioc->mmio_region->start <= res->start) &&
1393 (res->end <= ioc->mmio_region->end)) {
1394 parent = ioc->mmio_region;
1395 } else if (((ioc->mmio_region + 1)->start <= res->start) &&
1396 (res->end <= (ioc->mmio_region + 1)->end)) {
1397 parent = ioc->mmio_region + 1;
1421 struct ioc *ioc, **ioc_p = &ioc_list;
1423 ioc = kzalloc(sizeof(struct ioc), GFP_KERNEL);
1424 if (ioc == NULL) {
1429 ioc->name = dev->id.hversion == U2_IOA_RUNWAY ? "U2" : "UTurn";
1431 printk(KERN_INFO "Found %s at 0x%lx\n", ioc->name,
1437 *ioc_p = ioc;
1439 ioc->hw_path = dev->hw_path;
1440 ioc->ioc_regs = ioremap_nocache(dev->hpa.start, 4096);
1441 ccio_ioc_init(ioc);
1442 ccio_init_resources(ioc);
1448 HBA_DATA(dev->dev.platform_data)->iommu = ioc;