Fix a long-standing bug in alpha's implementation of busdma. We need to

OR the physical address with alpha_XXX_dmamap_or to get the DMA address,
like the name of the variable suggests.  However, while we were doing
this correctly in the alpha_XXX_dmamap() macro, the busdma code added
the variable to the physical address instead of or'ing it.  Fortunately
and if my math is not entirely wrong, you would need more than 128GB of
RAM and a device able to do DMA in 64bits to experience the bug.

Spotted by:	cognet
This commit is contained in:
Maxime Henrion 2005-03-12 02:43:50 +00:00
parent 1b1a07ad8b
commit 56a4dfb981

View File

@ -578,7 +578,7 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
}
if (sg->ds_len == 0) {
sg->ds_addr = paddr + alpha_XXX_dmamap_or;
sg->ds_addr = paddr | alpha_XXX_dmamap_or;
sg->ds_len = size;
} else if (paddr == nextpaddr) {
sg->ds_len += size;
@ -588,7 +588,7 @@ bus_dmamap_load(bus_dma_tag_t dmat, bus_dmamap_t map, void *buf,
seg++;
if (seg > dmat->nsegments)
break;
sg->ds_addr = paddr + alpha_XXX_dmamap_or;
sg->ds_addr = paddr | alpha_XXX_dmamap_or;
sg->ds_len = size;
}
vaddr += size;
@ -668,7 +668,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat,
* previous segment if possible.
*/
if (first) {
segs[seg].ds_addr = curaddr + alpha_XXX_dmamap_or;
segs[seg].ds_addr = curaddr | alpha_XXX_dmamap_or;
segs[seg].ds_len = sgsize;
first = 0;
} else {
@ -680,7 +680,7 @@ _bus_dmamap_load_buffer(bus_dma_tag_t dmat,
else {
if (++seg >= dmat->nsegments)
break;
segs[seg].ds_addr = curaddr + alpha_XXX_dmamap_or;
segs[seg].ds_addr = curaddr | alpha_XXX_dmamap_or;
segs[seg].ds_len = sgsize;
}
}