summaryrefslogtreecommitdiff
path: root/usr/src/uts/common/sys/agp/agpmaster_io.h
blob: e492fae1285f4c2aaba9ce5db2c1618c05fd563d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/*
 * CDDL HEADER START
 *
 * 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]
 *
 * CDDL HEADER END
 */

/*
 * Copyright (c) 2009, Intel Corporation.
 * All Rights Reserved.
 */

/*
 * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

#ifndef	_SYS_AGPMASTER_IO_H
#define	_SYS_AGPMASTER_IO_H

#ifdef __cplusplus
extern "C" {
#endif

#ifdef _KERNEL

#define	AGPMASTER_NAME		"agpmaster"
#define	AGPMASTER_DEVLINK	"/dev/agp/agpmaster"

/* macros for layered ioctls */
#define	AGPMASTERIOC_BASE		'M'
#define	DEVICE_DETECT		_IOR(AGPMASTERIOC_BASE, 10, int)
#define	I8XX_GET_INFO		_IOR(AGPMASTERIOC_BASE, 11, igd_info_t)
#define	I810_SET_GTT_BASE	_IOW(AGPMASTERIOC_BASE, 12, uint32_t)
#define	I8XX_ADD2GTT		_IOW(AGPMASTERIOC_BASE, 13, igd_gtt_seg_t)
#define	I8XX_REM_GTT		_IOW(AGPMASTERIOC_BASE, 14, igd_gtt_seg_t)
#define	I8XX_RW_GTT		_IOW(AGPMASTERIOC_BASE, 15, igd_gtt_seg_t)
#define	I8XX_UNCONFIG		_IO(AGPMASTERIOC_BASE, 16)
#define	AGP_MASTER_GETINFO	_IOR(AGPMASTERIOC_BASE, 20, agp_info_t)
#define	AGP_MASTER_SETCMD	_IOW(AGPMASTERIOC_BASE, 21, uint32_t)

/*
 * used for IGD to bind/unbind gtt entries, and RW_GTT
 */
typedef struct igd_gtt_seg {
	uint32_t	igs_pgstart;
	uint32_t	igs_npage;
	uint32_t	*igs_phyaddr; /* pointer to address array */
	uint32_t	igs_type; /* reserved for other memory type */
	uint32_t	igs_flags;
	uint32_t	igs_scratch;
} igd_gtt_seg_t;

/* used for IGD to get info */
typedef struct igd_info {
	uint32_t	igd_devid;
	uint32_t	igd_aperbase;
	size_t		igd_apersize; /* in MB */
} igd_info_t;

typedef struct gtt_impl {
	ddi_acc_handle_t	gtt_mmio_handle; /* mmaped graph registers */
	caddr_t			gtt_mmio_base; /* pointer to register base */
	ddi_acc_handle_t	gtt_handle; /* GTT table */
	caddr_t			gtt_addr; /* pointer to gtt */
	igd_info_t		gtt_info; /* for I8XX_GET_INFO ioctl */
} gtt_impl_t;

typedef struct agp_master_softc {
	uint32_t		agpm_id; /* agp master device id */
	ddi_acc_handle_t	agpm_acc_hdl; /* agp master pci conf handle */
	int			agpm_dev_type; /* which agp device type */
	union {
		off_t		agpm_acaptr; /* AGP capability reg pointer */
		gtt_impl_t	agpm_gtt; /* for gtt table */
	} agpm_data;
} agp_master_softc_t;

extern int agpmaster_attach(dev_info_t *, agp_master_softc_t **,
    ddi_acc_handle_t, minor_t);
extern void agpmaster_detach(agp_master_softc_t **);
extern int agpmaster_ioctl(dev_t dev, int cmd, intptr_t data, int mode,
    cred_t *cred, int *rval, agp_master_softc_t *softc);

#endif /* _KERNEL */

#ifdef __cplusplus
}
#endif

#endif /* _SYS_AGPMASTER_IO_H */