'\" te .\" Copyright (c) 2006, Sun Microsystems, Inc. .TH ddi_btop 9F "16 Jan 2006" "SunOS 5.11" "Kernel Functions for Drivers" .SH NAME ddi_btop, ddi_btopr, ddi_ptob \- page size conversions .SH SYNOPSIS .LP .nf #include #include \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 .sp .LP Solaris DDI specific (Solaris DDI). .SH DESCRIPTION .sp .LP 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 .sp .LP 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 .sp .LP This function can be called from user, interrupt, or kernel context. .SH EXAMPLES .LP \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 .sp .LP \fBbtop\fR(9F), \fBbtopr\fR(9F), \fBptob\fR(9F) .sp .LP \fIWriting Device Drivers for Oracle Solaris 11.2\fR