blob: f158c2199b7102c71b9298daf98339992be77aa9 [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
Angel Ponsa3cb3222020-09-14 13:15:19 +020011#include "memmap.h"
Matt DeVilliera51e3792018-03-04 01:44:15 -060012
Aaron Durbin76c37002012-10-30 09:03:43 -050013/* Everything below this line is ignored in the DSDT */
14#ifndef __ACPI__
15
16/* Device 0:0.0 PCI configuration space (Host Bridge) */
Angel Pons1db5bc72020-01-15 00:49:03 +010017#define HOST_BRIDGE PCI_DEV(0, 0, 0)
Aaron Durbin76c37002012-10-30 09:03:43 -050018
Angel Ponse4156c32020-09-14 15:47:59 +020019#include "registers/host_bridge.h"
Matt DeVilliera51e3792018-03-04 01:44:15 -060020
Angel Pons76b8bc22020-07-23 02:32:27 +020021/* Device 0:1.0 PCI configuration space (PCIe Graphics) */
22
23#define PEG_DCAP2 0xc4 /* 32bit */
24
25#define PEG_ESD 0x144 /* 32bit */
26#define PEG_LE1D 0x150 /* 32bit */
27#define PEG_LE1A 0x158 /* 64bit */
28
Aaron Durbin76c37002012-10-30 09:03:43 -050029/* Device 0:2.0 PCI configuration space (Graphics Device) */
30
31#define MSAC 0x62 /* Multi Size Aperture Control */
Aaron Durbin76c37002012-10-30 09:03:43 -050032
33/*
34 * MCHBAR
35 */
36
Angel Ponsf95b9b42021-01-20 01:10:48 +010037#include <northbridge/intel/common/fixed_bars.h>
38
Angel Pons1db5bc72020-01-15 00:49:03 +010039#define MCHBAR8_AND(x, and) (MCHBAR8(x) = MCHBAR8(x) & (and))
40#define MCHBAR16_AND(x, and) (MCHBAR16(x) = MCHBAR16(x) & (and))
41#define MCHBAR32_AND(x, and) (MCHBAR32(x) = MCHBAR32(x) & (and))
42#define MCHBAR8_OR(x, or) (MCHBAR8(x) = MCHBAR8(x) | (or))
43#define MCHBAR16_OR(x, or) (MCHBAR16(x) = MCHBAR16(x) | (or))
44#define MCHBAR32_OR(x, or) (MCHBAR32(x) = MCHBAR32(x) | (or))
45#define MCHBAR8_AND_OR(x, and, or) (MCHBAR8(x) = (MCHBAR8(x) & (and)) | (or))
46#define MCHBAR16_AND_OR(x, and, or) (MCHBAR16(x) = (MCHBAR16(x) & (and)) | (or))
47#define MCHBAR32_AND_OR(x, and, or) (MCHBAR32(x) = (MCHBAR32(x) & (and)) | (or))
Aaron Durbin76c37002012-10-30 09:03:43 -050048
Angel Pons1db5bc72020-01-15 00:49:03 +010049/* As there are many registers, define them on a separate file */
Angel Ponse4156c32020-09-14 15:47:59 +020050#include "registers/mchbar.h"
Duncan Lauriec70353f2013-06-28 14:40:38 -070051
Angel Ponse220e312020-07-22 00:55:38 +020052#define ARCHDIS 0xff0 /* DMA Remap Engine Policy Control */
53#define DMAR_LCKDN (1 << 31)
54#define SPCAPCTRL (1 << 25)
55#define L3HIT2PEND_DIS (1 << 20)
56#define PRSCAPDIS (1 << 2)
57#define GLBIOTLBINV (1 << 1)
58#define GLBCTXTINV (1 << 0)
59
Aaron Durbin76c37002012-10-30 09:03:43 -050060/*
61 * EPBAR - Egress Port Root Complex Register Block
62 */
63
Angel Ponsf95b9b42021-01-20 01:10:48 +010064#define EPBAR64(x) (*((volatile u64 *)((uintptr_t)CONFIG_FIXED_EPBAR_MMIO_BASE + (x))))
Aaron Durbin76c37002012-10-30 09:03:43 -050065
Angel Pons75594e92020-09-14 14:04:50 +020066#include "registers/epbar.h"
Aaron Durbin76c37002012-10-30 09:03:43 -050067
Aaron Durbin76c37002012-10-30 09:03:43 -050068/*
69 * DMIBAR
70 */
71
Angel Ponsf95b9b42021-01-20 01:10:48 +010072#define DMIBAR64(x) (*((volatile u64 *)((uintptr_t)CONFIG_FIXED_DMIBAR_MMIO_BASE + (x))))
Aaron Durbin76c37002012-10-30 09:03:43 -050073
Angel Pons75594e92020-09-14 14:04:50 +020074#include "registers/dmibar.h"
Angel Pons598ec6a2020-07-23 02:37:12 +020075
Aaron Durbin76c37002012-10-30 09:03:43 -050076#ifndef __ASSEMBLER__
Aaron Durbin76c37002012-10-30 09:03:43 -050077
Aaron Durbin76c37002012-10-30 09:03:43 -050078void intel_northbridge_haswell_finalize_smm(void);
Kyösti Mälkkid7205be2019-09-27 07:24:17 +030079
Angel Pons73fa0352020-07-03 12:29:03 +020080void mb_late_romstage_setup(void); /* optional */
Angel Pons2e25ac62020-07-03 12:06:04 +020081
Angel Ponse8168292020-07-03 11:42:22 +020082void haswell_early_initialization(void);
Aaron Durbin76c37002012-10-30 09:03:43 -050083void haswell_late_initialization(void);
Tristan Corrick334be322018-12-17 22:10:21 +130084void haswell_unhide_peg(void);
Aaron Durbin76c37002012-10-30 09:03:43 -050085
Aaron Durbin76c37002012-10-30 09:03:43 -050086void report_platform_info(void);
Aaron Durbin76c37002012-10-30 09:03:43 -050087
Matt DeVillier85d98d92018-03-04 01:41:23 -060088#include <device/device.h>
89
90struct acpi_rsdp;
Furquan Shaikh0f007d82020-04-24 06:41:18 -070091unsigned long northbridge_write_acpi_tables(const struct device *device, unsigned long start,
Angel Pons1db5bc72020-01-15 00:49:03 +010092 struct acpi_rsdp *rsdp);
Matt DeVillier85d98d92018-03-04 01:41:23 -060093
Angel Pons1db5bc72020-01-15 00:49:03 +010094#endif /* __ASSEMBLER__ */
95#endif /* __ACPI__ */
Edward O'Callaghan089a5102015-01-06 02:48:57 +110096#endif /* __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__ */