1ddi_btop(9F)             Kernel Functions for Drivers             ddi_btop(9F)
2
3
4

NAME

6       ddi_btop, ddi_btopr, ddi_ptob - page size conversions
7

SYNOPSIS

9       #include <sys/ddi.h>
10       #include <sys/sunddi.h>
11
12
13
14       unsigned long ddi_btop(dev_info_t *dip, unsigned long bytes);
15
16
17       unsigned long ddi_btopr(dev_info_t *dip, unsigned long bytes);
18
19
20       unsigned long ddi_ptob(dev_info_t *dip, unsigned long pages);
21
22

INTERFACE LEVEL

24       Solaris DDI specific (Solaris DDI).
25

DESCRIPTION

27       This set of routines use the parent nexus driver to perform conversions
28       in page size units.
29
30
31       The ddi_btop() function converts the given number of bytes to the  num‐
32       ber  of  memory pages that it corresponds to, rounding down in the case
33       that the byte count is not a page multiple.
34
35
36       The ddi_btopr() function converts the given number of bytes to the num‐
37       ber  of  memory  pages  that it corresponds to, rounding up in the case
38       that the byte count is not a page multiple.
39
40
41       The ddi_ptob() function converts the given number of pages to the  num‐
42       ber of bytes that it corresponds to.
43
44
45       Because  bus  nexus  may possess their own hardware address translation
46       facilities, these routines should be used in preference to  the  corre‐
47       sponding DDI/DKI routines btop(9F), btopr(9F), and ptob(9F), which only
48       deal in terms of the pagesize of the main system MMU.
49

RETURN VALUES

51       The ddi_btop() and ddi_btopr() functions return the  number  of  corre‐
52       sponding  pages.  ddi_ptob() returns the corresponding number of bytes.
53       There are no error return values.
54

CONTEXT

56       This function can be called from user, interrupt, or kernel context.
57

EXAMPLES

59       Example 1 Find the size (in bytes) of one page
60
61         pagesize = ddi_ptob(dip, 1L);
62
63

SEE ALSO

65       btop(9F), btopr(9F), ptob(9F)
66
67
68       Writing Device Drivers
69
70
71
72SunOS 5.11                        16 Jan 2006                     ddi_btop(9F)
Impressum