agpreg.h revision 1.23 1 1.23 nonaka /* $NetBSD: agpreg.h,v 1.23 2016/05/01 04:22:50 nonaka Exp $ */
2 1.1 fvdl
3 1.1 fvdl /*-
4 1.1 fvdl * Copyright (c) 2000 Doug Rabson
5 1.1 fvdl * All rights reserved.
6 1.1 fvdl *
7 1.1 fvdl * Redistribution and use in source and binary forms, with or without
8 1.1 fvdl * modification, are permitted provided that the following conditions
9 1.1 fvdl * are met:
10 1.1 fvdl * 1. Redistributions of source code must retain the above copyright
11 1.1 fvdl * notice, this list of conditions and the following disclaimer.
12 1.1 fvdl * 2. Redistributions in binary form must reproduce the above copyright
13 1.1 fvdl * notice, this list of conditions and the following disclaimer in the
14 1.1 fvdl * documentation and/or other materials provided with the distribution.
15 1.1 fvdl *
16 1.1 fvdl * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17 1.1 fvdl * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 1.1 fvdl * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 1.1 fvdl * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20 1.1 fvdl * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 1.1 fvdl * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 1.1 fvdl * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 1.1 fvdl * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 1.1 fvdl * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 1.1 fvdl * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 1.1 fvdl * SUCH DAMAGE.
27 1.1 fvdl *
28 1.1 fvdl * $FreeBSD: src/sys/pci/agpreg.h,v 1.3 2000/07/12 10:13:04 dfr Exp $
29 1.1 fvdl */
30 1.1 fvdl
31 1.1 fvdl #ifndef _PCI_AGPREG_H_
32 1.1 fvdl #define _PCI_AGPREG_H_
33 1.1 fvdl
34 1.1 fvdl /*
35 1.1 fvdl * Offsets for various AGP configuration registers.
36 1.1 fvdl */
37 1.1 fvdl #define AGP_APBASE 0x10
38 1.1 fvdl
39 1.1 fvdl #define AGP_STATUS 0x4
40 1.1 fvdl #define AGP_COMMAND 0x8
41 1.1 fvdl
42 1.1 fvdl /*
43 1.3 ichiro * Config registers for Intel AGP chipsets.
44 1.1 fvdl */
45 1.3 ichiro /* i845/855PM */
46 1.3 ichiro #define AGP_I845_AGPMISC 0x51
47 1.3 ichiro # define AGPMISC_AAGN (1U << 1) /* Aperture AccessEN */
48 1.3 ichiro
49 1.3 ichiro /* i840/850/850E */
50 1.3 ichiro #define AGP_I840_MCHCFG 0x50
51 1.3 ichiro # define MCHCFG_AAGN (1U << 9) /* Aperture AccessEN */
52 1.3 ichiro
53 1.3 ichiro /* i82443LX/BX/GX */
54 1.1 fvdl #define AGP_INTEL_NBXCFG 0x50
55 1.5 ichiro # define NBXCFG_APAE (1U << 10) /* AGPtoPCI AccessDIS */
56 1.3 ichiro # define NBXCFG_AAGN (1U << 9) /* Aperture AccessEN */
57 1.3 ichiro
58 1.4 ichiro /* Error Status for i8XX Chipset */
59 1.4 ichiro #define AGP_INTEL_I8XX_ERRSTS 0xc8
60 1.4 ichiro
61 1.3 ichiro /* Common register */
62 1.18 drochner #define AGP_INTEL_ERRSTS 0x90 /* bytes at 0x91 and 0x92, not i8XX */
63 1.3 ichiro #define AGP_INTEL_AGPCMD 0xa8
64 1.3 ichiro # define AGPCMD_SBA (1U << 9)
65 1.3 ichiro # define AGPCMD_AGPEN (1U << 8)
66 1.3 ichiro # define AGPCMD_FWEN (1U << 4)
67 1.3 ichiro # define AGPCMD_RATE_1X (1U << 1)
68 1.3 ichiro # define AGPCMD_RATE_2X (1U << 2)
69 1.3 ichiro # define AGPCMD_RATE_4X (1U << 3)
70 1.3 ichiro
71 1.1 fvdl #define AGP_INTEL_AGPCTRL 0xb0
72 1.3 ichiro # define AGPCTRL_AGPRSE (1U << 13) /* AGPRSE (82443 only)*/
73 1.3 ichiro # define AGPCTRL_GTLB (1U << 7) /* GTLB EN */
74 1.3 ichiro
75 1.1 fvdl #define AGP_INTEL_APSIZE 0xb4
76 1.3 ichiro # define APSIZE_MASK 0x3f
77 1.3 ichiro
78 1.1 fvdl #define AGP_INTEL_ATTBASE 0xb8
79 1.1 fvdl
80 1.1 fvdl /*
81 1.11 jmcneill * Config offsets for VIA AGP 2.x chipsets.
82 1.1 fvdl */
83 1.1 fvdl #define AGP_VIA_GARTCTRL 0x80
84 1.1 fvdl #define AGP_VIA_APSIZE 0x84
85 1.1 fvdl #define AGP_VIA_ATTBASE 0x88
86 1.1 fvdl
87 1.1 fvdl /*
88 1.11 jmcneill * Config offsets for VIA AGP 3.0 chipsets.
89 1.11 jmcneill */
90 1.11 jmcneill #define AGP3_VIA_GARTCTRL 0x90
91 1.11 jmcneill #define AGP3_VIA_APSIZE 0x94
92 1.11 jmcneill #define AGP3_VIA_ATTBASE 0x98
93 1.19 joerg #define AGP_VIA_AGPSEL 0xfc
94 1.11 jmcneill
95 1.11 jmcneill /*
96 1.1 fvdl * Config offsets for SiS AGP chipsets.
97 1.1 fvdl */
98 1.1 fvdl #define AGP_SIS_ATTBASE 0x90
99 1.1 fvdl #define AGP_SIS_WINCTRL 0x94
100 1.1 fvdl #define AGP_SIS_TLBCTRL 0x97
101 1.1 fvdl #define AGP_SIS_TLBFLUSH 0x98
102 1.1 fvdl
103 1.1 fvdl /*
104 1.1 fvdl * Config offsets for Ali AGP chipsets.
105 1.1 fvdl */
106 1.1 fvdl #define AGP_ALI_AGPCTRL 0xb8
107 1.1 fvdl #define AGP_ALI_ATTBASE 0xbc
108 1.1 fvdl #define AGP_ALI_TLBCTRL 0xc0
109 1.1 fvdl
110 1.1 fvdl /*
111 1.1 fvdl * Config offsets for the AMD 751 chipset.
112 1.1 fvdl */
113 1.1 fvdl #define AGP_AMD751_REGISTERS 0x14
114 1.1 fvdl #define AGP_AMD751_APCTRL 0xac
115 1.1 fvdl #define AGP_AMD751_MODECTRL 0xb0
116 1.1 fvdl #define AGP_AMD751_MODECTRL_SYNEN 0x80
117 1.1 fvdl #define AGP_AMD751_MODECTRL2 0xb2
118 1.1 fvdl #define AGP_AMD751_MODECTRL2_G1LM 0x01
119 1.1 fvdl #define AGP_AMD751_MODECTRL2_GPDCE 0x02
120 1.1 fvdl #define AGP_AMD751_MODECTRL2_NGSE 0x08
121 1.1 fvdl
122 1.1 fvdl /*
123 1.1 fvdl * Memory mapped register offsets for AMD 751 chipset.
124 1.1 fvdl */
125 1.1 fvdl #define AGP_AMD751_CAPS 0x00
126 1.1 fvdl #define AGP_AMD751_CAPS_EHI 0x0800
127 1.1 fvdl #define AGP_AMD751_CAPS_P2P 0x0400
128 1.1 fvdl #define AGP_AMD751_CAPS_MPC 0x0200
129 1.1 fvdl #define AGP_AMD751_CAPS_VBE 0x0100
130 1.1 fvdl #define AGP_AMD751_CAPS_REV 0x00ff
131 1.1 fvdl #define AGP_AMD751_STATUS 0x02
132 1.1 fvdl #define AGP_AMD751_STATUS_P2PS 0x0800
133 1.1 fvdl #define AGP_AMD751_STATUS_GCS 0x0400
134 1.1 fvdl #define AGP_AMD751_STATUS_MPS 0x0200
135 1.1 fvdl #define AGP_AMD751_STATUS_VBES 0x0100
136 1.1 fvdl #define AGP_AMD751_STATUS_P2PE 0x0008
137 1.1 fvdl #define AGP_AMD751_STATUS_GCE 0x0004
138 1.1 fvdl #define AGP_AMD751_STATUS_VBEE 0x0001
139 1.1 fvdl #define AGP_AMD751_ATTBASE 0x04
140 1.1 fvdl #define AGP_AMD751_TLBCTRL 0x0c
141 1.1 fvdl
142 1.1 fvdl /*
143 1.1 fvdl * Config registers for i810 device 0
144 1.1 fvdl */
145 1.1 fvdl #define AGP_I810_SMRAM 0x70
146 1.1 fvdl #define AGP_I810_SMRAM_GMS 0xc0
147 1.1 fvdl #define AGP_I810_SMRAM_GMS_DISABLED 0x00
148 1.1 fvdl #define AGP_I810_SMRAM_GMS_ENABLED_0 0x40
149 1.1 fvdl #define AGP_I810_SMRAM_GMS_ENABLED_512 0x80
150 1.1 fvdl #define AGP_I810_SMRAM_GMS_ENABLED_1024 0xc0
151 1.1 fvdl #define AGP_I810_MISCC 0x72
152 1.1 fvdl #define AGP_I810_MISCC_WINSIZE 0x0001
153 1.1 fvdl #define AGP_I810_MISCC_WINSIZE_64 0x0000
154 1.1 fvdl #define AGP_I810_MISCC_WINSIZE_32 0x0001
155 1.1 fvdl #define AGP_I810_MISCC_PLCK 0x0008
156 1.1 fvdl #define AGP_I810_MISCC_PLCK_UNLOCKED 0x0000
157 1.1 fvdl #define AGP_I810_MISCC_PLCK_LOCKED 0x0008
158 1.1 fvdl #define AGP_I810_MISCC_WPTC 0x0030
159 1.1 fvdl #define AGP_I810_MISCC_WPTC_NOLIMIT 0x0000
160 1.1 fvdl #define AGP_I810_MISCC_WPTC_62 0x0010
161 1.1 fvdl #define AGP_I810_MISCC_WPTC_50 0x0020
162 1.1 fvdl #define AGP_I810_MISCC_WPTC_37 0x0030
163 1.1 fvdl #define AGP_I810_MISCC_RPTC 0x00c0
164 1.1 fvdl #define AGP_I810_MISCC_RPTC_NOLIMIT 0x0000
165 1.1 fvdl #define AGP_I810_MISCC_RPTC_62 0x0040
166 1.1 fvdl #define AGP_I810_MISCC_RPTC_50 0x0080
167 1.1 fvdl #define AGP_I810_MISCC_RPTC_37 0x00c0
168 1.1 fvdl
169 1.1 fvdl /*
170 1.1 fvdl * Config registers for i810 device 1
171 1.1 fvdl */
172 1.1 fvdl #define AGP_I810_GMADR 0x10
173 1.1 fvdl #define AGP_I810_MMADR 0x14
174 1.1 fvdl
175 1.1 fvdl /*
176 1.1 fvdl * Memory mapped register offsets for i810 chipset.
177 1.1 fvdl */
178 1.1 fvdl #define AGP_I810_PGTBL_CTL 0x2020
179 1.20 christos
180 1.20 christos /**
181 1.20 christos * This field determines the actual size of the global GTT on the 965
182 1.20 christos * and G33
183 1.20 christos */
184 1.20 christos #define AGP_I810_PGTBL_SIZE_MASK 0x0000000e
185 1.20 christos #define AGP_I810_PGTBL_SIZE_512KB (0 << 1)
186 1.20 christos #define AGP_I810_PGTBL_SIZE_256KB (1 << 1)
187 1.20 christos #define AGP_I810_PGTBL_SIZE_128KB (2 << 1)
188 1.20 christos #define AGP_I810_DRT 0x3000
189 1.20 christos #define AGP_I810_DRT_UNPOPULATED 0x00
190 1.20 christos #define AGP_I810_DRT_POPULATED 0x01
191 1.20 christos #define AGP_I810_GTT 0x10000
192 1.2 scw
193 1.2 scw /*
194 1.2 scw * Config registers for i830MG device 0
195 1.2 scw */
196 1.2 scw #define AGP_I830_GCC0 0x50
197 1.2 scw #define AGP_I830_GCC1 0x52
198 1.2 scw #define AGP_I830_GCC1_DEV2 0x08
199 1.2 scw #define AGP_I830_GCC1_DEV2_ENABLED 0x00
200 1.2 scw #define AGP_I830_GCC1_DEV2_DISABLED 0x08
201 1.2 scw #define AGP_I830_GCC1_GMS 0x70
202 1.2 scw #define AGP_I830_GCC1_GMS_STOLEN_512 0x20
203 1.2 scw #define AGP_I830_GCC1_GMS_STOLEN_1024 0x30
204 1.2 scw #define AGP_I830_GCC1_GMS_STOLEN_8192 0x40
205 1.2 scw #define AGP_I830_GCC1_GMASIZE 0x01
206 1.2 scw #define AGP_I830_GCC1_GMASIZE_64 0x01
207 1.2 scw #define AGP_I830_GCC1_GMASIZE_128 0x00
208 1.1 fvdl
209 1.21 riastrad /*
210 1.21 riastrad * Memory mapped register offsets for i830 chipset.
211 1.21 riastrad */
212 1.21 riastrad #define AGP_I830_HIC 0x70
213 1.6 hannken
214 1.6 hannken /*
215 1.6 hannken * Config registers for 852GM/855GM/865G device 0
216 1.6 hannken */
217 1.17 drochner #define AGP_I855_GCC1 0x50 /* upper word */
218 1.6 hannken #define AGP_I855_GCC1_DEV2 0x08
219 1.6 hannken #define AGP_I855_GCC1_DEV2_ENABLED 0x00
220 1.6 hannken #define AGP_I855_GCC1_DEV2_DISABLED 0x08
221 1.16 markd #define AGP_I855_GCC1_GMS 0xf0 /* Top bit reserved pre-G33 */
222 1.6 hannken #define AGP_I855_GCC1_GMS_STOLEN_0M 0x00
223 1.6 hannken #define AGP_I855_GCC1_GMS_STOLEN_1M 0x10
224 1.6 hannken #define AGP_I855_GCC1_GMS_STOLEN_4M 0x20
225 1.6 hannken #define AGP_I855_GCC1_GMS_STOLEN_8M 0x30
226 1.6 hannken #define AGP_I855_GCC1_GMS_STOLEN_16M 0x40
227 1.6 hannken #define AGP_I855_GCC1_GMS_STOLEN_32M 0x50
228 1.8 perry
229 1.10 christos /*
230 1.10 christos * Config registers for 915G/915GM
231 1.10 christos */
232 1.10 christos #define AGP_I915_MMADR 0x10
233 1.10 christos #define AGP_I915_GMADR 0x18
234 1.10 christos #define AGP_I915_GTTADR 0x1c
235 1.21 riastrad #define AGP_I915_MSAC 0x60 /* upper word */
236 1.21 riastrad #define AGP_I915_MSAC_APER_128M 0x02
237 1.21 riastrad
238 1.21 riastrad /*
239 1.21 riastrad * Config registers for 915G/915GM device 0
240 1.21 riastrad */
241 1.10 christos #define AGP_I915_GCC1 0x52
242 1.20 christos #define AGP_I915_GCC1_GMS 0x70
243 1.20 christos #define AGP_I915_GCC1_GMS_STOLEN_0M 0x00
244 1.20 christos #define AGP_I915_GCC1_GMS_STOLEN_1M 0x10
245 1.20 christos #define AGP_I915_GCC1_GMS_STOLEN_8M 0x30
246 1.20 christos #define AGP_I915_GCC1_GMS_STOLEN_16M 0x40
247 1.20 christos #define AGP_I915_GCC1_GMS_STOLEN_32M 0x50
248 1.20 christos #define AGP_I915_GCC1_GMS_STOLEN_48M 0x60
249 1.20 christos #define AGP_I915_GCC1_GMS_STOLEN_64M 0x70
250 1.21 riastrad #define AGP_I915_IFPADDR 0x60
251 1.10 christos
252 1.13 kiyohara /*
253 1.14 markd * Config registers for 965G/965Q
254 1.14 markd */
255 1.14 markd #define AGP_I965_MMADR 0x10
256 1.14 markd #define AGP_I965_GMADR 0x18
257 1.14 markd
258 1.20 christos #define AGP_I965_GTT (512*1024)
259 1.20 christos
260 1.20 christos #define AGP_I965_PGTBL_SIZE_1MB (3 << 1)
261 1.20 christos #define AGP_I965_PGTBL_SIZE_2MB (4 << 1)
262 1.20 christos #define AGP_I965_PGTBL_SIZE_1_5MB (5 << 1)
263 1.20 christos
264 1.21 riastrad /*
265 1.21 riastrad * Config registers for 965G/965Q device 0
266 1.21 riastrad */
267 1.21 riastrad #define AGP_I965_IFPADDR 0x70
268 1.14 markd
269 1.14 markd /*
270 1.15 joerg * Config registers for G33
271 1.15 joerg */
272 1.15 joerg #define AGP_G33_PGTBL_SIZE_MASK (3U << 8)
273 1.15 joerg #define AGP_G33_PGTBL_SIZE_1M (1U << 8)
274 1.15 joerg #define AGP_G33_PGTBL_SIZE_2M (2U << 8)
275 1.15 joerg
276 1.16 markd #define AGP_G33_GCC1_GMS_STOLEN_128M 0x80
277 1.16 markd #define AGP_G33_GCC1_GMS_STOLEN_256M 0x90
278 1.16 markd
279 1.15 joerg /*
280 1.20 christos * Config registers for G4X
281 1.20 christos */
282 1.20 christos #define AGP_G4X_MSAC 0x64 /* upper word */
283 1.20 christos #define AGP_G4X_MSAC_MASK 0xff
284 1.20 christos #define AGP_G4X_MSAC_APER_256M 0x02
285 1.20 christos #define AGP_G4X_MSAC_APER_512M 0x04
286 1.20 christos
287 1.20 christos #define AGP_G4X_GTT (2*1024*1024)
288 1.20 christos
289 1.22 riastrad #define AGP_G4X_PGTBL_SIZE_MASK 0x0000000e
290 1.22 riastrad #define AGP_G4X_PGTBL_SIZE_512K (0 << 1)
291 1.22 riastrad #define AGP_G4X_PGTBL_SIZE_256K (1 << 1)
292 1.22 riastrad #define AGP_G4X_PGTBL_SIZE_128K (2 << 1)
293 1.22 riastrad #define AGP_G4X_PGTBL_SIZE_1M (3 << 1)
294 1.22 riastrad #define AGP_G4X_PGTBL_SIZE_2M (4 << 1)
295 1.22 riastrad #define AGP_G4X_PGTBL_SIZE_1_5M (5 << 1)
296 1.22 riastrad
297 1.20 christos #define AGP_G4X_GCC1_GMS_STOLEN_96M 0xa0
298 1.20 christos #define AGP_G4X_GCC1_GMS_STOLEN_160M 0xb0
299 1.20 christos #define AGP_G4X_GCC1_GMS_STOLEN_224M 0xc0
300 1.20 christos #define AGP_G4X_GCC1_GMS_STOLEN_352M 0xd0
301 1.20 christos
302 1.20 christos /*
303 1.23 nonaka * Config registers for Pineview
304 1.23 nonaka */
305 1.23 nonaka #define AGP_PINEVIEW_PGTBL_SIZE_MASK (3U << 8)
306 1.23 nonaka #define AGP_PINEVIEW_PGTBL_SIZE_1M (1U << 8)
307 1.23 nonaka
308 1.23 nonaka /*
309 1.13 kiyohara * AMD64 GART registers
310 1.13 kiyohara */
311 1.13 kiyohara #define AGP_AMD64_APCTRL 0x90
312 1.13 kiyohara #define AGP_AMD64_APBASE 0x94
313 1.13 kiyohara #define AGP_AMD64_ATTBASE 0x98
314 1.13 kiyohara #define AGP_AMD64_CACHECTRL 0x9c
315 1.13 kiyohara #define AGP_AMD64_APCTRL_GARTEN 0x00000001
316 1.13 kiyohara #define AGP_AMD64_APCTRL_SIZE_MASK 0x0000000e
317 1.13 kiyohara #define AGP_AMD64_APCTRL_DISGARTCPU 0x00000010
318 1.13 kiyohara #define AGP_AMD64_APCTRL_DISGARTIO 0x00000020
319 1.13 kiyohara #define AGP_AMD64_APCTRL_DISWLKPRB 0x00000040
320 1.13 kiyohara #define AGP_AMD64_APBASE_MASK 0x00007fff
321 1.13 kiyohara #define AGP_AMD64_ATTBASE_MASK 0xfffffff0
322 1.13 kiyohara #define AGP_AMD64_CACHECTRL_INVGART 0x00000001
323 1.13 kiyohara #define AGP_AMD64_CACHECTRL_PTEERR 0x00000002
324 1.13 kiyohara
325 1.13 kiyohara /*
326 1.13 kiyohara * NVIDIA nForce3 registers
327 1.13 kiyohara */
328 1.13 kiyohara #define AGP_AMD64_NVIDIA_0_APBASE 0x10
329 1.13 kiyohara #define AGP_AMD64_NVIDIA_1_APBASE1 0x50
330 1.13 kiyohara #define AGP_AMD64_NVIDIA_1_APLIMIT1 0x54
331 1.13 kiyohara #define AGP_AMD64_NVIDIA_1_APSIZE 0xa8
332 1.13 kiyohara #define AGP_AMD64_NVIDIA_1_APBASE2 0xd8
333 1.13 kiyohara #define AGP_AMD64_NVIDIA_1_APLIMIT2 0xdc
334 1.13 kiyohara
335 1.13 kiyohara /*
336 1.13 kiyohara * ULi M1689 registers
337 1.13 kiyohara */
338 1.13 kiyohara #define AGP_AMD64_ULI_APBASE 0x10
339 1.13 kiyohara #define AGP_AMD64_ULI_HTT_FEATURE 0x50
340 1.13 kiyohara #define AGP_AMD64_ULI_ENU_SCR 0x54
341 1.13 kiyohara
342 1.1 fvdl #endif /* !_PCI_AGPREG_H_ */
343