xref: /titanic_44/usr/src/uts/common/sys/agp/agpdefs.h (revision 2e6e901d9406e1a048063c872149376a6bf7cb63)
17c478bd9Sstevel@tonic-gate /*
2543414e0Skz151634  * CDDL HEADER START
3543414e0Skz151634  *
4543414e0Skz151634  * The contents of this file are subject to the terms of the
5543414e0Skz151634  * Common Development and Distribution License (the "License").
6543414e0Skz151634  * You may not use this file except in compliance with the License.
7543414e0Skz151634  *
8543414e0Skz151634  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9543414e0Skz151634  * or http://www.opensolaris.org/os/licensing.
10543414e0Skz151634  * See the License for the specific language governing permissions
11543414e0Skz151634  * and limitations under the License.
12543414e0Skz151634  *
13543414e0Skz151634  * When distributing Covered Code, include this CDDL HEADER in each
14543414e0Skz151634  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15543414e0Skz151634  * If applicable, add the following below this CDDL HEADER, with the
16543414e0Skz151634  * fields enclosed by brackets "[]" replaced with your own identifying
17543414e0Skz151634  * information: Portions Copyright [yyyy] [name of copyright owner]
18543414e0Skz151634  *
19543414e0Skz151634  * CDDL HEADER END
20543414e0Skz151634  */
21543414e0Skz151634 
22543414e0Skz151634 /*
230035d21cSmiao chen - Sun Microsystems - Beijing China  * Copyright (c) 2009, Intel Corporation.
240035d21cSmiao chen - Sun Microsystems - Beijing China  * All Rights Reserved.
250035d21cSmiao chen - Sun Microsystems - Beijing China  */
260035d21cSmiao chen - Sun Microsystems - Beijing China 
270035d21cSmiao chen - Sun Microsystems - Beijing China /*
28d0231070Smiao chen - Sun Microsystems - Beijing China  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
297c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
307c478bd9Sstevel@tonic-gate  */
317c478bd9Sstevel@tonic-gate 
327c478bd9Sstevel@tonic-gate #ifndef _SYS_AGPDEFS_H
337c478bd9Sstevel@tonic-gate #define	_SYS_AGPDEFS_H
347c478bd9Sstevel@tonic-gate 
357c478bd9Sstevel@tonic-gate #ifdef __cplusplus
367c478bd9Sstevel@tonic-gate extern "C" {
377c478bd9Sstevel@tonic-gate #endif
387c478bd9Sstevel@tonic-gate 
397c478bd9Sstevel@tonic-gate /*
40543414e0Skz151634  * This AGP memory type is required by some hardware like i810 video
417c478bd9Sstevel@tonic-gate  * card, which need physical contiguous pages to setup hardware cursor.
427c478bd9Sstevel@tonic-gate  * Usually, several tens of kilo bytes are needed in this case.
437c478bd9Sstevel@tonic-gate  * We use DDI DMA interfaces to allocate such memory in agpgart driver,
447c478bd9Sstevel@tonic-gate  * and it can not be exported to user applications directly by calling mmap
457c478bd9Sstevel@tonic-gate  * on agpgart driver. The typical usage scenario is as the following:
467c478bd9Sstevel@tonic-gate  * Firstly, Xserver get the memory physical address by calling AGPIOC_ALLOCATE
477c478bd9Sstevel@tonic-gate  * on agpgart driver. Secondly, Xserver use the physical address to mmap
487c478bd9Sstevel@tonic-gate  * the memory to Xserver space area by xsvc driver.
497c478bd9Sstevel@tonic-gate  *
507c478bd9Sstevel@tonic-gate  */
517c478bd9Sstevel@tonic-gate #define	AGP_PHYSICAL		2	/* Only used for i810, HW curosr */
527c478bd9Sstevel@tonic-gate 
537c478bd9Sstevel@tonic-gate #ifdef _KERNEL
547c478bd9Sstevel@tonic-gate 
557c478bd9Sstevel@tonic-gate /* AGP space units */
567c478bd9Sstevel@tonic-gate #define	AGP_PAGE_SHIFT			12
577c478bd9Sstevel@tonic-gate #define	AGP_PAGE_SIZE			(1 << AGP_PAGE_SHIFT)
587c478bd9Sstevel@tonic-gate #define	AGP_PAGE_OFFSET			(AGP_PAGE_SIZE - 1)
597c478bd9Sstevel@tonic-gate #define	AGP_MB2PAGES(x)			((x) << 8)
607c478bd9Sstevel@tonic-gate #define	AGP_PAGES2BYTES(x)		((x) << AGP_PAGE_SHIFT)
617c478bd9Sstevel@tonic-gate #define	AGP_BYTES2PAGES(x)		((x) >> AGP_PAGE_SHIFT)
627c478bd9Sstevel@tonic-gate #define	AGP_PAGES2KB(x)			((x) << 2)
637c478bd9Sstevel@tonic-gate #define	AGP_ALIGNED(offset)		(((offset) & AGP_PAGE_OFFSET) == 0)
647c478bd9Sstevel@tonic-gate 
657c478bd9Sstevel@tonic-gate /* stand pci register offset */
667c478bd9Sstevel@tonic-gate #define	PCI_CONF_CAP_MASK		0x10
677c478bd9Sstevel@tonic-gate #define	PCI_CONF_CAPID_MASK		0xff
687c478bd9Sstevel@tonic-gate #define	PCI_CONF_NCAPID_MASK		0xff00
697c478bd9Sstevel@tonic-gate 
707c478bd9Sstevel@tonic-gate #define	INTEL_VENDOR_ID			0x8086
717c478bd9Sstevel@tonic-gate #define	AMD_VENDOR_ID			0x1022
727c478bd9Sstevel@tonic-gate #define	VENDOR_ID_MASK			0xffff
737c478bd9Sstevel@tonic-gate 
747c478bd9Sstevel@tonic-gate /* macros for device types */
757c478bd9Sstevel@tonic-gate #define	DEVICE_IS_I810		11 /* intel i810 series video card */
767c478bd9Sstevel@tonic-gate #define	DEVICE_IS_I830		12 /* intel i830, i845, i855 series */
777c478bd9Sstevel@tonic-gate #define	DEVICE_IS_AGP		21 /* external AGP video card */
787c478bd9Sstevel@tonic-gate #define	CHIP_IS_INTEL		10 /* intel agp bridge */
797c478bd9Sstevel@tonic-gate #define	CHIP_IS_AMD		20 /* amd agp bridge */
807c478bd9Sstevel@tonic-gate 
817c478bd9Sstevel@tonic-gate /* AGP bridge device id */
827c478bd9Sstevel@tonic-gate #define	AMD_BR_8151			0x74541022
837c478bd9Sstevel@tonic-gate #define	INTEL_BR_810			0x71208086
847c478bd9Sstevel@tonic-gate #define	INTEL_BR_810DC			0x71228086
857c478bd9Sstevel@tonic-gate #define	INTEL_BR_810E			0x71248086
867c478bd9Sstevel@tonic-gate #define	INTEL_BR_815			0x11308086 /* include 815G/EG/P/EP */
877c478bd9Sstevel@tonic-gate #define	INTEL_BR_830M			0x35758086
887c478bd9Sstevel@tonic-gate #define	INTEL_BR_845			0x25608086 /* include 845G/P */
897c478bd9Sstevel@tonic-gate #define	INTEL_BR_855GM			0x35808086 /* include 852GM/PM */
907c478bd9Sstevel@tonic-gate #define	INTEL_BR_855PM			0x33408086
917c478bd9Sstevel@tonic-gate #define	INTEL_BR_865			0x25708086
92543414e0Skz151634 #define	INTEL_BR_915			0x25808086
93543414e0Skz151634 #define	INTEL_BR_915GM			0x25908086
94f4f0e748Szw161486 #define	INTEL_BR_945			0x27708086
955dbcb2a2Skz151634 #define	INTEL_BR_945GM			0x27a08086
9612db04d3Smiao chen - Sun Microsystems - Beijing China #define	INTEL_BR_945GME			0x27ac8086
97543414e0Skz151634 #define	INTEL_BR_946GZ			0x29708086
98543414e0Skz151634 #define	INTEL_BR_965G1			0x29808086
99543414e0Skz151634 #define	INTEL_BR_965Q			0x29908086
100543414e0Skz151634 #define	INTEL_BR_965G2			0x29a08086
101543414e0Skz151634 #define	INTEL_BR_965GM			0x2a008086
102f7b793feSkz151634 #define	INTEL_BR_965GME			0x2a108086
103c4f91784Skz151634 #define	INTEL_BR_Q35			0x29b08086
104c4f91784Skz151634 #define	INTEL_BR_G33			0x29c08086
105c4f91784Skz151634 #define	INTEL_BR_Q33			0x29d08086
106219cee99Smc196098 #define	INTEL_BR_GM45			0x2a408086
107fc6df3bdSmiao chen - Sun Microsystems - Beijing China #define	INTEL_BR_EL			0x2e008086
108fc6df3bdSmiao chen - Sun Microsystems - Beijing China #define	INTEL_BR_Q45			0x2e108086
109fc6df3bdSmiao chen - Sun Microsystems - Beijing China #define	INTEL_BR_G45			0x2e208086
110d0231070Smiao chen - Sun Microsystems - Beijing China #define	INTEL_BR_G41			0x2e308086
111*2e6e901dSmiao chen - Sun Microsystems - Beijing China #define	INTEL_BR_IGDNG_D		0x00408086
112*2e6e901dSmiao chen - Sun Microsystems - Beijing China #define	INTEL_BR_IGDNG_M		0x00448086
113*2e6e901dSmiao chen - Sun Microsystems - Beijing China #define	INTEL_BR_IGDNG_MA		0x00628086
114*2e6e901dSmiao chen - Sun Microsystems - Beijing China #define	INTEL_BR_IGDNG_MC2		0x006a8086
1150035d21cSmiao chen - Sun Microsystems - Beijing China #define	INTEL_BR_B43			0x2e408086
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate /* AGP common register offset in pci configuration space */
1187c478bd9Sstevel@tonic-gate #define	AGP_CONF_MISC			0x51 /* one byte */
1197c478bd9Sstevel@tonic-gate #define	AGP_CONF_CAPPTR			0x34
1207c478bd9Sstevel@tonic-gate #define	AGP_CONF_APERBASE		0x10
1217c478bd9Sstevel@tonic-gate #define	AGP_CONF_STATUS			0x04 /* CAP + 0x4 */
1227c478bd9Sstevel@tonic-gate #define	AGP_CONF_COMMAND		0x08 /* CAP + 0x8 */
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate /* AGP target register and mask defines */
1257c478bd9Sstevel@tonic-gate #define	AGP_CONF_CONTROL		0x10 /* CAP + 0x10 */
1267c478bd9Sstevel@tonic-gate #define	AGP_TARGET_BAR1			1
1277c478bd9Sstevel@tonic-gate #define	AGP_32_APERBASE_MASK		0xffc00000 /* 4M aligned */
1287c478bd9Sstevel@tonic-gate #define	AGP_64_APERBASE_MASK		0xffffc00000LL /* 4M aligned */
1297c478bd9Sstevel@tonic-gate #define	AGP_CONF_APERSIZE		0x14 /* CAP + 0x14 */
1307c478bd9Sstevel@tonic-gate #define	AGP_CONF_ATTBASE		0x18 /* CAP + 0x18 */
1317c478bd9Sstevel@tonic-gate #define	AGP_ATTBASE_MASK		0xfffff000
1327c478bd9Sstevel@tonic-gate #define	AGPCTRL_GTLBEN			(0x1 << 7)
1337c478bd9Sstevel@tonic-gate #define	AGP_APER_TYPE_MASK		0x4
1347c478bd9Sstevel@tonic-gate #define	AGP_APER_SIZE_MASK		0xf00
1357c478bd9Sstevel@tonic-gate #define	AGP_APER_128M_MASK		0x3f
1367c478bd9Sstevel@tonic-gate #define	AGP_APER_4G_MASK		0xf00
1377c478bd9Sstevel@tonic-gate #define	AGP_APER_4M			0x3f
1387c478bd9Sstevel@tonic-gate #define	AGP_APER_8M			0x3e
1397c478bd9Sstevel@tonic-gate #define	AGP_APER_16M			0x3c
1407c478bd9Sstevel@tonic-gate #define	AGP_APER_32M			0x38
1417c478bd9Sstevel@tonic-gate #define	AGP_APER_64M			0x30
1427c478bd9Sstevel@tonic-gate #define	AGP_APER_128M			0x20
1437c478bd9Sstevel@tonic-gate #define	AGP_APER_256M			0xf00
1447c478bd9Sstevel@tonic-gate #define	AGP_APER_512M			0xe00
1457c478bd9Sstevel@tonic-gate #define	AGP_APER_1024M			0xc00
1467c478bd9Sstevel@tonic-gate #define	AGP_APER_2048M			0x800
1477c478bd9Sstevel@tonic-gate #define	AGP_APER_4G			0x000
1487c478bd9Sstevel@tonic-gate #define	AGP_MISC_APEN			0x2
1497c478bd9Sstevel@tonic-gate 
1507c478bd9Sstevel@tonic-gate /* AGP gart table definition */
1517c478bd9Sstevel@tonic-gate #define	AGP_ENTRY_VALID			0x1
1527c478bd9Sstevel@tonic-gate 
1537c478bd9Sstevel@tonic-gate /* AGP term definitions */
1547c478bd9Sstevel@tonic-gate #define	AGP_CAP_ID			0x2
1557c478bd9Sstevel@tonic-gate #define	AGP_CAP_OFF_DEF			0xa0
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate /* Intel integrated video card, chipset id */
1587c478bd9Sstevel@tonic-gate #define	INTEL_IGD_810			0x71218086
1597c478bd9Sstevel@tonic-gate #define	INTEL_IGD_810DC			0x71238086
1607c478bd9Sstevel@tonic-gate #define	INTEL_IGD_810E			0x71258086
1617c478bd9Sstevel@tonic-gate #define	INTEL_IGD_815			0x11328086
1627c478bd9Sstevel@tonic-gate #define	INTEL_IGD_830M			0x35778086
1637c478bd9Sstevel@tonic-gate #define	INTEL_IGD_845G			0x25628086
1647c478bd9Sstevel@tonic-gate #define	INTEL_IGD_855GM			0x35828086
1657c478bd9Sstevel@tonic-gate #define	INTEL_IGD_865G			0x25728086
166543414e0Skz151634 #define	INTEL_IGD_915			0x25828086
167543414e0Skz151634 #define	INTEL_IGD_915GM			0x25928086
168f4f0e748Szw161486 #define	INTEL_IGD_945			0x27728086
1695dbcb2a2Skz151634 #define	INTEL_IGD_945GM			0x27a28086
17012db04d3Smiao chen - Sun Microsystems - Beijing China #define	INTEL_IGD_945GME		0x27ae8086
171543414e0Skz151634 #define	INTEL_IGD_946GZ			0x29728086
172543414e0Skz151634 #define	INTEL_IGD_965G1			0x29828086
173543414e0Skz151634 #define	INTEL_IGD_965Q			0x29928086
174543414e0Skz151634 #define	INTEL_IGD_965G2			0x29a28086
175543414e0Skz151634 #define	INTEL_IGD_965GM			0x2a028086
176f7b793feSkz151634 #define	INTEL_IGD_965GME		0x2a128086
177c4f91784Skz151634 #define	INTEL_IGD_Q35			0x29b28086
178c4f91784Skz151634 #define	INTEL_IGD_G33			0x29c28086
179c4f91784Skz151634 #define	INTEL_IGD_Q33			0x29d28086
180219cee99Smc196098 #define	INTEL_IGD_GM45			0x2a428086
181fc6df3bdSmiao chen - Sun Microsystems - Beijing China #define	INTEL_IGD_EL			0x2e028086
182fc6df3bdSmiao chen - Sun Microsystems - Beijing China #define	INTEL_IGD_Q45			0x2e128086
183fc6df3bdSmiao chen - Sun Microsystems - Beijing China #define	INTEL_IGD_G45			0x2e228086
184d0231070Smiao chen - Sun Microsystems - Beijing China #define	INTEL_IGD_G41			0x2e328086
185*2e6e901dSmiao chen - Sun Microsystems - Beijing China #define	INTEL_IGD_IGDNG_D		0x00428086
186*2e6e901dSmiao chen - Sun Microsystems - Beijing China #define	INTEL_IGD_IGDNG_M		0x00468086
1870035d21cSmiao chen - Sun Microsystems - Beijing China #define	INTEL_IGD_B43			0x2e428086
1880035d21cSmiao chen - Sun Microsystems - Beijing China 
1890035d21cSmiao chen - Sun Microsystems - Beijing China /* Intel 915 and 945 series */
1900035d21cSmiao chen - Sun Microsystems - Beijing China #define	IS_INTEL_915(device) ((device == INTEL_IGD_915) ||	\
1910035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_915GM) ||	\
1920035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_945) ||	\
1930035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_945GM) ||	\
1940035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_945GME))
1950035d21cSmiao chen - Sun Microsystems - Beijing China 
1960035d21cSmiao chen - Sun Microsystems - Beijing China /* Intel 965 series */
1970035d21cSmiao chen - Sun Microsystems - Beijing China #define	IS_INTEL_965(device) ((device == INTEL_IGD_946GZ) ||	\
1980035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_965G1) ||	\
1990035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_965Q) ||	\
2000035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_965G2) ||	\
2010035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_965GM) ||	\
2020035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_965GME) ||	\
2030035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_GM45) ||	\
2040035d21cSmiao chen - Sun Microsystems - Beijing China 	IS_INTEL_G4X(device))
2050035d21cSmiao chen - Sun Microsystems - Beijing China 
2060035d21cSmiao chen - Sun Microsystems - Beijing China /* Intel G33 series */
2070035d21cSmiao chen - Sun Microsystems - Beijing China #define	IS_INTEL_X33(device) ((device == INTEL_IGD_Q35) ||	\
2080035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_G33) ||	\
2090035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_Q33))
2100035d21cSmiao chen - Sun Microsystems - Beijing China 
211*2e6e901dSmiao chen - Sun Microsystems - Beijing China /* IGDNG */
212*2e6e901dSmiao chen - Sun Microsystems - Beijing China #define	IS_IGDNG(device)	((device == INTEL_IGD_IGDNG_D) ||	\
213*2e6e901dSmiao chen - Sun Microsystems - Beijing China 			(device == INTEL_IGD_IGDNG_M))
214*2e6e901dSmiao chen - Sun Microsystems - Beijing China 
2150035d21cSmiao chen - Sun Microsystems - Beijing China /* Intel G4X series */
2160035d21cSmiao chen - Sun Microsystems - Beijing China #define	IS_INTEL_G4X(device) ((device == INTEL_IGD_EL) ||	\
2170035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_Q45) ||	\
2180035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_G45) ||	\
2190035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_G41) ||	\
220*2e6e901dSmiao chen - Sun Microsystems - Beijing China 	IS_IGDNG(device) ||	\
2210035d21cSmiao chen - Sun Microsystems - Beijing China 	(device == INTEL_IGD_B43))
222219cee99Smc196098 
223c4f91784Skz151634 /* register offsets in PCI config space */
224c4f91784Skz151634 #define	I8XX_CONF_GMADR			0x10 /* GMADR of i8xx series */
225c4f91784Skz151634 #define	I915_CONF_GMADR			0x18 /* GMADR of i915 series */
226c4f91784Skz151634 /* (Mirror) GMCH Graphics Control Register (GGC, MGGC) */
227c4f91784Skz151634 #define	I8XX_CONF_GC			0x52
2287c478bd9Sstevel@tonic-gate 
2297c478bd9Sstevel@tonic-gate /* Intel integrated video card graphics mode mask */
2307c478bd9Sstevel@tonic-gate #define	I8XX_GC_MODE_MASK		0x70
231c4f91784Skz151634 #define	IX33_GC_MODE_MASK		0xf0
232c4f91784Skz151634 /* GTT Graphics Memory Size (9:8) in GMCH Graphics Control Register */
233c4f91784Skz151634 #define	IX33_GGMS_MASK			0x300
234c4f91784Skz151634 /* No VT mode, 1MB allocated for GTT */
235c4f91784Skz151634 #define	IX33_GGMS_1M			0x100
236c4f91784Skz151634 /* VT mode, 2MB allocated for GTT */
237c4f91784Skz151634 #define	IX33_GGMS_2M			0x200
2387c478bd9Sstevel@tonic-gate 
2397c478bd9Sstevel@tonic-gate /* Intel integrated video card GTT definition */
2407c478bd9Sstevel@tonic-gate #define	GTT_PAGE_SHIFT			12
2417c478bd9Sstevel@tonic-gate #define	GTT_PAGE_SIZE			(1 << GTT_PAGE_SHIFT)
2427c478bd9Sstevel@tonic-gate #define	GTT_PAGE_OFFSET			(GTT_PAGE_SIZE - 1)
2437c478bd9Sstevel@tonic-gate #define	GTT_PTE_MASK			(~GTT_PAGE_OFFSET)
2447c478bd9Sstevel@tonic-gate #define	GTT_PTE_VALID			0x1
2457c478bd9Sstevel@tonic-gate #define	GTT_TABLE_VALID			0x1
2467c478bd9Sstevel@tonic-gate #define	GTT_BASE_MASK			0xfffff000
2477c478bd9Sstevel@tonic-gate #define	GTT_MB_TO_PAGES(m)		((m) << 8)
248b526f5afSms148562 #define	GTT_POINTER_MASK		0xffffffff00000000
2497c478bd9Sstevel@tonic-gate 
2507c478bd9Sstevel@tonic-gate /* Intel i810 register offset */
251b526f5afSms148562 #define	I810_POINTER_MASK		0xffffffffc0000000
2527c478bd9Sstevel@tonic-gate #define	I810_CONF_SMRAM			0x70 /* offset in PCI config space */
2537c478bd9Sstevel@tonic-gate #define	I810_GMS_MASK			0xc0 /* smram register mask */
2547c478bd9Sstevel@tonic-gate /*
2557c478bd9Sstevel@tonic-gate  *	GART and GTT entry format table
2567c478bd9Sstevel@tonic-gate  *
2577c478bd9Sstevel@tonic-gate  * 		AMD64 GART entry
2587c478bd9Sstevel@tonic-gate  * 	from bios and kernel develop guide for amd64
2597c478bd9Sstevel@tonic-gate  *	 -----------------------------
2607c478bd9Sstevel@tonic-gate  * 	Bits		Description	|
2617c478bd9Sstevel@tonic-gate  * 	0		valid		|
2627c478bd9Sstevel@tonic-gate  * 	1		coherent	|
2637c478bd9Sstevel@tonic-gate  * 	3:2		reserved	|
2647c478bd9Sstevel@tonic-gate  * 	11:4		physaddr[39:32]	|
2657c478bd9Sstevel@tonic-gate  * 	31:12	physaddr[31:12]	|
2667c478bd9Sstevel@tonic-gate  * 	-----------------------------
2677c478bd9Sstevel@tonic-gate  *		Intel GTT entry
2687c478bd9Sstevel@tonic-gate  * 	Intel video programming manual
2697c478bd9Sstevel@tonic-gate  * 	-----------------------------
2707c478bd9Sstevel@tonic-gate  * 	Bits		descrition	|
2717c478bd9Sstevel@tonic-gate  * 	0		valid		|
2727c478bd9Sstevel@tonic-gate  * 	2:1		memory type	|
2737c478bd9Sstevel@tonic-gate  * 	29:12		PhysAddr[29:12]	|
2747c478bd9Sstevel@tonic-gate  * 	31:30		reserved	|
2757c478bd9Sstevel@tonic-gate  * 	-----------------------------
2767c478bd9Sstevel@tonic-gate  *		AGP entry
2777c478bd9Sstevel@tonic-gate  * 	from AGP protocol 3.0
2787c478bd9Sstevel@tonic-gate  * 	-----------------------------
2797c478bd9Sstevel@tonic-gate  * 	Bits		descrition	|
2807c478bd9Sstevel@tonic-gate  * 	0		valid		|
2817c478bd9Sstevel@tonic-gate  * 	1		coherent	|
2827c478bd9Sstevel@tonic-gate  * 	3:2		reserved	|
2837c478bd9Sstevel@tonic-gate  * 	11:4		PhysAddr[39:32]	|
2847c478bd9Sstevel@tonic-gate  * 	31:12	PhysAddr[31:12]		|
2857c478bd9Sstevel@tonic-gate  * 	63:32	PhysAddr[71:40]		|
2867c478bd9Sstevel@tonic-gate  *	 -----------------------------
2877c478bd9Sstevel@tonic-gate  */
2887c478bd9Sstevel@tonic-gate 
2897c478bd9Sstevel@tonic-gate /*
2907c478bd9Sstevel@tonic-gate  *	gart and gtt table base register format
2917c478bd9Sstevel@tonic-gate  *
2927c478bd9Sstevel@tonic-gate  *  		AMD64 register format
2937c478bd9Sstevel@tonic-gate  * 	from bios and kernel develop guide for AMD64
2947c478bd9Sstevel@tonic-gate  * 	---------------------------------------------
2957c478bd9Sstevel@tonic-gate  * 	Bits			Description		|
2967c478bd9Sstevel@tonic-gate  * 	3:0			reserved		|
2977c478bd9Sstevel@tonic-gate  * 	31:4			physical addr 39:12	|
2987c478bd9Sstevel@tonic-gate  * 	----------------------------------------------
2997c478bd9Sstevel@tonic-gate  * 		INTEL AGPGART table base register format
3007c478bd9Sstevel@tonic-gate  * 	from AGP protocol 3.0 p142, only support 32 bits
3017c478bd9Sstevel@tonic-gate  * 	---------------------------------------------
3027c478bd9Sstevel@tonic-gate  * 	Bits			Description		|
3037c478bd9Sstevel@tonic-gate  * 	11:0			reserved		|
3047c478bd9Sstevel@tonic-gate  * 	31:12		physical addr 31:12		|
3057c478bd9Sstevel@tonic-gate  * 	63:32		physical addr 63:32		|
3067c478bd9Sstevel@tonic-gate  * 	---------------------------------------------
3077c478bd9Sstevel@tonic-gate  * 		INTEL i810 GTT table base register format
3087c478bd9Sstevel@tonic-gate  * 	_____________________________________________
3097c478bd9Sstevel@tonic-gate  * 	Bits			Description		|
3107c478bd9Sstevel@tonic-gate  * 	0			GTT table enable bit	|
3117c478bd9Sstevel@tonic-gate  * 	11:1			reserved		|
3127c478bd9Sstevel@tonic-gate  * 	31:12			physical addr 31:12	|
3137c478bd9Sstevel@tonic-gate  * 	---------------------------------------------
3147c478bd9Sstevel@tonic-gate  */
3157c478bd9Sstevel@tonic-gate 
3167c478bd9Sstevel@tonic-gate /* Intel agp bridge specific */
317b526f5afSms148562 #define	AGP_INTEL_POINTER_MASK		0xffffffff00000000
3187c478bd9Sstevel@tonic-gate 
3197c478bd9Sstevel@tonic-gate /* Amd64 cpu gart device reigster offset */
3207c478bd9Sstevel@tonic-gate #define	AMD64_APERTURE_CONTROL		0x90
3217c478bd9Sstevel@tonic-gate #define	AMD64_APERTURE_BASE		0x94
3227c478bd9Sstevel@tonic-gate #define	AMD64_GART_CACHE_CTL		0x9c
3237c478bd9Sstevel@tonic-gate #define	AMD64_GART_BASE			0x98
3247c478bd9Sstevel@tonic-gate 
3257c478bd9Sstevel@tonic-gate /* Amd64 cpu gart bits */
3267c478bd9Sstevel@tonic-gate #define	AMD64_APERBASE_SHIFT		25
3277c478bd9Sstevel@tonic-gate #define	AMD64_APERBASE_MASK		0x00007fff
3287c478bd9Sstevel@tonic-gate #define	AMD64_GARTBASE_SHIFT		8
3297c478bd9Sstevel@tonic-gate #define	AMD64_GARTBASE_MASK		0xfffffff0
330b526f5afSms148562 #define	AMD64_POINTER_MASK		0xffffff0000000000
3317c478bd9Sstevel@tonic-gate #define	AMD64_INVALID_CACHE		0x1
3327c478bd9Sstevel@tonic-gate #define	AMD64_GART_SHIFT		12
3337c478bd9Sstevel@tonic-gate #define	AMD64_RESERVE_SHIFT		4
3347c478bd9Sstevel@tonic-gate #define	AMD64_APERSIZE_MASK		0xe
3357c478bd9Sstevel@tonic-gate #define	AMD64_GARTEN			0x1
3367c478bd9Sstevel@tonic-gate #define	AMD64_DISGARTCPU		0x10
3377c478bd9Sstevel@tonic-gate #define	AMD64_DISGARTIO			0x20
3387c478bd9Sstevel@tonic-gate #define	AMD64_ENTRY_VALID		0x1
3397c478bd9Sstevel@tonic-gate 
3407c478bd9Sstevel@tonic-gate /* Other common routines */
3417c478bd9Sstevel@tonic-gate #define	MB2BYTES(m)		((m) << 20)
3427c478bd9Sstevel@tonic-gate #define	BYTES2MB(m)		((m) >> 20)
3437c478bd9Sstevel@tonic-gate #define	GIGA_MASK		0xC0000000
3447c478bd9Sstevel@tonic-gate #define	UI32_MASK		0xffffffffU
34502bbca18Sms148562 #define	MAXAPERMEGAS		0x1000 /* Aper size no more than 4G */
3460035d21cSmiao chen - Sun Microsystems - Beijing China #define	MINAPERMEGAS		192
3477c478bd9Sstevel@tonic-gate 
3487c478bd9Sstevel@tonic-gate #endif /* _KERNEL */
3497c478bd9Sstevel@tonic-gate 
3507c478bd9Sstevel@tonic-gate #ifdef __cplusplus
3517c478bd9Sstevel@tonic-gate }
3527c478bd9Sstevel@tonic-gate #endif
3537c478bd9Sstevel@tonic-gate 
3547c478bd9Sstevel@tonic-gate #endif /* _SYS_AGPDEFS_H */
355