Subject: SCSI Scatter-Gather buffer command
To: tech-kern@NetBSD.ORG <tech-kern@NetBSD.ORG>
From: Dante Profeta <firstname.lastname@example.org>
Date: 06/30/1998 23:32:49
I hope I'm not boring you, but... yes, I'm still trying to port Linux
It seems Linux SCSI commands could be issued in two different way
according to the value of an Scsi_Cmnd field named 'use_sg'.
- if 'use_sg' is zero, then 'request_buffer' points to the data buffer
for the SCSI command, and 'request_bufflen' is the length of this buffer
- if 'use_sg' is grather then zero, then 'request_buffer' points to an
array of scatterlist structures, and 'use_sg' will indicate how many
such structures are in the array.
scatterlist structures has two fields: address and length.
The first meaning is ok by me: there are equivalent fields into NetBSD
My problems (...well, some of my problems...) lies with the second
meaning of 'use_sg'.
The following related code...
slp = (struct scatterlist *) scp->request_buffer;
for (sgcnt = 0; sgcnt < scp->use_sg; sgcnt++, slp++)
asc_sg_head.sg_list[sgcnt].addr = virt_to_bus(slp->address);
asc_sg_head.sg_list[sgcnt].bytes = slp->length;
...could be considered equivalent to the following one extracted from
* Load the hardware scatter/gather map with the
* contents of the DMA map.
for (seg = 0; seg < ccb->dmamap_xfer->dm_nsegs; seg++)
offsetof(struct bha_ccb, scat_gath), ccb->data_addr);
sizeof(struct bha_scat_gath), ccb->data_length);
...Otherwise how should I manage this situation?
Thanks for your patience,