'\" 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_map_regs 9F "16 Jan 2006" "SunOS 5.11" "Kernel Functions for Drivers" .SH NAME ddi_map_regs, ddi_unmap_regs \- map or unmap registers .SH SYNOPSIS .LP .nf #include #include #include \fBint\fR \fBddi_map_regs\fR(\fBdev_info_t *\fR\fIdip\fR, \fBuint_t\fR \fIrnumber\fR, \fBcaddr_t *\fR\fIkaddrp\fR, \fBoff_t\fR \fIoffset\fR, \fBoff_t\fR \fIlen\fR); .fi .LP .nf \fBvoid\fR \fBddi_unmap_regs\fR(\fBdev_info_t *\fR\fIdip\fR, \fBuint_t\fR \fIrnumber\fR, \fBcaddr_t *\fR\fIkaddrp\fR, \fBoff_t\fR \fIoffset\fR, \fBoff_t\fR \fIlen\fR); .fi .SH INTERFACE LEVEL .sp .LP These interfaces are obsolete. Use \fBddi_regs_map_setup\fR(9F) instead of \fBddi_map_regs()\fR. Use \fBddi_regs_map_free\fR(9F) instead of \fBddi_unmap_regs()\fR. .SH PARAMETERS .SS "\fBddi_map_regs()\fR" .sp .ne 2 .mk .na \fB\fIdip\fR\fR .ad .RS 11n .rt Pointer to the device's dev_info structure. .RE .sp .ne 2 .mk .na \fB\fIrnumber\fR\fR .ad .RS 11n .rt Register set number. .RE .sp .ne 2 .mk .na \fB\fIkaddrp\fR\fR .ad .RS 11n .rt Pointer to the base kernel address of the mapped region (set on return). .RE .sp .ne 2 .mk .na \fB\fIoffset\fR\fR .ad .RS 11n .rt Offset into register space. .RE .sp .ne 2 .mk .na \fB\fIlen\fR\fR .ad .RS 11n .rt Length to be mapped. .RE .SS "\fBddi_unmap_regs()\fR" .sp .ne 2 .mk .na \fB\fIdip\fR\fR .ad .RS 11n .rt Pointer to the device's dev_info structure. .RE .sp .ne 2 .mk .na \fB\fIrnumber\fR\fR .ad .RS 11n .rt Register set number. .RE .sp .ne 2 .mk .na \fB\fIkaddrp\fR\fR .ad .RS 11n .rt Pointer to the base kernel address of the region to be unmapped. .RE .sp .ne 2 .mk .na \fB\fIoffset\fR\fR .ad .RS 11n .rt Offset into register space. .RE .sp .ne 2 .mk .na \fB\fIlen\fR\fR .ad .RS 11n .rt Length to be unmapped. .RE .SH DESCRIPTION .sp .LP The \fBddi_map_regs()\fR function maps in the register set given by \fIrnumber\fR. The register number determines which register set will be mapped if more than one exists. The base kernel virtual address of the mapped register set is returned in \fIkaddrp\fR. \fIoffset\fR specifies an offset into the register space to start from and \fIlen\fR indicates the size of the area to be mapped. If \fIlen\fR is non-zero, it overrides the length given in the register set description. See the discussion of the \fBreg\fR property in \fBsbus\fR(4) and for more information on register set descriptions. If \fIlen\fR and \fIoffset\fR are 0, the entire space is mapped. .sp .LP The \fBddi_unmap_regs()\fR function undoes mappings set up by \fBddi_map_regs()\fR. This is provided for drivers preparing to detach themselves from the system, allowing them to release allocated mappings. Mappings must be released in the same way they were mapped (a call to \fBddi_unmap_regs()\fR must correspond to a previous call to \fBddi_map_regs()\fR). Releasing portions of previous mappings is not allowed. \fIrnumber\fR determines which register set will be unmapped if more than one exists. The \fIkaddrp\fR, \fIoffset\fR and \fIlen\fR specify the area to be unmapped. \fIkaddrp\fR is a pointer to the address returned from \fBddi_map_regs()\fR; \fIoffset\fR and \fIlen\fR should match what \fBddi_map_regs()\fR was called with. .SH RETURN VALUES .sp .LP The \fBddi_map_regs()\fR function returns: .sp .ne 2 .mk .na \fB\fBDDI_SUCCESS\fR\fR .ad .RS 15n .rt on success. .RE .SH CONTEXT .sp .LP These functions can be called from user, interrupt, or kernel context. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for a description of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . \fBATTRIBUTE TYPE\fR\fBATTRIBUTE VALUE\fR _ Interface Stability Obsolete .TE .SH SEE ALSO .sp .LP \fBattributes\fR(5), \fBsbus\fR(4), \fBddi_regs_map_free\fR(9F), \fBddi_regs_map_setup\fR(9F) .sp .LP \fIWriting Device Drivers\fR