From: Jesse Barnes Subject: [PATCH 2/2] x86 early quirk: detect & reserve graphics stolen memory for Intel devices Date: Tue, 23 Jul 2013 14:15:57 -0700 Message-ID: <1374614157-8324-3-git-send-email-jbarnes@virtuousgeek.org> References: <1374614157-8324-1-git-send-email-jbarnes@virtuousgeek.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from oproxy6-pub.bluehost.com (oproxy6-pub.bluehost.com [67.222.54.6]) by gabe.freedesktop.org (Postfix) with SMTP id 557C2E5F2C for ; Tue, 23 Jul 2013 14:16:18 -0700 (PDT) Received: from [67.161.37.189] (port=59674 helo=localhost.localdomain) by box514.bluehost.com with esmtpsa (TLSv1:CAMELLIA256-SHA:256) (Exim 4.80) (envelope-from ) id 1V1jwA-0001OB-EY for intel-gfx@lists.freedesktop.org; Tue, 23 Jul 2013 15:16:02 -0600 In-Reply-To: <1374614157-8324-1-git-send-email-jbarnes@virtuousgeek.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org We need to do this early on before the E820 map is modified or conflicting resources assigned on top. --- arch/x86/kernel/early-quirks.c | 91 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c index 94ab6b9..6017e45 100644 --- a/arch/x86/kernel/early-quirks.c +++ b/arch/x86/kernel/early-quirks.c @@ -208,6 +208,95 @@ static void __init intel_remapping_check(int num, int slot, int func) } +static const struct pci_device_id gen3_method_ids[] = { + INTEL_I830_IDS(NULL), + INTEL_I845G_IDS(NULL), + INTEL_I85X_IDS(NULL), + INTEL_I865G_IDS(NULL), + INTEL_I915G_IDS(NULL), + INTEL_I915GM_IDS(NULL), + INTEL_I945G_IDS(NULL), + INTEL_I945GM_IDS(NULL), + INTEL_VLV_M_IDS(NULL), + INTEL_VLV_D_IDS(NULL), + INTEL_PINEVIEW_IDS(NULL), +}; +static const struct pci_device_id gen4_method_ids[] = { + INTEL_I965G_IDS(NULL), + INTEL_G33_IDS(NULL), + INTEL_I965GM_IDS(NULL), + INTEL_GM45_IDS(NULL), + INTEL_G45_IDS(NULL), + INTEL_IRONLAKE_D_IDS(NULL), + INTEL_IRONLAKE_M_IDS(NULL), +}; +static const struct pci_device_id gen6_method_ids[] = { + INTEL_SNB_D_IDS(NULL), + INTEL_SNB_M_IDS(NULL), + INTEL_IVB_M_IDS(NULL), + INTEL_IVB_D_IDS(NULL), + INTEL_IVB_Q_IDS(NULL), + INTEL_HSW_D_IDS(NULL), + INTEL_HSW_M_IDS(NULL), +}; + +static void __init intel_gen3_method(int num, int slot, int func, + u32 *start, size_t *size) +{ +} + +static void __init intel_gen4_method(int num, int slot, int func, + u32 *start, size_t *size) +{ +} + +static void __init intel_gen6_method(int num, int slot, int func, + u32 *start, size_t *size) +{ +} + +static void __init intel_graphics_stolen(int num, int slot, int func) +{ + size_t size; + int i; + u32 start; + u16 device, subvendor, subdevice; + + device = read_pci_config_word(num, slot, func, PCI_DEVICE_ID); + subvendor = read_pci_config_word(num, slot, func, PCI_SUBVENDOR_ID); + subdevice = read_pci_config_word(num, slot, func, PCI_SUBDEVICE_ID); + + for (i = 0; i < ARRAY_SIZE(gen3_method_ids); i++) { + if (gen3_method_ids[i].device == device) { + intel_gen3_method(num, slot, func, &start, &size); + goto found; + } + } + + for (i = 0; i < ARRAY_SIZE(gen4_method_ids); i++) { + if (gen4_method_ids[i].device == device) { + intel_gen4_method(num, slot, func, &start, &size); + goto found; + } + } + + for (i = 0; i < ARRAY_SIZE(gen6_method_ids); i++) { + if (gen6_method_ids[i].device == device && + (gen6_method_ids[i].subvendor == PCI_ANY_ID || + gen6_method_ids[i].subvendor == subvendor) && + (gen6_method_ids[i].subdevice == PCI_ANY_ID || + gen6_method_ids[i].subdevce == subdevice)) { + intel_gen6_method(num, slot, func, &start, &size); + goto found; + } + } + + /* No match, don't bother reserving */ + return; +found: + /* Mark this space as reserved */ +} + #define QFLAG_APPLY_ONCE 0x1 #define QFLAG_APPLIED 0x2 #define QFLAG_DONE (QFLAG_APPLY_ONCE|QFLAG_APPLIED) @@ -241,6 +330,8 @@ static struct chipset early_qrk[] __initdata = { PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, { PCI_VENDOR_ID_INTEL, 0x3406, PCI_CLASS_BRIDGE_HOST, PCI_BASE_CLASS_BRIDGE, 0, intel_remapping_check }, + { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, PCI_CLASS_DISPLAY, PCI_ANY_ID, + QFLAG_APPLY_ONCE, intel_graphics_stolen } {} }; -- 1.7.9.5