SVR5
dma_pageio(D3)
dma_pageio --
break up an I/O request into manageable units
Synopsis (Not in current DDI version)
#include <sys/buf.h>
#include <sys/ddi.h>
void dma_pageio(void (*strat)(), buf_t *bp);
Description
dma_pageio breaks up a data transfer request from
physiock(D3)
into units of contiguous memory,
allowing the memory to be passed
to simple DMA controllers
that do not support scatter/gather operations.
Arguments
strat-
Address of the
strategy(D2)
routine to call to complete the I/O transfer.
bp-
Pointer to the buffer header structure.
Return values
None
Usage
When the transfer completes, any allocated buffers are freed.
Context and synchronization
User or blockable
context.
Examples
The following example shows how dma_pageio is used when reading
or writing disk data.
The driver's
read(D2)
and
write(D2)
entry points
use physiock to check the validity
of the I/O and perform the data transfer.
The
strategy(D2)
routine passed to physiock just calls
dma_pageio to perform the data transfer one page at a time.
1 struct dsize {
2 daddr_t nblocks; /* number of blocks in disk partition */
3 int cyloff; /* starting cylinder # of partition */
4 } my_sizes[2] = {
5 20448, 21, /* partition 0 = cyl 21-305 */
6 21888, 1 /* partition 1 = cyl 1-305 */
7 };
8 int
9 my_read(dev, uiop, crp)
10 dev_t dev;
11 uio_t *uiop;
12 cred_t *crp;
13 {
14 int nblks;
15 nblks = my_sizes[getminor(dev)].nblocks;
16 return(physiock(my_breakup, 0, dev, B_READ, nblks, uiop));
17 }
18 int
19 my_write(dev, uiop, crp)
20 dev_t dev;
21 uio_t *uiop;
22 cred_t *crp;
23 {
24 int nblks;
25 nblks = my_sizes[getminor(dev)].nblocks;
26 return(physiock(my_breakup, 0, dev, B_WRITE, nblks, uiop));
27 }
28 static void
29 my_breakup(bp)
30 buf_t *bp;
31 {
32 dma_pageio(my_strategy, bp);
33 }
Hardware applicability
All
Version applicability
ddi:
1, 2, 3, 4
Differences between versions
buf_breakup(D3)
replaces dma_pageio.
References
buf(D4),
buf_breakup(D3),
physiock(D3),
read(D2),
strategy(D2),
write(D2)
``DMA'' in HDK Technical Reference
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005