summaryrefslogtreecommitdiff
path: root/usr/src/man/man9f/ddi_btop.9f
blob: 634365092639197b6136f6009d6b989916fe7eb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
'\" te
.\" Copyright (c) 2006, Sun Microsystems, Inc.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH DDI_BTOP 9F "Jan 16, 2006"
.SH NAME
ddi_btop, ddi_btopr, ddi_ptob \- page size conversions
.SH SYNOPSIS
.nf
#include <sys/ddi.h>
#include <sys/sunddi.h>



\fBunsigned long\fR \fBddi_btop\fR(\fBdev_info_t\fR \fI*dip\fR, \fBunsigned long\fR \fIbytes\fR);
.fi

.LP
.nf
\fBunsigned long\fR \fBddi_btopr\fR(\fBdev_info_t\fR \fI*dip\fR, \fBunsigned long\fR \fIbytes\fR);
.fi

.LP
.nf
\fBunsigned long\fR \fBddi_ptob\fR(\fBdev_info_t\fR \fI*dip\fR, \fBunsigned long\fR \fIpages\fR);
.fi

.SH INTERFACE LEVEL
illumos DDI specific (illumos DDI).
.SH DESCRIPTION
This set of routines use the parent nexus driver to perform conversions in page
size units.
.sp
.LP
The \fBddi_btop()\fR function converts the given number of bytes to the number
of memory pages that it corresponds to, rounding down in the case that the byte
count is not a page multiple.
.sp
.LP
The \fBddi_btopr()\fR function converts the given number of bytes to the number
of memory pages that it corresponds to, rounding up in the case that the byte
count is not a page multiple.
.sp
.LP
The \fBddi_ptob()\fR function converts the given number of pages to the number
of bytes that it corresponds to.
.sp
.LP
Because bus nexus may possess their own hardware address translation
facilities, these routines should be used in preference to the corresponding
DDI/DKI routines \fBbtop\fR(9F), \fBbtopr\fR(9F), and \fBptob\fR(9F), which
only deal in terms of the pagesize of the main system MMU.
.SH RETURN VALUES
The \fBddi_btop()\fR and \fBddi_btopr()\fR functions return the number of
corresponding pages. \fBddi_ptob()\fR returns the corresponding number of
bytes. There are no error return values.
.SH CONTEXT
This function can be called from user, interrupt, or kernel context.
.SH EXAMPLES
\fBExample 1 \fRFind the size (in bytes) of one page
.sp
.in +2
.nf
pagesize = ddi_ptob(dip, 1L);
.fi
.in -2

.SH SEE ALSO
.BR btop (9F),
.BR btopr (9F),
.BR ptob (9F)
.sp
.LP
\fIWriting Device Drivers\fR