blob: 44ea9b9858c1d71ef44a9e37dcd22683f44030be [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#include <southbridge/intel/lynxpoint/pch.h>
14
15/* Everything below this line is ignored in the DSDT */
16#ifndef __ACPI__
17
18/* Device 0:0.0 PCI configuration space (Host Bridge) */
Angel Pons1db5bc72020-01-15 00:49:03 +010019#define HOST_BRIDGE PCI_DEV(0, 0, 0)
Aaron Durbin76c37002012-10-30 09:03:43 -050020
Angel Ponse4156c32020-09-14 15:47:59 +020021#include "registers/host_bridge.h"
Matt DeVilliera51e3792018-03-04 01:44:15 -060022
Aaron Durbin76c37002012-10-30 09:03:43 -050023
24/* Device 0:2.0 PCI configuration space (Graphics Device) */
25
26#define MSAC 0x62 /* Multi Size Aperture Control */
Aaron Durbin76c37002012-10-30 09:03:43 -050027
28/*
29 * MCHBAR
30 */
31
Angel Pons1db5bc72020-01-15 00:49:03 +010032#define MCHBAR8(x) (*((volatile u8 *)(DEFAULT_MCHBAR + (x))))
33#define MCHBAR16(x) (*((volatile u16 *)(DEFAULT_MCHBAR + (x))))
34#define MCHBAR32(x) (*((volatile u32 *)(DEFAULT_MCHBAR + (x))))
35#define MCHBAR8_AND(x, and) (MCHBAR8(x) = MCHBAR8(x) & (and))
36#define MCHBAR16_AND(x, and) (MCHBAR16(x) = MCHBAR16(x) & (and))
37#define MCHBAR32_AND(x, and) (MCHBAR32(x) = MCHBAR32(x) & (and))
38#define MCHBAR8_OR(x, or) (MCHBAR8(x) = MCHBAR8(x) | (or))
39#define MCHBAR16_OR(x, or) (MCHBAR16(x) = MCHBAR16(x) | (or))
40#define MCHBAR32_OR(x, or) (MCHBAR32(x) = MCHBAR32(x) | (or))
41#define MCHBAR8_AND_OR(x, and, or) (MCHBAR8(x) = (MCHBAR8(x) & (and)) | (or))
42#define MCHBAR16_AND_OR(x, and, or) (MCHBAR16(x) = (MCHBAR16(x) & (and)) | (or))
43#define MCHBAR32_AND_OR(x, and, or) (MCHBAR32(x) = (MCHBAR32(x) & (and)) | (or))
Aaron Durbin76c37002012-10-30 09:03:43 -050044
Angel Pons1db5bc72020-01-15 00:49:03 +010045/* As there are many registers, define them on a separate file */
Angel Ponse4156c32020-09-14 15:47:59 +020046#include "registers/mchbar.h"
Duncan Lauriec70353f2013-06-28 14:40:38 -070047
Angel Ponse220e312020-07-22 00:55:38 +020048#define ARCHDIS 0xff0 /* DMA Remap Engine Policy Control */
49#define DMAR_LCKDN (1 << 31)
50#define SPCAPCTRL (1 << 25)
51#define L3HIT2PEND_DIS (1 << 20)
52#define PRSCAPDIS (1 << 2)
53#define GLBIOTLBINV (1 << 1)
54#define GLBCTXTINV (1 << 0)
55
Aaron Durbin76c37002012-10-30 09:03:43 -050056/*
57 * EPBAR - Egress Port Root Complex Register Block
58 */
59
Angel Ponse5ec50c2020-09-14 13:22:01 +020060#define EPBAR8(x) *((volatile u8 *)(DEFAULT_EPBAR + (x)))
61#define EPBAR16(x) *((volatile u16 *)(DEFAULT_EPBAR + (x)))
62#define EPBAR32(x) *((volatile u32 *)(DEFAULT_EPBAR + (x)))
Aaron Durbin76c37002012-10-30 09:03:43 -050063
Angel Pons75594e92020-09-14 14:04:50 +020064#include "registers/epbar.h"
Aaron Durbin76c37002012-10-30 09:03:43 -050065
Aaron Durbin76c37002012-10-30 09:03:43 -050066/*
67 * DMIBAR
68 */
69
Angel Ponse5ec50c2020-09-14 13:22:01 +020070#define DMIBAR8(x) *((volatile u8 *)(DEFAULT_DMIBAR + (x)))
71#define DMIBAR16(x) *((volatile u16 *)(DEFAULT_DMIBAR + (x)))
72#define DMIBAR32(x) *((volatile u32 *)(DEFAULT_DMIBAR + (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);
Ronald G. Minnich4c8465c2013-09-30 15:57:21 -070084void set_translation_table(int start, int end, u64 base, int inc);
Tristan Corrick334be322018-12-17 22:10:21 +130085void haswell_unhide_peg(void);
Aaron Durbin76c37002012-10-30 09:03:43 -050086
Aaron Durbin76c37002012-10-30 09:03:43 -050087void report_platform_info(void);
Aaron Durbin76c37002012-10-30 09:03:43 -050088
Angel Ponsf4fa1e12020-08-03 14:12:13 +020089int decode_pcie_bar(u32 *const base, u32 *const len);
90
Matt DeVillier85d98d92018-03-04 01:41:23 -060091#include <device/device.h>
92
93struct acpi_rsdp;
Furquan Shaikh0f007d82020-04-24 06:41:18 -070094unsigned long northbridge_write_acpi_tables(const struct device *device, unsigned long start,
Angel Pons1db5bc72020-01-15 00:49:03 +010095 struct acpi_rsdp *rsdp);
Matt DeVillier85d98d92018-03-04 01:41:23 -060096
Angel Pons1db5bc72020-01-15 00:49:03 +010097#endif /* __ASSEMBLER__ */
98#endif /* __ACPI__ */
Edward O'Callaghan089a5102015-01-06 02:48:57 +110099#endif /* __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__ */