dma_pageio(D3) dma_pageio(D3)
NAME
dma_pageio - break up an I/O request into manageable units
SYNOPSIS
#include <sys/buf.h>
#include <sys/ddi.h>
void dma_pageio(void (*strat)(), buf_t *bp);
Arguments
strat
Address of the strategy(D2) routine to call to complete
the I/O transfer.
bp Pointer to the buffer header structure.
DESCRIPTION
dma_pageio breaks up a data transfer request from physiock(D3)
into units of contiguous memory. This function enhances the
capabilities of the direct memory access controller (DMAC).
Return Values
None
USAGE
When the transfer completes, any allocated buffers are freed.
The interrupt priority level is not maintained across calls to
dma_pageio.
Level
Base only.
Synchronization Constraints
Can sleep.
Driver-defined basic locks and read/write locks may not be
held across calls to this function.
Driver-defined sleep locks may be held across calls to this
function.
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)
Copyright 1994 Novell, Inc. Page 1
dma_pageio(D3) dma_pageio(D3)
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 }
REFERENCES
buf(D4), buf_breakup(D3), physiock(D3), read(D2),
strategy(D2), write(D2)
NOTICES
Portability
All processors
Copyright 1994 Novell, Inc. Page 2
dma_pageio(D3) dma_pageio(D3)
Applicability
ddi: 1, 2, 3, 4
buf_breakup(D3) replaces dma_pageio.
Copyright 1994 Novell, Inc. Page 3