7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #pragma ident "%Z%%M% %I% %E% SMI"
28
29 #include <sys/debug.h>
30 #include <sys/types.h>
31 #include <sys/param.h>
32 #include <sys/time.h>
33 #include <sys/buf.h>
34 #include <sys/errno.h>
35 #include <sys/systm.h>
36 #include <sys/conf.h>
37 #include <sys/signal.h>
38 #include <vm/page.h>
39 #include <vm/as.h>
40 #include <vm/hat.h>
41 #include <vm/seg.h>
42 #include <vm/seg_dev.h>
43 #include <vm/hat_i86.h>
44 #include <sys/ddi.h>
45 #include <sys/devops.h>
46 #include <sys/sunddi.h>
47 #include <sys/ddi_impldefs.h>
48 #include <sys/fs/snode.h>
49 #include <sys/pci.h>
50 #include <sys/vmsystm.h>
51 #include <sys/int_fmtio.h>
52 #include "gfx_private.h"
53
54 #ifdef __xpv
55 #include <sys/hypervisor.h>
56 #endif
57
58 /*
59 * Create a dummy ddi_umem_cookie given to gfxp_devmap_umem_setup().
60 */
61 ddi_umem_cookie_t
62 gfxp_umem_cookie_init(caddr_t kva, size_t size)
63 {
64 struct ddi_umem_cookie *umem_cookie;
65
66 umem_cookie = kmem_zalloc(sizeof (struct ddi_umem_cookie), KM_SLEEP);
67
68 if (umem_cookie == NULL)
69 return (NULL);
70
71 umem_cookie->cvaddr = kva;
72 umem_cookie->type = KMEM_NON_PAGEABLE;
73 umem_cookie->size = size;
74
75 return ((ddi_umem_cookie_t *)umem_cookie);
76 }
77
78 void
79 gfxp_umem_cookie_destroy(ddi_umem_cookie_t cookie)
80 {
81 kmem_free(cookie, sizeof (struct ddi_umem_cookie));
82 }
83
84 /*
85 * called by driver devmap routine to pass kernel virtual address mapping
86 * info to the framework.
87 */
88 /*ARGSUSED*/
89 int
|
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2007 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #include <sys/debug.h>
28 #include <sys/types.h>
29 #include <sys/param.h>
30 #include <sys/time.h>
31 #include <sys/buf.h>
32 #include <sys/errno.h>
33 #include <sys/systm.h>
34 #include <sys/conf.h>
35 #include <sys/signal.h>
36 #include <vm/page.h>
37 #include <vm/as.h>
38 #include <vm/hat.h>
39 #include <vm/seg.h>
40 #include <vm/seg_dev.h>
41 #include <vm/hat_i86.h>
42 #include <sys/ddi.h>
43 #include <sys/devops.h>
44 #include <sys/sunddi.h>
45 #include <sys/ddi_impldefs.h>
46 #include <sys/fs/snode.h>
47 #include <sys/pci.h>
48 #include <sys/vmsystm.h>
49 #include <sys/int_fmtio.h>
50 #include "gfx_private.h"
51
52 #ifdef __xpv
53 #include <sys/hypervisor.h>
54 #endif
55
56 /*
57 * Create a dummy ddi_umem_cookie given to gfxp_devmap_umem_setup().
58 */
59 ddi_umem_cookie_t
60 gfxp_umem_cookie_init(caddr_t kva, size_t size)
61 {
62 struct ddi_umem_cookie *umem_cookie;
63
64 umem_cookie = kmem_zalloc(sizeof (struct ddi_umem_cookie), KM_SLEEP);
65
66 umem_cookie->cvaddr = kva;
67 umem_cookie->type = KMEM_NON_PAGEABLE;
68 umem_cookie->size = size;
69
70 return ((ddi_umem_cookie_t *)umem_cookie);
71 }
72
73 void
74 gfxp_umem_cookie_destroy(ddi_umem_cookie_t cookie)
75 {
76 kmem_free(cookie, sizeof (struct ddi_umem_cookie));
77 }
78
79 /*
80 * called by driver devmap routine to pass kernel virtual address mapping
81 * info to the framework.
82 */
83 /*ARGSUSED*/
84 int
|