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 (c) 2009, Intel Corporation.
24 * All Rights Reserved.
25 */
26
27 /*
28 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
29 * Use is subject to license terms.
30 */
31
32 #ifndef _SYS_AGPMASTER_IO_H
33 #define _SYS_AGPMASTER_IO_H
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #ifdef _KERNEL
40
41 #define AGPMASTER_NAME "agpmaster"
42 #define AGPMASTER_DEVLINK "/dev/agp/agpmaster"
43
44 /* macros for layered ioctls */
45 #define AGPMASTERIOC_BASE 'M'
46 #define DEVICE_DETECT _IOR(AGPMASTERIOC_BASE, 10, int)
47 #define I8XX_GET_INFO _IOR(AGPMASTERIOC_BASE, 11, igd_info_t)
48 #define I810_SET_GTT_BASE _IOW(AGPMASTERIOC_BASE, 12, uint32_t)
49 #define I8XX_ADD2GTT _IOW(AGPMASTERIOC_BASE, 13, igd_gtt_seg_t)
50 #define I8XX_REM_GTT _IOW(AGPMASTERIOC_BASE, 14, igd_gtt_seg_t)
51 #define I8XX_UNCONFIG _IO(AGPMASTERIOC_BASE, 16)
52 #define AGP_MASTER_GETINFO _IOR(AGPMASTERIOC_BASE, 20, agp_info_t)
53 #define AGP_MASTER_SETCMD _IOW(AGPMASTERIOC_BASE, 21, uint32_t)
54
55 /* used for IGD to bind/unbind gtt entries */
56 typedef struct igd_gtt_seg {
57 uint32_t igs_pgstart;
58 uint32_t igs_npage;
59 uint32_t *igs_phyaddr; /* pointer to address array */
60 uint32_t igs_type; /* reserved for other memory type */
61 } igd_gtt_seg_t;
62
63 /* used for IGD to get info */
64 typedef struct igd_info {
65 uint32_t igd_devid;
66 uint32_t igd_aperbase;
67 size_t igd_apersize; /* in MB */
68 } igd_info_t;
69
70 typedef struct gtt_impl {
71 ddi_acc_handle_t gtt_mmio_handle; /* mmaped graph registers */
72 caddr_t gtt_mmio_base; /* pointer to register base */
73 ddi_acc_handle_t gtt_handle; /* GTT table */
74 caddr_t gtt_addr; /* pointer to gtt */
75 igd_info_t gtt_info; /* for I8XX_GET_INFO ioctl */
76 } gtt_impl_t;
77
78 typedef struct agp_master_softc {
79 uint32_t agpm_id; /* agp master device id */
80 ddi_acc_handle_t agpm_acc_hdl; /* agp master pci conf handle */
81 int agpm_dev_type; /* which agp device type */
82 union {
83 off_t agpm_acaptr; /* AGP capability reg pointer */
84 gtt_impl_t agpm_gtt; /* for gtt table */
85 } agpm_data;
86 } agp_master_softc_t;
87
88 extern int agpmaster_attach(dev_info_t *, agp_master_softc_t **,
89 ddi_acc_handle_t, minor_t);
90 extern void agpmaster_detach(agp_master_softc_t **);
91 extern int agpmaster_ioctl(dev_t dev, int cmd, intptr_t data, int mode,
92 cred_t *cred, int *rval, agp_master_softc_t *softc);
93
94 #endif /* _KERNEL */
95
96 #ifdef __cplusplus
97 }
98 #endif
99
100 #endif /* _SYS_AGPMASTER_IO_H */