Subject: Re: uiomove and bus-ified drivers
To: None <tech-kern@NetBSD.ORG>
From: Mike Long <mikel@shore.net>
List: tech-kern
Date: 12/18/1997 01:37:15
>Date: Wed, 17 Dec 1997 22:58:45 +0100
>From: Leo Weppelman <leo@wau.mis.ah.nl>

>>  Leo Weppelman <leo@wau.mis.ah.nl> wrote:
>> 
>>  > Yesterday, I was looking at a contributed driver that contained a line
>>  > like:
>>  > 
>>  >      uiomove((caddr_t)(sc->sc_memt + sc->sc_memh + uio->uio_offset),
>>  >              length, uio);
>>  > 
>>  > obviously, this is not correct. However, what *is* the correct solution
>>  > here? Should there always be an intermediate copy to a buffer like:
>>  >      bus_space_read_multi_1(sc->sc_memt, sc->sc_memh, uio->uio_offset,
>>  >                             buf, length);
>>  >      uiomove(buf, length, uio);
>>  > 
>>  > This is not very efficient.  Am I missing something obvious?

>I was more or less hoping I missed something. That extra copy bothers
>me.

The extra copy may be inefficient but it may be required if the space
from which bus_space_read_multi_1() is copying is sparsely addressed,
e.g. one byte of valid data per 32-bit word.
-- 
Mike Long <mikel@shore.net>                http://www.shore.net/~mikel
"Every normal man must be tempted at times to spit on his hands,
hoist the black flag, and begin slitting throats." -- H.L. Mencken