blob: 991d175af957e2dff370d9df75915570fafb4ec0 [file] [log] [blame]
Angel Pons4b429832020-04-02 23:48:50 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Damien Zammit43a1f782015-08-19 15:16:59 +10002
3#ifndef __NORTHBRIDGE_INTEL_X4X_H__
4#define __NORTHBRIDGE_INTEL_X4X_H__
5
Arthur Heymansdc972e12019-11-12 08:35:05 +01006#include <stdint.h>
Angel Pons2a8ceef2020-09-15 12:23:45 +02007#include "memmap.h"
Arthur Heymans6190d0b2019-11-01 18:34:45 +01008
Angel Pons41e66ac2020-09-15 13:17:23 +02009#define BOOT_PATH_NORMAL 0
10#define BOOT_PATH_WARM_RESET 1
11#define BOOT_PATH_RESUME 2
12
Damien Zammit43a1f782015-08-19 15:16:59 +100013/*
14 * D0:F0
15 */
Angel Ponsd1c590a2020-08-03 16:01:39 +020016#define HOST_BRIDGE PCI_DEV(0, 0, 0)
17
Angel Ponsfd190752020-09-15 12:38:17 +020018#include "registers/host_bridge.h"
Damien Zammit43a1f782015-08-19 15:16:59 +100019
20/*
21 * D1:F0 PEG
22 */
Angel Pons6fd9adb2020-09-15 12:34:36 +020023#define PEG_CAP 0xa2
24#define SLOTCAP 0xb4
25#define PEGLC 0xec
26#define D1F0_VCCAP 0x104
27#define D1F0_VC0RCTL 0x114
Damien Zammit43a1f782015-08-19 15:16:59 +100028
29/*
30 * Graphics frequencies
31 */
32#define GCFGC_PCIDEV PCI_DEV(0, 2, 0)
33#define GCFGC_OFFSET 0xf0
34#define GCFGC_CR_SHIFT 0
35#define GCFGC_CR_MASK (0xf << GCFGC_CR_SHIFT)
36#define GCFGC_CS_SHIFT 8
37#define GCFGC_CS_MASK (0xf << GCFGC_CS_SHIFT)
38#define GCFGC_CD_SHIFT 12
39#define GCFGC_CD_MASK (0x1 << GCFGC_CD_SHIFT)
40#define GCFGC_UPDATE_SHIFT 5
41#define GCFGC_UPDATE (0x1 << GCFGC_UPDATE_SHIFT)
42
43/*
44 * MCHBAR
45 */
46
Angel Ponse88f7052021-01-20 11:26:35 +010047#include <northbridge/intel/common/fixed_bars.h>
48
Arthur Heymans1994e4482017-11-04 07:52:23 +010049#define CHDECMISC 0x111
50#define STACKED_MEM (1 << 1)
51
52#define C0DRB0 0x200
53#define C0DRB1 0x202
54#define C0DRB2 0x204
55#define C0DRB3 0x206
56#define C0DRA01 0x208
57#define C0DRA23 0x20a
58#define C0CKECTRL 0x260
59
60#define C1DRB0 0x600
61#define C1DRB1 0x602
62#define C1DRB2 0x604
63#define C1DRB3 0x606
64#define C1DRA01 0x608
65#define C1DRA23 0x60a
66#define C1CKECTRL 0x660
67
Damien Zammit43a1f782015-08-19 15:16:59 +100068#define PMSTS_MCHBAR 0x0f14 /* Self refresh channel status */
Arthur Heymans97e13d82016-11-30 18:40:38 +010069#define PMSTS_WARM_RESET (1 << 8)
70#define PMSTS_BOTH_SELFREFRESH (3 << 0)
Damien Zammit43a1f782015-08-19 15:16:59 +100071
72#define CLKCFG_MCHBAR 0x0c00
73#define CLKCFG_FSBCLK_SHIFT 0
74#define CLKCFG_FSBCLK_MASK (7 << CLKCFG_FSBCLK_SHIFT)
75#define CLKCFG_MEMCLK_SHIFT 4
76#define CLKCFG_MEMCLK_MASK (7 << CLKCFG_MEMCLK_SHIFT)
Angel Pons93aab512021-03-27 09:06:54 +010077#define CLKCFG_UPDATE (1 << 10)
Damien Zammit43a1f782015-08-19 15:16:59 +100078
Arthur Heymans5b30b822016-12-01 18:41:50 +010079#define SSKPD_MCHBAR 0x0c20 /* 64 bit */
Damien Zammit43a1f782015-08-19 15:16:59 +100080
81/*
82 * DMIBAR
83 */
84
Angel Ponsa5314b62020-09-15 13:08:26 +020085#define DMIVCECH 0x000 /* 32bit */
86#define DMIPVCCAP1 0x004 /* 32bit */
87
88#define DMIVC0RCAP 0x010 /* 32bit */
89#define DMIVC0RCTL 0x014 /* 32bit */
90#define DMIVC0RSTS 0x01a /* 16bit */
91#define VC0NP (1 << 1)
92
93#define DMIVC1RCAP 0x01c /* 32bit */
94#define DMIVC1RCTL 0x020 /* 32bit */
95#define DMIVC1RSTS 0x026 /* 16bit */
96#define VC1NP (1 << 1)
97
98#define DMIVCPRCAP 0x028 /* 32bit */
99#define DMIVCPRCTL 0x02c /* 32bit */
100#define DMIVCPRSTS 0x032 /* 16bit */
101#define VCPNP (1 << 1)
102
103#define DMIVCMRCAP 0x034 /* 32bit */
104#define DMIVCMRCTL 0x038 /* 32bit */
105#define DMIVCMRSTS 0x03e /* 16bit */
106#define VCMNP (1 << 1)
107
108#define DMIESD 0x044 /* 32bit */
109
110#define DMILE1D 0x050 /* 32bit */
111#define DMILE1A 0x058 /* 64bit */
112#define DMILE2D 0x060 /* 32bit */
113#define DMILE2A 0x068 /* 64bit */
114
115#define DMILCAP 0x084 /* 32bit */
116#define DMILCTL 0x088 /* 16bit */
117#define DMILSTS 0x08a /* 16bit */
118
119#define DMIUESTS 0x1c4 /* 32bit */
120#define DMICESTS 0x1d0 /* 32bit */
Damien Zammit43a1f782015-08-19 15:16:59 +1000121
122/*
123 * EPBAR
124 */
125
Angel Ponsa5314b62020-09-15 13:08:26 +0200126#define EPPVCCAP1 0x004 /* 32bit */
127#define EPPVCCTL 0x00c /* 32bit */
128
129#define EPVC0RCAP 0x010 /* 32bit */
130#define EPVC0RCTL 0x014 /* 32bit */
131#define EPVC0RSTS 0x01a /* 16bit */
132
133#define EPVC1RCAP 0x01c /* 32bit */
134#define EPVC1RCTL 0x020 /* 32bit */
135#define EPVC1RSTS 0x026 /* 16bit */
136
137#define EPVC1MTS 0x028 /* 32bit */
138#define EPVC1ITC 0x02c /* 32bit */
139
140#define EPESD 0x044 /* 32bit */
141
142#define EPLE1D 0x050 /* 32bit */
143#define EPLE1A 0x058 /* 64bit */
144#define EPLE2D 0x060 /* 32bit */
145#define EPLE2A 0x068 /* 64bit */
146
147#define EP_PORTARB(x) (0x100 + 4 * (x)) /* 256bit */
148
Damien Zammit43a1f782015-08-19 15:16:59 +1000149void x4x_early_init(void);
Kyösti Mälkki4ce0a072021-02-17 18:10:49 +0200150void x4x_late_init(void);
Arthur Heymansbf53acc2019-11-11 21:14:39 +0100151void mb_get_spd_map(u8 spd_map[4]);
152void mb_pre_raminit_setup(int s3_resume);
Damien Zammit43a1f782015-08-19 15:16:59 +1000153u32 decode_igd_memory_size(u32 gms);
154u32 decode_igd_gtt_size(u32 gsm);
Arthur Heymans4c65bfc2018-04-10 13:34:24 +0200155u32 decode_tseg_size(const u32 esmramc);
Arthur Heymans0bf87de2017-11-04 06:15:05 +0100156
Kyösti Mälkkid7205be2019-09-27 07:24:17 +0300157#include <device/device.h>
Damien Zammit43a1f782015-08-19 15:16:59 +1000158struct acpi_rsdp;
Furquan Shaikh0f007d82020-04-24 06:41:18 -0700159unsigned long northbridge_write_acpi_tables(const struct device *device,
Elyes HAOUASfea02e12018-02-08 14:59:03 +0100160 unsigned long start, struct acpi_rsdp *rsdp);
Kyösti Mälkkid7205be2019-09-27 07:24:17 +0300161
Damien Zammit43a1f782015-08-19 15:16:59 +1000162#endif /* __NORTHBRIDGE_INTEL_X4X_H__ */