kernels/linux-2.4.0/arch/ia64/sn/io/pci_dma.c
/*
 * We map this to the one step pciio_dmamap_trans interface rather than
 * the two step pciio_dmamap_alloc/pciio_dmamap_addr because we have
 * no way of saving the dmamap handle from the alloc to later free
 * (which is pretty much unacceptable).
 *
 * TODO: simplify our interface;
 *       get rid of dev_desc and vhdl (seems redundant given a pci_dev);
 *       figure out how to save dmamap handle so can use two step.
 */
We map this to the one step pciio_dmamap_trans interface rather than
the two step pciio_dmamap_alloc/pciio_dmamap_addr because we have
no way of saving the dmamap handle from the alloc to later free
(which is pretty much unacceptable).

simplify our interface;
get rid of dev_desc and vhdl ;
figure out how to save dmamap handle so can use two step.
We map this to the one step pciio_dmamap_trans interface rather than the two step pciio_dmamap_alloc / pciio_dmamap_addr because we have no way of saving the dmamap handle from the alloc to later free ( which is pretty much unacceptable ) . simplify our interface ; get rid of dev_desc and vhdl ; figure out how to save dmamap handle so can use two step .
dma_addr_t sn1_pci_map_single (struct pci_dev *hwdev,
				void *ptr, size_t size, int direction)
{
	devfs_handle_t	vhdl;
	dma_addr_t dma_addr;
	paddr_t temp_ptr;
	struct sn1_device_sysdata *device_sysdata;
	if (direction == PCI_DMA_NONE)
		BUG();
	if (IS_PCI32L(hwdev)) {
		return ((dma_addr_t) NULL);
	}
	device_sysdata = (struct sn1_device_sysdata *)hwdev->sysdata;
	vhdl = device_sysdata->vhdl;
	dma_addr = 0;
	temp_ptr = (paddr_t) __pa(ptr);
	if (IS_PCIA64(hwdev)) {
		dma_addr = (dma_addr_t) pciio_dmatrans_addr(vhdl, NULL,
			temp_ptr, size,
			PCIBR_BARRIER | PCIIO_BYTE_STREAM | PCIIO_DMA_CMD
			| PCIIO_DMA_A64 );
		return (dma_addr);
	}
	if (IS_PCI32G(hwdev)) {
		dma_addr = (dma_addr_t) pciio_dmatrans_addr(vhdl, NULL,
			temp_ptr, size,
			PCIBR_BARRIER | PCIIO_BYTE_STREAM | PCIIO_DMA_CMD);
		if (dma_addr) {
			return (dma_addr);
		} else {
			printk("pci_map_single: 32Bits DMA Page Map support not available yet!");
			BUG();
		}
	}
	if (IS_PCI32L(hwdev)) {
		return ((dma_addr_t) NULL);
	}
	return ((dma_addr_t) NULL);
}
dma_addr_t sn1_pci_map_single ( struct pci_dev * hwdev , void * ptr , size_t size , int direction ) { devfs_handle_t vhdl ; dma_addr_t dma_addr ; paddr_t temp_ptr ; struct sn1_device_sysdata * device_sysdata ; if ( direction == PCI_DMA_NONE ) BUG ( ) ; if ( IS_PCI32L ( hwdev ) ) { return ( ( dma_addr_t ) NULL ) ; } device_sysdata = ( struct sn1_device_sysdata * ) hwdev -> sysdata ; vhdl = device_sysdata -> vhdl ; dma_addr = 0 ; temp_ptr = ( paddr_t ) __pa ( ptr ) ; if ( IS_PCIA64 ( hwdev ) ) { dma_addr = ( dma_addr_t ) pciio_dmatrans_addr ( vhdl , NULL , temp_ptr , size , PCIBR_BARRIER | PCIIO_BYTE_STREAM | PCIIO_DMA_CMD | PCIIO_DMA_A64 ) ; return ( dma_addr ) ; } if ( IS_PCI32G ( hwdev ) ) { dma_addr = ( dma_addr_t ) pciio_dmatrans_addr ( vhdl , NULL , temp_ptr , size , PCIBR_BARRIER | PCIIO_BYTE_STREAM | PCIIO_DMA_CMD ) ; if ( dma_addr ) { return ( dma_addr ) ; } else { printk ( " " ) ; BUG ( ) ; } } if ( IS_PCI32L ( hwdev ) ) { return ( ( dma_addr_t ) NULL ) ; } return ( ( dma_addr_t ) NULL ) ; }
We map this to the one step pciio_dmamap_trans interface rather than
 the two step pciio_dmamap_alloc/pciio_dmamap_addr because we have
 no way of saving the dmamap handle from the alloc to later free
 (which is pretty much unacceptable).
We map this to the one step pciio_dmamap_trans interface rather than the two step pciio_dmamap_alloc / pciio_dmamap_addr because we have no way of saving the dmamap handle from the alloc to later free ( which is pretty much unacceptable ) .
/*
		 * SNIA64 cannot support DMA Addresses smaller than 32 bits.
		 */ /*
	 * find vertex for the device
	 */ /* printk("pci_map_single: Called vhdl = 0x%p ptr = 0x%p size = %d\n", vhdl, ptr, size); */ /*
	 * Call our dmamap interface
	 */ /*
		 * This device supports 64bits DMA addresses.
		 */ /* printk("pci_map_single: 64Bit pciio_dmatrans_addr pcidev %p returns dma_addr 0x%lx\n", hwdev, dma_addr); */ /*
	 * Devices that supports 32 Bits upto 63 Bits DMA Address gets
	 * 32 Bits DMA addresses.
	 *
	 * First try to get 32 Bit Direct Map Support.
	 */ /* printk("pci_map_single: 32Bit direct pciio_dmatrans_addr pcidev %p returns dma_addr 0x%lx\n", hwdev, dma_addr); */ /*
			 * We need to map this request by using ATEs.
			 */ /*
		 * SNIA64 cannot support DMA Addresses smaller than 32 bits.
		 */