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 | |
Tristan Corrick | bc896cd | 2018-12-17 22:09:50 +1300 | [diff] [blame] | 3 | #include <commonlib/helpers.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 4 | #include <console/console.h> |
Furquan Shaikh | 76cedd2 | 2020-05-02 10:24:23 -0700 | [diff] [blame] | 5 | #include <acpi/acpi.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 6 | #include <delay.h> |
| 7 | #include <cpu/intel/haswell/haswell.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 8 | #include <device/device.h> |
| 9 | #include <device/pci.h> |
Tristan Corrick | bc896cd | 2018-12-17 22:09:50 +1300 | [diff] [blame] | 10 | #include <device/pci_def.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 11 | #include <device/pci_ids.h> |
Tristan Corrick | bc896cd | 2018-12-17 22:09:50 +1300 | [diff] [blame] | 12 | #include <device/pci_ops.h> |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 13 | #include <boot/tables.h> |
Angel Pons | 4b290b7 | 2020-09-24 23:38:53 +0200 | [diff] [blame] | 14 | #include <security/intel/txt/txt_register.h> |
Angel Pons | e2ec60f | 2021-01-26 19:18:09 +0100 | [diff] [blame] | 15 | #include <southbridge/intel/lynxpoint/pch.h> |
Elyes HAOUAS | 030d338 | 2021-02-12 08:17:35 +0100 | [diff] [blame] | 16 | #include <types.h> |
Elyes HAOUAS | a1e22b8 | 2019-03-18 22:49:36 +0100 | [diff] [blame] | 17 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 18 | #include "chip.h" |
| 19 | #include "haswell.h" |
| 20 | |
Tristan Corrick | f3127d4 | 2018-10-31 02:25:54 +1300 | [diff] [blame] | 21 | static const char *northbridge_acpi_name(const struct device *dev) |
| 22 | { |
| 23 | if (dev->path.type == DEVICE_PATH_DOMAIN) |
| 24 | return "PCI0"; |
| 25 | |
| 26 | if (dev->path.type != DEVICE_PATH_PCI || dev->bus->secondary != 0) |
| 27 | return NULL; |
| 28 | |
| 29 | switch (dev->path.pci.devfn) { |
| 30 | case PCI_DEVFN(0, 0): |
| 31 | return "MCHC"; |
| 32 | } |
| 33 | |
| 34 | return NULL; |
| 35 | } |
| 36 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 37 | /* |
| 38 | * TODO: We could determine how many PCIe busses we need in the bar. |
| 39 | * For now, that number is hardcoded to a max of 64. |
| 40 | */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 41 | static struct device_operations pci_domain_ops = { |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 42 | .read_resources = pci_domain_read_resources, |
| 43 | .set_resources = pci_domain_set_resources, |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 44 | .scan_bus = pci_domain_scan_bus, |
| 45 | .acpi_name = northbridge_acpi_name, |
Matt DeVillier | 85d98d9 | 2018-03-04 01:41:23 -0600 | [diff] [blame] | 46 | .write_acpi_tables = northbridge_write_acpi_tables, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 47 | }; |
| 48 | |
Elyes HAOUAS | 77f7a6e | 2018-05-09 17:47:59 +0200 | [diff] [blame] | 49 | static int get_bar(struct device *dev, unsigned int index, u32 *base, u32 *len) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 50 | { |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 51 | u32 bar = pci_read_config32(dev, index); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 52 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 53 | /* If not enabled don't report it */ |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 54 | if (!(bar & 0x1)) |
| 55 | return 0; |
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 | /* Knock down the enable bit */ |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 58 | *base = bar & ~1; |
| 59 | |
| 60 | return 1; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 61 | } |
| 62 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 63 | /* |
| 64 | * There are special BARs that actually are programmed in the MCHBAR. These Intel special |
| 65 | * features, but they do consume resources that need to be accounted for. |
| 66 | */ |
| 67 | static int get_bar_in_mchbar(struct device *dev, unsigned int index, u32 *base, u32 *len) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 68 | { |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 69 | u32 bar = MCHBAR32(index); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 70 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 71 | /* If not enabled don't report it */ |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 72 | if (!(bar & 0x1)) |
| 73 | return 0; |
| 74 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 75 | /* Knock down the enable bit */ |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 76 | *base = bar & ~1; |
| 77 | |
| 78 | return 1; |
| 79 | } |
| 80 | |
| 81 | struct fixed_mmio_descriptor { |
| 82 | unsigned int index; |
| 83 | u32 size; |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 84 | int (*get_resource)(struct device *dev, unsigned int index, u32 *base, u32 *size); |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 85 | const char *description; |
| 86 | }; |
| 87 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 88 | #define SIZE_KB(x) ((x) * 1024) |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 89 | struct fixed_mmio_descriptor mc_fixed_resources[] = { |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 90 | { MCHBAR, SIZE_KB(32), get_bar, "MCHBAR" }, |
| 91 | { DMIBAR, SIZE_KB(4), get_bar, "DMIBAR" }, |
| 92 | { EPBAR, SIZE_KB(4), get_bar, "EPBAR" }, |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 93 | { GDXCBAR, SIZE_KB(4), get_bar_in_mchbar, "GDXCBAR" }, |
| 94 | { EDRAMBAR, SIZE_KB(16), get_bar_in_mchbar, "EDRAMBAR" }, |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 95 | }; |
| 96 | #undef SIZE_KB |
| 97 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 98 | /* Add all known fixed MMIO ranges that hang off the host bridge/memory controller device. */ |
Elyes HAOUAS | 77f7a6e | 2018-05-09 17:47:59 +0200 | [diff] [blame] | 99 | static void mc_add_fixed_mmio_resources(struct device *dev) |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 100 | { |
| 101 | int i; |
| 102 | |
| 103 | for (i = 0; i < ARRAY_SIZE(mc_fixed_resources); i++) { |
| 104 | u32 base; |
| 105 | u32 size; |
| 106 | struct resource *resource; |
| 107 | unsigned int index; |
| 108 | |
| 109 | size = mc_fixed_resources[i].size; |
| 110 | index = mc_fixed_resources[i].index; |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 111 | if (!mc_fixed_resources[i].get_resource(dev, index, &base, &size)) |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 112 | continue; |
| 113 | |
| 114 | resource = new_resource(dev, mc_fixed_resources[i].index); |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 115 | resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED | |
| 116 | IORESOURCE_RESERVE | IORESOURCE_ASSIGNED; |
| 117 | |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 118 | resource->base = base; |
| 119 | resource->size = size; |
| 120 | printk(BIOS_DEBUG, "%s: Adding %s @ %x 0x%08lx-0x%08lx.\n", |
| 121 | __func__, mc_fixed_resources[i].description, index, |
| 122 | (unsigned long)base, (unsigned long)(base + size - 1)); |
| 123 | } |
Angel Pons | 32770f8 | 2021-01-20 15:03:30 +0100 | [diff] [blame] | 124 | |
| 125 | mmconf_resource(dev, PCIEXBAR); |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 126 | } |
| 127 | |
Angel Pons | 4b290b7 | 2020-09-24 23:38:53 +0200 | [diff] [blame] | 128 | /* |
| 129 | * Host Memory Map: |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 130 | * |
| 131 | * +--------------------------+ TOUUD |
| 132 | * | | |
| 133 | * +--------------------------+ 4GiB |
| 134 | * | PCI Address Space | |
| 135 | * +--------------------------+ TOLUD (also maps into MC address space) |
| 136 | * | iGD | |
| 137 | * +--------------------------+ BDSM |
| 138 | * | GTT | |
| 139 | * +--------------------------+ BGSM |
| 140 | * | TSEG | |
| 141 | * +--------------------------+ TSEGMB |
Angel Pons | 4b290b7 | 2020-09-24 23:38:53 +0200 | [diff] [blame] | 142 | * | DPR | |
| 143 | * +--------------------------+ (DPR top - DPR size) |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 144 | * | Usage DRAM | |
| 145 | * +--------------------------+ 0 |
| 146 | * |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 147 | * Some of the base registers above can be equal, making the size of the regions within 0. |
| 148 | * This is because the memory controller internally subtracts the base registers from each |
| 149 | * other to determine sizes of the regions. In other words, the memory map regions are always |
| 150 | * in a fixed order, no matter what sizes they have. |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 151 | */ |
| 152 | |
| 153 | struct map_entry { |
| 154 | int reg; |
| 155 | int is_64_bit; |
| 156 | int is_limit; |
| 157 | const char *description; |
| 158 | }; |
| 159 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 160 | static void read_map_entry(struct device *dev, struct map_entry *entry, uint64_t *result) |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 161 | { |
| 162 | uint64_t value; |
| 163 | uint64_t mask; |
| 164 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 165 | /* All registers have a 1MiB granularity */ |
| 166 | mask = ((1ULL << 20) - 1); |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 167 | mask = ~mask; |
| 168 | |
| 169 | value = 0; |
| 170 | |
| 171 | if (entry->is_64_bit) { |
| 172 | value = pci_read_config32(dev, entry->reg + 4); |
| 173 | value <<= 32; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 174 | } |
| 175 | |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 176 | value |= pci_read_config32(dev, entry->reg); |
| 177 | value &= mask; |
| 178 | |
| 179 | if (entry->is_limit) |
| 180 | value |= ~mask; |
| 181 | |
| 182 | *result = value; |
| 183 | } |
| 184 | |
| 185 | #define MAP_ENTRY(reg_, is_64_, is_limit_, desc_) \ |
| 186 | { \ |
| 187 | .reg = reg_, \ |
| 188 | .is_64_bit = is_64_, \ |
| 189 | .is_limit = is_limit_, \ |
| 190 | .description = desc_, \ |
| 191 | } |
| 192 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 193 | #define MAP_ENTRY_BASE_32(reg_, desc_) MAP_ENTRY(reg_, 0, 0, desc_) |
| 194 | #define MAP_ENTRY_BASE_64(reg_, desc_) MAP_ENTRY(reg_, 1, 0, desc_) |
| 195 | #define MAP_ENTRY_LIMIT_64(reg_, desc_) MAP_ENTRY(reg_, 1, 1, desc_) |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 196 | |
| 197 | enum { |
| 198 | TOM_REG, |
| 199 | TOUUD_REG, |
| 200 | MESEG_BASE_REG, |
| 201 | MESEG_LIMIT_REG, |
| 202 | REMAP_BASE_REG, |
| 203 | REMAP_LIMIT_REG, |
| 204 | TOLUD_REG, |
| 205 | BGSM_REG, |
| 206 | BDSM_REG, |
| 207 | TSEG_REG, |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 208 | /* Must be last */ |
| 209 | NUM_MAP_ENTRIES, |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 210 | }; |
| 211 | |
| 212 | static struct map_entry memory_map[NUM_MAP_ENTRIES] = { |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 213 | [TOM_REG] = MAP_ENTRY_BASE_64(TOM, "TOM"), |
| 214 | [TOUUD_REG] = MAP_ENTRY_BASE_64(TOUUD, "TOUUD"), |
| 215 | [MESEG_BASE_REG] = MAP_ENTRY_BASE_64(MESEG_BASE, "MESEG_BASE"), |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 216 | [MESEG_LIMIT_REG] = MAP_ENTRY_LIMIT_64(MESEG_LIMIT, "MESEG_LIMIT"), |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 217 | [REMAP_BASE_REG] = MAP_ENTRY_BASE_64(REMAPBASE, "REMAP_BASE"), |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 218 | [REMAP_LIMIT_REG] = MAP_ENTRY_LIMIT_64(REMAPLIMIT, "REMAP_LIMIT"), |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 219 | [TOLUD_REG] = MAP_ENTRY_BASE_32(TOLUD, "TOLUD"), |
| 220 | [BDSM_REG] = MAP_ENTRY_BASE_32(BDSM, "BDSM"), |
| 221 | [BGSM_REG] = MAP_ENTRY_BASE_32(BGSM, "BGSM"), |
Angel Pons | d8abb26 | 2020-05-07 00:48:35 +0200 | [diff] [blame] | 222 | [TSEG_REG] = MAP_ENTRY_BASE_32(TSEG, "TSEGMB"), |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 223 | }; |
| 224 | |
Elyes HAOUAS | 77f7a6e | 2018-05-09 17:47:59 +0200 | [diff] [blame] | 225 | static void mc_read_map_entries(struct device *dev, uint64_t *values) |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 226 | { |
| 227 | int i; |
| 228 | for (i = 0; i < NUM_MAP_ENTRIES; i++) { |
| 229 | read_map_entry(dev, &memory_map[i], &values[i]); |
| 230 | } |
| 231 | } |
| 232 | |
Elyes HAOUAS | 77f7a6e | 2018-05-09 17:47:59 +0200 | [diff] [blame] | 233 | static void mc_report_map_entries(struct device *dev, uint64_t *values) |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 234 | { |
| 235 | int i; |
| 236 | for (i = 0; i < NUM_MAP_ENTRIES; i++) { |
| 237 | printk(BIOS_DEBUG, "MC MAP: %s: 0x%llx\n", |
| 238 | memory_map[i].description, values[i]); |
| 239 | } |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 240 | /* One can validate the BDSM and BGSM against the GGC */ |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 241 | printk(BIOS_DEBUG, "MC MAP: GGC: 0x%x\n", pci_read_config16(dev, GGC)); |
| 242 | } |
| 243 | |
Elyes HAOUAS | 77f7a6e | 2018-05-09 17:47:59 +0200 | [diff] [blame] | 244 | static void mc_add_dram_resources(struct device *dev, int *resource_cnt) |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 245 | { |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 246 | unsigned long base_k, size_k, touud_k, index; |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 247 | struct resource *resource; |
| 248 | uint64_t mc_values[NUM_MAP_ENTRIES]; |
| 249 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 250 | /* Read in the MAP registers and report their values */ |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 251 | mc_read_map_entries(dev, &mc_values[0]); |
| 252 | mc_report_map_entries(dev, &mc_values[0]); |
| 253 | |
Angel Pons | 5d7c3a4 | 2020-10-29 21:18:14 +0100 | [diff] [blame] | 254 | /* |
| 255 | * DMA Protected Range can be reserved below TSEG for PCODE patch |
| 256 | * or TXT/BootGuard related data. Rather than report a base address, |
| 257 | * the DPR register reports the TOP of the region, which is the same |
| 258 | * as TSEG base. The region size is reported in MiB in bits 11:4. |
| 259 | */ |
Angel Pons | 4b290b7 | 2020-09-24 23:38:53 +0200 | [diff] [blame] | 260 | const union dpr_register dpr = { |
| 261 | .raw = pci_read_config32(dev, DPR), |
| 262 | }; |
| 263 | printk(BIOS_DEBUG, "MC MAP: DPR: 0x%x\n", dpr.raw); |
| 264 | |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 265 | /* |
Aaron Durbin | 1fef1f5 | 2012-12-19 17:15:43 -0600 | [diff] [blame] | 266 | * These are the host memory ranges that should be added: |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 267 | * - 0 -> 0xa0000: cacheable |
| 268 | * - 0xc0000 -> TSEG: cacheable |
| 269 | * - TSEG -> BGSM: cacheable with standard MTRRs and reserved |
| 270 | * - BGSM -> TOLUD: not cacheable with standard MTRRs and reserved |
| 271 | * - 4GiB -> TOUUD: cacheable |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 272 | * |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 273 | * The default SMRAM space is reserved so that the range doesn't have to be saved |
| 274 | * during S3 Resume. Once marked reserved the OS cannot use the memory. This is a |
| 275 | * bit of an odd place to reserve the region, but the CPU devices don't have |
| 276 | * dev_ops->read_resources() called on them. |
Aaron Durbin | 1fef1f5 | 2012-12-19 17:15:43 -0600 | [diff] [blame] | 277 | * |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 278 | * The range 0xa0000 -> 0xc0000 does not have any resources associated with it to |
| 279 | * handle legacy VGA memory. If this range is not omitted the mtrr code will setup |
| 280 | * the area as cacheable, causing VGA access to not work. |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 281 | * |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 282 | * The TSEG region is mapped as cacheable so that one can perform SMRAM relocation |
| 283 | * faster. Once the SMRR is enabled, the SMRR takes precedence over the existing |
| 284 | * MTRRs covering this region. |
Aaron Durbin | e6c3b1d | 2012-12-21 21:22:07 -0600 | [diff] [blame] | 285 | * |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 286 | * It should be noted that cacheable entry types need to be added in order. The reason |
| 287 | * is that the current MTRR code assumes this and falls over itself if it isn't. |
Aaron Durbin | 1fef1f5 | 2012-12-19 17:15:43 -0600 | [diff] [blame] | 288 | * |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 289 | * The resource index starts low and should not meet or exceed PCI_BASE_ADDRESS_0. |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 290 | */ |
Matt DeVillier | a51e379 | 2018-03-04 01:44:15 -0600 | [diff] [blame] | 291 | index = *resource_cnt; |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 292 | |
Aaron Durbin | 6a36004 | 2014-02-13 10:30:42 -0600 | [diff] [blame] | 293 | /* 0 - > 0xa0000 */ |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 294 | base_k = 0; |
Aaron Durbin | 1fef1f5 | 2012-12-19 17:15:43 -0600 | [diff] [blame] | 295 | size_k = (0xa0000 >> 10) - base_k; |
| 296 | ram_resource(dev, index++, base_k, size_k); |
| 297 | |
Angel Pons | 5d7c3a4 | 2020-10-29 21:18:14 +0100 | [diff] [blame] | 298 | /* 0xc0000 -> TSEG - DPR */ |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 299 | base_k = 0xc0000 >> 10; |
Angel Pons | 5d7c3a4 | 2020-10-29 21:18:14 +0100 | [diff] [blame] | 300 | size_k = (unsigned long)(mc_values[TSEG_REG] >> 10) - base_k; |
| 301 | size_k -= dpr.size >> 10; |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 302 | ram_resource(dev, index++, base_k, size_k); |
| 303 | |
Angel Pons | 5d7c3a4 | 2020-10-29 21:18:14 +0100 | [diff] [blame] | 304 | /* TSEG - DPR -> BGSM */ |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 305 | resource = new_resource(dev, index++); |
Angel Pons | 5d7c3a4 | 2020-10-29 21:18:14 +0100 | [diff] [blame] | 306 | resource->base = mc_values[TSEG_REG] - dpr.size; |
Aaron Durbin | e6c3b1d | 2012-12-21 21:22:07 -0600 | [diff] [blame] | 307 | resource->size = mc_values[BGSM_REG] - resource->base; |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 308 | resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED | |
| 309 | IORESOURCE_RESERVE | IORESOURCE_ASSIGNED | IORESOURCE_CACHEABLE; |
Aaron Durbin | e6c3b1d | 2012-12-21 21:22:07 -0600 | [diff] [blame] | 310 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 311 | /* BGSM -> TOLUD. If the IGD is disabled, BGSM can equal TOLUD. */ |
Tristan Corrick | c5d367b | 2018-12-17 22:10:07 +1300 | [diff] [blame] | 312 | if (mc_values[BGSM_REG] != mc_values[TOLUD_REG]) { |
| 313 | resource = new_resource(dev, index++); |
| 314 | resource->base = mc_values[BGSM_REG]; |
| 315 | resource->size = mc_values[TOLUD_REG] - resource->base; |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 316 | resource->flags = IORESOURCE_MEM | IORESOURCE_FIXED | IORESOURCE_STORED | |
| 317 | IORESOURCE_RESERVE | IORESOURCE_ASSIGNED; |
Tristan Corrick | c5d367b | 2018-12-17 22:10:07 +1300 | [diff] [blame] | 318 | } |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 319 | |
| 320 | /* 4GiB -> TOUUD */ |
| 321 | base_k = 4096 * 1024; /* 4GiB */ |
Aaron Durbin | 27435d3 | 2013-06-03 09:46:56 -0500 | [diff] [blame] | 322 | touud_k = mc_values[TOUUD_REG] >> 10; |
| 323 | size_k = touud_k - base_k; |
| 324 | if (touud_k > base_k) |
Aaron Durbin | 5c66f08 | 2013-01-08 10:10:33 -0600 | [diff] [blame] | 325 | ram_resource(dev, index++, base_k, size_k); |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 326 | |
Aaron Durbin | c965076 | 2013-03-22 22:03:09 -0500 | [diff] [blame] | 327 | /* Reserve everything between A segment and 1MB: |
| 328 | * |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 329 | * 0xa0000 - 0xbffff: Legacy VGA |
Aaron Durbin | c965076 | 2013-03-22 22:03:09 -0500 | [diff] [blame] | 330 | * 0xc0000 - 0xfffff: RAM |
| 331 | */ |
| 332 | mmio_resource(dev, index++, (0xa0000 >> 10), (0xc0000 - 0xa0000) >> 10); |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 333 | reserved_ram_resource(dev, index++, (0xc0000 >> 10), (0x100000 - 0xc0000) >> 10); |
| 334 | |
Matt DeVillier | a51e379 | 2018-03-04 01:44:15 -0600 | [diff] [blame] | 335 | *resource_cnt = index; |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 336 | } |
| 337 | |
Elyes HAOUAS | 77f7a6e | 2018-05-09 17:47:59 +0200 | [diff] [blame] | 338 | static void mc_read_resources(struct device *dev) |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 339 | { |
Matt DeVillier | a51e379 | 2018-03-04 01:44:15 -0600 | [diff] [blame] | 340 | int index = 0; |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 341 | const bool vtd_capable = !(pci_read_config32(dev, CAPID0_A) & VTD_DISABLE); |
Matt DeVillier | a51e379 | 2018-03-04 01:44:15 -0600 | [diff] [blame] | 342 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 343 | /* Read standard PCI resources */ |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 344 | pci_dev_read_resources(dev); |
| 345 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 346 | /* Add all fixed MMIO resources */ |
Aaron Durbin | c12ef97 | 2012-12-18 14:22:49 -0600 | [diff] [blame] | 347 | mc_add_fixed_mmio_resources(dev); |
| 348 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 349 | /* Add VT-d MMIO resources, if capable */ |
Matt DeVillier | a51e379 | 2018-03-04 01:44:15 -0600 | [diff] [blame] | 350 | if (vtd_capable) { |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 351 | mmio_resource(dev, index++, GFXVT_BASE_ADDRESS / KiB, GFXVT_BASE_SIZE / KiB); |
| 352 | mmio_resource(dev, index++, VTVC0_BASE_ADDRESS / KiB, VTVC0_BASE_SIZE / KiB); |
Matt DeVillier | a51e379 | 2018-03-04 01:44:15 -0600 | [diff] [blame] | 353 | } |
| 354 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 355 | /* Calculate and add DRAM resources */ |
Matt DeVillier | a51e379 | 2018-03-04 01:44:15 -0600 | [diff] [blame] | 356 | mc_add_dram_resources(dev, &index); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 357 | } |
| 358 | |
Tristan Corrick | bc896cd | 2018-12-17 22:09:50 +1300 | [diff] [blame] | 359 | /* |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 360 | * The Mini-HD audio device is disabled whenever the IGD is. This is because it provides |
| 361 | * audio over the integrated graphics port(s), which requires the IGD to be functional. |
Tristan Corrick | bc896cd | 2018-12-17 22:09:50 +1300 | [diff] [blame] | 362 | */ |
| 363 | static void disable_devices(void) |
| 364 | { |
| 365 | static const struct { |
| 366 | const unsigned int devfn; |
| 367 | const u32 mask; |
| 368 | const char *const name; |
| 369 | } nb_devs[] = { |
| 370 | { PCI_DEVFN(1, 2), DEVEN_D1F2EN, "PEG12" }, |
| 371 | { PCI_DEVFN(1, 1), DEVEN_D1F1EN, "PEG11" }, |
| 372 | { PCI_DEVFN(1, 0), DEVEN_D1F0EN, "PEG10" }, |
| 373 | { PCI_DEVFN(2, 0), DEVEN_D2EN | DEVEN_D3EN, "IGD" }, |
| 374 | { PCI_DEVFN(3, 0), DEVEN_D3EN, "Mini-HD audio" }, |
| 375 | { PCI_DEVFN(4, 0), DEVEN_D4EN, "\"device 4\"" }, |
| 376 | { PCI_DEVFN(7, 0), DEVEN_D7EN, "\"device 7\"" }, |
| 377 | }; |
| 378 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 379 | struct device *host_dev = pcidev_on_root(0, 0); |
Tristan Corrick | bc896cd | 2018-12-17 22:09:50 +1300 | [diff] [blame] | 380 | u32 deven; |
| 381 | size_t i; |
| 382 | |
| 383 | if (!host_dev) |
| 384 | return; |
| 385 | |
| 386 | deven = pci_read_config32(host_dev, DEVEN); |
| 387 | |
| 388 | for (i = 0; i < ARRAY_SIZE(nb_devs); i++) { |
Kyösti Mälkki | e737755 | 2018-06-21 16:20:55 +0300 | [diff] [blame] | 389 | struct device *dev = pcidev_path_on_root(nb_devs[i].devfn); |
Tristan Corrick | bc896cd | 2018-12-17 22:09:50 +1300 | [diff] [blame] | 390 | if (!dev || !dev->enabled) { |
| 391 | printk(BIOS_DEBUG, "Disabling %s.\n", nb_devs[i].name); |
| 392 | deven &= ~nb_devs[i].mask; |
| 393 | } |
| 394 | } |
| 395 | |
| 396 | pci_write_config32(host_dev, DEVEN, deven); |
| 397 | } |
| 398 | |
Angel Pons | 028b8e4 | 2020-07-24 14:03:29 +0200 | [diff] [blame] | 399 | static void init_egress(void) |
| 400 | { |
| 401 | /* VC0: Enable, ID0, TC0 */ |
| 402 | EPBAR32(EPVC0RCTL) = (1 << 31) | (0 << 24) | (1 << 0); |
| 403 | |
| 404 | /* No Low Priority Extended VCs, one Extended VC */ |
| 405 | EPBAR32(EPPVCCAP1) = (0 << 4) | (1 << 0); |
| 406 | |
| 407 | /* VC1: Enable, ID1, TC1 */ |
| 408 | EPBAR32(EPVC1RCTL) = (1 << 31) | (1 << 24) | (1 << 1); |
| 409 | |
| 410 | /* Poll the VC1 Negotiation Pending bit */ |
| 411 | while ((EPBAR16(EPVC1RSTS) & (1 << 1)) != 0) |
| 412 | ; |
| 413 | } |
| 414 | |
Angel Pons | 598ec6a | 2020-07-23 02:37:12 +0200 | [diff] [blame] | 415 | static void northbridge_dmi_init(void) |
| 416 | { |
| 417 | const bool is_haswell_h = !CONFIG(INTEL_LYNXPOINT_LP); |
| 418 | |
| 419 | u16 reg16; |
| 420 | u32 reg32; |
| 421 | |
| 422 | /* Steps prior to DMI ASPM */ |
| 423 | if (is_haswell_h) { |
| 424 | /* Configure DMI De-Emphasis */ |
| 425 | reg16 = DMIBAR16(DMILCTL2); |
| 426 | reg16 |= (1 << 6); /* 0b: -6.0 dB, 1b: -3.5 dB */ |
| 427 | DMIBAR16(DMILCTL2) = reg16; |
| 428 | |
| 429 | reg32 = DMIBAR32(DMIL0SLAT); |
| 430 | reg32 |= (1 << 31); |
| 431 | DMIBAR32(DMIL0SLAT) = reg32; |
| 432 | |
| 433 | reg32 = DMIBAR32(DMILLTC); |
| 434 | reg32 |= (1 << 29); |
| 435 | DMIBAR32(DMILLTC) = reg32; |
| 436 | |
| 437 | reg32 = DMIBAR32(DMI_AFE_PM_TMR); |
| 438 | reg32 &= ~0x1f; |
| 439 | reg32 |= 0x13; |
| 440 | DMIBAR32(DMI_AFE_PM_TMR) = reg32; |
| 441 | } |
| 442 | |
| 443 | /* Clear error status bits */ |
| 444 | DMIBAR32(DMIUESTS) = 0xffffffff; |
| 445 | DMIBAR32(DMICESTS) = 0xffffffff; |
| 446 | |
| 447 | if (is_haswell_h) { |
| 448 | /* Enable ASPM L0s and L1 on SA link, should happen before PCH link */ |
| 449 | reg16 = DMIBAR16(DMILCTL); |
| 450 | reg16 |= (1 << 1) | (1 << 0); |
| 451 | DMIBAR16(DMILCTL) = reg16; |
| 452 | } |
| 453 | } |
| 454 | |
Angel Pons | 76b8bc2 | 2020-07-23 02:32:27 +0200 | [diff] [blame] | 455 | static void northbridge_topology_init(void) |
| 456 | { |
| 457 | const u32 eple_a[3] = { EPLE2A, EPLE3A, EPLE4A }; |
| 458 | const u32 eple_d[3] = { EPLE2D, EPLE3D, EPLE4D }; |
| 459 | |
| 460 | u32 reg32; |
| 461 | |
| 462 | /* Set the CID1 Egress Port 0 Root Topology */ |
| 463 | reg32 = EPBAR32(EPESD); |
| 464 | reg32 &= ~(0xff << 16); |
| 465 | reg32 |= 1 << 16; |
| 466 | EPBAR32(EPESD) = reg32; |
| 467 | |
| 468 | reg32 = EPBAR32(EPLE1D); |
| 469 | reg32 &= ~(0xff << 16); |
| 470 | reg32 |= 1 | (1 << 16); |
| 471 | EPBAR32(EPLE1D) = reg32; |
Angel Pons | f95b9b4 | 2021-01-20 01:10:48 +0100 | [diff] [blame] | 472 | EPBAR64(EPLE1A) = CONFIG_FIXED_DMIBAR_MMIO_BASE; |
Angel Pons | 76b8bc2 | 2020-07-23 02:32:27 +0200 | [diff] [blame] | 473 | |
| 474 | for (unsigned int i = 0; i <= 2; i++) { |
| 475 | const struct device *const dev = pcidev_on_root(1, i); |
| 476 | |
| 477 | if (!dev || !dev->enabled) |
| 478 | continue; |
| 479 | |
| 480 | EPBAR64(eple_a[i]) = (u64)PCI_DEV(0, 1, i); |
| 481 | |
| 482 | reg32 = EPBAR32(eple_d[i]); |
| 483 | reg32 &= ~(0xff << 16); |
| 484 | reg32 |= 1 | (1 << 16); |
| 485 | EPBAR32(eple_d[i]) = reg32; |
| 486 | |
| 487 | pci_update_config32(dev, PEG_ESD, ~(0xff << 16), (1 << 16)); |
Angel Pons | f95b9b4 | 2021-01-20 01:10:48 +0100 | [diff] [blame] | 488 | pci_write_config32(dev, PEG_LE1A, CONFIG_FIXED_EPBAR_MMIO_BASE); |
Angel Pons | 76b8bc2 | 2020-07-23 02:32:27 +0200 | [diff] [blame] | 489 | pci_write_config32(dev, PEG_LE1A + 4, 0); |
| 490 | pci_update_config32(dev, PEG_LE1D, ~(0xff << 16), (1 << 16) | 1); |
| 491 | |
| 492 | /* Read and write to lock register */ |
| 493 | pci_or_config32(dev, PEG_DCAP2, 0); |
| 494 | } |
| 495 | |
| 496 | /* Set the CID1 DMI Port Root Topology */ |
| 497 | reg32 = DMIBAR32(DMIESD); |
| 498 | reg32 &= ~(0xff << 16); |
| 499 | reg32 |= 1 << 16; |
| 500 | DMIBAR32(DMIESD) = reg32; |
| 501 | |
| 502 | reg32 = DMIBAR32(DMILE1D); |
| 503 | reg32 &= ~(0xffff << 16); |
| 504 | reg32 |= 1 | (2 << 16); |
| 505 | DMIBAR32(DMILE1D) = reg32; |
Angel Pons | 6e732d3 | 2021-01-28 13:56:18 +0100 | [diff] [blame] | 506 | DMIBAR64(DMILE1A) = CONFIG_FIXED_RCBA_MMIO_BASE; |
Angel Pons | 76b8bc2 | 2020-07-23 02:32:27 +0200 | [diff] [blame] | 507 | |
Angel Pons | f95b9b4 | 2021-01-20 01:10:48 +0100 | [diff] [blame] | 508 | DMIBAR64(DMILE2A) = CONFIG_FIXED_EPBAR_MMIO_BASE; |
Angel Pons | 76b8bc2 | 2020-07-23 02:32:27 +0200 | [diff] [blame] | 509 | reg32 = DMIBAR32(DMILE2D); |
| 510 | reg32 &= ~(0xff << 16); |
| 511 | reg32 |= 1 | (1 << 16); |
| 512 | DMIBAR32(DMILE2D) = reg32; |
| 513 | |
| 514 | /* Program RO and Write-Once Registers */ |
| 515 | DMIBAR32(DMIPVCCAP1) = DMIBAR32(DMIPVCCAP1); |
| 516 | DMIBAR32(DMILCAP) = DMIBAR32(DMILCAP); |
| 517 | } |
| 518 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 519 | static void northbridge_init(struct device *dev) |
| 520 | { |
Duncan Laurie | c70353f | 2013-06-28 14:40:38 -0700 | [diff] [blame] | 521 | u8 bios_reset_cpl, pair; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 522 | |
Angel Pons | 028b8e4 | 2020-07-24 14:03:29 +0200 | [diff] [blame] | 523 | init_egress(); |
Angel Pons | 598ec6a | 2020-07-23 02:37:12 +0200 | [diff] [blame] | 524 | northbridge_dmi_init(); |
Angel Pons | 76b8bc2 | 2020-07-23 02:32:27 +0200 | [diff] [blame] | 525 | northbridge_topology_init(); |
Angel Pons | 598ec6a | 2020-07-23 02:37:12 +0200 | [diff] [blame] | 526 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 527 | /* Enable Power Aware Interrupt Routing. */ |
| 528 | pair = MCHBAR8(INTRDIRCTL); |
Duncan Laurie | c70353f | 2013-06-28 14:40:38 -0700 | [diff] [blame] | 529 | pair &= ~0x7; /* Clear 2:0 */ |
| 530 | pair |= 0x4; /* Fixed Priority */ |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 531 | MCHBAR8(INTRDIRCTL) = pair; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 532 | |
Tristan Corrick | bc896cd | 2018-12-17 22:09:50 +1300 | [diff] [blame] | 533 | disable_devices(); |
| 534 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 535 | /* |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 536 | * Set bits 0 + 1 of BIOS_RESET_CPL to indicate to the CPU |
| 537 | * that BIOS has initialized memory and power management. |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 538 | */ |
| 539 | bios_reset_cpl = MCHBAR8(BIOS_RESET_CPL); |
Duncan Laurie | c70353f | 2013-06-28 14:40:38 -0700 | [diff] [blame] | 540 | bios_reset_cpl |= 3; |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 541 | MCHBAR8(BIOS_RESET_CPL) = bios_reset_cpl; |
| 542 | printk(BIOS_DEBUG, "Set BIOS_RESET_CPL\n"); |
| 543 | |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 544 | /* Configure turbo power limits 1ms after reset complete bit. */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 545 | mdelay(1); |
| 546 | set_power_limits(28); |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 547 | } |
| 548 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 549 | static struct device_operations mc_ops = { |
Nico Huber | 68680dd | 2020-03-31 17:34:52 +0200 | [diff] [blame] | 550 | .read_resources = mc_read_resources, |
| 551 | .set_resources = pci_dev_set_resources, |
| 552 | .enable_resources = pci_dev_enable_resources, |
| 553 | .init = northbridge_init, |
| 554 | .acpi_fill_ssdt = generate_cpu_entries, |
Angel Pons | 1fc0edd | 2020-05-31 00:03:28 +0200 | [diff] [blame] | 555 | .ops_pci = &pci_dev_ops_pci, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 556 | }; |
| 557 | |
Tristan Corrick | d385624 | 2018-11-01 03:03:29 +1300 | [diff] [blame] | 558 | static const unsigned short mc_pci_device_ids[] = { |
| 559 | 0x0c00, /* Desktop */ |
| 560 | 0x0c04, /* Mobile */ |
| 561 | 0x0a04, /* ULT */ |
Iru Cai | 0766c98 | 2018-12-17 13:21:36 +0800 | [diff] [blame] | 562 | 0x0c08, /* Server */ |
Iru Cai | 12a13e1 | 2020-05-22 22:57:03 +0800 | [diff] [blame] | 563 | 0x0d00, /* Crystal Well Desktop */ |
| 564 | 0x0d04, /* Crystal Well Mobile */ |
| 565 | 0x0d08, /* Crystal Well Server (by extrapolation) */ |
Tristan Corrick | d385624 | 2018-11-01 03:03:29 +1300 | [diff] [blame] | 566 | 0 |
Tristan Corrick | 4817012 | 2018-10-31 02:21:41 +1300 | [diff] [blame] | 567 | }; |
| 568 | |
Tristan Corrick | d385624 | 2018-11-01 03:03:29 +1300 | [diff] [blame] | 569 | static const struct pci_driver mc_driver_hsw __pci_driver = { |
| 570 | .ops = &mc_ops, |
| 571 | .vendor = PCI_VENDOR_ID_INTEL, |
| 572 | .devices = mc_pci_device_ids, |
Duncan Laurie | df7be71 | 2012-12-17 11:22:57 -0800 | [diff] [blame] | 573 | }; |
| 574 | |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 575 | static struct device_operations cpu_bus_ops = { |
Nico Huber | 2f8ba69 | 2020-04-05 14:05:24 +0200 | [diff] [blame] | 576 | .read_resources = noop_read_resources, |
| 577 | .set_resources = noop_set_resources, |
Kyösti Mälkki | b3267e0 | 2019-08-13 16:44:04 +0300 | [diff] [blame] | 578 | .init = mp_cpu_bus_init, |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 579 | }; |
| 580 | |
Elyes HAOUAS | 77f7a6e | 2018-05-09 17:47:59 +0200 | [diff] [blame] | 581 | static void enable_dev(struct device *dev) |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 582 | { |
Angel Pons | 1db5bc7 | 2020-01-15 00:49:03 +0100 | [diff] [blame] | 583 | /* Set the operations if it is a special bus type. */ |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 584 | if (dev->path.type == DEVICE_PATH_DOMAIN) { |
| 585 | dev->ops = &pci_domain_ops; |
| 586 | } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) { |
| 587 | dev->ops = &cpu_bus_ops; |
| 588 | } |
| 589 | } |
| 590 | |
| 591 | struct chip_operations northbridge_intel_haswell_ops = { |
Angel Pons | 7bbf45e | 2020-10-22 23:55:24 +0200 | [diff] [blame] | 592 | CHIP_NAME("Intel Haswell integrated Northbridge") |
Aaron Durbin | 76c3700 | 2012-10-30 09:03:43 -0500 | [diff] [blame] | 593 | .enable_dev = enable_dev, |
| 594 | }; |