 /* we must lengthen transfers to end on a 32-bit boundary */ qc->pad_len = lsg->length & 3; if (qc->pad_len) { void *pad_buf = ap->pad + (qc->tag * ATA_DMA_PAD_SZ); struct scatterlist *psg = &qc->pad_sgent; unsigned int offset;  assert(qc->dev->class == ATA_DEV_ATAPI);  memset(pad_buf, 0, ATA_DMA_PAD_SZ);  /* * psg->page/offset are used to copy to-be-written * data in this function or read data in ata_sg_clean. */ offset = lsg->offset + lsg->length - qc->pad_len; psg->page = nth_page(lsg->page, offset >> PAGE_SHIFT); psg->offset = offset_in_page(offset);  if (qc->tf.flags & ATA_TFLAG_WRITE) { void *addr = kmap_atomic(psg->page, KM_IRQ0); memcpy(pad_buf, addr + psg->offset, qc->pad_len); kunmap_atomic(psg->page, KM_IRQ0); }  sg_dma_address(psg) = ap->pad_dma + (qc->tag * ATA_DMA_PAD_SZ); sg_dma_len(psg) = ATA_DMA_PAD_SZ; /* trim last sg */ lsg->length -= qc->pad_len;  DPRINTK("padding done, sg[%d].length=%u pad_len=%u\n", qc->n_elem - 1, lsg->length, qc->pad_len); } 
static int ata_sg_setup(struct ata_queued_cmd *qc){	struct ata_port *ap = qc->ap;	struct scatterlist *sg = qc->sg;	int n_elem, dir;	VPRINTK("ENTER, ata%u\n", ap->id);	assert(qc->flags & ATA_QCFLAG_SG);	dir = qc->dma_dir;	n_elem = dma_map_sg(ap->host_set->dev, sg, qc->n_elem, dir);	if (n_elem < 1)		return -1;	DPRINTK("%d sg elements mapped\n", n_elem);	qc->n_elem = n_elem;	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/cedc9a478d8c6265879dc3839ef3d4849a709184/libata-core.c/clean/drivers/scsi/libata-core.c