xref: /titanic_50/usr/src/uts/common/sys/agp/agpmaster_io.h (revision 0f509175c7fa701d6edf3f65789303587905b1bd)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
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 #ifndef	_SYS_AGPMASTER_IO_H
28 #define	_SYS_AGPMASTER_IO_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 #ifdef _KERNEL
37 
38 #define	AGPMASTER_NAME		"agpmaster"
39 #define	AGPMASTER_DEVLINK	"/dev/agp/agpmaster"
40 
41 /* macros for layered ioctls */
42 #define	AGPMASTERIOC_BASE		'M'
43 #define	DEVICE_DETECT		_IOR(AGPMASTERIOC_BASE, 10, int)
44 #define	I8XX_GET_INFO		_IOR(AGPMASTERIOC_BASE, 11, igd_info_t)
45 #define	I810_SET_GTT_BASE	_IOW(AGPMASTERIOC_BASE, 12, uint32_t)
46 #define	I8XX_ADD2GTT		_IOW(AGPMASTERIOC_BASE, 13, igd_gtt_seg_t)
47 #define	I8XX_REM_GTT		_IOW(AGPMASTERIOC_BASE, 14, igd_gtt_seg_t)
48 #define	I8XX_UNCONFIG		_IO(AGPMASTERIOC_BASE, 16)
49 #define	AGP_MASTER_GETINFO	_IOR(AGPMASTERIOC_BASE, 20, agp_info_t)
50 #define	AGP_MASTER_SETCMD	_IOW(AGPMASTERIOC_BASE, 21, uint32_t)
51 
52 /* used for IGD to bind/unbind gtt entries */
53 typedef struct igd_gtt_seg {
54 	uint32_t	igs_pgstart;
55 	uint32_t	igs_npage;
56 	uint32_t	*igs_phyaddr; /* pointer to address array */
57 	uint32_t	igs_type; /* reserved for other memory type */
58 } igd_gtt_seg_t;
59 
60 /* used for IGD to get info */
61 typedef struct igd_info {
62 	uint32_t	igd_devid;
63 	uint32_t	igd_aperbase;
64 	size_t		igd_apersize; /* in MB */
65 } igd_info_t;
66 
67 typedef struct gtt_impl {
68 	ddi_acc_handle_t	gtt_mmio_handle; /* mmaped graph registers */
69 	caddr_t			gtt_mmio_base; /* pointer to register base */
70 	ddi_acc_handle_t	gtt_handle; /* GTT table */
71 	caddr_t			gtt_addr; /* pointer to gtt */
72 	igd_info_t		gtt_info; /* for I8XX_GET_INFO ioctl */
73 } gtt_impl_t;
74 
75 typedef struct agp_master_softc {
76 	uint32_t		agpm_id; /* agp master device id */
77 	ddi_acc_handle_t	agpm_acc_hdl; /* agp master pci conf handle */
78 	int			agpm_dev_type; /* which agp device type */
79 	union {
80 		off_t		agpm_acaptr; /* AGP capability reg pointer */
81 		gtt_impl_t	agpm_gtt; /* for gtt table */
82 	} agpm_data;
83 } agp_master_softc_t;
84 
85 extern int agpmaster_attach(dev_info_t *, agp_master_softc_t **,
86     ddi_acc_handle_t, minor_t);
87 extern void agpmaster_detach(agp_master_softc_t **);
88 extern int agpmaster_ioctl(dev_t dev, int cmd, intptr_t data, int mode,
89     cred_t *cred, int *rval, agp_master_softc_t *softc);
90 
91 #endif /* _KERNEL */
92 
93 #ifdef __cplusplus
94 }
95 #endif
96 
97 #endif /* _SYS_AGPMASTER_IO_H */
98