kernels/linux-2.4.0/drivers/ide/ide-dma.c
/*
 *	This can be called for a dynamically installed interface. Don't __init it
 */
This can be called for a dynamically installed interface.
This can be called for a dynamically installed interface .
void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_ports)
{
	printk("    %s: BM-DMA at 0x%04lx-0x%04lx", hwif->name, dma_base, dma_base + num_ports - 1);
	if (check_region(dma_base, num_ports)) {
		printk(" -- ERROR, PORT ADDRESSES ALREADY IN USE\n");
		return;
	}
	request_region(dma_base, num_ports, hwif->name);
	hwif->dma_base = dma_base;
	hwif->dmatable_cpu = pci_alloc_consistent(hwif->pci_dev,
						  PRD_ENTRIES * PRD_BYTES,
						  &hwif->dmatable_dma);
	if (hwif->dmatable_cpu == NULL)
		goto dma_alloc_failure;
	hwif->sg_table = kmalloc(sizeof(struct scatterlist) * PRD_ENTRIES,
				 GFP_KERNEL);
	if (hwif->sg_table == NULL) {
		pci_free_consistent(hwif->pci_dev, PRD_ENTRIES * PRD_BYTES,
				    hwif->dmatable_cpu, hwif->dmatable_dma);
		goto dma_alloc_failure;
	}
	hwif->dmaproc = &ide_dmaproc;
	if (hwif->chipset != ide_trm290) {
		byte dma_stat = inb(dma_base+2);
		printk(", BIOS settings: %s:%s, %s:%s",
		       hwif->drives[0].name, (dma_stat & 0x20) ? "DMA" : "pio",
		       hwif->drives[1].name, (dma_stat & 0x40) ? "DMA" : "pio");
	}
	printk("\n");
	return;
dma_alloc_failure:
	printk(" -- ERROR, UNABLE TO ALLOCATE DMA TABLES\n");
}
void ide_setup_dma ( ide_hwif_t * hwif , unsigned long dma_base , unsigned int num_ports ) { printk ( " " , hwif -> name , dma_base , dma_base + num_ports - 1 ) ; if ( check_region ( dma_base , num_ports ) ) { printk ( " \n " ) ; return ; } request_region ( dma_base , num_ports , hwif -> name ) ; hwif -> dma_base = dma_base ; hwif -> dmatable_cpu = pci_alloc_consistent ( hwif -> pci_dev , PRD_ENTRIES * PRD_BYTES , & hwif -> dmatable_dma ) ; if ( hwif -> dmatable_cpu == NULL ) goto dma_alloc_failure ; hwif -> sg_table = kmalloc ( sizeof ( struct scatterlist ) * PRD_ENTRIES , GFP_KERNEL ) ; if ( hwif -> sg_table == NULL ) { pci_free_consistent ( hwif -> pci_dev , PRD_ENTRIES * PRD_BYTES , hwif -> dmatable_cpu , hwif -> dmatable_dma ) ; goto dma_alloc_failure ; } hwif -> dmaproc = & ide_dmaproc ; if ( hwif -> chipset != ide_trm290 ) { byte dma_stat = inb ( dma_base + 2 ) ; printk ( " " , hwif -> drives [ 0 ] . name , ( dma_stat & 0x20 ) ? " " : " " , hwif -> drives [ 1 ] . name , ( dma_stat & 0x40 ) ? " " : " " ) ; } printk ( " \n " ) ; return ; dma_alloc_failure : printk ( " \n " ) ; }
This can be called for a dynamically installed interface.
This can be called for a dynamically installed interface .