blob: b673f8154333fa7fd7ad06bec698413d542c1691 [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.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#ifndef __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__
Edward O'Callaghan089a5102015-01-06 02:48:57 +110022#define __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__
Aaron Durbin76c37002012-10-30 09:03:43 -050023
24/* Chipset types */
25#define HASWELL_MOBILE 0
26#define HASWELL_DESKTOP 1
27#define HASWELL_SERVER 2
28
Aaron Durbin8ce667e2013-02-15 21:45:06 -060029/* Intel Enhanced Debug region */
30#define IED_SIZE CONFIG_IED_REGION_SIZE
Aaron Durbin76c37002012-10-30 09:03:43 -050031
32/* Northbridge BARs */
33#define DEFAULT_PCIEXBAR CONFIG_MMCONF_BASE_ADDRESS /* 4 KB per PCIe device */
34#define DEFAULT_MCHBAR 0xfed10000 /* 16 KB */
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080035#ifndef __ACPI__
36#define DEFAULT_DMIBAR ((u8 *)0xfed18000) /* 4 KB */
37#else
Aaron Durbin76c37002012-10-30 09:03:43 -050038#define DEFAULT_DMIBAR 0xfed18000 /* 4 KB */
Kevin Paul Herbertbde6d302014-12-24 18:43:20 -080039#endif
Aaron Durbin76c37002012-10-30 09:03:43 -050040#define DEFAULT_EPBAR 0xfed19000 /* 4 KB */
41
42#include <southbridge/intel/lynxpoint/pch.h>
43
44/* Everything below this line is ignored in the DSDT */
45#ifndef __ACPI__
46
47/* Device 0:0.0 PCI configuration space (Host Bridge) */
48
49#define EPBAR 0x40
50#define MCHBAR 0x48
51#define PCIEXBAR 0x60
52#define DMIBAR 0x68
Aaron Durbin76c37002012-10-30 09:03:43 -050053
54#define GGC 0x50 /* GMCH Graphics Control */
55
56#define DEVEN 0x54 /* Device Enable */
Duncan Laurie0a7c49e2013-06-20 12:40:55 -070057#define DEVEN_D7EN (1 << 14)
58#define DEVEN_D4EN (1 << 7)
59#define DEVEN_D3EN (1 << 5)
60#define DEVEN_D2EN (1 << 4)
61#define DEVEN_D1F0EN (1 << 3)
62#define DEVEN_D1F1EN (1 << 2)
63#define DEVEN_D1F2EN (1 << 1)
64#define DEVEN_D0EN (1 << 0)
Aaron Durbin76c37002012-10-30 09:03:43 -050065
66#define PAM0 0x80
67#define PAM1 0x81
68#define PAM2 0x82
69#define PAM3 0x83
70#define PAM4 0x84
71#define PAM5 0x85
72#define PAM6 0x86
73
74#define LAC 0x87 /* Legacy Access Control */
75#define SMRAM 0x88 /* System Management RAM Control */
76#define D_OPEN (1 << 6)
77#define D_CLS (1 << 5)
78#define D_LCK (1 << 4)
79#define G_SMRAME (1 << 3)
80#define C_BASE_SEG ((0 << 2) | (1 << 1) | (0 << 0))
81
Aaron Durbinc12ef972012-12-18 14:22:49 -060082#define MESEG_BASE 0x70 /* Management Engine Base. */
83#define MESEG_LIMIT 0x78 /* Management Engine Limit. */
84#define REMAPBASE 0x90 /* Remap base. */
85#define REMAPLIMIT 0x98 /* Remap limit. */
86#define TOM 0xa0 /* Top of DRAM in memory controller space. */
Aaron Durbin76c37002012-10-30 09:03:43 -050087#define TOUUD 0xa8 /* Top of Upper Usable DRAM */
Aaron Durbinc12ef972012-12-18 14:22:49 -060088#define BDSM 0xb0 /* Base Data Stolen Memory */
89#define BGSM 0xb4 /* Base GTT Stolen Memory */
Aaron Durbin76c37002012-10-30 09:03:43 -050090#define TSEG 0xb8 /* TSEG base */
91#define TOLUD 0xbc /* Top of Low Used Memory */
92
93#define SKPAD 0xdc /* Scratchpad Data */
94
95/* Device 0:1.0 PCI configuration space (PCI Express) */
96
97#define BCTRL1 0x3e /* 16bit */
98
99
100/* Device 0:2.0 PCI configuration space (Graphics Device) */
101
102#define MSAC 0x62 /* Multi Size Aperture Control */
103#define SWSCI 0xe8 /* SWSCI enable */
104#define ASLS 0xfc /* OpRegion Base */
105
106/*
107 * MCHBAR
108 */
109
110#define MCHBAR8(x) *((volatile u8 *)(DEFAULT_MCHBAR + x))
111#define MCHBAR16(x) *((volatile u16 *)(DEFAULT_MCHBAR + x))
112#define MCHBAR32(x) *((volatile u32 *)(DEFAULT_MCHBAR + x))
113#define MCHBAR32_OR(x, or) MCHBAR32(x) = (MCHBAR32(x) | (or))
114
Aaron Durbin76c37002012-10-30 09:03:43 -0500115#define BIOS_RESET_CPL 0x5da8 /* 8bit */
116
Duncan Lauriec70353f2013-06-28 14:40:38 -0700117/* Some power MSRs are also represented in MCHBAR */
118#define MCH_PKG_POWER_LIMIT_LO 0x59a0
119#define MCH_PKG_POWER_LIMIT_HI 0x59a4
120#define MCH_DDR_POWER_LIMIT_LO 0x58e0
121#define MCH_DDR_POWER_LIMIT_HI 0x58e4
122
Aaron Durbin76c37002012-10-30 09:03:43 -0500123/*
124 * EPBAR - Egress Port Root Complex Register Block
125 */
126
127#define EPBAR8(x) *((volatile u8 *)(DEFAULT_EPBAR + x))
128#define EPBAR16(x) *((volatile u16 *)(DEFAULT_EPBAR + x))
129#define EPBAR32(x) *((volatile u32 *)(DEFAULT_EPBAR + x))
130
131#define EPPVCCAP1 0x004 /* 32bit */
132#define EPPVCCAP2 0x008 /* 32bit */
133
134#define EPVC0RCAP 0x010 /* 32bit */
135#define EPVC0RCTL 0x014 /* 32bit */
136#define EPVC0RSTS 0x01a /* 16bit */
137
138#define EPVC1RCAP 0x01c /* 32bit */
139#define EPVC1RCTL 0x020 /* 32bit */
140#define EPVC1RSTS 0x026 /* 16bit */
141
142#define EPVC1MTS 0x028 /* 32bit */
143#define EPVC1IST 0x038 /* 64bit */
144
145#define EPESD 0x044 /* 32bit */
146
147#define EPLE1D 0x050 /* 32bit */
148#define EPLE1A 0x058 /* 64bit */
149#define EPLE2D 0x060 /* 32bit */
150#define EPLE2A 0x068 /* 64bit */
151
152#define PORTARB 0x100 /* 256bit */
153
154/*
155 * DMIBAR
156 */
157
158#define DMIBAR8(x) *((volatile u8 *)(DEFAULT_DMIBAR + x))
159#define DMIBAR16(x) *((volatile u16 *)(DEFAULT_DMIBAR + x))
160#define DMIBAR32(x) *((volatile u32 *)(DEFAULT_DMIBAR + x))
161
162#define DMIVCECH 0x000 /* 32bit */
163#define DMIPVCCAP1 0x004 /* 32bit */
164#define DMIPVCCAP2 0x008 /* 32bit */
165
166#define DMIPVCCCTL 0x00c /* 16bit */
167
168#define DMIVC0RCAP 0x010 /* 32bit */
169#define DMIVC0RCTL0 0x014 /* 32bit */
170#define DMIVC0RSTS 0x01a /* 16bit */
171
172#define DMIVC1RCAP 0x01c /* 32bit */
173#define DMIVC1RCTL 0x020 /* 32bit */
174#define DMIVC1RSTS 0x026 /* 16bit */
175
176#define DMILE1D 0x050 /* 32bit */
177#define DMILE1A 0x058 /* 64bit */
178#define DMILE2D 0x060 /* 32bit */
179#define DMILE2A 0x068 /* 64bit */
180
181#define DMILCAP 0x084 /* 32bit */
182#define DMILCTL 0x088 /* 16bit */
183#define DMILSTS 0x08a /* 16bit */
184
185#define DMICTL1 0x0f0 /* 32bit */
186#define DMICTL2 0x0fc /* 32bit */
187
188#define DMICC 0x208 /* 32bit */
189
190#define DMIDRCCFG 0xeb4 /* 32bit */
191
192#ifndef __ASSEMBLER__
193static inline void barrier(void) { asm("" ::: "memory"); }
194
195struct ied_header {
196 char signature[10];
197 u32 size;
198 u8 reserved[34];
199} __attribute__ ((packed));
200
Aaron Durbin21efd8c2013-01-17 09:39:39 -0600201#define PCI_DEVICE_ID_HSW_MOBILE 0x0c04
202#define PCI_DEVICE_ID_HSW_ULT 0x0a04
Aaron Durbin76c37002012-10-30 09:03:43 -0500203
204#ifdef __SMM__
205void intel_northbridge_haswell_finalize_smm(void);
206#else /* !__SMM__ */
Aaron Durbin76c37002012-10-30 09:03:43 -0500207void haswell_early_initialization(int chipset_type);
208void haswell_late_initialization(void);
Ronald G. Minnich4c8465c2013-09-30 15:57:21 -0700209void set_translation_table(int start, int end, u64 base, int inc);
Aaron Durbin76c37002012-10-30 09:03:43 -0500210
211/* debugging functions */
212void print_pci_devices(void);
213void dump_pci_device(unsigned dev);
214void dump_pci_devices(void);
215void dump_spd_registers(void);
216void dump_mem(unsigned start, unsigned end);
217void report_platform_info(void);
218#endif /* !__SMM__ */
219
220
221#define MRC_DATA_ALIGN 0x1000
222#define MRC_DATA_SIGNATURE (('M'<<0)|('R'<<8)|('C'<<16)|('D'<<24))
223
224struct mrc_data_container {
225 u32 mrc_signature; // "MRCD"
226 u32 mrc_data_size; // Actual total size of this structure
227 u32 mrc_checksum; // IP style checksum
228 u32 reserved; // For header alignment
229 u8 mrc_data[0]; // Variable size, platform/run time dependent.
230} __attribute__ ((packed));
231
232struct mrc_data_container *find_current_mrc_cache(void);
233#if !defined(__PRE_RAM__)
Aaron Durbin76c37002012-10-30 09:03:43 -0500234#include "gma.h"
235int init_igd_opregion(igd_opregion_t *igd_opregion);
Aaron Durbin76c37002012-10-30 09:03:43 -0500236#endif
237
238#endif
239#endif
Edward O'Callaghan089a5102015-01-06 02:48:57 +1100240#endif /* __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__ */