32-bit PIO wrappers for scatterlists
cover 32-bit PIO wrappers for scatterlists
Hello,
While writing a driver for CB710 MMC host I had to implement PIO routines that transferred data to/from buffers described by scatterlists. As it turned later this scheme is needed for similar devices that can't handle [scatter-gather] DMA in hardware.
Following is my implementation of such routines that should be generic enough to use in drivers doing PIO by 32-bit accesses (PCI based devices or maybe other 32-bit word based busses).
Current implementation has some limitations:
1. it advances scatterlist iterator always by multiple of 4 bytes
2. it silently inserts zeroes after last byte of buffer when transferring data to the device (that's actually a good thing for my driver)
3. it silently ignores data that does not fit into specified buffer when transferring data from the device (this also is a good thing for the driver I wrote)
What those points mean is that driver writer has to know how many bytes there are available in the buffer if its important, and has to use multiple-of-4 transfer sizes when doing more than one transfer using a single iterator.
Patches are against vanilla kernel 2.6.28.
Best Regards,
Michał Mirosław