blob: 55c0b4b24b2193af90c146406450d83acbf9c488 [file] [log] [blame]
Aaron Durbin76c37002012-10-30 09:03:43 -05001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2007-2008 coresystems GmbH
5 * Copyright (C) 2011 Google Inc.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Aaron Durbin76c37002012-10-30 09:03:43 -050015 */
16
17#ifndef __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__
Edward O'Callaghan089a5102015-01-06 02:48:57 +110018#define __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__
Aaron Durbin76c37002012-10-30 09:03:43 -050019
20/* Chipset types */
21#define HASWELL_MOBILE 0
22#define HASWELL_DESKTOP 1
23#define HASWELL_SERVER 2
24
Aaron Durbin8ce667e2013-02-15 21:45:06 -060025/* Intel Enhanced Debug region */
26#define IED_SIZE CONFIG_IED_REGION_SIZE
Aaron Durbin76c37002012-10-30 09:03:43 -050027
28/* Northbridge BARs */
Aaron Durbin76c37002012-10-30 09:03:43 -050029#define DEFAULT_MCHBAR 0xfed10000 /* 16 KB */
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080030#ifndef __ACPI__
31#define DEFAULT_DMIBAR ((u8 *)0xfed18000) /* 4 KB */
32#else
Aaron Durbin76c37002012-10-30 09:03:43 -050033#define DEFAULT_DMIBAR 0xfed18000 /* 4 KB */
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080034#endif
Aaron Durbin76c37002012-10-30 09:03:43 -050035#define DEFAULT_EPBAR 0xfed19000 /* 4 KB */
36
Matt DeVilliera51e3792018-03-04 01:44:15 -060037#define GFXVT_BASE_ADDRESS 0xfed90000ULL
38#define GFXVT_BASE_SIZE 0x1000
39
40#define VTVC0_BASE_ADDRESS 0xfed91000ULL
41#define VTVC0_BASE_SIZE 0x1000
42
Aaron Durbin76c37002012-10-30 09:03:43 -050043#include <southbridge/intel/lynxpoint/pch.h>
44
45/* Everything below this line is ignored in the DSDT */
46#ifndef __ACPI__
47
48/* Device 0:0.0 PCI configuration space (Host Bridge) */
49
50#define EPBAR 0x40
51#define MCHBAR 0x48
52#define PCIEXBAR 0x60
53#define DMIBAR 0x68
Aaron Durbin76c37002012-10-30 09:03:43 -050054
55#define GGC 0x50 /* GMCH Graphics Control */
Tristan Corrickc5d367b2018-12-17 22:10:07 +130056#define GGC_DISABLE_VGA_IO_DECODE (1 << 1)
57#define GGC_IGD_MEM_IN_32MB_UNITS(x) (((x) & 0x1f) << 3)
58#define GGC_GTT_0MB (0 << 8)
59#define GGC_GTT_1MB (1 << 8)
60#define GGC_GTT_2MB (2 << 8)
Aaron Durbin76c37002012-10-30 09:03:43 -050061
62#define DEVEN 0x54 /* Device Enable */
Duncan Laurie0a7c49e2013-06-20 12:40:55 -070063#define DEVEN_D7EN (1 << 14)
64#define DEVEN_D4EN (1 << 7)
65#define DEVEN_D3EN (1 << 5)
66#define DEVEN_D2EN (1 << 4)
67#define DEVEN_D1F0EN (1 << 3)
68#define DEVEN_D1F1EN (1 << 2)
69#define DEVEN_D1F2EN (1 << 1)
70#define DEVEN_D0EN (1 << 0)
Aaron Durbin76c37002012-10-30 09:03:43 -050071
72#define PAM0 0x80
73#define PAM1 0x81
74#define PAM2 0x82
75#define PAM3 0x83
76#define PAM4 0x84
77#define PAM5 0x85
78#define PAM6 0x86
79
80#define LAC 0x87 /* Legacy Access Control */
81#define SMRAM 0x88 /* System Management RAM Control */
82#define D_OPEN (1 << 6)
83#define D_CLS (1 << 5)
84#define D_LCK (1 << 4)
85#define G_SMRAME (1 << 3)
86#define C_BASE_SEG ((0 << 2) | (1 << 1) | (0 << 0))
87
Aaron Durbinc12ef972012-12-18 14:22:49 -060088#define MESEG_BASE 0x70 /* Management Engine Base. */
89#define MESEG_LIMIT 0x78 /* Management Engine Limit. */
90#define REMAPBASE 0x90 /* Remap base. */
91#define REMAPLIMIT 0x98 /* Remap limit. */
92#define TOM 0xa0 /* Top of DRAM in memory controller space. */
Aaron Durbin76c37002012-10-30 09:03:43 -050093#define TOUUD 0xa8 /* Top of Upper Usable DRAM */
Aaron Durbinc12ef972012-12-18 14:22:49 -060094#define BDSM 0xb0 /* Base Data Stolen Memory */
95#define BGSM 0xb4 /* Base GTT Stolen Memory */
Aaron Durbin76c37002012-10-30 09:03:43 -050096#define TSEG 0xb8 /* TSEG base */
97#define TOLUD 0xbc /* Top of Low Used Memory */
98
99#define SKPAD 0xdc /* Scratchpad Data */
100
Matt DeVilliera51e3792018-03-04 01:44:15 -0600101#define CAPID0_A 0xe4
102#define VTD_DISABLE (1 << 23)
103#define ARCHDIS 0xff0 /* DMA Remap Engine Policy Control */
104#define DMAR_LCKDN (1 << 31)
105#define SPCAPCTRL (1 << 25)
106#define L3HIT2PEND_DIS (1 << 20)
107#define PRSCAPDIS (1 << 2)
108#define GLBIOTLBINV (1 << 1)
109#define GLBCTXTINV (1 << 0)
110
Aaron Durbin76c37002012-10-30 09:03:43 -0500111/* Device 0:1.0 PCI configuration space (PCI Express) */
112
113#define BCTRL1 0x3e /* 16bit */
114
115
116/* Device 0:2.0 PCI configuration space (Graphics Device) */
117
118#define MSAC 0x62 /* Multi Size Aperture Control */
Aaron Durbin76c37002012-10-30 09:03:43 -0500119
120/*
121 * MCHBAR
122 */
123
124#define MCHBAR8(x) *((volatile u8 *)(DEFAULT_MCHBAR + x))
125#define MCHBAR16(x) *((volatile u16 *)(DEFAULT_MCHBAR + x))
126#define MCHBAR32(x) *((volatile u32 *)(DEFAULT_MCHBAR + x))
127#define MCHBAR32_OR(x, or) MCHBAR32(x) = (MCHBAR32(x) | (or))
128
Aaron Durbin76c37002012-10-30 09:03:43 -0500129#define BIOS_RESET_CPL 0x5da8 /* 8bit */
Matt DeVilliera51e3792018-03-04 01:44:15 -0600130#define GFXVTBAR 0x5400
131#define VTVC0BAR 0x5410
Aaron Durbin76c37002012-10-30 09:03:43 -0500132
Duncan Lauriec70353f2013-06-28 14:40:38 -0700133/* Some power MSRs are also represented in MCHBAR */
134#define MCH_PKG_POWER_LIMIT_LO 0x59a0
135#define MCH_PKG_POWER_LIMIT_HI 0x59a4
136#define MCH_DDR_POWER_LIMIT_LO 0x58e0
137#define MCH_DDR_POWER_LIMIT_HI 0x58e4
138
Aaron Durbin76c37002012-10-30 09:03:43 -0500139/*
140 * EPBAR - Egress Port Root Complex Register Block
141 */
142
143#define EPBAR8(x) *((volatile u8 *)(DEFAULT_EPBAR + x))
144#define EPBAR16(x) *((volatile u16 *)(DEFAULT_EPBAR + x))
145#define EPBAR32(x) *((volatile u32 *)(DEFAULT_EPBAR + x))
146
147#define EPPVCCAP1 0x004 /* 32bit */
148#define EPPVCCAP2 0x008 /* 32bit */
149
150#define EPVC0RCAP 0x010 /* 32bit */
151#define EPVC0RCTL 0x014 /* 32bit */
152#define EPVC0RSTS 0x01a /* 16bit */
153
154#define EPVC1RCAP 0x01c /* 32bit */
155#define EPVC1RCTL 0x020 /* 32bit */
156#define EPVC1RSTS 0x026 /* 16bit */
157
158#define EPVC1MTS 0x028 /* 32bit */
159#define EPVC1IST 0x038 /* 64bit */
160
161#define EPESD 0x044 /* 32bit */
162
163#define EPLE1D 0x050 /* 32bit */
164#define EPLE1A 0x058 /* 64bit */
165#define EPLE2D 0x060 /* 32bit */
166#define EPLE2A 0x068 /* 64bit */
167
168#define PORTARB 0x100 /* 256bit */
169
170/*
171 * DMIBAR
172 */
173
174#define DMIBAR8(x) *((volatile u8 *)(DEFAULT_DMIBAR + x))
175#define DMIBAR16(x) *((volatile u16 *)(DEFAULT_DMIBAR + x))
176#define DMIBAR32(x) *((volatile u32 *)(DEFAULT_DMIBAR + x))
177
178#define DMIVCECH 0x000 /* 32bit */
179#define DMIPVCCAP1 0x004 /* 32bit */
180#define DMIPVCCAP2 0x008 /* 32bit */
181
182#define DMIPVCCCTL 0x00c /* 16bit */
183
184#define DMIVC0RCAP 0x010 /* 32bit */
185#define DMIVC0RCTL0 0x014 /* 32bit */
186#define DMIVC0RSTS 0x01a /* 16bit */
187
188#define DMIVC1RCAP 0x01c /* 32bit */
189#define DMIVC1RCTL 0x020 /* 32bit */
190#define DMIVC1RSTS 0x026 /* 16bit */
191
192#define DMILE1D 0x050 /* 32bit */
193#define DMILE1A 0x058 /* 64bit */
194#define DMILE2D 0x060 /* 32bit */
195#define DMILE2A 0x068 /* 64bit */
196
197#define DMILCAP 0x084 /* 32bit */
198#define DMILCTL 0x088 /* 16bit */
199#define DMILSTS 0x08a /* 16bit */
200
201#define DMICTL1 0x0f0 /* 32bit */
202#define DMICTL2 0x0fc /* 32bit */
203
204#define DMICC 0x208 /* 32bit */
205
206#define DMIDRCCFG 0xeb4 /* 32bit */
207
208#ifndef __ASSEMBLER__
209static inline void barrier(void) { asm("" ::: "memory"); }
210
Aaron Durbin76c37002012-10-30 09:03:43 -0500211#ifdef __SMM__
212void intel_northbridge_haswell_finalize_smm(void);
213#else /* !__SMM__ */
Aaron Durbin76c37002012-10-30 09:03:43 -0500214void haswell_early_initialization(int chipset_type);
215void haswell_late_initialization(void);
Ronald G. Minnich4c8465c2013-09-30 15:57:21 -0700216void set_translation_table(int start, int end, u64 base, int inc);
Tristan Corrick334be322018-12-17 22:10:21 +1300217void haswell_unhide_peg(void);
Aaron Durbin76c37002012-10-30 09:03:43 -0500218
Aaron Durbin76c37002012-10-30 09:03:43 -0500219void report_platform_info(void);
220#endif /* !__SMM__ */
221
Matt DeVillier85d98d92018-03-04 01:41:23 -0600222#if ENV_RAMSTAGE && !defined(__SIMPLE_DEVICE__)
223#include <device/device.h>
224
225struct acpi_rsdp;
Elyes HAOUAS77f7a6e2018-05-09 17:47:59 +0200226unsigned long northbridge_write_acpi_tables(struct device *device,
Matt DeVillier85d98d92018-03-04 01:41:23 -0600227 unsigned long start, struct acpi_rsdp *rsdp);
228#endif
229
Aaron Durbin76c37002012-10-30 09:03:43 -0500230#endif
231#endif
Edward O'Callaghan089a5102015-01-06 02:48:57 +1100232#endif /* __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__ */