Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
| 3 | * |
| 4 | * Copyright (C) 2011 Chromium OS Authors |
| 5 | * Copyright (C) 2013 Vladimir Serbinenko |
| 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. |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 15 | */ |
| 16 | |
| 17 | #include <arch/io.h> |
| 18 | #include <console/console.h> |
| 19 | #include <delay.h> |
| 20 | #include <device/device.h> |
| 21 | #include <device/pci.h> |
| 22 | #include <device/pci_ids.h> |
| 23 | #include <string.h> |
| 24 | #include <device/pci_ops.h> |
| 25 | #include <cpu/x86/msr.h> |
| 26 | #include <cpu/x86/mtrr.h> |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 27 | #include <drivers/intel/gma/edid.h> |
| 28 | #include <drivers/intel/gma/i915.h> |
| 29 | #include <pc80/vga.h> |
| 30 | #include <pc80/vga_io.h> |
Vladimir Serbinenko | 5aa28f5 | 2014-05-31 22:26:42 +0200 | [diff] [blame] | 31 | #include <drivers/intel/gma/intel_bios.h> |
Patrick Rudolph | 2be2840 | 2017-04-12 16:54:55 +0200 | [diff] [blame] | 32 | #include <southbridge/intel/ibexpeak/nvs.h> |
| 33 | #include <cbmem.h> |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 34 | |
| 35 | #include "chip.h" |
| 36 | #include "nehalem.h" |
| 37 | |
| 38 | struct gt_powermeter { |
| 39 | u16 reg; |
| 40 | u32 value; |
| 41 | }; |
| 42 | |
| 43 | static const struct gt_powermeter snb_pm_gt1[] = { |
| 44 | {0xa200, 0xcc000000}, |
| 45 | {0xa204, 0x07000040}, |
| 46 | {0xa208, 0x0000fe00}, |
| 47 | {0xa20c, 0x00000000}, |
| 48 | {0xa210, 0x17000000}, |
| 49 | {0xa214, 0x00000021}, |
| 50 | {0xa218, 0x0817fe19}, |
| 51 | {0xa21c, 0x00000000}, |
| 52 | {0xa220, 0x00000000}, |
| 53 | {0xa224, 0xcc000000}, |
| 54 | {0xa228, 0x07000040}, |
| 55 | {0xa22c, 0x0000fe00}, |
| 56 | {0xa230, 0x00000000}, |
| 57 | {0xa234, 0x17000000}, |
| 58 | {0xa238, 0x00000021}, |
| 59 | {0xa23c, 0x0817fe19}, |
| 60 | {0xa240, 0x00000000}, |
| 61 | {0xa244, 0x00000000}, |
| 62 | {0xa248, 0x8000421e}, |
| 63 | {0} |
| 64 | }; |
| 65 | |
| 66 | static const struct gt_powermeter snb_pm_gt2[] = { |
| 67 | {0xa200, 0x330000a6}, |
| 68 | {0xa204, 0x402d0031}, |
| 69 | {0xa208, 0x00165f83}, |
| 70 | {0xa20c, 0xf1000000}, |
| 71 | {0xa210, 0x00000000}, |
| 72 | {0xa214, 0x00160016}, |
| 73 | {0xa218, 0x002a002b}, |
| 74 | {0xa21c, 0x00000000}, |
| 75 | {0xa220, 0x00000000}, |
| 76 | {0xa224, 0x330000a6}, |
| 77 | {0xa228, 0x402d0031}, |
| 78 | {0xa22c, 0x00165f83}, |
| 79 | {0xa230, 0xf1000000}, |
| 80 | {0xa234, 0x00000000}, |
| 81 | {0xa238, 0x00160016}, |
| 82 | {0xa23c, 0x002a002b}, |
| 83 | {0xa240, 0x00000000}, |
| 84 | {0xa244, 0x00000000}, |
| 85 | {0xa248, 0x8000421e}, |
| 86 | {0} |
| 87 | }; |
| 88 | |
| 89 | static const struct gt_powermeter ivb_pm_gt1[] = { |
| 90 | {0xa800, 0x00000000}, |
| 91 | {0xa804, 0x00021c00}, |
| 92 | {0xa808, 0x00000403}, |
| 93 | {0xa80c, 0x02001700}, |
| 94 | {0xa810, 0x05000200}, |
| 95 | {0xa814, 0x00000000}, |
| 96 | {0xa818, 0x00690500}, |
| 97 | {0xa81c, 0x0000007f}, |
| 98 | {0xa820, 0x01002501}, |
| 99 | {0xa824, 0x00000300}, |
| 100 | {0xa828, 0x01000331}, |
| 101 | {0xa82c, 0x0000000c}, |
| 102 | {0xa830, 0x00010016}, |
| 103 | {0xa834, 0x01100101}, |
| 104 | {0xa838, 0x00010103}, |
| 105 | {0xa83c, 0x00041300}, |
| 106 | {0xa840, 0x00000b30}, |
| 107 | {0xa844, 0x00000000}, |
| 108 | {0xa848, 0x7f000000}, |
| 109 | {0xa84c, 0x05000008}, |
| 110 | {0xa850, 0x00000001}, |
| 111 | {0xa854, 0x00000004}, |
| 112 | {0xa858, 0x00000007}, |
| 113 | {0xa85c, 0x00000000}, |
| 114 | {0xa860, 0x00010000}, |
| 115 | {0xa248, 0x0000221e}, |
| 116 | {0xa900, 0x00000000}, |
| 117 | {0xa904, 0x00001c00}, |
| 118 | {0xa908, 0x00000000}, |
| 119 | {0xa90c, 0x06000000}, |
| 120 | {0xa910, 0x09000200}, |
| 121 | {0xa914, 0x00000000}, |
| 122 | {0xa918, 0x00590000}, |
| 123 | {0xa91c, 0x00000000}, |
| 124 | {0xa920, 0x04002501}, |
| 125 | {0xa924, 0x00000100}, |
| 126 | {0xa928, 0x03000410}, |
| 127 | {0xa92c, 0x00000000}, |
| 128 | {0xa930, 0x00020000}, |
| 129 | {0xa934, 0x02070106}, |
| 130 | {0xa938, 0x00010100}, |
| 131 | {0xa93c, 0x00401c00}, |
| 132 | {0xa940, 0x00000000}, |
| 133 | {0xa944, 0x00000000}, |
| 134 | {0xa948, 0x10000e00}, |
| 135 | {0xa94c, 0x02000004}, |
| 136 | {0xa950, 0x00000001}, |
| 137 | {0xa954, 0x00000004}, |
| 138 | {0xa960, 0x00060000}, |
| 139 | {0xaa3c, 0x00001c00}, |
| 140 | {0xaa54, 0x00000004}, |
| 141 | {0xaa60, 0x00060000}, |
| 142 | {0} |
| 143 | }; |
| 144 | |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 145 | static const struct gt_powermeter ivb_pm_gt2_17w[] = { |
| 146 | {0xa800, 0x20000000}, |
| 147 | {0xa804, 0x000e3800}, |
| 148 | {0xa808, 0x00000806}, |
| 149 | {0xa80c, 0x0c002f00}, |
| 150 | {0xa810, 0x0c000800}, |
| 151 | {0xa814, 0x00000000}, |
| 152 | {0xa818, 0x00d20d00}, |
| 153 | {0xa81c, 0x000000ff}, |
| 154 | {0xa820, 0x03004b02}, |
| 155 | {0xa824, 0x00000600}, |
| 156 | {0xa828, 0x07000773}, |
| 157 | {0xa82c, 0x00000000}, |
| 158 | {0xa830, 0x00020032}, |
| 159 | {0xa834, 0x1520040d}, |
| 160 | {0xa838, 0x00020105}, |
| 161 | {0xa83c, 0x00083700}, |
| 162 | {0xa840, 0x000016ff}, |
| 163 | {0xa844, 0x00000000}, |
| 164 | {0xa848, 0xff000000}, |
| 165 | {0xa84c, 0x0a000010}, |
| 166 | {0xa850, 0x00000002}, |
| 167 | {0xa854, 0x00000008}, |
| 168 | {0xa858, 0x0000000f}, |
| 169 | {0xa85c, 0x00000000}, |
| 170 | {0xa860, 0x00020000}, |
| 171 | {0xa248, 0x0000221e}, |
| 172 | {0xa900, 0x00000000}, |
| 173 | {0xa904, 0x00003800}, |
| 174 | {0xa908, 0x00000000}, |
| 175 | {0xa90c, 0x0c000000}, |
| 176 | {0xa910, 0x12000800}, |
| 177 | {0xa914, 0x00000000}, |
| 178 | {0xa918, 0x00b20000}, |
| 179 | {0xa91c, 0x00000000}, |
| 180 | {0xa920, 0x08004b02}, |
| 181 | {0xa924, 0x00000300}, |
| 182 | {0xa928, 0x01000820}, |
| 183 | {0xa92c, 0x00000000}, |
| 184 | {0xa930, 0x00030000}, |
| 185 | {0xa934, 0x15150406}, |
| 186 | {0xa938, 0x00020300}, |
| 187 | {0xa93c, 0x00903900}, |
| 188 | {0xa940, 0x00000000}, |
| 189 | {0xa944, 0x00000000}, |
| 190 | {0xa948, 0x20001b00}, |
| 191 | {0xa94c, 0x0a000010}, |
| 192 | {0xa950, 0x00000000}, |
| 193 | {0xa954, 0x00000008}, |
| 194 | {0xa960, 0x00110000}, |
| 195 | {0xaa3c, 0x00003900}, |
| 196 | {0xaa54, 0x00000008}, |
| 197 | {0xaa60, 0x00110000}, |
| 198 | {0} |
| 199 | }; |
| 200 | |
| 201 | static const struct gt_powermeter ivb_pm_gt2_35w[] = { |
| 202 | {0xa800, 0x00000000}, |
| 203 | {0xa804, 0x00030400}, |
| 204 | {0xa808, 0x00000806}, |
| 205 | {0xa80c, 0x0c002f00}, |
| 206 | {0xa810, 0x0c000300}, |
| 207 | {0xa814, 0x00000000}, |
| 208 | {0xa818, 0x00d20d00}, |
| 209 | {0xa81c, 0x000000ff}, |
| 210 | {0xa820, 0x03004b02}, |
| 211 | {0xa824, 0x00000600}, |
| 212 | {0xa828, 0x07000773}, |
| 213 | {0xa82c, 0x00000000}, |
| 214 | {0xa830, 0x00020032}, |
| 215 | {0xa834, 0x1520040d}, |
| 216 | {0xa838, 0x00020105}, |
| 217 | {0xa83c, 0x00083700}, |
| 218 | {0xa840, 0x000016ff}, |
| 219 | {0xa844, 0x00000000}, |
| 220 | {0xa848, 0xff000000}, |
| 221 | {0xa84c, 0x0a000010}, |
| 222 | {0xa850, 0x00000001}, |
| 223 | {0xa854, 0x00000008}, |
| 224 | {0xa858, 0x00000008}, |
| 225 | {0xa85c, 0x00000000}, |
| 226 | {0xa860, 0x00020000}, |
| 227 | {0xa248, 0x0000221e}, |
| 228 | {0xa900, 0x00000000}, |
| 229 | {0xa904, 0x00003800}, |
| 230 | {0xa908, 0x00000000}, |
| 231 | {0xa90c, 0x0c000000}, |
| 232 | {0xa910, 0x12000800}, |
| 233 | {0xa914, 0x00000000}, |
| 234 | {0xa918, 0x00b20000}, |
| 235 | {0xa91c, 0x00000000}, |
| 236 | {0xa920, 0x08004b02}, |
| 237 | {0xa924, 0x00000300}, |
| 238 | {0xa928, 0x01000820}, |
| 239 | {0xa92c, 0x00000000}, |
| 240 | {0xa930, 0x00030000}, |
| 241 | {0xa934, 0x15150406}, |
| 242 | {0xa938, 0x00020300}, |
| 243 | {0xa93c, 0x00903900}, |
| 244 | {0xa940, 0x00000000}, |
| 245 | {0xa944, 0x00000000}, |
| 246 | {0xa948, 0x20001b00}, |
| 247 | {0xa94c, 0x0a000010}, |
| 248 | {0xa950, 0x00000000}, |
| 249 | {0xa954, 0x00000008}, |
| 250 | {0xa960, 0x00110000}, |
| 251 | {0xaa3c, 0x00003900}, |
| 252 | {0xaa54, 0x00000008}, |
| 253 | {0xaa60, 0x00110000}, |
| 254 | {0} |
| 255 | }; |
| 256 | |
| 257 | /* some vga option roms are used for several chipsets but they only have one |
| 258 | * PCI ID in their header. If we encounter such an option rom, we need to do |
Martin Roth | 128c104 | 2016-11-18 09:29:03 -0700 | [diff] [blame] | 259 | * the mapping ourselves |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 260 | */ |
| 261 | |
| 262 | u32 map_oprom_vendev(u32 vendev) |
| 263 | { |
| 264 | u32 new_vendev = vendev; |
| 265 | |
Martin Roth | 128c104 | 2016-11-18 09:29:03 -0700 | [diff] [blame] | 266 | /* none currently. */ |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 267 | |
| 268 | return new_vendev; |
| 269 | } |
| 270 | |
| 271 | static struct resource *gtt_res = NULL; |
| 272 | |
Furquan Shaikh | 77f48cd | 2013-08-19 10:16:50 -0700 | [diff] [blame] | 273 | u32 gtt_read(u32 reg) |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 274 | { |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 275 | return read32(res2mmio(gtt_res, reg, 0)); |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 276 | } |
| 277 | |
Furquan Shaikh | 77f48cd | 2013-08-19 10:16:50 -0700 | [diff] [blame] | 278 | void gtt_write(u32 reg, u32 data) |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 279 | { |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 280 | write32(res2mmio(gtt_res, reg, 0), data); |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 281 | } |
| 282 | |
| 283 | static inline void gtt_write_powermeter(const struct gt_powermeter *pm) |
| 284 | { |
| 285 | for (; pm && pm->reg; pm++) |
| 286 | gtt_write(pm->reg, pm->value); |
| 287 | } |
| 288 | |
| 289 | #define GTT_RETRY 1000 |
Ronald G. Minnich | 9518b56 | 2013-09-19 16:45:22 -0700 | [diff] [blame] | 290 | int gtt_poll(u32 reg, u32 mask, u32 value) |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 291 | { |
| 292 | unsigned try = GTT_RETRY; |
| 293 | u32 data; |
| 294 | |
| 295 | while (try--) { |
| 296 | data = gtt_read(reg); |
| 297 | if ((data & mask) == value) |
| 298 | return 1; |
| 299 | udelay(10); |
| 300 | } |
| 301 | |
| 302 | printk(BIOS_ERR, "GT init timeout\n"); |
| 303 | return 0; |
| 304 | } |
| 305 | |
| 306 | static void gma_pm_init_pre_vbios(struct device *dev) |
| 307 | { |
| 308 | u32 reg32; |
| 309 | |
| 310 | printk(BIOS_DEBUG, "GT Power Management Init\n"); |
| 311 | |
| 312 | gtt_res = find_resource(dev, PCI_BASE_ADDRESS_0); |
| 313 | if (!gtt_res || !gtt_res->base) |
| 314 | return; |
| 315 | |
| 316 | if (bridge_silicon_revision() < IVB_STEP_C0) { |
| 317 | /* 1: Enable force wake */ |
| 318 | gtt_write(0xa18c, 0x00000001); |
| 319 | gtt_poll(0x130090, (1 << 0), (1 << 0)); |
| 320 | } else { |
| 321 | gtt_write(0xa180, 1 << 5); |
| 322 | gtt_write(0xa188, 0xffff0001); |
| 323 | gtt_poll(0x130040, (1 << 0), (1 << 0)); |
| 324 | } |
| 325 | |
| 326 | if ((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_SNB) { |
| 327 | /* 1d: Set GTT+0x42004 [15:14]=11 (SnB C1+) */ |
| 328 | reg32 = gtt_read(0x42004); |
| 329 | reg32 |= (1 << 14) | (1 << 15); |
| 330 | gtt_write(0x42004, reg32); |
| 331 | } |
| 332 | |
| 333 | if (bridge_silicon_revision() >= IVB_STEP_A0) { |
| 334 | /* Display Reset Acknowledge Settings */ |
| 335 | reg32 = gtt_read(0x45010); |
| 336 | reg32 |= (1 << 1) | (1 << 0); |
| 337 | gtt_write(0x45010, reg32); |
| 338 | } |
| 339 | |
| 340 | /* 2: Get GT SKU from GTT+0x911c[13] */ |
| 341 | reg32 = gtt_read(0x911c); |
| 342 | if ((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_SNB) { |
| 343 | if (reg32 & (1 << 13)) { |
| 344 | printk(BIOS_DEBUG, "SNB GT1 Power Meter Weights\n"); |
| 345 | gtt_write_powermeter(snb_pm_gt1); |
| 346 | } else { |
| 347 | printk(BIOS_DEBUG, "SNB GT2 Power Meter Weights\n"); |
| 348 | gtt_write_powermeter(snb_pm_gt2); |
| 349 | } |
| 350 | } else { |
| 351 | u32 unit = MCHBAR32(0x5938) & 0xf; |
| 352 | |
| 353 | if (reg32 & (1 << 13)) { |
| 354 | /* GT1 SKU */ |
| 355 | printk(BIOS_DEBUG, "IVB GT1 Power Meter Weights\n"); |
| 356 | gtt_write_powermeter(ivb_pm_gt1); |
| 357 | } else { |
| 358 | /* GT2 SKU */ |
| 359 | u32 tdp = MCHBAR32(0x5930) & 0x7fff; |
| 360 | tdp /= (1 << unit); |
| 361 | |
| 362 | if (tdp <= 17) { |
| 363 | /* <=17W ULV */ |
| 364 | printk(BIOS_DEBUG, "IVB GT2 17W " |
| 365 | "Power Meter Weights\n"); |
| 366 | gtt_write_powermeter(ivb_pm_gt2_17w); |
| 367 | } else if ((tdp >= 25) && (tdp <= 35)) { |
| 368 | /* 25W-35W */ |
| 369 | printk(BIOS_DEBUG, "IVB GT2 25W-35W " |
| 370 | "Power Meter Weights\n"); |
| 371 | gtt_write_powermeter(ivb_pm_gt2_35w); |
| 372 | } else { |
| 373 | /* All others */ |
| 374 | printk(BIOS_DEBUG, "IVB GT2 35W " |
| 375 | "Power Meter Weights\n"); |
| 376 | gtt_write_powermeter(ivb_pm_gt2_35w); |
| 377 | } |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | /* 3: Gear ratio map */ |
| 382 | gtt_write(0xa004, 0x00000010); |
| 383 | |
| 384 | /* 4: GFXPAUSE */ |
| 385 | gtt_write(0xa000, 0x00070020); |
| 386 | |
| 387 | /* 5: Dynamic EU trip control */ |
| 388 | gtt_write(0xa080, 0x00000004); |
| 389 | |
| 390 | /* 6: ECO bits */ |
| 391 | reg32 = gtt_read(0xa180); |
| 392 | reg32 |= (1 << 26) | (1 << 31); |
| 393 | /* (bit 20=1 for SNB step D1+ / IVB A0+) */ |
| 394 | if (bridge_silicon_revision() >= SNB_STEP_D1) |
| 395 | reg32 |= (1 << 20); |
| 396 | gtt_write(0xa180, reg32); |
| 397 | |
| 398 | /* 6a: for SnB step D2+ only */ |
| 399 | if (((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_SNB) && |
| 400 | (bridge_silicon_revision() >= SNB_STEP_D2)) { |
| 401 | reg32 = gtt_read(0x9400); |
| 402 | reg32 |= (1 << 7); |
| 403 | gtt_write(0x9400, reg32); |
| 404 | |
| 405 | reg32 = gtt_read(0x941c); |
| 406 | reg32 &= 0xf; |
| 407 | reg32 |= (1 << 1); |
| 408 | gtt_write(0x941c, reg32); |
| 409 | gtt_poll(0x941c, (1 << 1), (0 << 1)); |
| 410 | } |
| 411 | |
| 412 | if ((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_IVB) { |
| 413 | reg32 = gtt_read(0x907c); |
| 414 | reg32 |= (1 << 16); |
| 415 | gtt_write(0x907c, reg32); |
| 416 | |
| 417 | /* 6b: Clocking reset controls */ |
| 418 | gtt_write(0x9424, 0x00000001); |
| 419 | } else { |
| 420 | /* 6b: Clocking reset controls */ |
| 421 | gtt_write(0x9424, 0x00000000); |
| 422 | } |
| 423 | |
| 424 | /* 7 */ |
| 425 | if (gtt_poll(0x138124, (1 << 31), (0 << 31))) { |
| 426 | gtt_write(0x138128, 0x00000029); /* Mailbox Data */ |
| 427 | gtt_write(0x138124, 0x80000004); /* Mailbox Cmd for RC6 VID */ |
| 428 | if (gtt_poll(0x138124, (1 << 31), (0 << 31))) |
| 429 | gtt_write(0x138124, 0x8000000a); |
| 430 | gtt_poll(0x138124, (1 << 31), (0 << 31)); |
| 431 | } |
| 432 | |
| 433 | /* 8 */ |
| 434 | gtt_write(0xa090, 0x00000000); /* RC Control */ |
| 435 | gtt_write(0xa098, 0x03e80000); /* RC1e Wake Rate Limit */ |
| 436 | gtt_write(0xa09c, 0x0028001e); /* RC6/6p Wake Rate Limit */ |
| 437 | gtt_write(0xa0a0, 0x0000001e); /* RC6pp Wake Rate Limit */ |
| 438 | gtt_write(0xa0a8, 0x0001e848); /* RC Evaluation Interval */ |
| 439 | gtt_write(0xa0ac, 0x00000019); /* RC Idle Hysteresis */ |
| 440 | |
| 441 | /* 9 */ |
| 442 | gtt_write(0x2054, 0x0000000a); /* Render Idle Max Count */ |
| 443 | gtt_write(0x12054, 0x0000000a); /* Video Idle Max Count */ |
| 444 | gtt_write(0x22054, 0x0000000a); /* Blitter Idle Max Count */ |
| 445 | |
| 446 | /* 10 */ |
| 447 | gtt_write(0xa0b0, 0x00000000); /* Unblock Ack to Busy */ |
| 448 | gtt_write(0xa0b4, 0x000003e8); /* RC1e Threshold */ |
| 449 | gtt_write(0xa0b8, 0x0000c350); /* RC6 Threshold */ |
| 450 | gtt_write(0xa0bc, 0x000186a0); /* RC6p Threshold */ |
| 451 | gtt_write(0xa0c0, 0x0000fa00); /* RC6pp Threshold */ |
| 452 | |
| 453 | /* 11 */ |
| 454 | gtt_write(0xa010, 0x000f4240); /* RP Down Timeout */ |
| 455 | gtt_write(0xa014, 0x12060000); /* RP Interrupt Limits */ |
| 456 | gtt_write(0xa02c, 0x00015f90); /* RP Up Threshold */ |
| 457 | gtt_write(0xa030, 0x000186a0); /* RP Down Threshold */ |
| 458 | gtt_write(0xa068, 0x000186a0); /* RP Up EI */ |
| 459 | gtt_write(0xa06c, 0x000493e0); /* RP Down EI */ |
| 460 | gtt_write(0xa070, 0x0000000a); /* RP Idle Hysteresis */ |
| 461 | |
| 462 | /* 11a: Enable Render Standby (RC6) */ |
| 463 | if ((bridge_silicon_revision() & BASE_REV_MASK) == BASE_REV_IVB) { |
| 464 | /* |
| 465 | * IvyBridge should also support DeepRenderStandby. |
| 466 | * |
| 467 | * Unfortunately it does not work reliably on all SKUs so |
| 468 | * disable it here and it can be enabled by the kernel. |
| 469 | */ |
| 470 | gtt_write(0xa090, 0x88040000); /* HW RC Control */ |
| 471 | } else { |
| 472 | gtt_write(0xa090, 0x88040000); /* HW RC Control */ |
| 473 | } |
| 474 | |
| 475 | /* 12: Normal Frequency Request */ |
| 476 | /* RPNFREQ_VAL comes from MCHBAR 0x5998 23:16 (8 bits!? use 7) */ |
| 477 | reg32 = MCHBAR32(0x5998); |
| 478 | reg32 >>= 16; |
| 479 | reg32 &= 0xef; |
| 480 | reg32 <<= 25; |
| 481 | gtt_write(0xa008, reg32); |
| 482 | |
| 483 | /* 13: RP Control */ |
| 484 | gtt_write(0xa024, 0x00000592); |
| 485 | |
| 486 | /* 14: Enable PM Interrupts */ |
| 487 | gtt_write(0x4402c, 0x03000076); |
| 488 | |
| 489 | /* Clear 0x6c024 [8:6] */ |
| 490 | reg32 = gtt_read(0x6c024); |
| 491 | reg32 &= ~0x000001c0; |
| 492 | gtt_write(0x6c024, reg32); |
| 493 | } |
| 494 | |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 495 | static void gma_pm_init_post_vbios(struct device *dev) |
| 496 | { |
| 497 | struct northbridge_intel_nehalem_config *conf = dev->chip_info; |
| 498 | u32 reg32; |
| 499 | |
| 500 | printk(BIOS_DEBUG, "GT Power Management Init (post VBIOS)\n"); |
| 501 | |
| 502 | /* 15: Deassert Force Wake */ |
| 503 | if (bridge_silicon_revision() < IVB_STEP_C0) { |
| 504 | gtt_write(0xa18c, gtt_read(0xa18c) & ~1); |
| 505 | gtt_poll(0x130090, (1 << 0), (0 << 0)); |
| 506 | } else { |
| 507 | gtt_write(0xa188, 0x1fffe); |
| 508 | if (gtt_poll(0x130040, (1 << 0), (0 << 0))) |
| 509 | gtt_write(0xa188, gtt_read(0xa188) | 1); |
| 510 | } |
| 511 | |
| 512 | /* 16: SW RC Control */ |
| 513 | gtt_write(0xa094, 0x00060000); |
| 514 | |
| 515 | /* Setup Digital Port Hotplug */ |
| 516 | reg32 = gtt_read(0xc4030); |
| 517 | if (!reg32) { |
| 518 | reg32 = (conf->gpu_dp_b_hotplug & 0x7) << 2; |
| 519 | reg32 |= (conf->gpu_dp_c_hotplug & 0x7) << 10; |
| 520 | reg32 |= (conf->gpu_dp_d_hotplug & 0x7) << 18; |
| 521 | gtt_write(0xc4030, reg32); |
| 522 | } |
| 523 | |
| 524 | /* Setup Panel Power On Delays */ |
| 525 | reg32 = gtt_read(0xc7208); |
| 526 | if (!reg32) { |
| 527 | reg32 = (conf->gpu_panel_port_select & 0x3) << 30; |
| 528 | reg32 |= (conf->gpu_panel_power_up_delay & 0x1fff) << 16; |
| 529 | reg32 |= (conf->gpu_panel_power_backlight_on_delay & 0x1fff); |
| 530 | gtt_write(0xc7208, reg32); |
| 531 | } |
| 532 | |
| 533 | /* Setup Panel Power Off Delays */ |
| 534 | reg32 = gtt_read(0xc720c); |
| 535 | if (!reg32) { |
| 536 | reg32 = (conf->gpu_panel_power_down_delay & 0x1fff) << 16; |
| 537 | reg32 |= (conf->gpu_panel_power_backlight_off_delay & 0x1fff); |
| 538 | gtt_write(0xc720c, reg32); |
| 539 | } |
| 540 | |
| 541 | /* Setup Panel Power Cycle Delay */ |
| 542 | if (conf->gpu_panel_power_cycle_delay) { |
| 543 | reg32 = gtt_read(0xc7210); |
| 544 | reg32 &= ~0xff; |
| 545 | reg32 |= conf->gpu_panel_power_cycle_delay & 0xff; |
| 546 | gtt_write(0xc7210, reg32); |
| 547 | } |
| 548 | |
| 549 | /* Enable Backlight if needed */ |
| 550 | if (conf->gpu_cpu_backlight) { |
| 551 | gtt_write(0x48250, (1 << 31)); |
| 552 | gtt_write(0x48254, conf->gpu_cpu_backlight); |
| 553 | } |
| 554 | if (conf->gpu_pch_backlight) { |
| 555 | gtt_write(0xc8250, (1 << 31)); |
| 556 | gtt_write(0xc8254, conf->gpu_pch_backlight); |
| 557 | } |
| 558 | } |
| 559 | |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 560 | #if IS_ENABLED(CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT) |
| 561 | |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 562 | static void train_link(u8 *mmio) |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 563 | { |
| 564 | /* Clear interrupts. */ |
| 565 | write32(mmio + DEIIR, 0xffffffff); |
| 566 | |
| 567 | write32(mmio + 0x000f0018, 0x000000ff); |
| 568 | write32(mmio + 0x000f1018, 0x000000ff); |
| 569 | write32(mmio + 0x000f000c, 0x001a2050); |
| 570 | write32(mmio + 0x00060100, 0x001c4000); |
| 571 | write32(mmio + 0x00060100, 0x801c4000); |
| 572 | write32(mmio + 0x000f000c, 0x801a2050); |
| 573 | write32(mmio + 0x00060100, 0x801c4000); |
| 574 | write32(mmio + 0x000f000c, 0x801a2050); |
| 575 | mdelay(1); |
| 576 | |
| 577 | read32(mmio + 0x000f0014); // = 0x00000100 |
| 578 | write32(mmio + 0x000f0014, 0x00000100); |
| 579 | write32(mmio + 0x00060100, 0x901c4000); |
| 580 | write32(mmio + 0x000f000c, 0x901a2050); |
| 581 | mdelay(1); |
| 582 | read32(mmio + 0x000f0014); // = 0x00000600 |
| 583 | } |
| 584 | |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 585 | static void power_port(u8 *mmio) |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 586 | { |
| 587 | read32(mmio + 0x000e1100); // = 0x00000000 |
| 588 | write32(mmio + 0x000e1100, 0x00000000); |
| 589 | write32(mmio + 0x000e1100, 0x00010000); |
| 590 | read32(mmio + 0x000e1100); // = 0x00010000 |
| 591 | read32(mmio + 0x000e1100); // = 0x00010000 |
| 592 | read32(mmio + 0x000e1100); // = 0x00000000 |
| 593 | write32(mmio + 0x000e1100, 0x00000000); |
| 594 | read32(mmio + 0x000e1100); // = 0x00000000 |
| 595 | read32(mmio + 0x000e4200); // = 0x0000001c |
| 596 | write32(mmio + 0x000e4210, 0x8004003e); |
| 597 | write32(mmio + 0x000e4214, 0x80060002); |
| 598 | write32(mmio + 0x000e4218, 0x01000000); |
| 599 | read32(mmio + 0x000e4210); // = 0x5144003e |
| 600 | write32(mmio + 0x000e4210, 0x5344003e); |
| 601 | read32(mmio + 0x000e4210); // = 0x0144003e |
| 602 | write32(mmio + 0x000e4210, 0x8074003e); |
| 603 | read32(mmio + 0x000e4210); // = 0x5144003e |
| 604 | read32(mmio + 0x000e4210); // = 0x5144003e |
| 605 | write32(mmio + 0x000e4210, 0x5344003e); |
| 606 | read32(mmio + 0x000e4210); // = 0x0144003e |
| 607 | write32(mmio + 0x000e4210, 0x8074003e); |
| 608 | read32(mmio + 0x000e4210); // = 0x5144003e |
| 609 | read32(mmio + 0x000e4210); // = 0x5144003e |
| 610 | write32(mmio + 0x000e4210, 0x5344003e); |
| 611 | read32(mmio + 0x000e4210); // = 0x0144003e |
| 612 | write32(mmio + 0x000e4210, 0x8074003e); |
| 613 | read32(mmio + 0x000e4210); // = 0x5144003e |
| 614 | read32(mmio + 0x000e4210); // = 0x5144003e |
| 615 | write32(mmio + 0x000e4210, 0x5344003e); |
| 616 | write32(mmio + 0x000e4f00, 0x0100030c); |
| 617 | write32(mmio + 0x000e4f04, 0x00b8230c); |
| 618 | write32(mmio + 0x000e4f08, 0x06f8930c); |
| 619 | write32(mmio + 0x000e4f0c, 0x09f8e38e); |
| 620 | write32(mmio + 0x000e4f10, 0x00b8030c); |
| 621 | write32(mmio + 0x000e4f14, 0x0b78830c); |
| 622 | write32(mmio + 0x000e4f18, 0x0ff8d3cf); |
| 623 | write32(mmio + 0x000e4f1c, 0x01e8030c); |
| 624 | write32(mmio + 0x000e4f20, 0x0ff863cf); |
| 625 | write32(mmio + 0x000e4f24, 0x0ff803cf); |
| 626 | write32(mmio + 0x000c4030, 0x00001000); |
| 627 | read32(mmio + 0x000c4000); // = 0x00000000 |
| 628 | write32(mmio + 0x000c4030, 0x00001000); |
| 629 | read32(mmio + 0x000e1150); // = 0x0000001c |
| 630 | write32(mmio + 0x000e1150, 0x0000089c); |
| 631 | write32(mmio + 0x000fcc00, 0x01986f00); |
| 632 | write32(mmio + 0x000fcc0c, 0x01986f00); |
| 633 | write32(mmio + 0x000fcc18, 0x01986f00); |
| 634 | write32(mmio + 0x000fcc24, 0x01986f00); |
| 635 | read32(mmio + 0x000c4000); // = 0x00000000 |
| 636 | read32(mmio + 0x000e1180); // = 0x40000002 |
| 637 | } |
| 638 | |
| 639 | static void intel_gma_init(const struct northbridge_intel_nehalem_config *info, |
Kevin Paul Herbert | bde6d30 | 2014-12-24 18:43:20 -0800 | [diff] [blame] | 640 | u8 *mmio, u32 physbase, u16 piobase, u32 lfb) |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 641 | { |
| 642 | int i; |
| 643 | u8 edid_data[128]; |
| 644 | struct edid edid; |
Nicolas Reinecke | b142b84 | 2015-10-03 17:32:38 +0200 | [diff] [blame] | 645 | struct edid_mode *mode; |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 646 | u32 hactive, vactive, right_border, bottom_border; |
| 647 | int hpolarity, vpolarity; |
| 648 | u32 vsync, hsync, vblank, hblank, hfront_porch, vfront_porch; |
| 649 | u32 candp1, candn; |
| 650 | u32 best_delta = 0xffffffff; |
| 651 | u32 target_frequency; |
| 652 | u32 pixel_p1 = 1; |
| 653 | u32 pixel_n = 1; |
| 654 | u32 pixel_m1 = 1; |
| 655 | u32 pixel_m2 = 1; |
Vladimir Serbinenko | a71bdc3 | 2014-08-30 00:35:39 +0200 | [diff] [blame] | 656 | u32 link_frequency = info->gfx.link_frequency_270_mhz ? 270000 : 162000; |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 657 | u32 data_m1; |
| 658 | u32 data_n1 = 0x00800000; |
| 659 | u32 link_m1; |
| 660 | u32 link_n1 = 0x00080000; |
| 661 | |
| 662 | write32(mmio + 0x00070080, 0x00000000); |
| 663 | write32(mmio + DSPCNTR(0), 0x00000000); |
| 664 | write32(mmio + 0x00071180, 0x00000000); |
| 665 | write32(mmio + CPU_VGACNTRL, 0x0000298e | VGA_DISP_DISABLE); |
| 666 | write32(mmio + 0x0007019c, 0x00000000); |
| 667 | write32(mmio + 0x0007119c, 0x00000000); |
| 668 | write32(mmio + 0x000fc008, 0x2c010000); |
| 669 | write32(mmio + 0x000fc020, 0x2c010000); |
| 670 | write32(mmio + 0x000fc038, 0x2c010000); |
| 671 | write32(mmio + 0x000fc050, 0x2c010000); |
| 672 | write32(mmio + 0x000fc408, 0x2c010000); |
| 673 | write32(mmio + 0x000fc420, 0x2c010000); |
| 674 | write32(mmio + 0x000fc438, 0x2c010000); |
| 675 | write32(mmio + 0x000fc450, 0x2c010000); |
| 676 | vga_gr_write(0x18, 0); |
| 677 | write32(mmio + 0x00042004, 0x02000000); |
| 678 | write32(mmio + 0x000fd034, 0x8421ffe0); |
| 679 | |
Elyes HAOUAS | cf5430f | 2016-09-13 21:27:22 +0200 | [diff] [blame] | 680 | /* Setup GTT. */ |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 681 | for (i = 0; i < 0x2000; i++) |
| 682 | { |
| 683 | outl((i << 2) | 1, piobase); |
| 684 | outl(physbase + (i << 12) + 1, piobase + 4); |
| 685 | } |
| 686 | |
| 687 | vga_misc_write(0x67); |
| 688 | |
| 689 | const u8 cr[] = { 0x5f, 0x4f, 0x50, 0x82, 0x55, 0x81, 0xbf, 0x1f, |
| 690 | 0x00, 0x4f, 0x0d, 0x0e, 0x00, 0x00, 0x00, 0x00, |
| 691 | 0x9c, 0x8e, 0x8f, 0x28, 0x1f, 0x96, 0xb9, 0xa3, |
| 692 | 0xff |
| 693 | }; |
| 694 | vga_cr_write(0x11, 0); |
| 695 | |
| 696 | for (i = 0; i <= 0x18; i++) |
| 697 | vga_cr_write(i, cr[i]); |
| 698 | |
| 699 | power_port(mmio); |
| 700 | |
Arthur Heymans | 7141ff3 | 2016-10-10 17:49:00 +0200 | [diff] [blame] | 701 | intel_gmbus_read_edid(mmio + PCH_GMBUS0, 3, 0x50, edid_data, |
| 702 | sizeof(edid_data)); |
Vladimir Serbinenko | 428130e | 2015-05-19 09:45:22 +0200 | [diff] [blame] | 703 | intel_gmbus_stop(mmio + PCH_GMBUS0); |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 704 | decode_edid(edid_data, |
| 705 | sizeof(edid_data), &edid); |
Nicolas Reinecke | b142b84 | 2015-10-03 17:32:38 +0200 | [diff] [blame] | 706 | mode = &edid.mode; |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 707 | |
Elyes HAOUAS | cf5430f | 2016-09-13 21:27:22 +0200 | [diff] [blame] | 708 | /* Disable screen memory to prevent garbage from appearing. */ |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 709 | vga_sr_write(1, vga_sr_read(1) | 0x20); |
| 710 | |
| 711 | hactive = edid.x_resolution; |
| 712 | vactive = edid.y_resolution; |
Nicolas Reinecke | b142b84 | 2015-10-03 17:32:38 +0200 | [diff] [blame] | 713 | right_border = mode->hborder; |
| 714 | bottom_border = mode->vborder; |
| 715 | hpolarity = (mode->phsync == '-'); |
| 716 | vpolarity = (mode->pvsync == '-'); |
| 717 | vsync = mode->vspw; |
| 718 | hsync = mode->hspw; |
| 719 | vblank = mode->vbl; |
| 720 | hblank = mode->hbl; |
| 721 | hfront_porch = mode->hso; |
| 722 | vfront_porch = mode->vso; |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 723 | |
Vladimir Serbinenko | 551cff0 | 2015-10-10 23:58:08 +0200 | [diff] [blame] | 724 | target_frequency = mode->lvds_dual_channel ? mode->pixel_clock |
Nicolas Reinecke | b142b84 | 2015-10-03 17:32:38 +0200 | [diff] [blame] | 725 | : (2 * mode->pixel_clock); |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 726 | vga_textmode_init(); |
Vladimir Serbinenko | 428130e | 2015-05-19 09:45:22 +0200 | [diff] [blame] | 727 | #if IS_ENABLED(CONFIG_FRAMEBUFFER_KEEP_VESA_MODE) |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 728 | vga_sr_write(1, 1); |
| 729 | vga_sr_write(0x2, 0xf); |
| 730 | vga_sr_write(0x3, 0x0); |
| 731 | vga_sr_write(0x4, 0xe); |
| 732 | vga_gr_write(0, 0x0); |
| 733 | vga_gr_write(1, 0x0); |
| 734 | vga_gr_write(2, 0x0); |
| 735 | vga_gr_write(3, 0x0); |
| 736 | vga_gr_write(4, 0x0); |
| 737 | vga_gr_write(5, 0x0); |
| 738 | vga_gr_write(6, 0x5); |
| 739 | vga_gr_write(7, 0xf); |
| 740 | vga_gr_write(0x10, 0x1); |
| 741 | vga_gr_write(0x11, 0); |
| 742 | |
| 743 | |
| 744 | edid.bytes_per_line = (edid.bytes_per_line + 63) & ~63; |
| 745 | |
| 746 | write32(mmio + DSPCNTR(0), DISPPLANE_BGRX888); |
| 747 | write32(mmio + DSPADDR(0), 0); |
| 748 | write32(mmio + DSPSTRIDE(0), edid.bytes_per_line); |
| 749 | write32(mmio + DSPSURF(0), 0); |
| 750 | for (i = 0; i < 0x100; i++) |
| 751 | write32(mmio + LGC_PALETTE(0) + 4 * i, i * 0x010101); |
| 752 | #endif |
| 753 | |
Elyes HAOUAS | cf5430f | 2016-09-13 21:27:22 +0200 | [diff] [blame] | 754 | /* Find suitable divisors. */ |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 755 | for (candp1 = 1; candp1 <= 8; candp1++) { |
| 756 | for (candn = 5; candn <= 10; candn++) { |
| 757 | u32 cur_frequency; |
Elyes HAOUAS | cf5430f | 2016-09-13 21:27:22 +0200 | [diff] [blame] | 758 | u32 m; /* 77 - 131. */ |
| 759 | u32 denom; /* 35 - 560. */ |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 760 | u32 current_delta; |
| 761 | |
| 762 | denom = candn * candp1 * 7; |
Martin Roth | 128c104 | 2016-11-18 09:29:03 -0700 | [diff] [blame] | 763 | /* Doesn't overflow for up to |
Elyes HAOUAS | cf5430f | 2016-09-13 21:27:22 +0200 | [diff] [blame] | 764 | 5000000 kHz = 5 GHz. */ |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 765 | m = (target_frequency * denom + 60000) / 120000; |
| 766 | |
| 767 | if (m < 77 || m > 131) |
| 768 | continue; |
| 769 | |
| 770 | cur_frequency = (120000 * m) / denom; |
| 771 | if (target_frequency > cur_frequency) |
| 772 | current_delta = target_frequency - cur_frequency; |
| 773 | else |
| 774 | current_delta = cur_frequency - target_frequency; |
| 775 | |
| 776 | |
| 777 | if (best_delta > current_delta) { |
| 778 | best_delta = current_delta; |
| 779 | pixel_n = candn; |
| 780 | pixel_p1 = candp1; |
| 781 | pixel_m2 = ((m + 3) % 5) + 7; |
| 782 | pixel_m1 = (m - pixel_m2) / 5; |
| 783 | } |
| 784 | } |
| 785 | } |
| 786 | |
| 787 | if (best_delta == 0xffffffff) { |
| 788 | printk (BIOS_ERR, "Couldn't find GFX clock divisors\n"); |
| 789 | return; |
| 790 | } |
| 791 | |
Nicolas Reinecke | b142b84 | 2015-10-03 17:32:38 +0200 | [diff] [blame] | 792 | link_m1 = ((uint64_t)link_n1 * mode->pixel_clock) / link_frequency; |
| 793 | data_m1 = ((uint64_t)data_n1 * 18 * mode->pixel_clock) |
Vladimir Serbinenko | c48f5ef | 2015-10-11 02:05:55 +0200 | [diff] [blame] | 794 | / (link_frequency * 8 * 4); |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 795 | |
| 796 | printk(BIOS_INFO, "bringing up panel at resolution %d x %d\n", |
| 797 | hactive, vactive); |
| 798 | printk(BIOS_DEBUG, "Borders %d x %d\n", |
| 799 | right_border, bottom_border); |
| 800 | printk(BIOS_DEBUG, "Blank %d x %d\n", |
| 801 | hblank, vblank); |
| 802 | printk(BIOS_DEBUG, "Sync %d x %d\n", |
| 803 | hsync, vsync); |
| 804 | printk(BIOS_DEBUG, "Front porch %d x %d\n", |
| 805 | hfront_porch, vfront_porch); |
Vladimir Serbinenko | a71bdc3 | 2014-08-30 00:35:39 +0200 | [diff] [blame] | 806 | printk(BIOS_DEBUG, (info->gfx.use_spread_spectrum_clock |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 807 | ? "Spread spectrum clock\n" : "DREF clock\n")); |
| 808 | printk(BIOS_DEBUG, |
Vladimir Serbinenko | 551cff0 | 2015-10-10 23:58:08 +0200 | [diff] [blame] | 809 | mode->lvds_dual_channel ? "Dual channel\n" : "Single channel\n"); |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 810 | printk(BIOS_DEBUG, "Polarities %d, %d\n", |
| 811 | hpolarity, vpolarity); |
| 812 | printk(BIOS_DEBUG, "Data M1=%d, N1=%d\n", |
| 813 | data_m1, data_n1); |
| 814 | printk(BIOS_DEBUG, "Link frequency %d kHz\n", |
| 815 | link_frequency); |
| 816 | printk(BIOS_DEBUG, "Link M1=%d, N1=%d\n", |
| 817 | link_m1, link_n1); |
| 818 | printk(BIOS_DEBUG, "Pixel N=%d, M1=%d, M2=%d, P1=%d\n", |
| 819 | pixel_n, pixel_m1, pixel_m2, pixel_p1); |
| 820 | printk(BIOS_DEBUG, "Pixel clock %d kHz\n", |
| 821 | 120000 * (5 * pixel_m1 + pixel_m2) / pixel_n |
| 822 | / (pixel_p1 * 7)); |
| 823 | |
| 824 | write32(mmio + PCH_LVDS, |
| 825 | (hpolarity << 20) | (vpolarity << 21) |
Vladimir Serbinenko | 551cff0 | 2015-10-10 23:58:08 +0200 | [diff] [blame] | 826 | | (mode->lvds_dual_channel ? LVDS_CLOCK_B_POWERUP_ALL |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 827 | | LVDS_CLOCK_BOTH_POWERUP_ALL : 0) |
| 828 | | LVDS_BORDER_ENABLE | LVDS_CLOCK_A_POWERUP_ALL |
| 829 | | LVDS_DETECTED); |
| 830 | write32(mmio + BLC_PWM_CPU_CTL2, (1 << 31)); |
Vladimir Serbinenko | a71bdc3 | 2014-08-30 00:35:39 +0200 | [diff] [blame] | 831 | write32(mmio + PCH_DREF_CONTROL, (info->gfx.use_spread_spectrum_clock |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 832 | ? 0x1002 : 0x400)); |
| 833 | mdelay(1); |
| 834 | write32(mmio + PCH_PP_CONTROL, PANEL_UNLOCK_REGS |
| 835 | | (read32(mmio + PCH_PP_CONTROL) & ~PANEL_UNLOCK_MASK)); |
| 836 | write32(mmio + _PCH_FP0(0), |
| 837 | ((pixel_n - 2) << 16) |
| 838 | | ((pixel_m1 - 2) << 8) | pixel_m2); |
| 839 | write32(mmio + _PCH_DPLL(0), |
| 840 | DPLL_VCO_ENABLE | DPLLB_MODE_LVDS |
Vladimir Serbinenko | 551cff0 | 2015-10-10 23:58:08 +0200 | [diff] [blame] | 841 | | (mode->lvds_dual_channel ? DPLLB_LVDS_P2_CLOCK_DIV_7 |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 842 | : DPLLB_LVDS_P2_CLOCK_DIV_14) |
| 843 | | (0x10000 << (pixel_p1 - 1)) |
Vladimir Serbinenko | a71bdc3 | 2014-08-30 00:35:39 +0200 | [diff] [blame] | 844 | | ((info->gfx.use_spread_spectrum_clock ? 3 : 0) << 13) |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 845 | | (0x1 << (pixel_p1 - 1))); |
| 846 | mdelay(1); |
| 847 | write32(mmio + _PCH_DPLL(0), |
| 848 | DPLL_VCO_ENABLE | DPLLB_MODE_LVDS |
Vladimir Serbinenko | 551cff0 | 2015-10-10 23:58:08 +0200 | [diff] [blame] | 849 | | (mode->lvds_dual_channel ? DPLLB_LVDS_P2_CLOCK_DIV_7 |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 850 | : DPLLB_LVDS_P2_CLOCK_DIV_14) |
| 851 | | (0x10000 << (pixel_p1 - 1)) |
Vladimir Serbinenko | a71bdc3 | 2014-08-30 00:35:39 +0200 | [diff] [blame] | 852 | | ((info->gfx.use_spread_spectrum_clock ? 3 : 0) << 13) |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 853 | | (0x1 << (pixel_p1 - 1))); |
| 854 | /* Re-lock the registers. */ |
| 855 | write32(mmio + PCH_PP_CONTROL, |
| 856 | (read32(mmio + PCH_PP_CONTROL) & ~PANEL_UNLOCK_MASK)); |
| 857 | |
| 858 | write32(mmio + PCH_LVDS, |
| 859 | (hpolarity << 20) | (vpolarity << 21) |
Vladimir Serbinenko | 551cff0 | 2015-10-10 23:58:08 +0200 | [diff] [blame] | 860 | | (mode->lvds_dual_channel ? LVDS_CLOCK_B_POWERUP_ALL |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 861 | | LVDS_CLOCK_BOTH_POWERUP_ALL : 0) |
| 862 | | LVDS_BORDER_ENABLE | LVDS_CLOCK_A_POWERUP_ALL |
| 863 | | LVDS_DETECTED); |
| 864 | |
| 865 | write32(mmio + HTOTAL(0), |
| 866 | ((hactive + right_border + hblank - 1) << 16) |
| 867 | | (hactive - 1)); |
| 868 | write32(mmio + HBLANK(0), |
| 869 | ((hactive + right_border + hblank - 1) << 16) |
| 870 | | (hactive + right_border - 1)); |
| 871 | write32(mmio + HSYNC(0), |
| 872 | ((hactive + right_border + hfront_porch + hsync - 1) << 16) |
| 873 | | (hactive + right_border + hfront_porch - 1)); |
| 874 | |
| 875 | write32(mmio + VTOTAL(0), ((vactive + bottom_border + vblank - 1) << 16) |
| 876 | | (vactive - 1)); |
| 877 | write32(mmio + VBLANK(0), ((vactive + bottom_border + vblank - 1) << 16) |
| 878 | | (vactive + bottom_border - 1)); |
| 879 | write32(mmio + VSYNC(0), |
| 880 | (vactive + bottom_border + vfront_porch + vsync - 1) |
| 881 | | (vactive + bottom_border + vfront_porch - 1)); |
| 882 | |
| 883 | write32(mmio + PIPECONF(0), PIPECONF_DISABLE); |
| 884 | |
| 885 | write32(mmio + PF_WIN_POS(0), 0); |
| 886 | #if IS_ENABLED(CONFIG_FRAMEBUFFER_KEEP_VESA_MODE) |
| 887 | write32(mmio + PIPESRC(0), ((hactive - 1) << 16) | (vactive - 1)); |
| 888 | write32(mmio + PF_CTL(0),0); |
| 889 | write32(mmio + PF_WIN_SZ(0), 0); |
| 890 | #else |
| 891 | write32(mmio + PIPESRC(0), (639 << 16) | 399); |
| 892 | write32(mmio + PF_CTL(0),PF_ENABLE | PF_FILTER_MED_3x3); |
| 893 | write32(mmio + PF_WIN_SZ(0), vactive | (hactive << 16)); |
| 894 | #endif |
| 895 | |
| 896 | mdelay(1); |
| 897 | |
| 898 | write32(mmio + PIPE_DATA_M1(0), 0x7e000000 | data_m1); |
| 899 | write32(mmio + PIPE_DATA_N1(0), data_n1); |
| 900 | write32(mmio + PIPE_LINK_M1(0), link_m1); |
| 901 | write32(mmio + PIPE_LINK_N1(0), link_n1); |
| 902 | |
| 903 | write32(mmio + 0x000f000c, 0x00002040); |
| 904 | mdelay(1); |
| 905 | write32(mmio + 0x000f000c, 0x00002050); |
| 906 | write32(mmio + 0x00060100, 0x00044000); |
| 907 | mdelay(1); |
| 908 | write32(mmio + PIPECONF(0), PIPECONF_BPP_6); |
| 909 | write32(mmio + 0x000f0008, 0x00000040); |
| 910 | write32(mmio + 0x000f000c, 0x00022050); |
| 911 | write32(mmio + PIPECONF(0), PIPECONF_BPP_6 | PIPECONF_DITHER_EN); |
| 912 | write32(mmio + PIPECONF(0), PIPECONF_ENABLE | PIPECONF_BPP_6 | PIPECONF_DITHER_EN); |
| 913 | |
| 914 | #if IS_ENABLED(CONFIG_FRAMEBUFFER_KEEP_VESA_MODE) |
| 915 | write32(mmio + CPU_VGACNTRL, 0x20298e | VGA_DISP_DISABLE); |
| 916 | #else |
| 917 | write32(mmio + CPU_VGACNTRL, 0x20298e); |
| 918 | #endif |
| 919 | train_link(mmio); |
| 920 | |
| 921 | #if IS_ENABLED(CONFIG_FRAMEBUFFER_KEEP_VESA_MODE) |
| 922 | write32(mmio + DSPCNTR(0), DISPLAY_PLANE_ENABLE | DISPPLANE_BGRX888); |
| 923 | mdelay(1); |
| 924 | #endif |
| 925 | |
| 926 | write32(mmio + TRANS_HTOTAL(0), |
| 927 | ((hactive + right_border + hblank - 1) << 16) |
| 928 | | (hactive - 1)); |
| 929 | write32(mmio + TRANS_HBLANK(0), |
| 930 | ((hactive + right_border + hblank - 1) << 16) |
| 931 | | (hactive + right_border - 1)); |
| 932 | write32(mmio + TRANS_HSYNC(0), |
| 933 | ((hactive + right_border + hfront_porch + hsync - 1) << 16) |
| 934 | | (hactive + right_border + hfront_porch - 1)); |
| 935 | |
| 936 | write32(mmio + TRANS_VTOTAL(0), |
| 937 | ((vactive + bottom_border + vblank - 1) << 16) |
| 938 | | (vactive - 1)); |
| 939 | write32(mmio + TRANS_VBLANK(0), |
| 940 | ((vactive + bottom_border + vblank - 1) << 16) |
| 941 | | (vactive + bottom_border - 1)); |
| 942 | write32(mmio + TRANS_VSYNC(0), |
| 943 | (vactive + bottom_border + vfront_porch + vsync - 1) |
| 944 | | (vactive + bottom_border + vfront_porch - 1)); |
| 945 | |
| 946 | write32(mmio + 0x00060100, 0xb01c4000); |
| 947 | write32(mmio + 0x000f000c, 0xb01a2050); |
| 948 | mdelay(1); |
| 949 | write32(mmio + TRANSCONF(0), TRANS_ENABLE | TRANS_6BPC |
| 950 | #if IS_ENABLED(CONFIG_FRAMEBUFFER_KEEP_VESA_MODE) |
| 951 | | TRANS_STATE_MASK |
| 952 | #endif |
| 953 | ); |
| 954 | write32(mmio + PCH_LVDS, |
| 955 | LVDS_PORT_ENABLE |
| 956 | | (hpolarity << 20) | (vpolarity << 21) |
Vladimir Serbinenko | 551cff0 | 2015-10-10 23:58:08 +0200 | [diff] [blame] | 957 | | (mode->lvds_dual_channel ? LVDS_CLOCK_B_POWERUP_ALL |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 958 | | LVDS_CLOCK_BOTH_POWERUP_ALL : 0) |
| 959 | | LVDS_BORDER_ENABLE | LVDS_CLOCK_A_POWERUP_ALL |
| 960 | | LVDS_DETECTED); |
| 961 | |
| 962 | write32(mmio + PCH_PP_CONTROL, PANEL_UNLOCK_REGS | PANEL_POWER_OFF); |
| 963 | write32(mmio + PCH_PP_CONTROL, PANEL_UNLOCK_REGS | PANEL_POWER_RESET); |
| 964 | mdelay(1); |
| 965 | write32(mmio + PCH_PP_CONTROL, PANEL_UNLOCK_REGS |
| 966 | | PANEL_POWER_ON | PANEL_POWER_RESET); |
| 967 | |
| 968 | printk (BIOS_DEBUG, "waiting for panel powerup\n"); |
| 969 | while (1) { |
| 970 | u32 reg32; |
| 971 | reg32 = read32(mmio + PCH_PP_STATUS); |
| 972 | if (((reg32 >> 28) & 3) == 0) |
| 973 | break; |
| 974 | } |
| 975 | printk (BIOS_DEBUG, "panel powered up\n"); |
| 976 | |
| 977 | write32(mmio + PCH_PP_CONTROL, PANEL_POWER_ON | PANEL_POWER_RESET); |
| 978 | |
Elyes HAOUAS | cf5430f | 2016-09-13 21:27:22 +0200 | [diff] [blame] | 979 | /* Enable screen memory. */ |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 980 | vga_sr_write(1, vga_sr_read(1) & ~0x20); |
| 981 | |
| 982 | /* Clear interrupts. */ |
| 983 | write32(mmio + DEIIR, 0xffffffff); |
| 984 | write32(mmio + SDEIIR, 0xffffffff); |
| 985 | |
Vladimir Serbinenko | 428130e | 2015-05-19 09:45:22 +0200 | [diff] [blame] | 986 | /* Doesn't change any hw behaviour but vga oprom expects it there. */ |
| 987 | write32(mmio + 0x0004f040, 0x01000008); |
| 988 | write32(mmio + 0x0004f04c, 0x7f7f0000); |
| 989 | write32(mmio + 0x0004f054, 0x0000020d); |
| 990 | |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 991 | #if IS_ENABLED(CONFIG_FRAMEBUFFER_KEEP_VESA_MODE) |
| 992 | memset ((void *) lfb, 0, edid.x_resolution * edid.y_resolution * 4); |
| 993 | set_vbe_mode_info_valid(&edid, lfb); |
| 994 | #endif |
| 995 | } |
| 996 | |
Vladimir Serbinenko | 5aa28f5 | 2014-05-31 22:26:42 +0200 | [diff] [blame] | 997 | #endif |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 998 | |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 999 | static void gma_func0_init(struct device *dev) |
| 1000 | { |
| 1001 | u32 reg32; |
| 1002 | |
| 1003 | /* IGD needs to be Bus Master */ |
| 1004 | reg32 = pci_read_config32(dev, PCI_COMMAND); |
| 1005 | reg32 |= PCI_COMMAND_MASTER | PCI_COMMAND_MEMORY | PCI_COMMAND_IO; |
| 1006 | pci_write_config32(dev, PCI_COMMAND, reg32); |
| 1007 | |
| 1008 | /* Init graphics power management */ |
| 1009 | gma_pm_init_pre_vbios(dev); |
| 1010 | |
| 1011 | #if !CONFIG_MAINBOARD_DO_NATIVE_VGA_INIT |
| 1012 | /* PCI Init, will run VBIOS */ |
| 1013 | pci_dev_init(dev); |
| 1014 | #else |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 1015 | u32 physbase; |
| 1016 | struct northbridge_intel_nehalem_config *conf = dev->chip_info; |
| 1017 | struct resource *lfb_res; |
| 1018 | struct resource *pio_res; |
| 1019 | |
| 1020 | lfb_res = find_resource(dev, PCI_BASE_ADDRESS_2); |
| 1021 | pio_res = find_resource(dev, PCI_BASE_ADDRESS_4); |
| 1022 | |
| 1023 | physbase = pci_read_config32(dev, 0x5c) & ~0xf; |
| 1024 | |
| 1025 | if (gtt_res && gtt_res->base && physbase && pio_res && pio_res->base |
| 1026 | && lfb_res && lfb_res->base) { |
| 1027 | printk(BIOS_SPEW, "Initializing VGA without OPROM. MMIO 0x%llx\n", |
| 1028 | gtt_res->base); |
Nico Huber | 88c6487 | 2016-10-05 18:02:01 +0200 | [diff] [blame] | 1029 | if (IS_ENABLED(CONFIG_MAINBOARD_USE_LIBGFXINIT)) { |
| 1030 | int lightup_ok; |
| 1031 | gma_gfxinit(gtt_res->base, lfb_res->base, |
| 1032 | physbase, &lightup_ok); |
| 1033 | } else { |
| 1034 | intel_gma_init(conf, res2mmio(gtt_res, 0, 0), physbase, |
| 1035 | pio_res->base, lfb_res->base); |
| 1036 | } |
Vladimir Serbinenko | 1315730 | 2014-02-19 22:18:08 +0100 | [diff] [blame] | 1037 | } |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 1038 | |
Elyes HAOUAS | cf5430f | 2016-09-13 21:27:22 +0200 | [diff] [blame] | 1039 | /* Linux relies on VBT for panel info. */ |
Vladimir Serbinenko | a71bdc3 | 2014-08-30 00:35:39 +0200 | [diff] [blame] | 1040 | generate_fake_intel_oprom(&conf->gfx, dev, "$VBT IRONLAKE-MOBILE"); |
Vladimir Serbinenko | 5aa28f5 | 2014-05-31 22:26:42 +0200 | [diff] [blame] | 1041 | #endif |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 1042 | |
| 1043 | |
| 1044 | /* Post VBIOS init */ |
| 1045 | gma_pm_init_post_vbios(dev); |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 1046 | } |
| 1047 | |
| 1048 | static void gma_set_subsystem(device_t dev, unsigned vendor, unsigned device) |
| 1049 | { |
| 1050 | if (!vendor || !device) { |
| 1051 | pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, |
| 1052 | pci_read_config32(dev, PCI_VENDOR_ID)); |
| 1053 | } else { |
| 1054 | pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID, |
| 1055 | ((device & 0xffff) << 16) | (vendor & |
| 1056 | 0xffff)); |
| 1057 | } |
| 1058 | } |
| 1059 | |
| 1060 | static void gma_read_resources(struct device *dev) |
| 1061 | { |
| 1062 | pci_dev_read_resources(dev); |
| 1063 | |
| 1064 | struct resource *res; |
| 1065 | |
| 1066 | /* Set the graphics memory to write combining. */ |
| 1067 | res = find_resource(dev, PCI_BASE_ADDRESS_2); |
| 1068 | if (res == NULL) { |
| 1069 | printk(BIOS_DEBUG, "gma: memory resource not found.\n"); |
| 1070 | return; |
| 1071 | } |
| 1072 | res->flags |= IORESOURCE_RESERVE | IORESOURCE_FIXED | IORESOURCE_ASSIGNED; |
Elyes HAOUAS | cf5430f | 2016-09-13 21:27:22 +0200 | [diff] [blame] | 1073 | pci_write_config32(dev, PCI_BASE_ADDRESS_2, 0xd0000001); |
| 1074 | pci_write_config32(dev, PCI_BASE_ADDRESS_2 + 4, 0); |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 1075 | res->base = (resource_t) 0xd0000000; |
| 1076 | res->size = (resource_t) 0x10000000; |
| 1077 | } |
| 1078 | |
Vladimir Serbinenko | dd2bc3f | 2014-10-31 09:16:31 +0100 | [diff] [blame] | 1079 | const struct i915_gpu_controller_info * |
| 1080 | intel_gma_get_controller_info(void) |
| 1081 | { |
| 1082 | device_t dev = dev_find_slot(0, PCI_DEVFN(0x2,0)); |
| 1083 | if (!dev) { |
| 1084 | return NULL; |
| 1085 | } |
| 1086 | struct northbridge_intel_nehalem_config *chip = dev->chip_info; |
| 1087 | return &chip->gfx; |
| 1088 | } |
| 1089 | |
Alexander Couzens | 5eea458 | 2015-04-12 22:18:55 +0200 | [diff] [blame] | 1090 | static void gma_ssdt(device_t device) |
Vladimir Serbinenko | dd2bc3f | 2014-10-31 09:16:31 +0100 | [diff] [blame] | 1091 | { |
| 1092 | const struct i915_gpu_controller_info *gfx = intel_gma_get_controller_info(); |
| 1093 | if (!gfx) { |
| 1094 | return; |
| 1095 | } |
| 1096 | |
| 1097 | drivers_intel_gma_displays_ssdt_generate(gfx); |
| 1098 | } |
| 1099 | |
Patrick Rudolph | 2be2840 | 2017-04-12 16:54:55 +0200 | [diff] [blame] | 1100 | static unsigned long |
| 1101 | gma_write_acpi_tables(struct device *const dev, |
| 1102 | unsigned long current, |
| 1103 | struct acpi_rsdp *const rsdp) |
| 1104 | { |
| 1105 | igd_opregion_t *opregion; |
| 1106 | global_nvs_t *gnvs; |
| 1107 | |
| 1108 | // FIXME: Replace by common VBT implementation writing to current |
| 1109 | opregion = igd_make_opregion(); |
| 1110 | if (opregion) { |
| 1111 | /* GNVS has been already set up */ |
| 1112 | gnvs = cbmem_find(CBMEM_ID_ACPI_GNVS); |
| 1113 | if (gnvs) { |
| 1114 | /* IGD OpRegion Base Address */ |
| 1115 | gnvs->aslb = (u32)(uintptr_t)opregion; |
| 1116 | } else { |
| 1117 | printk(BIOS_ERR, "Error: GNVS table not found.\n"); |
| 1118 | } |
| 1119 | } |
| 1120 | |
| 1121 | return current; |
| 1122 | } |
| 1123 | |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 1124 | static struct pci_operations gma_pci_ops = { |
| 1125 | .set_subsystem = gma_set_subsystem, |
| 1126 | }; |
| 1127 | |
| 1128 | static struct device_operations gma_func0_ops = { |
| 1129 | .read_resources = gma_read_resources, |
| 1130 | .set_resources = pci_dev_set_resources, |
| 1131 | .enable_resources = pci_dev_enable_resources, |
Vladimir Serbinenko | dd2bc3f | 2014-10-31 09:16:31 +0100 | [diff] [blame] | 1132 | .acpi_fill_ssdt_generator = gma_ssdt, |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 1133 | .init = gma_func0_init, |
| 1134 | .scan_bus = 0, |
| 1135 | .enable = 0, |
| 1136 | .ops_pci = &gma_pci_ops, |
Patrick Rudolph | 2be2840 | 2017-04-12 16:54:55 +0200 | [diff] [blame] | 1137 | .write_acpi_tables = gma_write_acpi_tables, |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 1138 | }; |
| 1139 | |
Elyes HAOUAS | cf5430f | 2016-09-13 21:27:22 +0200 | [diff] [blame] | 1140 | static const unsigned short pci_device_ids[] = { |
| 1141 | 0x0046, 0x0102, 0x0106, 0x010a, 0x0112, |
Vladimir Serbinenko | c6f6be0 | 2013-11-12 22:32:08 +0100 | [diff] [blame] | 1142 | 0x0116, 0x0122, 0x0126, 0x0156, |
| 1143 | 0x0166, |
| 1144 | 0 |
| 1145 | }; |
| 1146 | |
| 1147 | static const struct pci_driver gma __pci_driver = { |
| 1148 | .ops = &gma_func0_ops, |
| 1149 | .vendor = PCI_VENDOR_ID_INTEL, |
| 1150 | .devices = pci_device_ids, |
| 1151 | }; |