Angel Pons | 4b42983 | 2020-04-02 23:48:50 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Damien Zammit | 43a1f78 | 2015-08-19 15:16:59 +1000 | [diff] [blame] | 2 | |
| 3 | #ifndef __NORTHBRIDGE_INTEL_X4X_H__ |
| 4 | #define __NORTHBRIDGE_INTEL_X4X_H__ |
| 5 | |
Arthur Heymans | dc972e1 | 2019-11-12 08:35:05 +0100 | [diff] [blame] | 6 | #include <stdint.h> |
Angel Pons | 2a8ceef | 2020-09-15 12:23:45 +0200 | [diff] [blame] | 7 | #include "memmap.h" |
Arthur Heymans | 6190d0b | 2019-11-01 18:34:45 +0100 | [diff] [blame] | 8 | |
Angel Pons | 41e66ac | 2020-09-15 13:17:23 +0200 | [diff] [blame] | 9 | #define BOOT_PATH_NORMAL 0 |
| 10 | #define BOOT_PATH_WARM_RESET 1 |
| 11 | #define BOOT_PATH_RESUME 2 |
| 12 | |
Damien Zammit | 43a1f78 | 2015-08-19 15:16:59 +1000 | [diff] [blame] | 13 | /* |
| 14 | * D0:F0 |
| 15 | */ |
Angel Pons | d1c590a | 2020-08-03 16:01:39 +0200 | [diff] [blame] | 16 | #define HOST_BRIDGE PCI_DEV(0, 0, 0) |
| 17 | |
Angel Pons | fd19075 | 2020-09-15 12:38:17 +0200 | [diff] [blame] | 18 | #include "registers/host_bridge.h" |
Damien Zammit | 43a1f78 | 2015-08-19 15:16:59 +1000 | [diff] [blame] | 19 | |
| 20 | /* |
| 21 | * D1:F0 PEG |
| 22 | */ |
Angel Pons | 6fd9adb | 2020-09-15 12:34:36 +0200 | [diff] [blame] | 23 | #define PEG_CAP 0xa2 |
| 24 | #define SLOTCAP 0xb4 |
| 25 | #define PEGLC 0xec |
| 26 | #define D1F0_VCCAP 0x104 |
| 27 | #define D1F0_VC0RCTL 0x114 |
Damien Zammit | 43a1f78 | 2015-08-19 15:16:59 +1000 | [diff] [blame] | 28 | |
| 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 Pons | e88f705 | 2021-01-20 11:26:35 +0100 | [diff] [blame] | 47 | #include <northbridge/intel/common/fixed_bars.h> |
| 48 | |
Arthur Heymans | 1994e448 | 2017-11-04 07:52:23 +0100 | [diff] [blame] | 49 | #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 Zammit | 43a1f78 | 2015-08-19 15:16:59 +1000 | [diff] [blame] | 68 | #define PMSTS_MCHBAR 0x0f14 /* Self refresh channel status */ |
Arthur Heymans | 97e13d8 | 2016-11-30 18:40:38 +0100 | [diff] [blame] | 69 | #define PMSTS_WARM_RESET (1 << 8) |
| 70 | #define PMSTS_BOTH_SELFREFRESH (3 << 0) |
Damien Zammit | 43a1f78 | 2015-08-19 15:16:59 +1000 | [diff] [blame] | 71 | |
| 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 Pons | 93aab51 | 2021-03-27 09:06:54 +0100 | [diff] [blame] | 77 | #define CLKCFG_UPDATE (1 << 10) |
Damien Zammit | 43a1f78 | 2015-08-19 15:16:59 +1000 | [diff] [blame] | 78 | |
Arthur Heymans | 5b30b82 | 2016-12-01 18:41:50 +0100 | [diff] [blame] | 79 | #define SSKPD_MCHBAR 0x0c20 /* 64 bit */ |
Damien Zammit | 43a1f78 | 2015-08-19 15:16:59 +1000 | [diff] [blame] | 80 | |
| 81 | /* |
| 82 | * DMIBAR |
| 83 | */ |
| 84 | |
Angel Pons | a5314b6 | 2020-09-15 13:08:26 +0200 | [diff] [blame] | 85 | #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 Zammit | 43a1f78 | 2015-08-19 15:16:59 +1000 | [diff] [blame] | 121 | |
| 122 | /* |
| 123 | * EPBAR |
| 124 | */ |
| 125 | |
Angel Pons | a5314b6 | 2020-09-15 13:08:26 +0200 | [diff] [blame] | 126 | #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 Zammit | 43a1f78 | 2015-08-19 15:16:59 +1000 | [diff] [blame] | 149 | void x4x_early_init(void); |
Kyösti Mälkki | 4ce0a07 | 2021-02-17 18:10:49 +0200 | [diff] [blame] | 150 | void x4x_late_init(void); |
Arthur Heymans | bf53acc | 2019-11-11 21:14:39 +0100 | [diff] [blame] | 151 | void mb_get_spd_map(u8 spd_map[4]); |
| 152 | void mb_pre_raminit_setup(int s3_resume); |
Damien Zammit | 43a1f78 | 2015-08-19 15:16:59 +1000 | [diff] [blame] | 153 | u32 decode_igd_memory_size(u32 gms); |
| 154 | u32 decode_igd_gtt_size(u32 gsm); |
Arthur Heymans | 4c65bfc | 2018-04-10 13:34:24 +0200 | [diff] [blame] | 155 | u32 decode_tseg_size(const u32 esmramc); |
Arthur Heymans | 0bf87de | 2017-11-04 06:15:05 +0100 | [diff] [blame] | 156 | |
Kyösti Mälkki | d7205be | 2019-09-27 07:24:17 +0300 | [diff] [blame] | 157 | #include <device/device.h> |
Damien Zammit | 43a1f78 | 2015-08-19 15:16:59 +1000 | [diff] [blame] | 158 | struct acpi_rsdp; |
Furquan Shaikh | 0f007d8 | 2020-04-24 06:41:18 -0700 | [diff] [blame] | 159 | unsigned long northbridge_write_acpi_tables(const struct device *device, |
Elyes HAOUAS | fea02e1 | 2018-02-08 14:59:03 +0100 | [diff] [blame] | 160 | unsigned long start, struct acpi_rsdp *rsdp); |
Kyösti Mälkki | d7205be | 2019-09-27 07:24:17 +0300 | [diff] [blame] | 161 | |
Damien Zammit | 43a1f78 | 2015-08-19 15:16:59 +1000 | [diff] [blame] | 162 | #endif /* __NORTHBRIDGE_INTEL_X4X_H__ */ |