kernels/linux-2.4.0/arch/ia64/sn/io/pci_dma.c
/*
 * On sn1 we use the alt_address entry of the scatterlist to store
 * the physical address corresponding to the given virtual address
 */
On sn1 we use the alt_address entry of the scatterlist to store
the physical address corresponding to the given virtual address
On sn1 we use the alt_address entry of the scatterlist to store the physical address corresponding to the given virtual address
int
sn1_pci_map_sg (struct pci_dev *hwdev,
                        struct scatterlist *sg, int nents, int direction)
{
	int i;
	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();
	device_sysdata = (struct sn1_device_sysdata *) hwdev->sysdata;
	vhdl = device_sysdata->vhdl;
	for (i = 0; i < nents; i++, sg++) {
		sg->orig_address = sg->address;
		dma_addr = 0;
		temp_ptr = (paddr_t) __pa(sg->address);
		if (IS_PCIA64(hwdev)) {
			dma_addr = (dma_addr_t) pciio_dmatrans_addr(vhdl, NULL,
				temp_ptr, sg->length,
				PCIBR_BARRIER | PCIIO_BYTE_STREAM |
				PCIIO_DMA_CMD | PCIIO_DMA_A64 );
			sg->address = (char *)dma_addr;
			continue;
		}
		if (IS_PCI32G(hwdev)) {
			dma_addr = (dma_addr_t) pciio_dmatrans_addr(vhdl, NULL,
				temp_ptr, sg->length,
				PCIBR_BARRIER | PCIIO_BYTE_STREAM |
				PCIIO_DMA_CMD);
			if (dma_addr) {
				sg->address = (char *)dma_addr;
				continue;
			} else {
				printk("pci_map_single: 32Bits DMA Page Map support not available yet!");
				BUG();
			}
		}
	}
	return nents;
}
int sn1_pci_map_sg ( struct pci_dev * hwdev , struct scatterlist * sg , int nents , int direction ) { int i ; 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 ( ) ; device_sysdata = ( struct sn1_device_sysdata * ) hwdev -> sysdata ; vhdl = device_sysdata -> vhdl ; for ( i = 0 ; i < nents ; i ++ , sg ++ ) { sg -> orig_address = sg -> address ; dma_addr = 0 ; temp_ptr = ( paddr_t ) __pa ( sg -> address ) ; if ( IS_PCIA64 ( hwdev ) ) { dma_addr = ( dma_addr_t ) pciio_dmatrans_addr ( vhdl , NULL , temp_ptr , sg -> length , PCIBR_BARRIER | PCIIO_BYTE_STREAM | PCIIO_DMA_CMD | PCIIO_DMA_A64 ) ; sg -> address = ( char * ) dma_addr ; continue ; } if ( IS_PCI32G ( hwdev ) ) { dma_addr = ( dma_addr_t ) pciio_dmatrans_addr ( vhdl , NULL , temp_ptr , sg -> length , PCIBR_BARRIER | PCIIO_BYTE_STREAM | PCIIO_DMA_CMD ) ; if ( dma_addr ) { sg -> address = ( char * ) dma_addr ; continue ; } else { printk ( " " ) ; BUG ( ) ; } } } return nents ; }
On sn1 we use the alt_address entry of the scatterlist to store
 the physical address corresponding to the given virtual address
On sn1 we use the alt_address entry of the scatterlist to store the physical address corresponding to the given virtual address
/*
	 * Handle 64 bit cards.
	 */ /*
		 * Handle the most common case 64Bit cards.
		 */ /* printk("pci_map_sg: 64Bits hwdev %p DMA Address 0x%p alt_address 0x%p orig_address 0x%p length 0x%x\n", hwdev, sg->address, sg->alt_address, sg->orig_address, sg->length); */ /*
		 * Handle 32Bits and greater cards.
		 */ /* 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.
				 */