if (dev->new_comm_interface) { init->InitFlags = cpu_to_le32(INITFLAGS_NEW_COMM_SUPPORTED); dprintk((KERN_WARNING"aacraid: New Comm Interface enabled\n")); } 
static int aac_alloc_comm(struct aac_dev *dev, void **commaddr, unsigned long commsize, unsigned long commalign){	unsigned char *base;	unsigned long size, align;	const unsigned long fibsize = 4096;	const unsigned long printfbufsiz = 256;	struct aac_init *init;	dma_addr_t phys;	size = fibsize + sizeof(struct aac_init) + commsize + commalign + printfbufsiz; 	base = pci_alloc_consistent(dev->pdev, size, &phys);	if(base == NULL)	{		printk(KERN_ERR "aacraid: unable to create mapping.\n");		return 0;	}	dev->comm_addr = (void *)base;	dev->comm_phys = phys;	dev->comm_size = size;		dev->init = (struct aac_init *)(base + fibsize);	dev->init_pa = phys + fibsize;	init = dev->init;	init->InitStructRevision = cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION);	if (dev->max_fib_size != sizeof(struct hw_fib))		init->InitStructRevision = cpu_to_le32(ADAPTER_INIT_STRUCT_REVISION_4);	init->MiniPortRevision = cpu_to_le32(Sa_MINIPORT_REVISION);	init->fsrev = cpu_to_le32(dev->fsrev);	/*	 *	Adapter Fibs are the first thing allocated so that they	 *	start page aligned	 */	dev->aif_base_va = (struct hw_fib *)base;		init->AdapterFibsVirtualAddress = 0;	init->AdapterFibsPhysicalAddress = cpu_to_le32((u32)phys);	init->AdapterFibsSize = cpu_to_le32(fibsize);	init->AdapterFibAlign = cpu_to_le32(sizeof(struct hw_fib));	/* 	 * number of 4k pages of host physical memory. The aacraid fw needs	 * this number to be less than 4gb worth of pages. num_physpages is in	 * system page units. New firmware doesn't have any issues with the	 * mapping system, but older Firmware did, and had *troubles* dealing	 * with the math overloading past 32 bits, thus we must limit this	 * field.	 *	 * This assumes the memory is mapped zero->n, which isnt	 * always true on real computers. It also has some slight problems	 * with the GART on x86-64. I've btw never tried DMA from PCI space	 * on this platform but don't be suprised if its problematic.	 */#ifndef CONFIG_GART_IOMMU	if ((num_physpages << (PAGE_SHIFT - 12)) <= AAC_MAX_HOSTPHYSMEMPAGES) {		init->HostPhysMemPages = 			cpu_to_le32(num_physpages << (PAGE_SHIFT-12));	} else #endif		{		init->HostPhysMemPages = cpu_to_le32(AAC_MAX_HOSTPHYSMEMPAGES);	}	init->InitFlags = 0;	init->MaxIoCommands = cpu_to_le32(dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB);	init->MaxIoSize = cpu_to_le32(dev->scsi_host_ptr->max_sectors << 9);	init->MaxFibSize = cpu_to_le32(dev->max_fib_size);	/*	 * Increment the base address by the amount already used	 */	base = base + fibsize + sizeof(struct aac_init);	phys = (dma_addr_t)((ulong)phys + fibsize + sizeof(struct aac_init));	/*	 *	Align the beginning of Headers to commalign	 */	align = (commalign - ((unsigned long)(base) & (commalign - 1)));	base = base + align;	phys = phys + align;	/*	 *	Fill in addresses of the Comm Area Headers and Queues	 */	*commaddr = base;	init->CommHeaderAddress = cpu_to_le32((u32)phys);	/*	 *	Increment the base address by the size of the CommArea	 */	base = base + commsize;	phys = phys + commsize;	/*	 *	 Place the Printf buffer area after the Fast I/O comm area.	 */	dev->printfbuf = (void *)base;	init->printfbuf = cpu_to_le32(phys);	init->printfbufsiz = cpu_to_le32(printfbufsiz);	memset(base, 0, printfbufsiz);	return 1;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/8e0c5ebde82b08f6d996e11983890fc4cc085fab/comminit.c/clean/drivers/scsi/aacraid/comminit.c