qla2x00t: Clean up DMA address computation code (merge r4778)

git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/2.2.x@5043 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2013-10-05 18:07:52 +00:00
parent aa137b5bea
commit 1dc9ea01ec

View File

@@ -2287,20 +2287,18 @@ static void q2t_load_cont_data_segments(struct q2t_prm *prm)
for (cnt = 0;
cnt < prm->tgt->datasegs_per_cont && prm->seg_cnt;
cnt++, prm->seg_cnt--) {
*dword_ptr++ =
cpu_to_le32(pci_dma_lo32
(sg_dma_address(prm->sg)));
dma_addr_t dma_addr = sg_dma_address(prm->sg);
*dword_ptr++ = cpu_to_le32(pci_dma_lo32(dma_addr));
if (enable_64bit_addressing) {
*dword_ptr++ =
cpu_to_le32(pci_dma_hi32
(sg_dma_address
(prm->sg)));
cpu_to_le32(pci_dma_hi32(dma_addr));
}
*dword_ptr++ = cpu_to_le32(sg_dma_len(prm->sg));
TRACE_SG("S/G Segment Cont. phys_addr=%llx:%llx, len=%d",
(long long unsigned int)pci_dma_hi32(sg_dma_address(prm->sg)),
(long long unsigned int)pci_dma_lo32(sg_dma_address(prm->sg)),
(long long unsigned int)pci_dma_hi32(dma_addr),
(long long unsigned int)pci_dma_lo32(dma_addr),
(int)sg_dma_len(prm->sg));
prm->sg++;
@@ -2352,17 +2350,16 @@ static void q2x_load_data_segments(struct q2t_prm *prm)
for (cnt = 0;
(cnt < prm->tgt->datasegs_per_cmd) && prm->seg_cnt;
cnt++, prm->seg_cnt--) {
*dword_ptr++ =
cpu_to_le32(pci_dma_lo32(sg_dma_address(prm->sg)));
if (enable_64bit_addressing) {
*dword_ptr++ =
cpu_to_le32(pci_dma_hi32(sg_dma_address(prm->sg)));
}
dma_addr_t dma_addr = sg_dma_address(prm->sg);
*dword_ptr++ = cpu_to_le32(pci_dma_lo32(dma_addr));
if (enable_64bit_addressing)
*dword_ptr++ = cpu_to_le32(pci_dma_hi32(dma_addr));
*dword_ptr++ = cpu_to_le32(sg_dma_len(prm->sg));
TRACE_SG("S/G Segment phys_addr=%llx:%llx, len=%d",
(long long unsigned int)pci_dma_hi32(sg_dma_address(prm->sg)),
(long long unsigned int)pci_dma_lo32(sg_dma_address(prm->sg)),
(long long unsigned int)pci_dma_hi32(dma_addr),
(long long unsigned int)pci_dma_lo32(dma_addr),
(int)sg_dma_len(prm->sg));
prm->sg++;
@@ -2415,19 +2412,16 @@ static void q24_load_data_segments(struct q2t_prm *prm)
for (cnt = 0;
(cnt < prm->tgt->datasegs_per_cmd) && prm->seg_cnt;
cnt++, prm->seg_cnt--) {
*dword_ptr++ =
cpu_to_le32(pci_dma_lo32(sg_dma_address(prm->sg)));
if (enable_64bit_addressing) {
*dword_ptr++ =
cpu_to_le32(pci_dma_hi32(sg_dma_address(prm->sg)));
}
dma_addr_t dma_addr = sg_dma_address(prm->sg);
*dword_ptr++ = cpu_to_le32(pci_dma_lo32(dma_addr));
if (enable_64bit_addressing)
*dword_ptr++ = cpu_to_le32(pci_dma_hi32(dma_addr));
*dword_ptr++ = cpu_to_le32(sg_dma_len(prm->sg));
TRACE_SG("S/G Segment phys_addr=%llx:%llx, len=%d",
(long long unsigned int)pci_dma_hi32(sg_dma_address(
prm->sg)),
(long long unsigned int)pci_dma_lo32(sg_dma_address(
prm->sg)),
(long long unsigned int)pci_dma_hi32(dma_addr),
(long long unsigned int)pci_dma_lo32(dma_addr),
(int)sg_dma_len(prm->sg));
prm->sg++;