blob: 32ac7c3db40d94717cfd4b799116cd9cc834d308 [file] [log] [blame]
Angel Pons4b429832020-04-02 23:48:50 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Aaron Durbin76c37002012-10-30 09:03:43 -05003
4#ifndef __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__
Edward O'Callaghan089a5102015-01-06 02:48:57 +11005#define __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__
Aaron Durbin76c37002012-10-30 09:03:43 -05006
7/* Chipset types */
8#define HASWELL_MOBILE 0
9#define HASWELL_DESKTOP 1
10#define HASWELL_SERVER 2
11
Aaron Durbin8ce667e2013-02-15 21:45:06 -060012/* Intel Enhanced Debug region */
13#define IED_SIZE CONFIG_IED_REGION_SIZE
Aaron Durbin76c37002012-10-30 09:03:43 -050014
15/* Northbridge BARs */
Angel Pons1db5bc72020-01-15 00:49:03 +010016#define DEFAULT_MCHBAR 0xfed10000 /* 16 KB */
17#define DEFAULT_DMIBAR 0xfed18000 /* 4 KB */
18#define DEFAULT_EPBAR 0xfed19000 /* 4 KB */
Aaron Durbin76c37002012-10-30 09:03:43 -050019
Matt DeVilliera51e3792018-03-04 01:44:15 -060020#define GFXVT_BASE_ADDRESS 0xfed90000ULL
21#define GFXVT_BASE_SIZE 0x1000
22
23#define VTVC0_BASE_ADDRESS 0xfed91000ULL
24#define VTVC0_BASE_SIZE 0x1000
25
Aaron Durbin76c37002012-10-30 09:03:43 -050026#include <southbridge/intel/lynxpoint/pch.h>
27
28/* Everything below this line is ignored in the DSDT */
29#ifndef __ACPI__
30
31/* Device 0:0.0 PCI configuration space (Host Bridge) */
Angel Pons1db5bc72020-01-15 00:49:03 +010032#define HOST_BRIDGE PCI_DEV(0, 0, 0)
Aaron Durbin76c37002012-10-30 09:03:43 -050033
34#define EPBAR 0x40
35#define MCHBAR 0x48
36#define PCIEXBAR 0x60
37#define DMIBAR 0x68
Aaron Durbin76c37002012-10-30 09:03:43 -050038
39#define GGC 0x50 /* GMCH Graphics Control */
Tristan Corrickc5d367b2018-12-17 22:10:07 +130040#define GGC_DISABLE_VGA_IO_DECODE (1 << 1)
41#define GGC_IGD_MEM_IN_32MB_UNITS(x) (((x) & 0x1f) << 3)
Angel Pons1db5bc72020-01-15 00:49:03 +010042#define GGC_GTT_0MB (0 << 8)
43#define GGC_GTT_1MB (1 << 8)
44#define GGC_GTT_2MB (2 << 8)
Aaron Durbin76c37002012-10-30 09:03:43 -050045
46#define DEVEN 0x54 /* Device Enable */
Duncan Laurie0a7c49e2013-06-20 12:40:55 -070047#define DEVEN_D7EN (1 << 14)
48#define DEVEN_D4EN (1 << 7)
49#define DEVEN_D3EN (1 << 5)
50#define DEVEN_D2EN (1 << 4)
51#define DEVEN_D1F0EN (1 << 3)
52#define DEVEN_D1F1EN (1 << 2)
53#define DEVEN_D1F2EN (1 << 1)
54#define DEVEN_D0EN (1 << 0)
Aaron Durbin76c37002012-10-30 09:03:43 -050055
56#define PAM0 0x80
57#define PAM1 0x81
58#define PAM2 0x82
59#define PAM3 0x83
60#define PAM4 0x84
61#define PAM5 0x85
62#define PAM6 0x86
63
64#define LAC 0x87 /* Legacy Access Control */
65#define SMRAM 0x88 /* System Management RAM Control */
66#define D_OPEN (1 << 6)
67#define D_CLS (1 << 5)
68#define D_LCK (1 << 4)
69#define G_SMRAME (1 << 3)
70#define C_BASE_SEG ((0 << 2) | (1 << 1) | (0 << 0))
71
Angel Pons1db5bc72020-01-15 00:49:03 +010072#define MESEG_BASE 0x70 /* Management Engine Base */
73#define MESEG_LIMIT 0x78 /* Management Engine Limit */
74#define REMAPBASE 0x90 /* Remap base */
75#define REMAPLIMIT 0x98 /* Remap limit */
76#define TOM 0xa0 /* Top of DRAM in memory controller space */
Aaron Durbin76c37002012-10-30 09:03:43 -050077#define TOUUD 0xa8 /* Top of Upper Usable DRAM */
Aaron Durbinc12ef972012-12-18 14:22:49 -060078#define BDSM 0xb0 /* Base Data Stolen Memory */
79#define BGSM 0xb4 /* Base GTT Stolen Memory */
Aaron Durbin76c37002012-10-30 09:03:43 -050080#define TSEG 0xb8 /* TSEG base */
81#define TOLUD 0xbc /* Top of Low Used Memory */
82
83#define SKPAD 0xdc /* Scratchpad Data */
84
Matt DeVilliera51e3792018-03-04 01:44:15 -060085#define CAPID0_A 0xe4
86#define VTD_DISABLE (1 << 23)
87#define ARCHDIS 0xff0 /* DMA Remap Engine Policy Control */
88#define DMAR_LCKDN (1 << 31)
89#define SPCAPCTRL (1 << 25)
90#define L3HIT2PEND_DIS (1 << 20)
91#define PRSCAPDIS (1 << 2)
92#define GLBIOTLBINV (1 << 1)
93#define GLBCTXTINV (1 << 0)
94
Aaron Durbin76c37002012-10-30 09:03:43 -050095
96/* Device 0:2.0 PCI configuration space (Graphics Device) */
97
98#define MSAC 0x62 /* Multi Size Aperture Control */
Aaron Durbin76c37002012-10-30 09:03:43 -050099
100/*
101 * MCHBAR
102 */
103
Angel Pons1db5bc72020-01-15 00:49:03 +0100104#define MCHBAR8(x) (*((volatile u8 *)(DEFAULT_MCHBAR + (x))))
105#define MCHBAR16(x) (*((volatile u16 *)(DEFAULT_MCHBAR + (x))))
106#define MCHBAR32(x) (*((volatile u32 *)(DEFAULT_MCHBAR + (x))))
107#define MCHBAR8_AND(x, and) (MCHBAR8(x) = MCHBAR8(x) & (and))
108#define MCHBAR16_AND(x, and) (MCHBAR16(x) = MCHBAR16(x) & (and))
109#define MCHBAR32_AND(x, and) (MCHBAR32(x) = MCHBAR32(x) & (and))
110#define MCHBAR8_OR(x, or) (MCHBAR8(x) = MCHBAR8(x) | (or))
111#define MCHBAR16_OR(x, or) (MCHBAR16(x) = MCHBAR16(x) | (or))
112#define MCHBAR32_OR(x, or) (MCHBAR32(x) = MCHBAR32(x) | (or))
113#define MCHBAR8_AND_OR(x, and, or) (MCHBAR8(x) = (MCHBAR8(x) & (and)) | (or))
114#define MCHBAR16_AND_OR(x, and, or) (MCHBAR16(x) = (MCHBAR16(x) & (and)) | (or))
115#define MCHBAR32_AND_OR(x, and, or) (MCHBAR32(x) = (MCHBAR32(x) & (and)) | (or))
Aaron Durbin76c37002012-10-30 09:03:43 -0500116
Angel Pons1db5bc72020-01-15 00:49:03 +0100117/* As there are many registers, define them on a separate file */
118#include "mchbar_regs.h"
Duncan Lauriec70353f2013-06-28 14:40:38 -0700119
Aaron Durbin76c37002012-10-30 09:03:43 -0500120/*
121 * EPBAR - Egress Port Root Complex Register Block
122 */
123
Angel Pons1db5bc72020-01-15 00:49:03 +0100124#define EPBAR8(x) *((volatile u8 *)(DEFAULT_EPBAR + x))
Aaron Durbin76c37002012-10-30 09:03:43 -0500125#define EPBAR16(x) *((volatile u16 *)(DEFAULT_EPBAR + x))
126#define EPBAR32(x) *((volatile u32 *)(DEFAULT_EPBAR + x))
127
128#define EPPVCCAP1 0x004 /* 32bit */
129#define EPPVCCAP2 0x008 /* 32bit */
130
131#define EPVC0RCAP 0x010 /* 32bit */
132#define EPVC0RCTL 0x014 /* 32bit */
133#define EPVC0RSTS 0x01a /* 16bit */
134
135#define EPVC1RCAP 0x01c /* 32bit */
136#define EPVC1RCTL 0x020 /* 32bit */
137#define EPVC1RSTS 0x026 /* 16bit */
138
139#define EPVC1MTS 0x028 /* 32bit */
140#define EPVC1IST 0x038 /* 64bit */
141
142#define EPESD 0x044 /* 32bit */
143
144#define EPLE1D 0x050 /* 32bit */
145#define EPLE1A 0x058 /* 64bit */
146#define EPLE2D 0x060 /* 32bit */
147#define EPLE2A 0x068 /* 64bit */
148
149#define PORTARB 0x100 /* 256bit */
150
151/*
152 * DMIBAR
153 */
154
Angel Pons1db5bc72020-01-15 00:49:03 +0100155#define DMIBAR8(x) *((volatile u8 *)(DEFAULT_DMIBAR + x))
Aaron Durbin76c37002012-10-30 09:03:43 -0500156#define DMIBAR16(x) *((volatile u16 *)(DEFAULT_DMIBAR + x))
157#define DMIBAR32(x) *((volatile u32 *)(DEFAULT_DMIBAR + x))
158
159#define DMIVCECH 0x000 /* 32bit */
160#define DMIPVCCAP1 0x004 /* 32bit */
161#define DMIPVCCAP2 0x008 /* 32bit */
162
163#define DMIPVCCCTL 0x00c /* 16bit */
164
165#define DMIVC0RCAP 0x010 /* 32bit */
166#define DMIVC0RCTL0 0x014 /* 32bit */
167#define DMIVC0RSTS 0x01a /* 16bit */
168
169#define DMIVC1RCAP 0x01c /* 32bit */
170#define DMIVC1RCTL 0x020 /* 32bit */
171#define DMIVC1RSTS 0x026 /* 16bit */
172
173#define DMILE1D 0x050 /* 32bit */
174#define DMILE1A 0x058 /* 64bit */
175#define DMILE2D 0x060 /* 32bit */
176#define DMILE2A 0x068 /* 64bit */
177
178#define DMILCAP 0x084 /* 32bit */
179#define DMILCTL 0x088 /* 16bit */
180#define DMILSTS 0x08a /* 16bit */
181
182#define DMICTL1 0x0f0 /* 32bit */
183#define DMICTL2 0x0fc /* 32bit */
184
185#define DMICC 0x208 /* 32bit */
186
187#define DMIDRCCFG 0xeb4 /* 32bit */
188
189#ifndef __ASSEMBLER__
Aaron Durbin76c37002012-10-30 09:03:43 -0500190
Aaron Durbin76c37002012-10-30 09:03:43 -0500191void intel_northbridge_haswell_finalize_smm(void);
Kyösti Mälkkid7205be2019-09-27 07:24:17 +0300192
Aaron Durbin76c37002012-10-30 09:03:43 -0500193void haswell_early_initialization(int chipset_type);
194void haswell_late_initialization(void);
Ronald G. Minnich4c8465c2013-09-30 15:57:21 -0700195void set_translation_table(int start, int end, u64 base, int inc);
Tristan Corrick334be322018-12-17 22:10:21 +1300196void haswell_unhide_peg(void);
Aaron Durbin76c37002012-10-30 09:03:43 -0500197
Aaron Durbin76c37002012-10-30 09:03:43 -0500198void report_platform_info(void);
Aaron Durbin76c37002012-10-30 09:03:43 -0500199
Matt DeVillier85d98d92018-03-04 01:41:23 -0600200#include <device/device.h>
201
202struct acpi_rsdp;
Furquan Shaikh0f007d82020-04-24 06:41:18 -0700203unsigned long northbridge_write_acpi_tables(const struct device *device, unsigned long start,
Angel Pons1db5bc72020-01-15 00:49:03 +0100204 struct acpi_rsdp *rsdp);
Matt DeVillier85d98d92018-03-04 01:41:23 -0600205
Angel Pons1db5bc72020-01-15 00:49:03 +0100206#endif /* __ASSEMBLER__ */
207#endif /* __ACPI__ */
Edward O'Callaghan089a5102015-01-06 02:48:57 +1100208#endif /* __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__ */