Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2007-2008 coresystems GmbH |
| 5 | * Copyright (C) 2011 Google Inc. |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; version 2 of the License. |
| 10 | * |
| 11 | * This program is distributed in the hope that it will be useful, |
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | * GNU General Public License for more details. |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #ifndef __NORTHBRIDGE_INTEL_SANDYBRIDGE_SANDYBRIDGE_H__ |
Edward O'Callaghan | 089a510 | 2015-01-06 02:48:57 +1100 | [diff] [blame] | 18 | #define __NORTHBRIDGE_INTEL_SANDYBRIDGE_SANDYBRIDGE_H__ |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 19 | |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 20 | /* Device ID for SandyBridge and IvyBridge */ |
| 21 | #define BASE_REV_SNB 0x00 |
| 22 | #define BASE_REV_IVB 0x50 |
| 23 | #define BASE_REV_MASK 0x50 |
| 24 | |
| 25 | /* SandyBridge CPU stepping */ |
| 26 | #define SNB_STEP_D0 (BASE_REV_SNB + 5) /* Also J0 */ |
| 27 | #define SNB_STEP_D1 (BASE_REV_SNB + 6) |
| 28 | #define SNB_STEP_D2 (BASE_REV_SNB + 7) /* Also J1/Q0 */ |
| 29 | |
| 30 | /* IvyBridge CPU stepping */ |
| 31 | #define IVB_STEP_A0 (BASE_REV_IVB + 0) |
| 32 | #define IVB_STEP_B0 (BASE_REV_IVB + 2) |
| 33 | #define IVB_STEP_C0 (BASE_REV_IVB + 4) |
| 34 | #define IVB_STEP_K0 (BASE_REV_IVB + 5) |
| 35 | #define IVB_STEP_D0 (BASE_REV_IVB + 6) |
| 36 | |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 37 | /* Northbridge BARs */ |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 38 | #ifndef __ACPI__ |
| 39 | #define DEFAULT_MCHBAR ((u8 *)0xfed10000) /* 16 KB */ |
| 40 | #define DEFAULT_DMIBAR ((u8 *)0xfed18000) /* 4 KB */ |
| 41 | #else |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 42 | #define DEFAULT_MCHBAR 0xfed10000 /* 16 KB */ |
| 43 | #define DEFAULT_DMIBAR 0xfed18000 /* 4 KB */ |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 44 | #endif |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 45 | #define DEFAULT_EPBAR 0xfed19000 /* 4 KB */ |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 46 | #define DEFAULT_RCBABASE ((u8 *)0xfed1c000) |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 47 | |
Nico Huber | bb9469c | 2015-10-21 11:49:23 +0200 | [diff] [blame] | 48 | #define IOMMU_BASE1 0xfed90000ULL |
| 49 | #define IOMMU_BASE2 0xfed91000ULL |
| 50 | |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 51 | /* Everything below this line is ignored in the DSDT */ |
| 52 | #ifndef __ACPI__ |
Patrick Rudolph | 74203de | 2017-11-20 11:57:01 +0100 | [diff] [blame] | 53 | #include <cpu/intel/model_206ax/model_206ax.h> |
| 54 | |
| 55 | /* Chipset types */ |
| 56 | enum platform_type { |
| 57 | PLATFORM_MOBILE = 0, |
| 58 | PLATFORM_DESKTOP_SERVER, |
| 59 | }; |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 60 | |
Nico Huber | 9d9ce0d | 2015-10-26 12:59:49 +0100 | [diff] [blame] | 61 | |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 62 | /* Device 0:0.0 PCI configuration space (Host Bridge) */ |
| 63 | |
| 64 | #define EPBAR 0x40 |
| 65 | #define MCHBAR 0x48 |
| 66 | #define PCIEXBAR 0x60 |
| 67 | #define DMIBAR 0x68 |
| 68 | #define X60BAR 0x60 |
| 69 | |
| 70 | #define GGC 0x50 /* GMCH Graphics Control */ |
| 71 | |
| 72 | #define DEVEN 0x54 /* Device Enable */ |
Patrick Rudolph | ecd4be8 | 2017-05-14 12:40:50 +0200 | [diff] [blame] | 73 | #define DEVEN_D7EN (1 << 14) |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 74 | #define DEVEN_PEG60 (1 << 13) |
Patrick Rudolph | ecd4be8 | 2017-05-14 12:40:50 +0200 | [diff] [blame] | 75 | #define DEVEN_D4EN (1 << 7) |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 76 | #define DEVEN_IGD (1 << 4) |
| 77 | #define DEVEN_PEG10 (1 << 3) |
| 78 | #define DEVEN_PEG11 (1 << 2) |
| 79 | #define DEVEN_PEG12 (1 << 1) |
| 80 | #define DEVEN_HOST (1 << 0) |
| 81 | |
| 82 | #define PAM0 0x80 |
| 83 | #define PAM1 0x81 |
| 84 | #define PAM2 0x82 |
| 85 | #define PAM3 0x83 |
| 86 | #define PAM4 0x84 |
| 87 | #define PAM5 0x85 |
| 88 | #define PAM6 0x86 |
| 89 | |
| 90 | #define LAC 0x87 /* Legacy Access Control */ |
| 91 | #define SMRAM 0x88 /* System Management RAM Control */ |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 92 | |
| 93 | #define TOM 0xa0 |
| 94 | #define TOUUD 0xa8 /* Top of Upper Usable DRAM */ |
Vladimir Serbinenko | a3e41c0 | 2015-05-28 16:04:17 +0200 | [diff] [blame] | 95 | #define BGSM 0xb4 /* Base GTT Stolen Memory */ |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 96 | #define TSEG 0xb8 /* TSEG base */ |
| 97 | #define TOLUD 0xbc /* Top of Low Used Memory */ |
| 98 | |
Patrick Rudolph | 9f3f915 | 2016-01-26 20:02:14 +0100 | [diff] [blame] | 99 | #define CAPID0_A 0xe4 /* Capabilities Register A */ |
| 100 | #define CAPID0_B 0xe8 /* Capabilities Register B */ |
| 101 | |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 102 | #define SKPAD 0xdc /* Scratchpad Data */ |
| 103 | |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 104 | |
| 105 | /* Device 0:2.0 PCI configuration space (Graphics Device) */ |
| 106 | |
| 107 | #define MSAC 0x62 /* Multi Size Aperture Control */ |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 108 | |
| 109 | /* |
| 110 | * MCHBAR |
| 111 | */ |
| 112 | |
Felix Held | b9267f0 | 2018-07-28 14:49:31 +0200 | [diff] [blame] | 113 | #define MCHBAR8(x) (*((volatile u8 *)(DEFAULT_MCHBAR + (x)))) |
| 114 | #define MCHBAR16(x) (*((volatile u16 *)(DEFAULT_MCHBAR + (x)))) |
| 115 | #define MCHBAR32(x) (*((volatile u32 *)(DEFAULT_MCHBAR + (x)))) |
Felix Held | fe68a77 | 2018-07-29 21:30:54 +0200 | [diff] [blame] | 116 | #define MCHBAR32_OR(x, or) (MCHBAR32(x) = (MCHBAR32(x) | (or))) |
| 117 | #define MCHBAR32_AND(x, and) (MCHBAR32(x) = (MCHBAR32(x) & (and))) |
| 118 | #define MCHBAR32_AND_OR(x, and, or) \ |
| 119 | (MCHBAR32(x) = (MCHBAR32(x) & (and)) | (or)) |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 120 | |
| 121 | #define SSKPD 0x5d14 /* 16bit (scratchpad) */ |
| 122 | #define BIOS_RESET_CPL 0x5da8 /* 8bit */ |
| 123 | |
| 124 | /* |
| 125 | * EPBAR - Egress Port Root Complex Register Block |
| 126 | */ |
| 127 | |
Felix Held | b9267f0 | 2018-07-28 14:49:31 +0200 | [diff] [blame] | 128 | #define EPBAR8(x) (*((volatile u8 *)(DEFAULT_EPBAR + (x)))) |
| 129 | #define EPBAR16(x) (*((volatile u16 *)(DEFAULT_EPBAR + (x)))) |
| 130 | #define EPBAR32(x) (*((volatile u32 *)(DEFAULT_EPBAR + (x)))) |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 131 | |
| 132 | #define EPPVCCAP1 0x004 /* 32bit */ |
| 133 | #define EPPVCCAP2 0x008 /* 32bit */ |
| 134 | |
| 135 | #define EPVC0RCAP 0x010 /* 32bit */ |
| 136 | #define EPVC0RCTL 0x014 /* 32bit */ |
| 137 | #define EPVC0RSTS 0x01a /* 16bit */ |
| 138 | |
| 139 | #define EPVC1RCAP 0x01c /* 32bit */ |
| 140 | #define EPVC1RCTL 0x020 /* 32bit */ |
| 141 | #define EPVC1RSTS 0x026 /* 16bit */ |
| 142 | |
| 143 | #define EPVC1MTS 0x028 /* 32bit */ |
| 144 | #define EPVC1IST 0x038 /* 64bit */ |
| 145 | |
| 146 | #define EPESD 0x044 /* 32bit */ |
| 147 | |
| 148 | #define EPLE1D 0x050 /* 32bit */ |
| 149 | #define EPLE1A 0x058 /* 64bit */ |
| 150 | #define EPLE2D 0x060 /* 32bit */ |
| 151 | #define EPLE2A 0x068 /* 64bit */ |
| 152 | |
| 153 | #define PORTARB 0x100 /* 256bit */ |
| 154 | |
| 155 | /* |
| 156 | * DMIBAR |
| 157 | */ |
| 158 | |
Felix Held | b9267f0 | 2018-07-28 14:49:31 +0200 | [diff] [blame] | 159 | #define DMIBAR8(x) (*((volatile u8 *)(DEFAULT_DMIBAR + (x)))) |
| 160 | #define DMIBAR16(x) (*((volatile u16 *)(DEFAULT_DMIBAR + (x)))) |
| 161 | #define DMIBAR32(x) (*((volatile u32 *)(DEFAULT_DMIBAR + (x)))) |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 162 | |
| 163 | #define DMIVCECH 0x000 /* 32bit */ |
| 164 | #define DMIPVCCAP1 0x004 /* 32bit */ |
| 165 | #define DMIPVCCAP2 0x008 /* 32bit */ |
| 166 | |
| 167 | #define DMIPVCCCTL 0x00c /* 16bit */ |
| 168 | |
| 169 | #define DMIVC0RCAP 0x010 /* 32bit */ |
Patrick Rudolph | bf74350 | 2019-03-25 17:05:20 +0100 | [diff] [blame] | 170 | #define DMIVC0RCTL 0x014 /* 32bit */ |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 171 | #define DMIVC0RSTS 0x01a /* 16bit */ |
Patrick Rudolph | bf74350 | 2019-03-25 17:05:20 +0100 | [diff] [blame] | 172 | #define VC0NP 0x2 |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 173 | |
| 174 | #define DMIVC1RCAP 0x01c /* 32bit */ |
| 175 | #define DMIVC1RCTL 0x020 /* 32bit */ |
| 176 | #define DMIVC1RSTS 0x026 /* 16bit */ |
Patrick Rudolph | bf74350 | 2019-03-25 17:05:20 +0100 | [diff] [blame] | 177 | #define VC1NP 0x2 |
| 178 | |
| 179 | #define DMIVCPRCTL 0x02c /* 32bit */ |
| 180 | |
| 181 | #define DMIVCPRSTS 0x032 /* 16bit */ |
| 182 | #define VCPNP 0x2 |
| 183 | |
| 184 | #define DMIVCMRCTL 0x0038 /* 32 bit */ |
| 185 | #define DMIVCMRSTS 0x003e /* 16 bit */ |
| 186 | #define VCMNP 0x2 |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 187 | |
| 188 | #define DMILE1D 0x050 /* 32bit */ |
| 189 | #define DMILE1A 0x058 /* 64bit */ |
| 190 | #define DMILE2D 0x060 /* 32bit */ |
| 191 | #define DMILE2A 0x068 /* 64bit */ |
| 192 | |
| 193 | #define DMILCAP 0x084 /* 32bit */ |
| 194 | #define DMILCTL 0x088 /* 16bit */ |
| 195 | #define DMILSTS 0x08a /* 16bit */ |
Patrick Rudolph | bf74350 | 2019-03-25 17:05:20 +0100 | [diff] [blame] | 196 | #define TXTRN (1 << 11) |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 197 | #define DMICTL1 0x0f0 /* 32bit */ |
| 198 | #define DMICTL2 0x0fc /* 32bit */ |
| 199 | |
| 200 | #define DMICC 0x208 /* 32bit */ |
| 201 | |
| 202 | #define DMIDRCCFG 0xeb4 /* 32bit */ |
| 203 | |
| 204 | #ifndef __ASSEMBLER__ |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 205 | |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 206 | void intel_sandybridge_finalize_smm(void); |
Kyösti Mälkki | 82c0e7e | 2019-11-05 19:06:56 +0200 | [diff] [blame^] | 207 | |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 208 | int bridge_silicon_revision(void); |
Patrick Rudolph | 2cdb65d | 2019-03-24 18:08:43 +0100 | [diff] [blame] | 209 | void systemagent_early_init(void); |
Nico Huber | bb9469c | 2015-10-21 11:49:23 +0200 | [diff] [blame] | 210 | void sandybridge_init_iommu(void); |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 211 | void sandybridge_late_initialization(void); |
Vladimir Serbinenko | c845b43 | 2014-09-05 03:37:44 +0200 | [diff] [blame] | 212 | void northbridge_romstage_finalize(int s3resume); |
Patrick Rudolph | 6aca7e6 | 2019-03-26 18:22:36 +0100 | [diff] [blame] | 213 | void early_init_dmi(void); |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 214 | |
Vladimir Serbinenko | ffbb3c0 | 2016-02-10 01:36:25 +0100 | [diff] [blame] | 215 | void pch_enable_lpc(void); |
| 216 | void mainboard_early_init(int s3resume); |
| 217 | void mainboard_config_superio(void); |
| 218 | int mainboard_should_reset_usb(int s3resume); |
| 219 | void perform_raminit(int s3resume); |
Patrick Rudolph | 74203de | 2017-11-20 11:57:01 +0100 | [diff] [blame] | 220 | enum platform_type get_platform_type(void); |
Vladimir Serbinenko | ffbb3c0 | 2016-02-10 01:36:25 +0100 | [diff] [blame] | 221 | |
Nico Huber | 9d9ce0d | 2015-10-26 12:59:49 +0100 | [diff] [blame] | 222 | #include <device/device.h> |
| 223 | |
| 224 | struct acpi_rsdp; |
Elyes HAOUAS | ab8743c | 2018-02-09 08:21:40 +0100 | [diff] [blame] | 225 | unsigned long northbridge_write_acpi_tables(struct device *device, unsigned long start, struct acpi_rsdp *rsdp); |
Nico Huber | 9d9ce0d | 2015-10-26 12:59:49 +0100 | [diff] [blame] | 226 | |
Stefan Reinauer | 00636b0 | 2012-04-04 00:08:51 +0200 | [diff] [blame] | 227 | #endif |
| 228 | #endif |
Edward O'Callaghan | 089a510 | 2015-01-06 02:48:57 +1100 | [diff] [blame] | 229 | #endif /* __NORTHBRIDGE_INTEL_SANDYBRIDGE_SANDYBRIDGE_H__ */ |