By giving the stolen a region a unique type and name, we then insert it
into the iomem_resource as a known resource. This clear identifies it to
the user when printing the e820 map (and later the iomem resources), and
exposes it to the driver for later use.

v2: Also need to add the string to a second id-to-name switch

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Cc: Jesse Barnes <jbar...@virtuousgeek.org>
---
 arch/x86/include/uapi/asm/e820.h |  2 ++
 arch/x86/kernel/e820.c           |  5 +++++
 arch/x86/kernel/early-quirks.c   | 12 ++----------
 3 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/arch/x86/include/uapi/asm/e820.h b/arch/x86/include/uapi/asm/e820.h
index bbae024..72384ce 100644
--- a/arch/x86/include/uapi/asm/e820.h
+++ b/arch/x86/include/uapi/asm/e820.h
@@ -38,6 +38,8 @@
 #define E820_NVS       4
 #define E820_UNUSABLE  5
 
+#define E820_STOLEN_IGFX 6
+#define E820_STOLEN_IGFX_STRING "Intel Graphics Stolen"
 
 /*
  * reserved RAM used by kernel itself
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index d32abea..3918f4d3 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -149,6 +149,10 @@ static void __init e820_print_type(u32 type)
        case E820_UNUSABLE:
                printk(KERN_CONT "unusable");
                break;
+
+       case E820_STOLEN_IGFX:
+               printk(KERN_CONT E820_STOLEN_IGFX_STRING);
+               break;
        default:
                printk(KERN_CONT "type %u", type);
                break;
@@ -915,6 +919,7 @@ static inline const char *e820_type_to_string(int e820_type)
        case E820_ACPI: return "ACPI Tables";
        case E820_NVS:  return "ACPI Non-volatile Storage";
        case E820_UNUSABLE:     return "Unusable memory";
+       case E820_STOLEN_IGFX: return E820_STOLEN_IGFX_STRING;
        default:        return "reserved";
        }
 }
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index bff8a6f..27b6d17 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -350,18 +350,10 @@ static void __init intel_graphics_stolen(int num, int 
slot, int func)
                        size = stolen_size(num, slot, func);
                        start = intel_stolen_base(num, slot, func);
                        if (size && start)
-                               goto found;
-                       else
-                               break;
+                               e820_add_region(start, size, E820_STOLEN_IGFX);
+                       return;
                }
        }
-
-       /* No match or invalid data, don't bother reserving */
-       return;
-found:
-       /* Mark this space as reserved */
-       e820_add_region(start, size, E820_RESERVED);
-       return;
 }
 
 #define QFLAG_APPLY_ONCE       0x1
-- 
1.8.3.2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to