'\" te .\" Copyright (c) 2004, 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_REGS_MAP_SETUP 9F "Nov 18, 2004" .SH NAME ddi_regs_map_setup \- set up a mapping for a register address space .SH SYNOPSIS .LP .nf #include #include \fBint\fR \fBddi_regs_map_setup\fR(\fBdev_info_t\fR \fI*dip\fR, \fBuint_t\fR \fIrnumber\fR, \fBcaddr_t\fR \fI*addrp\fR, \fBoffset_t\fR \fIoffset\fR, \fBoffset_t\fR \fIlen\fR, \fBddi_device_acc_attr_t\fR \fI*accattrp\fR, \fBddi_acc_handle_t\fR \fI*handlep\fR); .fi .SH INTERFACE LEVEL .sp .LP Solaris \fBDDI\fR specific (Solaris \fBDDI\fR). .SH PARAMETERS .sp .ne 2 .na \fB\fIdip\fR\fR .ad .RS 12n Pointer to the device's \fBdev_info\fR structure. .RE .sp .ne 2 .na \fB\fIrnumber\fR\fR .ad .RS 12n Index number to the register address space set. .RE .sp .ne 2 .na \fB\fIaddrp\fR\fR .ad .RS 12n A platform-dependent value that, when added to an offset that is less than or equal to the \fIlen\fR parameter (see below), is used for the \fBdev_addr\fR argument to the \fBddi_get\fR, \fBddi_mem_get\fR, and \fBddi_io_get\fR/\fBput\fR routines. .RE .sp .ne 2 .na \fB\fIoffset\fR\fR .ad .RS 12n Offset into the register address space. .RE .sp .ne 2 .na \fB\fIlen\fR\fR .ad .RS 12n Length to be mapped. .RE .sp .ne 2 .na \fB\fIaccattrp\fR\fR .ad .RS 12n Pointer to a device access attribute structure of this mapping (see \fBddi_device_acc_attr\fR(9S)). .RE .sp .ne 2 .na \fB\fIhandlep\fR\fR .ad .RS 12n Pointer to a data access handle. .RE .SH DESCRIPTION .sp .LP \fBddi_regs_map_setup()\fR maps in the register set given by \fIrnumber\fR. The register number determines which register set is mapped if more than one exists. .sp .LP \fIoffset\fR specifies the starting location within the register space 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. If both \fIlen\fR and \fIoffset\fR are \fB0\fR, the entire space is mapped. The base of the mapped register space is returned in \fIaddrp\fR. .sp .LP The device access attributes are specified in the location pointed by the \fIaccattrp\fR argument (see \fBddi_device_acc_attr\fR(9S) for details). .sp .LP The data access handle is returned in \fIhandlep\fR. \fIhandlep\fR is opaque; drivers should not attempt to interpret its value. The handle is used by the system to encode information for subsequent data access function calls to maintain a consistent view between the host and the device. .SH RETURN VALUES .sp .LP \fBddi_regs_map_setup()\fR returns: .sp .ne 2 .na \fB\fBDDI_SUCCESS\fR\fR .ad .RS 25n Successfully set up the mapping for data access. .RE .sp .ne 2 .na \fB\fBDDI_FAILURE\fR\fR .ad .RS 25n Invalid register number \fIrnumber\fR, offset \fIoffset\fR, or length \fIlen\fR. .RE .sp .ne 2 .na \fB\fBDDI_ME_RNUMBER_RANGE\fR\fR .ad .RS 25n Invalid register number \fIrnumber\fR or unable to find \fIreg\fR property. .RE .sp .ne 2 .na \fB\fBDDI_REGS_ACC_CONFLICT\fR\fR .ad .RS 25n Cannot enable the register mapping due to access conflicts with other enabled mappings. .RE .sp .LP Note that the return value \fBDDI_ME_RNUMBER_RANGE\fR is not supported on all platforms. Also, there is potential overlap between \fBDDI_ME_RNUMBER_RANGE\fR and \fBDDI_FAILURE\fR. Drivers should check for \fB!=DDI_SUCCESS\fR rather than checking for a specific failure value. .SH CONTEXT .sp .LP \fBddi_regs_map_setup()\fR must be called from user or kernel context. .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS box; c | c l | l . ATTRIBUTE TYPE ATTRIBUTE VALUE _ Architecture PCI Local Bus, SBus, ISA .TE .SH SEE ALSO .sp .LP \fBattributes\fR(5), \fBddi_regs_map_free\fR(9F), \fBddi_device_acc_attr\fR(9S) .sp .LP \fIWriting Device Drivers\fR