162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Common Intel AGPGART and GTT definitions.
462306a36Sopenharmony_ci */
562306a36Sopenharmony_ci#ifndef _INTEL_AGP_H
662306a36Sopenharmony_ci#define _INTEL_AGP_H
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci/* Intel registers */
962306a36Sopenharmony_ci#define INTEL_APSIZE	0xb4
1062306a36Sopenharmony_ci#define INTEL_ATTBASE	0xb8
1162306a36Sopenharmony_ci#define INTEL_AGPCTRL	0xb0
1262306a36Sopenharmony_ci#define INTEL_NBXCFG	0x50
1362306a36Sopenharmony_ci#define INTEL_ERRSTS	0x91
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci/* Intel i830 registers */
1662306a36Sopenharmony_ci#define I830_GMCH_CTRL			0x52
1762306a36Sopenharmony_ci#define I830_GMCH_ENABLED		0x4
1862306a36Sopenharmony_ci#define I830_GMCH_MEM_MASK		0x1
1962306a36Sopenharmony_ci#define I830_GMCH_MEM_64M		0x1
2062306a36Sopenharmony_ci#define I830_GMCH_MEM_128M		0
2162306a36Sopenharmony_ci#define I830_GMCH_GMS_MASK		0x70
2262306a36Sopenharmony_ci#define I830_GMCH_GMS_DISABLED		0x00
2362306a36Sopenharmony_ci#define I830_GMCH_GMS_LOCAL		0x10
2462306a36Sopenharmony_ci#define I830_GMCH_GMS_STOLEN_512	0x20
2562306a36Sopenharmony_ci#define I830_GMCH_GMS_STOLEN_1024	0x30
2662306a36Sopenharmony_ci#define I830_GMCH_GMS_STOLEN_8192	0x40
2762306a36Sopenharmony_ci#define I830_RDRAM_CHANNEL_TYPE		0x03010
2862306a36Sopenharmony_ci#define I830_RDRAM_ND(x)		(((x) & 0x20) >> 5)
2962306a36Sopenharmony_ci#define I830_RDRAM_DDT(x)		(((x) & 0x18) >> 3)
3062306a36Sopenharmony_ci
3162306a36Sopenharmony_ci/* This one is for I830MP w. an external graphic card */
3262306a36Sopenharmony_ci#define INTEL_I830_ERRSTS	0x92
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci/* Intel 855GM/852GM registers */
3562306a36Sopenharmony_ci#define I855_GMCH_GMS_MASK		0xF0
3662306a36Sopenharmony_ci#define I855_GMCH_GMS_STOLEN_0M		0x0
3762306a36Sopenharmony_ci#define I855_GMCH_GMS_STOLEN_1M		(0x1 << 4)
3862306a36Sopenharmony_ci#define I855_GMCH_GMS_STOLEN_4M		(0x2 << 4)
3962306a36Sopenharmony_ci#define I855_GMCH_GMS_STOLEN_8M		(0x3 << 4)
4062306a36Sopenharmony_ci#define I855_GMCH_GMS_STOLEN_16M	(0x4 << 4)
4162306a36Sopenharmony_ci#define I855_GMCH_GMS_STOLEN_32M	(0x5 << 4)
4262306a36Sopenharmony_ci#define I85X_CAPID			0x44
4362306a36Sopenharmony_ci#define I85X_VARIANT_MASK		0x7
4462306a36Sopenharmony_ci#define I85X_VARIANT_SHIFT		5
4562306a36Sopenharmony_ci#define I855_GME			0x0
4662306a36Sopenharmony_ci#define I855_GM				0x4
4762306a36Sopenharmony_ci#define I852_GME			0x2
4862306a36Sopenharmony_ci#define I852_GM				0x5
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ci/* Intel i845 registers */
5162306a36Sopenharmony_ci#define INTEL_I845_AGPM		0x51
5262306a36Sopenharmony_ci#define INTEL_I845_ERRSTS	0xc8
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/* Intel i860 registers */
5562306a36Sopenharmony_ci#define INTEL_I860_MCHCFG	0x50
5662306a36Sopenharmony_ci#define INTEL_I860_ERRSTS	0xc8
5762306a36Sopenharmony_ci
5862306a36Sopenharmony_ci/* Intel i810 registers */
5962306a36Sopenharmony_ci#define I810_GMADR_BAR		0
6062306a36Sopenharmony_ci#define I810_MMADR_BAR		1
6162306a36Sopenharmony_ci#define I810_PTE_BASE		0x10000
6262306a36Sopenharmony_ci#define I810_PTE_MAIN_UNCACHED	0x00000000
6362306a36Sopenharmony_ci#define I810_PTE_LOCAL		0x00000002
6462306a36Sopenharmony_ci#define I810_PTE_VALID		0x00000001
6562306a36Sopenharmony_ci#define I830_PTE_SYSTEM_CACHED  0x00000006
6662306a36Sopenharmony_ci
6762306a36Sopenharmony_ci#define I810_SMRAM_MISCC	0x70
6862306a36Sopenharmony_ci#define I810_GFX_MEM_WIN_SIZE	0x00010000
6962306a36Sopenharmony_ci#define I810_GFX_MEM_WIN_32M	0x00010000
7062306a36Sopenharmony_ci#define I810_GMS		0x000000c0
7162306a36Sopenharmony_ci#define I810_GMS_DISABLE	0x00000000
7262306a36Sopenharmony_ci#define I810_PGETBL_CTL		0x2020
7362306a36Sopenharmony_ci#define I810_PGETBL_ENABLED	0x00000001
7462306a36Sopenharmony_ci/* Note: PGETBL_CTL2 has a different offset on G33. */
7562306a36Sopenharmony_ci#define I965_PGETBL_CTL2	0x20c4
7662306a36Sopenharmony_ci#define I965_PGETBL_SIZE_MASK	0x0000000e
7762306a36Sopenharmony_ci#define I965_PGETBL_SIZE_512KB	(0 << 1)
7862306a36Sopenharmony_ci#define I965_PGETBL_SIZE_256KB	(1 << 1)
7962306a36Sopenharmony_ci#define I965_PGETBL_SIZE_128KB	(2 << 1)
8062306a36Sopenharmony_ci#define I965_PGETBL_SIZE_1MB	(3 << 1)
8162306a36Sopenharmony_ci#define I965_PGETBL_SIZE_2MB	(4 << 1)
8262306a36Sopenharmony_ci#define I965_PGETBL_SIZE_1_5MB	(5 << 1)
8362306a36Sopenharmony_ci#define G33_GMCH_SIZE_MASK	(3 << 8)
8462306a36Sopenharmony_ci#define G33_GMCH_SIZE_1M	(1 << 8)
8562306a36Sopenharmony_ci#define G33_GMCH_SIZE_2M	(2 << 8)
8662306a36Sopenharmony_ci#define G4x_GMCH_SIZE_MASK	(0xf << 8)
8762306a36Sopenharmony_ci#define G4x_GMCH_SIZE_1M	(0x1 << 8)
8862306a36Sopenharmony_ci#define G4x_GMCH_SIZE_2M	(0x3 << 8)
8962306a36Sopenharmony_ci#define G4x_GMCH_SIZE_VT_EN	(0x8 << 8)
9062306a36Sopenharmony_ci#define G4x_GMCH_SIZE_VT_1M	(G4x_GMCH_SIZE_1M | G4x_GMCH_SIZE_VT_EN)
9162306a36Sopenharmony_ci#define G4x_GMCH_SIZE_VT_1_5M	((0x2 << 8) | G4x_GMCH_SIZE_VT_EN)
9262306a36Sopenharmony_ci#define G4x_GMCH_SIZE_VT_2M	(G4x_GMCH_SIZE_2M | G4x_GMCH_SIZE_VT_EN)
9362306a36Sopenharmony_ci
9462306a36Sopenharmony_ci#define GFX_FLSH_CNTL		0x2170 /* 915+ */
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci#define I810_DRAM_CTL		0x3000
9762306a36Sopenharmony_ci#define I810_DRAM_ROW_0		0x00000001
9862306a36Sopenharmony_ci#define I810_DRAM_ROW_0_SDRAM	0x00000001
9962306a36Sopenharmony_ci
10062306a36Sopenharmony_ci/* Intel 815 register */
10162306a36Sopenharmony_ci#define INTEL_815_APCONT	0x51
10262306a36Sopenharmony_ci#define INTEL_815_ATTBASE_MASK	~0x1FFFFFFF
10362306a36Sopenharmony_ci
10462306a36Sopenharmony_ci/* Intel i820 registers */
10562306a36Sopenharmony_ci#define INTEL_I820_RDCR		0x51
10662306a36Sopenharmony_ci#define INTEL_I820_ERRSTS	0xc8
10762306a36Sopenharmony_ci
10862306a36Sopenharmony_ci/* Intel i840 registers */
10962306a36Sopenharmony_ci#define INTEL_I840_MCHCFG	0x50
11062306a36Sopenharmony_ci#define INTEL_I840_ERRSTS	0xc8
11162306a36Sopenharmony_ci
11262306a36Sopenharmony_ci/* Intel i850 registers */
11362306a36Sopenharmony_ci#define INTEL_I850_MCHCFG	0x50
11462306a36Sopenharmony_ci#define INTEL_I850_ERRSTS	0xc8
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci/* intel 915G registers */
11762306a36Sopenharmony_ci#define I915_GMADR_BAR	2
11862306a36Sopenharmony_ci#define I915_MMADR_BAR	0
11962306a36Sopenharmony_ci#define I915_PTE_BAR	3
12062306a36Sopenharmony_ci#define I915_GMCH_GMS_STOLEN_48M	(0x6 << 4)
12162306a36Sopenharmony_ci#define I915_GMCH_GMS_STOLEN_64M	(0x7 << 4)
12262306a36Sopenharmony_ci#define G33_GMCH_GMS_STOLEN_128M	(0x8 << 4)
12362306a36Sopenharmony_ci#define G33_GMCH_GMS_STOLEN_256M	(0x9 << 4)
12462306a36Sopenharmony_ci#define INTEL_GMCH_GMS_STOLEN_96M	(0xa << 4)
12562306a36Sopenharmony_ci#define INTEL_GMCH_GMS_STOLEN_160M	(0xb << 4)
12662306a36Sopenharmony_ci#define INTEL_GMCH_GMS_STOLEN_224M	(0xc << 4)
12762306a36Sopenharmony_ci#define INTEL_GMCH_GMS_STOLEN_352M	(0xd << 4)
12862306a36Sopenharmony_ci
12962306a36Sopenharmony_ci#define I915_IFPADDR    0x60
13062306a36Sopenharmony_ci#define I830_HIC        0x70
13162306a36Sopenharmony_ci
13262306a36Sopenharmony_ci/* Intel 965G registers */
13362306a36Sopenharmony_ci#define I965_MSAC 0x62
13462306a36Sopenharmony_ci#define I965_IFPADDR    0x70
13562306a36Sopenharmony_ci
13662306a36Sopenharmony_ci/* Intel 7505 registers */
13762306a36Sopenharmony_ci#define INTEL_I7505_APSIZE	0x74
13862306a36Sopenharmony_ci#define INTEL_I7505_NCAPID	0x60
13962306a36Sopenharmony_ci#define INTEL_I7505_NISTAT	0x6c
14062306a36Sopenharmony_ci#define INTEL_I7505_ATTBASE	0x78
14162306a36Sopenharmony_ci#define INTEL_I7505_ERRSTS	0x42
14262306a36Sopenharmony_ci#define INTEL_I7505_AGPCTRL	0x70
14362306a36Sopenharmony_ci#define INTEL_I7505_MCHCFG	0x50
14462306a36Sopenharmony_ci
14562306a36Sopenharmony_ci/* pci devices ids */
14662306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_E7221_HB	0x2588
14762306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_E7221_IG	0x258a
14862306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_82946GZ_HB      0x2970
14962306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_82946GZ_IG      0x2972
15062306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_82G35_HB     0x2980
15162306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_82G35_IG     0x2982
15262306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_82965Q_HB       0x2990
15362306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_82965Q_IG       0x2992
15462306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_82965G_HB       0x29A0
15562306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_82965G_IG       0x29A2
15662306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_82965GM_HB      0x2A00
15762306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_82965GM_IG      0x2A02
15862306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_82965GME_HB     0x2A10
15962306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_82965GME_IG     0x2A12
16062306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_82945GME_HB     0x27AC
16162306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_82945GME_IG     0x27AE
16262306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_PINEVIEW_M_HB        0xA010
16362306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_PINEVIEW_M_IG        0xA011
16462306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_PINEVIEW_HB         0xA000
16562306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_PINEVIEW_IG         0xA001
16662306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_G33_HB          0x29C0
16762306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_G33_IG          0x29C2
16862306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_Q35_HB          0x29B0
16962306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_Q35_IG          0x29B2
17062306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_Q33_HB          0x29D0
17162306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_Q33_IG          0x29D2
17262306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_B43_HB          0x2E40
17362306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_B43_IG          0x2E42
17462306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_B43_1_HB        0x2E90
17562306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_B43_1_IG        0x2E92
17662306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_GM45_HB         0x2A40
17762306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_GM45_IG         0x2A42
17862306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_EAGLELAKE_HB        0x2E00
17962306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_EAGLELAKE_IG        0x2E02
18062306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_Q45_HB          0x2E10
18162306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_Q45_IG          0x2E12
18262306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_G45_HB          0x2E20
18362306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_G45_IG          0x2E22
18462306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_G41_HB          0x2E30
18562306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_G41_IG          0x2E32
18662306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IRONLAKE_D_HB	    0x0040
18762306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IRONLAKE_D2_HB	    0x0069
18862306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IRONLAKE_D_IG	    0x0042
18962306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IRONLAKE_M_HB	    0x0044
19062306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IRONLAKE_MA_HB	    0x0062
19162306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IRONLAKE_MC2_HB    0x006a
19262306a36Sopenharmony_ci#define PCI_DEVICE_ID_INTEL_IRONLAKE_M_IG	    0x0046
19362306a36Sopenharmony_ci
19462306a36Sopenharmony_ci#endif
195