Angel Pons | 4b42983 | 2020-04-02 23:48:50 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 2 | |
| 3 | #ifndef __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__ |
Edward O'Callaghan | 089a510 | 2015-01-06 02:48:57 +1100 | [diff] [blame] | 4 | #define __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 5 | |
| 6 | /* Chipset types */ |
| 7 | #define HASWELL_MOBILE 0 |
| 8 | #define HASWELL_DESKTOP 1 |
| 9 | #define HASWELL_SERVER 2 |
| 10 | |
Aaron Durbin | 8ce667e | 2013-02-15 21:45:06 -0600 | [diff] [blame] | 11 | /* Intel Enhanced Debug region */ |
| 12 | #define IED_SIZE CONFIG_IED_REGION_SIZE |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 13 | |
| 14 | /* Northbridge BARs */ |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 15 | #define DEFAULT_MCHBAR 0xfed10000 /* 16 KB */ |
| 16 | #define DEFAULT_DMIBAR 0xfed18000 /* 4 KB */ |
| 17 | #define DEFAULT_EPBAR 0xfed19000 /* 4 KB */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 18 | |
Matt DeVillier | a51e379 | 2018-03-04 01:44:15 -0600 | [diff] [blame] | 19 | #define GFXVT_BASE_ADDRESS 0xfed90000ULL |
| 20 | #define GFXVT_BASE_SIZE 0x1000 |
| 21 | |
| 22 | #define VTVC0_BASE_ADDRESS 0xfed91000ULL |
| 23 | #define VTVC0_BASE_SIZE 0x1000 |
| 24 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 25 | #include <southbridge/intel/lynxpoint/pch.h> |
| 26 | |
| 27 | /* Everything below this line is ignored in the DSDT */ |
| 28 | #ifndef __ACPI__ |
| 29 | |
| 30 | /* Device 0:0.0 PCI configuration space (Host Bridge) */ |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 31 | #define HOST_BRIDGE PCI_DEV(0, 0, 0) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 32 | |
Angel Pons | e220e31 | 2020-07-22 00:55:38 +0200 | [diff] [blame] | 33 | #include "hostbridge_regs.h" |
Matt DeVillier | a51e379 | 2018-03-04 01:44:15 -0600 | [diff] [blame] | 34 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 35 | |
| 36 | /* Device 0:2.0 PCI configuration space (Graphics Device) */ |
| 37 | |
| 38 | #define MSAC 0x62 /* Multi Size Aperture Control */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 39 | |
| 40 | /* |
| 41 | * MCHBAR |
| 42 | */ |
| 43 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 44 | #define MCHBAR8(x) (*((volatile u8 *)(DEFAULT_MCHBAR + (x)))) |
| 45 | #define MCHBAR16(x) (*((volatile u16 *)(DEFAULT_MCHBAR + (x)))) |
| 46 | #define MCHBAR32(x) (*((volatile u32 *)(DEFAULT_MCHBAR + (x)))) |
| 47 | #define MCHBAR8_AND(x, and) (MCHBAR8(x) = MCHBAR8(x) & (and)) |
| 48 | #define MCHBAR16_AND(x, and) (MCHBAR16(x) = MCHBAR16(x) & (and)) |
| 49 | #define MCHBAR32_AND(x, and) (MCHBAR32(x) = MCHBAR32(x) & (and)) |
| 50 | #define MCHBAR8_OR(x, or) (MCHBAR8(x) = MCHBAR8(x) | (or)) |
| 51 | #define MCHBAR16_OR(x, or) (MCHBAR16(x) = MCHBAR16(x) | (or)) |
| 52 | #define MCHBAR32_OR(x, or) (MCHBAR32(x) = MCHBAR32(x) | (or)) |
| 53 | #define MCHBAR8_AND_OR(x, and, or) (MCHBAR8(x) = (MCHBAR8(x) & (and)) | (or)) |
| 54 | #define MCHBAR16_AND_OR(x, and, or) (MCHBAR16(x) = (MCHBAR16(x) & (and)) | (or)) |
| 55 | #define MCHBAR32_AND_OR(x, and, or) (MCHBAR32(x) = (MCHBAR32(x) & (and)) | (or)) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 56 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 57 | /* As there are many registers, define them on a separate file */ |
| 58 | #include "mchbar_regs.h" |
Duncan Laurie | c70353f | 2013-06-28 14:40:38 -0700 | [diff] [blame] | 59 | |
Angel Pons | e220e31 | 2020-07-22 00:55:38 +0200 | [diff] [blame] | 60 | #define ARCHDIS 0xff0 /* DMA Remap Engine Policy Control */ |
| 61 | #define DMAR_LCKDN (1 << 31) |
| 62 | #define SPCAPCTRL (1 << 25) |
| 63 | #define L3HIT2PEND_DIS (1 << 20) |
| 64 | #define PRSCAPDIS (1 << 2) |
| 65 | #define GLBIOTLBINV (1 << 1) |
| 66 | #define GLBCTXTINV (1 << 0) |
| 67 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 68 | /* |
| 69 | * EPBAR - Egress Port Root Complex Register Block |
| 70 | */ |
| 71 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 72 | #define EPBAR8(x) *((volatile u8 *)(DEFAULT_EPBAR + x)) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 73 | #define EPBAR16(x) *((volatile u16 *)(DEFAULT_EPBAR + x)) |
| 74 | #define EPBAR32(x) *((volatile u32 *)(DEFAULT_EPBAR + x)) |
| 75 | |
| 76 | #define EPPVCCAP1 0x004 /* 32bit */ |
| 77 | #define EPPVCCAP2 0x008 /* 32bit */ |
| 78 | |
| 79 | #define EPVC0RCAP 0x010 /* 32bit */ |
| 80 | #define EPVC0RCTL 0x014 /* 32bit */ |
| 81 | #define EPVC0RSTS 0x01a /* 16bit */ |
| 82 | |
| 83 | #define EPVC1RCAP 0x01c /* 32bit */ |
| 84 | #define EPVC1RCTL 0x020 /* 32bit */ |
| 85 | #define EPVC1RSTS 0x026 /* 16bit */ |
| 86 | |
| 87 | #define EPVC1MTS 0x028 /* 32bit */ |
| 88 | #define EPVC1IST 0x038 /* 64bit */ |
| 89 | |
| 90 | #define EPESD 0x044 /* 32bit */ |
| 91 | |
| 92 | #define EPLE1D 0x050 /* 32bit */ |
| 93 | #define EPLE1A 0x058 /* 64bit */ |
| 94 | #define EPLE2D 0x060 /* 32bit */ |
| 95 | #define EPLE2A 0x068 /* 64bit */ |
| 96 | |
| 97 | #define PORTARB 0x100 /* 256bit */ |
| 98 | |
| 99 | /* |
| 100 | * DMIBAR |
| 101 | */ |
| 102 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 103 | #define DMIBAR8(x) *((volatile u8 *)(DEFAULT_DMIBAR + x)) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 104 | #define DMIBAR16(x) *((volatile u16 *)(DEFAULT_DMIBAR + x)) |
| 105 | #define DMIBAR32(x) *((volatile u32 *)(DEFAULT_DMIBAR + x)) |
| 106 | |
| 107 | #define DMIVCECH 0x000 /* 32bit */ |
| 108 | #define DMIPVCCAP1 0x004 /* 32bit */ |
| 109 | #define DMIPVCCAP2 0x008 /* 32bit */ |
| 110 | |
| 111 | #define DMIPVCCCTL 0x00c /* 16bit */ |
| 112 | |
| 113 | #define DMIVC0RCAP 0x010 /* 32bit */ |
| 114 | #define DMIVC0RCTL0 0x014 /* 32bit */ |
| 115 | #define DMIVC0RSTS 0x01a /* 16bit */ |
| 116 | |
| 117 | #define DMIVC1RCAP 0x01c /* 32bit */ |
| 118 | #define DMIVC1RCTL 0x020 /* 32bit */ |
| 119 | #define DMIVC1RSTS 0x026 /* 16bit */ |
| 120 | |
| 121 | #define DMILE1D 0x050 /* 32bit */ |
| 122 | #define DMILE1A 0x058 /* 64bit */ |
| 123 | #define DMILE2D 0x060 /* 32bit */ |
| 124 | #define DMILE2A 0x068 /* 64bit */ |
| 125 | |
| 126 | #define DMILCAP 0x084 /* 32bit */ |
| 127 | #define DMILCTL 0x088 /* 16bit */ |
| 128 | #define DMILSTS 0x08a /* 16bit */ |
| 129 | |
Angel Pons | 598ec6a | 2020-07-23 02:37:12 +0200 | [diff] [blame^] | 130 | #define DMILCTL2 0x098 /* 16bit */ |
| 131 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 132 | #define DMICTL1 0x0f0 /* 32bit */ |
| 133 | #define DMICTL2 0x0fc /* 32bit */ |
| 134 | |
Angel Pons | 598ec6a | 2020-07-23 02:37:12 +0200 | [diff] [blame^] | 135 | #define DMIUESTS 0x1c4 /* 32bit */ |
| 136 | #define DMICESTS 0x1d0 /* 32bit */ |
| 137 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 138 | #define DMICC 0x208 /* 32bit */ |
| 139 | |
Angel Pons | 598ec6a | 2020-07-23 02:37:12 +0200 | [diff] [blame^] | 140 | #define DMIL0SLAT 0x22c /* 32bit */ |
| 141 | #define DMILLTC 0x238 /* 32bit */ |
| 142 | |
| 143 | #define DMI_AFE_PM_TMR 0xc28 /* 32bit */ |
| 144 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 145 | #define DMIDRCCFG 0xeb4 /* 32bit */ |
| 146 | |
| 147 | #ifndef __ASSEMBLER__ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 148 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 149 | void intel_northbridge_haswell_finalize_smm(void); |
Kyösti Mälkki | d7205be | 2019-09-27 07:24:17 +0300 | [diff] [blame] | 150 | |
Angel Pons | 73fa035 | 2020-07-03 12:29:03 +0200 | [diff] [blame] | 151 | void mb_late_romstage_setup(void); /* optional */ |
Angel Pons | 2e25ac6 | 2020-07-03 12:06:04 +0200 | [diff] [blame] | 152 | |
Angel Pons | e816829 | 2020-07-03 11:42:22 +0200 | [diff] [blame] | 153 | void haswell_early_initialization(void); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 154 | void haswell_late_initialization(void); |
Ronald G. Minnich | 4c8465c | 2013-09-30 15:57:21 -0700 | [diff] [blame] | 155 | void set_translation_table(int start, int end, u64 base, int inc); |
Tristan Corrick | 334be32 | 2018-12-17 22:10:21 +1300 | [diff] [blame] | 156 | void haswell_unhide_peg(void); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 157 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 158 | void report_platform_info(void); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 159 | |
Matt DeVillier | 85d98d9 | 2018-03-04 01:41:23 -0600 | [diff] [blame] | 160 | #include <device/device.h> |
| 161 | |
| 162 | struct acpi_rsdp; |
Furquan Shaikh | 0f007d8 | 2020-04-24 06:41:18 -0700 | [diff] [blame] | 163 | unsigned long northbridge_write_acpi_tables(const struct device *device, unsigned long start, |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 164 | struct acpi_rsdp *rsdp); |
Matt DeVillier | 85d98d9 | 2018-03-04 01:41:23 -0600 | [diff] [blame] | 165 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 166 | #endif /* __ASSEMBLER__ */ |
| 167 | #endif /* __ACPI__ */ |
Edward O'Callaghan | 089a510 | 2015-01-06 02:48:57 +1100 | [diff] [blame] | 168 | #endif /* __NORTHBRIDGE_INTEL_HASWELL_HASWELL_H__ */ |