blob: edca2b63303e5d6460b0bd543b6c79269f4b0d00 [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
Angel Pons76b8bc22020-07-23 02:32:27 +020023/* Device 0:1.0 PCI configuration space (PCIe Graphics) */
24
25#define PEG_DCAP2 0xc4 /* 32bit */
26
27#define PEG_ESD 0x144 /* 32bit */
28#define PEG_LE1D 0x150 /* 32bit */
29#define PEG_LE1A 0x158 /* 64bit */
30
Aaron Durbin76c37002012-10-30 09:03:43 -050031/* Device 0:2.0 PCI configuration space (Graphics Device) */
32
33#define MSAC 0x62 /* Multi Size Aperture Control */
Aaron Durbin76c37002012-10-30 09:03:43 -050034
35/*
36 * MCHBAR
37 */
38
Angel Pons1db5bc72020-01-15 00:49:03 +010039#define MCHBAR8(x) (*((volatile u8 *)(DEFAULT_MCHBAR + (x))))
40#define MCHBAR16(x) (*((volatile u16 *)(DEFAULT_MCHBAR + (x))))
41#define MCHBAR32(x) (*((volatile u32 *)(DEFAULT_MCHBAR + (x))))
42#define MCHBAR8_AND(x, and) (MCHBAR8(x) = MCHBAR8(x) & (and))
43#define MCHBAR16_AND(x, and) (MCHBAR16(x) = MCHBAR16(x) & (and))
44#define MCHBAR32_AND(x, and) (MCHBAR32(x) = MCHBAR32(x) & (and))
45#define MCHBAR8_OR(x, or) (MCHBAR8(x) = MCHBAR8(x) | (or))
46#define MCHBAR16_OR(x, or) (MCHBAR16(x) = MCHBAR16(x) | (or))
47#define MCHBAR32_OR(x, or) (MCHBAR32(x) = MCHBAR32(x) | (or))
48#define MCHBAR8_AND_OR(x, and, or) (MCHBAR8(x) = (MCHBAR8(x) & (and)) | (or))
49#define MCHBAR16_AND_OR(x, and, or) (MCHBAR16(x) = (MCHBAR16(x) & (and)) | (or))
50#define MCHBAR32_AND_OR(x, and, or) (MCHBAR32(x) = (MCHBAR32(x) & (and)) | (or))
Aaron Durbin76c37002012-10-30 09:03:43 -050051
Angel Pons1db5bc72020-01-15 00:49:03 +010052/* As there are many registers, define them on a separate file */
Angel Ponse4156c32020-09-14 15:47:59 +020053#include "registers/mchbar.h"
Duncan Lauriec70353f2013-06-28 14:40:38 -070054
Angel Ponse220e312020-07-22 00:55:38 +020055#define ARCHDIS 0xff0 /* DMA Remap Engine Policy Control */
56#define DMAR_LCKDN (1 << 31)
57#define SPCAPCTRL (1 << 25)
58#define L3HIT2PEND_DIS (1 << 20)
59#define PRSCAPDIS (1 << 2)
60#define GLBIOTLBINV (1 << 1)
61#define GLBCTXTINV (1 << 0)
62
Aaron Durbin76c37002012-10-30 09:03:43 -050063/*
64 * EPBAR - Egress Port Root Complex Register Block
65 */
66
Angel Ponse5ec50c2020-09-14 13:22:01 +020067#define EPBAR8(x) *((volatile u8 *)(DEFAULT_EPBAR + (x)))
68#define EPBAR16(x) *((volatile u16 *)(DEFAULT_EPBAR + (x)))
69#define EPBAR32(x) *((volatile u32 *)(DEFAULT_EPBAR + (x)))
Angel Pons76b8bc22020-07-23 02:32:27 +020070#define EPBAR64(x) *((volatile u64 *)(DEFAULT_EPBAR + (x)))
Aaron Durbin76c37002012-10-30 09:03:43 -050071
Angel Pons75594e92020-09-14 14:04:50 +020072#include "registers/epbar.h"
Aaron Durbin76c37002012-10-30 09:03:43 -050073
Aaron Durbin76c37002012-10-30 09:03:43 -050074/*
75 * DMIBAR
76 */
77
Angel Ponse5ec50c2020-09-14 13:22:01 +020078#define DMIBAR8(x) *((volatile u8 *)(DEFAULT_DMIBAR + (x)))
79#define DMIBAR16(x) *((volatile u16 *)(DEFAULT_DMIBAR + (x)))
80#define DMIBAR32(x) *((volatile u32 *)(DEFAULT_DMIBAR + (x)))
Angel Pons76b8bc22020-07-23 02:32:27 +020081#define DMIBAR64(x) *((volatile u64 *)(DEFAULT_DMIBAR + (x)))
Aaron Durbin76c37002012-10-30 09:03:43 -050082
Angel Pons75594e92020-09-14 14:04:50 +020083#include "registers/dmibar.h"
Angel Pons598ec6a2020-07-23 02:37:12 +020084
Aaron Durbin76c37002012-10-30 09:03:43 -050085#ifndef __ASSEMBLER__
Aaron Durbin76c37002012-10-30 09:03:43 -050086
Aaron Durbin76c37002012-10-30 09:03:43 -050087void intel_northbridge_haswell_finalize_smm(void);
Kyösti Mälkkid7205be2019-09-27 07:24:17 +030088
Angel Pons73fa0352020-07-03 12:29:03 +020089void mb_late_romstage_setup(void); /* optional */
Angel Pons2e25ac62020-07-03 12:06:04 +020090
Angel Ponse8168292020-07-03 11:42:22 +020091void haswell_early_initialization(void);
Aaron Durbin76c37002012-10-30 09:03:43 -050092void haswell_late_initialization(void);
Tristan Corrick334be322018-12-17 22:10:21 +130093void haswell_unhide_peg(void);
Aaron Durbin76c37002012-10-30 09:03:43 -050094
Aaron Durbin76c37002012-10-30 09:03:43 -050095void report_platform_info(void);
Aaron Durbin76c37002012-10-30 09:03:43 -050096
Angel Ponsf4fa1e12020-08-03 14:12:13 +020097int decode_pcie_bar(u32 *const base, u32 *const len);
98
Matt DeVillier85d98d92018-03-04 01:41:23 -060099#include <device/device.h>
100
101struct acpi_rsdp;
Furquan Shaikh0f007d82020-04-24 06:41:18 -0700102unsigned long northbridge_write_acpi_tables(const struct device *device, unsigned long start,
Angel Pons1db5bc72020-01-15 00:49:03 +0100103 struct acpi_rsdp *rsdp);
Matt DeVillier85d98d92018-03-04 01:41:23 -0600104
Angel Pons1db5bc72020-01-15 00:49:03 +0100105#endif /* __ASSEMBLER__ */
106#endif /* __ACPI__ */
Edward O'Callaghan089a5102015-01-06 02:48:57 +1100107#endif /* __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__ */