Alexander Sabourenkov wrote: > Alan Cox wrote: >>> I can't think of a way to avoid second pass over scatterlist without >>> duplicating code (ata_qc_prep() and ata_fill_sg() from libata-core.c). >> This appears to be incomplete: >> > > [...] > >> What guarantees you have enough PRD entries to do this without changing >> the limit in the structures ? >> >> Otherwise looks good > > PRD entries count is 256 > include/linux/ata.h: > ATA_MAX_PRD = 256, > ATA_PRD_TBL_SZ = (ATA_MAX_PRD * ATA_PRD_SZ), > > drivers/ata/libata-core.c: > ap->prd = dmam_alloc_coherent(dev, ATA_PRD_TBL_SZ, &ap->prd_dma, > > sata_promise Scsi_Host declares support for half of that: > > include/linux/libata.h: > LIBATA_MAX_PRD = ATA_MAX_PRD / 2, > > drivers/ata/sata_promise.c > .sg_tablesize = LIBATA_MAX_PRD, > > > PS: Vendor code has this limit at 32. > That's an interesting question of itself. I don't know what limits PRD count, but if it's hardware, then the driver should somehow make sure that it gets no more than hw can handle minus one for this errata. Right now driver declares that any hardware it supports can handle 128 PRD entries. If this is not true for any possibly existing specimen, we're welcoming trouble. -- ./lxnt - To unsubscribe from this list: send the line "unsubscribe linux-ide" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html