u64 le_addr; 
u64 addr; 
static unsigned long aac_build_sg64(struct scsi_cmnd* scsicmd, struct sgmap64* psg){	struct aac_dev *dev;	unsigned long byte_count = 0;	u64 le_addr;	dev = (struct aac_dev *)scsicmd->device->host->hostdata;	// Get rid of old data	psg->count = 0;	psg->sg[0].addr[0] = 0;	psg->sg[0].addr[1] = 0;	psg->sg[0].count = 0;	if (scsicmd->use_sg) {		struct scatterlist *sg;		int i;		int sg_count;		sg = (struct scatterlist *) scsicmd->request_buffer;		sg_count = pci_map_sg(dev->pdev, sg, scsicmd->use_sg,			scsicmd->sc_data_direction);		psg->count = cpu_to_le32(sg_count);		byte_count = 0;		for (i = 0; i < sg_count; i++) {			le_addr = cpu_to_le64(sg_dma_address(sg));			psg->sg[i].addr[1] = (u32)(le_addr>>32);			psg->sg[i].addr[0] = (u32)(le_addr & 0xffffffff);			psg->sg[i].count = cpu_to_le32(sg_dma_len(sg));			byte_count += sg_dma_len(sg);			sg++;		}		/* hba wants the size to be exact */		if(byte_count > scsicmd->request_bufflen){			psg->sg[i-1].count -= (byte_count - scsicmd->request_bufflen);			byte_count = scsicmd->request_bufflen;		}		/* Check for command underflow */		if(scsicmd->underflow && (byte_count < scsicmd->underflow)){			printk(KERN_WARNING"aacraid: cmd len %08lX cmd underflow %08X\n",					byte_count, scsicmd->underflow);		}	}	else if(scsicmd->request_bufflen) {		dma_addr_t addr; 		addr = pci_map_single(dev->pdev,				scsicmd->request_buffer,				scsicmd->request_bufflen,				scsicmd->sc_data_direction);		psg->count = cpu_to_le32(1);		le_addr = cpu_to_le64(addr);		psg->sg[0].addr[1] = (u32)(le_addr>>32);		psg->sg[0].addr[0] = (u32)(le_addr & 0xffffffff);		psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen);  		scsicmd->SCp.dma_handle = addr;		byte_count = scsicmd->request_bufflen;	}	return byte_count;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/56b5871223f66d4a34e6e1069f241077e9f0a154/aachba.c/clean/drivers/scsi/aacraid/aachba.c