aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/early-quirks.c
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2014-02-05 14:28:58 -0500
committerIngo Molnar <mingo@kernel.org>2014-02-09 09:11:30 -0500
commit52ca70454ea5ff29bc39f7871d28f8e6f4713867 (patch)
tree977a4bb8986b86f8a0316ab3e7c29a09045d55fb /arch/x86/kernel/early-quirks.c
parent494479038d97f1b9f76fc633a360a681acdf035c (diff)
x86/gpu: Add vfunc for Intel graphics stolen memory base address
For gen2 devices we're going to need another way to determine the stolen memory base address. Make that into a vfunc as well. Also drop the bogus inline keyword from gen8_stolen_size(). Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Cc: Bjorn Helgaas <bhelgaas@google.com> Link: http://lkml.kernel.org/r/1391628540-23072-2-git-send-email-ville.syrjala@linux.intel.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/early-quirks.c')
-rw-r--r--arch/x86/kernel/early-quirks.c77
1 files changed, 48 insertions, 29 deletions
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index bc4a088f9023..fddd4d05d1fa 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -228,7 +228,7 @@ static void __init intel_remapping_check(int num, int slot, int func)
228 * 228 *
229 * And yes, so far on current devices the base addr is always under 4G. 229 * And yes, so far on current devices the base addr is always under 4G.
230 */ 230 */
231static u32 __init intel_stolen_base(int num, int slot, int func) 231static u32 __init intel_stolen_base(int num, int slot, int func, size_t stolen_size)
232{ 232{
233 u32 base; 233 u32 base;
234 234
@@ -313,7 +313,7 @@ static size_t __init gen6_stolen_size(int num, int slot, int func)
313 return gmch_ctrl << 25; /* 32 MB units */ 313 return gmch_ctrl << 25; /* 32 MB units */
314} 314}
315 315
316static inline size_t gen8_stolen_size(int num, int slot, int func) 316static size_t gen8_stolen_size(int num, int slot, int func)
317{ 317{
318 u16 gmch_ctrl; 318 u16 gmch_ctrl;
319 319
@@ -323,31 +323,50 @@ static inline size_t gen8_stolen_size(int num, int slot, int func)
323 return gmch_ctrl << 25; /* 32 MB units */ 323 return gmch_ctrl << 25; /* 32 MB units */
324} 324}
325 325
326typedef size_t (*stolen_size_fn)(int num, int slot, int func); 326
327struct intel_stolen_funcs {
328 size_t (*size)(int num, int slot, int func);
329 u32 (*base)(int num, int slot, int func, size_t size);
330};
331
332static const struct intel_stolen_funcs gen3_stolen_funcs = {
333 .base = intel_stolen_base,
334 .size = gen3_stolen_size,
335};
336
337static const struct intel_stolen_funcs gen6_stolen_funcs = {
338 .base = intel_stolen_base,
339 .size = gen6_stolen_size,
340};
341
342static const struct intel_stolen_funcs gen8_stolen_funcs = {
343 .base = intel_stolen_base,
344 .size = gen8_stolen_size,
345};
327 346
328static struct pci_device_id intel_stolen_ids[] __initdata = { 347static struct pci_device_id intel_stolen_ids[] __initdata = {
329 INTEL_I915G_IDS(gen3_stolen_size), 348 INTEL_I915G_IDS(&gen3_stolen_funcs),
330 INTEL_I915GM_IDS(gen3_stolen_size), 349 INTEL_I915GM_IDS(&gen3_stolen_funcs),
331 INTEL_I945G_IDS(gen3_stolen_size), 350 INTEL_I945G_IDS(&gen3_stolen_funcs),
332 INTEL_I945GM_IDS(gen3_stolen_size), 351 INTEL_I945GM_IDS(&gen3_stolen_funcs),
333 INTEL_VLV_M_IDS(gen6_stolen_size), 352 INTEL_VLV_M_IDS(&gen6_stolen_funcs),
334 INTEL_VLV_D_IDS(gen6_stolen_size), 353 INTEL_VLV_D_IDS(&gen6_stolen_funcs),
335 INTEL_PINEVIEW_IDS(gen3_stolen_size), 354 INTEL_PINEVIEW_IDS(&gen3_stolen_funcs),
336 INTEL_I965G_IDS(gen3_stolen_size), 355 INTEL_I965G_IDS(&gen3_stolen_funcs),
337 INTEL_G33_IDS(gen3_stolen_size), 356 INTEL_G33_IDS(&gen3_stolen_funcs),
338 INTEL_I965GM_IDS(gen3_stolen_size), 357 INTEL_I965GM_IDS(&gen3_stolen_funcs),
339 INTEL_GM45_IDS(gen3_stolen_size), 358 INTEL_GM45_IDS(&gen3_stolen_funcs),
340 INTEL_G45_IDS(gen3_stolen_size), 359 INTEL_G45_IDS(&gen3_stolen_funcs),
341 INTEL_IRONLAKE_D_IDS(gen3_stolen_size), 360 INTEL_IRONLAKE_D_IDS(&gen3_stolen_funcs),
342 INTEL_IRONLAKE_M_IDS(gen3_stolen_size), 361 INTEL_IRONLAKE_M_IDS(&gen3_stolen_funcs),
343 INTEL_SNB_D_IDS(gen6_stolen_size), 362 INTEL_SNB_D_IDS(&gen6_stolen_funcs),
344 INTEL_SNB_M_IDS(gen6_stolen_size), 363 INTEL_SNB_M_IDS(&gen6_stolen_funcs),
345 INTEL_IVB_M_IDS(gen6_stolen_size), 364 INTEL_IVB_M_IDS(&gen6_stolen_funcs),
346 INTEL_IVB_D_IDS(gen6_stolen_size), 365 INTEL_IVB_D_IDS(&gen6_stolen_funcs),
347 INTEL_HSW_D_IDS(gen6_stolen_size), 366 INTEL_HSW_D_IDS(&gen6_stolen_funcs),
348 INTEL_HSW_M_IDS(gen6_stolen_size), 367 INTEL_HSW_M_IDS(&gen6_stolen_funcs),
349 INTEL_BDW_M_IDS(gen8_stolen_size), 368 INTEL_BDW_M_IDS(&gen8_stolen_funcs),
350 INTEL_BDW_D_IDS(gen8_stolen_size) 369 INTEL_BDW_D_IDS(&gen8_stolen_funcs)
351}; 370};
352 371
353static void __init intel_graphics_stolen(int num, int slot, int func) 372static void __init intel_graphics_stolen(int num, int slot, int func)
@@ -364,10 +383,10 @@ static void __init intel_graphics_stolen(int num, int slot, int func)
364 383
365 for (i = 0; i < ARRAY_SIZE(intel_stolen_ids); i++) { 384 for (i = 0; i < ARRAY_SIZE(intel_stolen_ids); i++) {
366 if (intel_stolen_ids[i].device == device) { 385 if (intel_stolen_ids[i].device == device) {
367 stolen_size_fn stolen_size = 386 const struct intel_stolen_funcs *stolen_funcs =
368 (stolen_size_fn)intel_stolen_ids[i].driver_data; 387 (const struct intel_stolen_funcs *)intel_stolen_ids[i].driver_data;
369 size = stolen_size(num, slot, func); 388 size = stolen_funcs->size(num, slot, func);
370 start = intel_stolen_base(num, slot, func); 389 start = stolen_funcs->base(num, slot, func, size);
371 if (size && start) { 390 if (size && start) {
372 /* Mark this space as reserved */ 391 /* Mark this space as reserved */
373 e820_add_region(start, size, E820_RESERVED); 392 e820_add_region(start, size, E820_RESERVED);