list_add(&ca_dmamap->cad_list, &tioca_kern->ca_list); 
list_add(&ca_dmamap->cad_list, &tioca_kern->ca_dmamaps); 
tioca_dma_mapped(struct pci_dev *pdev, uint64_t paddr, size_t req_size){	int i, ps, ps_shift, entry, entries, mapsize, last_entry;	uint64_t xio_addr, end_xio_addr;	struct tioca_common *tioca_common;	struct tioca_kernel *tioca_kern;	dma_addr_t bus_addr = 0;	struct tioca_dmamap *ca_dmamap;	void *map;	unsigned long flags;	struct pcidev_info *pcidev_info = SN_PCIDEV_INFO(pdev);;	tioca_common = (struct tioca_common *)pcidev_info->pdi_pcibus_info;	tioca_kern = (struct tioca_kernel *)tioca_common->ca_kernel_private;	xio_addr = PHYS_TO_TIODMA(paddr);	if (!xio_addr)		return 0;	spin_lock_irqsave(&tioca_kern->ca_lock, flags);	/*	 * allocate a map struct	 */	ca_dmamap = kcalloc(1, sizeof(struct tioca_dmamap), GFP_ATOMIC);	if (!ca_dmamap)		goto map_return;	/*	 * Locate free entries that can hold req_size.  Account for	 * unaligned start/length when allocating.	 */	ps = tioca_kern->ca_ap_pagesize;	/* will be power of 2 */	ps_shift = ffs(ps) - 1;	end_xio_addr = xio_addr + req_size - 1;	entries = (end_xio_addr >> ps_shift) - (xio_addr >> ps_shift) + 1;	map = tioca_kern->ca_pcigart_pagemap;	mapsize = tioca_kern->ca_pcigart_entries;	entry = find_first_zero_bit(map, mapsize);	while (entry < mapsize) {		last_entry = find_next_bit(map, mapsize, entry);		if (last_entry - entry >= entries)			break;		entry = find_next_zero_bit(map, mapsize, last_entry);	}	if (entry > mapsize)		goto map_return;	for (i = 0; i < entries; i++)		set_bit(entry + i, map);	bus_addr = tioca_kern->ca_pciap_base + (entry * ps);	ca_dmamap->cad_dma_addr = bus_addr;	ca_dmamap->cad_gart_size = entries;	ca_dmamap->cad_gart_entry = entry;	list_add(&ca_dmamap->cad_list, &tioca_kern->ca_list);	if (xio_addr % ps) {		tioca_kern->ca_pcigart[entry] = tioca_paddr_to_gart(xio_addr);		bus_addr += xio_addr & (ps - 1);		xio_addr &= ~(ps - 1);		xio_addr += ps;		entry++;	}	while (xio_addr < end_xio_addr) {		tioca_kern->ca_pcigart[entry] = tioca_paddr_to_gart(xio_addr);		xio_addr += ps;		entry++;	}	tioca_tlbflush(tioca_kern);map_return:	spin_unlock_irqrestore(&tioca_kern->ca_lock, flags);	return bus_addr;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/3ea8b477b4b9d3e75b5e9b8aea41259f45031823/tioca_provider.c/clean/arch/ia64/sn/pci/tioca_provider.c