fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * CDDL HEADER START
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * The contents of this file are subject to the terms of the
b9ae6f870f313422d793ca2506497dd04c858bddrugrat * Common Development and Distribution License (the "License").
b9ae6f870f313422d793ca2506497dd04c858bddrugrat * You may not use this file except in compliance with the License.
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * See the License for the specific language governing permissions
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * and limitations under the License.
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * When distributing Covered Code, include this CDDL HEADER in each
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * If applicable, add the following below this CDDL HEADER, with the
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * fields enclosed by brackets "[]" replaced with your own identifying
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * information: Portions Copyright [yyyy] [name of copyright owner]
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * CDDL HEADER END
b9ae6f870f313422d793ca2506497dd04c858bddrugrat * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * Use is subject to license terms.
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat#pragma ident "%Z%%M% %I% %E% SMI"
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * clone of ddi_segmap_setup(). Respects the requested cache
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * attributes so hat_devload() gives user space WC and
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * UC mappings for system memory.
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat/*ARGSUSED*/
fc1821fee2e1f208a4b5ff3e229e97b87979208arugratgfxp_ddi_segmap_setup(dev_t dev, off_t offset, struct as *as, caddr_t *addrp,
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat off_t len, uint_t prot, uint_t maxprot, uint_t flags, cred_t *cred,
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat if ((mapfunc = devopsp[getmajor(dev)]->devo_cb_ops->cb_mmap) == nodev)
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * Character devices that support the d_mmap
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * interface can only be mmap'ed shared.
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * Check that this region is indeed mappable on this platform.
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * Use the mapping function.
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat if (ddi_device_mapping_check(dev, accattrp, rnumber, &hat_attr) == -1)
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat /* Want UC */
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat /* Want WC */
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * Check to ensure that the entire range is
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * legal and we are not trying to map in
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * more than the device will let us.
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat if (i == 0) {
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * Save the pfn at offset here. This pfn will be
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * used later to get user address.
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * Pick an address w/o worrying about
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * any vac alignment constraints.
fc1821fee2e1f208a4b5ff3e229e97b87979208arugrat * User-specified address; blow away any previous mappings.