Messages in this thread | | | Date | Sun, 5 Apr 1998 11:41:56 +0200 | From | ralf@uni-kobl ... | Subject | Re: write[blw] vs memcpy? |
| |
On Sat, Apr 04, 1998 at 08:17:33PM -0500, Raul Miller wrote:
> The reason I ask is: the driver currently uses operations like memset > and memcpy on the card's memory, and it seems just plain silly to cast > these operations as a sequence writeb (or something more complex). > > Can someone who is familiar with this aspect of the kernel clue me in?
The way that the actual card's address space is accessible to the host machine can be changed more or less arbitrarily, that's why memcpy et al. shouldn't be used to access a card's memory. Some examples:
- The address space can be mapped by the CPU's MMU. - The address space can be mapped by an external I/O MMU _even_ if this is not part of the actual bus design, for example ISA. - There might only be a windows of the actual bus address space be visible in the processor address space. Implemented that way for example in the SNI RM200, certain Alphas or when running the CPU in 32bit mode on a Magnum 4000 and certain Alphas. The worst case scenario I know of is a system which addresses it's ISA bus via a address/data register pair. Yeah, doesn't it suck? - Some architectures don't implement byte access in hardware. The limitation may be in either the processor architecture or in in the bus hardware itself. Designer of such systems might decide to stretch the address space by a factor of the buswidth or greater.
In short, hardware designer are creative and these functions are important for portability. Remember how many drivers broke during early 2.1.x kernels? Using the proper functions would have saved alot of the trouble. For actual examples in the Linux kernel code illustrating why things have to be handled the way they are may want to take into include/asm-alpha/io.h and related code.
Finally there is no need to rely on {read,write}[bwl]. There are special purpose I/O copy functions available, memset_io(), memcpy_fromio() and memcpy_toio() which will do the job efficient and portable.
Ralf
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu
| |