Subject: Valid use of bus_dma(9)?
To: None <tech-kern@netbsd.org>
From: Jochen Kunz <jkunz@unixag-kl.fh-kl.de>
List: tech-kern
Date: 07/22/2004 15:13:10
Hi.

Is this a valid use of bus_dma(9)?

	bus_dmamem_alloc(x_segs)
	bus_dmamem_map(x_segs)
	bus_dmamap_create(x_map)
	bus_dmamap_load(x_map)
I.e. the usual way to get some DMA memory and later...
	y_segs[0] =3D x_segs[0]
	y_segs[0].ds_addr +=3D sizeof(some_thing);
	y_segs[0].ds_len =3D sizeof(some_other_thing);
	bus_dmamem_map(y_segs)
	bus_dmamap_create(y_map)
	bus_dmamap_load(y_map)

Thus resulting in a double mapping of the previously allocated and maped
"x" DMA memory. The physical "y" memory is subregion of the physical "x"
memory mapped at a different KVA.

To me this looks wrong. The "y" memory should be handled as an offset of
the "x" memory and a driver should never modify or "self create" a DMA
segment / map. (At least that is the way I understand bus_dma(9).)

Background: fpa(4) does the above. It fails on hp700 for this reason.
I now need to decide if the hp700 bus_dma(9) code needs fixing (my
problem) or if fpa(4) needs fixing (not my problem ;-) ).=20
--=20


tsch=FC=DF,
       Jochen

Homepage: http://www.unixag-kl.fh-kl.de/~jkunz/