xref: /titanic_44/usr/src/uts/common/sys/agpgart.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
3*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
4*7c478bd9Sstevel@tonic-gate  */
5*7c478bd9Sstevel@tonic-gate 
6*7c478bd9Sstevel@tonic-gate /*
7*7c478bd9Sstevel@tonic-gate  * Copyright (c) 2000 Doug Rabson
8*7c478bd9Sstevel@tonic-gate  * All rights reserved.
9*7c478bd9Sstevel@tonic-gate  *
10*7c478bd9Sstevel@tonic-gate  * Redistribution and use in source and binary forms, with or without
11*7c478bd9Sstevel@tonic-gate  * modification, are permitted provided that the following conditions
12*7c478bd9Sstevel@tonic-gate  * are met:
13*7c478bd9Sstevel@tonic-gate  * 1. Redistributions of source code must retain the above copyright
14*7c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer.
15*7c478bd9Sstevel@tonic-gate  * 2. Redistributions in binary form must reproduce the above copyright
16*7c478bd9Sstevel@tonic-gate  *    notice, this list of conditions and the following disclaimer in the
17*7c478bd9Sstevel@tonic-gate  *    documentation and/or other materials provided with the distribution.
18*7c478bd9Sstevel@tonic-gate  *
19*7c478bd9Sstevel@tonic-gate  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20*7c478bd9Sstevel@tonic-gate  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21*7c478bd9Sstevel@tonic-gate  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*7c478bd9Sstevel@tonic-gate  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23*7c478bd9Sstevel@tonic-gate  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24*7c478bd9Sstevel@tonic-gate  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25*7c478bd9Sstevel@tonic-gate  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26*7c478bd9Sstevel@tonic-gate  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27*7c478bd9Sstevel@tonic-gate  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28*7c478bd9Sstevel@tonic-gate  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29*7c478bd9Sstevel@tonic-gate  * SUCH DAMAGE.
30*7c478bd9Sstevel@tonic-gate  *
31*7c478bd9Sstevel@tonic-gate  */
32*7c478bd9Sstevel@tonic-gate 
33*7c478bd9Sstevel@tonic-gate #ifndef	_SYS_AGPGART_H
34*7c478bd9Sstevel@tonic-gate #define	_SYS_AGPGART_H
35*7c478bd9Sstevel@tonic-gate 
36*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
37*7c478bd9Sstevel@tonic-gate 
38*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
39*7c478bd9Sstevel@tonic-gate extern "C" {
40*7c478bd9Sstevel@tonic-gate #endif
41*7c478bd9Sstevel@tonic-gate 
42*7c478bd9Sstevel@tonic-gate #define	AGP_NORMAL	0	/* mapped to user land, no cache */
43*7c478bd9Sstevel@tonic-gate 
44*7c478bd9Sstevel@tonic-gate typedef struct _agp_version {
45*7c478bd9Sstevel@tonic-gate 	uint16_t	agpv_major;
46*7c478bd9Sstevel@tonic-gate 	uint16_t	agpv_minor;
47*7c478bd9Sstevel@tonic-gate } agp_version_t;
48*7c478bd9Sstevel@tonic-gate 
49*7c478bd9Sstevel@tonic-gate 
50*7c478bd9Sstevel@tonic-gate typedef struct	_agp_info {
51*7c478bd9Sstevel@tonic-gate 	agp_version_t	agpi_version;
52*7c478bd9Sstevel@tonic-gate 	uint32_t	agpi_devid;	/* bridge vendor + device */
53*7c478bd9Sstevel@tonic-gate 	uint32_t	agpi_mode;	/* mode of brdige */
54*7c478bd9Sstevel@tonic-gate 	ulong_t		agpi_aperbase;	/* base of aperture */
55*7c478bd9Sstevel@tonic-gate 	size_t		agpi_apersize;	/* aperture range size */
56*7c478bd9Sstevel@tonic-gate 	uint32_t	agpi_pgtotal;	/* max number of pages in aperture */
57*7c478bd9Sstevel@tonic-gate 	uint32_t	agpi_pgsystem;	/* same as pg_total */
58*7c478bd9Sstevel@tonic-gate 	uint32_t	agpi_pgused;	/* NUMBER of currently used pages */
59*7c478bd9Sstevel@tonic-gate } agp_info_t;
60*7c478bd9Sstevel@tonic-gate 
61*7c478bd9Sstevel@tonic-gate typedef struct _agp_setup {
62*7c478bd9Sstevel@tonic-gate 	uint32_t	agps_mode;
63*7c478bd9Sstevel@tonic-gate } agp_setup_t;
64*7c478bd9Sstevel@tonic-gate 
65*7c478bd9Sstevel@tonic-gate typedef struct _agp_allocate {
66*7c478bd9Sstevel@tonic-gate 	int32_t		agpa_key;
67*7c478bd9Sstevel@tonic-gate 	uint32_t	agpa_pgcount;
68*7c478bd9Sstevel@tonic-gate 	uint32_t	agpa_type;
69*7c478bd9Sstevel@tonic-gate 	uint32_t	agpa_physical;	/* for i810 only, private */
70*7c478bd9Sstevel@tonic-gate } agp_allocate_t;
71*7c478bd9Sstevel@tonic-gate 
72*7c478bd9Sstevel@tonic-gate typedef struct _agp_bind {
73*7c478bd9Sstevel@tonic-gate 	int32_t		agpb_key;
74*7c478bd9Sstevel@tonic-gate 	uint32_t	agpb_pgstart;
75*7c478bd9Sstevel@tonic-gate } agp_bind_t;
76*7c478bd9Sstevel@tonic-gate 
77*7c478bd9Sstevel@tonic-gate typedef struct _agp_unbind {
78*7c478bd9Sstevel@tonic-gate 	int32_t		agpu_key;
79*7c478bd9Sstevel@tonic-gate 	uint32_t	agpu_pri;	/* no use in solaris */
80*7c478bd9Sstevel@tonic-gate } agp_unbind_t;
81*7c478bd9Sstevel@tonic-gate 
82*7c478bd9Sstevel@tonic-gate #define	AGPIOC_BASE		'G'
83*7c478bd9Sstevel@tonic-gate #define	AGPIOC_INFO		_IOR(AGPIOC_BASE, 0, 100)
84*7c478bd9Sstevel@tonic-gate #define	AGPIOC_ACQUIRE		_IO(AGPIOC_BASE, 1)
85*7c478bd9Sstevel@tonic-gate #define	AGPIOC_RELEASE		_IO(AGPIOC_BASE, 2)
86*7c478bd9Sstevel@tonic-gate #define	AGPIOC_SETUP		_IOW(AGPIOC_BASE, 3, agp_setup_t)
87*7c478bd9Sstevel@tonic-gate #define	AGPIOC_ALLOCATE		_IOWR(AGPIOC_BASE, 4, agp_allocate_t)
88*7c478bd9Sstevel@tonic-gate #define	AGPIOC_DEALLOCATE	_IOW(AGPIOC_BASE, 5, int)
89*7c478bd9Sstevel@tonic-gate #define	AGPIOC_BIND		_IOW(AGPIOC_BASE, 6, agp_bind_t)
90*7c478bd9Sstevel@tonic-gate #define	AGPIOC_UNBIND		_IOW(AGPIOC_BASE, 7, agp_unbind_t)
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate /* AGP status register bits definition */
93*7c478bd9Sstevel@tonic-gate #define	AGPSTAT_RQ_MASK		0xff000000	/* target only */
94*7c478bd9Sstevel@tonic-gate #define	AGPSTAT_SBA		(0x1 << 9)	/* always 1 for 3.0 */
95*7c478bd9Sstevel@tonic-gate #define	AGPSTAT_OVER4G		(0x1 << 5)
96*7c478bd9Sstevel@tonic-gate #define	AGPSTAT_FW		(0x1 << 4)
97*7c478bd9Sstevel@tonic-gate #define	AGPSTAT_RATE_MASK	0x7
98*7c478bd9Sstevel@tonic-gate /* rate for 2.0 mode */
99*7c478bd9Sstevel@tonic-gate #define	AGP2_RATE_1X		0x1
100*7c478bd9Sstevel@tonic-gate #define	AGP2_RATE_2X		0x2
101*7c478bd9Sstevel@tonic-gate #define	AGP2_RATE_4X		0x4
102*7c478bd9Sstevel@tonic-gate /* AGP 3.0 only bits */
103*7c478bd9Sstevel@tonic-gate #define	AGPSTAT_ARQSZ_MASK	(0x7 << 13)	/* target only */
104*7c478bd9Sstevel@tonic-gate #define	AGPSTAT_CAL_MASK	(0x7 << 10)
105*7c478bd9Sstevel@tonic-gate #define	AGPSTAT_GART64B		(0x1 << 7)	/* target only */
106*7c478bd9Sstevel@tonic-gate #define	AGPSTAT_MODE3		(0x1 << 3)
107*7c478bd9Sstevel@tonic-gate /* Rate for 3.0 mode */
108*7c478bd9Sstevel@tonic-gate #define	AGP3_RATE_4X		0x1
109*7c478bd9Sstevel@tonic-gate #define	AGP3_RATE_8X		0x2
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate /* AGP command register bits definition */
112*7c478bd9Sstevel@tonic-gate #define	AGPCMD_RQ_MASK		0xff000000	/* master only */
113*7c478bd9Sstevel@tonic-gate #define	AGPCMD_SBAEN		(0x1 << 9)	/* must be 1 for 3.0 */
114*7c478bd9Sstevel@tonic-gate #define	AGPCMD_AGPEN		(0x1 << 8)
115*7c478bd9Sstevel@tonic-gate #define	AGPCMD_OVER4GEN		(0x1 << 5)
116*7c478bd9Sstevel@tonic-gate #define	AGPCMD_FWEN		(0x1 << 4)
117*7c478bd9Sstevel@tonic-gate #define	AGPCMD_RATE_MASK	0x7
118*7c478bd9Sstevel@tonic-gate /* AGP 3.0 only bits */
119*7c478bd9Sstevel@tonic-gate #define	AGP3_CMD_ARQSZ_MASK	(0x7 << 13)	/* master only */
120*7c478bd9Sstevel@tonic-gate #define	AGP3_CMD_CAL_MASK	(0x7 << 10)	/* target only */
121*7c478bd9Sstevel@tonic-gate #define	AGP3_CMD_GART64BEN	(0x1 << 7)	/* target only */
122*7c478bd9Sstevel@tonic-gate 
123*7c478bd9Sstevel@tonic-gate #define	AGP_DEVICE	"/dev/agpgart"
124*7c478bd9Sstevel@tonic-gate 
125*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
126*7c478bd9Sstevel@tonic-gate }
127*7c478bd9Sstevel@tonic-gate #endif
128*7c478bd9Sstevel@tonic-gate 
129*7c478bd9Sstevel@tonic-gate #endif /* _SYS_AGPGART_H */
130