Angel Pons | f94ac9a | 2020-04-05 15:46:48 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 3 | |
Duncan Laurie | e86ac7e | 2014-10-07 15:19:54 -0700 | [diff] [blame] | 4 | #include <arch/acpi.h> |
Kyösti Mälkki | 13f6650 | 2019-03-03 08:01:05 +0200 | [diff] [blame] | 5 | #include <device/mmio.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 6 | #include <device/pci_ops.h> |
Marc Jones | a6354a1 | 2014-12-26 22:11:14 -0700 | [diff] [blame] | 7 | #include <bootmode.h> |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 8 | #include <console/console.h> |
| 9 | #include <delay.h> |
| 10 | #include <device/device.h> |
| 11 | #include <device/pci.h> |
| 12 | #include <device/pci_ids.h> |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 13 | #include <string.h> |
| 14 | #include <reg_script.h> |
Matt DeVillier | 773488f | 2017-10-18 12:27:25 -0500 | [diff] [blame] | 15 | #include <cbmem.h> |
Matt DeVillier | 53e2446 | 2016-08-05 02:20:15 -0500 | [diff] [blame] | 16 | #include <drivers/intel/gma/i915.h> |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 17 | #include <drivers/intel/gma/i915_reg.h> |
Nico Huber | a06689c | 2019-10-08 20:56:41 +0200 | [diff] [blame] | 18 | #include <drivers/intel/gma/libgfxinit.h> |
Matt DeVillier | 773488f | 2017-10-18 12:27:25 -0500 | [diff] [blame] | 19 | #include <drivers/intel/gma/opregion.h> |
Julius Werner | 4ee4bd5 | 2014-10-20 13:46:39 -0700 | [diff] [blame] | 20 | #include <soc/cpu.h> |
Matt DeVillier | 773488f | 2017-10-18 12:27:25 -0500 | [diff] [blame] | 21 | #include <soc/nvs.h> |
Duncan Laurie | 1e6b591 | 2015-01-30 16:33:43 -0800 | [diff] [blame] | 22 | #include <soc/pm.h> |
Julius Werner | 4ee4bd5 | 2014-10-20 13:46:39 -0700 | [diff] [blame] | 23 | #include <soc/ramstage.h> |
| 24 | #include <soc/systemagent.h> |
| 25 | #include <soc/intel/broadwell/chip.h> |
Philipp Deppenwiese | fea2429 | 2017-10-17 17:02:29 +0200 | [diff] [blame] | 26 | #include <security/vboot/vbnv.h> |
Matt DeVillier | f8960a6 | 2016-11-16 23:37:43 -0600 | [diff] [blame] | 27 | #include <soc/igd.h> |
Elyes HAOUAS | 27d02d8 | 2019-05-15 21:11:39 +0200 | [diff] [blame] | 28 | #include <types.h> |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 29 | |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 30 | #define GT_RETRY 1000 |
| 31 | enum { |
| 32 | GT_CDCLK_DEFAULT = 0, |
| 33 | GT_CDCLK_337, |
| 34 | GT_CDCLK_450, |
| 35 | GT_CDCLK_540, |
| 36 | GT_CDCLK_675, |
| 37 | }; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 38 | |
Matt DeVillier | f8960a6 | 2016-11-16 23:37:43 -0600 | [diff] [blame] | 39 | static u32 reg_em4; |
| 40 | static u32 reg_em5; |
| 41 | |
| 42 | u32 igd_get_reg_em4(void) { return reg_em4; } |
| 43 | u32 igd_get_reg_em5(void) { return reg_em5; } |
| 44 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 45 | struct reg_script haswell_early_init_script[] = { |
| 46 | /* Enable Force Wake */ |
| 47 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa180, 0x00000020), |
| 48 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa188, 0x00010001), |
Edward O'Callaghan | 986e85c | 2014-10-29 12:15:34 +1100 | [diff] [blame] | 49 | REG_RES_POLL32(PCI_BASE_ADDRESS_0, FORCEWAKE_ACK_HSW, 1, 1, GT_RETRY), |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 50 | |
| 51 | /* Enable Counters */ |
| 52 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa248, 0x00000016), |
| 53 | |
| 54 | /* GFXPAUSE settings */ |
| 55 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa000, 0x00070020), |
| 56 | |
| 57 | /* ECO Settings */ |
| 58 | REG_RES_RMW32(PCI_BASE_ADDRESS_0, 0xa180, 0xff3fffff, 0x15000000), |
| 59 | |
| 60 | /* Enable DOP Clock Gating */ |
| 61 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x9424, 0x000003fd), |
| 62 | |
| 63 | /* Enable Unit Level Clock Gating */ |
| 64 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x9400, 0x00000080), |
| 65 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x9404, 0x40401000), |
| 66 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x9408, 0x00000000), |
| 67 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x940c, 0x02000001), |
| 68 | |
| 69 | /* |
| 70 | * RC6 Settings |
| 71 | */ |
| 72 | |
| 73 | /* Wake Rate Limits */ |
| 74 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa090, 0x00000000), |
| 75 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa098, 0x03e80000), |
| 76 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa09c, 0x00280000), |
| 77 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa0a8, 0x0001e848), |
| 78 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa0ac, 0x00000019), |
| 79 | |
| 80 | /* Render/Video/Blitter Idle Max Count */ |
| 81 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x02054, 0x0000000a), |
| 82 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x12054, 0x0000000a), |
| 83 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x22054, 0x0000000a), |
| 84 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x1a054, 0x0000000a), |
| 85 | |
| 86 | /* RC Sleep / RCx Thresholds */ |
| 87 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa0b0, 0x00000000), |
| 88 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa0b4, 0x000003e8), |
| 89 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa0b8, 0x0000c350), |
| 90 | |
| 91 | /* RP Settings */ |
| 92 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa010, 0x000f4240), |
| 93 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa014, 0x12060000), |
| 94 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa02c, 0x0000e808), |
| 95 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa030, 0x0003bd08), |
| 96 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa068, 0x000101d0), |
| 97 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa06c, 0x00055730), |
| 98 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0xa070, 0x0000000a), |
| 99 | |
| 100 | /* RP Control */ |
| 101 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa024, 0x00000b92), |
| 102 | |
| 103 | /* HW RC6 Control */ |
| 104 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa090, 0x88040000), |
| 105 | |
| 106 | /* Video Frequency Request */ |
| 107 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa00c, 0x08000000), |
| 108 | |
| 109 | /* Set RC6 VIDs */ |
| 110 | REG_RES_POLL32(PCI_BASE_ADDRESS_0, 0x138124, (1 << 31), 0, GT_RETRY), |
| 111 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x138128, 0), |
| 112 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x138124, 0x80000004), |
| 113 | REG_RES_POLL32(PCI_BASE_ADDRESS_0, 0x138124, (1 << 31), 0, GT_RETRY), |
| 114 | |
| 115 | /* Enable PM Interrupts */ |
| 116 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x4402c, 0x03000076), |
| 117 | |
| 118 | /* Enable RC6 in idle */ |
| 119 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa094, 0x00040000), |
| 120 | |
| 121 | REG_SCRIPT_END |
| 122 | }; |
| 123 | |
| 124 | static const struct reg_script haswell_late_init_script[] = { |
| 125 | /* Lock settings */ |
| 126 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a248, (1 << 31)), |
| 127 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a004, (1 << 4)), |
| 128 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a080, (1 << 2)), |
| 129 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a180, (1 << 31)), |
| 130 | |
| 131 | /* Disable Force Wake */ |
| 132 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa188, 0x00010000), |
Edward O'Callaghan | 986e85c | 2014-10-29 12:15:34 +1100 | [diff] [blame] | 133 | REG_RES_POLL32(PCI_BASE_ADDRESS_0, FORCEWAKE_ACK_HSW, 1, 0, GT_RETRY), |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 134 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa188, 0x00000001), |
| 135 | |
| 136 | /* Enable power well for DP and Audio */ |
| 137 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x45400, (1 << 31)), |
| 138 | REG_RES_POLL32(PCI_BASE_ADDRESS_0, 0x45400, |
| 139 | (1 << 30), (1 << 30), GT_RETRY), |
| 140 | |
| 141 | REG_SCRIPT_END |
| 142 | }; |
| 143 | |
| 144 | static const struct reg_script broadwell_early_init_script[] = { |
| 145 | /* Enable Force Wake */ |
| 146 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa188, 0x00010001), |
Edward O'Callaghan | 986e85c | 2014-10-29 12:15:34 +1100 | [diff] [blame] | 147 | REG_RES_POLL32(PCI_BASE_ADDRESS_0, FORCEWAKE_ACK_HSW, 1, 1, GT_RETRY), |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 148 | |
| 149 | /* Enable push bus metric control and shift */ |
| 150 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa248, 0x00000004), |
| 151 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa250, 0x000000ff), |
| 152 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa25c, 0x00000010), |
| 153 | |
Duncan Laurie | 84b9cf4 | 2014-07-31 10:46:57 -0700 | [diff] [blame] | 154 | /* GFXPAUSE settings (set based on stepping) */ |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 155 | |
| 156 | /* ECO Settings */ |
| 157 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa180, 0x45200000), |
| 158 | |
| 159 | /* Enable DOP Clock Gating */ |
| 160 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x9424, 0x000000fd), |
| 161 | |
| 162 | /* Enable Unit Level Clock Gating */ |
| 163 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x9400, 0x00000000), |
| 164 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x9404, 0x40401000), |
| 165 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x9408, 0x00000000), |
| 166 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x940c, 0x02000001), |
| 167 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x1a054, 0x0000000a), |
| 168 | |
| 169 | /* Video Frequency Request */ |
| 170 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa00c, 0x08000000), |
| 171 | |
Duncan Laurie | 84b9cf4 | 2014-07-31 10:46:57 -0700 | [diff] [blame] | 172 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x138158, 0x00000009), |
| 173 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x13815c, 0x0000000d), |
| 174 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 175 | /* |
| 176 | * RC6 Settings |
| 177 | */ |
| 178 | |
| 179 | /* Wake Rate Limits */ |
| 180 | REG_RES_RMW32(PCI_BASE_ADDRESS_0, 0x0a090, 0, 0), |
| 181 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a098, 0x03e80000), |
| 182 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a09c, 0x00280000), |
| 183 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a0a8, 0x0001e848), |
| 184 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a0ac, 0x00000019), |
| 185 | |
| 186 | /* Render/Video/Blitter Idle Max Count */ |
| 187 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x02054, 0x0000000a), |
| 188 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x12054, 0x0000000a), |
| 189 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x22054, 0x0000000a), |
| 190 | |
| 191 | /* RC Sleep / RCx Thresholds */ |
| 192 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a0b0, 0x00000000), |
| 193 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a0b8, 0x00000271), |
| 194 | |
| 195 | /* RP Settings */ |
| 196 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a010, 0x000f4240), |
| 197 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a014, 0x12060000), |
| 198 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a02c, 0x0000e808), |
| 199 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a030, 0x0003bd08), |
| 200 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a068, 0x000101d0), |
| 201 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a06c, 0x00055730), |
| 202 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a070, 0x0000000a), |
| 203 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a168, 0x00000006), |
| 204 | |
| 205 | /* RP Control */ |
| 206 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa024, 0x00000b92), |
| 207 | |
| 208 | /* HW RC6 Control */ |
| 209 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa090, 0x90040000), |
| 210 | |
| 211 | /* Set RC6 VIDs */ |
| 212 | REG_RES_POLL32(PCI_BASE_ADDRESS_0, 0x138124, (1 << 31), 0, GT_RETRY), |
| 213 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x138128, 0), |
| 214 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x138124, 0x80000004), |
| 215 | REG_RES_POLL32(PCI_BASE_ADDRESS_0, 0x138124, (1 << 31), 0, GT_RETRY), |
| 216 | |
| 217 | /* Enable PM Interrupts */ |
| 218 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0x4402c, 0x03000076), |
| 219 | |
| 220 | /* Enable RC6 in idle */ |
| 221 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa094, 0x00040000), |
| 222 | |
| 223 | REG_SCRIPT_END |
| 224 | }; |
| 225 | |
| 226 | static const struct reg_script broadwell_late_init_script[] = { |
| 227 | /* Lock settings */ |
| 228 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a248, (1 << 31)), |
| 229 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a000, (1 << 18)), |
| 230 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x0a180, (1 << 31)), |
| 231 | |
| 232 | /* Disable Force Wake */ |
| 233 | REG_RES_WRITE32(PCI_BASE_ADDRESS_0, 0xa188, 0x00010000), |
Edward O'Callaghan | 986e85c | 2014-10-29 12:15:34 +1100 | [diff] [blame] | 234 | REG_RES_POLL32(PCI_BASE_ADDRESS_0, FORCEWAKE_ACK_HSW, 1, 0, GT_RETRY), |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 235 | |
| 236 | /* Enable power well for DP and Audio */ |
| 237 | REG_RES_OR32(PCI_BASE_ADDRESS_0, 0x45400, (1 << 31)), |
| 238 | REG_RES_POLL32(PCI_BASE_ADDRESS_0, 0x45400, |
| 239 | (1 << 30), (1 << 30), GT_RETRY), |
| 240 | |
| 241 | REG_SCRIPT_END |
| 242 | }; |
| 243 | |
| 244 | u32 map_oprom_vendev(u32 vendev) |
| 245 | { |
| 246 | return SA_IGD_OPROM_VENDEV; |
| 247 | } |
| 248 | |
| 249 | static struct resource *gtt_res = NULL; |
| 250 | |
Matt DeVillier | 53e2446 | 2016-08-05 02:20:15 -0500 | [diff] [blame] | 251 | u32 gtt_read(u32 reg) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 252 | { |
| 253 | u32 val; |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 254 | val = read32(res2mmio(gtt_res, reg, 0)); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 255 | return val; |
| 256 | |
| 257 | } |
| 258 | |
Matt DeVillier | 53e2446 | 2016-08-05 02:20:15 -0500 | [diff] [blame] | 259 | void gtt_write(u32 reg, u32 data) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 260 | { |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 261 | write32(res2mmio(gtt_res, reg, 0), data); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 262 | } |
| 263 | |
| 264 | static inline void gtt_rmw(u32 reg, u32 andmask, u32 ormask) |
| 265 | { |
| 266 | u32 val = gtt_read(reg); |
| 267 | val &= andmask; |
| 268 | val |= ormask; |
| 269 | gtt_write(reg, val); |
| 270 | } |
| 271 | |
Matt DeVillier | 53e2446 | 2016-08-05 02:20:15 -0500 | [diff] [blame] | 272 | int gtt_poll(u32 reg, u32 mask, u32 value) |
| 273 | { unsigned int try = GT_RETRY; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 274 | u32 data; |
| 275 | |
| 276 | while (try--) { |
| 277 | data = gtt_read(reg); |
| 278 | if ((data & mask) == value) |
| 279 | return 1; |
| 280 | udelay(10); |
| 281 | } |
| 282 | |
| 283 | printk(BIOS_ERR, "GT init timeout\n"); |
| 284 | return 0; |
| 285 | } |
| 286 | |
| 287 | static void igd_setup_panel(struct device *dev) |
| 288 | { |
Kyösti Mälkki | 8950cfb | 2019-07-13 22:16:25 +0300 | [diff] [blame] | 289 | config_t *conf = config_of(dev); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 290 | u32 reg32; |
| 291 | |
| 292 | /* Setup Digital Port Hotplug */ |
| 293 | reg32 = gtt_read(PCH_PORT_HOTPLUG); |
| 294 | if (!reg32) { |
| 295 | reg32 = (conf->gpu_dp_b_hotplug & 0x7) << 2; |
| 296 | reg32 |= (conf->gpu_dp_c_hotplug & 0x7) << 10; |
| 297 | reg32 |= (conf->gpu_dp_d_hotplug & 0x7) << 18; |
| 298 | gtt_write(PCH_PORT_HOTPLUG, reg32); |
| 299 | } |
| 300 | |
| 301 | /* Setup Panel Power On Delays */ |
| 302 | reg32 = gtt_read(PCH_PP_ON_DELAYS); |
| 303 | if (!reg32) { |
| 304 | reg32 = (conf->gpu_panel_port_select & 0x3) << 30; |
| 305 | reg32 |= (conf->gpu_panel_power_up_delay & 0x1fff) << 16; |
| 306 | reg32 |= (conf->gpu_panel_power_backlight_on_delay & 0x1fff); |
| 307 | gtt_write(PCH_PP_ON_DELAYS, reg32); |
| 308 | } |
| 309 | |
| 310 | /* Setup Panel Power Off Delays */ |
| 311 | reg32 = gtt_read(PCH_PP_OFF_DELAYS); |
| 312 | if (!reg32) { |
| 313 | reg32 = (conf->gpu_panel_power_down_delay & 0x1fff) << 16; |
| 314 | reg32 |= (conf->gpu_panel_power_backlight_off_delay & 0x1fff); |
| 315 | gtt_write(PCH_PP_OFF_DELAYS, reg32); |
| 316 | } |
| 317 | |
| 318 | /* Setup Panel Power Cycle Delay */ |
| 319 | if (conf->gpu_panel_power_cycle_delay) { |
| 320 | reg32 = gtt_read(PCH_PP_DIVISOR); |
| 321 | reg32 &= ~0xff; |
| 322 | reg32 |= conf->gpu_panel_power_cycle_delay & 0xff; |
| 323 | gtt_write(PCH_PP_DIVISOR, reg32); |
| 324 | } |
| 325 | |
Nico Huber | 3b57a7c | 2019-10-08 20:24:05 +0200 | [diff] [blame] | 326 | /* So far all devices seem to use the PCH PWM function. |
| 327 | The CPU PWM registers are all zero after reset. */ |
| 328 | if (conf->gpu_pch_backlight_pwm_hz) { |
| 329 | /* For Lynx Point-LP: |
| 330 | Reference clock is 24MHz. We can choose either a 16 |
| 331 | or a 128 step increment. Use 16 if we would have less |
| 332 | than 100 steps otherwise. */ |
| 333 | const unsigned int hz_limit = 24 * 1000 * 1000 / 128 / 100; |
| 334 | unsigned int pwm_increment, pwm_period; |
| 335 | u32 south_chicken2; |
| 336 | |
| 337 | south_chicken2 = gtt_read(SOUTH_CHICKEN2); |
| 338 | if (conf->gpu_pch_backlight_pwm_hz > hz_limit) { |
| 339 | pwm_increment = 16; |
Nico Huber | e47132b | 2020-03-23 01:33:23 +0100 | [diff] [blame] | 340 | south_chicken2 |= 1 << 5; |
Nico Huber | 3b57a7c | 2019-10-08 20:24:05 +0200 | [diff] [blame] | 341 | } else { |
| 342 | pwm_increment = 128; |
Nico Huber | e47132b | 2020-03-23 01:33:23 +0100 | [diff] [blame] | 343 | south_chicken2 &= ~(1 << 5); |
Nico Huber | 3b57a7c | 2019-10-08 20:24:05 +0200 | [diff] [blame] | 344 | } |
| 345 | gtt_write(SOUTH_CHICKEN2, south_chicken2); |
| 346 | |
| 347 | pwm_period = 24 * 1000 * 1000 / pwm_increment / conf->gpu_pch_backlight_pwm_hz; |
| 348 | /* Start with a 50% duty cycle. */ |
| 349 | gtt_write(BLC_PWM_PCH_CTL2, pwm_period << 16 | pwm_period / 2); |
| 350 | |
| 351 | gtt_write(BLC_PWM_PCH_CTL1, |
| 352 | (conf->gpu_pch_backlight_polarity == GPU_BACKLIGHT_POLARITY_LOW) << 29 | |
| 353 | BLM_PCH_OVERRIDE_ENABLE | BLM_PCH_PWM_ENABLE); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 354 | } |
| 355 | } |
| 356 | |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 357 | static int igd_get_cdclk_haswell(u32 *const cdsel, int *const inform_pc, |
| 358 | struct device *const dev) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 359 | { |
Kyösti Mälkki | 8950cfb | 2019-07-13 22:16:25 +0300 | [diff] [blame] | 360 | const config_t *const conf = config_of(dev); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 361 | int cdclk = conf->cdclk; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 362 | |
| 363 | /* Check for ULX GT1 or GT2 */ |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 364 | const int devid = pci_read_config16(dev, PCI_DEVICE_ID); |
| 365 | const int gpu_is_ulx = devid == IGD_HASWELL_ULX_GT1 || |
| 366 | devid == IGD_HASWELL_ULX_GT2; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 367 | |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 368 | /* Check for fixed fused clock */ |
| 369 | if (gtt_read(0x42014) & 1 << 24) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 370 | cdclk = GT_CDCLK_450; |
| 371 | |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 372 | /* |
| 373 | * ULX defaults to 337MHz with possible override for 450MHz |
| 374 | * ULT is fixed at 450MHz |
| 375 | * others default to 540MHz with possible override for 450MHz |
| 376 | */ |
| 377 | if (gpu_is_ulx && cdclk <= GT_CDCLK_337) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 378 | cdclk = GT_CDCLK_337; |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 379 | else if (gpu_is_ulx || cpu_is_ult() || |
| 380 | cdclk == GT_CDCLK_337 || cdclk == GT_CDCLK_450) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 381 | cdclk = GT_CDCLK_450; |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 382 | else |
| 383 | cdclk = GT_CDCLK_540; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 384 | |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 385 | *cdsel = cdclk != GT_CDCLK_450; |
| 386 | *inform_pc = gpu_is_ulx; |
| 387 | return cdclk; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 388 | } |
| 389 | |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 390 | static int igd_get_cdclk_broadwell(u32 *const cdsel, int *const inform_pc, |
| 391 | struct device *const dev) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 392 | { |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 393 | static const u32 cdsel_by_cdclk[] = { 0, 2, 0, 1, 3 }; |
Kyösti Mälkki | 8950cfb | 2019-07-13 22:16:25 +0300 | [diff] [blame] | 394 | const config_t *const conf = config_of(dev); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 395 | int cdclk = conf->cdclk; |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 396 | |
| 397 | /* Check for ULX */ |
| 398 | const int devid = pci_read_config16(dev, PCI_DEVICE_ID); |
| 399 | const int gpu_is_ulx = devid == IGD_BROADWELL_Y_GT2; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 400 | |
| 401 | /* Inform power controller of upcoming frequency change */ |
| 402 | gtt_write(0x138128, 0); |
| 403 | gtt_write(0x13812c, 0); |
| 404 | gtt_write(0x138124, 0x80000018); |
| 405 | |
| 406 | /* Poll GT driver mailbox for run/busy clear */ |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 407 | if (gtt_poll(0x138124, (1 << 31), (0 << 31))) { |
| 408 | *inform_pc = 1; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 409 | } else { |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 410 | cdclk = GT_CDCLK_450; |
| 411 | *inform_pc = 0; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 412 | } |
| 413 | |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 414 | /* Check for fixed fused clock */ |
| 415 | if (gtt_read(0x42014) & 1 << 24) |
| 416 | cdclk = GT_CDCLK_450; |
| 417 | |
| 418 | /* |
| 419 | * ULX defaults to 450MHz with possible override up to 540MHz |
| 420 | * ULT defaults to 540MHz with possible override up to 675MHz |
| 421 | * others default to 675MHz with possible override for lower freqs |
| 422 | */ |
| 423 | if (cdclk == GT_CDCLK_337) |
| 424 | cdclk = GT_CDCLK_337; |
| 425 | else if (cdclk == GT_CDCLK_450 || |
| 426 | (gpu_is_ulx && cdclk == GT_CDCLK_DEFAULT)) |
| 427 | cdclk = GT_CDCLK_450; |
| 428 | else if (cdclk == GT_CDCLK_540 || gpu_is_ulx || |
| 429 | (cpu_is_ult() && cdclk == GT_CDCLK_DEFAULT)) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 430 | cdclk = GT_CDCLK_540; |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 431 | else |
| 432 | cdclk = GT_CDCLK_675; |
| 433 | |
| 434 | *cdsel = cdsel_by_cdclk[cdclk]; |
| 435 | return cdclk; |
| 436 | } |
| 437 | |
| 438 | static void igd_cdclk_init(struct device *dev, const int is_broadwell) |
| 439 | { |
| 440 | u32 dpdiv, cdsel, cdval; |
| 441 | int cdclk, inform_pc; |
| 442 | |
| 443 | if (is_broadwell) |
| 444 | cdclk = igd_get_cdclk_broadwell(&cdsel, &inform_pc, dev); |
| 445 | else |
| 446 | cdclk = igd_get_cdclk_haswell(&cdsel, &inform_pc, dev); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 447 | |
| 448 | /* Set variables based on CD Clock setting */ |
| 449 | switch (cdclk) { |
| 450 | case GT_CDCLK_337: |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 451 | cdval = 337; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 452 | dpdiv = 169; |
Matt DeVillier | f8960a6 | 2016-11-16 23:37:43 -0600 | [diff] [blame] | 453 | reg_em4 = 16; |
| 454 | reg_em5 = 225; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 455 | break; |
| 456 | case GT_CDCLK_450: |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 457 | cdval = 449; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 458 | dpdiv = 225; |
Matt DeVillier | f8960a6 | 2016-11-16 23:37:43 -0600 | [diff] [blame] | 459 | reg_em4 = 4; |
| 460 | reg_em5 = 75; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 461 | break; |
| 462 | case GT_CDCLK_540: |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 463 | cdval = 539; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 464 | dpdiv = 270; |
Matt DeVillier | f8960a6 | 2016-11-16 23:37:43 -0600 | [diff] [blame] | 465 | reg_em4 = 4; |
| 466 | reg_em5 = 90; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 467 | break; |
| 468 | case GT_CDCLK_675: |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 469 | cdval = 674; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 470 | dpdiv = 338; |
Matt DeVillier | f8960a6 | 2016-11-16 23:37:43 -0600 | [diff] [blame] | 471 | reg_em4 = 8; |
| 472 | reg_em5 = 225; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 473 | default: |
| 474 | return; |
| 475 | } |
| 476 | |
| 477 | /* Set LPCLL_CTL CD Clock Frequency Select */ |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 478 | gtt_rmw(0x130040, 0xf3ffffff, cdsel << 26); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 479 | |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 480 | if (inform_pc) { |
| 481 | /* Inform power controller of selected frequency */ |
| 482 | gtt_write(0x138128, cdsel); |
| 483 | gtt_write(0x13812c, 0); |
| 484 | gtt_write(0x138124, 0x80000017); |
| 485 | } |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 486 | |
| 487 | /* Program CD Clock Frequency */ |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 488 | gtt_rmw(0x46200, 0xfffffc00, cdval); |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 489 | |
| 490 | /* Set CPU DP AUX 2X bit clock dividers */ |
| 491 | gtt_rmw(0x64010, 0xfffff800, dpdiv); |
| 492 | gtt_rmw(0x64810, 0xfffff800, dpdiv); |
| 493 | } |
| 494 | |
Matt DeVillier | 773488f | 2017-10-18 12:27:25 -0500 | [diff] [blame] | 495 | uintptr_t gma_get_gnvs_aslb(const void *gnvs) |
| 496 | { |
| 497 | const global_nvs_t *gnvs_ptr = gnvs; |
| 498 | return (uintptr_t)(gnvs_ptr ? gnvs_ptr->aslb : 0); |
| 499 | } |
| 500 | |
| 501 | void gma_set_gnvs_aslb(void *gnvs, uintptr_t aslb) |
| 502 | { |
| 503 | global_nvs_t *gnvs_ptr = gnvs; |
| 504 | if (gnvs_ptr) |
| 505 | gnvs_ptr->aslb = aslb; |
| 506 | } |
| 507 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 508 | static void igd_init(struct device *dev) |
| 509 | { |
| 510 | int is_broadwell = !!(cpu_family_model() == BROADWELL_FAMILY_ULT); |
| 511 | u32 rp1_gfx_freq; |
| 512 | |
| 513 | /* IGD needs to be Bus Master */ |
| 514 | u32 reg32 = pci_read_config32(dev, PCI_COMMAND); |
| 515 | reg32 |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO; |
| 516 | pci_write_config32(dev, PCI_COMMAND, reg32); |
| 517 | |
| 518 | gtt_res = find_resource(dev, PCI_BASE_ADDRESS_0); |
| 519 | if (!gtt_res || !gtt_res->base) |
| 520 | return; |
| 521 | |
| 522 | /* Wait for any configured pre-graphics delay */ |
Kyösti Mälkki | 1ec23c9 | 2015-05-29 06:18:18 +0300 | [diff] [blame] | 523 | if (!acpi_is_wakeup_s3()) { |
Julius Werner | cd49cce | 2019-03-05 16:53:33 -0800 | [diff] [blame] | 524 | #if CONFIG(CHROMEOS) |
Joel Kitching | 807803a | 2019-05-10 12:58:53 +0800 | [diff] [blame] | 525 | if (display_init_required()) |
Duncan Laurie | 1e6b591 | 2015-01-30 16:33:43 -0800 | [diff] [blame] | 526 | mdelay(CONFIG_PRE_GRAPHICS_DELAY); |
Duncan Laurie | b8a7b71 | 2014-11-10 13:00:27 -0800 | [diff] [blame] | 527 | #else |
Duncan Laurie | 1e6b591 | 2015-01-30 16:33:43 -0800 | [diff] [blame] | 528 | mdelay(CONFIG_PRE_GRAPHICS_DELAY); |
Duncan Laurie | b8a7b71 | 2014-11-10 13:00:27 -0800 | [diff] [blame] | 529 | #endif |
Duncan Laurie | 1e6b591 | 2015-01-30 16:33:43 -0800 | [diff] [blame] | 530 | } |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 531 | |
| 532 | /* Early init steps */ |
| 533 | if (is_broadwell) { |
| 534 | reg_script_run_on_dev(dev, broadwell_early_init_script); |
Duncan Laurie | 84b9cf4 | 2014-07-31 10:46:57 -0700 | [diff] [blame] | 535 | |
| 536 | /* Set GFXPAUSE based on stepping */ |
| 537 | if (cpu_stepping() <= (CPUID_BROADWELL_E0 & 0xf) && |
| 538 | systemagent_revision() <= 9) { |
| 539 | gtt_write(0xa000, 0x300ff); |
| 540 | } else { |
| 541 | gtt_write(0xa000, 0x30020); |
| 542 | } |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 543 | } else { |
| 544 | reg_script_run_on_dev(dev, haswell_early_init_script); |
| 545 | } |
| 546 | |
| 547 | /* Set RP1 graphics frequency */ |
| 548 | rp1_gfx_freq = (MCHBAR32(0x5998) >> 8) & 0xff; |
| 549 | gtt_write(0xa008, rp1_gfx_freq << 24); |
| 550 | |
| 551 | /* Post VBIOS panel setup */ |
| 552 | igd_setup_panel(dev); |
| 553 | |
| 554 | /* Initialize PCI device, load/execute BIOS Option ROM */ |
| 555 | pci_dev_init(dev); |
| 556 | |
| 557 | /* Late init steps */ |
Nico Huber | e392f41 | 2016-12-07 19:29:08 +0100 | [diff] [blame] | 558 | igd_cdclk_init(dev, is_broadwell); |
Lee Leahy | 8a9c7dc | 2017-03-17 10:43:25 -0700 | [diff] [blame] | 559 | if (is_broadwell) |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 560 | reg_script_run_on_dev(dev, broadwell_late_init_script); |
Lee Leahy | 8a9c7dc | 2017-03-17 10:43:25 -0700 | [diff] [blame] | 561 | else |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 562 | reg_script_run_on_dev(dev, haswell_late_init_script); |
Duncan Laurie | 6168027 | 2014-05-05 12:42:35 -0500 | [diff] [blame] | 563 | |
Duncan Laurie | 49efaf2 | 2014-10-09 16:13:24 -0700 | [diff] [blame] | 564 | if (gfx_get_init_done()) { |
| 565 | /* |
| 566 | * Work around VBIOS issue that is not clearing first 64 |
| 567 | * bytes of the framebuffer during VBE mode set. |
| 568 | */ |
| 569 | struct resource *fb = find_resource(dev, PCI_BASE_ADDRESS_2); |
| 570 | memset((void *)((u32)fb->base), 0, 64); |
| 571 | } |
| 572 | |
Kyösti Mälkki | 1ec23c9 | 2015-05-29 06:18:18 +0300 | [diff] [blame] | 573 | if (!gfx_get_init_done() && !acpi_is_wakeup_s3()) { |
Duncan Laurie | 6168027 | 2014-05-05 12:42:35 -0500 | [diff] [blame] | 574 | /* |
| 575 | * Enable DDI-A if the Option ROM did not execute: |
| 576 | * |
| 577 | * bit 0: Display detected (RO) |
| 578 | * bit 4: DDI A supports 4 lanes and DDI E is not used |
| 579 | * bit 7: DDI buffer is idle |
| 580 | */ |
| 581 | gtt_write(DDI_BUF_CTL_A, DDI_BUF_IS_IDLE | DDI_A_4_LANES | |
| 582 | DDI_INIT_DISPLAY_DETECTED); |
| 583 | } |
Matt DeVillier | 773488f | 2017-10-18 12:27:25 -0500 | [diff] [blame] | 584 | |
Nico Huber | a06689c | 2019-10-08 20:56:41 +0200 | [diff] [blame] | 585 | if (CONFIG(MAINBOARD_USE_LIBGFXINIT)) { |
| 586 | int lightup_ok; |
| 587 | gma_gfxinit(&lightup_ok); |
| 588 | gfx_set_init_done(lightup_ok); |
| 589 | } |
| 590 | |
Matt DeVillier | 773488f | 2017-10-18 12:27:25 -0500 | [diff] [blame] | 591 | intel_gma_restore_opregion(); |
| 592 | } |
| 593 | |
| 594 | static unsigned long |
Furquan Shaikh | 0f007d8 | 2020-04-24 06:41:18 -0700 | [diff] [blame] | 595 | gma_write_acpi_tables(const struct device *const dev, unsigned long current, |
Matt DeVillier | 773488f | 2017-10-18 12:27:25 -0500 | [diff] [blame] | 596 | struct acpi_rsdp *const rsdp) |
| 597 | { |
| 598 | igd_opregion_t *opregion = (igd_opregion_t *)current; |
| 599 | global_nvs_t *gnvs; |
| 600 | |
| 601 | if (intel_gma_init_igd_opregion(opregion) != CB_SUCCESS) |
| 602 | return current; |
| 603 | |
| 604 | current += sizeof(igd_opregion_t); |
| 605 | |
| 606 | /* GNVS has been already set up */ |
| 607 | gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); |
| 608 | if (gnvs) { |
| 609 | /* IGD OpRegion Base Address */ |
| 610 | gma_set_gnvs_aslb(gnvs, (uintptr_t)opregion); |
| 611 | } else { |
| 612 | printk(BIOS_ERR, "Error: GNVS table not found.\n"); |
| 613 | } |
| 614 | |
| 615 | current = acpi_align_current(current); |
| 616 | return current; |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 617 | } |
| 618 | |
Matt DeVillier | 53e2446 | 2016-08-05 02:20:15 -0500 | [diff] [blame] | 619 | static void gma_generate_ssdt(struct device *dev) |
| 620 | { |
| 621 | const struct soc_intel_broadwell_config *chip = dev->chip_info; |
| 622 | |
| 623 | drivers_intel_gma_displays_ssdt_generate(&chip->gfx); |
| 624 | } |
| 625 | |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 626 | static struct device_operations igd_ops = { |
Marc Jones | a6354a1 | 2014-12-26 22:11:14 -0700 | [diff] [blame] | 627 | .read_resources = &pci_dev_read_resources, |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 628 | .set_resources = &pci_dev_set_resources, |
| 629 | .enable_resources = &pci_dev_enable_resources, |
| 630 | .init = &igd_init, |
| 631 | .ops_pci = &broadwell_pci_ops, |
Matt DeVillier | 773488f | 2017-10-18 12:27:25 -0500 | [diff] [blame] | 632 | .write_acpi_tables = gma_write_acpi_tables, |
Matt DeVillier | 53e2446 | 2016-08-05 02:20:15 -0500 | [diff] [blame] | 633 | .acpi_fill_ssdt = gma_generate_ssdt, |
Duncan Laurie | c88c54c | 2014-04-30 16:36:13 -0700 | [diff] [blame] | 634 | }; |
| 635 | |
| 636 | static const unsigned short pci_device_ids[] = { |
| 637 | IGD_HASWELL_ULT_GT1, |
| 638 | IGD_HASWELL_ULT_GT2, |
| 639 | IGD_HASWELL_ULT_GT3, |
| 640 | IGD_BROADWELL_U_GT1, |
| 641 | IGD_BROADWELL_U_GT2, |
| 642 | IGD_BROADWELL_U_GT3_15W, |
| 643 | IGD_BROADWELL_U_GT3_28W, |
| 644 | IGD_BROADWELL_Y_GT2, |
| 645 | IGD_BROADWELL_H_GT2, |
| 646 | IGD_BROADWELL_H_GT3, |
| 647 | 0, |
| 648 | }; |
| 649 | |
| 650 | static const struct pci_driver igd_driver __pci_driver = { |
| 651 | .ops = &igd_ops, |
| 652 | .vendor = PCI_VENDOR_ID_INTEL, |
| 653 | .devices = pci_device_ids, |
| 654 | }; |