blob: 1255cac5d621e34dce5ce0758e31c6115604438f [file] [log] [blame]
Angel Pons4b429832020-04-02 23:48:50 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Aaron Durbin76c37002012-10-30 09:03:43 -05002
3#ifndef __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__
Edward O'Callaghan089a5102015-01-06 02:48:57 +11004#define __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__
Aaron Durbin76c37002012-10-30 09:03:43 -05005
6/* Chipset types */
7#define HASWELL_MOBILE 0
8#define HASWELL_DESKTOP 1
9#define HASWELL_SERVER 2
10
Aaron Durbin8ce667e2013-02-15 21:45:06 -060011/* Intel Enhanced Debug region */
12#define IED_SIZE CONFIG_IED_REGION_SIZE
Aaron Durbin76c37002012-10-30 09:03:43 -050013
14/* Northbridge BARs */
Angel Pons1db5bc72020-01-15 00:49:03 +010015#define DEFAULT_MCHBAR 0xfed10000 /* 16 KB */
16#define DEFAULT_DMIBAR 0xfed18000 /* 4 KB */
17#define DEFAULT_EPBAR 0xfed19000 /* 4 KB */
Aaron Durbin76c37002012-10-30 09:03:43 -050018
Matt DeVilliera51e3792018-03-04 01:44:15 -060019#define GFXVT_BASE_ADDRESS 0xfed90000ULL
20#define GFXVT_BASE_SIZE 0x1000
21
22#define VTVC0_BASE_ADDRESS 0xfed91000ULL
23#define VTVC0_BASE_SIZE 0x1000
24
Aaron Durbin76c37002012-10-30 09:03:43 -050025#include <southbridge/intel/lynxpoint/pch.h>
26
27/* Everything below this line is ignored in the DSDT */
28#ifndef __ACPI__
29
30/* Device 0:0.0 PCI configuration space (Host Bridge) */
Angel Pons1db5bc72020-01-15 00:49:03 +010031#define HOST_BRIDGE PCI_DEV(0, 0, 0)
Aaron Durbin76c37002012-10-30 09:03:43 -050032
Angel Ponse220e312020-07-22 00:55:38 +020033#include "hostbridge_regs.h"
Matt DeVilliera51e3792018-03-04 01:44:15 -060034
Aaron Durbin76c37002012-10-30 09:03:43 -050035
36/* Device 0:2.0 PCI configuration space (Graphics Device) */
37
38#define MSAC 0x62 /* Multi Size Aperture Control */
Aaron Durbin76c37002012-10-30 09:03:43 -050039
40/*
41 * MCHBAR
42 */
43
Angel Pons1db5bc72020-01-15 00:49:03 +010044#define MCHBAR8(x) (*((volatile u8 *)(DEFAULT_MCHBAR + (x))))
45#define MCHBAR16(x) (*((volatile u16 *)(DEFAULT_MCHBAR + (x))))
46#define MCHBAR32(x) (*((volatile u32 *)(DEFAULT_MCHBAR + (x))))
47#define MCHBAR8_AND(x, and) (MCHBAR8(x) = MCHBAR8(x) & (and))
48#define MCHBAR16_AND(x, and) (MCHBAR16(x) = MCHBAR16(x) & (and))
49#define MCHBAR32_AND(x, and) (MCHBAR32(x) = MCHBAR32(x) & (and))
50#define MCHBAR8_OR(x, or) (MCHBAR8(x) = MCHBAR8(x) | (or))
51#define MCHBAR16_OR(x, or) (MCHBAR16(x) = MCHBAR16(x) | (or))
52#define MCHBAR32_OR(x, or) (MCHBAR32(x) = MCHBAR32(x) | (or))
53#define MCHBAR8_AND_OR(x, and, or) (MCHBAR8(x) = (MCHBAR8(x) & (and)) | (or))
54#define MCHBAR16_AND_OR(x, and, or) (MCHBAR16(x) = (MCHBAR16(x) & (and)) | (or))
55#define MCHBAR32_AND_OR(x, and, or) (MCHBAR32(x) = (MCHBAR32(x) & (and)) | (or))
Aaron Durbin76c37002012-10-30 09:03:43 -050056
Angel Pons1db5bc72020-01-15 00:49:03 +010057/* As there are many registers, define them on a separate file */
58#include "mchbar_regs.h"
Duncan Lauriec70353f2013-06-28 14:40:38 -070059
Angel Ponse220e312020-07-22 00:55:38 +020060#define ARCHDIS 0xff0 /* DMA Remap Engine Policy Control */
61#define DMAR_LCKDN (1 << 31)
62#define SPCAPCTRL (1 << 25)
63#define L3HIT2PEND_DIS (1 << 20)
64#define PRSCAPDIS (1 << 2)
65#define GLBIOTLBINV (1 << 1)
66#define GLBCTXTINV (1 << 0)
67
Aaron Durbin76c37002012-10-30 09:03:43 -050068/*
69 * EPBAR - Egress Port Root Complex Register Block
70 */
71
Angel Pons1db5bc72020-01-15 00:49:03 +010072#define EPBAR8(x) *((volatile u8 *)(DEFAULT_EPBAR + x))
Aaron Durbin76c37002012-10-30 09:03:43 -050073#define EPBAR16(x) *((volatile u16 *)(DEFAULT_EPBAR + x))
74#define EPBAR32(x) *((volatile u32 *)(DEFAULT_EPBAR + x))
75
76#define EPPVCCAP1 0x004 /* 32bit */
77#define EPPVCCAP2 0x008 /* 32bit */
78
79#define EPVC0RCAP 0x010 /* 32bit */
80#define EPVC0RCTL 0x014 /* 32bit */
81#define EPVC0RSTS 0x01a /* 16bit */
82
83#define EPVC1RCAP 0x01c /* 32bit */
84#define EPVC1RCTL 0x020 /* 32bit */
85#define EPVC1RSTS 0x026 /* 16bit */
86
87#define EPVC1MTS 0x028 /* 32bit */
88#define EPVC1IST 0x038 /* 64bit */
89
90#define EPESD 0x044 /* 32bit */
91
92#define EPLE1D 0x050 /* 32bit */
93#define EPLE1A 0x058 /* 64bit */
94#define EPLE2D 0x060 /* 32bit */
95#define EPLE2A 0x068 /* 64bit */
96
97#define PORTARB 0x100 /* 256bit */
98
99/*
100 * DMIBAR
101 */
102
Angel Pons1db5bc72020-01-15 00:49:03 +0100103#define DMIBAR8(x) *((volatile u8 *)(DEFAULT_DMIBAR + x))
Aaron Durbin76c37002012-10-30 09:03:43 -0500104#define DMIBAR16(x) *((volatile u16 *)(DEFAULT_DMIBAR + x))
105#define DMIBAR32(x) *((volatile u32 *)(DEFAULT_DMIBAR + x))
106
107#define DMIVCECH 0x000 /* 32bit */
108#define DMIPVCCAP1 0x004 /* 32bit */
109#define DMIPVCCAP2 0x008 /* 32bit */
110
111#define DMIPVCCCTL 0x00c /* 16bit */
112
113#define DMIVC0RCAP 0x010 /* 32bit */
114#define DMIVC0RCTL0 0x014 /* 32bit */
115#define DMIVC0RSTS 0x01a /* 16bit */
116
117#define DMIVC1RCAP 0x01c /* 32bit */
118#define DMIVC1RCTL 0x020 /* 32bit */
119#define DMIVC1RSTS 0x026 /* 16bit */
120
121#define DMILE1D 0x050 /* 32bit */
122#define DMILE1A 0x058 /* 64bit */
123#define DMILE2D 0x060 /* 32bit */
124#define DMILE2A 0x068 /* 64bit */
125
126#define DMILCAP 0x084 /* 32bit */
127#define DMILCTL 0x088 /* 16bit */
128#define DMILSTS 0x08a /* 16bit */
129
130#define DMICTL1 0x0f0 /* 32bit */
131#define DMICTL2 0x0fc /* 32bit */
132
133#define DMICC 0x208 /* 32bit */
134
135#define DMIDRCCFG 0xeb4 /* 32bit */
136
137#ifndef __ASSEMBLER__
Aaron Durbin76c37002012-10-30 09:03:43 -0500138
Aaron Durbin76c37002012-10-30 09:03:43 -0500139void intel_northbridge_haswell_finalize_smm(void);
Kyösti Mälkkid7205be2019-09-27 07:24:17 +0300140
Angel Pons73fa0352020-07-03 12:29:03 +0200141void mb_late_romstage_setup(void); /* optional */
Angel Pons2e25ac62020-07-03 12:06:04 +0200142
Angel Ponse8168292020-07-03 11:42:22 +0200143void haswell_early_initialization(void);
Aaron Durbin76c37002012-10-30 09:03:43 -0500144void haswell_late_initialization(void);
Ronald G. Minnich4c8465c2013-09-30 15:57:21 -0700145void set_translation_table(int start, int end, u64 base, int inc);
Tristan Corrick334be322018-12-17 22:10:21 +1300146void haswell_unhide_peg(void);
Aaron Durbin76c37002012-10-30 09:03:43 -0500147
Aaron Durbin76c37002012-10-30 09:03:43 -0500148void report_platform_info(void);
Aaron Durbin76c37002012-10-30 09:03:43 -0500149
Matt DeVillier85d98d92018-03-04 01:41:23 -0600150#include <device/device.h>
151
152struct acpi_rsdp;
Furquan Shaikh0f007d82020-04-24 06:41:18 -0700153unsigned long northbridge_write_acpi_tables(const struct device *device, unsigned long start,
Angel Pons1db5bc72020-01-15 00:49:03 +0100154 struct acpi_rsdp *rsdp);
Matt DeVillier85d98d92018-03-04 01:41:23 -0600155
Angel Pons1db5bc72020-01-15 00:49:03 +0100156#endif /* __ASSEMBLER__ */
157#endif /* __ACPI__ */
Edward O'Callaghan089a5102015-01-06 02:48:57 +1100158#endif /* __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__ */