ctx = iommu->iommu_cur_ctx++; 
ctx = iommu_alloc_ctx(iommu); 
dma_addr_t pci_map_single(struct pci_dev *pdev, void *ptr, size_t sz, int direction){	struct pcidev_cookie *pcp;	struct pci_iommu *iommu;	struct pci_strbuf *strbuf;	iopte_t *base;	unsigned long flags, npages, oaddr;	unsigned long i, base_paddr, ctx;	u32 bus_addr, ret;	unsigned long iopte_protection;	pcp = pdev->sysdata;	iommu = pcp->pbm->iommu;	strbuf = &pcp->pbm->stc;	if (direction == PCI_DMA_NONE)		BUG();	oaddr = (unsigned long)ptr;	npages = IO_PAGE_ALIGN(oaddr + sz) - (oaddr & IO_PAGE_MASK);	npages >>= IO_PAGE_SHIFT;	spin_lock_irqsave(&iommu->lock, flags);	base = alloc_streaming_cluster(iommu, npages);	if (base == NULL)		goto bad;	bus_addr = (iommu->page_table_map_base +		    ((base - iommu->page_table) << IO_PAGE_SHIFT));	ret = bus_addr | (oaddr & ~IO_PAGE_MASK);	base_paddr = __pa(oaddr & IO_PAGE_MASK);	ctx = 0;	if (iommu->iommu_ctxflush)		ctx = iommu->iommu_cur_ctx++;	if (strbuf->strbuf_enabled)		iopte_protection = IOPTE_STREAMING(ctx);	else		iopte_protection = IOPTE_CONSISTENT(ctx);	if (direction != PCI_DMA_TODEVICE)		iopte_protection |= IOPTE_WRITE;	for (i = 0; i < npages; i++, base++, base_paddr += IO_PAGE_SIZE)		iopte_val(*base) = iopte_protection | base_paddr;	spin_unlock_irqrestore(&iommu->lock, flags);	return ret;bad:	spin_unlock_irqrestore(&iommu->lock, flags);	return PCI_DMA_ERROR_CODE;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/7c963ad1d113790a8c723a178988b675868f3abe/pci_iommu.c/buggy/arch/sparc64/kernel/pci_iommu.c