From patchwork Thu Jul 4 12:25:04 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 2823121 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id BCC8DBF4A1 for ; Thu, 4 Jul 2013 12:30:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD25520171 for ; Thu, 4 Jul 2013 12:30:30 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id A628020169 for ; Thu, 4 Jul 2013 12:30:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 922DBE66C6 for ; Thu, 4 Jul 2013 05:30:28 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f51.google.com (mail-ee0-f51.google.com [74.125.83.51]) by gabe.freedesktop.org (Postfix) with ESMTP id EB32DE6685 for ; Thu, 4 Jul 2013 05:26:30 -0700 (PDT) Received: by mail-ee0-f51.google.com with SMTP id e52so742181eek.24 for ; Thu, 04 Jul 2013 05:26:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=BChY9GwbfWYbWaaQUSdWsFqthnWR6tn75oI4lCssEVw=; b=hUMgziUBaShGXpRiIbe1StTW9Lc1jJMhFi9ooB3TnBYIi0CXmopGizp1H6C/qr9nDR CleFH3bsBYQkdZFnlJBppjiJPdz3ux/XA0ZSdxVOWwm9P7I4Dx3eyW2mPMxGILvtBvky KZvc9fRQETjh8K2TJWkqnsid8ldWQ5aE/w7LZD1bPk8Hmx/YCaFkvgAabx3muhGKDrVp XjezncsCFtIz1AwR0YWBkSt0d1Hl51RHGEgAlc8vRMyo3krNiIV9Sl7jQm7NbfZPO9Y3 LCrINCpTrlbZOhHAybxdJ1aAU/gbqXV4pw75+K8Yyq+d2BxDKbxrbDsHtLEenjTl2gqg EFTw== X-Received: by 10.14.101.13 with SMTP id a13mr6556289eeg.86.1372940789959; Thu, 04 Jul 2013 05:26:29 -0700 (PDT) Received: from localhost.localdomain (stgt-5f718597.pool.mediaWays.net. [95.113.133.151]) by mx.google.com with ESMTPSA id n5sm4678843eed.9.2013.07.04.05.26.28 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Jul 2013 05:26:29 -0700 (PDT) From: David Herrmann To: linux-kernel@vger.kernel.org Subject: [PATCH v2 04/14] x86: sysfb: move EFI quirks from efifb to sysfb Date: Thu, 4 Jul 2013 14:25:04 +0200 Message-Id: <1372940714-12470-5-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1372940714-12470-1-git-send-email-dh.herrmann@gmail.com> References: <1372940714-12470-1-git-send-email-dh.herrmann@gmail.com> Cc: x86@kernel.org, dri-devel@lists.freedesktop.org, Peter Jones , "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The EFI FB quirks from efifb.c are useful for simple-framebuffer devices as well. Apply them by default so we can convert efifb.c to use efi-framebuffer platform devices. Signed-off-by: David Herrmann --- arch/x86/include/asm/sysfb.h | 57 +++++++++++ arch/x86/kernel/Makefile | 1 + arch/x86/kernel/sysfb.c | 3 + arch/x86/kernel/sysfb_efi.c | 214 +++++++++++++++++++++++++++++++++++++++ drivers/video/efifb.c | 234 ++----------------------------------------- 5 files changed, 282 insertions(+), 227 deletions(-) create mode 100644 arch/x86/kernel/sysfb_efi.c diff --git a/arch/x86/include/asm/sysfb.h b/arch/x86/include/asm/sysfb.h index 2395fe0..2aeb3e2 100644 --- a/arch/x86/include/asm/sysfb.h +++ b/arch/x86/include/asm/sysfb.h @@ -15,6 +15,63 @@ #include #include +enum { + M_I17, /* 17-Inch iMac */ + M_I20, /* 20-Inch iMac */ + M_I20_SR, /* 20-Inch iMac (Santa Rosa) */ + M_I24, /* 24-Inch iMac */ + M_I24_8_1, /* 24-Inch iMac, 8,1th gen */ + M_I24_10_1, /* 24-Inch iMac, 10,1th gen */ + M_I27_11_1, /* 27-Inch iMac, 11,1th gen */ + M_MINI, /* Mac Mini */ + M_MINI_3_1, /* Mac Mini, 3,1th gen */ + M_MINI_4_1, /* Mac Mini, 4,1th gen */ + M_MB, /* MacBook */ + M_MB_2, /* MacBook, 2nd rev. */ + M_MB_3, /* MacBook, 3rd rev. */ + M_MB_5_1, /* MacBook, 5th rev. */ + M_MB_6_1, /* MacBook, 6th rev. */ + M_MB_7_1, /* MacBook, 7th rev. */ + M_MB_SR, /* MacBook, 2nd gen, (Santa Rosa) */ + M_MBA, /* MacBook Air */ + M_MBA_3, /* Macbook Air, 3rd rev */ + M_MBP, /* MacBook Pro */ + M_MBP_2, /* MacBook Pro 2nd gen */ + M_MBP_2_2, /* MacBook Pro 2,2nd gen */ + M_MBP_SR, /* MacBook Pro (Santa Rosa) */ + M_MBP_4, /* MacBook Pro, 4th gen */ + M_MBP_5_1, /* MacBook Pro, 5,1th gen */ + M_MBP_5_2, /* MacBook Pro, 5,2th gen */ + M_MBP_5_3, /* MacBook Pro, 5,3rd gen */ + M_MBP_6_1, /* MacBook Pro, 6,1th gen */ + M_MBP_6_2, /* MacBook Pro, 6,2th gen */ + M_MBP_7_1, /* MacBook Pro, 7,1th gen */ + M_MBP_8_2, /* MacBook Pro, 8,2nd gen */ + M_UNKNOWN /* placeholder */ +}; + +struct efifb_dmi_info { + char *optname; + unsigned long base; + int stride; + int width; + int height; + int flags; +}; + +#ifdef CONFIG_EFI + +extern struct efifb_dmi_info efifb_dmi_list[]; +void sysfb_apply_efi_quirks(void); + +#else /* CONFIG_EFI */ + +static inline void sysfb_apply_efi_quirks(void) +{ +} + +#endif /* CONFIG_EFI */ + #ifdef CONFIG_X86_SYSFB bool parse_mode(const struct screen_info *si, diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile index c5e7677..66c87da 100644 --- a/arch/x86/kernel/Makefile +++ b/arch/x86/kernel/Makefile @@ -102,6 +102,7 @@ obj-$(CONFIG_OF) += devicetree.o obj-$(CONFIG_UPROBES) += uprobes.o obj-y += sysfb.o obj-$(CONFIG_X86_SYSFB) += sysfb_simplefb.o +obj-$(CONFIG_EFI) += sysfb_efi.o obj-$(CONFIG_PERF_EVENTS) += perf_regs.o diff --git a/arch/x86/kernel/sysfb.c b/arch/x86/kernel/sysfb.c index 7f30e19..193ec2c 100644 --- a/arch/x86/kernel/sysfb.c +++ b/arch/x86/kernel/sysfb.c @@ -47,6 +47,8 @@ static __init int sysfb_init(void) bool compatible; int ret; + sysfb_apply_efi_quirks(); + /* try to create a simple-framebuffer device */ compatible = parse_mode(si, &mode); if (compatible) { @@ -68,4 +70,5 @@ static __init int sysfb_init(void) return IS_ERR(pd) ? PTR_ERR(pd) : 0; } +/* must execute after PCI subsystem for EFI quirks */ device_initcall(sysfb_init); diff --git a/arch/x86/kernel/sysfb_efi.c b/arch/x86/kernel/sysfb_efi.c new file mode 100644 index 0000000..b285d4e --- /dev/null +++ b/arch/x86/kernel/sysfb_efi.c @@ -0,0 +1,214 @@ +/* + * Generic System Framebuffers on x86 + * Copyright (c) 2012-2013 David Herrmann + * + * EFI Quirks Copyright (c) 2006 Edgar Hucek + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + */ + +/* + * EFI Quirks + * Several EFI systems do not correctly advertise their boot framebuffers. + * Hence, we use this static table of known broken machines and fix up the + * information so framebuffer drivers can load corectly. + */ + +#include +#include +#include +#include +#include +#include +#include +#include